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;
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;
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();
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();
}
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();
}
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);
* 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;
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;
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;
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){
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;
ProhibitInput();
- _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;
+ 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;
}
- _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
* visible */
updateScrollbar();
redraw();
- _owner->getMiniBuffer()->Init();
+ owner_->getMiniBuffer()->Init();
AllowInput();
// Now if the title form still exist kill it
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;
}
obj->u_vdata = this;
fl_set_pixmapbutton_data(obj, up_xpm);
-#if FL_REVISION >85
+#if FL_REVISION > 85
// Remove the blue feedback rectangle
fl_set_pixmapbutton_focus_outline(obj,0);
#endif
{
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;
// Callback for scrollbar slider
void BufferView::ScrollCB(FL_OBJECT * ob, long)
{
- BufferView *view = static_cast<BufferView*>(ob->u_vdata);
+ 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)
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) {
{
BufferView * view = static_cast<BufferView*>(ob->u_vdata);
- if (view->_buffer == 0) return;
+ if (view->buffer_ == 0) return;
- XEvent const *ev2;
+ XEvent const * ev2;
static long time = 0;
ev2 = fl_last_event();
if (ev2->type == ButtonPress || ev2->type == ButtonRelease)
int BufferView::ScrollUp(long time)
{
- if (_buffer == 0) return 0;
+ if (buffer_ == 0) return 0;
if (!screen)
return 0;
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;
int BufferView::ScrollDown(long time)
{
- if (_buffer == 0) return 0;
+ if (buffer_ == 0) return 0;
if (!screen)
return 0;
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;
void BufferView::ScrollUpOnePage(long /*time*/)
{
- if (_buffer == 0) return;
+ if (buffer_ == 0) return;
if (!screen)
return;
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);
void BufferView::ScrollDownOnePage(long /*time*/)
{
- if (_buffer == 0) return;
+ if (buffer_ == 0) return;
if (!screen)
return;
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);
// 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);
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
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;
}
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),
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();
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;
{
- 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);
}
}
// 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();
}
// 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;
}
// 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();
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;
}
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;
// 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;
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;
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();
}
}
// ...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;
}
}
}
// 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);
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;
}
// 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;
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)
// 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)
&& 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;
// 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();
// 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 {
// always make sure that the scrollbar is sane.
updateScrollbar();
- _owner->updateLayoutChoice();
+ owner_->updateLayoutChoice();
return 1;
}
/* 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;
}
}
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();
}
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 {
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;
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;
}
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);
}
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);
}
///
BufferView(LyXView *owner, int ,int ,int, int);
///
- Buffer *currentBuffer() { return _buffer; }
+ Buffer * buffer() const { return buffer_; }
///
- FL_OBJECT *getWorkArea() { return work_area; }
+ FL_OBJECT * getWorkArea() { return work_area; }
///
- void setBuffer(Buffer *b);
+ void buffer(Buffer * b);
///
void resize();
///
///
bool available() const;
///
- LyXView *getOwner() { return _owner; }
+ LyXView * owner() const { return owner_; }
///
- LyXScreen *getScreen()
+ LyXScreen * getScreen()
{
fl_set_timer(timer_cursor, 0.4);
return screen;
///
void create_view(int, int, int, int);
///
- Inset * checkInsetHit(int &x, int &y);
+ Inset * checkInsetHit(int & x, int & y);
///
int ScrollUp(long time);
///
public:
/// A callback for the up arrow in the scrollbar.
- static void UpCB(FL_OBJECT *ob, long);
+ static void UpCB(FL_OBJECT * ob, long);
/// A callback for the slider in the scrollbar.
- static void ScrollCB(FL_OBJECT *ob, long);
+ static void ScrollCB(FL_OBJECT * ob, long);
/// A callback for the down arrow in the scrollbar.
- static void DownCB(FL_OBJECT *ob, long);
+ static void DownCB(FL_OBJECT * ob, long);
///
- static void CursorToggleCB(FL_OBJECT *ob, long);
+ static void CursorToggleCB(FL_OBJECT * ob, long);
/** Work area free object handler
*/
static int work_area_handler(FL_OBJECT *, int event,
FL_Coord, FL_Coord, int key, void *xev);
private:
///
- int WorkAreaMotionNotify(FL_OBJECT *ob,
+ int WorkAreaMotionNotify(FL_OBJECT * ob,
Window win,
int w, int h,
- XEvent *ev, void *d);
+ XEvent * ev, void * d);
///
int WorkAreaSelectionNotify(FL_OBJECT *, Window win,
int /*w*/, int /*h*/,
- XEvent *event, void */*d*/);
+ XEvent * event, void * /*d*/);
///
- int WorkAreaButtonPress(FL_OBJECT *ob,
+ int WorkAreaButtonPress(FL_OBJECT * ob,
Window win,
int w, int h,
- XEvent *ev, void *d);
+ XEvent * ev, void * d);
///
- int WorkAreaButtonRelease(FL_OBJECT *ob,
+ int WorkAreaButtonRelease(FL_OBJECT * ob,
Window win,
int w, int h,
- XEvent *ev, void *d);
+ XEvent * ev, void * d);
///
- LyXView *_owner;
+ LyXView * owner_;
///
- Buffer *_buffer;
+ Buffer * buffer_;
///
- LyXScreen *screen;
+ LyXScreen * screen;
///
long current_scrollbar_value;
///
///
bool work_area_focus;
///
- FL_OBJECT *work_area;
+ FL_OBJECT * work_area;
///
- FL_OBJECT *figinset_canvas;
+ FL_OBJECT * figinset_canvas;
///
- FL_OBJECT *scrollbar;
+ FL_OBJECT * scrollbar;
///
- FL_OBJECT *button_down;
+ FL_OBJECT * button_down;
///
- FL_OBJECT *button_up;
+ FL_OBJECT * button_up;
///
- FL_OBJECT *timer_cursor;
+ FL_OBJECT * timer_cursor;
///
BackStack backstack;
///
}
/// Do load font
-XFontStruct* FontLoader::doLoad(LyXFont::FONT_FAMILY family,
+XFontStruct * FontLoader::doLoad(LyXFont::FONT_FAMILY family,
LyXFont::FONT_SERIES series,
LyXFont::FONT_SHAPE shape,
LyXFont::FONT_SIZE size)
{
getFontinfo(family,series,shape);
- int fsize = (int) ( (lyxrc->font_sizes[size] * lyxrc->dpi *
- (lyxrc->zoom/100.0) ) / 72.27 + 0.5 );
+ 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);
minibuffer->Store();
minibuffer->Set(_("Loading font into X-Server..."));
- XFontStruct* fs = XLoadQueryFont(fl_display, font.c_str());
+ XFontStruct * fs = XLoadQueryFont(fl_display, font.c_str());
if (fs == 0) {
- if (font=="fixed") {
+ if (font == "fixed") {
lyxerr << "We're doomed. Can't get 'fixed' font." << endl;
} else {
lyxerr << "Could not get font. Using 'fixed'." << endl;
* Copyright 1995 Matthias Ettrich
* Copyright 1995-1999 the LyX Team.
*
- * ======================================================*/
+ * ====================================================== */
#include <config.h>
extern LyXRC * lyxrc;
-LaTeXFeatures::LaTeXFeatures(int n)
+LaTeXFeatures::LaTeXFeatures(int n)
+ : layout(n, false)
{
// packages
color = false;
LyXParagraphIndent = false;
NeedLyXFootnoteCode = false;
NeedLyXMinipageIndent = false;
-
- // layouts
- layout = new bool[n];
- for (int i = n; i--;)
- layout[i] = false;
}
-string LaTeXFeatures::getPackages(BufferParams const ¶ms)
+string LaTeXFeatures::getPackages(BufferParams const & params)
{
string packages;
LyXTextClass const & tclass = textclasslist.TextClass(params.textclass);
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;
#pragma interface
#endif
+#include <vector>
+
#include "LString.h"
class BufferParams;
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
//@Man: Layouts
//@{
- bool *layout;
+ vector<bool> layout;
//@}
//@Man: Special features
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())
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();
#include "layout.h"
#include "lyxtext.h"
-extern FD_form_document *fd_form_document;
-FD_form_main *fd_form_main; /* a pointer to the one in LyXView
+extern FD_form_document * fd_form_document;
+FD_form_main * fd_form_main; /* a pointer to the one in LyXView
should be removed as soon as possible */
-MiniBuffer *minibuffer;/* a pointer to the one in LyXView
+MiniBuffer * minibuffer;/* a pointer to the one in LyXView
should be removed as soon as possible */
extern void AutoSave();
int current_layout = 0;
// This is very temporary
-BufferView *current_view;
+BufferView * current_view;
extern "C" int C_LyXView_atCloseMainFormCB(FL_FORM *, void *);
{
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;
}
/// Redraw the main form.
void LyXView::redraw() {
- lyxerr.debug() << "LyXView::redraw()" << endl;
+ lyxerr[Debug::INFO] << "LyXView::redraw()" << endl;
fl_redraw_form(_form);
minibuffer->Activate();
}
// Callback for update timer
-void LyXView::UpdateTimerCB(FL_OBJECT *ob, long)
+void LyXView::UpdateTimerCB(FL_OBJECT * ob, long)
{
- LyXView *view = (LyXView*) ob->u_vdata;
+ LyXView * view = static_cast<LyXView*>(ob->u_vdata);
if (!view->currentView()->available())
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;
}
// Wrapper for the above
-extern "C" void C_LyXView_UpdateTimerCB(FL_OBJECT *ob, long data) {
- LyXView::UpdateTimerCB(ob,data);
+extern "C" void C_LyXView_UpdateTimerCB(FL_OBJECT * ob, long data) {
+ LyXView::UpdateTimerCB(ob, data);
}
// Callback for autosave timer
void LyXView::AutosaveTimerCB(FL_OBJECT *, long)
{
- lyxerr.debug() << "Running AutoSave()" << endl;
+ lyxerr[Debug::INFO] << "Running AutoSave()" << endl;
AutoSave();
}
// Wrapper for the above
-extern "C" void C_LyXView_AutosaveTimerCB(FL_OBJECT *ob, long data) {
+extern "C" void C_LyXView_AutosaveTimerCB(FL_OBJECT * ob, long data) {
LyXView::AutosaveTimerCB(ob, data);
}
return FL_IGNORE;
}
+
// Wrapper for the above
-extern "C" int C_LyXView_atCloseMainFormCB(FL_FORM *form, void *p) {
- return LyXView::atCloseMainFormCB(form,p);
+extern "C" int C_LyXView_atCloseMainFormCB(FL_FORM * form, void * p) {
+ return LyXView::atCloseMainFormCB(form, p);
}
}
-void LyXView::show(int place, int border, char const* title)
+void LyXView::show(int place, int border, char const * title)
{
fl_show_form(_form, place, border, title);
minibuffer->Init();
}
-FD_form_main *LyXView::create_form_form_main(int width, int height)
+FD_form_main * LyXView::create_form_form_main(int width, int height)
/* to make this work as it should, .lyxrc should have been
* read first; OR maybe this one should be made dynamic.
* Hmmmm. Lgb.
* are presented (and rightly so) in GUI popups. Asger.
*/
{
- FL_OBJECT *obj;
+ FL_OBJECT * obj;
FD_form_main *fdui = (FD_form_main *)
fl_calloc(1, sizeof(FD_form_main));
// the main form
_form = fdui->form_main = fl_bgn_form(FL_NO_BOX, width, height);
- fdui->form_main->u_vdata = (void*) this;
- obj = fl_add_box(FL_FLAT_BOX,0,0,width,height,"");
- fl_set_object_color(obj,FL_MCOL,FL_MCOL);
+ 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);
// Parameters for the appearance of the main form
const int air = 2;
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
return fdui;
}
-extern "C" int C_LyXView_KeyPressMask_raw_callback(FL_FORM *fl, void *xev);
+extern "C" int C_LyXView_KeyPressMask_raw_callback(FL_FORM * fl, void * xev);
void LyXView::init()
{
// 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;
// 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);
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);
// 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;
}
// wrapper for the above
-extern "C" int C_LyXView_KeyPressMask_raw_callback(FL_FORM *fl, void *xev)
+extern "C" int C_LyXView_KeyPressMask_raw_callback(FL_FORM * fl, void * xev)
{
return LyXView::KeyPressMask_raw_callback(fl, xev);
}
// Updates the title of the window with the filename of the current document
void LyXView::updateWindowTitle() {
- static string last_title="LyX";
+ static string last_title = "LyX";
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)");
}
}
///
struct FD_form_main {
///
- FL_FORM *form_main;
+ FL_FORM * form_main;
///
- FL_OBJECT *timer_autosave;
+ FL_OBJECT * timer_autosave;
///
- FL_OBJECT *timer_update;
+ FL_OBJECT * timer_update;
///
- void *vdata;
+ void * vdata;
///
long ldata;
};
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; }
trans_mgr.C \
trans_mgr.h \
undo.h \
+ vc-backend.C \
+ vc-backend.h \
version.h \
vms_defines.h \
vspace.C \
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);
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."
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;
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;
}
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();
}
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."));
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
}
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;
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,"");
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)
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);
LyXTable
*table = 0;
int
- cell,
s,
num = 0;
string
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,
}
// 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;
}
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,
}
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
}
Buffer::Buffer(string const & file, LyXRC *lyxrc, bool ronly)
{
+ lyxerr[Debug::INFO] << "Buffer::Buffer()" << endl;
filename = file;
filepath = OnlyPath(file);
paragraph = 0;
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();
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);
// Should work on a list
void Buffer::updateTitles()
{
- if (users) users->getOwner()->updateWindowTitle();
+ if (users) users->owner()->updateWindowTitle();
}
// Should work on a list
void Buffer::resetAutosaveTimers()
{
- if (users) users->getOwner()->resetAutosaveTimer();
+ if (users) users->owner()->resetAutosaveTimer();
}
}
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();
// 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);
// 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();
}
}
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();
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);
// 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();
}
}
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();
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);
// 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();
}
}
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();
{
if (!users) return;
- users->getOwner()->updateLayoutChoice();
+ users->owner()->updateLayoutChoice();
if (!text->selection && f > -3)
text->sel_cursor = text->cursor;
if (f==1 || f==-1) {
if (isLyxClean()) {
markDirty();
- users->getOwner()->getMiniBuffer()->setTimer(4);
+ users->owner()->getMiniBuffer()->setTimer(4);
} else {
markDirty();
}
}
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);
// 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) {
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();
}
{
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];
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));
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);
}
-void BulletDepthCB(FL_OBJECT *ob, long data)
+void BulletDepthCB(FL_OBJECT * ob, long data)
{
/* Should I do the following: */
/* 1. change to the panel that the current bullet belongs in */
/* */
/* 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:
/* 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 */
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;
// Shouldn't this question be directed to the buffer?
// Indeed it should. Asger.
{
- return current_view->currentBuffer()->params.textclass;
+ return current_view->buffer()->params.textclass;
}
void BeforeChange()
{
current_view->getScreen()->ToggleSelection();
- current_view->currentBuffer()->text->ClearSelection();
+ current_view->buffer()->text->ClearSelection();
FreeUpdateTimer();
}
current_view->getScreen()->SmallUpdate();
if (current_view->getScreen()->TopCursorVisible()
!= current_view->getScreen()->first){
- current_view->currentBuffer()->update(f);
+ current_view->buffer()->update(f);
return;
}
current_view->fitCursor();
current_view->updateScrollbar();
- if (!current_view->currentBuffer()->text->selection)
- current_view->currentBuffer()->text->sel_cursor =
- current_view->currentBuffer()->text->cursor;
+ if (!current_view->buffer()->text->selection)
+ current_view->buffer()->text->sel_cursor =
+ current_view->buffer()->text->cursor;
if (f==1 || f==-1) {
- if (current_view->currentBuffer()->isLyxClean()) {
- current_view->currentBuffer()->markDirty();
+ if (current_view->buffer()->isLyxClean()) {
+ current_view->buffer()->markDirty();
minibuffer->setTimer(4);
}
else {
- current_view->currentBuffer()->markDirty();
+ current_view->buffer()->markDirty();
}
}
}
if (!current_view->getScreen() || !current_view->available())
return;
- if (current_view->currentBuffer()->isBakClean()
- || current_view->currentBuffer()->isReadonly()) {
+ if (current_view->buffer()->isBakClean()
+ || current_view->buffer()->isReadonly()) {
// We don't save now, but we'll try again later
- current_view->getOwner()->resetAutosaveTimer();
+ current_view->owner()->resetAutosaveTimer();
return;
}
minibuffer->Set(_("Autosaving current document..."));
// create autosave filename
- string fname = OnlyPath(current_view->currentBuffer()->getFileName());
+ string fname = OnlyPath(current_view->buffer()->getFileName());
fname += "#";
- fname += OnlyFilename(current_view->currentBuffer()->getFileName());
+ fname += OnlyFilename(current_view->buffer()->getFileName());
fname += "#";
// tmp_ret will be located (usually) in /tmp
// anyway.
bool failed = false;
if (!tmp_ret.empty()) {
- current_view->currentBuffer()->writeFile(tmp_ret, 1);
+ current_view->buffer()->writeFile(tmp_ret, 1);
// assume successful write of tmp_ret
if (rename(tmp_ret.c_str(), fname.c_str()) == -1) {
failed = true;
if (failed) {
// failed to write/rename tmp_ret so try writing direct
- if (!current_view->currentBuffer()->writeFile(fname,
- 1)) {
+ if (!current_view->buffer()->writeFile(fname, 1)) {
// It is dangerous to do this in the child,
// but safe in the parent, so...
if (pid == -1)
}
}
- current_view->currentBuffer()->markBakClean();
- current_view->getOwner()->resetAutosaveTimer();
+ current_view->buffer()->markBakClean();
+ current_view->owner()->resetAutosaveTimer();
}
if (fname.empty()) {
ProhibitInput();
fname = fileDlg.Select(_("File to Insert"),
- current_view->getOwner()->currentBuffer()->filepath,
+ current_view->owner()->buffer()->filepath,
"*");
AllowInput();
if (fname.empty()) return;
// clear the selection
BeforeChange();
if (!asParagraph)
- current_view->currentBuffer()->text->InsertStringA(tmppar->text);
+ current_view->buffer()->text->InsertStringA(tmppar->text);
else
- current_view->currentBuffer()->text->InsertStringB(tmppar->text);
+ current_view->buffer()->text->InsertStringB(tmppar->text);
delete tmppar;
- current_view->currentBuffer()->update(1);
+ current_view->buffer()->update(1);
}
if (!label.empty()) {
InsetLabel *new_inset = new InsetLabel;
new_inset->setContents(label);
- current_view->currentBuffer()->insertInset(new_inset);
+ current_view->buffer()->insertInset(new_inset);
}
AllowInput();
}
minibuffer->Set(_("Inserting Footnote..."));
current_view->getScreen()->HideCursor();
- current_view->currentBuffer()->update(-2);
- current_view->currentBuffer()->text->InsertFootnoteEnvironment(LyXParagraph::FOOTNOTE);
- current_view->currentBuffer()->update(1);
+ current_view->buffer()->update(-2);
+ current_view->buffer()->text->InsertFootnoteEnvironment(LyXParagraph::FOOTNOTE);
+ current_view->buffer()->update(1);
}
void LayoutsCB(int sel, void *)
{
string tmp = tostr(sel);
- current_view->getOwner()->getLyXFunc()->Dispatch(LFUN_LAYOUTNO,
+ current_view->owner()->getLyXFunc()->Dispatch(LFUN_LAYOUTNO,
tmp.c_str());
}
name = ChangeExtension (filename, ".sgml", true);
path = OnlyPath (filename);
if (lyxrc->use_tempdir || (IsDirWriteable(path) < 1)) {
- path = current_view->currentBuffer()->tmppath;
+ path = current_view->buffer()->tmppath;
}
Path p(path);
if (flag != -1) {
if (!current_view->available())
return 0;
- current_view->currentBuffer()->makeLinuxDocFile(name,0);
- LYX_PAPER_SIZE ps = (LYX_PAPER_SIZE) current_view->currentBuffer()->params.papersize;
+ current_view->buffer()->makeLinuxDocFile(name,0);
+ LYX_PAPER_SIZE ps = (LYX_PAPER_SIZE) current_view->buffer()->params.papersize;
switch (ps) {
case PAPER_A4PAPER: add_flags = "-p a4"; break;
case PAPER_USLETTER: add_flags = "-p letter"; break;
if (one.startscript(Systemcalls::System, s2)) {
errorcode = 1;
} else
- current_view->currentBuffer()->markDviClean();
+ current_view->buffer()->markDviClean();
break;
default: /* unknown output */
break;
AllowInput();
- current_view->currentBuffer()->redraw();
+ current_view->buffer()->redraw();
return errorcode;
}
name = ChangeExtension (filename, ".sgml", true);
path = OnlyPath (filename);
if (lyxrc->use_tempdir || (IsDirWriteable(path) < 1)) {
- path = current_view->currentBuffer()->tmppath;
+ path = current_view->buffer()->tmppath;
}
Path p(path);
if (!current_view->available())
return 0;
- current_view->currentBuffer()->makeDocBookFile(name,0);
+ current_view->buffer()->makeDocBookFile(name,0);
// Shall this code go or should it stay? (Lgb)
// string add_flags;
-// LYX_PAPER_SIZE ps = (LYX_PAPER_SIZE) current_view->currentBuffer()->params.papersize;
+// LYX_PAPER_SIZE ps = (LYX_PAPER_SIZE) current_view->buffer()->params.papersize;
// switch (ps) {
// case PAPER_A4PAPER: add_flags = "-p a4"; break;
// case PAPER_USLETTER: add_flags = "-p letter"; break;
if (one.startscript(Systemcalls::System, s2)) {
errorcode = 1;
} else
- current_view->currentBuffer()->markDviClean();
+ current_view->buffer()->markDviClean();
break;
default: /* unknown output */
break;
AllowInput();
- current_view->currentBuffer()->redraw();
+ current_view->buffer()->redraw();
return errorcode;
}
if (!current_view->available())
return;
- LyXCursor cursor = current_view->currentBuffer()->text->cursor;
+ LyXCursor cursor = current_view->buffer()->text->cursor;
if (!flag && cursor.par->footnoteflag != LyXParagraph::NO_FOOTNOTE
&& ((figmar
cursor.par = tmpcursor.par->ParFromPos(tmpcursor.pos);
cursor.pos = tmpcursor.par->PositionInParFromPos(tmpcursor.pos);
- LyXParagraph *par = current_view->currentBuffer()->paragraph;
+ LyXParagraph *par = current_view->buffer()->paragraph;
while (par) {
if (flag) {
if (par->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE
if (par->previous
&& par->previous->footnoteflag !=
LyXParagraph::CLOSED_FOOTNOTE){ /* should be */
- current_view->currentBuffer()->text->SetCursorIntern(par->previous,
+ current_view->buffer()->text->SetCursorIntern(par->previous,
0);
- current_view->currentBuffer()->text->OpenFootnote();
+ current_view->buffer()->text->OpenFootnote();
}
}
}
)
)
){
- current_view->currentBuffer()->text->SetCursorIntern(par, 0);
- current_view->currentBuffer()->text->CloseFootnote();
+ current_view->buffer()->text->SetCursorIntern(par, 0);
+ current_view->buffer()->text->CloseFootnote();
}
}
par = par->next;
}
- current_view->currentBuffer()->text->SetCursorIntern(cursor.par, cursor.pos);
+ current_view->buffer()->text->SetCursorIntern(cursor.par, cursor.pos);
current_view->redraw();
current_view->fitCursor();
current_view->updateScrollbar();
return false;
}
- Buffer * buf = current_view->currentBuffer();
+ Buffer * buf = current_view->buffer();
fl_set_input(fd_form_paragraph->input_labelwidth,
buf->text->cursor.par->GetLabelWidthString().c_str());
fl_set_button(fd_form_paragraph->check_noindent,
buf->text->cursor.par->FirstPhysicalPar()->noindent);
- if (current_view->currentBuffer()->isReadonly()) {
+ if (current_view->buffer()->isReadonly()) {
DisableParagraphLayout();
} else {
EnableParagraphLayout();
}
if (params == 0)
- params = ¤t_view->currentBuffer()->params;
+ params = ¤t_view->buffer()->params;
LyXTextClass const & tclass = textclasslist.TextClass(params->textclass);
fl_set_choice_text(fd_form_document->choice_class,
else
fl_set_input(fd_form_document->input_extra, "");
- if (current_view->currentBuffer()->isSGML()) {
+ if (current_view->buffer()->isSGML()) {
// bullets not used in SGML derived documents
fl_deactivate_object(fd_form_document->button_bullets);
fl_set_object_lcol(fd_form_document->button_bullets,
FL_BLACK);
}
- if (current_view->currentBuffer()->isReadonly()) {
+ if (current_view->buffer()->isReadonly()) {
DisableDocumentLayout();
} else {
EnableDocumentLayout();
bool update = true;
if (!current_view->getScreen()
|| !current_view->available()
- || current_view->currentBuffer()->isReadonly())
+ || current_view->buffer()->isReadonly())
update = false;
if (update) {
fl_set_choice(fd_form_quotes->choice_quotes_language,
- current_view->currentBuffer()->params.quotes_language + 1);
+ current_view->buffer()->params.quotes_language + 1);
fl_set_button(fd_form_quotes->radio_single, 0);
fl_set_button(fd_form_quotes->radio_double, 0);
- if (current_view->currentBuffer()->params.quotes_times == InsetQuotes::SingleQ)
+ if (current_view->buffer()->params.quotes_times == InsetQuotes::SingleQ)
fl_set_button(fd_form_quotes->radio_single, 1);
else
fl_set_button(fd_form_quotes->radio_double, 1);
if (update) {
fl_set_input(fd_form_preamble->input_preamble,
- current_view->currentBuffer()->params.preamble.c_str());
+ current_view->buffer()->params.preamble.c_str());
- if (current_view->currentBuffer()->isReadonly()) {
+ if (current_view->buffer()->isReadonly()) {
fl_deactivate_object(fd_form_preamble->input_preamble);
fl_deactivate_object(fd_form_preamble->button_ok);
fl_deactivate_object(fd_form_preamble->button_apply);
if (AskQuestion(_("Do you want to save the current settings"),
_("for Character, Document, Paper and Quotes"),
_("as default for new documents?")))
- current_view->currentBuffer()->saveParamsAsDefaults();
+ current_view->buffer()->saveParamsAsDefaults();
}
void NoteCB()
{
InsetInfo *new_inset = new InsetInfo();
- current_view->currentBuffer()->insertInset(new_inset);
+ current_view->buffer()->insertInset(new_inset);
new_inset->Edit(0,0);
- //current_view->currentBuffer()->update(-1);
+ //current_view->buffer()->update(-1);
}
minibuffer->Set(_("Open/Close..."));
current_view->getScreen()->HideCursor();
BeforeChange();
- current_view->currentBuffer()->update(-2);
- current_view->currentBuffer()->text->OpenStuff();
- current_view->currentBuffer()->update(0);
+ current_view->buffer()->update(-2);
+ current_view->buffer()->text->OpenStuff();
+ current_view->buffer()->update(0);
}
}
minibuffer->Set(_("Open/Close..."));
current_view->getScreen()->HideCursor();
BeforeChange();
- current_view->currentBuffer()->update(-2);
- current_view->currentBuffer()->text->ToggleFootnote();
- current_view->currentBuffer()->update(0);
+ current_view->buffer()->update(-2);
+ current_view->buffer()->text->ToggleFootnote();
+ current_view->buffer()->update(0);
}
}
void MenuUndo()
{
-/* if (current_view->currentBuffer()->the_locking_inset) {
+/* if (current_view->buffer()->the_locking_inset) {
minibuffer->Set(_("Undo not yet supported in math mode"));
return;
}*/
minibuffer->Set(_("Undo"));
current_view->getScreen()->HideCursor();
BeforeChange();
- current_view->currentBuffer()->update(-2);
- if (!current_view->currentBuffer()->text->TextUndo())
+ current_view->buffer()->update(-2);
+ if (!current_view->buffer()->text->TextUndo())
minibuffer->Set(_("No further undo information"));
else
- current_view->currentBuffer()->update(-1);
+ current_view->buffer()->update(-1);
}
}
void MenuRedo()
{
- if (current_view->currentBuffer()->the_locking_inset) {
+ if (current_view->buffer()->the_locking_inset) {
minibuffer->Set(_("Redo not yet supported in math mode"));
return;
}
minibuffer->Set(_("Redo"));
current_view->getScreen()->HideCursor();
BeforeChange();
- current_view->currentBuffer()->update(-2);
- if (!current_view->currentBuffer()->text->TextRedo())
+ current_view->buffer()->update(-2);
+ if (!current_view->buffer()->text->TextRedo())
minibuffer->Set(_("No further redo information"));
else
- current_view->currentBuffer()->update(-1);
+ current_view->buffer()->update(-1);
}
}
{
if (current_view->available()) {
current_view->getScreen()->HideCursor();
- current_view->currentBuffer()->update(-2);
+ current_view->buffer()->update(-2);
InsetSpecialChar *new_inset =
new InsetSpecialChar(InsetSpecialChar::HYPHENATION);
- current_view->currentBuffer()->insertInset(new_inset);
- //current_view->currentBuffer()->update(-1);
+ current_view->buffer()->insertInset(new_inset);
+ //current_view->buffer()->update(-1);
}
}
{
if (current_view->available()) {
current_view->getScreen()->HideCursor();
- current_view->currentBuffer()->update(-2);
+ current_view->buffer()->update(-2);
InsetSpecialChar *new_inset =
new InsetSpecialChar(InsetSpecialChar::LDOTS);
- current_view->currentBuffer()->insertInset(new_inset);
+ current_view->buffer()->insertInset(new_inset);
}
}
{
if (current_view->available()) {
current_view->getScreen()->HideCursor();
- current_view->currentBuffer()->update(-2);
+ current_view->buffer()->update(-2);
InsetSpecialChar *new_inset =
new InsetSpecialChar(InsetSpecialChar::END_OF_SENTENCE);
- current_view->currentBuffer()->insertInset(new_inset);
+ current_view->buffer()->insertInset(new_inset);
}
}
{
if (current_view->available()) {
current_view->getScreen()->HideCursor();
- current_view->currentBuffer()->update(-2);
+ current_view->buffer()->update(-2);
InsetSpecialChar *new_inset =
new InsetSpecialChar(InsetSpecialChar::MENU_SEPARATOR);
- current_view->currentBuffer()->insertInset(new_inset);
- //current_view->currentBuffer()->update(-1);
+ current_view->buffer()->insertInset(new_inset);
+ //current_view->buffer()->update(-1);
}
}
{
if (current_view->available()) {
current_view->getScreen()->HideCursor();
- current_view->currentBuffer()->update(-2);
- current_view->currentBuffer()->text->InsertChar(LYX_META_NEWLINE);
- current_view->currentBuffer()->update(-1);
+ current_view->buffer()->update(-2);
+ current_view->buffer()->text->InsertChar(LYX_META_NEWLINE);
+ current_view->buffer()->update(-1);
}
}
{
if (current_view->available()) {
current_view->getScreen()->HideCursor();
- current_view->currentBuffer()->update(-2);
- current_view->currentBuffer()->text->InsertChar(LYX_META_PROTECTED_SEPARATOR);
- current_view->currentBuffer()->update(-1);
+ current_view->buffer()->update(-2);
+ current_view->buffer()->text->InsertChar(LYX_META_PROTECTED_SEPARATOR);
+ current_view->buffer()->update(-1);
}
}
{
if (current_view->available()) {
current_view->getScreen()->HideCursor();
- current_view->currentBuffer()->update(-2);
- current_view->currentBuffer()->text->InsertChar(LYX_META_HFILL);
- current_view->currentBuffer()->update(-1);
+ current_view->buffer()->update(-2);
+ current_view->buffer()->text->InsertChar(LYX_META_HFILL);
+ current_view->buffer()->update(-1);
}
}
if (current_view->available()) {
// I think we should only show changes from the default
// font. (Asger)
- Buffer * buffer = current_view->currentBuffer();
+ Buffer * buffer = current_view->buffer();
LyXFont font = buffer->text->real_current_font;
LyXFont defaultfont = textclasslist.TextClass(buffer->
params.textclass).defaultfont();
{
if (current_view->available()) {
current_view->getScreen()->HideCursor();
- current_view->currentBuffer()->update(-2);
- current_view->currentBuffer()->text->ToggleFree(font, toggleall);
- current_view->currentBuffer()->update(1);
+ current_view->buffer()->update(-2);
+ current_view->buffer()->text->ToggleFree(font, toggleall);
+ current_view->buffer()->update(1);
}
// removed since it overrides the ToggleFree Message about the style
// Since Styles are more "High Level" than raw fonts I think the user
if (current_view->available()) {
minibuffer->Set(_("Inserting margin note..."));
current_view->getScreen()->HideCursor();
- current_view->currentBuffer()->update(-2);
- current_view->currentBuffer()->text->InsertFootnoteEnvironment(LyXParagraph::MARGIN);
- current_view->currentBuffer()->update(1);
+ current_view->buffer()->update(-2);
+ current_view->buffer()->text->InsertFootnoteEnvironment(LyXParagraph::MARGIN);
+ current_view->buffer()->update(1);
}
}
void CopyEnvironmentCB()
{
if (current_view->available()) {
- current_view->currentBuffer()->text->copyEnvironmentType();
+ current_view->buffer()->text->copyEnvironmentType();
/* clear the selection, even if mark_set */
current_view->getScreen()->ToggleSelection();
- current_view->currentBuffer()->text->ClearSelection();
- current_view->currentBuffer()->update(-2);
+ current_view->buffer()->text->ClearSelection();
+ current_view->buffer()->update(-2);
minibuffer->Set(_("Paragraph environment type copied"));
}
}
void PasteEnvironmentCB()
{
if (current_view->available()) {
- current_view->currentBuffer()->text->pasteEnvironmentType();
+ current_view->buffer()->text->pasteEnvironmentType();
minibuffer->Set(_("Paragraph environment type set"));
- current_view->currentBuffer()->update(1);
+ current_view->buffer()->update(1);
}
}
void CopyCB()
{
if (current_view->available()) {
- current_view->currentBuffer()->text->CopySelection();
+ current_view->buffer()->text->CopySelection();
/* clear the selection, even if mark_set */
current_view->getScreen()->ToggleSelection();
- current_view->currentBuffer()->text->ClearSelection();
- current_view->currentBuffer()->update(-2);
+ current_view->buffer()->text->ClearSelection();
+ current_view->buffer()->update(-2);
minibuffer->Set(_("Copy"));
}
}
{
if (current_view->available()) {
current_view->getScreen()->HideCursor();
- current_view->currentBuffer()->update(-2);
- current_view->currentBuffer()->text->CutSelection();
- current_view->currentBuffer()->update(1);
+ current_view->buffer()->update(-2);
+ current_view->buffer()->text->CutSelection();
+ current_view->buffer()->update(1);
minibuffer->Set(_("Cut"));
}
}
current_view->getScreen()->HideCursor();
/* clear the selection */
current_view->getScreen()->ToggleSelection();
- current_view->currentBuffer()->text->ClearSelection();
- current_view->currentBuffer()->update(-2);
+ current_view->buffer()->text->ClearSelection();
+ current_view->buffer()->update(-2);
/* paste */
- current_view->currentBuffer()->text->PasteSelection();
- current_view->currentBuffer()->update(1);
+ current_view->buffer()->text->PasteSelection();
+ current_view->buffer()->update(1);
/* clear the selection */
current_view->getScreen()->ToggleSelection();
- current_view->currentBuffer()->text->ClearSelection();
- current_view->currentBuffer()->update(-2);
+ current_view->buffer()->text->ClearSelection();
+ current_view->buffer()->update(-2);
}
minibuffer->Set(_("Melt"));
current_view->getScreen()->HideCursor();
BeforeChange();
- current_view->currentBuffer()->update(-2);
- current_view->currentBuffer()->text->MeltFootnoteEnvironment();
- current_view->currentBuffer()->update(1);
+ current_view->buffer()->update(-2);
+ current_view->buffer()->text->MeltFootnoteEnvironment();
+ current_view->buffer()->update(1);
}
if (current_view->available()) {
current_view->getScreen()->HideCursor();
- current_view->currentBuffer()->update(-2);
+ current_view->buffer()->update(-2);
if (button == 1)
- current_view->currentBuffer()->text->IncDepth();
+ current_view->buffer()->text->IncDepth();
else
- current_view->currentBuffer()->text->DecDepth();
- current_view->currentBuffer()->update(1);
+ current_view->buffer()->text->DecDepth();
+ current_view->buffer()->update(1);
minibuffer->Set(_("Changed environment depth"
" (in possible range, maybe not)"));
}
labelwidthstring = fl_get_input(fd_form_paragraph->input_labelwidth);
noindent = fl_get_button(fd_form_paragraph->check_noindent);
- current_view->currentBuffer()->text->SetParagraph(line_top,
+ current_view->buffer()->text->SetParagraph(line_top,
line_bottom,
pagebreak_top,
pagebreak_bottom,
align,
labelwidthstring,
noindent);
- current_view->currentBuffer()->update(1);
+ current_view->buffer()->update(1);
minibuffer->Set(_("Paragraph layout set"));
}
extern "C" void DocumentApplyCB(FL_OBJECT *, long)
{
bool redo = false;
- BufferParams *params = &(current_view->currentBuffer()->params);
- current_view->currentBuffer()->params.language =
+ BufferParams *params = &(current_view->buffer()->params);
+ current_view->buffer()->params.language =
combo_language->getline();
// If default skip is a "Length" but there's no text in the
// successfully loaded
redo = true;
minibuffer->Set(_("Converting document to new document class..."));
- int ret = current_view->currentBuffer()->
+ int ret = current_view->buffer()->
text->
- SwitchLayoutsBetweenClasses(current_view->currentBuffer()->
+ SwitchLayoutsBetweenClasses(current_view->buffer()->
params.textclass,
new_class,
- current_view->currentBuffer()->
+ current_view->buffer()->
paragraph);
if (ret){
current_view->redoCurrentBuffer();
minibuffer->Set(_("Document layout set"));
- current_view->currentBuffer()->markDirty();
+ current_view->buffer()->markDirty();
params->options =
fl_get_input(fd_form_document->input_extra);
current_view->getScreen()->HideCursor();
BeforeChange();
- current_view->currentBuffer()->update(-2);
+ current_view->buffer()->update(-2);
LyXCursor tmp;
- if (!current_view->currentBuffer()->text->GotoNextNote()) {
- if (current_view->currentBuffer()->text->cursor.pos
- || current_view->currentBuffer()->text->cursor.par !=
- current_view->currentBuffer()->text->FirstParagraph())
+ if (!current_view->buffer()->text->GotoNextNote()) {
+ if (current_view->buffer()->text->cursor.pos
+ || current_view->buffer()->text->cursor.par !=
+ current_view->buffer()->text->FirstParagraph())
{
- tmp = current_view->currentBuffer()->text->cursor;
- current_view->currentBuffer()->text->cursor.par =
- current_view->currentBuffer()->text->FirstParagraph();
- current_view->currentBuffer()->text->cursor.pos = 0;
- if (!current_view->currentBuffer()->text->GotoNextNote()) {
- current_view->currentBuffer()->text->cursor = tmp;
+ tmp = current_view->buffer()->text->cursor;
+ current_view->buffer()->text->cursor.par =
+ current_view->buffer()->text->FirstParagraph();
+ current_view->buffer()->text->cursor.pos = 0;
+ if (!current_view->buffer()->text->GotoNextNote()) {
+ current_view->buffer()->text->cursor = tmp;
minibuffer->Set(_("No more notes"));
LyXBell();
}
LyXBell();
}
}
- current_view->currentBuffer()->update(0);
- current_view->currentBuffer()->text->sel_cursor =
- current_view->currentBuffer()->text->cursor;
+ current_view->buffer()->update(0);
+ current_view->buffer()->text->sel_cursor =
+ current_view->buffer()->text->cursor;
}
void InsertCorrectQuote()
{
- Buffer *cbuffer = current_view->currentBuffer();
+ Buffer *cbuffer = current_view->buffer();
char c;
if (cbuffer->text->cursor.pos )
return;
minibuffer->Set(_("Quotes type set"));
- //current_view->currentBuffer()->params.quotes_language =
+ //current_view->buffer()->params.quotes_language =
// fl_get_choice(fd_form_quotes->choice_quotes_language) - 1;
InsetQuotes::quote_language lga = InsetQuotes::EnglishQ;
switch(fl_get_choice(fd_form_quotes->choice_quotes_language) - 1) {
lga = InsetQuotes::DanishQ;
break;
}
- current_view->currentBuffer()->params.quotes_language = lga;
+ current_view->buffer()->params.quotes_language = lga;
if (fl_get_button(fd_form_quotes->radio_single))
- current_view->currentBuffer()->
+ current_view->buffer()->
params.quotes_times = InsetQuotes::SingleQ;
else
- current_view->currentBuffer()->
+ current_view->buffer()->
params.quotes_times = InsetQuotes::DoubleQ;
}
if (!current_view->available())
return;
- current_view->currentBuffer()->params.preamble =
+ current_view->buffer()->params.preamble =
fl_get_input(fd_form_preamble->input_preamble);
- current_view->currentBuffer()->markDirty();
+ current_view->buffer()->markDirty();
minibuffer->Set(_("LaTeX preamble set"));
}
return;
// check for tables in tables
- if (current_view->currentBuffer()->text->cursor.par->table){
+ if (current_view->buffer()->text->cursor.par->table){
WriteAlert(_("Impossible Operation!"),
_("Cannot insert table in table."),
_("Sorry."));
current_view->getScreen()->HideCursor();
BeforeChange();
- current_view->currentBuffer()->update(-2);
+ current_view->buffer()->update(-2);
- current_view->currentBuffer()->text->SetCursorParUndo();
- current_view->currentBuffer()->text->FreezeUndo();
+ current_view->buffer()->text->SetCursorParUndo();
+ current_view->buffer()->text->FreezeUndo();
- current_view->currentBuffer()->text->BreakParagraph();
- current_view->currentBuffer()->update(-1);
+ current_view->buffer()->text->BreakParagraph();
+ current_view->buffer()->update(-1);
- if (current_view->currentBuffer()->text->cursor.par->Last()) {
- current_view->currentBuffer()->text->CursorLeft();
+ if (current_view->buffer()->text->cursor.par->Last()) {
+ current_view->buffer()->text->CursorLeft();
- current_view->currentBuffer()->text->BreakParagraph();
- current_view->currentBuffer()->update(-1);
+ current_view->buffer()->text->BreakParagraph();
+ current_view->buffer()->update(-1);
}
- current_view->currentBuffer()->text->current_font.setLatex(LyXFont::OFF);
+ current_view->buffer()->text->current_font.setLatex(LyXFont::OFF);
//if (!fl_get_button(fd_form_table->check_latex)){
// insert the new wysiwy table
- current_view->currentBuffer()->text->SetLayout(0); // standard layout
- if (current_view->currentBuffer()->text->cursor.par->footnoteflag ==
+ current_view->buffer()->text->SetLayout(0); // standard layout
+ if (current_view->buffer()->text->cursor.par->footnoteflag ==
LyXParagraph::NO_FOOTNOTE) {
- current_view->currentBuffer()->
+ current_view->buffer()->
text->SetParagraph(0, 0,
0, 0,
- VSpace (0.3 * current_view->currentBuffer()->
+ VSpace (0.3 * current_view->buffer()->
params.spacing.getValue(),
LyXLength::CM),
- VSpace (0.3 * current_view->currentBuffer()->
+ VSpace (0.3 * current_view->buffer()->
params.spacing.getValue(),
LyXLength::CM),
LYX_ALIGN_CENTER,
0);
}
else
- current_view->currentBuffer()->text->SetParagraph(0, 0,
+ current_view->buffer()->text->SetParagraph(0, 0,
0, 0,
VSpace(VSpace::NONE),
VSpace(VSpace::NONE),
string(),
0);
- current_view->currentBuffer()->text->cursor.par->table = new LyXTable(xsize, ysize);
+ current_view->buffer()->text->cursor.par->table = new LyXTable(xsize, ysize);
int i;
for (i=0; i<xsize * ysize - 1; i++)
- current_view->currentBuffer()->text->cursor.par->InsertChar(0,LYX_META_NEWLINE);
- current_view->currentBuffer()->text->RedoParagraph();
+ current_view->buffer()->text->cursor.par->InsertChar(0,LYX_META_NEWLINE);
+ current_view->buffer()->text->RedoParagraph();
- current_view->currentBuffer()->text->UnFreezeUndo();
+ current_view->buffer()->text->UnFreezeUndo();
- current_view->currentBuffer()->update(1);
+ current_view->buffer()->update(1);
minibuffer->Set(_("Table inserted"));
}
{
if (!current_view->available())
return;
- Buffer *buffer = current_view->currentBuffer();
+ Buffer *buffer = current_view->buffer();
string path = OnlyPath(buffer->getFileName());
string pageflag;
if (!current_view->available())
return;
- Buffer * buffer = current_view->currentBuffer();
+ Buffer * buffer = current_view->buffer();
if(buffer->isReadonly()) // paranoia
return;
return;
fl_set_button(fd_latex_options->accents,
- (int)current_view->currentBuffer()->params.allowAccents);
+ (int)current_view->buffer()->params.allowAccents);
if (fd_latex_options->LaTeXOptions->visible) {
fl_raise_form(fd_latex_options->LaTeXOptions);
return 0;
}
- char* string = current_view->currentBuffer()->text->SelectNextWord(value);
+ char* string = current_view->buffer()->text->SelectNextWord(value);
return string;
}
current_view->getScreen()->HideCursor();
BeforeChange();
- current_view->currentBuffer()->text->SelectSelectedWord();
+ current_view->buffer()->text->SelectSelectedWord();
current_view->getScreen()->ToggleSelection(false);
- current_view->currentBuffer()->update(0);
+ current_view->buffer()->update(0);
}
current_view->getScreen()->HideCursor();
BeforeChange();
- current_view->currentBuffer()->text->SelectSelectedWord();
- current_view->currentBuffer()->text->ClearSelection();
- current_view->currentBuffer()->update(0);
+ current_view->buffer()->text->SelectSelectedWord();
+ current_view->buffer()->text->ClearSelection();
+ current_view->buffer()->update(0);
}
return;
current_view->getScreen()->HideCursor();
- current_view->currentBuffer()->update(-2);
+ current_view->buffer()->update(-2);
/* 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->SetSelectionOverString(replacestring.c_str());
+ current_view->buffer()->text->SetSelectionOverString(replacestring.c_str());
// Go back so that replacement string is also spellchecked
for (string::size_type i = 0; i < replacestring.length() + 1; ++i) {
- current_view->currentBuffer()->text->CursorLeftIntern();
+ current_view->buffer()->text->CursorLeftIntern();
}
- current_view->currentBuffer()->update(1);
+ current_view->buffer()->update(1);
}
// End of spellchecker stuff
return;
- LyXParagraph *par = current_view->currentBuffer()->paragraph;
+ LyXParagraph *par = current_view->buffer()->paragraph;
while (par && (par->GetFirstCounter(0) != tmptoclist->counter[0] ||
par->GetFirstCounter(1) != tmptoclist->counter[1] ||
par->GetFirstCounter(2) != tmptoclist->counter[2] ||
if (par) {
BeforeChange();
- current_view->currentBuffer()->text->SetCursor(par, 0);
- current_view->currentBuffer()->text->sel_cursor =
- current_view->currentBuffer()->text->cursor;
- current_view->currentBuffer()->update(0);
+ current_view->buffer()->text->SetCursor(par, 0);
+ current_view->buffer()->text->sel_cursor =
+ current_view->buffer()->text->cursor;
+ current_view->buffer()->update(0);
}
else {
WriteAlert(_("Error"),
}
fl_hide_object(fd_form_toc->browser_toc);
/* get the table of contents */
- LyXParagraph * par = current_view->currentBuffer()->paragraph;
+ LyXParagraph * par = current_view->buffer()->paragraph;
char labeltype;
char * line = new char[200];
int pos = 0;
stapar = par;
while (par) {
- labeltype = textclasslist.Style(current_view->currentBuffer()->params.textclass,
+ labeltype = textclasslist.Style(current_view->buffer()->params.textclass,
par->GetLayout()).labeltype;
if (labeltype >= LABEL_COUNTER_CHAPTER
&& labeltype <= LABEL_COUNTER_CHAPTER +
- current_view->currentBuffer()->params.tocdepth) {
+ current_view->buffer()->params.tocdepth) {
/* insert this into the table of contents */
/* first indent a little bit */
for (pos=0;
pos < (labeltype -
- textclasslist.TextClass(current_view->currentBuffer()->
+ textclasslist.TextClass(current_view->buffer()->
params.textclass).maxcounter()) * 4 + 2;
pos++)
line[pos] = ' ';
return;
if (data==2) {
- current_view->getOwner()->getLyXFunc()->Dispatch(LFUN_REFGOTO, s.c_str());
+ current_view->owner()->getLyXFunc()->Dispatch(LFUN_REFGOTO, s.c_str());
return;
}
else
t += "\\pageref";
- if(current_view->currentBuffer()->isSGML())
+ if(current_view->buffer()->isSGML())
t += "[" + u + "]" + "{" + s + "}";
else
t += "{" + s + "}";
Inset *new_inset =
- new InsetRef(t, current_view->currentBuffer());
- current_view->currentBuffer()->insertInset(new_inset);
+ new InsetRef(t, current_view->buffer());
+ current_view->buffer()->insertInset(new_inset);
}
fl_clear_browser(brow);
- string refs = current_view->currentBuffer()->getReferenceList('\n');
+ string refs = current_view->buffer()->getReferenceList('\n');
int topline = 1;
#if FL_REVISION > 85
fl_select_browser_line(brow, topline);
fl_activate_object(brow);
}
- if (current_view->currentBuffer()->isReadonly()) {
+ if (current_view->buffer()->isReadonly()) {
// would be better to de/activate insert buttons
// but that's more work... besides this works. ARRae
fl_hide_form(fd_form_ref->form_ref);
}
- if (!current_view->currentBuffer()->isSGML()) {
+ if (!current_view->buffer()->isSGML()) {
fl_deactivate_object(fd_form_ref->ref_name);
fl_set_object_lcol(fd_form_ref->ref_name, FL_INACTIVE);
}
return;
/* very first check for locking insets*/
- if (current_view->currentBuffer()->the_locking_inset == inset){
- if (current_view->currentBuffer()->text->UpdateInset(inset)){
+ if (current_view->buffer()->the_locking_inset == inset){
+ if (current_view->buffer()->text->UpdateInset(inset)){
current_view->update();
if (mark_dirty){
- if (current_view->currentBuffer()->isLyxClean())
+ if (current_view->buffer()->isLyxClean())
minibuffer->setTimer(4);
- current_view->currentBuffer()->markDirty();
+ current_view->buffer()->markDirty();
}
current_view->updateScrollbar();
return;
/* first check the current buffer */
if (current_view->available()){
current_view->getScreen()->HideCursor();
- current_view->currentBuffer()->update(-3);
- if (current_view->currentBuffer()->text->UpdateInset(inset)){
+ current_view->buffer()->update(-3);
+ if (current_view->buffer()->text->UpdateInset(inset)){
if (mark_dirty)
- current_view->currentBuffer()->update(1);
+ current_view->buffer()->update(1);
else
- current_view->currentBuffer()->update(3);
+ current_view->buffer()->update(3);
return;
}
}
otherwise 0 */
int LockInset(UpdatableInset* inset)
{
- if (!current_view->currentBuffer()->the_locking_inset && inset){
- current_view->currentBuffer()->the_locking_inset = inset;
+ if (!current_view->buffer()->the_locking_inset && inset){
+ current_view->buffer()->the_locking_inset = inset;
return 0;
}
return 1;
void ShowLockedInsetCursor(long x, long y, int asc, int desc)
{
- if (current_view->currentBuffer()->the_locking_inset &&
+ if (current_view->buffer()->the_locking_inset &&
current_view->getScreen()){
- y += current_view->currentBuffer()->text->cursor.y;
+ y += current_view->buffer()->text->cursor.y;
current_view->getScreen()->ShowManualCursor(x, y,
asc, desc);
}
void HideLockedInsetCursor(long x, long y, int asc, int desc)
{
- if (current_view->currentBuffer()->the_locking_inset &&
+ if (current_view->buffer()->the_locking_inset &&
current_view->getScreen()){
- y += current_view->currentBuffer()->text->cursor.y;
+ y += current_view->buffer()->text->cursor.y;
current_view->getScreen()->HideManualCursor(x, y,
asc, desc);
}
void FitLockedInsetCursor(long x, long y, int asc, int desc)
{
- if (current_view->currentBuffer()->the_locking_inset &&
+ if (current_view->buffer()->the_locking_inset &&
current_view->getScreen()){
- y += current_view->currentBuffer()->text->cursor.y;
+ y += current_view->buffer()->text->cursor.y;
if (current_view->getScreen()->FitManualCursor(x, y, asc, desc))
current_view->updateScrollbar();
}
int UnlockInset(UpdatableInset* inset)
{
if (inset &&
- current_view->currentBuffer()->the_locking_inset == inset){
+ current_view->buffer()->the_locking_inset == inset){
inset->InsetUnlock();
- current_view->currentBuffer()->the_locking_inset = 0;
- current_view->currentBuffer()->text->FinishUndo();
+ current_view->buffer()->the_locking_inset = 0;
+ current_view->buffer()->text->FinishUndo();
return 0;
}
return bufferlist.unlockInset(inset);
void LockedInsetStoreUndo(Undo::undo_kind kind)
{
- if (!current_view->currentBuffer()->the_locking_inset)
+ if (!current_view->buffer()->the_locking_inset)
return; // shouldn't happen
if (kind == Undo::EDIT) // in this case insets would not be stored!
kind = Undo::FINISH;
- current_view->currentBuffer()->text->SetUndo(kind,
- current_view->currentBuffer()->text->cursor.par->
- ParFromPos(current_view->currentBuffer()->text->cursor.pos)->previous,
- current_view->currentBuffer()->text->cursor.par->
- ParFromPos(current_view->currentBuffer()->text->cursor.pos)->next);
+ current_view->buffer()->text->SetUndo(kind,
+ current_view->buffer()->text->cursor.par->
+ ParFromPos(current_view->buffer()->text->cursor.pos)->previous,
+ current_view->buffer()->text->cursor.par->
+ ParFromPos(current_view->buffer()->text->cursor.pos)->next);
}
tmp = tmp->next;
}
- /* delete the update list */
+ // delete the update list
while (InsetUpdateList) {
tmp = InsetUpdateList;
InsetUpdateList = InsetUpdateList->next;
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)
void LyXGUI::regBuf(Buffer *b)
{
- lyxViews->currentView()->setBuffer(b);
+ lyxViews->currentView()->buffer(b);
}
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);
{
WriteAlert(_("Any changes will be ignored"),
_("The document is read-only:"),
- current_view->currentBuffer()->getFileName());
+ current_view->buffer()->getFileName());
}
// 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();
// 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;
<< _("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.
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;
//
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));
}
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
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:
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
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) );
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;
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;
inline
void LyXFunc::moveCursorUpdate(bool selecting)
{
- if (selecting || owner->currentBuffer()->text->mark_set) {
- owner->currentBuffer()->text->SetSelection();
+ if (selecting || owner->buffer()->text->mark_set) {
+ owner->buffer()->text->SetSelection();
owner->currentView()->getScreen()->ToggleToggle();
- owner->currentBuffer()->update(0);
+ owner->buffer()->update(0);
} else {
- owner->currentBuffer()->update(-2); // this IS necessary
+ owner->buffer()->update(-2); // this IS necessary
// (Matthias)
}
owner->currentView()->getScreen()->ShowCursor();
// this function should be used always [asierra060396]
if (owner->currentView()->available() &&
- owner->currentBuffer()->the_locking_inset &&
+ owner->buffer()->the_locking_inset &&
keysym_return == XK_Escape) {
- UnlockInset(owner->currentBuffer()->the_locking_inset);
- owner->currentBuffer()->text->CursorRight();
+ UnlockInset(owner->buffer()->the_locking_inset);
+ owner->buffer()->text->CursorRight();
return 0;
}
// Now that we know which action, if the buffer is RO let's check
// whether the action is legal. Alejandro 970603
if (owner->currentView()->available() &&
- owner->currentBuffer()->isReadonly() &&
+ owner->buffer()->isReadonly() &&
lyxaction.isFuncRO(action)) {
setErrorMessage(N_("Document is read-only"));
lyxerr.debug() << "Error: Document is read-only." << endl;
// If in math mode pass the control to
// the math inset [asierra060396]
if (owner->currentView()->available() &&
- owner->currentBuffer()->the_locking_inset) {
+ owner->buffer()->the_locking_inset) {
if (action>1 || (action==LFUN_UNKNOWN_ACTION && keyseq.length>=-1)) {
if (action==LFUN_UNKNOWN_ACTION && argument.empty()) {
argument = keyseq.getiso();
if (action==LFUN_UNDO) {
int slx, sly;
UpdatableInset* inset =
- owner->currentBuffer()->the_locking_inset;
+ owner->buffer()->the_locking_inset;
inset->GetCursorPos(slx, sly);
UnlockInset(inset);
MenuUndo();
- inset = (UpdatableInset*)owner->currentBuffer()->text->cursor.par->GetInset(owner->currentBuffer()->text->cursor.pos);
+ inset = (UpdatableInset*)owner->buffer()->text->cursor.par->GetInset(owner->buffer()->text->cursor.pos);
if (inset)
inset->Edit(slx, sly);
return string();
} else
if (action==LFUN_REDO) {
int slx, sly;
- UpdatableInset* inset = owner->currentBuffer()->the_locking_inset;
+ UpdatableInset* inset = owner->buffer()->the_locking_inset;
inset->GetCursorPos(slx, sly);
UnlockInset(inset);
MenuRedo();
- inset = (UpdatableInset*)owner->currentBuffer()->text->cursor.par->GetInset(owner->currentBuffer()->text->cursor.pos);
+ inset = (UpdatableInset*)owner->buffer()->text->cursor.par->GetInset(owner->buffer()->text->cursor.pos);
if (inset)
inset->Edit(slx, sly);
return string();
} else
- if (owner->currentBuffer()->the_locking_inset->LocalDispatch(action, argument.c_str()))
+ if (owner->buffer()->the_locking_inset->LocalDispatch(action, argument.c_str()))
return string();
else {
setMessage(N_("Text mode"));
if (action==LFUN_RIGHT || action==-1)
- owner->currentBuffer()->text->CursorRight();
+ owner->buffer()->text->CursorRight();
if (action==LFUN_LEFT || action==LFUN_RIGHT)
return string();
}
switch(action) {
// --- Misc -------------------------------------------
case LFUN_WORDFINDFORWARD :
- case LFUN_WORDFINDBACKWARD : {
- LyXText *ltCur;
+ case LFUN_WORDFINDBACKWARD : {
static string last_search;
string searched_string;
searched_string = last_search;
}
- ltCur = owner->currentView()->currentBuffer()->text ;
+ LyXText * ltCur = owner->currentView()->buffer()->text ;
if (!searched_string.empty() &&
( (action == LFUN_WORDFINDBACKWARD) ?
)){
// ??? What is that ???
- owner->currentView()->currentBuffer()->update(-2);
+ owner->currentView()->buffer()->update(-2);
// ??? Needed ???
// clear the selection (if there is any)
owner->currentView()->getScreen()->ToggleSelection();
- owner->currentView()->currentBuffer()->text->ClearSelection();
+ owner->currentView()->buffer()->text->ClearSelection();
// Move cursor so that successive C-s 's will not stand in place.
if( action == LFUN_WORDFINDFORWARD )
- owner->currentBuffer()->text->CursorRightOneWord();
- owner->currentBuffer()->text->FinishUndo();
+ owner->buffer()->text->CursorRightOneWord();
+ owner->buffer()->text->FinishUndo();
moveCursorUpdate(false);
// ??? Needed ???
{
if (owner->currentView()->available()
&& owner->currentView()->getScreen()) {
- owner->currentBuffer()->update(-2);
+ owner->buffer()->update(-2);
}
char buf[100];
keyseq.print(buf,100, true);
break;
case LFUN_READ_ONLY_TOGGLE:
- if (owner->currentBuffer()->lyxvc.inUse()) {
- owner->currentBuffer()->lyxvc.toggleReadOnly();
+ if (owner->buffer()->lyxvc.inUse()) {
+ owner->buffer()->lyxvc.toggleReadOnly();
} else {
- owner->currentBuffer()->setReadonly(
- !owner->currentBuffer()->isReadonly());
+ owner->buffer()->setReadonly(
+ !owner->buffer()->isReadonly());
}
break;
case LFUN_CENTER: // this is center and redraw.
BeforeChange();
- if (owner->currentBuffer()->text->cursor.y >
+ if (owner->buffer()->text->cursor.y >
owner->currentView()->getWorkArea()->h / 2) {
owner->currentView()->getScreen()->
- Draw(owner->currentBuffer()->text->cursor.y -
+ Draw(owner->buffer()->text->cursor.y -
owner->currentView()->getWorkArea()->h/2);
} else { // <=
owner->currentView()->getScreen()->
Draw(0);
}
- owner->currentBuffer()->update(0);
+ owner->buffer()->update(0);
owner->currentView()->redraw();
break;
case LFUN_APPENDIX:
if (owner->currentView()->available()) {
- owner->currentBuffer()->text->toggleAppendix();
- owner->currentBuffer()->update(1);
+ owner->buffer()->text->toggleAppendix();
+ owner->buffer()->update(1);
}
break;
break;
case LFUN_MENUWRITE:
- MenuWrite(owner->currentBuffer());
+ MenuWrite(owner->buffer());
break;
case LFUN_MENUWRITEAS:
- MenuWriteAs(owner->currentBuffer());
+ MenuWriteAs(owner->buffer());
break;
case LFUN_MENURELOAD:
break;
case LFUN_PREVIEW:
- MenuPreview(owner->currentBuffer());
+ MenuPreview(owner->buffer());
break;
case LFUN_PREVIEWPS:
- MenuPreviewPS(owner->currentBuffer());
+ MenuPreviewPS(owner->buffer());
break;
case LFUN_RUNLATEX:
- MenuRunLaTeX(owner->currentBuffer());
+ MenuRunLaTeX(owner->buffer());
break;
case LFUN_BUILDPROG:
- MenuBuildProg(owner->currentBuffer());
+ MenuBuildProg(owner->buffer());
break;
case LFUN_RUNCHKTEX:
- MenuRunChktex(owner->currentBuffer());
+ MenuRunChktex(owner->buffer());
break;
case LFUN_RUNDVIPS:
- MenuRunDvips(owner->currentBuffer(), false);
+ MenuRunDvips(owner->buffer(), false);
break;
case LFUN_MENUPRINT:
- MenuPrint(owner->currentBuffer());
+ MenuPrint(owner->buffer());
break;
case LFUN_FAX:
- MenuFax(owner->currentBuffer());
+ MenuFax(owner->buffer());
break;
case LFUN_EXPORT:
// latex
if (extyp == "latex") {
// make sure that this buffer is not linuxdoc
- MenuMakeLaTeX(owner->currentBuffer());
+ MenuMakeLaTeX(owner->buffer());
}
// linuxdoc
else if (extyp == "linuxdoc") {
// make sure that this buffer is not latex
- MenuMakeLinuxDoc(owner->currentBuffer());
+ MenuMakeLinuxDoc(owner->buffer());
}
// docbook
else if (extyp == "docbook") {
// make sure that this buffer is not latex or linuxdoc
- MenuMakeDocBook(owner->currentBuffer());
+ MenuMakeDocBook(owner->buffer());
}
// dvi
else if (extyp == "dvi") {
// *.log and *.aux files also. (Asger)
bool flag = lyxrc->use_tempdir;
lyxrc->use_tempdir = false;
- MenuRunLaTeX(owner->currentBuffer());
+ MenuRunLaTeX(owner->buffer());
lyxrc->use_tempdir = flag;
}
// postscript
else if (extyp == "postscript") {
// Start Print-dialog. Not as good as dvi... Bernhard.
- MenuPrint(owner->currentBuffer());
+ MenuPrint(owner->buffer());
// Since the MenuPrint is a pop-up, we can't use
// the same trick as above. (Asger)
// MISSING: Move of ps-file :-(
}
// ascii
else if (extyp == "ascii") {
- MenuMakeAscii(owner->currentBuffer());
+ MenuMakeAscii(owner->buffer());
}
else if (extyp == "custom") {
MenuSendto();
// HTML
else if (extyp == "html" && lyxrc->html_command != "none") {
// First, create LaTeX file
- MenuMakeLaTeX(owner->currentBuffer());
+ MenuMakeLaTeX(owner->buffer());
// And now, run the converter
- string file = owner->currentBuffer()->getFileName();
+ string file = owner->buffer()->getFileName();
Path path(OnlyPath(file));
// the tex file name has to be correct for
// latex, but the html file name can be
case LFUN_TOC_INSERT:
{
Inset *new_inset =
- new InsetTOC(owner->currentBuffer());
- owner->currentBuffer()->insertInset(new_inset,
+ new InsetTOC(owner->buffer());
+ owner->buffer()->insertInset(new_inset,
"Standard", true);
break;
}
case LFUN_LOF_INSERT:
{
Inset *new_inset =
- new InsetLOF(owner->currentBuffer());
- owner->currentBuffer()->insertInset(new_inset,
+ new InsetLOF(owner->buffer());
+ owner->buffer()->insertInset(new_inset,
"Standard", true);
break;
}
case LFUN_LOA_INSERT:
{
Inset *new_inset =
- new InsetLOA(owner->currentBuffer());
- owner->currentBuffer()->insertInset(new_inset,
+ new InsetLOA(owner->buffer());
+ owner->buffer()->insertInset(new_inset,
"Standard", true);
break;
}
case LFUN_LOT_INSERT:
{
Inset *new_inset =
- new InsetLOT(owner->currentBuffer());
- owner->currentBuffer()->insertInset(new_inset,
+ new InsetLOT(owner->buffer());
+ owner->buffer()->insertInset(new_inset,
"Standard", true);
break;
}
break;
case LFUN_REMOVEERRORS:
- if (owner->currentBuffer()->removeAutoInsets()) {
+ if (owner->buffer()->removeAutoInsets()) {
owner->currentView()->redraw();
owner->currentView()->fitCursor();
owner->currentView()->updateScrollbar();
case LFUN_FOOTMELT:
if (owner->currentView()->available()
- && !owner->currentBuffer()->text->selection
- && owner->currentBuffer()->text->cursor.par->footnoteflag
+ && !owner->buffer()->text->selection
+ && owner->buffer()->text->cursor.par->footnoteflag
!= LyXParagraph::NO_FOOTNOTE)
{ // only melt footnotes with FOOTMELT, not margins etc
- if(owner->currentBuffer()->text->cursor.par->footnotekind == LyXParagraph::FOOTNOTE)
+ if(owner->buffer()->text->cursor.par->footnotekind == LyXParagraph::FOOTNOTE)
MeltCB(ob,0);
}
else
case LFUN_MARGINMELT:
if (owner->currentView()->available()
- && !owner->currentBuffer()->text->selection
- && owner->currentBuffer()->text->cursor.par->footnoteflag
+ && !owner->buffer()->text->selection
+ && owner->buffer()->text->cursor.par->footnoteflag
!= LyXParagraph::NO_FOOTNOTE)
{ // only melt margins
- if(owner->currentBuffer()->text->cursor.par->footnotekind == LyXParagraph::MARGIN)
+ if(owner->buffer()->text->cursor.par->footnotekind == LyXParagraph::MARGIN)
MeltCB(ob,0);
}
else
// --- version control -------------------------------
case LFUN_VC_REGISTER:
{
- if (!owner->currentBuffer()->lyxvc.inUse())
- owner->currentBuffer()->lyxvc.registrer();
+ if (!owner->buffer()->lyxvc.inUse())
+ owner->buffer()->lyxvc.registrer();
}
break;
case LFUN_VC_CHECKIN:
{
- if (owner->currentBuffer()->lyxvc.inUse()
- && !owner->currentBuffer()->isReadonly())
- owner->currentBuffer()->lyxvc.checkIn();
+ if (owner->buffer()->lyxvc.inUse()
+ && !owner->buffer()->isReadonly())
+ owner->buffer()->lyxvc.checkIn();
}
break;
case LFUN_VC_CHECKOUT:
{
- if (owner->currentBuffer()->lyxvc.inUse()
- && owner->currentBuffer()->isReadonly())
- owner->currentBuffer()->lyxvc.checkOut();
+ if (owner->buffer()->lyxvc.inUse()
+ && owner->buffer()->isReadonly())
+ owner->buffer()->lyxvc.checkOut();
}
break;
case LFUN_VC_REVERT:
{
- owner->currentBuffer()->lyxvc.revert();
+ owner->buffer()->lyxvc.revert();
}
break;
case LFUN_VC_UNDO:
{
- owner->currentBuffer()->lyxvc.undoLast();
+ owner->buffer()->lyxvc.undoLast();
}
break;
case LFUN_VC_HISTORY:
{
- owner->currentBuffer()->lyxvc.showLog();
+ owner->buffer()->lyxvc.showLog();
break;
}
// remember the previous buffer, not bufferlist.
// if (owner->currentView()->available()){
// BeforeChange();
-// owner->currentBuffer()->update(-2);
+// owner->buffer()->update(-2);
// }
// owner->currentView()->setBuffer(bufferlist.prev());
Buffer * tmpbuf = 0;
tmpbuf = NewLyxFile(argument);
if (tmpbuf)
- owner->currentView()->setBuffer(tmpbuf);
+ owner->currentView()->buffer(tmpbuf);
}
break;
case LFUN_FILE_OPEN:
- owner->currentView()->setBuffer(
+ owner->currentView()->buffer(
bufferlist.loadLyXFile(argument));
break;
// Pretend we got the name instead.
Dispatch(int(LFUN_LAYOUT),
- textclasslist.NameOfLayout(owner->currentBuffer()->
+ textclasslist.NameOfLayout(owner->buffer()->
text->parameters->
textclass,
sel).c_str());
int layoutno = -1;
layoutno =
textclasslist.NumberOfLayout(owner->
- currentBuffer()->
+ buffer()->
text->parameters->
textclass,
argument).second;
if (current_layout != layoutno) {
owner->currentView()->getScreen()->HideCursor();
current_layout = layoutno;
- owner->currentBuffer()->update(-2);
- owner->currentBuffer()->text->
+ owner->buffer()->update(-2);
+ owner->buffer()->text->
SetLayout(layoutno);
owner->getToolbar()->combox->
- select(owner->currentBuffer()->
+ select(owner->buffer()->
text->cursor.par->
GetLayout() + 1);
- owner->currentBuffer()->update(1);
+ owner->buffer()->update(1);
}
}
break;
break;
case LFUN_UPCASE_WORD:
- owner->currentBuffer()->update(-2);
+ owner->buffer()->update(-2);
FreeUpdateTimer();
- owner->currentBuffer()->text->ChangeWordCase(LyXText::text_uppercase);
- owner->currentBuffer()->update(1);
+ owner->buffer()->text->ChangeWordCase(LyXText::text_uppercase);
+ owner->buffer()->update(1);
SetUpdateTimer();
break;
case LFUN_LOWCASE_WORD:
- owner->currentBuffer()->update(-2);
+ owner->buffer()->update(-2);
FreeUpdateTimer();
- owner->currentBuffer()->text->ChangeWordCase(LyXText::text_lowercase);
- owner->currentBuffer()->update(1);
+ owner->buffer()->text->ChangeWordCase(LyXText::text_lowercase);
+ owner->buffer()->update(1);
SetUpdateTimer();
break;
case LFUN_CAPITALIZE_WORD:
- owner->currentBuffer()->update(-2);
+ owner->buffer()->update(-2);
FreeUpdateTimer();
- owner->currentBuffer()->text->ChangeWordCase(LyXText::text_capitalization);
- owner->currentBuffer()->update(1);
+ owner->buffer()->text->ChangeWordCase(LyXText::text_capitalization);
+ owner->buffer()->update(1);
SetUpdateTimer();
break;
if (!label.empty()) {
owner->currentView()->savePosition();
- owner->currentBuffer()->gotoLabel(label.c_str());
+ owner->buffer()->gotoLabel(label.c_str());
}
}
break;
// --- Cursor Movements -----------------------------
case LFUN_RIGHT:
{
- Buffer *tmpbuffer = owner->currentBuffer();
- LyXText *tmptext = owner->currentBuffer()->text;
+ Buffer *tmpbuffer = owner->buffer();
+ LyXText *tmptext = owner->buffer()->text;
if(!tmptext->mark_set)
BeforeChange();
tmpbuffer->update(-2);
break;
}
tmptext->CursorRight();
- owner->currentBuffer()->text->FinishUndo();
+ owner->buffer()->text->FinishUndo();
moveCursorUpdate(false);
owner->getMiniBuffer()->Set(CurrentState());
}
{
// This is soooo ugly. Isn`t it possible to make
// it simpler? (Lgb)
- LyXText *txt= owner->currentBuffer()->text;
+ LyXText *txt= owner->buffer()->text;
if(!txt->mark_set) BeforeChange();
- owner->currentBuffer()->update(-2);
+ owner->buffer()->update(-2);
txt->CursorLeft();
if (txt->cursor.pos < txt->cursor.par->Last()
&& txt->cursor.par->GetChar(txt->cursor.pos)
// tmpinset->Edit(-1, 0); // -1 means go rightmost
break;
}
- owner->currentBuffer()->text->FinishUndo();
+ owner->buffer()->text->FinishUndo();
moveCursorUpdate(false);
owner->getMiniBuffer()->Set(CurrentState());
}
break;
case LFUN_UP:
- if(!owner->currentBuffer()->text->mark_set) BeforeChange();
- owner->currentBuffer()->update(-3);
- owner->currentBuffer()->text->CursorUp();
- owner->currentBuffer()->text->FinishUndo();
+ if(!owner->buffer()->text->mark_set) BeforeChange();
+ owner->buffer()->update(-3);
+ owner->buffer()->text->CursorUp();
+ owner->buffer()->text->FinishUndo();
moveCursorUpdate(false);
owner->getMiniBuffer()->Set(CurrentState());
break;
case LFUN_DOWN:
- if(!owner->currentBuffer()->text->mark_set)
+ if(!owner->buffer()->text->mark_set)
BeforeChange();
- owner->currentBuffer()->update(-3);
- owner->currentBuffer()->text->CursorDown();
- owner->currentBuffer()->text->FinishUndo();
+ owner->buffer()->update(-3);
+ owner->buffer()->text->CursorDown();
+ owner->buffer()->text->FinishUndo();
moveCursorUpdate(false);
owner->getMiniBuffer()->Set(CurrentState());
break;
case LFUN_UP_PARAGRAPH:
- if(!owner->currentBuffer()->text->mark_set)
+ if(!owner->buffer()->text->mark_set)
BeforeChange();
- owner->currentBuffer()->update(-3);
- owner->currentBuffer()->text->CursorUpParagraph();
- owner->currentBuffer()->text->FinishUndo();
+ owner->buffer()->update(-3);
+ owner->buffer()->text->CursorUpParagraph();
+ owner->buffer()->text->FinishUndo();
moveCursorUpdate(false);
owner->getMiniBuffer()->Set(CurrentState());
break;
case LFUN_DOWN_PARAGRAPH:
- if(!owner->currentBuffer()->text->mark_set)
+ if(!owner->buffer()->text->mark_set)
BeforeChange();
- owner->currentBuffer()->update(-3);
- owner->currentBuffer()->text->CursorDownParagraph();
- owner->currentBuffer()->text->FinishUndo();
+ owner->buffer()->update(-3);
+ owner->buffer()->text->CursorDownParagraph();
+ owner->buffer()->text->FinishUndo();
moveCursorUpdate(false);
owner->getMiniBuffer()->Set(CurrentState());
break;
case LFUN_PRIOR:
- if(!owner->currentBuffer()->text->mark_set)
+ if(!owner->buffer()->text->mark_set)
BeforeChange();
- owner->currentBuffer()->update(-3);
+ owner->buffer()->update(-3);
owner->currentView()->cursorPrevious();
- owner->currentBuffer()->text->FinishUndo();
+ owner->buffer()->text->FinishUndo();
moveCursorUpdate(false);
owner->getMiniBuffer()->Set(CurrentState());
break;
case LFUN_NEXT:
- if(!owner->currentBuffer()->text->mark_set)
+ if(!owner->buffer()->text->mark_set)
BeforeChange();
- owner->currentBuffer()->update(-3);
+ owner->buffer()->update(-3);
owner->currentView()->cursorNext();
- owner->currentBuffer()->text->FinishUndo();
+ owner->buffer()->text->FinishUndo();
moveCursorUpdate(false);
owner->getMiniBuffer()->Set(CurrentState());
break;
case LFUN_HOME:
- if(!owner->currentBuffer()->text->mark_set)
+ if(!owner->buffer()->text->mark_set)
BeforeChange();
- owner->currentBuffer()->update(-2);
- owner->currentBuffer()->text->CursorHome();
- owner->currentBuffer()->text->FinishUndo();
+ owner->buffer()->update(-2);
+ owner->buffer()->text->CursorHome();
+ owner->buffer()->text->FinishUndo();
moveCursorUpdate(false);
owner->getMiniBuffer()->Set(CurrentState());
break;
case LFUN_END:
- if(!owner->currentBuffer()->text->mark_set)
+ if(!owner->buffer()->text->mark_set)
BeforeChange();
- owner->currentBuffer()->update(-2);
- owner->currentBuffer()->text->CursorEnd();
- owner->currentBuffer()->text->FinishUndo();
+ owner->buffer()->update(-2);
+ owner->buffer()->text->CursorEnd();
+ owner->buffer()->text->FinishUndo();
moveCursorUpdate(false);
owner->getMiniBuffer()->Set(CurrentState());
break;
case LFUN_TAB:
- if(!owner->currentBuffer()->text->mark_set)
+ if(!owner->buffer()->text->mark_set)
BeforeChange();
- owner->currentBuffer()->update(-2);
- owner->currentBuffer()->text->CursorTab();
- owner->currentBuffer()->text->FinishUndo();
+ owner->buffer()->update(-2);
+ owner->buffer()->text->CursorTab();
+ owner->buffer()->text->FinishUndo();
moveCursorUpdate(false);
owner->getMiniBuffer()->Set(CurrentState());
break;
case LFUN_WORDRIGHT:
- if(!owner->currentBuffer()->text->mark_set)
+ if(!owner->buffer()->text->mark_set)
BeforeChange();
- owner->currentBuffer()->update(-2);
- owner->currentBuffer()->text->CursorRightOneWord();
- owner->currentBuffer()->text->FinishUndo();
+ owner->buffer()->update(-2);
+ owner->buffer()->text->CursorRightOneWord();
+ owner->buffer()->text->FinishUndo();
moveCursorUpdate(false);
owner->getMiniBuffer()->Set(CurrentState());
break;
case LFUN_WORDLEFT:
- if(!owner->currentBuffer()->text->mark_set)
+ if(!owner->buffer()->text->mark_set)
BeforeChange();
- owner->currentBuffer()->update(-2);
- owner->currentBuffer()->text->CursorLeftOneWord();
- owner->currentBuffer()->text->FinishUndo();
+ owner->buffer()->update(-2);
+ owner->buffer()->text->CursorLeftOneWord();
+ owner->buffer()->text->FinishUndo();
moveCursorUpdate(false);
owner->getMiniBuffer()->Set(CurrentState());
break;
case LFUN_BEGINNINGBUF:
- if(!owner->currentBuffer()->text->mark_set)
+ if(!owner->buffer()->text->mark_set)
BeforeChange();
- owner->currentBuffer()->update(-2);
- owner->currentBuffer()->text->CursorTop();
- owner->currentBuffer()->text->FinishUndo();
+ owner->buffer()->update(-2);
+ owner->buffer()->text->CursorTop();
+ owner->buffer()->text->FinishUndo();
moveCursorUpdate(false);
owner->getMiniBuffer()->Set(CurrentState());
break;
case LFUN_ENDBUF:
- if(!owner->currentBuffer()->text->mark_set)
+ if(!owner->buffer()->text->mark_set)
BeforeChange();
- owner->currentBuffer()->update(-2);
- owner->currentBuffer()->text->CursorBottom();
- owner->currentBuffer()->text->FinishUndo();
+ owner->buffer()->update(-2);
+ owner->buffer()->text->CursorBottom();
+ owner->buffer()->text->FinishUndo();
moveCursorUpdate(false);
owner->getMiniBuffer()->Set(CurrentState());
break;
/* cursor selection ---------------------------- */
case LFUN_RIGHTSEL:
- owner->currentBuffer()->update(-2);
- owner->currentBuffer()->text->CursorRight();
- owner->currentBuffer()->text->FinishUndo();
+ owner->buffer()->update(-2);
+ owner->buffer()->text->CursorRight();
+ owner->buffer()->text->FinishUndo();
moveCursorUpdate(true);
owner->getMiniBuffer()->Set(CurrentState());
break;
case LFUN_LEFTSEL:
- owner->currentBuffer()->update(-2);
- owner->currentBuffer()->text->CursorLeft();
- owner->currentBuffer()->text->FinishUndo();
+ owner->buffer()->update(-2);
+ owner->buffer()->text->CursorLeft();
+ owner->buffer()->text->FinishUndo();
moveCursorUpdate(true);
owner->getMiniBuffer()->Set(CurrentState());
break;
case LFUN_UPSEL:
- owner->currentBuffer()->update(-2);
- owner->currentBuffer()->text->CursorUp();
- owner->currentBuffer()->text->FinishUndo();
+ owner->buffer()->update(-2);
+ owner->buffer()->text->CursorUp();
+ owner->buffer()->text->FinishUndo();
moveCursorUpdate(true);
owner->getMiniBuffer()->Set(CurrentState());
break;
case LFUN_DOWNSEL:
- owner->currentBuffer()->update(-2);
- owner->currentBuffer()->text->CursorDown();
- owner->currentBuffer()->text->FinishUndo();
+ owner->buffer()->update(-2);
+ owner->buffer()->text->CursorDown();
+ owner->buffer()->text->FinishUndo();
moveCursorUpdate(true);
owner->getMiniBuffer()->Set(CurrentState());
break;
case LFUN_UP_PARAGRAPHSEL:
- owner->currentBuffer()->update(-2);
- owner->currentBuffer()->text->CursorUpParagraph();
- owner->currentBuffer()->text->FinishUndo();
+ owner->buffer()->update(-2);
+ owner->buffer()->text->CursorUpParagraph();
+ owner->buffer()->text->FinishUndo();
moveCursorUpdate(true);
owner->getMiniBuffer()->Set(CurrentState());
break;
case LFUN_DOWN_PARAGRAPHSEL:
- owner->currentBuffer()->update(-2);
- owner->currentBuffer()->text->CursorDownParagraph();
- owner->currentBuffer()->text->FinishUndo();
+ owner->buffer()->update(-2);
+ owner->buffer()->text->CursorDownParagraph();
+ owner->buffer()->text->FinishUndo();
moveCursorUpdate(true);
owner->getMiniBuffer()->Set(CurrentState());
break;
case LFUN_PRIORSEL:
- owner->currentBuffer()->update(-2);
+ owner->buffer()->update(-2);
owner->currentView()->cursorPrevious();
- owner->currentBuffer()->text->FinishUndo();
+ owner->buffer()->text->FinishUndo();
moveCursorUpdate(true);
owner->getMiniBuffer()->Set(CurrentState());
break;
case LFUN_NEXTSEL:
- owner->currentBuffer()->update(-2);
+ owner->buffer()->update(-2);
owner->currentView()->cursorNext();
- owner->currentBuffer()->text->FinishUndo();
+ owner->buffer()->text->FinishUndo();
moveCursorUpdate(true);
owner->getMiniBuffer()->Set(CurrentState());
break;
case LFUN_HOMESEL:
- owner->currentBuffer()->update(-2);
- owner->currentBuffer()->text->CursorHome();
- owner->currentBuffer()->text->FinishUndo();
+ owner->buffer()->update(-2);
+ owner->buffer()->text->CursorHome();
+ owner->buffer()->text->FinishUndo();
moveCursorUpdate(true);
owner->getMiniBuffer()->Set(CurrentState());
break;
case LFUN_ENDSEL:
- owner->currentBuffer()->update(-2);
- owner->currentBuffer()->text->CursorEnd();
- owner->currentBuffer()->text->FinishUndo();
+ owner->buffer()->update(-2);
+ owner->buffer()->text->CursorEnd();
+ owner->buffer()->text->FinishUndo();
moveCursorUpdate(true);
owner->getMiniBuffer()->Set(CurrentState());
break;
case LFUN_WORDRIGHTSEL:
- owner->currentBuffer()->update(-2);
- owner->currentBuffer()->text->CursorRightOneWord();
- owner->currentBuffer()->text->FinishUndo();
+ owner->buffer()->update(-2);
+ owner->buffer()->text->CursorRightOneWord();
+ owner->buffer()->text->FinishUndo();
moveCursorUpdate(true);
owner->getMiniBuffer()->Set(CurrentState());
break;
case LFUN_WORDLEFTSEL:
- owner->currentBuffer()->update(-2);
- owner->currentBuffer()->text->CursorLeftOneWord();
- owner->currentBuffer()->text->FinishUndo();
+ owner->buffer()->update(-2);
+ owner->buffer()->text->CursorLeftOneWord();
+ owner->buffer()->text->FinishUndo();
moveCursorUpdate(true);
owner->getMiniBuffer()->Set(CurrentState());
break;
case LFUN_BEGINNINGBUFSEL:
- owner->currentBuffer()->update(-2);
- owner->currentBuffer()->text->CursorTop();
- owner->currentBuffer()->text->FinishUndo();
+ owner->buffer()->update(-2);
+ owner->buffer()->text->CursorTop();
+ owner->buffer()->text->FinishUndo();
moveCursorUpdate(true);
owner->getMiniBuffer()->Set(CurrentState());
break;
case LFUN_ENDBUFSEL:
- owner->currentBuffer()->update(-2);
- owner->currentBuffer()->text->CursorBottom();
- owner->currentBuffer()->text->FinishUndo();
+ owner->buffer()->update(-2);
+ owner->buffer()->text->CursorBottom();
+ owner->buffer()->text->FinishUndo();
moveCursorUpdate(true);
owner->getMiniBuffer()->Set(CurrentState());
break;
// --- text changing commands ------------------------
case LFUN_BREAKLINE:
BeforeChange();
- owner->currentBuffer()->text->InsertChar(LYX_META_NEWLINE);
+ owner->buffer()->text->InsertChar(LYX_META_NEWLINE);
SmallUpdate(1);
SetUpdateTimer(0.01);
moveCursorUpdate(false);
case LFUN_PROTECTEDSPACE:
BeforeChange();
- owner->currentBuffer()->text->
+ owner->buffer()->text->
InsertChar(LYX_META_PROTECTED_SEPARATOR);
SmallUpdate(1);
SetUpdateTimer();
break;
case LFUN_SETMARK:
- if(owner->currentBuffer()->text->mark_set) {
+ if(owner->buffer()->text->mark_set) {
BeforeChange();
- owner->currentBuffer()->update(0);
+ owner->buffer()->update(0);
setMessage(N_("Mark removed"));
} else {
BeforeChange();
- owner->currentBuffer()->text->mark_set = 1;
- owner->currentBuffer()->update(0);
+ owner->buffer()->text->mark_set = 1;
+ owner->buffer()->update(0);
setMessage(N_("Mark set"));
}
- owner->currentBuffer()->text->sel_cursor =
- owner->currentBuffer()->text->cursor;
+ owner->buffer()->text->sel_cursor =
+ owner->buffer()->text->cursor;
break;
case LFUN_DELETE:
FreeUpdateTimer();
- if (!owner->currentBuffer()->text->selection) {
- owner->currentBuffer()->text->Delete();
- owner->currentBuffer()->text->sel_cursor =
- owner->currentBuffer()->text->cursor;
+ if (!owner->buffer()->text->selection) {
+ owner->buffer()->text->Delete();
+ owner->buffer()->text->sel_cursor =
+ owner->buffer()->text->cursor;
SmallUpdate(1);
// It is possible to make it a lot faster still
// just comment out the lone below...
{
// Reverse the effect of LFUN_BREAKPARAGRAPH_SKIP.
- LyXCursor cursor = owner->currentBuffer()->text->cursor;
+ LyXCursor cursor = owner->buffer()->text->cursor;
FreeUpdateTimer();
- if (!owner->currentBuffer()->text->selection) {
+ if (!owner->buffer()->text->selection) {
if (cursor.pos == cursor.par->Last()) {
- owner->currentBuffer()->text->CursorRight();
- cursor = owner->currentBuffer()->text->cursor;
+ owner->buffer()->text->CursorRight();
+ cursor = owner->buffer()->text->cursor;
if (cursor.pos == 0
&& !(cursor.par->added_space_top
== VSpace (VSpace::NONE))) {
- owner->currentBuffer()->text->SetParagraph
+ owner->buffer()->text->SetParagraph
(cursor.par->line_top,
cursor.par->line_bottom,
cursor.par->pagebreak_top,
cursor.par->added_space_bottom,
cursor.par->align,
cursor.par->labelwidthstring, 0);
- owner->currentBuffer()->text->CursorLeft();
- owner->currentBuffer()->update (1);
+ owner->buffer()->text->CursorLeft();
+ owner->buffer()->update (1);
} else {
- owner->currentBuffer()->text->CursorLeft();
- owner->currentBuffer()->text->Delete();
- owner->currentBuffer()->text->sel_cursor =
- owner->currentBuffer()->text->cursor;
+ owner->buffer()->text->CursorLeft();
+ owner->buffer()->text->Delete();
+ owner->buffer()->text->sel_cursor =
+ owner->buffer()->text->cursor;
SmallUpdate(1);
}
} else {
- owner->currentBuffer()->text->Delete();
- owner->currentBuffer()->text->sel_cursor =
- owner->currentBuffer()->text->cursor;
+ owner->buffer()->text->Delete();
+ owner->buffer()->text->sel_cursor =
+ owner->buffer()->text->cursor;
SmallUpdate(1);
}
} else {
/* -------> Delete word forward. */
case LFUN_DELETE_WORD_FORWARD:
- owner->currentBuffer()->update(-2);
+ owner->buffer()->update(-2);
FreeUpdateTimer();
- owner->currentBuffer()->text->DeleteWordForward();
- owner->currentBuffer()->update( 1 );
+ owner->buffer()->text->DeleteWordForward();
+ owner->buffer()->update( 1 );
SetUpdateTimer();
moveCursorUpdate(false);
break;
/* -------> Delete word backward. */
case LFUN_DELETE_WORD_BACKWARD:
- owner->currentBuffer()->update(-2);
+ owner->buffer()->update(-2);
FreeUpdateTimer();
- owner->currentBuffer()->text->DeleteWordBackward();
- owner->currentBuffer()->update( 1 );
+ owner->buffer()->text->DeleteWordBackward();
+ owner->buffer()->update( 1 );
SetUpdateTimer();
moveCursorUpdate(false);
break;
/* -------> Kill to end of line. */
case LFUN_DELETE_LINE_FORWARD:
FreeUpdateTimer();
- owner->currentBuffer()->update(-2);
- owner->currentBuffer()->text->DeleteLineForward();
- owner->currentBuffer()->update( 1 );
+ owner->buffer()->update(-2);
+ owner->buffer()->text->DeleteLineForward();
+ owner->buffer()->update( 1 );
SetUpdateTimer();
moveCursorUpdate(false);
break;
/* -------> Set mark off. */
case LFUN_MARK_OFF:
BeforeChange();
- owner->currentBuffer()->update(0);
- owner->currentBuffer()->text->sel_cursor =
- owner->currentBuffer()->text->cursor;
+ owner->buffer()->update(0);
+ owner->buffer()->text->sel_cursor =
+ owner->buffer()->text->cursor;
setMessage(N_("Mark off"));
break;
/* -------> Set mark on. */
case LFUN_MARK_ON:
BeforeChange();
- owner->currentBuffer()->text->mark_set = 1;
- owner->currentBuffer()->update( 0 );
- owner->currentBuffer()->text->sel_cursor =
- owner->currentBuffer()->text->cursor;
+ owner->buffer()->text->mark_set = 1;
+ owner->buffer()->update( 0 );
+ owner->buffer()->text->sel_cursor =
+ owner->buffer()->text->cursor;
setMessage(N_("Mark on"));
break;
case LFUN_BACKSPACE:
{
FreeUpdateTimer();
- if (!owner->currentBuffer()->text->selection) {
+ if (!owner->buffer()->text->selection) {
if (owner->getIntl()->getTrans()->backspace()) {
- owner->currentBuffer()->text->Backspace();
- owner->currentBuffer()->text->sel_cursor =
- owner->currentBuffer()->text->cursor;
+ owner->buffer()->text->Backspace();
+ owner->buffer()->text->sel_cursor =
+ owner->buffer()->text->cursor;
SmallUpdate(1);
// It is possible to make it a lot faster still
// just comment out the lone below...
{
// Reverse the effect of LFUN_BREAKPARAGRAPH_SKIP.
- LyXCursor cursor = owner->currentBuffer()->text->cursor;
+ LyXCursor cursor = owner->buffer()->text->cursor;
FreeUpdateTimer();
- if (!owner->currentBuffer()->text->selection) {
+ if (!owner->buffer()->text->selection) {
if (cursor.pos == 0
&& !(cursor.par->added_space_top
== VSpace (VSpace::NONE))) {
- owner->currentBuffer()->text->SetParagraph
+ owner->buffer()->text->SetParagraph
(cursor.par->line_top,
cursor.par->line_bottom,
cursor.par->pagebreak_top,
VSpace(VSpace::NONE), cursor.par->added_space_bottom,
cursor.par->align,
cursor.par->labelwidthstring, 0);
- owner->currentBuffer()->update (1);
+ owner->buffer()->update (1);
} else {
- owner->currentBuffer()->text->Backspace();
- owner->currentBuffer()->text->sel_cursor
+ owner->buffer()->text->Backspace();
+ owner->buffer()->text->sel_cursor
= cursor;
SmallUpdate (1);
}
case LFUN_BREAKPARAGRAPH:
{
BeforeChange();
- owner->currentBuffer()->text->BreakParagraph(0);
+ owner->buffer()->text->BreakParagraph(0);
SmallUpdate(1);
SetUpdateTimer(0.01);
- owner->currentBuffer()->text->sel_cursor =
- owner->currentBuffer()->text->cursor;
+ owner->buffer()->text->sel_cursor =
+ owner->buffer()->text->cursor;
break;
}
case LFUN_BREAKPARAGRAPHKEEPLAYOUT:
{
BeforeChange();
- owner->currentBuffer()->text->BreakParagraph(1);
+ owner->buffer()->text->BreakParagraph(1);
SmallUpdate(1);
SetUpdateTimer(0.01);
- owner->currentBuffer()->text->sel_cursor =
- owner->currentBuffer()->text->cursor;
+ owner->buffer()->text->sel_cursor =
+ owner->buffer()->text->cursor;
break;
}
// indentation and add a "defskip" at the top.
// Otherwise, do the same as LFUN_BREAKPARAGRAPH.
- LyXCursor cursor = owner->currentBuffer()->text->cursor;
+ LyXCursor cursor = owner->buffer()->text->cursor;
BeforeChange();
if (cursor.pos == 0) {
if (cursor.par->added_space_top == VSpace(VSpace::NONE)) {
- owner->currentBuffer()->text->SetParagraph
+ owner->buffer()->text->SetParagraph
(cursor.par->line_top,
cursor.par->line_bottom,
cursor.par->pagebreak_top,
VSpace(VSpace::DEFSKIP), cursor.par->added_space_bottom,
cursor.par->align,
cursor.par->labelwidthstring, 1);
- owner->currentBuffer()->update(1);
+ owner->buffer()->update(1);
}
}
else {
- owner->currentBuffer()->text->BreakParagraph(0);
+ owner->buffer()->text->BreakParagraph(0);
SmallUpdate(1);
}
SetUpdateTimer(0.01);
- owner->currentBuffer()->text->sel_cursor = cursor;
+ owner->buffer()->text->sel_cursor = cursor;
}
break;
case LFUN_QUOTE:
BeforeChange();
- owner->currentBuffer()->text->InsertChar('\"'); // This " matches the single quote in the code
+ owner->buffer()->text->InsertChar('\"'); // This " matches the single quote in the code
SmallUpdate(1);
SetUpdateTimer();
moveCursorUpdate(false);
new_inset = new InsetUrl("htmlurl", "", "");
else
new_inset = new InsetUrl("url", "", "");
- owner->currentBuffer()->insertInset(new_inset);
+ owner->buffer()->insertInset(new_inset);
new_inset->Edit(0, 0);
}
break;
{
#ifdef NEW_TEXT
LyXParagraph::size_type pos =
- owner->currentBuffer()->text->cursor.pos;
- if(pos < owner->currentBuffer()->text->cursor.par->size())
+ owner->buffer()->text->cursor.pos;
+ if(pos < owner->buffer()->text->cursor.par->size())
#else
- int pos = owner->currentBuffer()->text->cursor.pos;
- if(pos < owner->currentBuffer()->text->cursor.par->last)
+ int pos = owner->buffer()->text->cursor.pos;
+ if(pos < owner->buffer()->text->cursor.par->last)
#endif
- dispatch_buffer = owner->currentBuffer()->text->
+ dispatch_buffer = owner->buffer()->text->
cursor.par->text[pos];
else
dispatch_buffer = "EOF";
case LFUN_GETXY:
dispatch_buffer =
- tostr(owner->currentBuffer()->text->cursor.x) + ' '
- + tostr(owner->currentBuffer()->text->cursor.y);
+ tostr(owner->buffer()->text->cursor.x) + ' '
+ + tostr(owner->buffer()->text->cursor.y);
break;
case LFUN_SETXY:
int x;
long y;
sscanf(argument.c_str(), " %d %ld", &x, &y);
- owner->currentBuffer()->text->SetCursorFromCoordinates(x, y);
+ owner->buffer()->text->SetCursorFromCoordinates(x, y);
}
break;
case LFUN_GETLAYOUT:
dispatch_buffer =
- tostr(owner->currentBuffer()->text->cursor.par->layout);
+ tostr(owner->buffer()->text->cursor.par->layout);
break;
case LFUN_GETFONT:
{
- LyXFont *font = &(owner->currentBuffer()->text->current_font);
+ LyXFont *font = &(owner->buffer()->text->current_font);
if(font->shape() == LyXFont::ITALIC_SHAPE)
dispatch_buffer = 'E';
else if(font->shape() == LyXFont::SMALLCAPS_SHAPE)
case LFUN_GETLATEX:
{
- LyXFont *font = &(owner->currentBuffer()->text->current_font);
+ LyXFont *font = &(owner->buffer()->text->current_font);
if(font->latex() == LyXFont::ON)
dispatch_buffer = 'L';
else
break;
case LFUN_GETNAME:
- setMessage(owner->currentBuffer()->getFileName());
+ setMessage(owner->buffer()->getFileName());
lyxerr.debug() << "FNAME["
- << owner->currentBuffer()->getFileName()
+ << owner->buffer()->getFileName()
<< "] " << endl;
break;
// Either change buffer or load the file
if (bufferlist.exists(s))
- owner->currentView()->setBuffer(bufferlist.getBuffer(s));
+ owner->currentView()->buffer(bufferlist.getBuffer(s));
else
- owner->currentView()->setBuffer(bufferlist.loadLyXFile(s));
+ owner->currentView()->buffer(bufferlist.loadLyXFile(s));
// Set the cursor
- owner->currentBuffer()->setCursorFromRow(row);
+ owner->buffer()->setCursorFromRow(row);
// Recenter screen
BeforeChange();
- if (owner->currentBuffer()->text->cursor.y >
+ if (owner->buffer()->text->cursor.y >
owner->currentView()->getWorkArea()->h / 2) {
owner->currentView()->getScreen()->
- Draw(owner->currentBuffer()->text->cursor.y -
+ Draw(owner->buffer()->text->cursor.y -
owner->currentView()->getWorkArea()->h/2);
} else { // <=
owner->currentView()->getScreen()->
Draw(0);
}
- owner->currentBuffer()->update(0);
+ owner->buffer()->update(0);
owner->currentView()->redraw();
}
break;
owner->getIntl()->getTrans()->
deadkey(c, get_accent(action).accent,
- owner->currentBuffer()->text);
+ owner->buffer()->text);
// Need to reset, in case the minibuffer calls these
// actions
// copied verbatim from do_accent_char
SmallUpdate(1);
SetUpdateTimer();
- owner->currentBuffer()->text->sel_cursor =
- owner->currentBuffer()->text->cursor;
+ owner->buffer()->text->sel_cursor =
+ owner->buffer()->text->cursor;
}
break;
case LFUN_INSERT_INSET_LATEX:
{
Inset *new_inset = new InsetLatex(argument);
- owner->currentBuffer()->insertInset(new_inset);
+ owner->buffer()->insertInset(new_inset);
}
break;
case LFUN_INSERT_MATRIX:
{
if (owner->currentView()->available()) {
- owner->currentBuffer()->
+ owner->buffer()->
open_new_inset(new InsetFormula(false));
- owner->currentBuffer()->
+ owner->buffer()->
the_locking_inset->LocalDispatch(action, argument.c_str());
}
}
case LFUN_MATH_DISPLAY:
{
if (owner->currentView()->available())
- owner->currentBuffer()->open_new_inset(new InsetFormula(true));
+ owner->buffer()->open_new_inset(new InsetFormula(true));
break;
}
else {
string s1 = token(s, ' ', 1);
int na = s1.empty() ? 0: atoi(s1.c_str());
- owner->currentBuffer()->
+ owner->buffer()->
open_new_inset(new InsetFormulaMacro(token(s, ' ', 0), na));
}
}
{
if (owner->currentView()->available())
- owner->currentBuffer()->open_new_inset(new InsetFormula);
+ owner->buffer()->open_new_inset(new InsetFormula);
setMessage(N_("Math editor mode"));
}
break;
new_inset->setOptions(token(lsarg, '|', 1));
} else
new_inset->setContents(lsarg);
- owner->currentBuffer()->insertInset(new_inset);
+ owner->buffer()->insertInset(new_inset);
} else {
- owner->currentBuffer()->insertInset(new_inset);
+ owner->buffer()->insertInset(new_inset);
new_inset->Edit(0,0);
}
}
InsetBibtex *new_inset
= new InsetBibtex(token(lsarg, ' ', 0),
bibstyle,
- owner->currentBuffer());
+ owner->buffer());
- owner->currentBuffer()->insertInset(new_inset);
+ owner->buffer()->insertInset(new_inset);
if (lsarg.empty()) {
new_inset->Edit(0,0);
}
if (!argument.empty()) {
string lsarg(argument);
new_inset->setContents(lsarg);
- owner->currentBuffer()->insertInset(new_inset);
+ owner->buffer()->insertInset(new_inset);
} else {
//reh 98/09/21
//get the current word for an argument
#ifdef NEW_TEXT
LyXParagraph::size_type lastpos =
- owner->currentBuffer()->text->cursor.pos - 1;
+ owner->buffer()->text->cursor.pos - 1;
// If this can't happen, let's make sure that it really don't
- Assert(owner->currentBuffer()->text->cursor.pos - 1 >= 0);
+ Assert(owner->buffer()->text->cursor.pos - 1 >= 0);
#else
- int lastpos =owner->currentBuffer()->text->cursor.pos - 1;
+ int lastpos =owner->buffer()->text->cursor.pos - 1;
//this shouldn't happen, but let's be careful
if (lastpos < 0) lastpos=0;
#endif
// note that this must be done before
// inserting the inset, or the inset will break
// the word
- string curstring(owner->currentBuffer()
+ string curstring(owner->buffer()
->text->cursor.par->GetWord(lastpos));
//make the new inset and write the current word into it
// move the cursor to the returned value of lastpos
// but only for the auto-insert
- owner->currentBuffer()->text->cursor.pos=lastpos;
+ owner->buffer()->text->cursor.pos=lastpos;
}
//put the new inset into the buffer.
// there should be some way of knowing the user
//cancelled & avoiding this, but i don't know how
- owner->currentBuffer()->insertInset(new_inset);
+ owner->buffer()->insertInset(new_inset);
}
}
break;
case LFUN_INDEX_PRINT:
{
- Inset *new_inset = new InsetPrintIndex(owner->currentBuffer());
- owner->currentBuffer()->insertInset(new_inset, "Standard", true);
+ Inset *new_inset = new InsetPrintIndex(owner->buffer());
+ owner->buffer()->insertInset(new_inset, "Standard", true);
}
break;
case LFUN_PARENTINSERT:
{
lyxerr << "arg " << argument << endl;
- Inset *new_inset = new InsetParent(argument, owner->currentBuffer());
- owner->currentBuffer()->insertInset(new_inset, "Standard", true);
+ Inset *new_inset = new InsetParent(argument, owner->buffer());
+ owner->buffer()->insertInset(new_inset, "Standard", true);
}
break;
case LFUN_CHILDINSERT:
{
- Inset *new_inset = new InsetInclude(argument,owner->currentBuffer());
- owner->currentBuffer()->insertInset(new_inset, "Standard", true);
+ Inset *new_inset = new InsetInclude(argument,owner->buffer());
+ owner->buffer()->insertInset(new_inset, "Standard", true);
new_inset->Edit(0,0);
}
break;
case LFUN_CHILDOPEN:
{
string filename = MakeAbsPath(argument,
- OnlyPath(owner->currentBuffer()->getFileName()));
+ OnlyPath(owner->buffer()->getFileName()));
setMessage(N_("Opening child document ") +
MakeDisplayPath(filename) + "...");
owner->currentView()->savePosition();
if (bufferlist.exists(filename))
- owner->currentView()->setBuffer(bufferlist.getBuffer(filename));
+ owner->currentView()->buffer(bufferlist.getBuffer(filename));
else
- owner->currentView()->setBuffer(bufferlist.loadLyXFile(filename));
+ owner->currentView()->buffer(bufferlist.loadLyXFile(filename));
}
break;
setErrorMessage(N_("Unknown kind of footnote"));
break;
}
- owner->currentBuffer()->text->InsertFootnoteEnvironment(kind);
- owner->currentBuffer()->update(1);
+ owner->buffer()->text->InsertFootnoteEnvironment(kind);
+ owner->buffer()->update(1);
}
break;
case LFUN_SELFINSERT:
{
for (string::size_type i = 0; i < argument.length(); ++i) {
- owner->currentBuffer()->text->InsertChar(argument[i]);
+ owner->buffer()->text->InsertChar(argument[i]);
// This needs to be in the loop, or else we
// won't break lines correctly. (Asger)
SmallUpdate(1);
}
SetUpdateTimer();
- owner->currentBuffer()->text->sel_cursor =
- owner->currentBuffer()->text->cursor;
+ owner->buffer()->text->sel_cursor =
+ owner->buffer()->text->cursor;
moveCursorUpdate(false);
}
break;
case LFUN_UNKNOWN_ACTION:
{
- if (owner->currentBuffer()->isReadonly()) {
+ if (owner->buffer()->isReadonly()) {
LyXBell();
setErrorMessage(N_("Document is read only"));
break;
* true (on). */
if ( lyxrc->auto_region_delete ) {
- if (owner->currentBuffer()->text->selection){
- owner->currentBuffer()->text->CutSelection(false);
- owner->currentBuffer()->update(-1);
+ if (owner->buffer()->text->selection){
+ owner->buffer()->text->CutSelection(false);
+ owner->buffer()->update(-1);
}
}
for (string::size_type i = 0; i < argument.length(); ++i) {
if (greek_kb_flag) {
if (!math_insert_greek(argument[i]))
- owner->getIntl()->getTrans()->TranslateAndInsert(argument[i], owner->currentBuffer()->text);
+ owner->getIntl()->getTrans()->TranslateAndInsert(argument[i], owner->buffer()->text);
} else
- owner->getIntl()->getTrans()->TranslateAndInsert(argument[i], owner->currentBuffer()->text);
+ owner->getIntl()->getTrans()->TranslateAndInsert(argument[i], owner->buffer()->text);
}
SmallUpdate(1);
SetUpdateTimer();
- owner->currentBuffer()->text->sel_cursor =
- owner->currentBuffer()->text->cursor;
+ owner->buffer()->text->sel_cursor =
+ owner->buffer()->text->cursor;
moveCursorUpdate(false);
return string();
} else {
LyXFileDlg fileDlg;
if (owner->currentView()->available()) {
- string trypath = owner->currentBuffer()->filepath;
+ string trypath = owner->buffer()->filepath;
// If directory is writeable, use this as default.
if (IsDirWriteable(trypath) == 1)
initpath = trypath;
return;
break;
case 2: // No: switch to the open document
- owner->currentView()->setBuffer(bufferlist.getBuffer(s));
+ owner->currentView()->buffer(bufferlist.getBuffer(s));
return;
case 3: // Cancel: Do nothing
owner->getMiniBuffer()->Set(_("Canceled."));
owner->getMiniBuffer()->Set(_("Opening document"),
MakeDisplayPath(s), "...");
XFlush(fl_display);
- owner->currentView()->setBuffer(
+ owner->currentView()->buffer(
bufferlist.loadLyXFile(s));
owner->getMiniBuffer()->Set(_("Document"),
MakeDisplayPath(s),
// find a free buffer
lyxerr.debug() << "Find a free buffer." << endl;
- owner->currentView()->setBuffer(bufferlist.newFile(s,templname));
+ owner->currentView()->buffer(bufferlist.newFile(s,templname));
}
LyXFileDlg fileDlg;
if (owner->currentView()->available()) {
- string trypath = owner->currentBuffer()->filepath;
+ string trypath = owner->buffer()->filepath;
// If directory is writeable, use this as default.
if (IsDirWriteable(trypath) == 1)
initpath = trypath;
MakeDisplayPath(filename), "...");
Buffer * openbuf = bufferlist.loadLyXFile(filename);
if (openbuf) {
- owner->currentView()->setBuffer(openbuf);
+ owner->currentView()->buffer(openbuf);
owner->getMiniBuffer()->Set(_("Document"),
MakeDisplayPath(filename),
_("opened."));
LyXFileDlg fileDlg;
if (owner->currentView()->available()) {
- string trypath = owner->currentBuffer()->filepath;
+ string trypath = owner->buffer()->filepath;
// If directory is writeable, use this as default.
if (IsDirWriteable(trypath) == 1)
initpath = trypath;
return;
break;
case 2: // No: switch to the open document
- owner->currentView()->setBuffer(bufferlist.getBuffer(s));
+ owner->currentView()->buffer(bufferlist.getBuffer(s));
return;
case 3: // Cancel: Do nothing
owner->getMiniBuffer()->Set(_("Canceled."));
return;
}
- owner->currentView()->setBuffer(bufferlist.newFile(s,string()));
+ owner->currentView()->buffer(bufferlist.newFile(s,string()));
owner->getMiniBuffer()->Set(_("Importing ASCII file"),
MakeDisplayPath(filename), "...");
// Insert ASCII file
LyXFileDlg fileDlg;
if (owner->currentView()->available()) {
- string trypath = owner->currentBuffer()->filepath;
+ string trypath = owner->buffer()->filepath;
// If directory is writeable, use this as default.
if (IsDirWriteable(trypath) == 1)
initpath = trypath;
return;
break;
case 2: // No: switch to the open document
- owner->currentView()->setBuffer(
+ owner->currentView()->buffer(
bufferlist.getBuffer(LyXfilename));
return;
case 3: // Cancel: Do nothing
openbuf = myImport.run();
}
if (openbuf) {
- owner->currentView()->setBuffer(openbuf);
+ owner->currentView()->buffer(openbuf);
owner->getMiniBuffer()->Set(isnoweb ?
_("Noweb file ") : _("LateX file "),
MakeDisplayPath(filename),
LyXFileDlg fileDlg;
if (owner->currentView()->available()) {
- string trypath = owner->currentBuffer()->filepath;
+ string trypath = owner->buffer()->filepath;
// If directory is writeable, use this as default.
if (IsDirWriteable(trypath) == 1)
initpath = trypath;
// Inserts document
owner->getMiniBuffer()->Set(_("Inserting document"),
MakeDisplayPath(filename), "...");
- bool res = owner->currentBuffer()->insertLyXFile(filename);
+ bool res = owner->buffer()->insertLyXFile(filename);
if (res) {
owner->getMiniBuffer()->Set(_("Document"),
MakeDisplayPath(filename),
void LyXFunc::reloadBuffer()
{
- string fn = owner->currentBuffer()->getFileName();
- if (bufferlist.close(owner->currentBuffer()))
- owner->currentView()->setBuffer(bufferlist.loadLyXFile(fn));
+ string fn = owner->buffer()->getFileName();
+ if (bufferlist.close(owner->buffer()))
+ owner->currentView()->buffer(bufferlist.loadLyXFile(fn));
}
void LyXFunc::CloseBuffer()
{
- if (bufferlist.close(owner->currentBuffer()) && !quitting) {
+ if (bufferlist.close(owner->buffer()) && !quitting) {
if (bufferlist.empty()) {
// need this otherwise SEGV may occur while trying to
// set variables that don't exist
CloseAllBufferRelatedPopups();
}
else {
- owner->currentView()->setBuffer(bufferlist.first());
+ owner->currentView()->buffer(bufferlist.first());
}
}
}
{
bool found = false;
Inset * inset = 0;
- LyXCursor cursor = owner->currentBuffer()->text->cursor;
+ LyXCursor cursor = owner->buffer()->text->cursor;
#ifdef NEW_TEXT
LyXParagraph::size_type pos = cursor.pos;
#else
// 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;
}
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;
}
return 0;
}
if (event->type != KeyPress)
- lyxerr <<"LyXLookupString: wrong event type"
- +string(event->type));
+ lyxerr << "LyXLookupString: wrong event type"
+ << event->type << endl;
Status status_return;
result = XmbLookupString(xic, &event->xkey, buffer_return,
void CloseLyXLookup()
{
if (xic) {
- lyxerr.debug("CloseLyXLookup: destroying input context");
+ lyxerr.debug() << "CloseLyXLookup: destroying input context"
+ << endl;
XDestroyIC(xic);
XCloseIM(xim);
}
#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;
}
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();
+ 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;
- } else {
- // Check if RCS/*,v exists.
- tmp = AddName(AddPath(OnlyPath(fn), "RCS"), fn);
- tmp += ",v";
- lyxerr[Debug::LYXVC] << "Checking if file is under vc: "
- << tmp << endl;
- if (f.newFile(tmp).readable()) {
- lyxerr[Debug::LYXVC] << "Yes it is under vc."<< endl;
- master = tmp;
- backend = RCS_VCS;
- scanMaster();
- return true;
- }
}
- // If either one, return true
-
// file is not under any VCS.
return false;
}
}
-void LyXVC::scanMaster()
-{
- 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;
- }
- }
-}
-
-
-void LyXVC::setBuffer(Buffer * buf)
+void LyXVC::buffer(Buffer * buf)
{
- _owner = 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;
}
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();
+
}
if (AskQuestion(_("When you revert, you will loose all changes made"),
_("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;
}
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)
{
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;
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;
-}
// -*- C++ -*-
-#ifndef _LYX_VC_H_
-#define _LYX_VC_H_
+#ifndef LYX_VC_H
+#define LYX_VC_H
#ifdef __GNUG__
#pragma interface
#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
- 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,
- but is not as extensive as that one. See examples/VC.lyx for a simple
- tutorial and manual for the use of the version control system in LyX.
-
- LyXVC use this algorithm when it searches for VC files:
- for RCS it searches for <filename>,v and RCS/<filename>,v similar
- should be done for CVS. By doing this there doesn't need to be any
- special support for VC in the lyx format, and this is especially good
- when the lyx format will be a subset of LaTeX.
- */
+/** 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,
+ but is not as extensive as that one. See examples/VC.lyx for a simple
+ tutorial and manual for the use of the version control system in LyX.
+
+ LyXVC use this algorithm when it searches for VC files:
+ for RCS it searches for <filename>,v and RCS/<filename>,v similar
+ should be done for CVS. By doing this there doesn't need to be any
+ special support for VC in the lyx format, and this is especially good
+ when the lyx format will be a subset of LaTeX.
+*/
class LyXVC {
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();
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);
+ static void logClose(FL_OBJECT *, long);
///
- static void logUpdate(FL_OBJECT*, long);
+ static void logUpdate(FL_OBJECT *, long);
protected:
private:
///
- int doVCCommand(string const&);
+ Buffer * owner_;
- /** 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;
-
///
- 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
+ FD_LaTeXLog * browser; // FD_LaTeXLog is just a browser with a
// close button. Unfortunately we can not use the standard callbacks.
};
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();
case 18: // The first item with lastfiles.
default:
men->currentView()
- ->setBuffer(bufferlist
+ ->buffer(bufferlist
.loadLyXFile((*lastfiles)[choice - 18]));
break;
}
case 6: // The first item with lastfiles.
default:
men->currentView()
- ->setBuffer(bufferlist
+ ->buffer(bufferlist
.loadLyXFile((*lastfiles)[choice - 6]));
break;
}
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
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));
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),
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),
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);
void Menus::handleBufferMenu(int choice)
{
- currentView()->setBuffer(bufferlist.getBuffer(choice));
+ currentView()->buffer(bufferlist.getBuffer(choice));
}
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();
}
-extern "C" void C_MiniBuffer_TimerCB(FL_OBJECT *ob, long data)
+extern "C" void C_MiniBuffer_TimerCB(FL_OBJECT * ob, long data)
{
MiniBuffer::TimerCB(ob, data);
}
-void MiniBuffer::ExecutingCB(FL_OBJECT *ob, long)
+void MiniBuffer::ExecutingCB(FL_OBJECT * ob, long)
{
- MiniBuffer *obj = (MiniBuffer*)ob->u_vdata;
+ MiniBuffer * obj = static_cast<MiniBuffer*>(ob->u_vdata);
lyxerr.debug() << "Getting ready to execute: " << obj->cur_cmd << endl;
fl_set_focus_object(obj->owner->getForm(),
obj->owner->currentView()->getWorkArea());
<< "\nArg : " << arg << endl;
// Dispatch only returns requested data for a few commands (ale)
- string res=obj->owner->getLyXFunc()->Dispatch(function.c_str(),
+ string res = obj->owner->getLyXFunc()->Dispatch(function.c_str(),
arg.c_str());
lyxerr.debug() << "Minibuffer Res: " << res << endl;
obj->shows_no_match = false;
return ;
}
-extern "C" void C_MiniBuffer_ExecutingCB(FL_OBJECT *ob, long data)
+extern "C" void C_MiniBuffer_ExecutingCB(FL_OBJECT * ob, long data)
{
MiniBuffer::TimerCB(ob, data);
}
// This is not as dirty as it seems, the hidden buttons removed by this
// function were just kludges for an uncomplete keyboard callback (ale)
-int MiniBuffer::peek_event(FL_OBJECT *ob, int event, FL_Coord, FL_Coord,
+int MiniBuffer::peek_event(FL_OBJECT * ob, int event, FL_Coord, FL_Coord,
int key, void */*xev*/)
{
- MiniBuffer *mini = (MiniBuffer*)ob->u_vdata;
+ MiniBuffer * mini = static_cast<MiniBuffer*>(ob->u_vdata);
- if (event==FL_KEYBOARD){
+ if (event == FL_KEYBOARD){
switch (key) {
case XK_Down:
mini->history_idx++;
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;
return 0;
}
-extern "C" int C_MiniBuffer_peek_event(FL_OBJECT *ob, int event,
+extern "C" int C_MiniBuffer_peek_event(FL_OBJECT * ob, int event,
FL_Coord, FL_Coord,
- int key, void *xev)
+ int key, void * xev)
{
return MiniBuffer::peek_event(ob,event,0,0,key,xev);
}
}
-FL_OBJECT *MiniBuffer::add(int type, FL_Coord x, FL_Coord y,
+FL_OBJECT * MiniBuffer::add(int type, FL_Coord x, FL_Coord y,
FL_Coord w, FL_Coord h)
{
- FL_OBJECT *obj;
+ FL_OBJECT * obj;
the_buffer = obj = fl_add_input(type,x,y,w,h,text.c_str());
fl_set_object_boxtype(obj,FL_DOWN_BOX);
// 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;
// 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
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())
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 += '}';
break;
case '£':
- if (current_view->currentBuffer()->params.inputenc == "default") {
+ if (current_view->buffer()->params.inputenc == "default") {
file += "\\pounds{}";
column += 8;
} else {
// 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())
texrow.newline();
}
- BufferParams * params = ¤t_view->currentBuffer()->params;
+ BufferParams * params = ¤t_view->buffer()->params;
bool footer_in_body = true;
switch (footnotekind) {
case LyXParagraph::FOOTNOTE:
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;
}
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);
}
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);
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];
}
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)
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;
#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)){
}
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 {
--- /dev/null
+#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 &)
+{
+}
--- /dev/null
+// -*- 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
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}"
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]
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