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
444
src/BufferView.C
444
src/BufferView.C
@ -61,9 +61,9 @@ FL_OBJECT * figinset_canvas;
|
||||
|
||||
BufferView::BufferView(LyXView *o, int xpos, int ypos,
|
||||
int width, int height)
|
||||
: _owner(o)
|
||||
: owner_(o)
|
||||
{
|
||||
_buffer = 0;
|
||||
buffer_ = 0;
|
||||
|
||||
screen = 0;
|
||||
work_area = 0;
|
||||
@ -76,22 +76,22 @@ BufferView::BufferView(LyXView *o, int xpos, int ypos,
|
||||
create_view(xpos, ypos, width, height);
|
||||
// Activate the timer for the cursor
|
||||
fl_set_timer(timer_cursor, 0.4);
|
||||
fl_set_focus_object(_owner->getForm(), work_area);
|
||||
fl_set_focus_object(owner_->getForm(), work_area);
|
||||
work_area_focus = true;
|
||||
lyx_focus = false;
|
||||
}
|
||||
|
||||
|
||||
void BufferView::setBuffer(Buffer *b)
|
||||
void BufferView::buffer(Buffer *b)
|
||||
{
|
||||
lyxerr.debug() << "Setting buffer in BufferView" << endl;
|
||||
if (_buffer) {
|
||||
_buffer->InsetSleep();
|
||||
_buffer->delUser(this);
|
||||
lyxerr[Debug::INFO] << "Setting buffer in BufferView" << endl;
|
||||
if (buffer_) {
|
||||
buffer_->InsetSleep();
|
||||
buffer_->delUser(this);
|
||||
}
|
||||
|
||||
// Set current buffer
|
||||
_buffer = b;
|
||||
buffer_ = b;
|
||||
|
||||
if (bufferlist.getState() == BufferList::CLOSING) return;
|
||||
|
||||
@ -101,16 +101,16 @@ void BufferView::setBuffer(Buffer *b)
|
||||
screen = 0;
|
||||
|
||||
// If we are closing the buffer, use the first buffer as current
|
||||
if (!_buffer) {
|
||||
_buffer = bufferlist.first();
|
||||
if (!buffer_) {
|
||||
buffer_ = bufferlist.first();
|
||||
}
|
||||
|
||||
if (_buffer) {
|
||||
lyxerr.debug() << " Buffer addr: " << _buffer << endl;
|
||||
_buffer->addUser(this);
|
||||
_owner->getMenus()->showMenus();
|
||||
if (buffer_) {
|
||||
lyxerr[Debug::INFO] << " Buffer addr: " << buffer_ << endl;
|
||||
buffer_->addUser(this);
|
||||
owner_->getMenus()->showMenus();
|
||||
// If we don't have a text object for this, we make one
|
||||
if (_buffer->text == 0)
|
||||
if (buffer_->text == 0)
|
||||
resizeCurrentBuffer();
|
||||
else {
|
||||
updateScreen();
|
||||
@ -119,17 +119,17 @@ void BufferView::setBuffer(Buffer *b)
|
||||
screen->first = screen->TopCursorVisible();
|
||||
redraw();
|
||||
updateAllVisibleBufferRelatedPopups();
|
||||
_buffer->InsetWakeup();
|
||||
buffer_->InsetWakeup();
|
||||
} else {
|
||||
lyxerr.debug() << " No Buffer!" << endl;
|
||||
_owner->getMenus()->hideMenus();
|
||||
lyxerr[Debug::INFO] << " No Buffer!" << endl;
|
||||
owner_->getMenus()->hideMenus();
|
||||
updateScrollbar();
|
||||
fl_redraw_object(work_area);
|
||||
}
|
||||
// should update layoutchoice even if we don't have a buffer.
|
||||
_owner->updateLayoutChoice();
|
||||
_owner->getMiniBuffer()->Init();
|
||||
_owner->updateWindowTitle();
|
||||
owner_->updateLayoutChoice();
|
||||
owner_->getMiniBuffer()->Init();
|
||||
owner_->updateWindowTitle();
|
||||
}
|
||||
|
||||
|
||||
@ -143,14 +143,14 @@ void BufferView::updateScreen()
|
||||
work_area->h,
|
||||
work_area->x,
|
||||
work_area->y,
|
||||
_buffer->text);
|
||||
buffer_->text);
|
||||
}
|
||||
|
||||
|
||||
void BufferView::resize()
|
||||
{
|
||||
// This will resize the buffer. (Asger)
|
||||
if (_buffer)
|
||||
if (buffer_)
|
||||
resizeCurrentBuffer();
|
||||
}
|
||||
|
||||
@ -159,7 +159,7 @@ static bool lgb_hack = false;
|
||||
|
||||
void BufferView::redraw()
|
||||
{
|
||||
lyxerr.debug() << "BufferView::redraw()" << endl;
|
||||
lyxerr[Debug::INFO] << "BufferView::redraw()" << endl;
|
||||
lgb_hack = true;
|
||||
fl_redraw_object(work_area);
|
||||
fl_redraw_object(scrollbar);
|
||||
@ -187,7 +187,7 @@ void BufferView::updateScrollbar()
|
||||
* maximum must be the working area height. No scrolling will
|
||||
* be possible */
|
||||
|
||||
if (!_buffer) {
|
||||
if (!buffer_) {
|
||||
fl_set_slider_value(scrollbar, 0);
|
||||
fl_set_slider_size(scrollbar, scrollbar->h);
|
||||
return;
|
||||
@ -199,8 +199,8 @@ void BufferView::updateScrollbar()
|
||||
long cbth = 0;
|
||||
long cbsf = 0;
|
||||
|
||||
if (_buffer->text)
|
||||
cbth = _buffer->text->height;
|
||||
if (buffer_->text)
|
||||
cbth = buffer_->text->height;
|
||||
if (screen)
|
||||
cbsf = screen->first;
|
||||
|
||||
@ -222,7 +222,7 @@ void BufferView::updateScrollbar()
|
||||
long maximum_height = work_area->h * 3/4 + cbth;
|
||||
long value = cbsf;
|
||||
|
||||
/* set the scrollbar */
|
||||
// set the scrollbar
|
||||
double hfloat = work_area->h;
|
||||
double maxfloat = maximum_height;
|
||||
|
||||
@ -230,7 +230,7 @@ void BufferView::updateScrollbar()
|
||||
fl_set_slider_bounds(scrollbar, 0,
|
||||
maximum_height - work_area->h);
|
||||
#if FL_REVISION > 85
|
||||
double lineh = _buffer->text->DefaultHeight();
|
||||
double lineh = buffer_->text->DefaultHeight();
|
||||
fl_set_slider_increment(scrollbar,work_area->h-lineh,lineh);
|
||||
#endif
|
||||
if (maxfloat>0){
|
||||
@ -248,17 +248,17 @@ void BufferView::updateScrollbar()
|
||||
|
||||
void BufferView::redoCurrentBuffer()
|
||||
{
|
||||
lyxerr.debug() << "BufferView::redoCurrentBuffer" << endl;
|
||||
if (_buffer && _buffer->text) {
|
||||
lyxerr[Debug::INFO] << "BufferView::redoCurrentBuffer" << endl;
|
||||
if (buffer_ && buffer_->text) {
|
||||
resize();
|
||||
_owner->updateLayoutChoice();
|
||||
owner_->updateLayoutChoice();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int BufferView::resizeCurrentBuffer()
|
||||
{
|
||||
lyxerr.debug() << "resizeCurrentBuffer" << endl;
|
||||
lyxerr[Debug::INFO] << "resizeCurrentBuffer" << endl;
|
||||
|
||||
LyXParagraph * par = 0;
|
||||
LyXParagraph * selstartpar = 0;
|
||||
@ -271,41 +271,41 @@ int BufferView::resizeCurrentBuffer()
|
||||
|
||||
ProhibitInput();
|
||||
|
||||
_owner->getMiniBuffer()->Set(_("Formatting document..."));
|
||||
owner_->getMiniBuffer()->Set(_("Formatting document..."));
|
||||
|
||||
if (_buffer->text) {
|
||||
par = _buffer->text->cursor.par;
|
||||
pos = _buffer->text->cursor.pos;
|
||||
selstartpar = _buffer->text->sel_start_cursor.par;
|
||||
selstartpos = _buffer->text->sel_start_cursor.pos;
|
||||
selendpar = _buffer->text->sel_end_cursor.par;
|
||||
selendpos = _buffer->text->sel_end_cursor.pos;
|
||||
selection = _buffer->text->selection;
|
||||
mark_set = _buffer->text->mark_set;
|
||||
delete _buffer->text;
|
||||
if (buffer_->text) {
|
||||
par = buffer_->text->cursor.par;
|
||||
pos = buffer_->text->cursor.pos;
|
||||
selstartpar = buffer_->text->sel_start_cursor.par;
|
||||
selstartpos = buffer_->text->sel_start_cursor.pos;
|
||||
selendpar = buffer_->text->sel_end_cursor.par;
|
||||
selendpos = buffer_->text->sel_end_cursor.pos;
|
||||
selection = buffer_->text->selection;
|
||||
mark_set = buffer_->text->mark_set;
|
||||
delete buffer_->text;
|
||||
}
|
||||
_buffer->text = new LyXText(work_area->w, _buffer);
|
||||
buffer_->text = new LyXText(work_area->w, buffer_);
|
||||
|
||||
updateScreen();
|
||||
|
||||
if (par) {
|
||||
_buffer->text->selection = true;
|
||||
buffer_->text->selection = true;
|
||||
/* at this point just
|
||||
* to avoid the Delete-
|
||||
* Empty-Paragraph
|
||||
* Mechanism when
|
||||
* setting the cursor */
|
||||
_buffer->text->mark_set = mark_set;
|
||||
buffer_->text->mark_set = mark_set;
|
||||
if (selection) {
|
||||
_buffer->text->SetCursor(selstartpar, selstartpos);
|
||||
_buffer->text->sel_cursor = _buffer->text->cursor;
|
||||
_buffer->text->SetCursor(selendpar, selendpos);
|
||||
_buffer->text->SetSelection();
|
||||
_buffer->text->SetCursor(par, pos);
|
||||
buffer_->text->SetCursor(selstartpar, selstartpos);
|
||||
buffer_->text->sel_cursor = buffer_->text->cursor;
|
||||
buffer_->text->SetCursor(selendpar, selendpos);
|
||||
buffer_->text->SetSelection();
|
||||
buffer_->text->SetCursor(par, pos);
|
||||
} else {
|
||||
_buffer->text->SetCursor(par, pos);
|
||||
_buffer->text->sel_cursor = _buffer->text->cursor;
|
||||
_buffer->text->selection = false;
|
||||
buffer_->text->SetCursor(par, pos);
|
||||
buffer_->text->sel_cursor = buffer_->text->cursor;
|
||||
buffer_->text->selection = false;
|
||||
}
|
||||
}
|
||||
screen->first = screen->TopCursorVisible(); /* this will scroll the
|
||||
@ -314,7 +314,7 @@ int BufferView::resizeCurrentBuffer()
|
||||
* visible */
|
||||
updateScrollbar();
|
||||
redraw();
|
||||
_owner->getMiniBuffer()->Init();
|
||||
owner_->getMiniBuffer()->Init();
|
||||
AllowInput();
|
||||
|
||||
// Now if the title form still exist kill it
|
||||
@ -331,30 +331,30 @@ void BufferView::gotoError()
|
||||
|
||||
screen->HideCursor();
|
||||
BeforeChange();
|
||||
_buffer->update(-2);
|
||||
buffer_->update(-2);
|
||||
LyXCursor tmp;
|
||||
|
||||
if (!_buffer->text->GotoNextError()) {
|
||||
if (_buffer->text->cursor.pos
|
||||
|| _buffer->text->cursor.par !=
|
||||
_buffer->text->FirstParagraph()) {
|
||||
tmp = _buffer->text->cursor;
|
||||
_buffer->text->cursor.par =
|
||||
_buffer->text->FirstParagraph();
|
||||
_buffer->text->cursor.pos = 0;
|
||||
if (!_buffer->text->GotoNextError()) {
|
||||
_buffer->text->cursor = tmp;
|
||||
_owner->getMiniBuffer()->Set(_("No more errors"));
|
||||
if (!buffer_->text->GotoNextError()) {
|
||||
if (buffer_->text->cursor.pos
|
||||
|| buffer_->text->cursor.par !=
|
||||
buffer_->text->FirstParagraph()) {
|
||||
tmp = buffer_->text->cursor;
|
||||
buffer_->text->cursor.par =
|
||||
buffer_->text->FirstParagraph();
|
||||
buffer_->text->cursor.pos = 0;
|
||||
if (!buffer_->text->GotoNextError()) {
|
||||
buffer_->text->cursor = tmp;
|
||||
owner_->getMiniBuffer()->Set(_("No more errors"));
|
||||
LyXBell();
|
||||
}
|
||||
} else {
|
||||
_owner->getMiniBuffer()->Set(_("No more errors"));
|
||||
owner_->getMiniBuffer()->Set(_("No more errors"));
|
||||
LyXBell();
|
||||
}
|
||||
}
|
||||
_buffer->update(0);
|
||||
_buffer->text->sel_cursor =
|
||||
_buffer->text->cursor;
|
||||
buffer_->update(0);
|
||||
buffer_->text->sel_cursor =
|
||||
buffer_->text->cursor;
|
||||
}
|
||||
|
||||
|
||||
@ -498,7 +498,7 @@ void BufferView::UpCB(FL_OBJECT * ob, long)
|
||||
{
|
||||
BufferView * view = static_cast<BufferView*>(ob->u_vdata);
|
||||
|
||||
if (view->_buffer == 0) return;
|
||||
if (view->buffer_ == 0) return;
|
||||
|
||||
XEvent const * ev2;
|
||||
static long time = 0;
|
||||
@ -551,7 +551,7 @@ void BufferView::ScrollCB(FL_OBJECT * ob, long)
|
||||
BufferView * view = static_cast<BufferView*>(ob->u_vdata);
|
||||
extern bool cursor_follows_scrollbar;
|
||||
|
||||
if (view->_buffer == 0) return;
|
||||
if (view->buffer_ == 0) return;
|
||||
|
||||
view->current_scrollbar_value = long(fl_get_slider_value(ob));
|
||||
if (view->current_scrollbar_value < 0)
|
||||
@ -563,7 +563,7 @@ void BufferView::ScrollCB(FL_OBJECT * ob, long)
|
||||
view->screen->Draw(view->current_scrollbar_value);
|
||||
|
||||
if (cursor_follows_scrollbar) {
|
||||
LyXText * vbt = view->_buffer->text;
|
||||
LyXText * vbt = view->buffer_->text;
|
||||
int height = vbt->DefaultHeight();
|
||||
|
||||
if (vbt->cursor.y < view->screen->first + height) {
|
||||
@ -588,7 +588,7 @@ void BufferView::DownCB(FL_OBJECT * ob, long)
|
||||
{
|
||||
BufferView * view = static_cast<BufferView*>(ob->u_vdata);
|
||||
|
||||
if (view->_buffer == 0) return;
|
||||
if (view->buffer_ == 0) return;
|
||||
|
||||
XEvent const * ev2;
|
||||
static long time = 0;
|
||||
@ -609,7 +609,7 @@ void BufferView::DownCB(FL_OBJECT * ob, long)
|
||||
|
||||
int BufferView::ScrollUp(long time)
|
||||
{
|
||||
if (_buffer == 0) return 0;
|
||||
if (buffer_ == 0) return 0;
|
||||
if (!screen)
|
||||
return 0;
|
||||
|
||||
@ -618,12 +618,12 @@ int BufferView::ScrollUp(long time)
|
||||
if (value == 0)
|
||||
return 0;
|
||||
|
||||
float add_value = (_buffer->text->DefaultHeight()
|
||||
float add_value = (buffer_->text->DefaultHeight()
|
||||
+ float(time) * float(time) * 0.125);
|
||||
|
||||
if (add_value > work_area->h)
|
||||
add_value = float(work_area->h -
|
||||
_buffer->text->DefaultHeight());
|
||||
buffer_->text->DefaultHeight());
|
||||
|
||||
value -= add_value;
|
||||
|
||||
@ -639,7 +639,7 @@ int BufferView::ScrollUp(long time)
|
||||
|
||||
int BufferView::ScrollDown(long time)
|
||||
{
|
||||
if (_buffer == 0) return 0;
|
||||
if (buffer_ == 0) return 0;
|
||||
if (!screen)
|
||||
return 0;
|
||||
|
||||
@ -650,12 +650,12 @@ int BufferView::ScrollDown(long time)
|
||||
if (value == max)
|
||||
return 0;
|
||||
|
||||
float add_value = (_buffer->text->DefaultHeight()
|
||||
float add_value = (buffer_->text->DefaultHeight()
|
||||
+ float(time) * float(time) * 0.125);
|
||||
|
||||
if (add_value > work_area->h)
|
||||
add_value = float(work_area->h -
|
||||
_buffer->text->DefaultHeight());
|
||||
buffer_->text->DefaultHeight());
|
||||
|
||||
value += add_value;
|
||||
|
||||
@ -671,7 +671,7 @@ int BufferView::ScrollDown(long time)
|
||||
|
||||
void BufferView::ScrollUpOnePage(long /*time*/)
|
||||
{
|
||||
if (_buffer == 0) return;
|
||||
if (buffer_ == 0) return;
|
||||
if (!screen)
|
||||
return;
|
||||
|
||||
@ -679,7 +679,7 @@ void BufferView::ScrollUpOnePage(long /*time*/)
|
||||
|
||||
if (!y) return;
|
||||
|
||||
Row* row = _buffer->text->GetRowNearY(y);
|
||||
Row* row = buffer_->text->GetRowNearY(y);
|
||||
y = y - work_area->h + row->height;
|
||||
|
||||
fl_set_slider_value(scrollbar, y);
|
||||
@ -690,7 +690,7 @@ void BufferView::ScrollUpOnePage(long /*time*/)
|
||||
|
||||
void BufferView::ScrollDownOnePage(long /*time*/)
|
||||
{
|
||||
if (_buffer == 0) return;
|
||||
if (buffer_ == 0) return;
|
||||
if (!screen)
|
||||
return;
|
||||
|
||||
@ -698,11 +698,11 @@ void BufferView::ScrollDownOnePage(long /*time*/)
|
||||
fl_get_slider_bounds(scrollbar, &min, &max);
|
||||
long y = screen->first;
|
||||
|
||||
if (y > _buffer->text->height - work_area->h)
|
||||
if (y > buffer_->text->height - work_area->h)
|
||||
return;
|
||||
|
||||
y += work_area->h;
|
||||
_buffer->text->GetRowNearY(y);
|
||||
buffer_->text->GetRowNearY(y);
|
||||
|
||||
fl_set_slider_value(scrollbar, y);
|
||||
|
||||
@ -747,18 +747,18 @@ int BufferView::work_area_handler(FL_OBJECT * ob, int event,
|
||||
// Done by the raw callback:
|
||||
// case FL_KEYBOARD: WorkAreaKeyPress(ob, 0,0,0,ev,0); break;
|
||||
case FL_FOCUS:
|
||||
if (!view->_owner->getMiniBuffer()->shows_no_match)
|
||||
view->_owner->getMiniBuffer()->Init();
|
||||
view->_owner->getMiniBuffer()->shows_no_match = false;
|
||||
if (!view->owner_->getMiniBuffer()->shows_no_match)
|
||||
view->owner_->getMiniBuffer()->Init();
|
||||
view->owner_->getMiniBuffer()->shows_no_match = false;
|
||||
view->work_area_focus = true;
|
||||
fl_set_timer(view->timer_cursor, 0.4);
|
||||
break;
|
||||
case FL_UNFOCUS:
|
||||
view->_owner->getMiniBuffer()->ExecCommand();
|
||||
view->owner_->getMiniBuffer()->ExecCommand();
|
||||
view->work_area_focus = false;
|
||||
break;
|
||||
case FL_ENTER:
|
||||
SetXtermCursor(view->_owner->getForm()->window);
|
||||
SetXtermCursor(view->owner_->getForm()->window);
|
||||
// reset the timer
|
||||
view->lyx_focus = true;
|
||||
fl_set_timer(view->timer_cursor, 0.4);
|
||||
@ -766,7 +766,7 @@ int BufferView::work_area_handler(FL_OBJECT * ob, int event,
|
||||
case FL_LEAVE:
|
||||
if (!input_prohibited)
|
||||
XUndefineCursor(fl_display,
|
||||
view->_owner->getForm()->window);
|
||||
view->owner_->getForm()->window);
|
||||
view->lyx_focus = false; // This is not an absolute truth
|
||||
// but if it is not true, it will be changed within a blink
|
||||
// of an eye. ... Not good enough... use regulare timeperiod
|
||||
@ -775,37 +775,37 @@ int BufferView::work_area_handler(FL_OBJECT * ob, int event,
|
||||
break;
|
||||
case FL_DBLCLICK:
|
||||
// select a word
|
||||
if (view->_buffer && !view->_buffer->the_locking_inset) {
|
||||
if (view->buffer_ && !view->buffer_->the_locking_inset) {
|
||||
if (view->screen && ev->xbutton.button == 1) {
|
||||
view->screen->HideCursor();
|
||||
view->screen->ToggleSelection();
|
||||
view->_buffer->text->SelectWord();
|
||||
view->buffer_->text->SelectWord();
|
||||
view->screen->ToggleSelection(false);
|
||||
/* This will fit the cursor on the screen
|
||||
* if necessary */
|
||||
view->_buffer->update(0);
|
||||
view->buffer_->update(0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case FL_TRPLCLICK:
|
||||
// select a line
|
||||
if (view->_buffer && view->screen && ev->xbutton.button == 1) {
|
||||
if (view->buffer_ && view->screen && ev->xbutton.button == 1) {
|
||||
view->screen->HideCursor();
|
||||
view->screen->ToggleSelection();
|
||||
view->_buffer->text->CursorHome();
|
||||
view->_buffer->text->sel_cursor =
|
||||
view->_buffer->text->cursor;
|
||||
view->_buffer->text->CursorEnd();
|
||||
view->_buffer->text->SetSelection();
|
||||
view->buffer_->text->CursorHome();
|
||||
view->buffer_->text->sel_cursor =
|
||||
view->buffer_->text->cursor;
|
||||
view->buffer_->text->CursorEnd();
|
||||
view->buffer_->text->SetSelection();
|
||||
view->screen->ToggleSelection(false);
|
||||
/* This will fit the cursor on the screen
|
||||
* if necessary */
|
||||
view->_buffer->update(0);
|
||||
view->buffer_->update(0);
|
||||
}
|
||||
break;
|
||||
case FL_OTHER:
|
||||
view->WorkAreaSelectionNotify(ob,
|
||||
view->_owner->getForm()->window,
|
||||
view->owner_->getForm()->window,
|
||||
0,0,ev,0);
|
||||
break;
|
||||
}
|
||||
@ -817,13 +817,13 @@ int BufferView::WorkAreaMotionNotify(FL_OBJECT *ob, Window,
|
||||
XEvent *ev, void */*d*/)
|
||||
{
|
||||
|
||||
if (_buffer == 0) return 0;
|
||||
if (buffer_ == 0) return 0;
|
||||
if (!screen) return 0;
|
||||
|
||||
// Check for inset locking
|
||||
if (_buffer->the_locking_inset) {
|
||||
LyXCursor cursor = _buffer->text->cursor;
|
||||
_buffer->the_locking_inset->
|
||||
if (buffer_->the_locking_inset) {
|
||||
LyXCursor cursor = buffer_->text->cursor;
|
||||
buffer_->the_locking_inset->
|
||||
InsetMotionNotify(ev->xbutton.x - ob->x - cursor.x,
|
||||
ev->xbutton.y - ob->y -
|
||||
(cursor.y),
|
||||
@ -840,15 +840,15 @@ int BufferView::WorkAreaMotionNotify(FL_OBJECT *ob, Window,
|
||||
if (selection_possible) {
|
||||
screen->HideCursor();
|
||||
|
||||
_buffer->text->
|
||||
buffer_->text->
|
||||
SetCursorFromCoordinates(ev->xbutton.x - ob->x,
|
||||
ev->xbutton.y - ob->y +
|
||||
screen->first);
|
||||
|
||||
if (!_buffer->text->selection)
|
||||
_buffer->update(-3); // Maybe an empty line was deleted
|
||||
if (!buffer_->text->selection)
|
||||
buffer_->update(-3); // Maybe an empty line was deleted
|
||||
|
||||
_buffer->text->SetSelection();
|
||||
buffer_->text->SetSelection();
|
||||
screen->ToggleToggle();
|
||||
if (screen->FitCursor())
|
||||
updateScrollbar();
|
||||
@ -867,7 +867,7 @@ int BufferView::WorkAreaButtonPress(FL_OBJECT *ob, Window,
|
||||
last_click_x = -1;
|
||||
last_click_y = -1;
|
||||
|
||||
if (_buffer == 0) return 0;
|
||||
if (buffer_ == 0) return 0;
|
||||
if (!screen) return 0;
|
||||
|
||||
int const x = ev->xbutton.x - ob->x;
|
||||
@ -885,17 +885,17 @@ int BufferView::WorkAreaButtonPress(FL_OBJECT *ob, Window,
|
||||
|
||||
{
|
||||
|
||||
if (_buffer->the_locking_inset) {
|
||||
if (buffer_->the_locking_inset) {
|
||||
// We are in inset locking mode
|
||||
|
||||
/* Check whether the inset was hit. If not reset mode,
|
||||
otherwise give the event to the inset */
|
||||
if (inset_hit != 0) {
|
||||
_buffer->the_locking_inset->
|
||||
buffer_->the_locking_inset->
|
||||
InsetButtonPress(inset_x, inset_y, button);
|
||||
return 0;
|
||||
} else {
|
||||
UnlockInset(_buffer->the_locking_inset);
|
||||
UnlockInset(buffer_->the_locking_inset);
|
||||
}
|
||||
}
|
||||
|
||||
@ -904,22 +904,22 @@ int BufferView::WorkAreaButtonPress(FL_OBJECT *ob, Window,
|
||||
|
||||
// Right button mouse click on a table
|
||||
if (button == 3 &&
|
||||
(_buffer->text->cursor.par->table ||
|
||||
_buffer->text->MouseHitInTable(x, y+screen->first))) {
|
||||
(buffer_->text->cursor.par->table ||
|
||||
buffer_->text->MouseHitInTable(x, y+screen->first))) {
|
||||
// Set the cursor to the press-position
|
||||
_buffer->text->SetCursorFromCoordinates(x, y + screen->first);
|
||||
buffer_->text->SetCursorFromCoordinates(x, y + screen->first);
|
||||
bool doit = true;
|
||||
|
||||
// Only show the table popup if the hit is in the table, too
|
||||
if (!_buffer->text->HitInTable(_buffer->text->cursor.row, x))
|
||||
if (!buffer_->text->HitInTable(buffer_->text->cursor.row, x))
|
||||
doit = false;
|
||||
|
||||
// Hit above or below the table?
|
||||
if (doit) {
|
||||
if (!_buffer->text->selection) {
|
||||
if (!buffer_->text->selection) {
|
||||
screen->ToggleSelection();
|
||||
_buffer->text->ClearSelection();
|
||||
_buffer->text->FullRebreak();
|
||||
buffer_->text->ClearSelection();
|
||||
buffer_->text->FullRebreak();
|
||||
screen->Update();
|
||||
updateScrollbar();
|
||||
}
|
||||
@ -930,7 +930,7 @@ int BufferView::WorkAreaButtonPress(FL_OBJECT *ob, Window,
|
||||
// the right mouse. So this should be done more
|
||||
// general in the future. Matthias.
|
||||
selection_possible = false;
|
||||
_owner->getLyXFunc()->Dispatch(LFUN_LAYOUT_TABLE,
|
||||
owner_->getLyXFunc()->Dispatch(LFUN_LAYOUT_TABLE,
|
||||
"true");
|
||||
return 0;
|
||||
}
|
||||
@ -940,16 +940,16 @@ int BufferView::WorkAreaButtonPress(FL_OBJECT *ob, Window,
|
||||
|
||||
// Middle button press pastes if we have a selection
|
||||
bool paste_internally = false;
|
||||
if (button == 2 // && !_buffer->the_locking_inset
|
||||
&& _buffer->text->selection) {
|
||||
_owner->getLyXFunc()->Dispatch(LFUN_COPY);
|
||||
if (button == 2 // && !buffer_->the_locking_inset
|
||||
&& buffer_->text->selection) {
|
||||
owner_->getLyXFunc()->Dispatch(LFUN_COPY);
|
||||
paste_internally = true;
|
||||
}
|
||||
|
||||
// Clear the selection
|
||||
screen->ToggleSelection();
|
||||
_buffer->text->ClearSelection();
|
||||
_buffer->text->FullRebreak();
|
||||
buffer_->text->ClearSelection();
|
||||
buffer_->text->FullRebreak();
|
||||
screen->Update();
|
||||
updateScrollbar();
|
||||
|
||||
@ -957,8 +957,8 @@ int BufferView::WorkAreaButtonPress(FL_OBJECT *ob, Window,
|
||||
if (inset_hit != 0 && inset_hit->Editable() == 2) {
|
||||
// Highly editable inset, like math
|
||||
selection_possible = false;
|
||||
_owner->updateLayoutChoice();
|
||||
_owner->getMiniBuffer()->Set(inset_hit->EditMessage());
|
||||
owner_->updateLayoutChoice();
|
||||
owner_->getMiniBuffer()->Set(inset_hit->EditMessage());
|
||||
inset_hit->Edit(inset_x, inset_y);
|
||||
return 0;
|
||||
}
|
||||
@ -969,12 +969,12 @@ int BufferView::WorkAreaButtonPress(FL_OBJECT *ob, Window,
|
||||
return 0;
|
||||
}
|
||||
|
||||
_buffer->text->SetCursorFromCoordinates(x, y + screen_first);
|
||||
_buffer->text->FinishUndo();
|
||||
_buffer->text->sel_cursor = _buffer->text->cursor;
|
||||
_buffer->text->cursor.x_fix = _buffer->text->cursor.x;
|
||||
buffer_->text->SetCursorFromCoordinates(x, y + screen_first);
|
||||
buffer_->text->FinishUndo();
|
||||
buffer_->text->sel_cursor = buffer_->text->cursor;
|
||||
buffer_->text->cursor.x_fix = buffer_->text->cursor.x;
|
||||
|
||||
_owner->updateLayoutChoice();
|
||||
owner_->updateLayoutChoice();
|
||||
if (screen->FitCursor()){
|
||||
updateScrollbar();
|
||||
selection_possible = false;
|
||||
@ -982,11 +982,11 @@ int BufferView::WorkAreaButtonPress(FL_OBJECT *ob, Window,
|
||||
|
||||
// Insert primary selection with middle mouse
|
||||
// if there is a local selection in the current buffer, insert this
|
||||
if (button == 2) { // && !_buffer->the_locking_inset){
|
||||
if (button == 2) { // && !buffer_->the_locking_inset){
|
||||
if (paste_internally)
|
||||
_owner->getLyXFunc()->Dispatch(LFUN_PASTE);
|
||||
owner_->getLyXFunc()->Dispatch(LFUN_PASTE);
|
||||
else
|
||||
_owner->getLyXFunc()->Dispatch(LFUN_PASTESELECTION,
|
||||
owner_->getLyXFunc()->Dispatch(LFUN_PASTESELECTION,
|
||||
"paragraph");
|
||||
selection_possible = false;
|
||||
return 0;
|
||||
@ -1025,7 +1025,7 @@ int BufferView::WorkAreaButtonPress(FL_OBJECT *ob, Window,
|
||||
int BufferView::WorkAreaButtonRelease(FL_OBJECT *ob, Window ,
|
||||
int /*w*/, int /*h*/, XEvent *ev, void */*d*/)
|
||||
{
|
||||
if (_buffer == 0 || screen == 0) return 0;
|
||||
if (buffer_ == 0 || screen == 0) return 0;
|
||||
|
||||
int const x = ev->xbutton.x - ob->x;
|
||||
int const y = ev->xbutton.y - ob->y;
|
||||
@ -1037,28 +1037,28 @@ int BufferView::WorkAreaButtonRelease(FL_OBJECT *ob, Window ,
|
||||
int inset_y = y;
|
||||
Inset * inset_hit = checkInsetHit(inset_x, inset_y);
|
||||
|
||||
if (_buffer->the_locking_inset) {
|
||||
if (buffer_->the_locking_inset) {
|
||||
// We are in inset locking mode.
|
||||
|
||||
/* LyX does a kind of work-area grabbing for insets.
|
||||
Only a ButtonPress Event outside the inset will
|
||||
force a InsetUnlock. */
|
||||
_buffer->the_locking_inset->
|
||||
buffer_->the_locking_inset->
|
||||
InsetButtonRelease(inset_x, inset_y,
|
||||
ev->xbutton.button);
|
||||
return 0;
|
||||
}
|
||||
|
||||
selection_possible = false;
|
||||
if (_buffer->text->cursor.par->table) {
|
||||
int cell = _buffer->text->
|
||||
NumberOfCell(_buffer->text->cursor.par,
|
||||
_buffer->text->cursor.pos);
|
||||
if (_buffer->text->cursor.par->table->IsContRow(cell) &&
|
||||
_buffer->text->cursor.par->table->
|
||||
CellHasContRow(_buffer->text->cursor.par->table->
|
||||
if (buffer_->text->cursor.par->table) {
|
||||
int cell = buffer_->text->
|
||||
NumberOfCell(buffer_->text->cursor.par,
|
||||
buffer_->text->cursor.pos);
|
||||
if (buffer_->text->cursor.par->table->IsContRow(cell) &&
|
||||
buffer_->text->cursor.par->table->
|
||||
CellHasContRow(buffer_->text->cursor.par->table->
|
||||
GetCellAbove(cell))<0) {
|
||||
_buffer->text->CursorUp();
|
||||
buffer_->text->CursorUp();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1092,38 +1092,38 @@ int BufferView::WorkAreaButtonRelease(FL_OBJECT *ob, Window ,
|
||||
// ...or maybe the SetCursorParUndo()
|
||||
// below isn't necessary at all anylonger?
|
||||
if (inset_hit->LyxCode() == Inset::REF_CODE) {
|
||||
_buffer->text->SetCursorParUndo();
|
||||
buffer_->text->SetCursorParUndo();
|
||||
}
|
||||
|
||||
_owner->getMiniBuffer()->Set(inset_hit->EditMessage());
|
||||
owner_->getMiniBuffer()->Set(inset_hit->EditMessage());
|
||||
inset_hit->Edit(inset_x, inset_y);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// check whether we want to open a float
|
||||
if (_buffer->text) {
|
||||
if (buffer_->text) {
|
||||
bool hit = false;
|
||||
char c = ' ';
|
||||
if (_buffer->text->cursor.pos <
|
||||
_buffer->text->cursor.par->Last()) {
|
||||
c = _buffer->text->cursor.par->
|
||||
GetChar(_buffer->text->cursor.pos);
|
||||
if (buffer_->text->cursor.pos <
|
||||
buffer_->text->cursor.par->Last()) {
|
||||
c = buffer_->text->cursor.par->
|
||||
GetChar(buffer_->text->cursor.pos);
|
||||
}
|
||||
if (c == LYX_META_FOOTNOTE || c == LYX_META_MARGIN
|
||||
|| c == LYX_META_FIG || c == LYX_META_TAB
|
||||
|| c == LYX_META_WIDE_FIG || c == LYX_META_WIDE_TAB
|
||||
|| c == LYX_META_ALGORITHM){
|
||||
hit = true;
|
||||
} else if (_buffer->text->cursor.pos - 1 >= 0) {
|
||||
c = _buffer->text->cursor.par->
|
||||
GetChar(_buffer->text->cursor.pos - 1);
|
||||
} else if (buffer_->text->cursor.pos - 1 >= 0) {
|
||||
c = buffer_->text->cursor.par->
|
||||
GetChar(buffer_->text->cursor.pos - 1);
|
||||
if (c == LYX_META_FOOTNOTE || c == LYX_META_MARGIN
|
||||
|| c == LYX_META_FIG || c == LYX_META_TAB
|
||||
|| c == LYX_META_WIDE_FIG
|
||||
|| c == LYX_META_WIDE_TAB
|
||||
|| c == LYX_META_ALGORITHM){
|
||||
// We are one step too far to the right
|
||||
_buffer->text->CursorLeft();
|
||||
buffer_->text->CursorLeft();
|
||||
hit = true;
|
||||
}
|
||||
}
|
||||
@ -1135,11 +1135,11 @@ int BufferView::WorkAreaButtonRelease(FL_OBJECT *ob, Window ,
|
||||
}
|
||||
|
||||
// Do we want to close a float? (click on the float-label)
|
||||
if (_buffer->text->cursor.row->par->footnoteflag ==
|
||||
if (buffer_->text->cursor.row->par->footnoteflag ==
|
||||
LyXParagraph::OPEN_FOOTNOTE
|
||||
&& _buffer->text->cursor.pos == 0
|
||||
&& _buffer->text->cursor.row->previous &&
|
||||
_buffer->text->cursor.row->previous->par->
|
||||
&& buffer_->text->cursor.pos == 0
|
||||
&& buffer_->text->cursor.row->previous &&
|
||||
buffer_->text->cursor.row->previous->par->
|
||||
footnoteflag != LyXParagraph::OPEN_FOOTNOTE){
|
||||
LyXFont font (LyXFont::ALL_SANE);
|
||||
font.setSize(LyXFont::SIZE_SMALL);
|
||||
@ -1150,10 +1150,10 @@ int BufferView::WorkAreaButtonRelease(FL_OBJECT *ob, Window ,
|
||||
int screen_first = screen->first;
|
||||
|
||||
if (x < box_x
|
||||
&& y + screen_first > _buffer->text->cursor.y -
|
||||
_buffer->text->cursor.row->baseline
|
||||
&& y + screen_first < _buffer->text->cursor.y -
|
||||
_buffer->text->cursor.row->baseline
|
||||
&& y + screen_first > buffer_->text->cursor.y -
|
||||
buffer_->text->cursor.row->baseline
|
||||
&& y + screen_first < buffer_->text->cursor.y -
|
||||
buffer_->text->cursor.row->baseline
|
||||
+ font.maxAscent()*1.2 + font.maxDescent()*1.2) {
|
||||
ToggleFloat();
|
||||
selection_possible = false;
|
||||
@ -1162,10 +1162,10 @@ int BufferView::WorkAreaButtonRelease(FL_OBJECT *ob, Window ,
|
||||
}
|
||||
|
||||
// Maybe we want to edit a bibitem ale970302
|
||||
if (_buffer->text->cursor.par->bibkey && x < 20 +
|
||||
bibitemMaxWidth(textclasslist.TextClass(_buffer->
|
||||
if (buffer_->text->cursor.par->bibkey && x < 20 +
|
||||
bibitemMaxWidth(textclasslist.TextClass(buffer_->
|
||||
params.textclass).defaultfont())) {
|
||||
_buffer->text->cursor.par->bibkey->Edit(0, 0);
|
||||
buffer_->text->cursor.par->bibkey->Edit(0, 0);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -1184,7 +1184,7 @@ Inset * BufferView::checkInsetHit(int & x, int & y)
|
||||
|
||||
int y_tmp = y + getScreen()->first;
|
||||
|
||||
LyXCursor cursor = _buffer->text->cursor;
|
||||
LyXCursor cursor = buffer_->text->cursor;
|
||||
if (cursor.pos < cursor.par->Last()
|
||||
&& cursor.par->GetChar(cursor.pos) == LYX_META_INSET
|
||||
&& cursor.par->GetInset(cursor.pos)
|
||||
@ -1192,7 +1192,7 @@ Inset * BufferView::checkInsetHit(int & x, int & y)
|
||||
|
||||
// Check whether the inset really was hit
|
||||
Inset* tmpinset = cursor.par->GetInset(cursor.pos);
|
||||
LyXFont font = _buffer->text->GetFont(cursor.par, cursor.pos);
|
||||
LyXFont font = buffer_->text->GetFont(cursor.par, cursor.pos);
|
||||
if (x > cursor.x
|
||||
&& x < cursor.x + tmpinset->Width(font)
|
||||
&& y_tmp > cursor.y - tmpinset->Ascent(font)
|
||||
@ -1206,10 +1206,10 @@ Inset * BufferView::checkInsetHit(int & x, int & y)
|
||||
&& cursor.par->GetChar(cursor.pos - 1) == LYX_META_INSET
|
||||
&& cursor.par->GetInset(cursor.pos - 1)
|
||||
&& cursor.par->GetInset(cursor.pos - 1)->Editable()) {
|
||||
_buffer->text->CursorLeft();
|
||||
buffer_->text->CursorLeft();
|
||||
Inset * result = checkInsetHit(x, y);
|
||||
if (result == 0) {
|
||||
_buffer->text->CursorRight();
|
||||
buffer_->text->CursorRight();
|
||||
return 0;
|
||||
} else {
|
||||
return result;
|
||||
@ -1239,7 +1239,7 @@ int BufferView::workAreaExpose()
|
||||
// update from work area
|
||||
work_area_width = work_area->w;
|
||||
work_area_height = work_area->h;
|
||||
if (_buffer != 0) {
|
||||
if (buffer_ != 0) {
|
||||
if (widthChange) {
|
||||
// All buffers need a resize
|
||||
bufferlist.resize();
|
||||
@ -1254,7 +1254,7 @@ int BufferView::workAreaExpose()
|
||||
// The main window size has changed, repaint most stuff
|
||||
redraw();
|
||||
// ...including the minibuffer
|
||||
_owner->getMiniBuffer()->Init();
|
||||
owner_->getMiniBuffer()->Init();
|
||||
|
||||
} else if (screen) screen->Redraw();
|
||||
} else {
|
||||
@ -1266,7 +1266,7 @@ int BufferView::workAreaExpose()
|
||||
|
||||
// always make sure that the scrollbar is sane.
|
||||
updateScrollbar();
|
||||
_owner->updateLayoutChoice();
|
||||
owner_->updateLayoutChoice();
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -1278,7 +1278,7 @@ void BufferView::CursorToggleCB(FL_OBJECT * ob, long)
|
||||
|
||||
/* quite a nice place for asyncron Inset updating, isn't it? */
|
||||
// actually no! This is run even if no buffer exist... so (Lgb)
|
||||
if (view && !view->_buffer) {
|
||||
if (view && !view->buffer_) {
|
||||
goto set_timer_and_return;
|
||||
}
|
||||
|
||||
@ -1326,20 +1326,20 @@ void BufferView::CursorToggleCB(FL_OBJECT * ob, long)
|
||||
}
|
||||
|
||||
if (view->lyx_focus && view->work_area_focus) {
|
||||
if (!view->_buffer->the_locking_inset){
|
||||
if (!view->buffer_->the_locking_inset){
|
||||
view->screen->CursorToggle();
|
||||
} else {
|
||||
view->_buffer->the_locking_inset->
|
||||
view->buffer_->the_locking_inset->
|
||||
ToggleInsetCursor();
|
||||
}
|
||||
goto set_timer_and_return;
|
||||
} else {
|
||||
// Make sure that the cursor is visible.
|
||||
if (!view->_buffer->the_locking_inset){
|
||||
if (!view->buffer_->the_locking_inset){
|
||||
view->screen->ShowCursor();
|
||||
} else {
|
||||
if (!view->_buffer->the_locking_inset->isCursorVisible())
|
||||
view->_buffer->the_locking_inset->
|
||||
if (!view->buffer_->the_locking_inset->isCursorVisible())
|
||||
view->buffer_->the_locking_inset->
|
||||
ToggleInsetCursor();
|
||||
}
|
||||
|
||||
@ -1349,12 +1349,12 @@ void BufferView::CursorToggleCB(FL_OBJECT * ob, long)
|
||||
XGetInputFocus(fl_display, &tmpwin, &tmp);
|
||||
if (lyxerr.debugging()) {
|
||||
lyxerr << "tmpwin: " << tmpwin
|
||||
<< "\nwindow: " << view->_owner->getForm()->window
|
||||
<< "\nwindow: " << view->owner_->getForm()->window
|
||||
<< "\nwork_area_focus: " << view->work_area_focus
|
||||
<< "\nlyx_focus : " << view->lyx_focus
|
||||
<< endl;
|
||||
}
|
||||
if (tmpwin != view->_owner->getForm()->window) {
|
||||
if (tmpwin != view->owner_->getForm()->window) {
|
||||
view->lyx_focus = false;
|
||||
goto skip_timer;
|
||||
} else {
|
||||
@ -1376,7 +1376,7 @@ void BufferView::CursorToggleCB(FL_OBJECT * ob, long)
|
||||
int BufferView::WorkAreaSelectionNotify(FL_OBJECT *, Window win,
|
||||
int /*w*/, int /*h*/, XEvent *event, void */*d*/)
|
||||
{
|
||||
if (_buffer == 0) return 0;
|
||||
if (buffer_ == 0) return 0;
|
||||
if (event->type != SelectionNotify)
|
||||
return 0;
|
||||
|
||||
@ -1433,17 +1433,17 @@ int BufferView::WorkAreaSelectionNotify(FL_OBJECT *, Window win,
|
||||
|
||||
if (uc){
|
||||
if (!ascii_type) {
|
||||
_buffer->text->
|
||||
buffer_->text->
|
||||
InsertStringA(reinterpret_cast<char*>(uc));
|
||||
} else {
|
||||
_buffer->text->
|
||||
buffer_->text->
|
||||
InsertStringB(reinterpret_cast<char*>(uc));
|
||||
}
|
||||
free(uc);
|
||||
uc = 0;
|
||||
}
|
||||
|
||||
_buffer->update(1);
|
||||
buffer_->update(1);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -1451,61 +1451,61 @@ int BufferView::WorkAreaSelectionNotify(FL_OBJECT *, Window win,
|
||||
|
||||
void BufferView::cursorPrevious()
|
||||
{
|
||||
if (!currentBuffer()->text->cursor.row->previous) return;
|
||||
if (!buffer()->text->cursor.row->previous) return;
|
||||
|
||||
long y = getScreen()->first;
|
||||
Row * cursorrow = currentBuffer()->text->cursor.row;
|
||||
currentBuffer()->text->
|
||||
SetCursorFromCoordinates(currentBuffer()->text->
|
||||
Row * cursorrow = buffer()->text->cursor.row;
|
||||
buffer()->text->
|
||||
SetCursorFromCoordinates(buffer()->text->
|
||||
cursor.x_fix,
|
||||
y);
|
||||
currentBuffer()->text->FinishUndo();
|
||||
/* this is to allow jumping over large insets */
|
||||
if ((cursorrow == currentBuffer()->text->cursor.row))
|
||||
currentBuffer()->text->CursorUp();
|
||||
buffer()->text->FinishUndo();
|
||||
// this is to allow jumping over large insets
|
||||
if ((cursorrow == buffer()->text->cursor.row))
|
||||
buffer()->text->CursorUp();
|
||||
|
||||
if (currentBuffer()->text->cursor.row->height < work_area->h)
|
||||
getScreen()->Draw(currentBuffer()->text->cursor.y
|
||||
- currentBuffer()->text->cursor.row->baseline
|
||||
+ currentBuffer()->text->cursor.row->height
|
||||
if (buffer()->text->cursor.row->height < work_area->h)
|
||||
getScreen()->Draw(buffer()->text->cursor.y
|
||||
- buffer()->text->cursor.row->baseline
|
||||
+ buffer()->text->cursor.row->height
|
||||
- work_area->h +1 );
|
||||
}
|
||||
|
||||
|
||||
void BufferView::cursorNext()
|
||||
{
|
||||
if (!currentBuffer()->text->cursor.row->next) return;
|
||||
if (!buffer()->text->cursor.row->next) return;
|
||||
|
||||
long y = getScreen()->first;
|
||||
currentBuffer()->text->GetRowNearY(y);
|
||||
Row* cursorrow = currentBuffer()->text->cursor.row;
|
||||
currentBuffer()->text->
|
||||
SetCursorFromCoordinates(currentBuffer()->text->
|
||||
buffer()->text->GetRowNearY(y);
|
||||
Row * cursorrow = buffer()->text->cursor.row;
|
||||
buffer()->text->
|
||||
SetCursorFromCoordinates(buffer()->text->
|
||||
cursor.x_fix,
|
||||
y + work_area->h);
|
||||
currentBuffer()->text->FinishUndo();
|
||||
buffer()->text->FinishUndo();
|
||||
/* this is to allow jumping over large insets */
|
||||
if ((cursorrow == currentBuffer()->text->cursor.row))
|
||||
currentBuffer()->text->CursorDown();
|
||||
if ((cursorrow == buffer()->text->cursor.row))
|
||||
buffer()->text->CursorDown();
|
||||
|
||||
if (currentBuffer()->text->cursor.row->height < work_area->h)
|
||||
getScreen()->Draw(currentBuffer()->text->cursor.y
|
||||
- currentBuffer()->text->cursor.row->baseline);
|
||||
if (buffer()->text->cursor.row->height < work_area->h)
|
||||
getScreen()->Draw(buffer()->text->cursor.y
|
||||
- buffer()->text->cursor.row->baseline);
|
||||
}
|
||||
|
||||
|
||||
bool BufferView::available() const
|
||||
{
|
||||
if (_buffer && _buffer->text) return true;
|
||||
if (buffer_ && buffer_->text) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void BufferView::savePosition()
|
||||
{
|
||||
backstack.push(currentBuffer()->getFileName(),
|
||||
currentBuffer()->text->cursor.x,
|
||||
currentBuffer()->text->cursor.y);
|
||||
backstack.push(buffer()->getFileName(),
|
||||
buffer()->text->cursor.x,
|
||||
buffer()->text->cursor.y);
|
||||
}
|
||||
|
||||
|
||||
@ -1519,7 +1519,7 @@ void BufferView::restorePosition()
|
||||
BeforeChange();
|
||||
Buffer * b = (bufferlist.exists(fname)) ? bufferlist.getBuffer(fname):
|
||||
bufferlist.loadLyXFile(fname); // don't ask, just load it
|
||||
setBuffer(b);
|
||||
currentBuffer()->text->SetCursorFromCoordinates(x, y);
|
||||
currentBuffer()->update(0);
|
||||
buffer(b);
|
||||
buffer()->text->SetCursorFromCoordinates(x, y);
|
||||
buffer()->update(0);
|
||||
}
|
||||
|
@ -30,11 +30,11 @@ public:
|
||||
///
|
||||
BufferView(LyXView *owner, int ,int ,int, int);
|
||||
///
|
||||
Buffer *currentBuffer() { return _buffer; }
|
||||
Buffer * buffer() const { return buffer_; }
|
||||
///
|
||||
FL_OBJECT * getWorkArea() { return work_area; }
|
||||
///
|
||||
void setBuffer(Buffer *b);
|
||||
void buffer(Buffer * b);
|
||||
///
|
||||
void resize();
|
||||
///
|
||||
@ -58,7 +58,7 @@ public:
|
||||
///
|
||||
bool available() const;
|
||||
///
|
||||
LyXView *getOwner() { return _owner; }
|
||||
LyXView * owner() const { return owner_; }
|
||||
///
|
||||
LyXScreen * getScreen()
|
||||
{
|
||||
@ -124,9 +124,9 @@ private:
|
||||
int w, int h,
|
||||
XEvent * ev, void * d);
|
||||
///
|
||||
LyXView *_owner;
|
||||
LyXView * owner_;
|
||||
///
|
||||
Buffer *_buffer;
|
||||
Buffer * buffer_;
|
||||
///
|
||||
LyXScreen * screen;
|
||||
///
|
||||
|
@ -202,7 +202,7 @@ XFontStruct* FontLoader::doLoad(LyXFont::FONT_FAMILY family,
|
||||
LyXFont::FONT_SIZE size)
|
||||
{
|
||||
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 );
|
||||
|
||||
string font = fontinfo[family][series][shape]->getFontname(fsize);
|
||||
|
@ -26,6 +26,7 @@
|
||||
extern LyXRC * lyxrc;
|
||||
|
||||
LaTeXFeatures::LaTeXFeatures(int n)
|
||||
: layout(n, false)
|
||||
{
|
||||
// packages
|
||||
color = false;
|
||||
@ -66,11 +67,6 @@ LaTeXFeatures::LaTeXFeatures(int n)
|
||||
LyXParagraphIndent = false;
|
||||
NeedLyXFootnoteCode = false;
|
||||
NeedLyXMinipageIndent = false;
|
||||
|
||||
// layouts
|
||||
layout = new bool[n];
|
||||
for (int i = n; i--;)
|
||||
layout[i] = false;
|
||||
}
|
||||
|
||||
|
||||
@ -232,9 +228,10 @@ string LaTeXFeatures::getTClassPreamble(BufferParams const & params)
|
||||
LyXTextClass const & tclass = textclasslist.TextClass(params.textclass);
|
||||
string tcpreamble = tclass.preamble();
|
||||
|
||||
for (LyXTextClass::LayoutList::const_iterator cit = tclass.begin();
|
||||
cit != tclass.end(); ++cit) {
|
||||
tcpreamble += (*cit).preamble();
|
||||
for (unsigned int i = 0; i < tclass.numLayouts(); ++i) {
|
||||
if (layout[i]) {
|
||||
tcpreamble += tclass[i].preamble();
|
||||
}
|
||||
}
|
||||
|
||||
return tcpreamble;
|
||||
|
@ -17,6 +17,8 @@
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "LString.h"
|
||||
|
||||
class BufferParams;
|
||||
@ -31,10 +33,6 @@ class LyXTextClass;
|
||||
struct LaTeXFeatures {
|
||||
///
|
||||
LaTeXFeatures(int n) ;
|
||||
///
|
||||
~LaTeXFeatures() {
|
||||
delete[] layout;
|
||||
}
|
||||
/// The packaes needed by the document
|
||||
string getPackages(BufferParams const ¶ms);
|
||||
/// The macros definitions needed by the document
|
||||
@ -118,7 +116,7 @@ struct LaTeXFeatures {
|
||||
|
||||
//@Man: Layouts
|
||||
//@{
|
||||
bool *layout;
|
||||
vector<bool> layout;
|
||||
//@}
|
||||
|
||||
//@Man: Special features
|
||||
|
@ -22,14 +22,14 @@ void ShowLatexLog()
|
||||
bool use_build = false;
|
||||
static int ow = -1, oh;
|
||||
|
||||
filename = current_view->currentBuffer()->getFileName();
|
||||
filename = current_view->buffer()->getFileName();
|
||||
if (!filename.empty()) {
|
||||
fname = SpaceLess(ChangeExtension(filename, ".log", true));
|
||||
bname = SpaceLess(ChangeExtension(filename,
|
||||
lyxrc->literate_extension + ".out", true));
|
||||
path = OnlyPath(filename);
|
||||
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);
|
||||
if (b_fi.exist())
|
||||
|
@ -52,7 +52,7 @@ void SendtoApplyCB(FL_OBJECT *, long)
|
||||
string command = fl_get_input(fd_form_sendto->input_cmd);
|
||||
if (command.empty())
|
||||
return;
|
||||
Buffer *buffer = current_view->currentBuffer();
|
||||
Buffer * buffer = current_view->buffer();
|
||||
if (fl_get_button(fd_form_sendto->radio_ftype_dvi) ||
|
||||
fl_get_button(fd_form_sendto->radio_ftype_ps)) {
|
||||
ProhibitInput();
|
||||
|
@ -52,7 +52,7 @@ LyXView::LyXView(int width, int height)
|
||||
{
|
||||
fd_form_main = create_form_form_main(width,height);
|
||||
fl_set_form_atclose(_form, C_LyXView_atCloseMainFormCB, 0);
|
||||
lyxerr.debug() << "Initializing LyXFunc" << endl;
|
||||
lyxerr[Debug::INIT] << "Initializing LyXFunc" << endl;
|
||||
lyxfunc = new LyXFunc(this);
|
||||
intl = new Intl;
|
||||
}
|
||||
@ -70,7 +70,7 @@ LyXView::~LyXView()
|
||||
|
||||
/// Redraw the main form.
|
||||
void LyXView::redraw() {
|
||||
lyxerr.debug() << "LyXView::redraw()" << endl;
|
||||
lyxerr[Debug::INFO] << "LyXView::redraw()" << endl;
|
||||
fl_redraw_form(_form);
|
||||
minibuffer->Activate();
|
||||
}
|
||||
@ -79,14 +79,14 @@ void LyXView::redraw() {
|
||||
// Callback for update timer
|
||||
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())
|
||||
return;
|
||||
if (!view->currentView()->getScreen() || !updatetimer)
|
||||
return;
|
||||
|
||||
view->currentView()->getScreen()->HideCursor();
|
||||
view->currentBuffer()->update(-2);
|
||||
view->buffer()->update(-2);
|
||||
/* This update can happen, even when the work area has lost
|
||||
* the focus. So suppress the cursor in that case */
|
||||
updatetimer = 0;
|
||||
@ -102,7 +102,7 @@ extern "C" void C_LyXView_UpdateTimerCB(FL_OBJECT *ob, long data) {
|
||||
// Callback for autosave timer
|
||||
void LyXView::AutosaveTimerCB(FL_OBJECT *, long)
|
||||
{
|
||||
lyxerr.debug() << "Running AutoSave()" << endl;
|
||||
lyxerr[Debug::INFO] << "Running AutoSave()" << endl;
|
||||
AutoSave();
|
||||
}
|
||||
|
||||
@ -127,6 +127,7 @@ int LyXView::atCloseMainFormCB(FL_FORM *, void *)
|
||||
return FL_IGNORE;
|
||||
}
|
||||
|
||||
|
||||
// Wrapper for the above
|
||||
extern "C" int C_LyXView_atCloseMainFormCB(FL_FORM * form, void * p) {
|
||||
return LyXView::atCloseMainFormCB(form, p);
|
||||
@ -165,7 +166,7 @@ FD_form_main *LyXView::create_form_form_main(int width, int height)
|
||||
|
||||
// the main form
|
||||
_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, "");
|
||||
fl_set_object_color(obj, FL_MCOL, FL_MCOL);
|
||||
|
||||
@ -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,
|
||||
0,0,0,0,"Timer");
|
||||
fl_set_object_callback(obj,C_LyXView_UpdateTimerCB,0);
|
||||
obj->u_vdata = (void*) this;
|
||||
obj->u_vdata = this;
|
||||
|
||||
//
|
||||
// Misc
|
||||
@ -283,7 +284,7 @@ void LyXView::updateLayoutChoice()
|
||||
|
||||
// this has a bi-effect that the layouts are not showed when no
|
||||
// document is loaded.
|
||||
if (bufferview==0 || bufferview->currentBuffer()==0) {
|
||||
if (bufferview == 0 || bufferview->buffer()==0) {
|
||||
toolbar->combox->clear();
|
||||
toolbar->combox->Redraw();
|
||||
return;
|
||||
@ -291,26 +292,26 @@ void LyXView::updateLayoutChoice()
|
||||
|
||||
// If textclass is different, we need to update the list
|
||||
if (toolbar->combox->empty() ||
|
||||
(last_textclass != int(currentBuffer()->params.textclass))) {
|
||||
(last_textclass != int(buffer()->params.textclass))) {
|
||||
toolbar->combox->clear();
|
||||
for (int i = 0;
|
||||
textclasslist.NameOfLayout(currentBuffer()->
|
||||
textclasslist.NameOfLayout(buffer()->
|
||||
params.textclass, i) !="@@end@@";
|
||||
i++) {
|
||||
LyXLayout const & layout = textclasslist.
|
||||
Style(currentBuffer()->params.textclass, i);
|
||||
Style(buffer()->params.textclass, i);
|
||||
if (layout.obsoleted_by().empty())
|
||||
toolbar->combox->addline(layout.name().c_str());
|
||||
else
|
||||
toolbar->combox->addline(("@N"+layout.name()).c_str());
|
||||
}
|
||||
last_textclass = int(currentBuffer()->params.textclass);
|
||||
last_textclass = int(buffer()->params.textclass);
|
||||
current_layout = 0;
|
||||
}
|
||||
// we need to do this.
|
||||
toolbar->combox->Redraw();
|
||||
|
||||
char layout = currentBuffer()->text->cursor.par->GetLayout();
|
||||
char layout = buffer()->text->cursor.par->GetLayout();
|
||||
|
||||
if (layout != current_layout){
|
||||
toolbar->combox->select(layout + 1);
|
||||
@ -321,7 +322,7 @@ void LyXView::updateLayoutChoice()
|
||||
|
||||
void LyXView::UpdateDocumentClassChoice()
|
||||
{
|
||||
/* update the document class display in the document form */
|
||||
// update the document class display in the document form
|
||||
int i;
|
||||
if (fd_form_document) {
|
||||
fl_clear_choice(fd_form_document->choice_class);
|
||||
@ -337,17 +338,17 @@ void LyXView::UpdateDocumentClassChoice()
|
||||
// as FL_KEYBOARD events :-( Matthias 280596
|
||||
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
|
||||
|
||||
// funny. Even though the raw_callback is registered with KeyPressMask,
|
||||
// also KeyRelease-events are passed through:-(
|
||||
// [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()->active)
|
||||
retval = view->getLyXFunc()->processKeyEvent((XEvent*)xev);
|
||||
|
||||
retval = view->getLyXFunc()
|
||||
->processKeyEvent(static_cast<XEvent*>(xev));
|
||||
return retval;
|
||||
}
|
||||
|
||||
@ -363,12 +364,12 @@ void LyXView::updateWindowTitle() {
|
||||
string title = "LyX";
|
||||
|
||||
if (currentView()->available()) {
|
||||
string cur_title = currentBuffer()->getFileName();
|
||||
string cur_title = buffer()->getFileName();
|
||||
if (!cur_title.empty()){
|
||||
title += ": " + OnlyFilename(cur_title);
|
||||
if (!currentBuffer()->isLyxClean())
|
||||
if (!buffer()->isLyxClean())
|
||||
title += _(" (Changed)");
|
||||
if (currentBuffer()->isReadonly())
|
||||
if (buffer()->isReadonly())
|
||||
title += _(" (read only)");
|
||||
}
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ public:
|
||||
void redraw();
|
||||
|
||||
/// returns the buffer currently shown in the main form.
|
||||
Buffer * currentBuffer(){ return bufferview->currentBuffer();}
|
||||
Buffer * buffer() const { return bufferview->buffer(); }
|
||||
|
||||
///
|
||||
BufferView * currentView() { return bufferview; }
|
||||
|
@ -168,6 +168,8 @@ lyx_SOURCES = \
|
||||
trans_mgr.C \
|
||||
trans_mgr.h \
|
||||
undo.h \
|
||||
vc-backend.C \
|
||||
vc-backend.h \
|
||||
version.h \
|
||||
vms_defines.h \
|
||||
vspace.C \
|
||||
|
@ -112,7 +112,7 @@ bool UpdateLayoutPaper()
|
||||
update = false;
|
||||
|
||||
if (update) {
|
||||
BufferParams * params = ¤t_view->currentBuffer()->params;
|
||||
BufferParams * params = ¤t_view->buffer()->params;
|
||||
|
||||
fl_set_choice(fd_form_paper->choice_papersize2,
|
||||
params->papersize2 + 1);
|
||||
@ -148,7 +148,7 @@ bool UpdateLayoutPaper()
|
||||
fl_set_focus_object(fd_form_paper->form_paper,
|
||||
fd_form_paper->choice_papersize2);
|
||||
fl_hide_object(fd_form_paper->text_warning);
|
||||
if (current_view->currentBuffer()->isReadonly()) {
|
||||
if (current_view->buffer()->isReadonly()) {
|
||||
DisablePaperLayout();
|
||||
fl_set_object_label(fd_form_paper->text_warning,
|
||||
_("Document is read-only."
|
||||
@ -184,7 +184,7 @@ void PaperApplyCB(FL_OBJECT *, long)
|
||||
if (! current_view->available())
|
||||
return;
|
||||
|
||||
BufferParams * params = ¤t_view->currentBuffer()->params;
|
||||
BufferParams * params = ¤t_view->buffer()->params;
|
||||
|
||||
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->headsep = fl_get_input(fd->input_head_sep);
|
||||
params->footskip = fl_get_input(fd->input_foot_skip);
|
||||
current_view->currentBuffer()->setPaperStuff();
|
||||
current_view->buffer()->setPaperStuff();
|
||||
minibuffer->Set(_("Paper layout set"));
|
||||
current_view->currentBuffer()->markDirty();
|
||||
current_view->buffer()->markDirty();
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ bool UpdateParagraphExtra()
|
||||
bool update = false;
|
||||
if (current_view->getScreen() && current_view->available()) {
|
||||
update = true;
|
||||
LyXParagraph* par = current_view->currentBuffer()->text->cursor.par;
|
||||
LyXParagraph * par = current_view->buffer()->text->cursor.par;
|
||||
|
||||
EnableParagraphExtra();
|
||||
|
||||
@ -137,7 +137,7 @@ bool UpdateParagraphExtra()
|
||||
}
|
||||
fl_hide_object(fd_form_paragraph_extra->text_warning);
|
||||
|
||||
if (current_view->currentBuffer()->isReadonly()) {
|
||||
if (current_view->buffer()->isReadonly()) {
|
||||
DisableParagraphExtra();
|
||||
fl_set_object_label(fd_form_paragraph_extra->text_warning,
|
||||
_("Document is read-only. No changes to layout permitted."));
|
||||
@ -165,12 +165,10 @@ void ParagraphExtraOpen(FL_OBJECT *, long)
|
||||
void ParagraphExtraApplyCB(FL_OBJECT *, long)
|
||||
{
|
||||
if (current_view->getScreen() && current_view->available()) {
|
||||
const FD_form_paragraph_extra* fd = fd_form_paragraph_extra;
|
||||
const char
|
||||
*width = fl_get_input(fd->input_pextra_width),
|
||||
*widthp = fl_get_input(fd->input_pextra_widthp);
|
||||
LyXText
|
||||
*text = current_view->currentBuffer()->text;
|
||||
FD_form_paragraph_extra const * fd = fd_form_paragraph_extra;
|
||||
const char * width = fl_get_input(fd->input_pextra_width);
|
||||
const char * widthp = fl_get_input(fd->input_pextra_widthp);
|
||||
LyXText * text = current_view->buffer()->text;
|
||||
int type = PEXTRA_NONE;
|
||||
int alignment = 0;
|
||||
bool
|
||||
@ -195,7 +193,7 @@ void ParagraphExtraApplyCB(FL_OBJECT *, long)
|
||||
}
|
||||
text->SetParagraphExtraOpt(type,width,widthp,alignment,hfill,
|
||||
start_minipage);
|
||||
current_view->currentBuffer()->update(1);
|
||||
current_view->buffer()->update(1);
|
||||
minibuffer->Set(_("ParagraphExtra layout set"));
|
||||
}
|
||||
return;
|
||||
|
@ -43,21 +43,20 @@ bool UpdateLayoutTable(int flag)
|
||||
if (!current_view->getScreen() || !current_view->available())
|
||||
update = false;
|
||||
|
||||
if (update && current_view->currentBuffer()->text->cursor.par->table) {
|
||||
if (update && current_view->buffer()->text->cursor.par->table) {
|
||||
int
|
||||
align,
|
||||
cell,
|
||||
column,row;
|
||||
char
|
||||
buf[12];
|
||||
string
|
||||
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->
|
||||
NumberOfCell(current_view->currentBuffer()->text->cursor.par,
|
||||
current_view->currentBuffer()->text->cursor.pos);
|
||||
int cell = current_view->buffer()->text->
|
||||
NumberOfCell(current_view->buffer()->text->cursor.par,
|
||||
current_view->buffer()->text->cursor.pos);
|
||||
ActCell = cell;
|
||||
column = table->column_of_cell(cell)+1;
|
||||
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,
|
||||
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);
|
||||
special = table->GetAlignSpecial(cell,LyXTable::SET_SPECIAL_MULTI);
|
||||
if (flag)
|
||||
@ -118,12 +117,12 @@ bool UpdateLayoutTable(int flag)
|
||||
fl_set_input_cursorpos(fd_form_table_extra->input_special_multialign,
|
||||
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);
|
||||
pwidth = table->GetPWidth(cell);
|
||||
if (flag)
|
||||
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);
|
||||
if (!pwidth.empty()) {
|
||||
fl_activate_object(fd_form_table_options->radio_linebreak_cell);
|
||||
@ -264,7 +263,6 @@ void TableOptionsCB(FL_OBJECT *ob, long)
|
||||
LyXTable
|
||||
*table = 0;
|
||||
int
|
||||
cell,
|
||||
s,
|
||||
num = 0;
|
||||
string
|
||||
@ -273,14 +271,14 @@ void TableOptionsCB(FL_OBJECT *ob, long)
|
||||
|
||||
if (!current_view->available()
|
||||
||
|
||||
!(table = current_view->currentBuffer()->text->cursor.par->table))
|
||||
!(table = current_view->buffer()->text->cursor.par->table))
|
||||
{
|
||||
MenuLayoutTable(0);
|
||||
return;
|
||||
}
|
||||
cell = current_view->currentBuffer()->text->
|
||||
NumberOfCell(current_view->currentBuffer()->text->cursor.par,
|
||||
current_view->currentBuffer()->text->cursor.pos);
|
||||
int cell = current_view->buffer()->text->
|
||||
NumberOfCell(current_view->buffer()->text->cursor.par,
|
||||
current_view->buffer()->text->cursor.pos);
|
||||
if (ActCell != cell) {
|
||||
MenuLayoutTable(0);
|
||||
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
|
||||
// anyhow, so exit now if the buffer is read-only.
|
||||
if (current_view->currentBuffer()->isReadonly()) {
|
||||
if (current_view->buffer()->isReadonly()) {
|
||||
MenuLayoutTable(0);
|
||||
return;
|
||||
}
|
||||
@ -431,16 +429,16 @@ void TableOptionsCB(FL_OBJECT *ob, long)
|
||||
return;
|
||||
if (current_view->available()){
|
||||
current_view->getScreen()->HideCursor();
|
||||
if (!current_view->currentBuffer()->text->selection){
|
||||
if (!current_view->buffer()->text->selection){
|
||||
BeforeChange();
|
||||
current_view->currentBuffer()->update(-2);
|
||||
current_view->buffer()->update(-2);
|
||||
}
|
||||
if ((num == LyXTable::SET_SPECIAL_COLUMN) ||
|
||||
(num == LyXTable::SET_SPECIAL_MULTI))
|
||||
current_view->currentBuffer()->text->TableFeatures(num,special);
|
||||
current_view->buffer()->text->TableFeatures(num,special);
|
||||
else
|
||||
current_view->currentBuffer()->text->TableFeatures(num);
|
||||
current_view->currentBuffer()->update(1);
|
||||
current_view->buffer()->text->TableFeatures(num);
|
||||
current_view->buffer()->update(1);
|
||||
}
|
||||
if (num == LyXTable::DELETE_TABLE) {
|
||||
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()){
|
||||
current_view->getScreen()->HideCursor();
|
||||
if (!current_view->currentBuffer()->text->selection){
|
||||
if (!current_view->buffer()->text->selection){
|
||||
BeforeChange();
|
||||
current_view->currentBuffer()->update(-2);
|
||||
current_view->buffer()->update(-2);
|
||||
}
|
||||
current_view->currentBuffer()->text->TableFeatures(LyXTable::SET_PWIDTH,str);
|
||||
current_view->currentBuffer()->update(1);
|
||||
current_view->buffer()->text->TableFeatures(LyXTable::SET_PWIDTH,str);
|
||||
current_view->buffer()->update(1);
|
||||
}
|
||||
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)
|
||||
{
|
||||
lyxerr[Debug::INFO] << "Buffer::Buffer()" << endl;
|
||||
filename = file;
|
||||
filepath = OnlyPath(file);
|
||||
paragraph = 0;
|
||||
@ -115,8 +116,7 @@ Buffer::Buffer(string const & file, LyXRC *lyxrc, bool ronly)
|
||||
read_only = ronly;
|
||||
inset_slept = false;
|
||||
users = 0;
|
||||
lyxvc.setBuffer(this);
|
||||
lyxerr.debug() << "Buffer::Buffer()" << endl;
|
||||
lyxvc.buffer(this);
|
||||
if (read_only || (lyxrc && lyxrc->use_tempdir)) {
|
||||
tmppath = CreateBufferTmpDir();
|
||||
} else tmppath.clear();
|
||||
@ -125,14 +125,14 @@ Buffer::Buffer(string const & file, LyXRC *lyxrc, bool ronly)
|
||||
|
||||
Buffer::~Buffer()
|
||||
{
|
||||
lyxerr.debug() << "Buffer::~Buffer()" << endl;
|
||||
lyxerr[Debug::INFO] << "Buffer::~Buffer()" << endl;
|
||||
// here the buffer should take care that it is
|
||||
// saved properly, before it goes into the void.
|
||||
|
||||
// make sure that views using this buffer
|
||||
// forgets it.
|
||||
if (users)
|
||||
users->setBuffer(0);
|
||||
users->buffer(0);
|
||||
|
||||
if (!tmppath.empty()) {
|
||||
DestroyBufferTmpDir(tmppath);
|
||||
@ -169,7 +169,7 @@ bool Buffer::saveParamsAsDefaults()
|
||||
// Should work on a list
|
||||
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
|
||||
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
|
||||
users->getOwner()->getMiniBuffer()->Set(_("Running LaTeX..."));
|
||||
users->owner()->getMiniBuffer()->Set(_("Running LaTeX..."));
|
||||
|
||||
// Remove all error insets
|
||||
bool a = removeAutoInsets();
|
||||
@ -3221,14 +3221,15 @@ int Buffer::runLaTeX()
|
||||
// do the LaTex run(s)
|
||||
TeXErrors terr;
|
||||
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().
|
||||
if ((res & LaTeX::NO_LOGFILE)) {
|
||||
WriteAlert(_("LaTeX did not work!"),
|
||||
_("Missing log file:"), name);
|
||||
} else if ((res & LaTeX::ERRORS)) {
|
||||
users->getOwner()->getMiniBuffer()->Set(_("Done"));
|
||||
users->owner()->getMiniBuffer()->Set(_("Done"));
|
||||
// Insert all errors as errors boxes
|
||||
insertErrors(terr);
|
||||
|
||||
@ -3237,7 +3238,7 @@ int Buffer::runLaTeX()
|
||||
// to view a dirty dvi too.
|
||||
} else {
|
||||
//no errors or any other things to think about so:
|
||||
users->getOwner()->getMiniBuffer()->Set(_("Done"));
|
||||
users->owner()->getMiniBuffer()->Set(_("Done"));
|
||||
markDviClean();
|
||||
}
|
||||
|
||||
@ -3273,7 +3274,7 @@ int Buffer::runLiterate()
|
||||
}
|
||||
|
||||
Path p(path); // path to Literate file
|
||||
users->getOwner()->getMiniBuffer()->Set(_("Running Literate..."));
|
||||
users->owner()->getMiniBuffer()->Set(_("Running Literate..."));
|
||||
|
||||
// Remove all error insets
|
||||
bool a = removeAutoInsets();
|
||||
@ -3289,14 +3290,14 @@ int Buffer::runLiterate()
|
||||
lyxrc->literate_command, lyxrc->literate_error_filter,
|
||||
lyxrc->build_command, lyxrc->build_error_filter);
|
||||
TeXErrors terr;
|
||||
int res = literate.weave(terr, users->getOwner()->getMiniBuffer());
|
||||
int res = literate.weave(terr, users->owner()->getMiniBuffer());
|
||||
|
||||
// check return value from literate.weave().
|
||||
if ((res & Literate::NO_LOGFILE)) {
|
||||
WriteAlert(_("Literate command did not work!"),
|
||||
_("Missing log file:"), name);
|
||||
} else if ((res & Literate::ERRORS)) {
|
||||
users->getOwner()->getMiniBuffer()->Set(_("Done"));
|
||||
users->owner()->getMiniBuffer()->Set(_("Done"));
|
||||
// Insert all errors as errors boxes
|
||||
insertErrors(terr);
|
||||
|
||||
@ -3305,7 +3306,7 @@ int Buffer::runLiterate()
|
||||
// to view a dirty dvi too.
|
||||
} else {
|
||||
//no errors or any other things to think about so:
|
||||
users->getOwner()->getMiniBuffer()->Set(_("Done"));
|
||||
users->owner()->getMiniBuffer()->Set(_("Done"));
|
||||
markDviClean();
|
||||
}
|
||||
|
||||
@ -3341,7 +3342,7 @@ int Buffer::buildProgram()
|
||||
}
|
||||
|
||||
Path p(path); // path to Literate file
|
||||
users->getOwner()->getMiniBuffer()->Set(_("Building Program..."));
|
||||
users->owner()->getMiniBuffer()->Set(_("Building Program..."));
|
||||
|
||||
// Remove all error insets
|
||||
bool a = removeAutoInsets();
|
||||
@ -3357,14 +3358,14 @@ int Buffer::buildProgram()
|
||||
lyxrc->literate_command, lyxrc->literate_error_filter,
|
||||
lyxrc->build_command, lyxrc->build_error_filter);
|
||||
TeXErrors terr;
|
||||
int res = literate.build(terr, users->getOwner()->getMiniBuffer());
|
||||
int res = literate.build(terr, users->owner()->getMiniBuffer());
|
||||
|
||||
// check return value from literate.build().
|
||||
if ((res & Literate::NO_LOGFILE)) {
|
||||
WriteAlert(_("Build did not work!"),
|
||||
_("Missing log file:"), name);
|
||||
} else if ((res & Literate::ERRORS)) {
|
||||
users->getOwner()->getMiniBuffer()->Set(_("Done"));
|
||||
users->owner()->getMiniBuffer()->Set(_("Done"));
|
||||
// Insert all errors as errors boxes
|
||||
insertErrors(terr);
|
||||
|
||||
@ -3372,7 +3373,7 @@ int Buffer::buildProgram()
|
||||
// command run ends up with errors.
|
||||
} else {
|
||||
//no errors or any other things to think about so:
|
||||
users->getOwner()->getMiniBuffer()->Set(_("Done"));
|
||||
users->owner()->getMiniBuffer()->Set(_("Done"));
|
||||
markNwClean();
|
||||
}
|
||||
|
||||
@ -3408,7 +3409,7 @@ int Buffer::runChktex()
|
||||
}
|
||||
|
||||
Path p(path); // path to LaTeX file
|
||||
users->getOwner()->getMiniBuffer()->Set(_("Running chktex..."));
|
||||
users->owner()->getMiniBuffer()->Set(_("Running chktex..."));
|
||||
|
||||
// Remove all error insets
|
||||
bool a = removeAutoInsets();
|
||||
@ -3673,7 +3674,7 @@ void Buffer::update(signed char f)
|
||||
{
|
||||
if (!users) return;
|
||||
|
||||
users->getOwner()->updateLayoutChoice();
|
||||
users->owner()->updateLayoutChoice();
|
||||
|
||||
if (!text->selection && f > -3)
|
||||
text->sel_cursor = text->cursor;
|
||||
@ -3690,7 +3691,7 @@ void Buffer::update(signed char f)
|
||||
if (f==1 || f==-1) {
|
||||
if (isLyxClean()) {
|
||||
markDirty();
|
||||
users->getOwner()->getMiniBuffer()->setTimer(4);
|
||||
users->owner()->getMiniBuffer()->setTimer(4);
|
||||
} else {
|
||||
markDirty();
|
||||
}
|
||||
|
@ -61,8 +61,8 @@ bool updateBulletForm()
|
||||
}
|
||||
if (!current_view->available()) {
|
||||
update = false;
|
||||
} else if (current_view->currentBuffer()->isReadonly()
|
||||
|| current_view->currentBuffer()->isLinuxDoc()) {
|
||||
} else if (current_view->buffer()->isReadonly()
|
||||
|| current_view->buffer()->isLinuxDoc()) {
|
||||
fl_deactivate_object (fd_form_bullet->button_ok);
|
||||
fl_deactivate_object (fd_form_bullet->button_apply);
|
||||
fl_set_object_lcol (fd_form_bullet->button_ok, FL_INACTIVE);
|
||||
@ -85,10 +85,10 @@ bool updateBulletForm()
|
||||
// any settings that need doing each time
|
||||
fl_set_button(fd_form_bullet->radio_bullet_depth_1, 1);
|
||||
fl_set_input(fd_form_bullet->input_bullet_latex,
|
||||
current_view->currentBuffer()
|
||||
current_view->buffer()
|
||||
->params.user_defined_bullets[0].c_str());
|
||||
fl_set_choice(fd_form_bullet->choice_bullet_size,
|
||||
current_view->currentBuffer()
|
||||
current_view->buffer()
|
||||
->params.user_defined_bullets[0].getSize() + 2);
|
||||
} else {
|
||||
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*/ )
|
||||
{
|
||||
/* update the bullet settings */
|
||||
BufferParams & param = current_view->currentBuffer()->params;
|
||||
// update the bullet settings
|
||||
BufferParams & param = current_view->buffer()->params;
|
||||
|
||||
// a little bit of loop unrolling
|
||||
param.user_defined_bullets[0] = param.temp_bullets[0];
|
||||
param.user_defined_bullets[1] = param.temp_bullets[1];
|
||||
param.user_defined_bullets[2] = param.temp_bullets[2];
|
||||
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);
|
||||
// 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[1] = param.user_defined_bullets[1];
|
||||
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)
|
||||
{
|
||||
/* fill-in code for callback */
|
||||
BufferParams & param = current_view->currentBuffer()->params;
|
||||
// fill-in code for callback
|
||||
BufferParams & param = current_view->buffer()->params;
|
||||
|
||||
param.temp_bullets[current_bullet_depth].setText(
|
||||
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*/ )
|
||||
{
|
||||
BufferParams & param = current_view->currentBuffer()->params;
|
||||
BufferParams & param = current_view->buffer()->params;
|
||||
|
||||
// convert from 1-6 range to -1-4
|
||||
param.temp_bullets[current_bullet_depth].setSize(fl_get_choice(ob) - 2);
|
||||
@ -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 */
|
||||
/* 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)) {
|
||||
case 3:
|
||||
@ -242,7 +242,7 @@ void BulletBMTableCB(FL_OBJECT *ob, long /*data*/ )
|
||||
/* to that extracted from the current chosen position of the BMTable */
|
||||
/* 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);
|
||||
|
||||
/* 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)
|
||||
/* initialize key mapper */
|
||||
{
|
||||
lyxerr[Debug::KBMAP] << "Initializing key mappings..." << endl;
|
||||
lyxerr[Debug::INIT] << "Initializing key mappings..." << endl;
|
||||
|
||||
if (prim_lang.empty() && sec_lang.empty())
|
||||
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()
|
||||
{
|
||||
lyxerr.debug() << "Initializing LyXView..." << endl;
|
||||
lyxerr[Debug::INIT] << "Initializing LyXView..." << endl;
|
||||
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)
|
||||
|
||||
@ -641,5 +641,5 @@ void LyXGUI::runTime()
|
||||
|
||||
void LyXGUI::regBuf(Buffer *b)
|
||||
{
|
||||
lyxViews->currentView()->setBuffer(b);
|
||||
lyxViews->currentView()->buffer(b);
|
||||
}
|
||||
|
@ -242,7 +242,7 @@ void updateAllVisibleBufferRelatedPopups()
|
||||
RefUpdateCB(0,0);
|
||||
}
|
||||
#endif
|
||||
if (current_view->currentBuffer()->isReadonly()) {
|
||||
if (current_view->buffer()->isReadonly()) {
|
||||
// a little crude perhaps but it works. ARRae
|
||||
if (fd_form_character->form_character->visible) {
|
||||
fl_hide_form(fd_form_character->form_character);
|
||||
@ -410,6 +410,6 @@ void WarnReadonly()
|
||||
{
|
||||
WriteAlert(_("Any changes will be ignored"),
|
||||
_("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)
|
||||
toplevel_keymap = new kb_keymap;
|
||||
|
||||
lyxerr.debug() << "Initializing lyxrc" << endl;
|
||||
lyxerr[Debug::INIT] << "Initializing lyxrc" << endl;
|
||||
lyxrc = new LyXRC;
|
||||
|
||||
// Make the GUI object, and let it take care of the
|
||||
// command line arguments that concerns it.
|
||||
lyxerr.debug() << "Initializing LyXGUI..." << endl;
|
||||
lyxerr[Debug::INIT] << "Initializing LyXGUI..." << endl;
|
||||
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)
|
||||
lyxerr.debug() << "Initializing LyX::init..." << endl;
|
||||
lyxerr[Debug::INIT] << "Initializing LyX::init..." << endl;
|
||||
init(argc, argv);
|
||||
lyxerr.debug() << "Initializing LyX::init...done" << endl;
|
||||
lyxerr[Debug::INIT] << "Initializing LyX::init...done" << endl;
|
||||
|
||||
lyxGUI->init();
|
||||
|
||||
@ -87,13 +87,13 @@ LyX::LyX(int * argc, char * argv[])
|
||||
// the only thing left on the command line should be
|
||||
// filenames.
|
||||
if ((*argc)==2)
|
||||
lyxerr.debug() << "Opening document..." << endl;
|
||||
lyxerr[Debug::INFO] << "Opening document..." << endl;
|
||||
else if ((*argc)>2)
|
||||
lyxerr.debug() << "Opening documents..." << endl;
|
||||
lyxerr[Debug::INFO] << "Opening documents..." << endl;
|
||||
|
||||
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]);
|
||||
if (loadb != 0) {
|
||||
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.")
|
||||
<< endl;
|
||||
}
|
||||
lyxerr.debug() << "Path of binary: " << binpath << endl;
|
||||
lyxerr[Debug::INIT] << "Path of binary: " << binpath << endl;
|
||||
|
||||
//
|
||||
// Determine system directory.
|
||||
@ -323,7 +323,7 @@ void LyX::init(int */*argc*/, char **argv)
|
||||
Screen * scr=(DefaultScreenOfDisplay(fl_get_display()));
|
||||
lyxrc->dpi = ((HeightOfScreen(scr)* 25.4 / HeightMMOfScreen(scr)) +
|
||||
(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;
|
||||
|
||||
//
|
||||
|
42
src/lyxfr1.C
42
src/lyxfr1.C
@ -141,10 +141,10 @@ void SetSelectionOverLenChars(LyXText *lt, int len)
|
||||
void LyXFindReplace1::StartSearch()
|
||||
{
|
||||
LyXFindReplace0::StartSearch();
|
||||
SetReplaceEnabled(!current_view->currentBuffer()->isReadonly());
|
||||
SetReplaceEnabled(!current_view->buffer()->isReadonly());
|
||||
searchForward = true;
|
||||
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())
|
||||
return;
|
||||
if (current_view->currentBuffer()->isReadonly())
|
||||
if (current_view->buffer()->isReadonly())
|
||||
return;
|
||||
|
||||
// CutSelection cannot cut a single space, so we have to stop
|
||||
@ -171,17 +171,17 @@ void LyXFindReplace1::SearchReplaceCB()
|
||||
string const replacestring = ReplaceString();
|
||||
|
||||
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) {
|
||||
// clear the selection (if there is any)
|
||||
current_view->getScreen()->ToggleSelection(false);
|
||||
current_view->currentBuffer()->text->
|
||||
current_view->buffer()->text->
|
||||
ReplaceSelectionWithString(replacestring.c_str());
|
||||
current_view->currentBuffer()->text->
|
||||
current_view->buffer()->text->
|
||||
SetSelectionOverString(replacestring.c_str());
|
||||
current_view->currentBuffer()->update(1);
|
||||
current_view->buffer()->update(1);
|
||||
}
|
||||
|
||||
// jump to next match:
|
||||
@ -196,7 +196,7 @@ void LyXFindReplace1::SearchReplaceAllCB()
|
||||
|
||||
if (!current_view->getScreen())
|
||||
return;
|
||||
if (current_view->currentBuffer()->isReadonly())
|
||||
if (current_view->buffer()->isReadonly())
|
||||
return;
|
||||
|
||||
// CutSelection cannot cut a single space, so we have to stop
|
||||
@ -214,20 +214,20 @@ void LyXFindReplace1::SearchReplaceAllCB()
|
||||
current_view->getScreen()->HideCursor();
|
||||
|
||||
// start at top
|
||||
current_view->currentBuffer()->text->ClearSelection();
|
||||
current_view->currentBuffer()->text->CursorTop();
|
||||
current_view->buffer()->text->ClearSelection();
|
||||
current_view->buffer()->text->CursorTop();
|
||||
|
||||
int replace_count = 0;
|
||||
do {
|
||||
ltCur = current_view->currentBuffer()->text;
|
||||
ltCur = current_view->buffer()->text;
|
||||
if (ltCur->selection) {
|
||||
current_view->currentBuffer()->update(-2);
|
||||
current_view->buffer()->update(-2);
|
||||
current_view->getScreen()->ToggleSelection(false);
|
||||
current_view->currentBuffer()->text->
|
||||
current_view->buffer()->text->
|
||||
ReplaceSelectionWithString(replacestring.c_str());
|
||||
current_view->currentBuffer()->text->
|
||||
current_view->buffer()->text->
|
||||
SetSelectionOverString(replacestring.c_str());
|
||||
current_view->currentBuffer()->update(1);
|
||||
current_view->buffer()->update(1);
|
||||
replace_count++;
|
||||
}
|
||||
} while( SearchCB(true) );
|
||||
@ -259,8 +259,8 @@ bool LyXFindReplace1::SearchCB(bool fForward)
|
||||
return(false);
|
||||
|
||||
current_view->getScreen()->HideCursor();
|
||||
current_view->currentBuffer()->update(-2);
|
||||
ltCur = current_view->currentBuffer()->text;
|
||||
current_view->buffer()->update(-2);
|
||||
ltCur = current_view->buffer()->text;
|
||||
if (ltCur->selection)
|
||||
ltCur->cursor = fForward ? ltCur->sel_end_cursor :
|
||||
ltCur->sel_start_cursor;
|
||||
@ -270,14 +270,14 @@ bool LyXFindReplace1::SearchCB(bool fForward)
|
||||
|
||||
if (!ValidSearchData() ||
|
||||
(fForward ? SearchForward(ltCur) : SearchBackward(ltCur))) {
|
||||
current_view->currentBuffer()->update(-2);
|
||||
current_view->buffer()->update(-2);
|
||||
|
||||
// clear the selection (if there is any)
|
||||
current_view->getScreen()->ToggleSelection();
|
||||
current_view->currentBuffer()->text->ClearSelection();
|
||||
current_view->buffer()->text->ClearSelection();
|
||||
|
||||
// set the new selection
|
||||
SetSelectionOverLenChars(current_view->currentBuffer()->text, iLenSelected);
|
||||
SetSelectionOverLenChars(current_view->buffer()->text, iLenSelected);
|
||||
current_view->getScreen()->ToggleSelection(false);
|
||||
minibuffer->Set(_("Found."));
|
||||
result = true;
|
||||
|
671
src/lyxfunc.C
671
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
|
||||
setlocale(LC_CTYPE,"");
|
||||
if (!XSupportsLocale()) {
|
||||
lyxerr.debug("InitLyXLookup: X does not support this locale.");
|
||||
lyxerr.debug() << "InitLyXLookup: X does not support this locale." << endl;
|
||||
return;
|
||||
}
|
||||
if (!XSetLocaleModifiers("")) {
|
||||
lyxerr.debug("InitLyXLookup: Could not set modifiers "
|
||||
"for this locale.");
|
||||
lyxerr.debug() << "InitLyXLookup: Could not set modifiers "
|
||||
"for this locale." << endl;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -54,15 +54,15 @@ void InitLyXLookup(Display* display, Window window)
|
||||
0);
|
||||
|
||||
if (!xic) {
|
||||
lyxerr.debug("InitLyXLookup: could not create "
|
||||
"an input context");
|
||||
lyxerr.debug() << "InitLyXLookup: could not create "
|
||||
"an input context" << endl;
|
||||
XCloseIM (xim);
|
||||
xim = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
lyxerr.debug("InitLyXLookup: could not open "
|
||||
"an input method.");
|
||||
lyxerr.debug() << "InitLyXLookup: could not open "
|
||||
"an input method." << endl;
|
||||
|
||||
}
|
||||
|
||||
@ -153,7 +153,7 @@ int LyXLookupString(XEvent *event,
|
||||
}
|
||||
if (event->type != KeyPress)
|
||||
lyxerr << "LyXLookupString: wrong event type"
|
||||
+string(event->type));
|
||||
<< event->type << endl;
|
||||
Status status_return;
|
||||
|
||||
result = XmbLookupString(xic, &event->xkey, buffer_return,
|
||||
@ -189,7 +189,8 @@ int LyXLookupString(XEvent *event,
|
||||
void CloseLyXLookup()
|
||||
{
|
||||
if (xic) {
|
||||
lyxerr.debug("CloseLyXLookup: destroying input context");
|
||||
lyxerr.debug() << "CloseLyXLookup: destroying input context"
|
||||
<< endl;
|
||||
XDestroyIC(xic);
|
||||
XCloseIM(xim);
|
||||
}
|
||||
|
235
src/lyxvc.C
235
src/lyxvc.C
@ -4,29 +4,25 @@
|
||||
#pragma implementation
|
||||
#endif
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
#include FORMS_H_LOCATION
|
||||
#include "lyxvc.h"
|
||||
#include "vc-backend.h"
|
||||
#include "debug.h"
|
||||
#include "lyx_gui_misc.h"
|
||||
#include "bufferlist.h"
|
||||
#include "support/syscall.h"
|
||||
#include "support/path.h"
|
||||
#include "support/filetools.h"
|
||||
#include "support/FileInfo.h"
|
||||
#include "buffer.h"
|
||||
#include "gettext.h"
|
||||
#include "LyXView.h"
|
||||
#include "support/filetools.h"
|
||||
#include "lyxfunc.h"
|
||||
#include "latexoptions.h"
|
||||
|
||||
extern BufferList bufferlist;
|
||||
extern void MenuWrite(Buffer *);
|
||||
#include "LyXView.h"
|
||||
|
||||
|
||||
LyXVC::LyXVC()
|
||||
{
|
||||
backend = UNKNOWN_VCS;
|
||||
_owner = 0;
|
||||
vcs = 0;
|
||||
browser = 0;
|
||||
owner_ = 0;
|
||||
}
|
||||
|
||||
|
||||
@ -37,39 +33,27 @@ LyXVC::~LyXVC()
|
||||
fl_hide_form(browser->LaTeXLog);
|
||||
fl_free_form(browser->LaTeXLog);
|
||||
}
|
||||
if (vcs) {
|
||||
delete vcs;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool LyXVC::file_found_hook(string const & fn)
|
||||
{
|
||||
string tmp(fn);
|
||||
FileInfo f;
|
||||
// Check if *,v exists.
|
||||
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;
|
||||
} 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();
|
||||
string found_file;
|
||||
// Check if file is under RCS
|
||||
if (!(found_file = RCS::find_file(fn)).empty()) {
|
||||
vcs = new RCS(found_file);
|
||||
vcs->owner(owner_);
|
||||
return true;
|
||||
}
|
||||
// Check if file is under CVS
|
||||
if (!(found_file = CVS::find_file(fn)).empty()) {
|
||||
vcs = new CVS(found_file, fn);
|
||||
vcs->owner(owner_);
|
||||
return true;
|
||||
}
|
||||
// If either one, return true
|
||||
|
||||
// file is not under any VCS.
|
||||
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;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
owner_ = buf;
|
||||
}
|
||||
|
||||
|
||||
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()
|
||||
{
|
||||
// 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 (!_owner->isLyxClean() &&
|
||||
if (!vcs->owner()->isLyxClean() &&
|
||||
AskQuestion(_("Changes in document:"),
|
||||
MakeDisplayPath(_owner->getFileName(),50),
|
||||
MakeDisplayPath(vcs->owner()->getFileName(),50),
|
||||
_("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,
|
||||
// the document will be dirty, and we abort.
|
||||
if (!_owner->isLyxClean()) {
|
||||
if (!vcs->owner()->isLyxClean()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -185,56 +105,49 @@ void LyXVC::registrer()
|
||||
WriteAlert(_("Info"), _("This document has NOT been registered."));
|
||||
return;
|
||||
}
|
||||
string cmd = "ci -q -u -i -t-\"";
|
||||
cmd += tmp;
|
||||
cmd += "\" \"";
|
||||
cmd += OnlyFilename(_owner->getFileName());
|
||||
cmd += "\"";
|
||||
doVCCommand(cmd);
|
||||
_owner->getUser()->getOwner()->getLyXFunc()->Dispatch("buffer-reload");
|
||||
|
||||
vcs->registrer(tmp);
|
||||
}
|
||||
|
||||
|
||||
void LyXVC::checkIn()
|
||||
{
|
||||
// If the document is changed, we might want to save it
|
||||
if (!_owner->isLyxClean() &&
|
||||
if (!vcs->owner()->isLyxClean() &&
|
||||
AskQuestion(_("Changes in document:"),
|
||||
MakeDisplayPath(_owner->getFileName(),50),
|
||||
MakeDisplayPath(vcs->owner()->getFileName(),50),
|
||||
_("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,
|
||||
// the document will be dirty, and we abort.
|
||||
if (!_owner->isLyxClean()) {
|
||||
if (!vcs->owner()->isLyxClean()) {
|
||||
return;
|
||||
}
|
||||
|
||||
lyxerr[Debug::LYXVC] << "LyXVC: checkIn" << endl;
|
||||
_owner->getUser()->getOwner()->getLyXFunc()->Dispatch(LFUN_MENUWRITE);
|
||||
string tmp = askForText(_("LyX VC: Log Message"));
|
||||
if (tmp.empty()) tmp = "(no log msg)";
|
||||
doVCCommand("ci -q -u -m\"" + tmp + "\" \""
|
||||
+ OnlyFilename(_owner->getFileName()) + "\"");
|
||||
_owner->getUser()->getOwner()->getLyXFunc()->Dispatch("buffer-reload");
|
||||
|
||||
vcs->checkIn(tmp);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void LyXVC::checkOut()
|
||||
{
|
||||
lyxerr[Debug::LYXVC] << "LyXVC: checkOut" << endl;
|
||||
if (!_owner->isLyxClean()
|
||||
if (!vcs->owner()->isLyxClean()
|
||||
&& !AskQuestion(_("Changes in document:"),
|
||||
MakeDisplayPath(_owner->getFileName(),50),
|
||||
MakeDisplayPath(vcs->owner()->getFileName(),50),
|
||||
_("Ignore changes and proceed with check out?"))) {
|
||||
return;
|
||||
}
|
||||
|
||||
_owner->markLyxClean();
|
||||
doVCCommand("co -q -l \""
|
||||
+ OnlyFilename(_owner->getFileName()) + "\"");
|
||||
_owner->getUser()->getOwner()->getLyXFunc()->Dispatch("buffer-reload");
|
||||
vcs->checkOut();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -248,31 +161,26 @@ void LyXVC::revert()
|
||||
_("to the document since the last check in."),
|
||||
_("Do you still want to do it?"))) {
|
||||
|
||||
doVCCommand("co -f -u" + getVersion() + " \""
|
||||
+ OnlyFilename(_owner->getFileName()) + "\"");
|
||||
// We ignore changes and just reload!
|
||||
_owner->markLyxClean();
|
||||
_owner->getUser()->getOwner()->
|
||||
getLyXFunc()->Dispatch("buffer-reload");
|
||||
vcs->revert();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void LyXVC::undoLast()
|
||||
{
|
||||
lyxerr[Debug::LYXVC] << "LyXVC: undoLast" << endl;
|
||||
doVCCommand("rcs -o" + getVersion() + " \""
|
||||
+ OnlyFilename(_owner->getFileName()) + "\"");
|
||||
vcs->undoLast();
|
||||
}
|
||||
|
||||
|
||||
void LyXVC::toggleReadOnly()
|
||||
{
|
||||
switch (vcstat) {
|
||||
case UNLOCKED:
|
||||
switch (vcs->stat()) {
|
||||
case VCS::UNLOCKED:
|
||||
lyxerr[Debug::LYXVC] << "LyXVC: toggle to locked" << endl;
|
||||
checkOut();
|
||||
break;
|
||||
case LOCKED:
|
||||
case VCS::LOCKED:
|
||||
lyxerr[Debug::LYXVC] << "LyXVC: toggle to unlocked" << endl;
|
||||
checkIn();
|
||||
break;
|
||||
}
|
||||
@ -281,23 +189,23 @@ void LyXVC::toggleReadOnly()
|
||||
|
||||
bool LyXVC::inUse()
|
||||
{
|
||||
if (!master.empty())
|
||||
return true;
|
||||
if (vcs) return true;
|
||||
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.
|
||||
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()))
|
||||
fl_add_browser_line(browser->browser_latexlog,
|
||||
_("No RCS History!"));
|
||||
_("No VC History!"));
|
||||
|
||||
if (browser->LaTeXLog->visible) {
|
||||
fl_raise_form(browser->LaTeXLog);
|
||||
} else {
|
||||
fl_show_form(browser->LaTeXLog,
|
||||
FL_PLACE_MOUSE | FL_FREE_SIZE, FL_FULLBORDER,
|
||||
_("RCS History"));
|
||||
_("VC History"));
|
||||
if (ow < 0) {
|
||||
ow = browser->LaTeXLog->w;
|
||||
oh = browser->LaTeXLog->h;
|
||||
@ -374,18 +282,7 @@ void LyXVC::viewLog(string const & fil)
|
||||
void LyXVC::showLog()
|
||||
{
|
||||
string tmpf = tmpnam(0);
|
||||
doVCCommand("rlog \""
|
||||
+ OnlyFilename(_owner->getFileName()) + "\" > " + tmpf);
|
||||
vcs->getLog(tmpf);
|
||||
viewLog(tmpf);
|
||||
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;
|
||||
}
|
||||
|
56
src/lyxvc.h
56
src/lyxvc.h
@ -1,7 +1,7 @@
|
||||
// -*- C++ -*-
|
||||
|
||||
#ifndef _LYX_VC_H_
|
||||
#define _LYX_VC_H_
|
||||
#ifndef LYX_VC_H
|
||||
#define LYX_VC_H
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
@ -10,10 +10,11 @@
|
||||
#include "LString.h"
|
||||
#include "latexoptions.h"
|
||||
|
||||
class VCS;
|
||||
class Buffer;
|
||||
|
||||
/** Version Control for LyX. This is the class giving the verison control
|
||||
features to LyX. It is
|
||||
/** Version Control for LyX.
|
||||
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
|
||||
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,
|
||||
@ -51,9 +52,7 @@ public:
|
||||
static bool file_not_found_hook(string const & fn);
|
||||
|
||||
///
|
||||
void scanMaster();
|
||||
///
|
||||
void setBuffer(Buffer*);
|
||||
void buffer(Buffer *);
|
||||
|
||||
/// Register the document as an VC file.
|
||||
void registrer();
|
||||
@ -83,10 +82,10 @@ public:
|
||||
bool inUse();
|
||||
|
||||
/// Returns the version number.
|
||||
string const getVersion() const;
|
||||
string const & version() const;
|
||||
|
||||
/// 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);
|
||||
@ -95,45 +94,10 @@ public:
|
||||
protected:
|
||||
private:
|
||||
///
|
||||
int doVCCommand(string const&);
|
||||
|
||||
/** The master VC file. For RCS this is *,v or RCS/ *,v. master should
|
||||
have full path.
|
||||
*/
|
||||
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;
|
||||
Buffer * owner_;
|
||||
|
||||
///
|
||||
enum VCStatus {
|
||||
///
|
||||
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;
|
||||
VCS * vcs;
|
||||
|
||||
///
|
||||
FD_LaTeXLog * browser; // FD_LaTeXLog is just a browser with a
|
||||
|
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_redraw_object(ob);
|
||||
|
||||
Buffer * tmpbuffer = men->_view->currentBuffer();
|
||||
Buffer * tmpbuffer = men->_view->buffer();
|
||||
LyXFunc * tmpfunc = men->_view->getLyXFunc();
|
||||
|
||||
bool LinuxDoc = tmpbuffer->isLinuxDoc();
|
||||
@ -673,7 +673,7 @@ void Menus::ShowFileMenu(FL_OBJECT * ob, long)
|
||||
case 18: // The first item with lastfiles.
|
||||
default:
|
||||
men->currentView()
|
||||
->setBuffer(bufferlist
|
||||
->buffer(bufferlist
|
||||
.loadLyXFile((*lastfiles)[choice - 18]));
|
||||
break;
|
||||
}
|
||||
@ -789,7 +789,7 @@ void Menus::ShowFileMenu2(FL_OBJECT * ob, long)
|
||||
case 6: // The first item with lastfiles.
|
||||
default:
|
||||
men->currentView()
|
||||
->setBuffer(bufferlist
|
||||
->buffer(bufferlist
|
||||
.loadLyXFile((*lastfiles)[choice - 6]));
|
||||
break;
|
||||
}
|
||||
@ -810,7 +810,7 @@ void Menus::ShowEditMenu(FL_OBJECT * ob, long)
|
||||
fl_set_button(ob, 0);
|
||||
fl_redraw_object(ob);
|
||||
|
||||
Buffer * tmpbuffer = men->_view->currentBuffer();
|
||||
Buffer * tmpbuffer = men->_view->buffer();
|
||||
LyXFunc * tmpfunc = men->_view->getLyXFunc();
|
||||
|
||||
// Floats & Insets submenu
|
||||
@ -1135,7 +1135,7 @@ void Menus::ShowLayoutMenu(FL_OBJECT * ob, long)
|
||||
fl_set_button(ob, 0);
|
||||
fl_redraw_object(ob);
|
||||
|
||||
Buffer * tmpbuffer = men->_view->currentBuffer();
|
||||
Buffer * tmpbuffer = men->_view->buffer();
|
||||
LyXFunc * tmpfunc = men->_view->getLyXFunc();
|
||||
|
||||
int LayoutMenu = fl_newpup(FL_ObjWin(ob));
|
||||
@ -1225,7 +1225,7 @@ void Menus::ShowInsertMenu(FL_OBJECT * ob, long)
|
||||
fl_set_button(ob, 0);
|
||||
fl_redraw_object(ob);
|
||||
|
||||
Buffer * tmpbuffer = men->_view->currentBuffer();
|
||||
Buffer * tmpbuffer = men->_view->buffer();
|
||||
LyXFunc * tmpfunc = men->_view->getLyXFunc();
|
||||
|
||||
int SubInsertAscii = fl_defpup(FL_ObjWin(ob),
|
||||
@ -1428,7 +1428,7 @@ void Menus::ShowMathMenu(FL_OBJECT * ob, long)
|
||||
fl_set_button(ob, 0);
|
||||
fl_redraw_object(ob);
|
||||
|
||||
Buffer * tmpbuffer = men->_view->currentBuffer();
|
||||
Buffer * tmpbuffer = men->_view->buffer();
|
||||
LyXFunc * tmpfunc = men->_view->getLyXFunc();
|
||||
|
||||
int MathMenu = fl_defpup(FL_ObjWin(ob),
|
||||
@ -1662,7 +1662,7 @@ void Menus::MenuDocu(string const & docname)
|
||||
string fname = i18nLibFileSearch("doc", docname, "lyx");
|
||||
_view->getMiniBuffer()->Set(_("Opening help file"),
|
||||
MakeDisplayPath(fname),"...");
|
||||
currentView()->setBuffer(bufferlist.loadLyXFile(fname,false));
|
||||
currentView()->buffer(bufferlist.loadLyXFile(fname,false));
|
||||
|
||||
if (docname == "Reference")
|
||||
_view->getLyXFunc()->Dispatch(LFUN_TOCVIEW);
|
||||
@ -1671,5 +1671,5 @@ void Menus::MenuDocu(string const & docname)
|
||||
|
||||
void Menus::handleBufferMenu(int choice)
|
||||
{
|
||||
currentView()->setBuffer(bufferlist.getBuffer(choice));
|
||||
currentView()->buffer(bufferlist.getBuffer(choice));
|
||||
}
|
||||
|
@ -30,9 +30,9 @@ extern string keyseqOptions(int l=190);
|
||||
extern string keyseqStr(int l=190);
|
||||
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();
|
||||
}
|
||||
|
||||
@ -43,7 +43,7 @@ extern "C" void C_MiniBuffer_TimerCB(FL_OBJECT *ob, long data)
|
||||
|
||||
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;
|
||||
fl_set_focus_object(obj->owner->getForm(),
|
||||
obj->owner->currentView()->getWorkArea());
|
||||
@ -86,7 +86,7 @@ extern "C" void C_MiniBuffer_ExecutingCB(FL_OBJECT *ob, long data)
|
||||
int MiniBuffer::peek_event(FL_OBJECT * ob, int event, FL_Coord, FL_Coord,
|
||||
int key, void */*xev*/)
|
||||
{
|
||||
MiniBuffer *mini = (MiniBuffer*)ob->u_vdata;
|
||||
MiniBuffer * mini = static_cast<MiniBuffer*>(ob->u_vdata);
|
||||
|
||||
if (event == FL_KEYBOARD){
|
||||
switch (key) {
|
||||
@ -105,7 +105,7 @@ int MiniBuffer::peek_event(FL_OBJECT *ob, int event, FL_Coord, FL_Coord,
|
||||
case XK_Tab:
|
||||
{
|
||||
// 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])
|
||||
fl_set_input(ob, s);
|
||||
return 1;
|
||||
@ -161,12 +161,13 @@ FL_OBJECT *MiniBuffer::add(int type, FL_Coord x, FL_Coord y,
|
||||
|
||||
// To intercept Up, Down, Table for history
|
||||
fl_set_object_prehandler(obj, C_MiniBuffer_peek_event);
|
||||
obj->u_vdata = (void*)this;
|
||||
obj->u_vdata = this;
|
||||
obj->wantkey = FL_KEY_TAB;
|
||||
|
||||
// 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());
|
||||
|
||||
return obj;
|
||||
@ -210,23 +211,23 @@ void MiniBuffer::Init()
|
||||
// Else, show the buffer state.
|
||||
else if (owner->currentView()->available()) {
|
||||
string nicename =
|
||||
MakeDisplayPath(owner->currentBuffer()->
|
||||
MakeDisplayPath(owner->buffer()->
|
||||
getFileName());
|
||||
// Should we do this instead? (kindo like emacs)
|
||||
// leaves more room for other information
|
||||
text = "LyX: ";
|
||||
text += nicename;
|
||||
if (owner->currentBuffer()->lyxvc.inUse()) {
|
||||
text += " [RCS:";
|
||||
text += owner->currentBuffer()->lyxvc.getVersion();
|
||||
if (owner->buffer()->lyxvc.inUse()) {
|
||||
text += " [";
|
||||
text += owner->buffer()->lyxvc.version();
|
||||
text += ' ';
|
||||
text += owner->currentBuffer()->lyxvc.getLocker();
|
||||
if (owner->currentBuffer()->isReadonly())
|
||||
text += owner->buffer()->lyxvc.locker();
|
||||
if (owner->buffer()->isReadonly())
|
||||
text += " (RO)";
|
||||
text += ']';
|
||||
} else if (owner->currentBuffer()->isReadonly())
|
||||
} else if (owner->buffer()->isReadonly())
|
||||
text += " [RO]";
|
||||
if (!owner->currentBuffer()->isLyxClean())
|
||||
if (!owner->buffer()->isLyxClean())
|
||||
text += _(" (Changed)");
|
||||
} else {
|
||||
if (text != _("Welcome to LyX!")) // this is a hack
|
||||
|
@ -454,7 +454,7 @@ void LyXParagraph::validate(LaTeXFeatures & features)
|
||||
if (layout.needprotect
|
||||
&& next && next->footnoteflag != LyXParagraph::NO_FOOTNOTE)
|
||||
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))
|
||||
features.NeedLyXMinipageIndent = true;
|
||||
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 'µ':
|
||||
if (current_view->currentBuffer()->params.inputenc == "latin1") {
|
||||
if (current_view->buffer()->params.inputenc == "latin1") {
|
||||
file += "\\ensuremath{";
|
||||
file += c;
|
||||
file += '}';
|
||||
@ -3806,7 +3806,7 @@ void LyXParagraph::SimpleTeXSpecialChars(string & file, TexRow & texrow,
|
||||
break;
|
||||
|
||||
case '£':
|
||||
if (current_view->currentBuffer()->params.inputenc == "default") {
|
||||
if (current_view->buffer()->params.inputenc == "default") {
|
||||
file += "\\pounds{}";
|
||||
column += 8;
|
||||
} else {
|
||||
@ -4048,7 +4048,7 @@ LyXParagraph * LyXParagraph::TeXEnvironment(string & file, TexRow & texrow,
|
||||
// flags when footnotetext should be appended to file.
|
||||
static bool minipage_open = false;
|
||||
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;
|
||||
if (IsDummy())
|
||||
@ -4347,7 +4347,7 @@ LyXParagraph * LyXParagraph::TeXFootnote(string & file, TexRow & texrow,
|
||||
texrow.newline();
|
||||
}
|
||||
|
||||
BufferParams * params = ¤t_view->currentBuffer()->params;
|
||||
BufferParams * params = ¤t_view->buffer()->params;
|
||||
bool footer_in_body = true;
|
||||
switch (footnotekind) {
|
||||
case LyXParagraph::FOOTNOTE:
|
||||
|
@ -325,13 +325,13 @@ void create_ispell_pipe(string const & lang)
|
||||
argv[argc++] = tmp;
|
||||
}
|
||||
if (lyxrc->isp_use_input_encoding &&
|
||||
current_view->currentBuffer()->params.inputenc != "default") {
|
||||
current_view->buffer()->params.inputenc != "default") {
|
||||
tmp = new char[3];
|
||||
string("-T").copy(tmp, 2); tmp[2] = '\0';
|
||||
argv[argc++] = tmp; // Input encoding
|
||||
tmp = new char[current_view->currentBuffer()->params.inputenc.length() + 1];
|
||||
current_view->currentBuffer()->params.inputenc.copy(tmp, current_view->currentBuffer()->params.inputenc.length());
|
||||
tmp[current_view->currentBuffer()->params.inputenc.length()] = '\0';
|
||||
tmp = new char[current_view->buffer()->params.inputenc.length() + 1];
|
||||
current_view->buffer()->params.inputenc.copy(tmp, current_view->buffer()->params.inputenc.length());
|
||||
tmp[current_view->buffer()->params.inputenc.length()] = '\0';
|
||||
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->browser, FL_BLACK);
|
||||
// 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_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->start, FL_INACTIVE);
|
||||
|
||||
ret = RunSpellChecker(current_view->currentBuffer()->GetLanguage());
|
||||
ret = RunSpellChecker(current_view->buffer()->GetLanguage());
|
||||
|
||||
// deactivate insert, accept, replace, and stop
|
||||
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
|
||||
{
|
||||
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)
|
||||
{
|
||||
if (fl_get_button(fd_latex_options->accents))
|
||||
current_view->currentBuffer()->params.allowAccents = true;
|
||||
current_view->buffer()->params.allowAccents = true;
|
||||
else
|
||||
current_view->currentBuffer()->params.allowAccents = false;
|
||||
current_view->buffer()->params.allowAccents = false;
|
||||
}
|
||||
|
||||
void LaTeXOptionsCancel(FL_OBJECT *, long)
|
||||
|
@ -1807,8 +1807,8 @@ void LyXText::TableFeatures(int feature)
|
||||
return;
|
||||
}
|
||||
case LyXTable::DELETE_ROW:
|
||||
if (current_view->currentBuffer()->the_locking_inset)
|
||||
UnlockInset(current_view->currentBuffer()->the_locking_inset);
|
||||
if (current_view->buffer()->the_locking_inset)
|
||||
UnlockInset(current_view->buffer()->the_locking_inset);
|
||||
RemoveTableRow(&cursor);
|
||||
RedoParagraph();
|
||||
return;
|
||||
@ -1821,8 +1821,8 @@ void LyXText::TableFeatures(int feature)
|
||||
#endif
|
||||
int cell_org = actCell;
|
||||
int cell = 0;
|
||||
if (current_view->currentBuffer()->the_locking_inset)
|
||||
UnlockInset(current_view->currentBuffer()->the_locking_inset);
|
||||
if (current_view->buffer()->the_locking_inset)
|
||||
UnlockInset(current_view->buffer()->the_locking_inset);
|
||||
do {
|
||||
if (!pos || (cursor.par->IsNewline(pos-1))){
|
||||
if (cursor.par->table->DeleteCellIfColumnIsDeleted(cell, cell_org)){
|
||||
|
@ -97,7 +97,7 @@ string TransDeadkeyState::normalkey(char c,char *trans)
|
||||
}
|
||||
if (l==0) {
|
||||
// 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) {
|
||||
res=DoAccent(c,deadkey_info_.accent);
|
||||
} 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) {
|
||||
case NONE: return string();
|
||||
case DEFSKIP:
|
||||
return current_view->currentBuffer()->params.getDefSkip().asLatexCommand();
|
||||
return current_view->buffer()->params.getDefSkip().asLatexCommand();
|
||||
case SMALLSKIP: return kp ? "\\vspace*{\\smallskipamount}"
|
||||
: "\\smallskip{}";
|
||||
case MEDSKIP: return kp ? "\\vspace*{\\medskipamount}"
|
||||
@ -492,7 +492,7 @@ string VSpace::asLatexCommand() const
|
||||
int VSpace::inPixels() const
|
||||
{
|
||||
// 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
|
||||
float const zoom = lyxrc->zoom / 100.0; // [percent]
|
||||
@ -507,7 +507,7 @@ int VSpace::inPixels() const
|
||||
case NONE: return 0;
|
||||
|
||||
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
|
||||
// LateX. But there should be some way to change
|
||||
|
Loading…
Reference in New Issue
Block a user