mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-25 19:07:45 +00:00
a couple of name changes and new functionality in lyxvc and vc-backend
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@302 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
a94cb21697
commit
3660343dc7
450
src/BufferView.C
450
src/BufferView.C
File diff suppressed because it is too large
Load Diff
@ -30,11 +30,11 @@ public:
|
|||||||
///
|
///
|
||||||
BufferView(LyXView *owner, int ,int ,int, int);
|
BufferView(LyXView *owner, int ,int ,int, int);
|
||||||
///
|
///
|
||||||
Buffer *currentBuffer() { return _buffer; }
|
Buffer * buffer() const { return buffer_; }
|
||||||
///
|
///
|
||||||
FL_OBJECT *getWorkArea() { return work_area; }
|
FL_OBJECT * getWorkArea() { return work_area; }
|
||||||
///
|
///
|
||||||
void setBuffer(Buffer *b);
|
void buffer(Buffer * b);
|
||||||
///
|
///
|
||||||
void resize();
|
void resize();
|
||||||
///
|
///
|
||||||
@ -58,9 +58,9 @@ public:
|
|||||||
///
|
///
|
||||||
bool available() const;
|
bool available() const;
|
||||||
///
|
///
|
||||||
LyXView *getOwner() { return _owner; }
|
LyXView * owner() const { return owner_; }
|
||||||
///
|
///
|
||||||
LyXScreen *getScreen()
|
LyXScreen * getScreen()
|
||||||
{
|
{
|
||||||
fl_set_timer(timer_cursor, 0.4);
|
fl_set_timer(timer_cursor, 0.4);
|
||||||
return screen;
|
return screen;
|
||||||
@ -77,7 +77,7 @@ private:
|
|||||||
///
|
///
|
||||||
void create_view(int, int, int, int);
|
void create_view(int, int, int, int);
|
||||||
///
|
///
|
||||||
Inset * checkInsetHit(int &x, int &y);
|
Inset * checkInsetHit(int & x, int & y);
|
||||||
///
|
///
|
||||||
int ScrollUp(long time);
|
int ScrollUp(long time);
|
||||||
///
|
///
|
||||||
@ -89,46 +89,46 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
/// A callback for the up arrow in the scrollbar.
|
/// A callback for the up arrow in the scrollbar.
|
||||||
static void UpCB(FL_OBJECT *ob, long);
|
static void UpCB(FL_OBJECT * ob, long);
|
||||||
|
|
||||||
/// A callback for the slider in the scrollbar.
|
/// A callback for the slider in the scrollbar.
|
||||||
static void ScrollCB(FL_OBJECT *ob, long);
|
static void ScrollCB(FL_OBJECT * ob, long);
|
||||||
|
|
||||||
/// A callback for the down arrow in the scrollbar.
|
/// A callback for the down arrow in the scrollbar.
|
||||||
static void DownCB(FL_OBJECT *ob, long);
|
static void DownCB(FL_OBJECT * ob, long);
|
||||||
|
|
||||||
///
|
///
|
||||||
static void CursorToggleCB(FL_OBJECT *ob, long);
|
static void CursorToggleCB(FL_OBJECT * ob, long);
|
||||||
/** Work area free object handler
|
/** Work area free object handler
|
||||||
*/
|
*/
|
||||||
static int work_area_handler(FL_OBJECT *, int event,
|
static int work_area_handler(FL_OBJECT *, int event,
|
||||||
FL_Coord, FL_Coord, int key, void *xev);
|
FL_Coord, FL_Coord, int key, void *xev);
|
||||||
private:
|
private:
|
||||||
///
|
///
|
||||||
int WorkAreaMotionNotify(FL_OBJECT *ob,
|
int WorkAreaMotionNotify(FL_OBJECT * ob,
|
||||||
Window win,
|
Window win,
|
||||||
int w, int h,
|
int w, int h,
|
||||||
XEvent *ev, void *d);
|
XEvent * ev, void * d);
|
||||||
///
|
///
|
||||||
int WorkAreaSelectionNotify(FL_OBJECT *, Window win,
|
int WorkAreaSelectionNotify(FL_OBJECT *, Window win,
|
||||||
int /*w*/, int /*h*/,
|
int /*w*/, int /*h*/,
|
||||||
XEvent *event, void */*d*/);
|
XEvent * event, void * /*d*/);
|
||||||
///
|
///
|
||||||
int WorkAreaButtonPress(FL_OBJECT *ob,
|
int WorkAreaButtonPress(FL_OBJECT * ob,
|
||||||
Window win,
|
Window win,
|
||||||
int w, int h,
|
int w, int h,
|
||||||
XEvent *ev, void *d);
|
XEvent * ev, void * d);
|
||||||
///
|
///
|
||||||
int WorkAreaButtonRelease(FL_OBJECT *ob,
|
int WorkAreaButtonRelease(FL_OBJECT * ob,
|
||||||
Window win,
|
Window win,
|
||||||
int w, int h,
|
int w, int h,
|
||||||
XEvent *ev, void *d);
|
XEvent * ev, void * d);
|
||||||
///
|
///
|
||||||
LyXView *_owner;
|
LyXView * owner_;
|
||||||
///
|
///
|
||||||
Buffer *_buffer;
|
Buffer * buffer_;
|
||||||
///
|
///
|
||||||
LyXScreen *screen;
|
LyXScreen * screen;
|
||||||
///
|
///
|
||||||
long current_scrollbar_value;
|
long current_scrollbar_value;
|
||||||
///
|
///
|
||||||
@ -138,17 +138,17 @@ private:
|
|||||||
///
|
///
|
||||||
bool work_area_focus;
|
bool work_area_focus;
|
||||||
///
|
///
|
||||||
FL_OBJECT *work_area;
|
FL_OBJECT * work_area;
|
||||||
///
|
///
|
||||||
FL_OBJECT *figinset_canvas;
|
FL_OBJECT * figinset_canvas;
|
||||||
///
|
///
|
||||||
FL_OBJECT *scrollbar;
|
FL_OBJECT * scrollbar;
|
||||||
///
|
///
|
||||||
FL_OBJECT *button_down;
|
FL_OBJECT * button_down;
|
||||||
///
|
///
|
||||||
FL_OBJECT *button_up;
|
FL_OBJECT * button_up;
|
||||||
///
|
///
|
||||||
FL_OBJECT *timer_cursor;
|
FL_OBJECT * timer_cursor;
|
||||||
///
|
///
|
||||||
BackStack backstack;
|
BackStack backstack;
|
||||||
///
|
///
|
||||||
|
@ -196,14 +196,14 @@ void FontLoader::getFontinfo(LyXFont::FONT_FAMILY family,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Do load font
|
/// Do load font
|
||||||
XFontStruct* FontLoader::doLoad(LyXFont::FONT_FAMILY family,
|
XFontStruct * FontLoader::doLoad(LyXFont::FONT_FAMILY family,
|
||||||
LyXFont::FONT_SERIES series,
|
LyXFont::FONT_SERIES series,
|
||||||
LyXFont::FONT_SHAPE shape,
|
LyXFont::FONT_SHAPE shape,
|
||||||
LyXFont::FONT_SIZE size)
|
LyXFont::FONT_SIZE size)
|
||||||
{
|
{
|
||||||
getFontinfo(family,series,shape);
|
getFontinfo(family,series,shape);
|
||||||
int fsize = (int) ( (lyxrc->font_sizes[size] * lyxrc->dpi *
|
int fsize = int( (lyxrc->font_sizes[size] * lyxrc->dpi *
|
||||||
(lyxrc->zoom/100.0) ) / 72.27 + 0.5 );
|
(lyxrc->zoom/100.0) ) / 72.27 + 0.5 );
|
||||||
|
|
||||||
string font = fontinfo[family][series][shape]->getFontname(fsize);
|
string font = fontinfo[family][series][shape]->getFontname(fsize);
|
||||||
|
|
||||||
@ -216,10 +216,10 @@ XFontStruct* FontLoader::doLoad(LyXFont::FONT_FAMILY family,
|
|||||||
minibuffer->Store();
|
minibuffer->Store();
|
||||||
minibuffer->Set(_("Loading font into X-Server..."));
|
minibuffer->Set(_("Loading font into X-Server..."));
|
||||||
|
|
||||||
XFontStruct* fs = XLoadQueryFont(fl_display, font.c_str());
|
XFontStruct * fs = XLoadQueryFont(fl_display, font.c_str());
|
||||||
|
|
||||||
if (fs == 0) {
|
if (fs == 0) {
|
||||||
if (font=="fixed") {
|
if (font == "fixed") {
|
||||||
lyxerr << "We're doomed. Can't get 'fixed' font." << endl;
|
lyxerr << "We're doomed. Can't get 'fixed' font." << endl;
|
||||||
} else {
|
} else {
|
||||||
lyxerr << "Could not get font. Using 'fixed'." << endl;
|
lyxerr << "Could not get font. Using 'fixed'." << endl;
|
||||||
|
@ -7,7 +7,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>
|
||||||
|
|
||||||
@ -25,7 +25,8 @@
|
|||||||
|
|
||||||
extern LyXRC * lyxrc;
|
extern LyXRC * lyxrc;
|
||||||
|
|
||||||
LaTeXFeatures::LaTeXFeatures(int n)
|
LaTeXFeatures::LaTeXFeatures(int n)
|
||||||
|
: layout(n, false)
|
||||||
{
|
{
|
||||||
// packages
|
// packages
|
||||||
color = false;
|
color = false;
|
||||||
@ -66,15 +67,10 @@ LaTeXFeatures::LaTeXFeatures(int n)
|
|||||||
LyXParagraphIndent = false;
|
LyXParagraphIndent = false;
|
||||||
NeedLyXFootnoteCode = false;
|
NeedLyXFootnoteCode = false;
|
||||||
NeedLyXMinipageIndent = false;
|
NeedLyXMinipageIndent = false;
|
||||||
|
|
||||||
// layouts
|
|
||||||
layout = new bool[n];
|
|
||||||
for (int i = n; i--;)
|
|
||||||
layout[i] = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
string LaTeXFeatures::getPackages(BufferParams const ¶ms)
|
string LaTeXFeatures::getPackages(BufferParams const & params)
|
||||||
{
|
{
|
||||||
string packages;
|
string packages;
|
||||||
LyXTextClass const & tclass = textclasslist.TextClass(params.textclass);
|
LyXTextClass const & tclass = textclasslist.TextClass(params.textclass);
|
||||||
@ -232,9 +228,10 @@ string LaTeXFeatures::getTClassPreamble(BufferParams const & params)
|
|||||||
LyXTextClass const & tclass = textclasslist.TextClass(params.textclass);
|
LyXTextClass const & tclass = textclasslist.TextClass(params.textclass);
|
||||||
string tcpreamble = tclass.preamble();
|
string tcpreamble = tclass.preamble();
|
||||||
|
|
||||||
for (LyXTextClass::LayoutList::const_iterator cit = tclass.begin();
|
for (unsigned int i = 0; i < tclass.numLayouts(); ++i) {
|
||||||
cit != tclass.end(); ++cit) {
|
if (layout[i]) {
|
||||||
tcpreamble += (*cit).preamble();
|
tcpreamble += tclass[i].preamble();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return tcpreamble;
|
return tcpreamble;
|
||||||
|
@ -17,6 +17,8 @@
|
|||||||
#pragma interface
|
#pragma interface
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#include "LString.h"
|
#include "LString.h"
|
||||||
|
|
||||||
class BufferParams;
|
class BufferParams;
|
||||||
@ -31,10 +33,6 @@ class LyXTextClass;
|
|||||||
struct LaTeXFeatures {
|
struct LaTeXFeatures {
|
||||||
///
|
///
|
||||||
LaTeXFeatures(int n) ;
|
LaTeXFeatures(int n) ;
|
||||||
///
|
|
||||||
~LaTeXFeatures() {
|
|
||||||
delete[] layout;
|
|
||||||
}
|
|
||||||
/// The packaes needed by the document
|
/// The packaes needed by the document
|
||||||
string getPackages(BufferParams const ¶ms);
|
string getPackages(BufferParams const ¶ms);
|
||||||
/// The macros definitions needed by the document
|
/// The macros definitions needed by the document
|
||||||
@ -118,7 +116,7 @@ struct LaTeXFeatures {
|
|||||||
|
|
||||||
//@Man: Layouts
|
//@Man: Layouts
|
||||||
//@{
|
//@{
|
||||||
bool *layout;
|
vector<bool> layout;
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
//@Man: Special features
|
//@Man: Special features
|
||||||
|
@ -22,14 +22,14 @@ void ShowLatexLog()
|
|||||||
bool use_build = false;
|
bool use_build = false;
|
||||||
static int ow = -1, oh;
|
static int ow = -1, oh;
|
||||||
|
|
||||||
filename = current_view->currentBuffer()->getFileName();
|
filename = current_view->buffer()->getFileName();
|
||||||
if (!filename.empty()) {
|
if (!filename.empty()) {
|
||||||
fname = SpaceLess(ChangeExtension(filename, ".log", true));
|
fname = SpaceLess(ChangeExtension(filename, ".log", true));
|
||||||
bname = SpaceLess(ChangeExtension(filename,
|
bname = SpaceLess(ChangeExtension(filename,
|
||||||
lyxrc->literate_extension + ".out", true));
|
lyxrc->literate_extension + ".out", true));
|
||||||
path = OnlyPath(filename);
|
path = OnlyPath(filename);
|
||||||
if (lyxrc->use_tempdir || (IsDirWriteable(path) < 1)) {
|
if (lyxrc->use_tempdir || (IsDirWriteable(path) < 1)) {
|
||||||
path = current_view->currentBuffer()->tmppath;
|
path = current_view->buffer()->tmppath;
|
||||||
}
|
}
|
||||||
FileInfo f_fi(path + fname), b_fi(path + bname);
|
FileInfo f_fi(path + fname), b_fi(path + bname);
|
||||||
if (b_fi.exist())
|
if (b_fi.exist())
|
||||||
|
@ -52,7 +52,7 @@ void SendtoApplyCB(FL_OBJECT *, long)
|
|||||||
string command = fl_get_input(fd_form_sendto->input_cmd);
|
string command = fl_get_input(fd_form_sendto->input_cmd);
|
||||||
if (command.empty())
|
if (command.empty())
|
||||||
return;
|
return;
|
||||||
Buffer *buffer = current_view->currentBuffer();
|
Buffer * buffer = current_view->buffer();
|
||||||
if (fl_get_button(fd_form_sendto->radio_ftype_dvi) ||
|
if (fl_get_button(fd_form_sendto->radio_ftype_dvi) ||
|
||||||
fl_get_button(fd_form_sendto->radio_ftype_ps)) {
|
fl_get_button(fd_form_sendto->radio_ftype_ps)) {
|
||||||
ProhibitInput();
|
ProhibitInput();
|
||||||
|
@ -31,11 +31,11 @@
|
|||||||
#include "layout.h"
|
#include "layout.h"
|
||||||
#include "lyxtext.h"
|
#include "lyxtext.h"
|
||||||
|
|
||||||
extern FD_form_document *fd_form_document;
|
extern FD_form_document * fd_form_document;
|
||||||
FD_form_main *fd_form_main; /* a pointer to the one in LyXView
|
FD_form_main * fd_form_main; /* a pointer to the one in LyXView
|
||||||
should be removed as soon as possible */
|
should be removed as soon as possible */
|
||||||
|
|
||||||
MiniBuffer *minibuffer;/* a pointer to the one in LyXView
|
MiniBuffer * minibuffer;/* a pointer to the one in LyXView
|
||||||
should be removed as soon as possible */
|
should be removed as soon as possible */
|
||||||
|
|
||||||
extern void AutoSave();
|
extern void AutoSave();
|
||||||
@ -44,7 +44,7 @@ extern void QuitLyX();
|
|||||||
int current_layout = 0;
|
int current_layout = 0;
|
||||||
|
|
||||||
// This is very temporary
|
// This is very temporary
|
||||||
BufferView *current_view;
|
BufferView * current_view;
|
||||||
|
|
||||||
extern "C" int C_LyXView_atCloseMainFormCB(FL_FORM *, void *);
|
extern "C" int C_LyXView_atCloseMainFormCB(FL_FORM *, void *);
|
||||||
|
|
||||||
@ -52,7 +52,7 @@ LyXView::LyXView(int width, int height)
|
|||||||
{
|
{
|
||||||
fd_form_main = create_form_form_main(width,height);
|
fd_form_main = create_form_form_main(width,height);
|
||||||
fl_set_form_atclose(_form, C_LyXView_atCloseMainFormCB, 0);
|
fl_set_form_atclose(_form, C_LyXView_atCloseMainFormCB, 0);
|
||||||
lyxerr.debug() << "Initializing LyXFunc" << endl;
|
lyxerr[Debug::INIT] << "Initializing LyXFunc" << endl;
|
||||||
lyxfunc = new LyXFunc(this);
|
lyxfunc = new LyXFunc(this);
|
||||||
intl = new Intl;
|
intl = new Intl;
|
||||||
}
|
}
|
||||||
@ -70,31 +70,31 @@ LyXView::~LyXView()
|
|||||||
|
|
||||||
/// Redraw the main form.
|
/// Redraw the main form.
|
||||||
void LyXView::redraw() {
|
void LyXView::redraw() {
|
||||||
lyxerr.debug() << "LyXView::redraw()" << endl;
|
lyxerr[Debug::INFO] << "LyXView::redraw()" << endl;
|
||||||
fl_redraw_form(_form);
|
fl_redraw_form(_form);
|
||||||
minibuffer->Activate();
|
minibuffer->Activate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Callback for update timer
|
// Callback for update timer
|
||||||
void LyXView::UpdateTimerCB(FL_OBJECT *ob, long)
|
void LyXView::UpdateTimerCB(FL_OBJECT * ob, long)
|
||||||
{
|
{
|
||||||
LyXView *view = (LyXView*) ob->u_vdata;
|
LyXView * view = static_cast<LyXView*>(ob->u_vdata);
|
||||||
if (!view->currentView()->available())
|
if (!view->currentView()->available())
|
||||||
return;
|
return;
|
||||||
if (!view->currentView()->getScreen() || !updatetimer)
|
if (!view->currentView()->getScreen() || !updatetimer)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
view->currentView()->getScreen()->HideCursor();
|
view->currentView()->getScreen()->HideCursor();
|
||||||
view->currentBuffer()->update(-2);
|
view->buffer()->update(-2);
|
||||||
/* This update can happen, even when the work area has lost
|
/* This update can happen, even when the work area has lost
|
||||||
* the focus. So suppress the cursor in that case */
|
* the focus. So suppress the cursor in that case */
|
||||||
updatetimer = 0;
|
updatetimer = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wrapper for the above
|
// Wrapper for the above
|
||||||
extern "C" void C_LyXView_UpdateTimerCB(FL_OBJECT *ob, long data) {
|
extern "C" void C_LyXView_UpdateTimerCB(FL_OBJECT * ob, long data) {
|
||||||
LyXView::UpdateTimerCB(ob,data);
|
LyXView::UpdateTimerCB(ob, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -102,12 +102,12 @@ extern "C" void C_LyXView_UpdateTimerCB(FL_OBJECT *ob, long data) {
|
|||||||
// Callback for autosave timer
|
// Callback for autosave timer
|
||||||
void LyXView::AutosaveTimerCB(FL_OBJECT *, long)
|
void LyXView::AutosaveTimerCB(FL_OBJECT *, long)
|
||||||
{
|
{
|
||||||
lyxerr.debug() << "Running AutoSave()" << endl;
|
lyxerr[Debug::INFO] << "Running AutoSave()" << endl;
|
||||||
AutoSave();
|
AutoSave();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wrapper for the above
|
// Wrapper for the above
|
||||||
extern "C" void C_LyXView_AutosaveTimerCB(FL_OBJECT *ob, long data) {
|
extern "C" void C_LyXView_AutosaveTimerCB(FL_OBJECT * ob, long data) {
|
||||||
LyXView::AutosaveTimerCB(ob, data);
|
LyXView::AutosaveTimerCB(ob, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -127,9 +127,10 @@ int LyXView::atCloseMainFormCB(FL_FORM *, void *)
|
|||||||
return FL_IGNORE;
|
return FL_IGNORE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Wrapper for the above
|
// Wrapper for the above
|
||||||
extern "C" int C_LyXView_atCloseMainFormCB(FL_FORM *form, void *p) {
|
extern "C" int C_LyXView_atCloseMainFormCB(FL_FORM * form, void * p) {
|
||||||
return LyXView::atCloseMainFormCB(form,p);
|
return LyXView::atCloseMainFormCB(form, p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -139,7 +140,7 @@ void LyXView::setPosition(int x, int y)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LyXView::show(int place, int border, char const* title)
|
void LyXView::show(int place, int border, char const * title)
|
||||||
{
|
{
|
||||||
fl_show_form(_form, place, border, title);
|
fl_show_form(_form, place, border, title);
|
||||||
minibuffer->Init();
|
minibuffer->Init();
|
||||||
@ -147,7 +148,7 @@ void LyXView::show(int place, int border, char const* title)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
FD_form_main *LyXView::create_form_form_main(int width, int height)
|
FD_form_main * LyXView::create_form_form_main(int width, int height)
|
||||||
/* to make this work as it should, .lyxrc should have been
|
/* to make this work as it should, .lyxrc should have been
|
||||||
* read first; OR maybe this one should be made dynamic.
|
* read first; OR maybe this one should be made dynamic.
|
||||||
* Hmmmm. Lgb.
|
* Hmmmm. Lgb.
|
||||||
@ -156,7 +157,7 @@ FD_form_main *LyXView::create_form_form_main(int width, int height)
|
|||||||
* are presented (and rightly so) in GUI popups. Asger.
|
* are presented (and rightly so) in GUI popups. Asger.
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
FL_OBJECT *obj;
|
FL_OBJECT * obj;
|
||||||
|
|
||||||
FD_form_main *fdui = (FD_form_main *)
|
FD_form_main *fdui = (FD_form_main *)
|
||||||
fl_calloc(1, sizeof(FD_form_main));
|
fl_calloc(1, sizeof(FD_form_main));
|
||||||
@ -165,9 +166,9 @@ FD_form_main *LyXView::create_form_form_main(int width, int height)
|
|||||||
|
|
||||||
// the main form
|
// the main form
|
||||||
_form = fdui->form_main = fl_bgn_form(FL_NO_BOX, width, height);
|
_form = fdui->form_main = fl_bgn_form(FL_NO_BOX, width, height);
|
||||||
fdui->form_main->u_vdata = (void*) this;
|
fdui->form_main->u_vdata = this;
|
||||||
obj = fl_add_box(FL_FLAT_BOX,0,0,width,height,"");
|
obj = fl_add_box(FL_FLAT_BOX, 0, 0, width, height, "");
|
||||||
fl_set_object_color(obj,FL_MCOL,FL_MCOL);
|
fl_set_object_color(obj, FL_MCOL, FL_MCOL);
|
||||||
|
|
||||||
// Parameters for the appearance of the main form
|
// Parameters for the appearance of the main form
|
||||||
const int air = 2;
|
const int air = 2;
|
||||||
@ -221,7 +222,7 @@ FD_form_main *LyXView::create_form_form_main(int width, int height)
|
|||||||
fdui->timer_update = obj = fl_add_timer(FL_HIDDEN_TIMER,
|
fdui->timer_update = obj = fl_add_timer(FL_HIDDEN_TIMER,
|
||||||
0,0,0,0,"Timer");
|
0,0,0,0,"Timer");
|
||||||
fl_set_object_callback(obj,C_LyXView_UpdateTimerCB,0);
|
fl_set_object_callback(obj,C_LyXView_UpdateTimerCB,0);
|
||||||
obj->u_vdata = (void*) this;
|
obj->u_vdata = this;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Misc
|
// Misc
|
||||||
@ -248,7 +249,7 @@ FD_form_main *LyXView::create_form_form_main(int width, int height)
|
|||||||
return fdui;
|
return fdui;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" int C_LyXView_KeyPressMask_raw_callback(FL_FORM *fl, void *xev);
|
extern "C" int C_LyXView_KeyPressMask_raw_callback(FL_FORM * fl, void * xev);
|
||||||
|
|
||||||
void LyXView::init()
|
void LyXView::init()
|
||||||
{
|
{
|
||||||
@ -283,7 +284,7 @@ void LyXView::updateLayoutChoice()
|
|||||||
|
|
||||||
// this has a bi-effect that the layouts are not showed when no
|
// this has a bi-effect that the layouts are not showed when no
|
||||||
// document is loaded.
|
// document is loaded.
|
||||||
if (bufferview==0 || bufferview->currentBuffer()==0) {
|
if (bufferview == 0 || bufferview->buffer()==0) {
|
||||||
toolbar->combox->clear();
|
toolbar->combox->clear();
|
||||||
toolbar->combox->Redraw();
|
toolbar->combox->Redraw();
|
||||||
return;
|
return;
|
||||||
@ -291,26 +292,26 @@ 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 != int(currentBuffer()->params.textclass))) {
|
(last_textclass != int(buffer()->params.textclass))) {
|
||||||
toolbar->combox->clear();
|
toolbar->combox->clear();
|
||||||
for (int i = 0;
|
for (int i = 0;
|
||||||
textclasslist.NameOfLayout(currentBuffer()->
|
textclasslist.NameOfLayout(buffer()->
|
||||||
params.textclass, i) !="@@end@@";
|
params.textclass, i) !="@@end@@";
|
||||||
i++) {
|
i++) {
|
||||||
LyXLayout const & layout = textclasslist.
|
LyXLayout const & layout = textclasslist.
|
||||||
Style(currentBuffer()->params.textclass, i);
|
Style(buffer()->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 = int(currentBuffer()->params.textclass);
|
last_textclass = int(buffer()->params.textclass);
|
||||||
current_layout = 0;
|
current_layout = 0;
|
||||||
}
|
}
|
||||||
// we need to do this.
|
// we need to do this.
|
||||||
toolbar->combox->Redraw();
|
toolbar->combox->Redraw();
|
||||||
|
|
||||||
char layout = currentBuffer()->text->cursor.par->GetLayout();
|
char layout = buffer()->text->cursor.par->GetLayout();
|
||||||
|
|
||||||
if (layout != current_layout){
|
if (layout != current_layout){
|
||||||
toolbar->combox->select(layout + 1);
|
toolbar->combox->select(layout + 1);
|
||||||
@ -321,7 +322,7 @@ void LyXView::updateLayoutChoice()
|
|||||||
|
|
||||||
void LyXView::UpdateDocumentClassChoice()
|
void LyXView::UpdateDocumentClassChoice()
|
||||||
{
|
{
|
||||||
/* update the document class display in the document form */
|
// update the document class display in the document form
|
||||||
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);
|
||||||
@ -337,38 +338,38 @@ void LyXView::UpdateDocumentClassChoice()
|
|||||||
// as FL_KEYBOARD events :-( Matthias 280596
|
// as FL_KEYBOARD events :-( Matthias 280596
|
||||||
int LyXView::KeyPressMask_raw_callback(FL_FORM *fl, void *xev)
|
int LyXView::KeyPressMask_raw_callback(FL_FORM *fl, void *xev)
|
||||||
{
|
{
|
||||||
LyXView *view = (LyXView*) fl->u_vdata;
|
LyXView * view = static_cast<LyXView*>(fl->u_vdata);
|
||||||
int retval = 0; // 0 means XForms should have a look at this event
|
int retval = 0; // 0 means XForms should have a look at this event
|
||||||
|
|
||||||
// funny. Even though the raw_callback is registered with KeyPressMask,
|
// funny. Even though the raw_callback is registered with KeyPressMask,
|
||||||
// also KeyRelease-events are passed through:-(
|
// also KeyRelease-events are passed through:-(
|
||||||
// [It seems that xforms puts them in pairs... (JMarc)]
|
// [It seems that xforms puts them in pairs... (JMarc)]
|
||||||
if (((XEvent*)xev)->type == KeyPress
|
if (static_cast<XEvent*>(xev)->type == KeyPress
|
||||||
&& view->bufferview->getWorkArea()->focus
|
&& view->bufferview->getWorkArea()->focus
|
||||||
&& view->bufferview->getWorkArea()->active)
|
&& view->bufferview->getWorkArea()->active)
|
||||||
retval = view->getLyXFunc()->processKeyEvent((XEvent*)xev);
|
retval = view->getLyXFunc()
|
||||||
|
->processKeyEvent(static_cast<XEvent*>(xev));
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
// wrapper for the above
|
// wrapper for the above
|
||||||
extern "C" int C_LyXView_KeyPressMask_raw_callback(FL_FORM *fl, void *xev)
|
extern "C" int C_LyXView_KeyPressMask_raw_callback(FL_FORM * fl, void * xev)
|
||||||
{
|
{
|
||||||
return LyXView::KeyPressMask_raw_callback(fl, xev);
|
return LyXView::KeyPressMask_raw_callback(fl, xev);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Updates the title of the window with the filename of the current document
|
// Updates the title of the window with the filename of the current document
|
||||||
void LyXView::updateWindowTitle() {
|
void LyXView::updateWindowTitle() {
|
||||||
static string last_title="LyX";
|
static string last_title = "LyX";
|
||||||
string title = "LyX";
|
string title = "LyX";
|
||||||
|
|
||||||
if (currentView()->available()) {
|
if (currentView()->available()) {
|
||||||
string cur_title = currentBuffer()->getFileName();
|
string cur_title = buffer()->getFileName();
|
||||||
if (!cur_title.empty()){
|
if (!cur_title.empty()){
|
||||||
title += ": " + OnlyFilename(cur_title);
|
title += ": " + OnlyFilename(cur_title);
|
||||||
if (!currentBuffer()->isLyxClean())
|
if (!buffer()->isLyxClean())
|
||||||
title += _(" (Changed)");
|
title += _(" (Changed)");
|
||||||
if (currentBuffer()->isReadonly())
|
if (buffer()->isReadonly())
|
||||||
title += _(" (read only)");
|
title += _(" (read only)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,13 +31,13 @@ class Intl;
|
|||||||
///
|
///
|
||||||
struct FD_form_main {
|
struct FD_form_main {
|
||||||
///
|
///
|
||||||
FL_FORM *form_main;
|
FL_FORM * form_main;
|
||||||
///
|
///
|
||||||
FL_OBJECT *timer_autosave;
|
FL_OBJECT * timer_autosave;
|
||||||
///
|
///
|
||||||
FL_OBJECT *timer_update;
|
FL_OBJECT * timer_update;
|
||||||
///
|
///
|
||||||
void *vdata;
|
void * vdata;
|
||||||
///
|
///
|
||||||
long ldata;
|
long ldata;
|
||||||
};
|
};
|
||||||
@ -70,7 +70,7 @@ 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 * buffer() const { return bufferview->buffer(); }
|
||||||
|
|
||||||
///
|
///
|
||||||
BufferView * currentView() { return bufferview; }
|
BufferView * currentView() { return bufferview; }
|
||||||
|
@ -168,6 +168,8 @@ lyx_SOURCES = \
|
|||||||
trans_mgr.C \
|
trans_mgr.C \
|
||||||
trans_mgr.h \
|
trans_mgr.h \
|
||||||
undo.h \
|
undo.h \
|
||||||
|
vc-backend.C \
|
||||||
|
vc-backend.h \
|
||||||
version.h \
|
version.h \
|
||||||
vms_defines.h \
|
vms_defines.h \
|
||||||
vspace.C \
|
vspace.C \
|
||||||
|
@ -112,7 +112,7 @@ bool UpdateLayoutPaper()
|
|||||||
update = false;
|
update = false;
|
||||||
|
|
||||||
if (update) {
|
if (update) {
|
||||||
BufferParams * params = ¤t_view->currentBuffer()->params;
|
BufferParams * params = ¤t_view->buffer()->params;
|
||||||
|
|
||||||
fl_set_choice(fd_form_paper->choice_papersize2,
|
fl_set_choice(fd_form_paper->choice_papersize2,
|
||||||
params->papersize2 + 1);
|
params->papersize2 + 1);
|
||||||
@ -148,7 +148,7 @@ bool UpdateLayoutPaper()
|
|||||||
fl_set_focus_object(fd_form_paper->form_paper,
|
fl_set_focus_object(fd_form_paper->form_paper,
|
||||||
fd_form_paper->choice_papersize2);
|
fd_form_paper->choice_papersize2);
|
||||||
fl_hide_object(fd_form_paper->text_warning);
|
fl_hide_object(fd_form_paper->text_warning);
|
||||||
if (current_view->currentBuffer()->isReadonly()) {
|
if (current_view->buffer()->isReadonly()) {
|
||||||
DisablePaperLayout();
|
DisablePaperLayout();
|
||||||
fl_set_object_label(fd_form_paper->text_warning,
|
fl_set_object_label(fd_form_paper->text_warning,
|
||||||
_("Document is read-only."
|
_("Document is read-only."
|
||||||
@ -184,7 +184,7 @@ 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->buffer()->params;
|
||||||
|
|
||||||
FD_form_paper const * fd = fd_form_paper;
|
FD_form_paper const * fd = fd_form_paper;
|
||||||
|
|
||||||
@ -204,9 +204,9 @@ void PaperApplyCB(FL_OBJECT *, long)
|
|||||||
params->headheight = fl_get_input(fd->input_head_height);
|
params->headheight = fl_get_input(fd->input_head_height);
|
||||||
params->headsep = fl_get_input(fd->input_head_sep);
|
params->headsep = fl_get_input(fd->input_head_sep);
|
||||||
params->footskip = fl_get_input(fd->input_foot_skip);
|
params->footskip = fl_get_input(fd->input_foot_skip);
|
||||||
current_view->currentBuffer()->setPaperStuff();
|
current_view->buffer()->setPaperStuff();
|
||||||
minibuffer->Set(_("Paper layout set"));
|
minibuffer->Set(_("Paper layout set"));
|
||||||
current_view->currentBuffer()->markDirty();
|
current_view->buffer()->markDirty();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -76,7 +76,7 @@ bool UpdateParagraphExtra()
|
|||||||
bool update = false;
|
bool update = false;
|
||||||
if (current_view->getScreen() && current_view->available()) {
|
if (current_view->getScreen() && current_view->available()) {
|
||||||
update = true;
|
update = true;
|
||||||
LyXParagraph* par = current_view->currentBuffer()->text->cursor.par;
|
LyXParagraph * par = current_view->buffer()->text->cursor.par;
|
||||||
|
|
||||||
EnableParagraphExtra();
|
EnableParagraphExtra();
|
||||||
|
|
||||||
@ -137,7 +137,7 @@ bool UpdateParagraphExtra()
|
|||||||
}
|
}
|
||||||
fl_hide_object(fd_form_paragraph_extra->text_warning);
|
fl_hide_object(fd_form_paragraph_extra->text_warning);
|
||||||
|
|
||||||
if (current_view->currentBuffer()->isReadonly()) {
|
if (current_view->buffer()->isReadonly()) {
|
||||||
DisableParagraphExtra();
|
DisableParagraphExtra();
|
||||||
fl_set_object_label(fd_form_paragraph_extra->text_warning,
|
fl_set_object_label(fd_form_paragraph_extra->text_warning,
|
||||||
_("Document is read-only. No changes to layout permitted."));
|
_("Document is read-only. No changes to layout permitted."));
|
||||||
@ -165,12 +165,10 @@ void ParagraphExtraOpen(FL_OBJECT *, long)
|
|||||||
void ParagraphExtraApplyCB(FL_OBJECT *, long)
|
void ParagraphExtraApplyCB(FL_OBJECT *, long)
|
||||||
{
|
{
|
||||||
if (current_view->getScreen() && current_view->available()) {
|
if (current_view->getScreen() && current_view->available()) {
|
||||||
const FD_form_paragraph_extra* fd = fd_form_paragraph_extra;
|
FD_form_paragraph_extra const * fd = fd_form_paragraph_extra;
|
||||||
const char
|
const char * width = fl_get_input(fd->input_pextra_width);
|
||||||
*width = fl_get_input(fd->input_pextra_width),
|
const char * widthp = fl_get_input(fd->input_pextra_widthp);
|
||||||
*widthp = fl_get_input(fd->input_pextra_widthp);
|
LyXText * text = current_view->buffer()->text;
|
||||||
LyXText
|
|
||||||
*text = current_view->currentBuffer()->text;
|
|
||||||
int type = PEXTRA_NONE;
|
int type = PEXTRA_NONE;
|
||||||
int alignment = 0;
|
int alignment = 0;
|
||||||
bool
|
bool
|
||||||
@ -195,7 +193,7 @@ 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->currentBuffer()->update(1);
|
current_view->buffer()->update(1);
|
||||||
minibuffer->Set(_("ParagraphExtra layout set"));
|
minibuffer->Set(_("ParagraphExtra layout set"));
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
@ -43,21 +43,20 @@ bool UpdateLayoutTable(int flag)
|
|||||||
if (!current_view->getScreen() || !current_view->available())
|
if (!current_view->getScreen() || !current_view->available())
|
||||||
update = false;
|
update = false;
|
||||||
|
|
||||||
if (update && current_view->currentBuffer()->text->cursor.par->table) {
|
if (update && current_view->buffer()->text->cursor.par->table) {
|
||||||
int
|
int
|
||||||
align,
|
align,
|
||||||
cell,
|
|
||||||
column,row;
|
column,row;
|
||||||
char
|
char
|
||||||
buf[12];
|
buf[12];
|
||||||
string
|
string
|
||||||
pwidth, special;
|
pwidth, special;
|
||||||
|
|
||||||
LyXTable *table = current_view->currentBuffer()->text->cursor.par->table;
|
LyXTable * table = current_view->buffer()->text->cursor.par->table;
|
||||||
|
|
||||||
cell = current_view->currentBuffer()->text->
|
int cell = current_view->buffer()->text->
|
||||||
NumberOfCell(current_view->currentBuffer()->text->cursor.par,
|
NumberOfCell(current_view->buffer()->text->cursor.par,
|
||||||
current_view->currentBuffer()->text->cursor.pos);
|
current_view->buffer()->text->cursor.pos);
|
||||||
ActCell = cell;
|
ActCell = cell;
|
||||||
column = table->column_of_cell(cell)+1;
|
column = table->column_of_cell(cell)+1;
|
||||||
fl_set_object_label(fd_form_table_options->text_warning,"");
|
fl_set_object_label(fd_form_table_options->text_warning,"");
|
||||||
@ -108,7 +107,7 @@ bool UpdateLayoutTable(int flag)
|
|||||||
fl_set_input_cursorpos(fd_form_table_extra->input_special_alignment,
|
fl_set_input_cursorpos(fd_form_table_extra->input_special_alignment,
|
||||||
extra_col_cursor_x, 0); // restore the cursor
|
extra_col_cursor_x, 0); // restore the cursor
|
||||||
}
|
}
|
||||||
if (current_view->currentBuffer()->isReadonly())
|
if (current_view->buffer()->isReadonly())
|
||||||
fl_deactivate_object(fd_form_table_extra->input_special_alignment);
|
fl_deactivate_object(fd_form_table_extra->input_special_alignment);
|
||||||
special = table->GetAlignSpecial(cell,LyXTable::SET_SPECIAL_MULTI);
|
special = table->GetAlignSpecial(cell,LyXTable::SET_SPECIAL_MULTI);
|
||||||
if (flag)
|
if (flag)
|
||||||
@ -118,12 +117,12 @@ bool UpdateLayoutTable(int flag)
|
|||||||
fl_set_input_cursorpos(fd_form_table_extra->input_special_multialign,
|
fl_set_input_cursorpos(fd_form_table_extra->input_special_multialign,
|
||||||
extra_multicol_cursor_x, 0); // restore the cursor
|
extra_multicol_cursor_x, 0); // restore the cursor
|
||||||
}
|
}
|
||||||
if (current_view->currentBuffer()->isReadonly())
|
if (current_view->buffer()->isReadonly())
|
||||||
fl_deactivate_object(fd_form_table_extra->input_special_multialign);
|
fl_deactivate_object(fd_form_table_extra->input_special_multialign);
|
||||||
pwidth = table->GetPWidth(cell);
|
pwidth = table->GetPWidth(cell);
|
||||||
if (flag)
|
if (flag)
|
||||||
fl_set_input(fd_form_table_options->input_column_width,pwidth.c_str());
|
fl_set_input(fd_form_table_options->input_column_width,pwidth.c_str());
|
||||||
if (current_view->currentBuffer()->isReadonly())
|
if (current_view->buffer()->isReadonly())
|
||||||
fl_deactivate_object(fd_form_table_options->input_column_width);
|
fl_deactivate_object(fd_form_table_options->input_column_width);
|
||||||
if (!pwidth.empty()) {
|
if (!pwidth.empty()) {
|
||||||
fl_activate_object(fd_form_table_options->radio_linebreak_cell);
|
fl_activate_object(fd_form_table_options->radio_linebreak_cell);
|
||||||
@ -264,7 +263,6 @@ void TableOptionsCB(FL_OBJECT *ob, long)
|
|||||||
LyXTable
|
LyXTable
|
||||||
*table = 0;
|
*table = 0;
|
||||||
int
|
int
|
||||||
cell,
|
|
||||||
s,
|
s,
|
||||||
num = 0;
|
num = 0;
|
||||||
string
|
string
|
||||||
@ -273,14 +271,14 @@ void TableOptionsCB(FL_OBJECT *ob, long)
|
|||||||
|
|
||||||
if (!current_view->available()
|
if (!current_view->available()
|
||||||
||
|
||
|
||||||
!(table = current_view->currentBuffer()->text->cursor.par->table))
|
!(table = current_view->buffer()->text->cursor.par->table))
|
||||||
{
|
{
|
||||||
MenuLayoutTable(0);
|
MenuLayoutTable(0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
cell = current_view->currentBuffer()->text->
|
int cell = current_view->buffer()->text->
|
||||||
NumberOfCell(current_view->currentBuffer()->text->cursor.par,
|
NumberOfCell(current_view->buffer()->text->cursor.par,
|
||||||
current_view->currentBuffer()->text->cursor.pos);
|
current_view->buffer()->text->cursor.pos);
|
||||||
if (ActCell != cell) {
|
if (ActCell != cell) {
|
||||||
MenuLayoutTable(0);
|
MenuLayoutTable(0);
|
||||||
fl_set_object_label(fd_form_table_options->text_warning,
|
fl_set_object_label(fd_form_table_options->text_warning,
|
||||||
@ -292,7 +290,7 @@ void TableOptionsCB(FL_OBJECT *ob, long)
|
|||||||
}
|
}
|
||||||
// No point in processing directives that you can't do anything with
|
// No point in processing directives that you can't do anything with
|
||||||
// anyhow, so exit now if the buffer is read-only.
|
// anyhow, so exit now if the buffer is read-only.
|
||||||
if (current_view->currentBuffer()->isReadonly()) {
|
if (current_view->buffer()->isReadonly()) {
|
||||||
MenuLayoutTable(0);
|
MenuLayoutTable(0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -431,16 +429,16 @@ void TableOptionsCB(FL_OBJECT *ob, long)
|
|||||||
return;
|
return;
|
||||||
if (current_view->available()){
|
if (current_view->available()){
|
||||||
current_view->getScreen()->HideCursor();
|
current_view->getScreen()->HideCursor();
|
||||||
if (!current_view->currentBuffer()->text->selection){
|
if (!current_view->buffer()->text->selection){
|
||||||
BeforeChange();
|
BeforeChange();
|
||||||
current_view->currentBuffer()->update(-2);
|
current_view->buffer()->update(-2);
|
||||||
}
|
}
|
||||||
if ((num == LyXTable::SET_SPECIAL_COLUMN) ||
|
if ((num == LyXTable::SET_SPECIAL_COLUMN) ||
|
||||||
(num == LyXTable::SET_SPECIAL_MULTI))
|
(num == LyXTable::SET_SPECIAL_MULTI))
|
||||||
current_view->currentBuffer()->text->TableFeatures(num,special);
|
current_view->buffer()->text->TableFeatures(num,special);
|
||||||
else
|
else
|
||||||
current_view->currentBuffer()->text->TableFeatures(num);
|
current_view->buffer()->text->TableFeatures(num);
|
||||||
current_view->currentBuffer()->update(1);
|
current_view->buffer()->update(1);
|
||||||
}
|
}
|
||||||
if (num == LyXTable::DELETE_TABLE) {
|
if (num == LyXTable::DELETE_TABLE) {
|
||||||
fl_set_focus_object(fd_form_table_options->form_table_options,
|
fl_set_focus_object(fd_form_table_options->form_table_options,
|
||||||
@ -483,12 +481,12 @@ void SetPWidthCB(FL_OBJECT *ob, long)
|
|||||||
}
|
}
|
||||||
if (current_view->available()){
|
if (current_view->available()){
|
||||||
current_view->getScreen()->HideCursor();
|
current_view->getScreen()->HideCursor();
|
||||||
if (!current_view->currentBuffer()->text->selection){
|
if (!current_view->buffer()->text->selection){
|
||||||
BeforeChange();
|
BeforeChange();
|
||||||
current_view->currentBuffer()->update(-2);
|
current_view->buffer()->update(-2);
|
||||||
}
|
}
|
||||||
current_view->currentBuffer()->text->TableFeatures(LyXTable::SET_PWIDTH,str);
|
current_view->buffer()->text->TableFeatures(LyXTable::SET_PWIDTH,str);
|
||||||
current_view->currentBuffer()->update(1);
|
current_view->buffer()->update(1);
|
||||||
}
|
}
|
||||||
MenuLayoutTable(0); // update for alignment
|
MenuLayoutTable(0); // update for alignment
|
||||||
}
|
}
|
||||||
|
43
src/buffer.C
43
src/buffer.C
@ -102,6 +102,7 @@ extern void FreeUpdateTimer();
|
|||||||
|
|
||||||
Buffer::Buffer(string const & file, LyXRC *lyxrc, bool ronly)
|
Buffer::Buffer(string const & file, LyXRC *lyxrc, bool ronly)
|
||||||
{
|
{
|
||||||
|
lyxerr[Debug::INFO] << "Buffer::Buffer()" << endl;
|
||||||
filename = file;
|
filename = file;
|
||||||
filepath = OnlyPath(file);
|
filepath = OnlyPath(file);
|
||||||
paragraph = 0;
|
paragraph = 0;
|
||||||
@ -115,8 +116,7 @@ Buffer::Buffer(string const & file, LyXRC *lyxrc, bool ronly)
|
|||||||
read_only = ronly;
|
read_only = ronly;
|
||||||
inset_slept = false;
|
inset_slept = false;
|
||||||
users = 0;
|
users = 0;
|
||||||
lyxvc.setBuffer(this);
|
lyxvc.buffer(this);
|
||||||
lyxerr.debug() << "Buffer::Buffer()" << endl;
|
|
||||||
if (read_only || (lyxrc && lyxrc->use_tempdir)) {
|
if (read_only || (lyxrc && lyxrc->use_tempdir)) {
|
||||||
tmppath = CreateBufferTmpDir();
|
tmppath = CreateBufferTmpDir();
|
||||||
} else tmppath.clear();
|
} else tmppath.clear();
|
||||||
@ -125,14 +125,14 @@ Buffer::Buffer(string const & file, LyXRC *lyxrc, bool ronly)
|
|||||||
|
|
||||||
Buffer::~Buffer()
|
Buffer::~Buffer()
|
||||||
{
|
{
|
||||||
lyxerr.debug() << "Buffer::~Buffer()" << endl;
|
lyxerr[Debug::INFO] << "Buffer::~Buffer()" << endl;
|
||||||
// here the buffer should take care that it is
|
// here the buffer should take care that it is
|
||||||
// saved properly, before it goes into the void.
|
// saved properly, before it goes into the void.
|
||||||
|
|
||||||
// make sure that views using this buffer
|
// make sure that views using this buffer
|
||||||
// forgets it.
|
// forgets it.
|
||||||
if (users)
|
if (users)
|
||||||
users->setBuffer(0);
|
users->buffer(0);
|
||||||
|
|
||||||
if (!tmppath.empty()) {
|
if (!tmppath.empty()) {
|
||||||
DestroyBufferTmpDir(tmppath);
|
DestroyBufferTmpDir(tmppath);
|
||||||
@ -169,7 +169,7 @@ bool Buffer::saveParamsAsDefaults()
|
|||||||
// Should work on a list
|
// Should work on a list
|
||||||
void Buffer::updateTitles()
|
void Buffer::updateTitles()
|
||||||
{
|
{
|
||||||
if (users) users->getOwner()->updateWindowTitle();
|
if (users) users->owner()->updateWindowTitle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -177,7 +177,7 @@ void Buffer::updateTitles()
|
|||||||
// Should work on a list
|
// Should work on a list
|
||||||
void Buffer::resetAutosaveTimers()
|
void Buffer::resetAutosaveTimers()
|
||||||
{
|
{
|
||||||
if (users) users->getOwner()->resetAutosaveTimer();
|
if (users) users->owner()->resetAutosaveTimer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -3209,7 +3209,7 @@ int Buffer::runLaTeX()
|
|||||||
}
|
}
|
||||||
|
|
||||||
Path p(path); // path to LaTeX file
|
Path p(path); // path to LaTeX file
|
||||||
users->getOwner()->getMiniBuffer()->Set(_("Running LaTeX..."));
|
users->owner()->getMiniBuffer()->Set(_("Running LaTeX..."));
|
||||||
|
|
||||||
// Remove all error insets
|
// Remove all error insets
|
||||||
bool a = removeAutoInsets();
|
bool a = removeAutoInsets();
|
||||||
@ -3221,14 +3221,15 @@ int Buffer::runLaTeX()
|
|||||||
// do the LaTex run(s)
|
// do the LaTex run(s)
|
||||||
TeXErrors terr;
|
TeXErrors terr;
|
||||||
LaTeX latex(lyxrc->latex_command, name, filepath);
|
LaTeX latex(lyxrc->latex_command, name, filepath);
|
||||||
int res = latex.run(terr,users->getOwner()->getMiniBuffer()); // running latex
|
int res = latex.run(terr,
|
||||||
|
users->owner()->getMiniBuffer()); // running latex
|
||||||
|
|
||||||
// check return value from latex.run().
|
// check return value from latex.run().
|
||||||
if ((res & LaTeX::NO_LOGFILE)) {
|
if ((res & LaTeX::NO_LOGFILE)) {
|
||||||
WriteAlert(_("LaTeX did not work!"),
|
WriteAlert(_("LaTeX did not work!"),
|
||||||
_("Missing log file:"), name);
|
_("Missing log file:"), name);
|
||||||
} else if ((res & LaTeX::ERRORS)) {
|
} else if ((res & LaTeX::ERRORS)) {
|
||||||
users->getOwner()->getMiniBuffer()->Set(_("Done"));
|
users->owner()->getMiniBuffer()->Set(_("Done"));
|
||||||
// Insert all errors as errors boxes
|
// Insert all errors as errors boxes
|
||||||
insertErrors(terr);
|
insertErrors(terr);
|
||||||
|
|
||||||
@ -3237,7 +3238,7 @@ int Buffer::runLaTeX()
|
|||||||
// to view a dirty dvi too.
|
// to view a dirty dvi too.
|
||||||
} else {
|
} else {
|
||||||
//no errors or any other things to think about so:
|
//no errors or any other things to think about so:
|
||||||
users->getOwner()->getMiniBuffer()->Set(_("Done"));
|
users->owner()->getMiniBuffer()->Set(_("Done"));
|
||||||
markDviClean();
|
markDviClean();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3273,7 +3274,7 @@ int Buffer::runLiterate()
|
|||||||
}
|
}
|
||||||
|
|
||||||
Path p(path); // path to Literate file
|
Path p(path); // path to Literate file
|
||||||
users->getOwner()->getMiniBuffer()->Set(_("Running Literate..."));
|
users->owner()->getMiniBuffer()->Set(_("Running Literate..."));
|
||||||
|
|
||||||
// Remove all error insets
|
// Remove all error insets
|
||||||
bool a = removeAutoInsets();
|
bool a = removeAutoInsets();
|
||||||
@ -3289,14 +3290,14 @@ int Buffer::runLiterate()
|
|||||||
lyxrc->literate_command, lyxrc->literate_error_filter,
|
lyxrc->literate_command, lyxrc->literate_error_filter,
|
||||||
lyxrc->build_command, lyxrc->build_error_filter);
|
lyxrc->build_command, lyxrc->build_error_filter);
|
||||||
TeXErrors terr;
|
TeXErrors terr;
|
||||||
int res = literate.weave(terr, users->getOwner()->getMiniBuffer());
|
int res = literate.weave(terr, users->owner()->getMiniBuffer());
|
||||||
|
|
||||||
// check return value from literate.weave().
|
// check return value from literate.weave().
|
||||||
if ((res & Literate::NO_LOGFILE)) {
|
if ((res & Literate::NO_LOGFILE)) {
|
||||||
WriteAlert(_("Literate command did not work!"),
|
WriteAlert(_("Literate command did not work!"),
|
||||||
_("Missing log file:"), name);
|
_("Missing log file:"), name);
|
||||||
} else if ((res & Literate::ERRORS)) {
|
} else if ((res & Literate::ERRORS)) {
|
||||||
users->getOwner()->getMiniBuffer()->Set(_("Done"));
|
users->owner()->getMiniBuffer()->Set(_("Done"));
|
||||||
// Insert all errors as errors boxes
|
// Insert all errors as errors boxes
|
||||||
insertErrors(terr);
|
insertErrors(terr);
|
||||||
|
|
||||||
@ -3305,7 +3306,7 @@ int Buffer::runLiterate()
|
|||||||
// to view a dirty dvi too.
|
// to view a dirty dvi too.
|
||||||
} else {
|
} else {
|
||||||
//no errors or any other things to think about so:
|
//no errors or any other things to think about so:
|
||||||
users->getOwner()->getMiniBuffer()->Set(_("Done"));
|
users->owner()->getMiniBuffer()->Set(_("Done"));
|
||||||
markDviClean();
|
markDviClean();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3341,7 +3342,7 @@ int Buffer::buildProgram()
|
|||||||
}
|
}
|
||||||
|
|
||||||
Path p(path); // path to Literate file
|
Path p(path); // path to Literate file
|
||||||
users->getOwner()->getMiniBuffer()->Set(_("Building Program..."));
|
users->owner()->getMiniBuffer()->Set(_("Building Program..."));
|
||||||
|
|
||||||
// Remove all error insets
|
// Remove all error insets
|
||||||
bool a = removeAutoInsets();
|
bool a = removeAutoInsets();
|
||||||
@ -3357,14 +3358,14 @@ int Buffer::buildProgram()
|
|||||||
lyxrc->literate_command, lyxrc->literate_error_filter,
|
lyxrc->literate_command, lyxrc->literate_error_filter,
|
||||||
lyxrc->build_command, lyxrc->build_error_filter);
|
lyxrc->build_command, lyxrc->build_error_filter);
|
||||||
TeXErrors terr;
|
TeXErrors terr;
|
||||||
int res = literate.build(terr, users->getOwner()->getMiniBuffer());
|
int res = literate.build(terr, users->owner()->getMiniBuffer());
|
||||||
|
|
||||||
// check return value from literate.build().
|
// check return value from literate.build().
|
||||||
if ((res & Literate::NO_LOGFILE)) {
|
if ((res & Literate::NO_LOGFILE)) {
|
||||||
WriteAlert(_("Build did not work!"),
|
WriteAlert(_("Build did not work!"),
|
||||||
_("Missing log file:"), name);
|
_("Missing log file:"), name);
|
||||||
} else if ((res & Literate::ERRORS)) {
|
} else if ((res & Literate::ERRORS)) {
|
||||||
users->getOwner()->getMiniBuffer()->Set(_("Done"));
|
users->owner()->getMiniBuffer()->Set(_("Done"));
|
||||||
// Insert all errors as errors boxes
|
// Insert all errors as errors boxes
|
||||||
insertErrors(terr);
|
insertErrors(terr);
|
||||||
|
|
||||||
@ -3372,7 +3373,7 @@ int Buffer::buildProgram()
|
|||||||
// command run ends up with errors.
|
// command run ends up with errors.
|
||||||
} else {
|
} else {
|
||||||
//no errors or any other things to think about so:
|
//no errors or any other things to think about so:
|
||||||
users->getOwner()->getMiniBuffer()->Set(_("Done"));
|
users->owner()->getMiniBuffer()->Set(_("Done"));
|
||||||
markNwClean();
|
markNwClean();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3408,7 +3409,7 @@ int Buffer::runChktex()
|
|||||||
}
|
}
|
||||||
|
|
||||||
Path p(path); // path to LaTeX file
|
Path p(path); // path to LaTeX file
|
||||||
users->getOwner()->getMiniBuffer()->Set(_("Running chktex..."));
|
users->owner()->getMiniBuffer()->Set(_("Running chktex..."));
|
||||||
|
|
||||||
// Remove all error insets
|
// Remove all error insets
|
||||||
bool a = removeAutoInsets();
|
bool a = removeAutoInsets();
|
||||||
@ -3673,7 +3674,7 @@ void Buffer::update(signed char f)
|
|||||||
{
|
{
|
||||||
if (!users) return;
|
if (!users) return;
|
||||||
|
|
||||||
users->getOwner()->updateLayoutChoice();
|
users->owner()->updateLayoutChoice();
|
||||||
|
|
||||||
if (!text->selection && f > -3)
|
if (!text->selection && f > -3)
|
||||||
text->sel_cursor = text->cursor;
|
text->sel_cursor = text->cursor;
|
||||||
@ -3690,7 +3691,7 @@ void Buffer::update(signed char f)
|
|||||||
if (f==1 || f==-1) {
|
if (f==1 || f==-1) {
|
||||||
if (isLyxClean()) {
|
if (isLyxClean()) {
|
||||||
markDirty();
|
markDirty();
|
||||||
users->getOwner()->getMiniBuffer()->setTimer(4);
|
users->owner()->getMiniBuffer()->setTimer(4);
|
||||||
} else {
|
} else {
|
||||||
markDirty();
|
markDirty();
|
||||||
}
|
}
|
||||||
|
@ -61,8 +61,8 @@ bool updateBulletForm()
|
|||||||
}
|
}
|
||||||
if (!current_view->available()) {
|
if (!current_view->available()) {
|
||||||
update = false;
|
update = false;
|
||||||
} else if (current_view->currentBuffer()->isReadonly()
|
} else if (current_view->buffer()->isReadonly()
|
||||||
|| current_view->currentBuffer()->isLinuxDoc()) {
|
|| current_view->buffer()->isLinuxDoc()) {
|
||||||
fl_deactivate_object (fd_form_bullet->button_ok);
|
fl_deactivate_object (fd_form_bullet->button_ok);
|
||||||
fl_deactivate_object (fd_form_bullet->button_apply);
|
fl_deactivate_object (fd_form_bullet->button_apply);
|
||||||
fl_set_object_lcol (fd_form_bullet->button_ok, FL_INACTIVE);
|
fl_set_object_lcol (fd_form_bullet->button_ok, FL_INACTIVE);
|
||||||
@ -85,10 +85,10 @@ bool updateBulletForm()
|
|||||||
// any settings that need doing each time
|
// any settings that need doing each time
|
||||||
fl_set_button(fd_form_bullet->radio_bullet_depth_1, 1);
|
fl_set_button(fd_form_bullet->radio_bullet_depth_1, 1);
|
||||||
fl_set_input(fd_form_bullet->input_bullet_latex,
|
fl_set_input(fd_form_bullet->input_bullet_latex,
|
||||||
current_view->currentBuffer()
|
current_view->buffer()
|
||||||
->params.user_defined_bullets[0].c_str());
|
->params.user_defined_bullets[0].c_str());
|
||||||
fl_set_choice(fd_form_bullet->choice_bullet_size,
|
fl_set_choice(fd_form_bullet->choice_bullet_size,
|
||||||
current_view->currentBuffer()
|
current_view->buffer()
|
||||||
->params.user_defined_bullets[0].getSize() + 2);
|
->params.user_defined_bullets[0].getSize() + 2);
|
||||||
} else {
|
} else {
|
||||||
if (fd_form_bullet->form_bullet->visible) {
|
if (fd_form_bullet->form_bullet->visible) {
|
||||||
@ -110,15 +110,15 @@ void BulletOKCB(FL_OBJECT *ob, long data)
|
|||||||
|
|
||||||
void BulletApplyCB(FL_OBJECT * /*ob*/, long /*data*/ )
|
void BulletApplyCB(FL_OBJECT * /*ob*/, long /*data*/ )
|
||||||
{
|
{
|
||||||
/* update the bullet settings */
|
// update the bullet settings
|
||||||
BufferParams & param = current_view->currentBuffer()->params;
|
BufferParams & param = current_view->buffer()->params;
|
||||||
|
|
||||||
// a little bit of loop unrolling
|
// a little bit of loop unrolling
|
||||||
param.user_defined_bullets[0] = param.temp_bullets[0];
|
param.user_defined_bullets[0] = param.temp_bullets[0];
|
||||||
param.user_defined_bullets[1] = param.temp_bullets[1];
|
param.user_defined_bullets[1] = param.temp_bullets[1];
|
||||||
param.user_defined_bullets[2] = param.temp_bullets[2];
|
param.user_defined_bullets[2] = param.temp_bullets[2];
|
||||||
param.user_defined_bullets[3] = param.temp_bullets[3];
|
param.user_defined_bullets[3] = param.temp_bullets[3];
|
||||||
current_view->currentBuffer()->markDirty();
|
current_view->buffer()->markDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -126,7 +126,7 @@ void BulletCancelCB(FL_OBJECT * /*ob*/, long /*data*/ )
|
|||||||
{
|
{
|
||||||
fl_hide_form(fd_form_bullet->form_bullet);
|
fl_hide_form(fd_form_bullet->form_bullet);
|
||||||
// this avoids confusion when reopening
|
// this avoids confusion when reopening
|
||||||
BufferParams & param = current_view->currentBuffer()->params;
|
BufferParams & param = current_view->buffer()->params;
|
||||||
param.temp_bullets[0] = param.user_defined_bullets[0];
|
param.temp_bullets[0] = param.user_defined_bullets[0];
|
||||||
param.temp_bullets[1] = param.user_defined_bullets[1];
|
param.temp_bullets[1] = param.user_defined_bullets[1];
|
||||||
param.temp_bullets[2] = param.user_defined_bullets[2];
|
param.temp_bullets[2] = param.user_defined_bullets[2];
|
||||||
@ -136,8 +136,8 @@ void BulletCancelCB(FL_OBJECT * /*ob*/, long /*data*/ )
|
|||||||
|
|
||||||
void InputBulletLaTeXCB(FL_OBJECT *, long)
|
void InputBulletLaTeXCB(FL_OBJECT *, long)
|
||||||
{
|
{
|
||||||
/* fill-in code for callback */
|
// fill-in code for callback
|
||||||
BufferParams & param = current_view->currentBuffer()->params;
|
BufferParams & param = current_view->buffer()->params;
|
||||||
|
|
||||||
param.temp_bullets[current_bullet_depth].setText(
|
param.temp_bullets[current_bullet_depth].setText(
|
||||||
fl_get_input(fd_form_bullet->input_bullet_latex));
|
fl_get_input(fd_form_bullet->input_bullet_latex));
|
||||||
@ -146,7 +146,7 @@ void InputBulletLaTeXCB(FL_OBJECT *, long)
|
|||||||
|
|
||||||
void ChoiceBulletSizeCB(FL_OBJECT * ob, long /*data*/ )
|
void ChoiceBulletSizeCB(FL_OBJECT * ob, long /*data*/ )
|
||||||
{
|
{
|
||||||
BufferParams & param = current_view->currentBuffer()->params;
|
BufferParams & param = current_view->buffer()->params;
|
||||||
|
|
||||||
// convert from 1-6 range to -1-4
|
// convert from 1-6 range to -1-4
|
||||||
param.temp_bullets[current_bullet_depth].setSize(fl_get_choice(ob) - 2);
|
param.temp_bullets[current_bullet_depth].setSize(fl_get_choice(ob) - 2);
|
||||||
@ -155,7 +155,7 @@ void ChoiceBulletSizeCB(FL_OBJECT * ob, long /*data*/ )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void BulletDepthCB(FL_OBJECT *ob, long data)
|
void BulletDepthCB(FL_OBJECT * ob, long data)
|
||||||
{
|
{
|
||||||
/* Should I do the following: */
|
/* Should I do the following: */
|
||||||
/* 1. change to the panel that the current bullet belongs in */
|
/* 1. change to the panel that the current bullet belongs in */
|
||||||
@ -165,7 +165,7 @@ void BulletDepthCB(FL_OBJECT *ob, long data)
|
|||||||
/* */
|
/* */
|
||||||
/* I'm inclined to just go with 3 and 4 at the moment and */
|
/* I'm inclined to just go with 3 and 4 at the moment and */
|
||||||
/* maybe try to support the others later */
|
/* maybe try to support the others later */
|
||||||
BufferParams & param = current_view->currentBuffer()->params;
|
BufferParams & param = current_view->buffer()->params;
|
||||||
|
|
||||||
switch (fl_get_button_numb(ob)) {
|
switch (fl_get_button_numb(ob)) {
|
||||||
case 3:
|
case 3:
|
||||||
@ -242,7 +242,7 @@ void BulletBMTableCB(FL_OBJECT *ob, long /*data*/ )
|
|||||||
/* to that extracted from the current chosen position of the BMTable */
|
/* to that extracted from the current chosen position of the BMTable */
|
||||||
/* Don't forget to free the button's old pixmap first. */
|
/* Don't forget to free the button's old pixmap first. */
|
||||||
|
|
||||||
BufferParams & param = current_view->currentBuffer()->params;
|
BufferParams & param = current_view->buffer()->params;
|
||||||
int bmtable_button = fl_get_bmtable(ob);
|
int bmtable_button = fl_get_bmtable(ob);
|
||||||
|
|
||||||
/* try to keep the button held down till another is pushed */
|
/* try to keep the button held down till another is pushed */
|
||||||
|
@ -236,7 +236,7 @@ extern "C" void C_Intl_DispatchCallback(FL_OBJECT *ob,long code)
|
|||||||
void Intl::InitKeyMapper(bool on)
|
void Intl::InitKeyMapper(bool on)
|
||||||
/* initialize key mapper */
|
/* initialize key mapper */
|
||||||
{
|
{
|
||||||
lyxerr[Debug::KBMAP] << "Initializing key mappings..." << endl;
|
lyxerr[Debug::INIT] << "Initializing key mappings..." << endl;
|
||||||
|
|
||||||
if (prim_lang.empty() && sec_lang.empty())
|
if (prim_lang.empty() && sec_lang.empty())
|
||||||
keymapon = false;
|
keymapon = false;
|
||||||
|
457
src/lyx_cb.C
457
src/lyx_cb.C
File diff suppressed because it is too large
Load Diff
@ -325,9 +325,9 @@ void LyXGUI::init()
|
|||||||
|
|
||||||
void LyXGUI::create_forms()
|
void LyXGUI::create_forms()
|
||||||
{
|
{
|
||||||
lyxerr.debug() << "Initializing LyXView..." << endl;
|
lyxerr[Debug::INIT] << "Initializing LyXView..." << endl;
|
||||||
lyxViews = new LyXView(width, height);
|
lyxViews = new LyXView(width, height);
|
||||||
lyxerr.debug() << "Initializing LyXView...done" << endl;
|
lyxerr[Debug::INIT] << "Initializing LyXView...done" << endl;
|
||||||
|
|
||||||
// From here down should be done by somebody else. (Lgb)
|
// From here down should be done by somebody else. (Lgb)
|
||||||
|
|
||||||
@ -641,5 +641,5 @@ void LyXGUI::runTime()
|
|||||||
|
|
||||||
void LyXGUI::regBuf(Buffer *b)
|
void LyXGUI::regBuf(Buffer *b)
|
||||||
{
|
{
|
||||||
lyxViews->currentView()->setBuffer(b);
|
lyxViews->currentView()->buffer(b);
|
||||||
}
|
}
|
||||||
|
@ -242,7 +242,7 @@ void updateAllVisibleBufferRelatedPopups()
|
|||||||
RefUpdateCB(0,0);
|
RefUpdateCB(0,0);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (current_view->currentBuffer()->isReadonly()) {
|
if (current_view->buffer()->isReadonly()) {
|
||||||
// a little crude perhaps but it works. ARRae
|
// a little crude perhaps but it works. ARRae
|
||||||
if (fd_form_character->form_character->visible) {
|
if (fd_form_character->form_character->visible) {
|
||||||
fl_hide_form(fd_form_character->form_character);
|
fl_hide_form(fd_form_character->form_character);
|
||||||
@ -410,6 +410,6 @@ void WarnReadonly()
|
|||||||
{
|
{
|
||||||
WriteAlert(_("Any changes will be ignored"),
|
WriteAlert(_("Any changes will be ignored"),
|
||||||
_("The document is read-only:"),
|
_("The document is read-only:"),
|
||||||
current_view->currentBuffer()->getFileName());
|
current_view->buffer()->getFileName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,19 +66,19 @@ LyX::LyX(int * argc, char * argv[])
|
|||||||
// Global bindings (this must be done as early as possible.) (Lgb)
|
// Global bindings (this must be done as early as possible.) (Lgb)
|
||||||
toplevel_keymap = new kb_keymap;
|
toplevel_keymap = new kb_keymap;
|
||||||
|
|
||||||
lyxerr.debug() << "Initializing lyxrc" << endl;
|
lyxerr[Debug::INIT] << "Initializing lyxrc" << endl;
|
||||||
lyxrc = new LyXRC;
|
lyxrc = new LyXRC;
|
||||||
|
|
||||||
// Make the GUI object, and let it take care of the
|
// Make the GUI object, and let it take care of the
|
||||||
// command line arguments that concerns it.
|
// command line arguments that concerns it.
|
||||||
lyxerr.debug() << "Initializing LyXGUI..." << endl;
|
lyxerr[Debug::INIT] << "Initializing LyXGUI..." << endl;
|
||||||
lyxGUI = new LyXGUI(this, argc, argv, gui);
|
lyxGUI = new LyXGUI(this, argc, argv, gui);
|
||||||
lyxerr.debug() << "Initializing LyXGUI...done" << endl;
|
lyxerr[Debug::INIT] << "Initializing LyXGUI...done" << endl;
|
||||||
|
|
||||||
// Initialization of LyX (reads lyxrc and more)
|
// Initialization of LyX (reads lyxrc and more)
|
||||||
lyxerr.debug() << "Initializing LyX::init..." << endl;
|
lyxerr[Debug::INIT] << "Initializing LyX::init..." << endl;
|
||||||
init(argc, argv);
|
init(argc, argv);
|
||||||
lyxerr.debug() << "Initializing LyX::init...done" << endl;
|
lyxerr[Debug::INIT] << "Initializing LyX::init...done" << endl;
|
||||||
|
|
||||||
lyxGUI->init();
|
lyxGUI->init();
|
||||||
|
|
||||||
@ -87,13 +87,13 @@ LyX::LyX(int * argc, char * argv[])
|
|||||||
// the only thing left on the command line should be
|
// the only thing left on the command line should be
|
||||||
// filenames.
|
// filenames.
|
||||||
if ((*argc)==2)
|
if ((*argc)==2)
|
||||||
lyxerr.debug() << "Opening document..." << endl;
|
lyxerr[Debug::INFO] << "Opening document..." << endl;
|
||||||
else if ((*argc)>2)
|
else if ((*argc)>2)
|
||||||
lyxerr.debug() << "Opening documents..." << endl;
|
lyxerr[Debug::INFO] << "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]);
|
||||||
if (loadb != 0) {
|
if (loadb != 0) {
|
||||||
last_loaded = loadb;
|
last_loaded = loadb;
|
||||||
@ -169,7 +169,7 @@ void LyX::init(int */*argc*/, char **argv)
|
|||||||
<< _("If you have problems, try starting LyX with an absolute path.")
|
<< _("If you have problems, try starting LyX with an absolute path.")
|
||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
lyxerr.debug() << "Path of binary: " << binpath << endl;
|
lyxerr[Debug::INIT] << "Path of binary: " << binpath << endl;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Determine system directory.
|
// Determine system directory.
|
||||||
@ -323,7 +323,7 @@ void LyX::init(int */*argc*/, char **argv)
|
|||||||
Screen * scr=(DefaultScreenOfDisplay(fl_get_display()));
|
Screen * scr=(DefaultScreenOfDisplay(fl_get_display()));
|
||||||
lyxrc->dpi = ((HeightOfScreen(scr)* 25.4 / HeightMMOfScreen(scr)) +
|
lyxrc->dpi = ((HeightOfScreen(scr)* 25.4 / HeightMMOfScreen(scr)) +
|
||||||
(WidthOfScreen(scr)* 25.4 / WidthMMOfScreen(scr))) / 2;
|
(WidthOfScreen(scr)* 25.4 / WidthMMOfScreen(scr))) / 2;
|
||||||
lyxerr.debug() << "DPI setting detected to be "
|
lyxerr[Debug::INFO] << "DPI setting detected to be "
|
||||||
<< lyxrc->dpi+0.5 << endl;
|
<< lyxrc->dpi+0.5 << endl;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
42
src/lyxfr1.C
42
src/lyxfr1.C
@ -141,10 +141,10 @@ void SetSelectionOverLenChars(LyXText *lt, int len)
|
|||||||
void LyXFindReplace1::StartSearch()
|
void LyXFindReplace1::StartSearch()
|
||||||
{
|
{
|
||||||
LyXFindReplace0::StartSearch();
|
LyXFindReplace0::StartSearch();
|
||||||
SetReplaceEnabled(!current_view->currentBuffer()->isReadonly());
|
SetReplaceEnabled(!current_view->buffer()->isReadonly());
|
||||||
searchForward = true;
|
searchForward = true;
|
||||||
if (lsSearch.empty())
|
if (lsSearch.empty())
|
||||||
SetSearchString(GetSelectionOrWordAtCursor(current_view->currentBuffer()->text));
|
SetSearchString(GetSelectionOrWordAtCursor(current_view->buffer()->text));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -155,7 +155,7 @@ void LyXFindReplace1::SearchReplaceCB()
|
|||||||
|
|
||||||
if (!current_view->getScreen())
|
if (!current_view->getScreen())
|
||||||
return;
|
return;
|
||||||
if (current_view->currentBuffer()->isReadonly())
|
if (current_view->buffer()->isReadonly())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// CutSelection cannot cut a single space, so we have to stop
|
// CutSelection cannot cut a single space, so we have to stop
|
||||||
@ -171,17 +171,17 @@ void LyXFindReplace1::SearchReplaceCB()
|
|||||||
string const replacestring = ReplaceString();
|
string const replacestring = ReplaceString();
|
||||||
|
|
||||||
current_view->getScreen()->HideCursor();
|
current_view->getScreen()->HideCursor();
|
||||||
current_view->currentBuffer()->update(-2);
|
current_view->buffer()->update(-2);
|
||||||
|
|
||||||
ltCur = current_view->currentBuffer()->text;
|
ltCur = current_view->buffer()->text;
|
||||||
if (ltCur->selection) {
|
if (ltCur->selection) {
|
||||||
// clear the selection (if there is any)
|
// clear the selection (if there is any)
|
||||||
current_view->getScreen()->ToggleSelection(false);
|
current_view->getScreen()->ToggleSelection(false);
|
||||||
current_view->currentBuffer()->text->
|
current_view->buffer()->text->
|
||||||
ReplaceSelectionWithString(replacestring.c_str());
|
ReplaceSelectionWithString(replacestring.c_str());
|
||||||
current_view->currentBuffer()->text->
|
current_view->buffer()->text->
|
||||||
SetSelectionOverString(replacestring.c_str());
|
SetSelectionOverString(replacestring.c_str());
|
||||||
current_view->currentBuffer()->update(1);
|
current_view->buffer()->update(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// jump to next match:
|
// jump to next match:
|
||||||
@ -196,7 +196,7 @@ void LyXFindReplace1::SearchReplaceAllCB()
|
|||||||
|
|
||||||
if (!current_view->getScreen())
|
if (!current_view->getScreen())
|
||||||
return;
|
return;
|
||||||
if (current_view->currentBuffer()->isReadonly())
|
if (current_view->buffer()->isReadonly())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// CutSelection cannot cut a single space, so we have to stop
|
// CutSelection cannot cut a single space, so we have to stop
|
||||||
@ -214,20 +214,20 @@ void LyXFindReplace1::SearchReplaceAllCB()
|
|||||||
current_view->getScreen()->HideCursor();
|
current_view->getScreen()->HideCursor();
|
||||||
|
|
||||||
// start at top
|
// start at top
|
||||||
current_view->currentBuffer()->text->ClearSelection();
|
current_view->buffer()->text->ClearSelection();
|
||||||
current_view->currentBuffer()->text->CursorTop();
|
current_view->buffer()->text->CursorTop();
|
||||||
|
|
||||||
int replace_count = 0;
|
int replace_count = 0;
|
||||||
do {
|
do {
|
||||||
ltCur = current_view->currentBuffer()->text;
|
ltCur = current_view->buffer()->text;
|
||||||
if (ltCur->selection) {
|
if (ltCur->selection) {
|
||||||
current_view->currentBuffer()->update(-2);
|
current_view->buffer()->update(-2);
|
||||||
current_view->getScreen()->ToggleSelection(false);
|
current_view->getScreen()->ToggleSelection(false);
|
||||||
current_view->currentBuffer()->text->
|
current_view->buffer()->text->
|
||||||
ReplaceSelectionWithString(replacestring.c_str());
|
ReplaceSelectionWithString(replacestring.c_str());
|
||||||
current_view->currentBuffer()->text->
|
current_view->buffer()->text->
|
||||||
SetSelectionOverString(replacestring.c_str());
|
SetSelectionOverString(replacestring.c_str());
|
||||||
current_view->currentBuffer()->update(1);
|
current_view->buffer()->update(1);
|
||||||
replace_count++;
|
replace_count++;
|
||||||
}
|
}
|
||||||
} while( SearchCB(true) );
|
} while( SearchCB(true) );
|
||||||
@ -259,8 +259,8 @@ bool LyXFindReplace1::SearchCB(bool fForward)
|
|||||||
return(false);
|
return(false);
|
||||||
|
|
||||||
current_view->getScreen()->HideCursor();
|
current_view->getScreen()->HideCursor();
|
||||||
current_view->currentBuffer()->update(-2);
|
current_view->buffer()->update(-2);
|
||||||
ltCur = current_view->currentBuffer()->text;
|
ltCur = current_view->buffer()->text;
|
||||||
if (ltCur->selection)
|
if (ltCur->selection)
|
||||||
ltCur->cursor = fForward ? ltCur->sel_end_cursor :
|
ltCur->cursor = fForward ? ltCur->sel_end_cursor :
|
||||||
ltCur->sel_start_cursor;
|
ltCur->sel_start_cursor;
|
||||||
@ -270,14 +270,14 @@ bool LyXFindReplace1::SearchCB(bool fForward)
|
|||||||
|
|
||||||
if (!ValidSearchData() ||
|
if (!ValidSearchData() ||
|
||||||
(fForward ? SearchForward(ltCur) : SearchBackward(ltCur))) {
|
(fForward ? SearchForward(ltCur) : SearchBackward(ltCur))) {
|
||||||
current_view->currentBuffer()->update(-2);
|
current_view->buffer()->update(-2);
|
||||||
|
|
||||||
// clear the selection (if there is any)
|
// clear the selection (if there is any)
|
||||||
current_view->getScreen()->ToggleSelection();
|
current_view->getScreen()->ToggleSelection();
|
||||||
current_view->currentBuffer()->text->ClearSelection();
|
current_view->buffer()->text->ClearSelection();
|
||||||
|
|
||||||
// set the new selection
|
// set the new selection
|
||||||
SetSelectionOverLenChars(current_view->currentBuffer()->text, iLenSelected);
|
SetSelectionOverLenChars(current_view->buffer()->text, iLenSelected);
|
||||||
current_view->getScreen()->ToggleSelection(false);
|
current_view->getScreen()->ToggleSelection(false);
|
||||||
minibuffer->Set(_("Found."));
|
minibuffer->Set(_("Found."));
|
||||||
result = true;
|
result = true;
|
||||||
|
673
src/lyxfunc.C
673
src/lyxfunc.C
File diff suppressed because it is too large
Load Diff
@ -35,12 +35,12 @@ void InitLyXLookup(Display* display, Window window)
|
|||||||
// This part could be done before opening display
|
// This part could be done before opening display
|
||||||
setlocale(LC_CTYPE,"");
|
setlocale(LC_CTYPE,"");
|
||||||
if (!XSupportsLocale()) {
|
if (!XSupportsLocale()) {
|
||||||
lyxerr.debug("InitLyXLookup: X does not support this locale.");
|
lyxerr.debug() << "InitLyXLookup: X does not support this locale." << endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!XSetLocaleModifiers("")) {
|
if (!XSetLocaleModifiers("")) {
|
||||||
lyxerr.debug("InitLyXLookup: Could not set modifiers "
|
lyxerr.debug() << "InitLyXLookup: Could not set modifiers "
|
||||||
"for this locale.");
|
"for this locale." << endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,15 +54,15 @@ void InitLyXLookup(Display* display, Window window)
|
|||||||
0);
|
0);
|
||||||
|
|
||||||
if (!xic) {
|
if (!xic) {
|
||||||
lyxerr.debug("InitLyXLookup: could not create "
|
lyxerr.debug() << "InitLyXLookup: could not create "
|
||||||
"an input context");
|
"an input context" << endl;
|
||||||
XCloseIM (xim);
|
XCloseIM (xim);
|
||||||
xim = 0;
|
xim = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
lyxerr.debug("InitLyXLookup: could not open "
|
lyxerr.debug() << "InitLyXLookup: could not open "
|
||||||
"an input method.");
|
"an input method." << endl;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -152,8 +152,8 @@ int LyXLookupString(XEvent *event,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (event->type != KeyPress)
|
if (event->type != KeyPress)
|
||||||
lyxerr <<"LyXLookupString: wrong event type"
|
lyxerr << "LyXLookupString: wrong event type"
|
||||||
+string(event->type));
|
<< event->type << endl;
|
||||||
Status status_return;
|
Status status_return;
|
||||||
|
|
||||||
result = XmbLookupString(xic, &event->xkey, buffer_return,
|
result = XmbLookupString(xic, &event->xkey, buffer_return,
|
||||||
@ -189,7 +189,8 @@ int LyXLookupString(XEvent *event,
|
|||||||
void CloseLyXLookup()
|
void CloseLyXLookup()
|
||||||
{
|
{
|
||||||
if (xic) {
|
if (xic) {
|
||||||
lyxerr.debug("CloseLyXLookup: destroying input context");
|
lyxerr.debug() << "CloseLyXLookup: destroying input context"
|
||||||
|
<< endl;
|
||||||
XDestroyIC(xic);
|
XDestroyIC(xic);
|
||||||
XCloseIM(xim);
|
XCloseIM(xim);
|
||||||
}
|
}
|
||||||
|
239
src/lyxvc.C
239
src/lyxvc.C
@ -4,29 +4,25 @@
|
|||||||
#pragma implementation
|
#pragma implementation
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
#include FORMS_H_LOCATION
|
#include FORMS_H_LOCATION
|
||||||
#include "lyxvc.h"
|
#include "lyxvc.h"
|
||||||
|
#include "vc-backend.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "lyx_gui_misc.h"
|
#include "lyx_gui_misc.h"
|
||||||
#include "bufferlist.h"
|
#include "buffer.h"
|
||||||
#include "support/syscall.h"
|
|
||||||
#include "support/path.h"
|
|
||||||
#include "support/filetools.h"
|
|
||||||
#include "support/FileInfo.h"
|
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
#include "LyXView.h"
|
#include "support/filetools.h"
|
||||||
#include "lyxfunc.h"
|
#include "lyxfunc.h"
|
||||||
#include "latexoptions.h"
|
#include "LyXView.h"
|
||||||
|
|
||||||
extern BufferList bufferlist;
|
|
||||||
extern void MenuWrite(Buffer *);
|
|
||||||
|
|
||||||
|
|
||||||
LyXVC::LyXVC()
|
LyXVC::LyXVC()
|
||||||
{
|
{
|
||||||
backend = UNKNOWN_VCS;
|
vcs = 0;
|
||||||
_owner = 0;
|
|
||||||
browser = 0;
|
browser = 0;
|
||||||
|
owner_ = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -37,39 +33,27 @@ LyXVC::~LyXVC()
|
|||||||
fl_hide_form(browser->LaTeXLog);
|
fl_hide_form(browser->LaTeXLog);
|
||||||
fl_free_form(browser->LaTeXLog);
|
fl_free_form(browser->LaTeXLog);
|
||||||
}
|
}
|
||||||
|
if (vcs) {
|
||||||
|
delete vcs;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool LyXVC::file_found_hook(string const & fn)
|
bool LyXVC::file_found_hook(string const & fn)
|
||||||
{
|
{
|
||||||
string tmp(fn);
|
string found_file;
|
||||||
FileInfo f;
|
// Check if file is under RCS
|
||||||
// Check if *,v exists.
|
if (!(found_file = RCS::find_file(fn)).empty()) {
|
||||||
tmp += ",v";
|
vcs = new RCS(found_file);
|
||||||
lyxerr[Debug::LYXVC] << "Checking if file is under vc: "
|
vcs->owner(owner_);
|
||||||
<< tmp << endl;
|
return true;
|
||||||
if (f.newFile(tmp).readable()) {
|
}
|
||||||
lyxerr[Debug::LYXVC] << "Yes it is under vc." << endl;
|
// Check if file is under CVS
|
||||||
master = tmp;
|
if (!(found_file = CVS::find_file(fn)).empty()) {
|
||||||
backend = RCS_VCS;
|
vcs = new CVS(found_file, fn);
|
||||||
scanMaster();
|
vcs->owner(owner_);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
|
||||||
// Check if RCS/*,v exists.
|
|
||||||
tmp = AddName(AddPath(OnlyPath(fn), "RCS"), fn);
|
|
||||||
tmp += ",v";
|
|
||||||
lyxerr[Debug::LYXVC] << "Checking if file is under vc: "
|
|
||||||
<< tmp << endl;
|
|
||||||
if (f.newFile(tmp).readable()) {
|
|
||||||
lyxerr[Debug::LYXVC] << "Yes it is under vc."<< endl;
|
|
||||||
master = tmp;
|
|
||||||
backend = RCS_VCS;
|
|
||||||
scanMaster();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// If either one, return true
|
|
||||||
|
|
||||||
// file is not under any VCS.
|
// file is not under any VCS.
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -82,98 +66,34 @@ bool LyXVC::file_not_found_hook(string const &)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LyXVC::scanMaster()
|
void LyXVC::buffer(Buffer * buf)
|
||||||
{
|
{
|
||||||
lyxerr[Debug::LYXVC] << "LyXVC: This file is a VC file." << endl;
|
owner_ = buf;
|
||||||
|
|
||||||
LyXLex lex(0, 0);
|
|
||||||
lex.setFile(master);
|
|
||||||
|
|
||||||
string token;
|
|
||||||
bool read_enough = false;
|
|
||||||
while (lex.IsOK() && !read_enough) {
|
|
||||||
lex.next();
|
|
||||||
token = lex.GetString();
|
|
||||||
|
|
||||||
lyxerr[Debug::LYXVC] <<"LyXVC::scanMaster: current lex text: `"
|
|
||||||
<< token << "'" << endl;
|
|
||||||
|
|
||||||
if (token.empty())
|
|
||||||
continue;
|
|
||||||
else if (token == "head") {
|
|
||||||
// get version here
|
|
||||||
lex.next();
|
|
||||||
string tmv = strip(lex.GetString(), ';');
|
|
||||||
version = tmv;
|
|
||||||
} else if (contains(token, "access")
|
|
||||||
|| contains(token, "symbols")
|
|
||||||
|| contains(token, "strict")) {
|
|
||||||
// nothing
|
|
||||||
} else if (contains(token, "locks")) {
|
|
||||||
// get locker here
|
|
||||||
if (contains(token, ";")) {
|
|
||||||
locker = "Unlocked";
|
|
||||||
vcstat = UNLOCKED;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
string tmpt, s1, s2;
|
|
||||||
do {
|
|
||||||
lex.next();
|
|
||||||
s1 = strip(tmpt = lex.GetString(), ';');
|
|
||||||
// tmp is now in the format <user>:<version>
|
|
||||||
s1 = split(s1, s2, ':');
|
|
||||||
// s2 is user, and s1 is version
|
|
||||||
if (s1 == version) {
|
|
||||||
locker = s2;
|
|
||||||
vcstat = LOCKED;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} while (!contains(tmpt, ";"));
|
|
||||||
|
|
||||||
} else if (token == "comment") {
|
|
||||||
// we don't need to read any further than this.
|
|
||||||
read_enough = true;
|
|
||||||
} else {
|
|
||||||
// unexpected
|
|
||||||
lyxerr[Debug::LYXVC]
|
|
||||||
<< "LyXVC::scanMaster(): unexpected token"
|
|
||||||
<< endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LyXVC::setBuffer(Buffer * buf)
|
|
||||||
{
|
|
||||||
_owner = buf;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// I will probably add some backend_xxxx functions later to perform the
|
|
||||||
// version control system specific commands. Something like:
|
|
||||||
// void backend_revert(<params>) {
|
|
||||||
// if (backend == "RCS") {
|
|
||||||
// } else if (backend == "CVS") {
|
|
||||||
// } else if (backend == "SCCS") {
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// But for 0.12 we will only support RCS.
|
|
||||||
//
|
|
||||||
|
|
||||||
void LyXVC::registrer()
|
void LyXVC::registrer()
|
||||||
{
|
{
|
||||||
|
// it is very likely here that the vcs is not created yet...
|
||||||
|
// so... we use RCS as default, later this should perhaps be
|
||||||
|
// a lyxrc option.
|
||||||
|
if (!vcs) {
|
||||||
|
vcs = new RCS(owner_->getFileName());
|
||||||
|
vcs->owner(owner_);
|
||||||
|
}
|
||||||
|
|
||||||
// If the document is changed, we might want to save it
|
// If the document is changed, we might want to save it
|
||||||
if (!_owner->isLyxClean() &&
|
if (!vcs->owner()->isLyxClean() &&
|
||||||
AskQuestion(_("Changes in document:"),
|
AskQuestion(_("Changes in document:"),
|
||||||
MakeDisplayPath(_owner->getFileName(),50),
|
MakeDisplayPath(vcs->owner()->getFileName(),50),
|
||||||
_("Save document and proceed?"))) {
|
_("Save document and proceed?"))) {
|
||||||
MenuWrite(_owner);
|
vcs->owner()->getUser()->owner()
|
||||||
|
->getLyXFunc()->Dispatch(LFUN_MENUWRITE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Maybe the save fails, or we answered "no". In both cases,
|
// Maybe the save fails, or we answered "no". In both cases,
|
||||||
// the document will be dirty, and we abort.
|
// the document will be dirty, and we abort.
|
||||||
if (!_owner->isLyxClean()) {
|
if (!vcs->owner()->isLyxClean()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -185,56 +105,49 @@ void LyXVC::registrer()
|
|||||||
WriteAlert(_("Info"), _("This document has NOT been registered."));
|
WriteAlert(_("Info"), _("This document has NOT been registered."));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
string cmd = "ci -q -u -i -t-\"";
|
|
||||||
cmd += tmp;
|
vcs->registrer(tmp);
|
||||||
cmd += "\" \"";
|
|
||||||
cmd += OnlyFilename(_owner->getFileName());
|
|
||||||
cmd += "\"";
|
|
||||||
doVCCommand(cmd);
|
|
||||||
_owner->getUser()->getOwner()->getLyXFunc()->Dispatch("buffer-reload");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LyXVC::checkIn()
|
void LyXVC::checkIn()
|
||||||
{
|
{
|
||||||
// If the document is changed, we might want to save it
|
// If the document is changed, we might want to save it
|
||||||
if (!_owner->isLyxClean() &&
|
if (!vcs->owner()->isLyxClean() &&
|
||||||
AskQuestion(_("Changes in document:"),
|
AskQuestion(_("Changes in document:"),
|
||||||
MakeDisplayPath(_owner->getFileName(),50),
|
MakeDisplayPath(vcs->owner()->getFileName(),50),
|
||||||
_("Save document and proceed?"))) {
|
_("Save document and proceed?"))) {
|
||||||
MenuWrite(_owner);
|
vcs->owner()->getUser()->owner()
|
||||||
|
->getLyXFunc()->Dispatch(LFUN_MENUWRITE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Maybe the save fails, or we answered "no". In both cases,
|
// Maybe the save fails, or we answered "no". In both cases,
|
||||||
// the document will be dirty, and we abort.
|
// the document will be dirty, and we abort.
|
||||||
if (!_owner->isLyxClean()) {
|
if (!vcs->owner()->isLyxClean()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
lyxerr[Debug::LYXVC] << "LyXVC: checkIn" << endl;
|
lyxerr[Debug::LYXVC] << "LyXVC: checkIn" << endl;
|
||||||
_owner->getUser()->getOwner()->getLyXFunc()->Dispatch(LFUN_MENUWRITE);
|
|
||||||
string tmp = askForText(_("LyX VC: Log Message"));
|
string tmp = askForText(_("LyX VC: Log Message"));
|
||||||
if (tmp.empty()) tmp = "(no log msg)";
|
if (tmp.empty()) tmp = "(no log msg)";
|
||||||
doVCCommand("ci -q -u -m\"" + tmp + "\" \""
|
|
||||||
+ OnlyFilename(_owner->getFileName()) + "\"");
|
vcs->checkIn(tmp);
|
||||||
_owner->getUser()->getOwner()->getLyXFunc()->Dispatch("buffer-reload");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LyXVC::checkOut()
|
void LyXVC::checkOut()
|
||||||
{
|
{
|
||||||
lyxerr[Debug::LYXVC] << "LyXVC: checkOut" << endl;
|
lyxerr[Debug::LYXVC] << "LyXVC: checkOut" << endl;
|
||||||
if (!_owner->isLyxClean()
|
if (!vcs->owner()->isLyxClean()
|
||||||
&& !AskQuestion(_("Changes in document:"),
|
&& !AskQuestion(_("Changes in document:"),
|
||||||
MakeDisplayPath(_owner->getFileName(),50),
|
MakeDisplayPath(vcs->owner()->getFileName(),50),
|
||||||
_("Ignore changes and proceed with check out?"))) {
|
_("Ignore changes and proceed with check out?"))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_owner->markLyxClean();
|
vcs->checkOut();
|
||||||
doVCCommand("co -q -l \""
|
|
||||||
+ OnlyFilename(_owner->getFileName()) + "\"");
|
|
||||||
_owner->getUser()->getOwner()->getLyXFunc()->Dispatch("buffer-reload");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -247,32 +160,27 @@ void LyXVC::revert()
|
|||||||
if (AskQuestion(_("When you revert, you will loose all changes made"),
|
if (AskQuestion(_("When you revert, you will loose all changes made"),
|
||||||
_("to the document since the last check in."),
|
_("to the document since the last check in."),
|
||||||
_("Do you still want to do it?"))) {
|
_("Do you still want to do it?"))) {
|
||||||
|
|
||||||
doVCCommand("co -f -u" + getVersion() + " \""
|
vcs->revert();
|
||||||
+ OnlyFilename(_owner->getFileName()) + "\"");
|
|
||||||
// We ignore changes and just reload!
|
|
||||||
_owner->markLyxClean();
|
|
||||||
_owner->getUser()->getOwner()->
|
|
||||||
getLyXFunc()->Dispatch("buffer-reload");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LyXVC::undoLast()
|
void LyXVC::undoLast()
|
||||||
{
|
{
|
||||||
lyxerr[Debug::LYXVC] << "LyXVC: undoLast" << endl;
|
vcs->undoLast();
|
||||||
doVCCommand("rcs -o" + getVersion() + " \""
|
|
||||||
+ OnlyFilename(_owner->getFileName()) + "\"");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LyXVC::toggleReadOnly()
|
void LyXVC::toggleReadOnly()
|
||||||
{
|
{
|
||||||
switch (vcstat) {
|
switch (vcs->stat()) {
|
||||||
case UNLOCKED:
|
case VCS::UNLOCKED:
|
||||||
|
lyxerr[Debug::LYXVC] << "LyXVC: toggle to locked" << endl;
|
||||||
checkOut();
|
checkOut();
|
||||||
break;
|
break;
|
||||||
case LOCKED:
|
case VCS::LOCKED:
|
||||||
|
lyxerr[Debug::LYXVC] << "LyXVC: toggle to unlocked" << endl;
|
||||||
checkIn();
|
checkIn();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -281,23 +189,23 @@ void LyXVC::toggleReadOnly()
|
|||||||
|
|
||||||
bool LyXVC::inUse()
|
bool LyXVC::inUse()
|
||||||
{
|
{
|
||||||
if (!master.empty())
|
if (vcs) return true;
|
||||||
return true;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
string const LyXVC::getVersion() const
|
string const & LyXVC::version() const
|
||||||
{
|
{
|
||||||
return version;
|
return vcs->version();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
string const LyXVC::getLocker() const
|
string const & LyXVC::locker() const
|
||||||
{
|
{
|
||||||
return locker;
|
return vcs->locker();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 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)
|
||||||
{
|
{
|
||||||
@ -354,14 +262,14 @@ 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,
|
fl_add_browser_line(browser->browser_latexlog,
|
||||||
_("No RCS History!"));
|
_("No VC History!"));
|
||||||
|
|
||||||
if (browser->LaTeXLog->visible) {
|
if (browser->LaTeXLog->visible) {
|
||||||
fl_raise_form(browser->LaTeXLog);
|
fl_raise_form(browser->LaTeXLog);
|
||||||
} else {
|
} else {
|
||||||
fl_show_form(browser->LaTeXLog,
|
fl_show_form(browser->LaTeXLog,
|
||||||
FL_PLACE_MOUSE | FL_FREE_SIZE, FL_FULLBORDER,
|
FL_PLACE_MOUSE | FL_FREE_SIZE, FL_FULLBORDER,
|
||||||
_("RCS History"));
|
_("VC History"));
|
||||||
if (ow < 0) {
|
if (ow < 0) {
|
||||||
ow = browser->LaTeXLog->w;
|
ow = browser->LaTeXLog->w;
|
||||||
oh = browser->LaTeXLog->h;
|
oh = browser->LaTeXLog->h;
|
||||||
@ -374,18 +282,7 @@ void LyXVC::viewLog(string const & fil)
|
|||||||
void LyXVC::showLog()
|
void LyXVC::showLog()
|
||||||
{
|
{
|
||||||
string tmpf = tmpnam(0);
|
string tmpf = tmpnam(0);
|
||||||
doVCCommand("rlog \""
|
vcs->getLog(tmpf);
|
||||||
+ OnlyFilename(_owner->getFileName()) + "\" > " + tmpf);
|
|
||||||
viewLog(tmpf);
|
viewLog(tmpf);
|
||||||
unlink(tmpf.c_str());
|
unlink(tmpf.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int LyXVC::doVCCommand(string const & cmd)
|
|
||||||
{
|
|
||||||
lyxerr[Debug::LYXVC] << "doVCCommand: " << cmd << endl;
|
|
||||||
Systemcalls one;
|
|
||||||
Path p(_owner->filepath);
|
|
||||||
int ret = one.startscript(Systemcalls::System, cmd);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
88
src/lyxvc.h
88
src/lyxvc.h
@ -1,7 +1,7 @@
|
|||||||
// -*- C++ -*-
|
// -*- C++ -*-
|
||||||
|
|
||||||
#ifndef _LYX_VC_H_
|
#ifndef LYX_VC_H
|
||||||
#define _LYX_VC_H_
|
#define LYX_VC_H
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma interface
|
#pragma interface
|
||||||
@ -10,22 +10,23 @@
|
|||||||
#include "LString.h"
|
#include "LString.h"
|
||||||
#include "latexoptions.h"
|
#include "latexoptions.h"
|
||||||
|
|
||||||
|
class VCS;
|
||||||
class Buffer;
|
class Buffer;
|
||||||
|
|
||||||
/** Version Control for LyX. This is the class giving the verison control
|
/** Version Control for LyX.
|
||||||
features to LyX. It is
|
This is the class giving the verison control features to LyX. It is
|
||||||
intended to support different kinds of version control, but at this point
|
intended to support different kinds of version control, but at this point
|
||||||
we will only support RCS. Later CVS is a likely candidate for support.
|
we will only support RCS. Later CVS is a likely candidate for support.
|
||||||
The support in LyX is based loosely upon the version control in GNU Emacs,
|
The support in LyX is based loosely upon the version control in GNU Emacs,
|
||||||
but is not as extensive as that one. See examples/VC.lyx for a simple
|
but is not as extensive as that one. See examples/VC.lyx for a simple
|
||||||
tutorial and manual for the use of the version control system in LyX.
|
tutorial and manual for the use of the version control system in LyX.
|
||||||
|
|
||||||
LyXVC use this algorithm when it searches for VC files:
|
LyXVC use this algorithm when it searches for VC files:
|
||||||
for RCS it searches for <filename>,v and RCS/<filename>,v similar
|
for RCS it searches for <filename>,v and RCS/<filename>,v similar
|
||||||
should be done for CVS. By doing this there doesn't need to be any
|
should be done for CVS. By doing this there doesn't need to be any
|
||||||
special support for VC in the lyx format, and this is especially good
|
special support for VC in the lyx format, and this is especially good
|
||||||
when the lyx format will be a subset of LaTeX.
|
when the lyx format will be a subset of LaTeX.
|
||||||
*/
|
*/
|
||||||
class LyXVC {
|
class LyXVC {
|
||||||
public:
|
public:
|
||||||
///
|
///
|
||||||
@ -51,9 +52,7 @@ public:
|
|||||||
static bool file_not_found_hook(string const & fn);
|
static bool file_not_found_hook(string const & fn);
|
||||||
|
|
||||||
///
|
///
|
||||||
void scanMaster();
|
void buffer(Buffer *);
|
||||||
///
|
|
||||||
void setBuffer(Buffer*);
|
|
||||||
|
|
||||||
/// Register the document as an VC file.
|
/// Register the document as an VC file.
|
||||||
void registrer();
|
void registrer();
|
||||||
@ -83,60 +82,25 @@ public:
|
|||||||
bool inUse();
|
bool inUse();
|
||||||
|
|
||||||
/// Returns the version number.
|
/// Returns the version number.
|
||||||
string const getVersion() const;
|
string const & version() const;
|
||||||
|
|
||||||
/// Returns the userid of the person who has locked the doc.
|
/// Returns the userid of the person who has locked the doc.
|
||||||
string const getLocker() const;
|
string const & locker() const;
|
||||||
|
|
||||||
///
|
///
|
||||||
static void logClose(FL_OBJECT*, long);
|
static void logClose(FL_OBJECT *, long);
|
||||||
///
|
///
|
||||||
static void logUpdate(FL_OBJECT*, long);
|
static void logUpdate(FL_OBJECT *, long);
|
||||||
protected:
|
protected:
|
||||||
private:
|
private:
|
||||||
///
|
///
|
||||||
int doVCCommand(string const&);
|
Buffer * owner_;
|
||||||
|
|
||||||
/** The master VC file. For RCS this is *,v or RCS/ *,v. master should
|
///
|
||||||
have full path.
|
VCS * vcs;
|
||||||
*/
|
|
||||||
string master;
|
|
||||||
|
|
||||||
/** The version of the VC file. I am not sure if this can be a
|
|
||||||
string of if it must be a
|
|
||||||
float/int. */
|
|
||||||
string version;
|
|
||||||
|
|
||||||
/// The user currently keeping the lock on the VC file.
|
|
||||||
string locker;
|
|
||||||
|
|
||||||
///
|
///
|
||||||
enum VCStatus {
|
FD_LaTeXLog * browser; // FD_LaTeXLog is just a browser with a
|
||||||
///
|
|
||||||
UNLOCKED,
|
|
||||||
///
|
|
||||||
LOCKED
|
|
||||||
};
|
|
||||||
|
|
||||||
/// The status of the VC controlled file.
|
|
||||||
VCStatus vcstat;
|
|
||||||
|
|
||||||
///
|
|
||||||
enum Backend {
|
|
||||||
///
|
|
||||||
UNKNOWN_VCS,
|
|
||||||
///
|
|
||||||
RCS_VCS
|
|
||||||
};
|
|
||||||
|
|
||||||
/// The VC backend used. (so far this can only be RCS)
|
|
||||||
Backend backend;
|
|
||||||
|
|
||||||
/// The buffer using this VC
|
|
||||||
Buffer *_owner;
|
|
||||||
|
|
||||||
///
|
|
||||||
FD_LaTeXLog *browser; // FD_LaTeXLog is just a browser with a
|
|
||||||
// close button. Unfortunately we can not use the standard callbacks.
|
// close button. Unfortunately we can not use the standard callbacks.
|
||||||
};
|
};
|
||||||
|
|
||||||
|
18
src/menus.C
18
src/menus.C
@ -458,7 +458,7 @@ 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->buffer();
|
||||||
LyXFunc * tmpfunc = men->_view->getLyXFunc();
|
LyXFunc * tmpfunc = men->_view->getLyXFunc();
|
||||||
|
|
||||||
bool LinuxDoc = tmpbuffer->isLinuxDoc();
|
bool LinuxDoc = tmpbuffer->isLinuxDoc();
|
||||||
@ -673,7 +673,7 @@ void Menus::ShowFileMenu(FL_OBJECT * ob, long)
|
|||||||
case 18: // The first item with lastfiles.
|
case 18: // The first item with lastfiles.
|
||||||
default:
|
default:
|
||||||
men->currentView()
|
men->currentView()
|
||||||
->setBuffer(bufferlist
|
->buffer(bufferlist
|
||||||
.loadLyXFile((*lastfiles)[choice - 18]));
|
.loadLyXFile((*lastfiles)[choice - 18]));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -789,7 +789,7 @@ void Menus::ShowFileMenu2(FL_OBJECT * ob, long)
|
|||||||
case 6: // The first item with lastfiles.
|
case 6: // The first item with lastfiles.
|
||||||
default:
|
default:
|
||||||
men->currentView()
|
men->currentView()
|
||||||
->setBuffer(bufferlist
|
->buffer(bufferlist
|
||||||
.loadLyXFile((*lastfiles)[choice - 6]));
|
.loadLyXFile((*lastfiles)[choice - 6]));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -810,7 +810,7 @@ void Menus::ShowEditMenu(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->buffer();
|
||||||
LyXFunc * tmpfunc = men->_view->getLyXFunc();
|
LyXFunc * tmpfunc = men->_view->getLyXFunc();
|
||||||
|
|
||||||
// Floats & Insets submenu
|
// Floats & Insets submenu
|
||||||
@ -1135,7 +1135,7 @@ 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->buffer();
|
||||||
LyXFunc * tmpfunc = men->_view->getLyXFunc();
|
LyXFunc * tmpfunc = men->_view->getLyXFunc();
|
||||||
|
|
||||||
int LayoutMenu = fl_newpup(FL_ObjWin(ob));
|
int LayoutMenu = fl_newpup(FL_ObjWin(ob));
|
||||||
@ -1225,7 +1225,7 @@ void Menus::ShowInsertMenu(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->buffer();
|
||||||
LyXFunc * tmpfunc = men->_view->getLyXFunc();
|
LyXFunc * tmpfunc = men->_view->getLyXFunc();
|
||||||
|
|
||||||
int SubInsertAscii = fl_defpup(FL_ObjWin(ob),
|
int SubInsertAscii = fl_defpup(FL_ObjWin(ob),
|
||||||
@ -1428,7 +1428,7 @@ void Menus::ShowMathMenu(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->buffer();
|
||||||
LyXFunc * tmpfunc = men->_view->getLyXFunc();
|
LyXFunc * tmpfunc = men->_view->getLyXFunc();
|
||||||
|
|
||||||
int MathMenu = fl_defpup(FL_ObjWin(ob),
|
int MathMenu = fl_defpup(FL_ObjWin(ob),
|
||||||
@ -1662,7 +1662,7 @@ 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"),
|
||||||
MakeDisplayPath(fname),"...");
|
MakeDisplayPath(fname),"...");
|
||||||
currentView()->setBuffer(bufferlist.loadLyXFile(fname,false));
|
currentView()->buffer(bufferlist.loadLyXFile(fname,false));
|
||||||
|
|
||||||
if (docname == "Reference")
|
if (docname == "Reference")
|
||||||
_view->getLyXFunc()->Dispatch(LFUN_TOCVIEW);
|
_view->getLyXFunc()->Dispatch(LFUN_TOCVIEW);
|
||||||
@ -1671,5 +1671,5 @@ void Menus::MenuDocu(string const & docname)
|
|||||||
|
|
||||||
void Menus::handleBufferMenu(int choice)
|
void Menus::handleBufferMenu(int choice)
|
||||||
{
|
{
|
||||||
currentView()->setBuffer(bufferlist.getBuffer(choice));
|
currentView()->buffer(bufferlist.getBuffer(choice));
|
||||||
}
|
}
|
||||||
|
@ -30,20 +30,20 @@ extern string keyseqOptions(int l=190);
|
|||||||
extern string keyseqStr(int l=190);
|
extern string keyseqStr(int l=190);
|
||||||
extern LyXAction lyxaction;
|
extern LyXAction lyxaction;
|
||||||
|
|
||||||
void MiniBuffer::TimerCB(FL_OBJECT *, long tmp)
|
void MiniBuffer::TimerCB(FL_OBJECT * ob, long)
|
||||||
{
|
{
|
||||||
MiniBuffer *obj= (MiniBuffer*)tmp;
|
MiniBuffer * obj = static_cast<MiniBuffer*>(ob->u_vdata);
|
||||||
obj->Init();
|
obj->Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" void C_MiniBuffer_TimerCB(FL_OBJECT *ob, long data)
|
extern "C" void C_MiniBuffer_TimerCB(FL_OBJECT * ob, long data)
|
||||||
{
|
{
|
||||||
MiniBuffer::TimerCB(ob, data);
|
MiniBuffer::TimerCB(ob, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MiniBuffer::ExecutingCB(FL_OBJECT *ob, long)
|
void MiniBuffer::ExecutingCB(FL_OBJECT * ob, long)
|
||||||
{
|
{
|
||||||
MiniBuffer *obj = (MiniBuffer*)ob->u_vdata;
|
MiniBuffer * obj = static_cast<MiniBuffer*>(ob->u_vdata);
|
||||||
lyxerr.debug() << "Getting ready to execute: " << obj->cur_cmd << endl;
|
lyxerr.debug() << "Getting ready to execute: " << obj->cur_cmd << endl;
|
||||||
fl_set_focus_object(obj->owner->getForm(),
|
fl_set_focus_object(obj->owner->getForm(),
|
||||||
obj->owner->currentView()->getWorkArea());
|
obj->owner->currentView()->getWorkArea());
|
||||||
@ -68,7 +68,7 @@ void MiniBuffer::ExecutingCB(FL_OBJECT *ob, long)
|
|||||||
<< "\nArg : " << arg << endl;
|
<< "\nArg : " << arg << endl;
|
||||||
|
|
||||||
// Dispatch only returns requested data for a few commands (ale)
|
// Dispatch only returns requested data for a few commands (ale)
|
||||||
string res=obj->owner->getLyXFunc()->Dispatch(function.c_str(),
|
string res = obj->owner->getLyXFunc()->Dispatch(function.c_str(),
|
||||||
arg.c_str());
|
arg.c_str());
|
||||||
lyxerr.debug() << "Minibuffer Res: " << res << endl;
|
lyxerr.debug() << "Minibuffer Res: " << res << endl;
|
||||||
obj->shows_no_match = false;
|
obj->shows_no_match = false;
|
||||||
@ -76,19 +76,19 @@ void MiniBuffer::ExecutingCB(FL_OBJECT *ob, long)
|
|||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" void C_MiniBuffer_ExecutingCB(FL_OBJECT *ob, long data)
|
extern "C" void C_MiniBuffer_ExecutingCB(FL_OBJECT * ob, long data)
|
||||||
{
|
{
|
||||||
MiniBuffer::TimerCB(ob, data);
|
MiniBuffer::TimerCB(ob, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is not as dirty as it seems, the hidden buttons removed by this
|
// This is not as dirty as it seems, the hidden buttons removed by this
|
||||||
// function were just kludges for an uncomplete keyboard callback (ale)
|
// function were just kludges for an uncomplete keyboard callback (ale)
|
||||||
int MiniBuffer::peek_event(FL_OBJECT *ob, int event, FL_Coord, FL_Coord,
|
int MiniBuffer::peek_event(FL_OBJECT * ob, int event, FL_Coord, FL_Coord,
|
||||||
int key, void */*xev*/)
|
int key, void */*xev*/)
|
||||||
{
|
{
|
||||||
MiniBuffer *mini = (MiniBuffer*)ob->u_vdata;
|
MiniBuffer * mini = static_cast<MiniBuffer*>(ob->u_vdata);
|
||||||
|
|
||||||
if (event==FL_KEYBOARD){
|
if (event == FL_KEYBOARD){
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case XK_Down:
|
case XK_Down:
|
||||||
mini->history_idx++;
|
mini->history_idx++;
|
||||||
@ -105,7 +105,7 @@ int MiniBuffer::peek_event(FL_OBJECT *ob, int event, FL_Coord, FL_Coord,
|
|||||||
case XK_Tab:
|
case XK_Tab:
|
||||||
{
|
{
|
||||||
// complete or increment the command
|
// complete or increment the command
|
||||||
const char *s = lyxaction.getApproxFuncName(fl_get_input(ob));
|
char const * s = lyxaction.getApproxFuncName(fl_get_input(ob));
|
||||||
if (s && s[0])
|
if (s && s[0])
|
||||||
fl_set_input(ob, s);
|
fl_set_input(ob, s);
|
||||||
return 1;
|
return 1;
|
||||||
@ -130,9 +130,9 @@ int MiniBuffer::peek_event(FL_OBJECT *ob, int event, FL_Coord, FL_Coord,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" int C_MiniBuffer_peek_event(FL_OBJECT *ob, int event,
|
extern "C" int C_MiniBuffer_peek_event(FL_OBJECT * ob, int event,
|
||||||
FL_Coord, FL_Coord,
|
FL_Coord, FL_Coord,
|
||||||
int key, void *xev)
|
int key, void * xev)
|
||||||
{
|
{
|
||||||
return MiniBuffer::peek_event(ob,event,0,0,key,xev);
|
return MiniBuffer::peek_event(ob,event,0,0,key,xev);
|
||||||
}
|
}
|
||||||
@ -146,10 +146,10 @@ void MiniBuffer::ExecCommand()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
FL_OBJECT *MiniBuffer::add(int type, FL_Coord x, FL_Coord y,
|
FL_OBJECT * MiniBuffer::add(int type, FL_Coord x, FL_Coord y,
|
||||||
FL_Coord w, FL_Coord h)
|
FL_Coord w, FL_Coord h)
|
||||||
{
|
{
|
||||||
FL_OBJECT *obj;
|
FL_OBJECT * obj;
|
||||||
|
|
||||||
the_buffer = obj = fl_add_input(type,x,y,w,h,text.c_str());
|
the_buffer = obj = fl_add_input(type,x,y,w,h,text.c_str());
|
||||||
fl_set_object_boxtype(obj,FL_DOWN_BOX);
|
fl_set_object_boxtype(obj,FL_DOWN_BOX);
|
||||||
@ -161,12 +161,13 @@ FL_OBJECT *MiniBuffer::add(int type, FL_Coord x, FL_Coord y,
|
|||||||
|
|
||||||
// To intercept Up, Down, Table for history
|
// To intercept Up, Down, Table for history
|
||||||
fl_set_object_prehandler(obj, C_MiniBuffer_peek_event);
|
fl_set_object_prehandler(obj, C_MiniBuffer_peek_event);
|
||||||
obj->u_vdata = (void*)this;
|
obj->u_vdata = this;
|
||||||
obj->wantkey = FL_KEY_TAB;
|
obj->wantkey = FL_KEY_TAB;
|
||||||
|
|
||||||
// timer
|
// timer
|
||||||
timer = fl_add_timer(FL_HIDDEN_TIMER, 0,0,0,0, "Timer");
|
timer = fl_add_timer(FL_HIDDEN_TIMER, 0,0,0,0, "Timer");
|
||||||
fl_set_object_callback(timer, C_MiniBuffer_TimerCB, (long)this);
|
fl_set_object_callback(timer, C_MiniBuffer_TimerCB, 0);
|
||||||
|
timer->u_vdata = this;
|
||||||
fl_set_input(the_buffer, text.c_str());
|
fl_set_input(the_buffer, text.c_str());
|
||||||
|
|
||||||
return obj;
|
return obj;
|
||||||
@ -210,23 +211,23 @@ void MiniBuffer::Init()
|
|||||||
// Else, show the buffer state.
|
// Else, show the buffer state.
|
||||||
else if (owner->currentView()->available()) {
|
else if (owner->currentView()->available()) {
|
||||||
string nicename =
|
string nicename =
|
||||||
MakeDisplayPath(owner->currentBuffer()->
|
MakeDisplayPath(owner->buffer()->
|
||||||
getFileName());
|
getFileName());
|
||||||
// Should we do this instead? (kindo like emacs)
|
// Should we do this instead? (kindo like emacs)
|
||||||
// leaves more room for other information
|
// leaves more room for other information
|
||||||
text = "LyX: ";
|
text = "LyX: ";
|
||||||
text += nicename;
|
text += nicename;
|
||||||
if (owner->currentBuffer()->lyxvc.inUse()) {
|
if (owner->buffer()->lyxvc.inUse()) {
|
||||||
text += " [RCS:";
|
text += " [";
|
||||||
text += owner->currentBuffer()->lyxvc.getVersion();
|
text += owner->buffer()->lyxvc.version();
|
||||||
text += ' ';
|
text += ' ';
|
||||||
text += owner->currentBuffer()->lyxvc.getLocker();
|
text += owner->buffer()->lyxvc.locker();
|
||||||
if (owner->currentBuffer()->isReadonly())
|
if (owner->buffer()->isReadonly())
|
||||||
text += " (RO)";
|
text += " (RO)";
|
||||||
text += ']';
|
text += ']';
|
||||||
} else if (owner->currentBuffer()->isReadonly())
|
} else if (owner->buffer()->isReadonly())
|
||||||
text += " [RO]";
|
text += " [RO]";
|
||||||
if (!owner->currentBuffer()->isLyxClean())
|
if (!owner->buffer()->isLyxClean())
|
||||||
text += _(" (Changed)");
|
text += _(" (Changed)");
|
||||||
} else {
|
} else {
|
||||||
if (text != _("Welcome to LyX!")) // this is a hack
|
if (text != _("Welcome to LyX!")) // this is a hack
|
||||||
|
@ -454,7 +454,7 @@ void LyXParagraph::validate(LaTeXFeatures & features)
|
|||||||
if (layout.needprotect
|
if (layout.needprotect
|
||||||
&& next && next->footnoteflag != LyXParagraph::NO_FOOTNOTE)
|
&& next && next->footnoteflag != LyXParagraph::NO_FOOTNOTE)
|
||||||
features.NeedLyXFootnoteCode = true;
|
features.NeedLyXFootnoteCode = true;
|
||||||
if ((current_view->currentBuffer()->params.paragraph_separation == LYX_PARSEP_INDENT) &&
|
if ((current_view->buffer()->params.paragraph_separation == LYX_PARSEP_INDENT) &&
|
||||||
(pextra_type == PEXTRA_MINIPAGE))
|
(pextra_type == PEXTRA_MINIPAGE))
|
||||||
features.NeedLyXMinipageIndent = true;
|
features.NeedLyXMinipageIndent = true;
|
||||||
if (table && table->NeedRotating())
|
if (table && table->NeedRotating())
|
||||||
@ -3735,7 +3735,7 @@ void LyXParagraph::SimpleTeXSpecialChars(string & file, TexRow & texrow,
|
|||||||
case '°': case '±': case '²': case '³':
|
case '°': case '±': case '²': case '³':
|
||||||
case '×': case '÷': case '¹': case 'ª':
|
case '×': case '÷': case '¹': case 'ª':
|
||||||
case 'º': case '¬': case 'µ':
|
case 'º': case '¬': case 'µ':
|
||||||
if (current_view->currentBuffer()->params.inputenc == "latin1") {
|
if (current_view->buffer()->params.inputenc == "latin1") {
|
||||||
file += "\\ensuremath{";
|
file += "\\ensuremath{";
|
||||||
file += c;
|
file += c;
|
||||||
file += '}';
|
file += '}';
|
||||||
@ -3806,7 +3806,7 @@ void LyXParagraph::SimpleTeXSpecialChars(string & file, TexRow & texrow,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case '£':
|
case '£':
|
||||||
if (current_view->currentBuffer()->params.inputenc == "default") {
|
if (current_view->buffer()->params.inputenc == "default") {
|
||||||
file += "\\pounds{}";
|
file += "\\pounds{}";
|
||||||
column += 8;
|
column += 8;
|
||||||
} else {
|
} else {
|
||||||
@ -4048,7 +4048,7 @@ LyXParagraph * LyXParagraph::TeXEnvironment(string & file, TexRow & texrow,
|
|||||||
// flags when footnotetext should be appended to file.
|
// flags when footnotetext should be appended to file.
|
||||||
static bool minipage_open = false;
|
static bool minipage_open = false;
|
||||||
static int minipage_open_depth = 0;
|
static int minipage_open_depth = 0;
|
||||||
char par_sep = current_view->currentBuffer()->params.paragraph_separation;
|
char par_sep = current_view->buffer()->params.paragraph_separation;
|
||||||
|
|
||||||
lyxerr[Debug::LATEX] << "TeXEnvironment... " << this << endl;
|
lyxerr[Debug::LATEX] << "TeXEnvironment... " << this << endl;
|
||||||
if (IsDummy())
|
if (IsDummy())
|
||||||
@ -4347,7 +4347,7 @@ LyXParagraph * LyXParagraph::TeXFootnote(string & file, TexRow & texrow,
|
|||||||
texrow.newline();
|
texrow.newline();
|
||||||
}
|
}
|
||||||
|
|
||||||
BufferParams * params = ¤t_view->currentBuffer()->params;
|
BufferParams * params = ¤t_view->buffer()->params;
|
||||||
bool footer_in_body = true;
|
bool footer_in_body = true;
|
||||||
switch (footnotekind) {
|
switch (footnotekind) {
|
||||||
case LyXParagraph::FOOTNOTE:
|
case LyXParagraph::FOOTNOTE:
|
||||||
|
@ -325,13 +325,13 @@ void create_ispell_pipe(string const & lang)
|
|||||||
argv[argc++] = tmp;
|
argv[argc++] = tmp;
|
||||||
}
|
}
|
||||||
if (lyxrc->isp_use_input_encoding &&
|
if (lyxrc->isp_use_input_encoding &&
|
||||||
current_view->currentBuffer()->params.inputenc != "default") {
|
current_view->buffer()->params.inputenc != "default") {
|
||||||
tmp = new char[3];
|
tmp = new char[3];
|
||||||
string("-T").copy(tmp, 2); tmp[2] = '\0';
|
string("-T").copy(tmp, 2); tmp[2] = '\0';
|
||||||
argv[argc++] = tmp; // Input encoding
|
argv[argc++] = tmp; // Input encoding
|
||||||
tmp = new char[current_view->currentBuffer()->params.inputenc.length() + 1];
|
tmp = new char[current_view->buffer()->params.inputenc.length() + 1];
|
||||||
current_view->currentBuffer()->params.inputenc.copy(tmp, current_view->currentBuffer()->params.inputenc.length());
|
current_view->buffer()->params.inputenc.copy(tmp, current_view->buffer()->params.inputenc.length());
|
||||||
tmp[current_view->currentBuffer()->params.inputenc.length()] = '\0';
|
tmp[current_view->buffer()->params.inputenc.length()] = '\0';
|
||||||
argv[argc++] = tmp;
|
argv[argc++] = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -585,7 +585,7 @@ void ShowSpellChecker()
|
|||||||
fl_set_object_lcol(fd_form_spell_check->input, FL_BLACK);
|
fl_set_object_lcol(fd_form_spell_check->input, FL_BLACK);
|
||||||
fl_set_object_lcol(fd_form_spell_check->browser, FL_BLACK);
|
fl_set_object_lcol(fd_form_spell_check->browser, FL_BLACK);
|
||||||
// activate replace only if the file is not read-only
|
// activate replace only if the file is not read-only
|
||||||
if (!current_view->currentBuffer()->isReadonly()) {
|
if (!current_view->buffer()->isReadonly()) {
|
||||||
fl_activate_object(fd_form_spell_check->replace);
|
fl_activate_object(fd_form_spell_check->replace);
|
||||||
fl_set_object_lcol(fd_form_spell_check->replace, FL_BLACK);
|
fl_set_object_lcol(fd_form_spell_check->replace, FL_BLACK);
|
||||||
}
|
}
|
||||||
@ -596,7 +596,7 @@ void ShowSpellChecker()
|
|||||||
fl_set_object_lcol(fd_form_spell_check->options, FL_INACTIVE);
|
fl_set_object_lcol(fd_form_spell_check->options, FL_INACTIVE);
|
||||||
fl_set_object_lcol(fd_form_spell_check->start, FL_INACTIVE);
|
fl_set_object_lcol(fd_form_spell_check->start, FL_INACTIVE);
|
||||||
|
|
||||||
ret = RunSpellChecker(current_view->currentBuffer()->GetLanguage());
|
ret = RunSpellChecker(current_view->buffer()->GetLanguage());
|
||||||
|
|
||||||
// deactivate insert, accept, replace, and stop
|
// deactivate insert, accept, replace, and stop
|
||||||
fl_deactivate_object(fd_form_spell_check->insert);
|
fl_deactivate_object(fd_form_spell_check->insert);
|
||||||
|
@ -629,7 +629,8 @@ lyxstring & lyxstring::assign(iterator first, iterator last)
|
|||||||
lyxstring::const_reference lyxstring::operator[](size_type pos) const
|
lyxstring::const_reference lyxstring::operator[](size_type pos) const
|
||||||
{
|
{
|
||||||
Assert(pos <= rep->sz); // OURS!
|
Assert(pos <= rep->sz); // OURS!
|
||||||
return pos == rep->sz ? '\0' : rep->s[pos];
|
static char helper = '\0';
|
||||||
|
return pos == rep->sz ? helper : rep->s[pos];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -31,9 +31,9 @@ void LaTeXOptionsOK(FL_OBJECT *ob, long data)
|
|||||||
void LaTeXOptionsApply(FL_OBJECT *, long)
|
void LaTeXOptionsApply(FL_OBJECT *, long)
|
||||||
{
|
{
|
||||||
if (fl_get_button(fd_latex_options->accents))
|
if (fl_get_button(fd_latex_options->accents))
|
||||||
current_view->currentBuffer()->params.allowAccents = true;
|
current_view->buffer()->params.allowAccents = true;
|
||||||
else
|
else
|
||||||
current_view->currentBuffer()->params.allowAccents = false;
|
current_view->buffer()->params.allowAccents = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LaTeXOptionsCancel(FL_OBJECT *, long)
|
void LaTeXOptionsCancel(FL_OBJECT *, long)
|
||||||
|
@ -1807,8 +1807,8 @@ void LyXText::TableFeatures(int feature)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case LyXTable::DELETE_ROW:
|
case LyXTable::DELETE_ROW:
|
||||||
if (current_view->currentBuffer()->the_locking_inset)
|
if (current_view->buffer()->the_locking_inset)
|
||||||
UnlockInset(current_view->currentBuffer()->the_locking_inset);
|
UnlockInset(current_view->buffer()->the_locking_inset);
|
||||||
RemoveTableRow(&cursor);
|
RemoveTableRow(&cursor);
|
||||||
RedoParagraph();
|
RedoParagraph();
|
||||||
return;
|
return;
|
||||||
@ -1821,8 +1821,8 @@ void LyXText::TableFeatures(int feature)
|
|||||||
#endif
|
#endif
|
||||||
int cell_org = actCell;
|
int cell_org = actCell;
|
||||||
int cell = 0;
|
int cell = 0;
|
||||||
if (current_view->currentBuffer()->the_locking_inset)
|
if (current_view->buffer()->the_locking_inset)
|
||||||
UnlockInset(current_view->currentBuffer()->the_locking_inset);
|
UnlockInset(current_view->buffer()->the_locking_inset);
|
||||||
do {
|
do {
|
||||||
if (!pos || (cursor.par->IsNewline(pos-1))){
|
if (!pos || (cursor.par->IsNewline(pos-1))){
|
||||||
if (cursor.par->table->DeleteCellIfColumnIsDeleted(cell, cell_org)){
|
if (cursor.par->table->DeleteCellIfColumnIsDeleted(cell, cell_org)){
|
||||||
|
@ -97,7 +97,7 @@ string TransDeadkeyState::normalkey(char c,char *trans)
|
|||||||
}
|
}
|
||||||
if (l==0) {
|
if (l==0) {
|
||||||
// Not an exception. Check if it allowed
|
// Not an exception. Check if it allowed
|
||||||
if (current_view->currentBuffer()->params.allowAccents==true ||
|
if (current_view->buffer()->params.allowAccents==true ||
|
||||||
countChar(deadkey_info_.allowed, c) > 0) {
|
countChar(deadkey_info_.allowed, c) > 0) {
|
||||||
res=DoAccent(c,deadkey_info_.accent);
|
res=DoAccent(c,deadkey_info_.accent);
|
||||||
} else {
|
} else {
|
||||||
|
306
src/vc-backend.C
Normal file
306
src/vc-backend.C
Normal file
@ -0,0 +1,306 @@
|
|||||||
|
#include <config.h>
|
||||||
|
|
||||||
|
#ifdef __GNUG__
|
||||||
|
#pragma implementation
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <fstream>
|
||||||
|
|
||||||
|
#include "vc-backend.h"
|
||||||
|
#include "debug.h"
|
||||||
|
#include "support/FileInfo.h"
|
||||||
|
#include "support/LRegex.h"
|
||||||
|
#include "support/LSubstring.h"
|
||||||
|
#include "support/path.h"
|
||||||
|
#include "buffer.h"
|
||||||
|
#include "LyXView.h"
|
||||||
|
#include "lyxfunc.h"
|
||||||
|
|
||||||
|
|
||||||
|
int VCS::doVCCommand(string const & cmd)
|
||||||
|
{
|
||||||
|
lyxerr[Debug::LYXVC] << "doVCCommand: " << cmd << endl;
|
||||||
|
Systemcalls one;
|
||||||
|
Path p(owner_->filepath);
|
||||||
|
int ret = one.startscript(Systemcalls::System, cmd);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
RCS::RCS(string const & m)
|
||||||
|
{
|
||||||
|
master_ = m;
|
||||||
|
scanMaster();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
string RCS::find_file(string const & file)
|
||||||
|
{
|
||||||
|
string tmp(file);
|
||||||
|
// Check if *,v exists.
|
||||||
|
tmp += ",v";
|
||||||
|
FileInfo f;
|
||||||
|
lyxerr[Debug::LYXVC] << "Checking if file is under rcs: "
|
||||||
|
<< tmp << endl;
|
||||||
|
if (f.newFile(tmp).readable()) {
|
||||||
|
lyxerr[Debug::LYXVC] << "Yes " << file
|
||||||
|
<< " is under rcs." << endl;
|
||||||
|
return tmp;
|
||||||
|
} else {
|
||||||
|
// Check if RCS/*,v exists.
|
||||||
|
tmp = AddName(AddPath(OnlyPath(file), "RCS"), file);
|
||||||
|
tmp += ",v";
|
||||||
|
lyxerr[Debug::LYXVC] << "Checking if file is under rcs: "
|
||||||
|
<< tmp << endl;
|
||||||
|
if (f.newFile(tmp).readable()) {
|
||||||
|
lyxerr[Debug::LYXVC] << "Yes " << file
|
||||||
|
<< " it is under rcs."<< endl;
|
||||||
|
return tmp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return string();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void RCS::scanMaster()
|
||||||
|
{
|
||||||
|
lyxerr[Debug::LYXVC] << "LyXVC::RCS: scanMaster." << endl;
|
||||||
|
|
||||||
|
ifstream ifs(master_.c_str());
|
||||||
|
|
||||||
|
string token;
|
||||||
|
bool read_enough = false;
|
||||||
|
|
||||||
|
while (!read_enough && ifs >> token) {
|
||||||
|
lyxerr[Debug::LYXVC]
|
||||||
|
<< "LyXVC::scanMaster: current lex text: `"
|
||||||
|
<< token << "'" << endl;
|
||||||
|
|
||||||
|
if (token.empty())
|
||||||
|
continue;
|
||||||
|
else if (token == "head") {
|
||||||
|
// get version here
|
||||||
|
string tmv;
|
||||||
|
ifs >> tmv;
|
||||||
|
tmv = strip(tmv, ';');
|
||||||
|
version_ = tmv;
|
||||||
|
lyxerr[Debug::LYXVC] << "LyXVC: version found to be "
|
||||||
|
<< tmv << endl;
|
||||||
|
} else if (contains(token, "access")
|
||||||
|
|| contains(token, "symbols")
|
||||||
|
|| contains(token, "strict")) {
|
||||||
|
// nothing
|
||||||
|
} else if (contains(token, "locks")) {
|
||||||
|
// get locker here
|
||||||
|
if (contains(token, ";")) {
|
||||||
|
locker_ = "Unlocked";
|
||||||
|
vcstat = UNLOCKED;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
string tmpt, s1, s2;
|
||||||
|
do {
|
||||||
|
ifs >> tmpt;
|
||||||
|
s1 = strip(tmpt, ';');
|
||||||
|
// tmp is now in the format <user>:<version>
|
||||||
|
s1 = split(s1, s2, ':');
|
||||||
|
// s2 is user, and s1 is version
|
||||||
|
if (s1 == version_) {
|
||||||
|
locker_ = s2;
|
||||||
|
vcstat = LOCKED;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} while (!contains(tmpt, ";"));
|
||||||
|
|
||||||
|
} else if (token == "comment") {
|
||||||
|
// we don't need to read any further than this.
|
||||||
|
read_enough = true;
|
||||||
|
} else {
|
||||||
|
// unexpected
|
||||||
|
lyxerr[Debug::LYXVC]
|
||||||
|
<< "LyXVC::scanMaster(): unexpected token"
|
||||||
|
<< endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
version_ = "RCS: " + version_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void RCS::registrer(string const & msg)
|
||||||
|
{
|
||||||
|
string cmd = "ci -q -u -i -t-\"";
|
||||||
|
cmd += msg;
|
||||||
|
cmd += "\" \"";
|
||||||
|
cmd += OnlyFilename(owner_->getFileName());
|
||||||
|
cmd += "\"";
|
||||||
|
doVCCommand(cmd);
|
||||||
|
owner_->getUser()->owner()->getLyXFunc()->Dispatch("buffer-reload");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void RCS::checkIn(string const & msg)
|
||||||
|
{
|
||||||
|
doVCCommand("ci -q -u -m\"" + msg + "\" \""
|
||||||
|
+ OnlyFilename(owner_->getFileName()) + "\"");
|
||||||
|
owner_->getUser()->owner()->getLyXFunc()->Dispatch("buffer-reload");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void RCS::checkOut()
|
||||||
|
{
|
||||||
|
owner_->markLyxClean();
|
||||||
|
doVCCommand("co -q -l \""
|
||||||
|
+ OnlyFilename(owner_->getFileName()) + "\"");
|
||||||
|
owner_->getUser()->owner()->getLyXFunc()->Dispatch("buffer-reload");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void RCS::revert()
|
||||||
|
{
|
||||||
|
doVCCommand("co -f -u" + version() + " \""
|
||||||
|
+ OnlyFilename(owner_->getFileName()) + "\"");
|
||||||
|
// We ignore changes and just reload!
|
||||||
|
owner_->markLyxClean();
|
||||||
|
owner_->getUser()->owner()
|
||||||
|
->getLyXFunc()->Dispatch("buffer-reload");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void RCS::undoLast()
|
||||||
|
{
|
||||||
|
lyxerr[Debug::LYXVC] << "LyXVC: undoLast" << endl;
|
||||||
|
doVCCommand("rcs -o" + version() + " \""
|
||||||
|
+ OnlyFilename(owner_->getFileName()) + "\"");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void RCS::getLog(string const & tmpf)
|
||||||
|
{
|
||||||
|
doVCCommand("rlog \""
|
||||||
|
+ OnlyFilename(owner_->getFileName()) + "\" > " + tmpf);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
CVS::CVS(string const & m, string const & f)
|
||||||
|
{
|
||||||
|
master_ = m;
|
||||||
|
file_ = f;
|
||||||
|
scanMaster();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
string CVS::find_file(string const & file)
|
||||||
|
{
|
||||||
|
// First we look for the CVS/Entries in the same dir
|
||||||
|
// where we have file.
|
||||||
|
string dir = OnlyPath(file);
|
||||||
|
string tmpf = "/" + OnlyFilename(file) + "/";
|
||||||
|
dir += "/CVS/Entries";
|
||||||
|
lyxerr[Debug::LYXVC] << "LyXVC: checking in `" << dir
|
||||||
|
<< "' for `" << tmpf << "'" << endl;
|
||||||
|
FileInfo f(dir);
|
||||||
|
if (f.readable()) {
|
||||||
|
// Ok we are at least in a CVS dir. Parse the CVS/Entries
|
||||||
|
// and see if we can find this file. We do a fast and
|
||||||
|
// dirty parse here.
|
||||||
|
ifstream ifs(dir.c_str());
|
||||||
|
string line;
|
||||||
|
while (getline(ifs, line)) {
|
||||||
|
lyxerr[Debug::LYXVC] << "\tEntries: " << line << endl;
|
||||||
|
if (contains(line, tmpf)) return dir;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return string();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CVS::scanMaster()
|
||||||
|
{
|
||||||
|
lyxerr[Debug::LYXVC] << "LyXVC::CVS: scanMaster. \n Checking: "
|
||||||
|
<< master_ << endl;
|
||||||
|
// Ok now we do the real scan...
|
||||||
|
ifstream ifs(master_.c_str());
|
||||||
|
string tmpf = "/" + OnlyFilename(file_) + "/";
|
||||||
|
lyxerr[Debug::LYXVC] << "\tlooking for `" << tmpf << "'" << endl;
|
||||||
|
string line;
|
||||||
|
while(getline(ifs, line)) {
|
||||||
|
lyxerr[Debug::LYXVC] << "\t line: " << line << endl;
|
||||||
|
if (contains(line, tmpf)) {
|
||||||
|
// Ok extract the fields.
|
||||||
|
LRegex reg("/(.*)/(.*)/(.*)/(.*)/(.*)");
|
||||||
|
LRegex::SubMatches const & sm = reg.exec(line);
|
||||||
|
//sm[0]; // whole matched string
|
||||||
|
//sm[1]; // filename
|
||||||
|
version_ = "CVS: ";
|
||||||
|
version_ += LSubstring(line, sm[2].first,
|
||||||
|
sm[2].second);
|
||||||
|
string file_date = LSubstring(line, sm[3].first,
|
||||||
|
sm[3].second);
|
||||||
|
//sm[4]; // options
|
||||||
|
//sm[5]; // tag or tagdate
|
||||||
|
FileInfo fi(file_);
|
||||||
|
time_t mod = fi.getModificationTime();
|
||||||
|
string mod_date = strip(asctime(gmtime(&mod)), '\n');
|
||||||
|
lyxerr[Debug::LYXVC]
|
||||||
|
<< "Date in Entries: `" << file_date
|
||||||
|
<< "'\nModification date of file: `"
|
||||||
|
<< mod_date << "'" << endl;
|
||||||
|
if (file_date == mod_date) {
|
||||||
|
locker_ = "Unlocked";
|
||||||
|
vcstat = UNLOCKED;
|
||||||
|
} else {
|
||||||
|
// Here we should also to some more checking
|
||||||
|
// to see if there are conflicts or not.
|
||||||
|
locker_ = "Locked";
|
||||||
|
vcstat = LOCKED;
|
||||||
|
}
|
||||||
|
#if 0
|
||||||
|
for (LRegex::SubMatches::const_iterator cit = sm.begin();
|
||||||
|
cit != sm.end(); ++cit) {
|
||||||
|
if ((*cit).first != string::npos)
|
||||||
|
lyxerr << string(line, (*cit).first,
|
||||||
|
(*cit).second) << endl;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CVS::registrer(string const & msg)
|
||||||
|
{
|
||||||
|
// cvs add
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CVS::checkIn(string const & msg)
|
||||||
|
{
|
||||||
|
// cvs commit
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CVS::checkOut()
|
||||||
|
{
|
||||||
|
// cvs update
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CVS::revert()
|
||||||
|
{
|
||||||
|
// not sure how to do this...
|
||||||
|
// rm file
|
||||||
|
// cvs update
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CVS::undoLast()
|
||||||
|
{
|
||||||
|
// merge the current with the previous version
|
||||||
|
// in a reverse patch kind of way, so that the
|
||||||
|
// result is to revert the last changes.
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CVS::getLog(string const &)
|
||||||
|
{
|
||||||
|
}
|
124
src/vc-backend.h
Normal file
124
src/vc-backend.h
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
// -*- C++ -*-
|
||||||
|
|
||||||
|
#ifndef VC_BACKEND_H
|
||||||
|
#define VC_BACKEND_H
|
||||||
|
|
||||||
|
#ifdef __GNUG__
|
||||||
|
#pragma interface
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "LString.h"
|
||||||
|
#include "support/syscall.h"
|
||||||
|
|
||||||
|
class Buffer;
|
||||||
|
|
||||||
|
///
|
||||||
|
class VCS {
|
||||||
|
public:
|
||||||
|
///
|
||||||
|
enum VCStatus {
|
||||||
|
///
|
||||||
|
UNLOCKED,
|
||||||
|
///
|
||||||
|
LOCKED
|
||||||
|
};
|
||||||
|
///
|
||||||
|
virtual ~VCS() {}
|
||||||
|
///
|
||||||
|
virtual void scanMaster() = 0;
|
||||||
|
///
|
||||||
|
virtual void registrer(string const & msg) = 0;
|
||||||
|
///
|
||||||
|
virtual void checkIn(string const & msg) = 0;
|
||||||
|
///
|
||||||
|
virtual void checkOut() = 0;
|
||||||
|
///
|
||||||
|
virtual void revert() = 0;
|
||||||
|
///
|
||||||
|
virtual void undoLast() = 0;
|
||||||
|
///
|
||||||
|
virtual void getLog(string const &) = 0;
|
||||||
|
///
|
||||||
|
string const & version() const { return version_; }
|
||||||
|
///
|
||||||
|
string const & locker() const { return locker_; }
|
||||||
|
///
|
||||||
|
void owner(Buffer * b) { owner_ = b; }
|
||||||
|
///
|
||||||
|
Buffer * owner() const { return owner_; }
|
||||||
|
///
|
||||||
|
VCStatus stat() const { return vcstat; }
|
||||||
|
protected:
|
||||||
|
///
|
||||||
|
int doVCCommand(string const &);
|
||||||
|
|
||||||
|
/** The master VC file. For RCS this is *,v or RCS/ *,v. master should
|
||||||
|
have full path.
|
||||||
|
*/
|
||||||
|
string master_;
|
||||||
|
|
||||||
|
/// The status of the VC controlled file.
|
||||||
|
VCStatus vcstat;
|
||||||
|
|
||||||
|
/** The version of the VC file. I am not sure if this can be a
|
||||||
|
string of if it must be a
|
||||||
|
float/int. */
|
||||||
|
string version_;
|
||||||
|
|
||||||
|
/// The user currently keeping the lock on the VC file.
|
||||||
|
string locker_;
|
||||||
|
/// The buffer using this VC
|
||||||
|
Buffer * owner_;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
class RCS : public VCS {
|
||||||
|
public:
|
||||||
|
///
|
||||||
|
RCS(string const & m);
|
||||||
|
///
|
||||||
|
static string find_file(string const & file);
|
||||||
|
///
|
||||||
|
virtual void scanMaster();
|
||||||
|
///
|
||||||
|
virtual void registrer(string const & msg);
|
||||||
|
///
|
||||||
|
virtual void checkIn(string const & msg);
|
||||||
|
///
|
||||||
|
virtual void checkOut();
|
||||||
|
///
|
||||||
|
virtual void revert();
|
||||||
|
///
|
||||||
|
virtual void undoLast();
|
||||||
|
///
|
||||||
|
virtual void getLog(string const &);
|
||||||
|
private:
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
class CVS : public VCS {
|
||||||
|
public:
|
||||||
|
///
|
||||||
|
CVS(string const & m, string const & f);
|
||||||
|
///
|
||||||
|
static string find_file(string const & file);
|
||||||
|
///
|
||||||
|
virtual void scanMaster();
|
||||||
|
///
|
||||||
|
virtual void registrer(string const & msg);
|
||||||
|
///
|
||||||
|
virtual void checkIn(string const & msg);
|
||||||
|
///
|
||||||
|
virtual void checkOut();
|
||||||
|
///
|
||||||
|
virtual void revert();
|
||||||
|
///
|
||||||
|
virtual void undoLast();
|
||||||
|
///
|
||||||
|
virtual void getLog(string const &);
|
||||||
|
private:
|
||||||
|
string file_;
|
||||||
|
};
|
||||||
|
#endif
|
@ -473,7 +473,7 @@ string VSpace::asLatexCommand() const
|
|||||||
switch (kin) {
|
switch (kin) {
|
||||||
case NONE: return string();
|
case NONE: return string();
|
||||||
case DEFSKIP:
|
case DEFSKIP:
|
||||||
return current_view->currentBuffer()->params.getDefSkip().asLatexCommand();
|
return current_view->buffer()->params.getDefSkip().asLatexCommand();
|
||||||
case SMALLSKIP: return kp ? "\\vspace*{\\smallskipamount}"
|
case SMALLSKIP: return kp ? "\\vspace*{\\smallskipamount}"
|
||||||
: "\\smallskip{}";
|
: "\\smallskip{}";
|
||||||
case MEDSKIP: return kp ? "\\vspace*{\\medskipamount}"
|
case MEDSKIP: return kp ? "\\vspace*{\\medskipamount}"
|
||||||
@ -492,7 +492,7 @@ string VSpace::asLatexCommand() const
|
|||||||
int VSpace::inPixels() const
|
int VSpace::inPixels() const
|
||||||
{
|
{
|
||||||
// Height of a normal line in pixels (zoom factor considered)
|
// Height of a normal line in pixels (zoom factor considered)
|
||||||
int height = current_view->currentBuffer()->text->DefaultHeight(); // [pixels]
|
int height = current_view->buffer()->text->DefaultHeight(); // [pixels]
|
||||||
|
|
||||||
// Zoom factor specified by user in percent
|
// Zoom factor specified by user in percent
|
||||||
float const zoom = lyxrc->zoom / 100.0; // [percent]
|
float const zoom = lyxrc->zoom / 100.0; // [percent]
|
||||||
@ -507,7 +507,7 @@ int VSpace::inPixels() const
|
|||||||
case NONE: return 0;
|
case NONE: return 0;
|
||||||
|
|
||||||
case DEFSKIP:
|
case DEFSKIP:
|
||||||
return current_view->currentBuffer()->params.getDefSkip().inPixels();
|
return current_view->buffer()->params.getDefSkip().inPixels();
|
||||||
|
|
||||||
// This is how the skips are normally defined by
|
// This is how the skips are normally defined by
|
||||||
// LateX. But there should be some way to change
|
// LateX. But there should be some way to change
|
||||||
|
Loading…
Reference in New Issue
Block a user