#include "TextCache.h"
#include "bufferlist.h"
#include "insets/insetbib.h"
+#include "insets/insettext.h"
#include "lyx_gui_misc.h"
#include "lyxrc.h"
#include "intl.h"
extern BufferList bufferlist;
extern char ascii_type;
-extern "C" void TimerCB(FL_OBJECT *, long);
extern void sigchldhandler(pid_t pid, int * status);
extern int bibitemMaxWidth(BufferView *, LyXFont const &);
: bv_(b), owner_(o), cursor_timeout(400)
{
buffer_ = 0;
-#if 0
- workarea_ = new WorkArea(bv_, xpos, ypos, width, height);
-#else
workarea_ = new WorkArea(xpos, ypos, width, height);
-#endif
// Setup the signals
workarea_->scrollCB.connect(slot(this, &BufferView::Pimpl::scrollCB));
workarea_->workAreaExpose
void BufferView::Pimpl::resize(int xpos, int ypos, int width, int height)
{
workarea_->resize(xpos, ypos, width, height);
- update(SELECT);
+ update(bv_->text, SELECT);
redraw();
}
LyXParagraph * par = 0;
LyXParagraph * selstartpar = 0;
LyXParagraph * selendpar = 0;
+ UpdatableInset * the_locking_inset;
+
int pos = 0;
int selstartpos = 0;
int selendpos = 0;
selendpos = bv_->text->sel_end_cursor.pos();
selection = bv_->text->selection;
mark_set = bv_->text->mark_set;
+ the_locking_inset = bv_->text->the_locking_inset;
delete bv_->text;
bv_->text = new LyXText(bv_);
} else {
bv_->text->SetCursor(bv_, selstartpar, selstartpos);
bv_->text->sel_cursor = bv_->text->cursor;
bv_->text->SetCursor(bv_, selendpar, selendpos);
- bv_->text->SetSelection();
+ bv_->text->SetSelection(bv_);
bv_->text->SetCursor(bv_, par, pos);
} else {
bv_->text->SetCursor(bv_, par, pos);
bv_->text->sel_cursor = bv_->text->cursor;
bv_->text->selection = false;
}
+ // remake the inset locking
+ bv_->text->the_locking_inset = the_locking_inset;
}
bv_->text->first = screen_->TopCursorVisible(bv_->text);
buffer_->resizeInsets(bv_);
bv_->setState();
AllowInput(bv_);
- // Now if the title form still exist kill it
- TimerCB(0, 0);
-
+ owner_->getDialogs()->hideSplash();
+
return 0;
}
bv_->text->SetCursorFromCoordinates(bv_, x, y + bv_->text->first);
if (!bv_->text->selection)
- update(BufferView::UPDATE); // Maybe an empty line was deleted
+ update(bv_->text, BufferView::UPDATE); // Maybe an empty line was deleted
- bv_->text->SetSelection();
+ bv_->text->SetSelection(bv_);
screen_->ToggleToggle(bv_->text, bv_);
fitCursor(bv_->text);
screen_->ShowCursor(bv_->text, bv_);
void BufferView::Pimpl::doubleClick(int /*x*/, int /*y*/, unsigned int button)
{
// select a word
- if (buffer_ && !bv_->theLockingInset()) {
- if (screen_ && button == 1) {
- screen_->HideCursor();
- screen_->ToggleSelection(bv_->text, bv_);
- bv_->text->SelectWord(bv_);
- screen_->ToggleSelection(bv_->text, bv_, false);
- /* This will fit the cursor on the screen
- * if necessary */
- update(BufferView::SELECT|BufferView::FITCUR);
- }
- }
+ if (!buffer_)
+ return;
+
+ LyXText * text = bv_->getLyXText();
+
+ if (text->bv_owner && bv_->theLockingInset())
+ return;
+
+ if (screen_ && button == 1) {
+ screen_->HideCursor();
+ screen_->ToggleSelection(text, bv_);
+ text->SelectWord(bv_);
+ screen_->ToggleSelection(text, bv_, false);
+ /* This will fit the cursor on the screen
+ * if necessary */
+ update(text, BufferView::SELECT|BufferView::FITCUR);
+ }
}
void BufferView::Pimpl::tripleClick(int /*x*/, int /*y*/, unsigned int button)
{
// select a line
- if (buffer_ && screen_ && !bv_->theLockingInset() && (button == 1)) {
+ if (buffer_)
+ return;
+
+ LyXText * text = bv_->getLyXText();
+
+ if (text->bv_owner && bv_->theLockingInset())
+ return;
+
+ if (screen_ && (button == 1)) {
screen_->HideCursor();
- screen_->ToggleSelection(bv_->text, bv_);
- bv_->text->CursorHome(bv_);
- bv_->text->sel_cursor = bv_->text->cursor;
- bv_->text->CursorEnd(bv_);
- bv_->text->SetSelection();
- screen_->ToggleSelection(bv_->text, bv_, false);
+ screen_->ToggleSelection(text, bv_);
+ text->CursorHome(bv_);
+ text->sel_cursor = text->cursor;
+ text->CursorEnd(bv_);
+ text->SetSelection(bv_);
+ screen_->ToggleSelection(text, bv_, false);
/* This will fit the cursor on the screen
* if necessary */
- update(BufferView::SELECT|BufferView::FITCUR);
+ update(text, BufferView::SELECT|BufferView::FITCUR);
}
}
// update(1) -> update(1 + 2 + 4) -> update(7) -> update(SELECT|FITCUR|CHANGE)
// update(3) -> update(1) -> update(1) -> update(SELECT)
-void BufferView::Pimpl::update(BufferView::UpdateCodes f)
+void BufferView::Pimpl::update(LyXText * text, BufferView::UpdateCodes f)
{
owner_->updateLayoutChoice();
- if (!bv_->text->selection && (f & SELECT)) {
- bv_->text->sel_cursor = bv_->text->cursor;
+ if (!text->selection && (f & SELECT)) {
+ text->sel_cursor = text->cursor;
}
- bv_->text->FullRebreak(bv_);
+ text->FullRebreak(bv_);
- update();
+ if (text->inset_owner) {
+ text->inset_owner->SetUpdateStatus(bv_, InsetText::CURSOR_PAR);
+ bv_->updateInset(text->inset_owner, true);
+ } else
+ update();
if ((f & FITCUR)) {
- fitCursor(bv_->text);
+ fitCursor(text);
}
if ((f & CHANGE)) {
}
-void BufferView::Pimpl::beforeChange()
+void BufferView::Pimpl::beforeChange(LyXText * text)
{
toggleSelection();
- bv_->text->ClearSelection();
+ text->ClearSelection();
}
string fname = saved_positions[i].filename;
- beforeChange();
+ beforeChange(bv_->text);
if (fname != buffer_->fileName()) {
Buffer * b = bufferlist.exists(fname) ?
bv_->text->SetCursor(bv_, par,
min(par->Last(), saved_positions[i].par_pos));
- update(BufferView::SELECT|BufferView::FITCUR);
+ update(bv_->text, BufferView::SELECT|BufferView::FITCUR);
if (i > 0)
owner_->getMiniBuffer()->Set(_("Moved to bookmark ") + tostr(i));
}
void BufferView::Pimpl::center()
{
- beforeChange();
+ beforeChange(bv_->text);
if (bv_->text->cursor.y() > static_cast<int>((workarea_->height() / 2))) {
screen_->Draw(bv_->text, bv_, bv_->text->cursor.y() - workarea_->height() / 2);
} else {
screen_->Draw(bv_->text, bv_, 0);
}
- update(BufferView::SELECT|BufferView::FITCUR);
+ update(bv_->text, BufferView::SELECT|BufferView::FITCUR);
redraw();
}
if (!buffer_) return;
screen_->HideCursor();
- bv_->beforeChange();
+ beforeChange(bv_->text);
string const clip(workarea_->getClipboard());
} else {
bv_->text->InsertStringA(bv_, clip);
}
- update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
+ update(bv_->text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
}