mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 10:00:33 +00:00
the buffer patch, moved Buffer::text to BufferView, moved Buffer::update(short) to BufferView::update(short), some whitespace changes
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@362 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
f6ec60f98e
commit
ee1229d743
32
ChangeLog
32
ChangeLog
@ -1,3 +1,33 @@
|
||||
1999-12-10 Lars Gullik Bjønnes <larsbj@lyx.org>
|
||||
|
||||
* src/buffer.h: removed the two friends from Buffer. Some changes
|
||||
because of this. Buffer::getFileName and Buffer::setFileName
|
||||
renamed to Buffer::fileName() and Buffer::fileName(...).
|
||||
|
||||
1999-12-09 Lars Gullik Bjønnes <larsbj@lyx.org>
|
||||
|
||||
* buffer.[Ch], BufferView.[Ch] + other files: Moved Buffer::text
|
||||
and Buffer::update(short) to BufferView. This move is currently
|
||||
controlled by a define MOVE_TEXT, this will be removed when all
|
||||
shows to be ok. This move paves the way for better separation
|
||||
between buffer contents and buffer view. One side effect is that
|
||||
the BufferView needs a rebreak when swiching buffers, if we want
|
||||
to avoid this we can add a cache that holds pointers to LyXText's
|
||||
that is not currently in use.
|
||||
|
||||
* buffer.[Ch], lyx_main.C: small changes to the "-export" patch by
|
||||
André Pönitz.
|
||||
|
||||
1999-11-18 André Pönitz <poenitz@mathematik.tu-chemnitz.de>
|
||||
|
||||
* buffer.[Ch]: Dispatch() - new dispatcher on the buffer level
|
||||
|
||||
* lyx_main.C: new command line option -x (or --execute) and
|
||||
-e (or --export). Now direct conversion from .lyx to .tex
|
||||
(.dvi, .ps, ...) is possible ('lyx file.lyx --export latex')
|
||||
Unfortunately, X is still needed and the GUI pops up during the
|
||||
process...
|
||||
|
||||
1999-12-07 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
|
||||
|
||||
* src/Spacing.C: add a using directive to bring stream stuff into
|
||||
@ -400,7 +430,7 @@
|
||||
* lib/reLyX/configure.in: make sure that the prefix is set
|
||||
correctly in LYX_DIR.
|
||||
|
||||
1999-11-18 Andre' Poenitz <poenitz@mathematik.tu-chemnitz.de>
|
||||
1999-11-18 André Pönitz <poenitz@mathematik.tu-chemnitz.de>
|
||||
|
||||
* src/commandtags.h: introduction of a new tag 'LFUN_SEQUENCE' to
|
||||
be used by 'command-sequence' this allows to bind a key to a
|
||||
|
@ -184,6 +184,7 @@ dnl Check the version of g++
|
||||
elif test $ac_cv_prog_cxx_g = yes; then
|
||||
case $gxx_version in
|
||||
2.7*) CXXFLAGS="$lyx_opt";;
|
||||
2.95.1) CXXFLAGS="-g $lyx_opt -fpermissive";;
|
||||
2.95.*) CXXFLAGS="-g $lyx_opt";;
|
||||
*) CXXFLAGS="-g $lyx_opt -fno-exceptions -fno-rtti";;
|
||||
esac
|
||||
|
674
src/BufferView.C
674
src/BufferView.C
@ -55,6 +55,7 @@ extern void ToggleFloat();
|
||||
extern void MenuPasteSelection(char at);
|
||||
extern InsetUpdateStruct *InsetUpdateList;
|
||||
extern void UpdateInsetUpdateList();
|
||||
extern void FreeUpdateTimer();
|
||||
|
||||
// This is _very_ temporary
|
||||
FL_OBJECT * figinset_canvas;
|
||||
@ -64,7 +65,9 @@ BufferView::BufferView(LyXView *o, int xpos, int ypos,
|
||||
: owner_(o)
|
||||
{
|
||||
buffer_ = 0;
|
||||
|
||||
#ifdef MOVE_TEXT
|
||||
text = 0;
|
||||
#endif
|
||||
screen = 0;
|
||||
work_area = 0;
|
||||
figinset_canvas = 0;
|
||||
@ -82,12 +85,22 @@ BufferView::BufferView(LyXView *o, int xpos, int ypos,
|
||||
}
|
||||
|
||||
|
||||
BufferView::~BufferView()
|
||||
{
|
||||
#ifdef MOVE_TEXT
|
||||
delete text;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void BufferView::buffer(Buffer *b)
|
||||
{
|
||||
lyxerr[Debug::INFO] << "Setting buffer in BufferView" << endl;
|
||||
if (buffer_) {
|
||||
buffer_->InsetSleep();
|
||||
buffer_->delUser(this);
|
||||
delete text;
|
||||
text = 0;
|
||||
}
|
||||
|
||||
// Set current buffer
|
||||
@ -110,12 +123,21 @@ void BufferView::buffer(Buffer *b)
|
||||
buffer_->addUser(this);
|
||||
owner_->getMenus()->showMenus();
|
||||
// If we don't have a text object for this, we make one
|
||||
#ifdef MOVE_TEXT
|
||||
if (text == 0)
|
||||
resizeCurrentBuffer();
|
||||
else {
|
||||
updateScreen();
|
||||
updateScrollbar();
|
||||
}
|
||||
#else
|
||||
if (buffer_->text == 0)
|
||||
resizeCurrentBuffer();
|
||||
else {
|
||||
updateScreen();
|
||||
updateScrollbar();
|
||||
}
|
||||
#endif
|
||||
screen->first = screen->TopCursorVisible();
|
||||
redraw();
|
||||
updateAllVisibleBufferRelatedPopups();
|
||||
@ -138,12 +160,21 @@ void BufferView::updateScreen()
|
||||
// Regenerate the screen.
|
||||
if (screen)
|
||||
delete screen;
|
||||
#ifdef MOVE_TEXT
|
||||
screen = new LyXScreen(FL_ObjWin(work_area),
|
||||
work_area->w,
|
||||
work_area->h,
|
||||
work_area->x,
|
||||
work_area->y,
|
||||
text);
|
||||
#else
|
||||
screen = new LyXScreen(FL_ObjWin(work_area),
|
||||
work_area->w,
|
||||
work_area->h,
|
||||
work_area->x,
|
||||
work_area->y,
|
||||
buffer_->text);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -199,8 +230,13 @@ void BufferView::updateScrollbar()
|
||||
long cbth = 0;
|
||||
long cbsf = 0;
|
||||
|
||||
#ifdef MOVE_TEXT
|
||||
if (text)
|
||||
cbth = text->height;
|
||||
#else
|
||||
if (buffer_->text)
|
||||
cbth = buffer_->text->height;
|
||||
#endif
|
||||
if (screen)
|
||||
cbsf = screen->first;
|
||||
|
||||
@ -230,16 +266,20 @@ void BufferView::updateScrollbar()
|
||||
fl_set_slider_bounds(scrollbar, 0,
|
||||
maximum_height - work_area->h);
|
||||
#if FL_REVISION > 85
|
||||
#ifdef MOVE_TEXT
|
||||
double lineh = text->DefaultHeight();
|
||||
#else
|
||||
double lineh = buffer_->text->DefaultHeight();
|
||||
#endif
|
||||
fl_set_slider_increment(scrollbar, work_area->h-lineh, lineh);
|
||||
#endif
|
||||
if (maxfloat>0){
|
||||
if ((hfloat/maxfloat) * float(height2) < 3)
|
||||
if (maxfloat > 0){
|
||||
if ((hfloat / maxfloat) * float(height2) < 3)
|
||||
fl_set_slider_size(scrollbar,
|
||||
3/float(height2));
|
||||
3 / float(height2));
|
||||
else
|
||||
fl_set_slider_size(scrollbar,
|
||||
hfloat/maxfloat);
|
||||
hfloat / maxfloat);
|
||||
} else
|
||||
fl_set_slider_size(scrollbar, hfloat);
|
||||
fl_set_slider_precision(scrollbar, 0);
|
||||
@ -249,10 +289,17 @@ void BufferView::updateScrollbar()
|
||||
void BufferView::redoCurrentBuffer()
|
||||
{
|
||||
lyxerr[Debug::INFO] << "BufferView::redoCurrentBuffer" << endl;
|
||||
#ifdef MOVE_TEXT
|
||||
if (text) {
|
||||
resize();
|
||||
owner_->updateLayoutChoice();
|
||||
}
|
||||
#else
|
||||
if (buffer_ && buffer_->text) {
|
||||
resize();
|
||||
owner_->updateLayoutChoice();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -273,6 +320,20 @@ int BufferView::resizeCurrentBuffer()
|
||||
|
||||
owner_->getMiniBuffer()->Set(_("Formatting document..."));
|
||||
|
||||
#ifdef MOVE_TEXT
|
||||
if (text) {
|
||||
par = text->cursor.par;
|
||||
pos = text->cursor.pos;
|
||||
selstartpar = text->sel_start_cursor.par;
|
||||
selstartpos = text->sel_start_cursor.pos;
|
||||
selendpar = text->sel_end_cursor.par;
|
||||
selendpos = text->sel_end_cursor.pos;
|
||||
selection = text->selection;
|
||||
mark_set = text->mark_set;
|
||||
delete text;
|
||||
}
|
||||
text = new LyXText(work_area->w, buffer_);
|
||||
#else
|
||||
if (buffer_->text) {
|
||||
par = buffer_->text->cursor.par;
|
||||
pos = buffer_->text->cursor.pos;
|
||||
@ -285,9 +346,32 @@ int BufferView::resizeCurrentBuffer()
|
||||
delete buffer_->text;
|
||||
}
|
||||
buffer_->text = new LyXText(work_area->w, buffer_);
|
||||
#endif
|
||||
|
||||
updateScreen();
|
||||
|
||||
|
||||
#ifdef MOVE_TEXT
|
||||
if (par) {
|
||||
text->selection = true;
|
||||
/* at this point just
|
||||
* to avoid the Delete-
|
||||
* Empty-Paragraph
|
||||
* Mechanism when
|
||||
* setting the cursor */
|
||||
text->mark_set = mark_set;
|
||||
if (selection) {
|
||||
text->SetCursor(selstartpar, selstartpos);
|
||||
text->sel_cursor = text->cursor;
|
||||
text->SetCursor(selendpar, selendpos);
|
||||
text->SetSelection();
|
||||
text->SetCursor(par, pos);
|
||||
} else {
|
||||
text->SetCursor(par, pos);
|
||||
text->sel_cursor = text->cursor;
|
||||
text->selection = false;
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (par) {
|
||||
buffer_->text->selection = true;
|
||||
/* at this point just
|
||||
@ -308,6 +392,7 @@ int BufferView::resizeCurrentBuffer()
|
||||
buffer_->text->selection = false;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
screen->first = screen->TopCursorVisible(); /* this will scroll the
|
||||
* screen such that the
|
||||
* cursor becomes
|
||||
@ -331,9 +416,33 @@ void BufferView::gotoError()
|
||||
|
||||
screen->HideCursor();
|
||||
BeforeChange();
|
||||
#ifdef MOVE_TEXT
|
||||
update(-2);
|
||||
#else
|
||||
buffer_->update(-2);
|
||||
#endif
|
||||
LyXCursor tmp;
|
||||
|
||||
|
||||
#ifdef MOVE_TEXT
|
||||
if (!text->GotoNextError()) {
|
||||
if (text->cursor.pos
|
||||
|| text->cursor.par != text->FirstParagraph()) {
|
||||
tmp = text->cursor;
|
||||
text->cursor.par = text->FirstParagraph();
|
||||
text->cursor.pos = 0;
|
||||
if (!text->GotoNextError()) {
|
||||
text->cursor = tmp;
|
||||
owner_->getMiniBuffer()->Set(_("No more errors"));
|
||||
LyXBell();
|
||||
}
|
||||
} else {
|
||||
owner_->getMiniBuffer()->Set(_("No more errors"));
|
||||
LyXBell();
|
||||
}
|
||||
}
|
||||
update(0);
|
||||
text->sel_cursor = text->cursor;
|
||||
#else
|
||||
if (!buffer_->text->GotoNextError()) {
|
||||
if (buffer_->text->cursor.pos
|
||||
|| buffer_->text->cursor.par !=
|
||||
@ -355,6 +464,7 @@ void BufferView::gotoError()
|
||||
buffer_->update(0);
|
||||
buffer_->text->sel_cursor =
|
||||
buffer_->text->cursor;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -563,7 +673,11 @@ void BufferView::ScrollCB(FL_OBJECT * ob, long)
|
||||
view->screen->Draw(view->current_scrollbar_value);
|
||||
|
||||
if (cursor_follows_scrollbar) {
|
||||
#ifdef MOVE_TEXT
|
||||
LyXText * vbt = view->text;
|
||||
#else
|
||||
LyXText * vbt = view->buffer_->text;
|
||||
#endif
|
||||
int height = vbt->DefaultHeight();
|
||||
|
||||
if (vbt->cursor.y < view->screen->first + height) {
|
||||
@ -617,13 +731,22 @@ int BufferView::ScrollUp(long time)
|
||||
|
||||
if (value == 0)
|
||||
return 0;
|
||||
|
||||
#ifdef MOVE_TEXT
|
||||
float add_value = (text->DefaultHeight()
|
||||
+ float(time) * float(time) * 0.125);
|
||||
|
||||
if (add_value > work_area->h)
|
||||
add_value = float(work_area->h -
|
||||
text->DefaultHeight());
|
||||
#else
|
||||
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());
|
||||
#endif
|
||||
|
||||
value -= add_value;
|
||||
|
||||
@ -649,13 +772,22 @@ int BufferView::ScrollDown(long time)
|
||||
|
||||
if (value == max)
|
||||
return 0;
|
||||
|
||||
#ifdef MOVE_TEXT
|
||||
float add_value = (text->DefaultHeight()
|
||||
+ float(time) * float(time) * 0.125);
|
||||
|
||||
if (add_value > work_area->h)
|
||||
add_value = float(work_area->h -
|
||||
text->DefaultHeight());
|
||||
#else
|
||||
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());
|
||||
#endif
|
||||
|
||||
value += add_value;
|
||||
|
||||
@ -678,8 +810,11 @@ void BufferView::ScrollUpOnePage(long /*time*/)
|
||||
long y = screen->first;
|
||||
|
||||
if (!y) return;
|
||||
|
||||
Row* row = buffer_->text->GetRowNearY(y);
|
||||
#ifdef MOVE_TEXT
|
||||
Row * row = text->GetRowNearY(y);
|
||||
#else
|
||||
Row * row = buffer_->text->GetRowNearY(y);
|
||||
#endif
|
||||
y = y - work_area->h + row->height;
|
||||
|
||||
fl_set_slider_value(scrollbar, y);
|
||||
@ -697,13 +832,20 @@ void BufferView::ScrollDownOnePage(long /*time*/)
|
||||
double min, max;
|
||||
fl_get_slider_bounds(scrollbar, &min, &max);
|
||||
long y = screen->first;
|
||||
|
||||
#ifdef MOVE_TEXT
|
||||
if (y > text->height - work_area->h)
|
||||
return;
|
||||
|
||||
y += work_area->h;
|
||||
text->GetRowNearY(y);
|
||||
#else
|
||||
if (y > buffer_->text->height - work_area->h)
|
||||
return;
|
||||
|
||||
y += work_area->h;
|
||||
buffer_->text->GetRowNearY(y);
|
||||
|
||||
#endif
|
||||
fl_set_slider_value(scrollbar, y);
|
||||
|
||||
ScrollCB(scrollbar, 0);
|
||||
@ -778,12 +920,20 @@ int BufferView::work_area_handler(FL_OBJECT * ob, int event,
|
||||
if (view->buffer_ && !view->buffer_->the_locking_inset) {
|
||||
if (view->screen && ev->xbutton.button == 1) {
|
||||
view->screen->HideCursor();
|
||||
view->screen->ToggleSelection();
|
||||
view->screen->ToggleSelection();
|
||||
#ifdef MOVE_TEXT
|
||||
view->text->SelectWord();
|
||||
#else
|
||||
view->buffer_->text->SelectWord();
|
||||
#endif
|
||||
view->screen->ToggleSelection(false);
|
||||
/* This will fit the cursor on the screen
|
||||
* if necessary */
|
||||
view->buffer_->update(0);
|
||||
* if necessary */
|
||||
#ifdef MOVE_TEXT
|
||||
view->update(0);
|
||||
#else
|
||||
view->buffer_->update(0);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -791,16 +941,27 @@ int BufferView::work_area_handler(FL_OBJECT * ob, int event,
|
||||
// select a line
|
||||
if (view->buffer_ && view->screen && ev->xbutton.button == 1) {
|
||||
view->screen->HideCursor();
|
||||
view->screen->ToggleSelection();
|
||||
view->screen->ToggleSelection();
|
||||
#ifdef MOVE_TEXT
|
||||
view->text->CursorHome();
|
||||
view->text->sel_cursor = view->text->cursor;
|
||||
view->text->CursorEnd();
|
||||
view->text->SetSelection();
|
||||
#else
|
||||
view->buffer_->text->CursorHome();
|
||||
view->buffer_->text->sel_cursor =
|
||||
view->buffer_->text->cursor;
|
||||
view->buffer_->text->CursorEnd();
|
||||
view->buffer_->text->SetSelection();
|
||||
#endif
|
||||
view->screen->ToggleSelection(false);
|
||||
/* This will fit the cursor on the screen
|
||||
* if necessary */
|
||||
view->buffer_->update(0);
|
||||
* if necessary */
|
||||
#ifdef MOVE_TEXT
|
||||
view->update(0);
|
||||
#else
|
||||
view->buffer_->update(0);
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
case FL_OTHER:
|
||||
@ -822,7 +983,11 @@ int BufferView::WorkAreaMotionNotify(FL_OBJECT *ob, Window,
|
||||
|
||||
// Check for inset locking
|
||||
if (buffer_->the_locking_inset) {
|
||||
#ifdef MOVE_TEXT
|
||||
LyXCursor cursor = text->cursor;
|
||||
#else
|
||||
LyXCursor cursor = buffer_->text->cursor;
|
||||
#endif
|
||||
buffer_->the_locking_inset->
|
||||
InsetMotionNotify(ev->xbutton.x - ob->x - cursor.x,
|
||||
ev->xbutton.y - ob->y -
|
||||
@ -840,6 +1005,16 @@ int BufferView::WorkAreaMotionNotify(FL_OBJECT *ob, Window,
|
||||
if (selection_possible) {
|
||||
screen->HideCursor();
|
||||
|
||||
#ifdef MOVE_TEXT
|
||||
text->SetCursorFromCoordinates(ev->xbutton.x - ob->x,
|
||||
ev->xbutton.y - ob->y +
|
||||
screen->first);
|
||||
|
||||
if (!text->selection)
|
||||
update(-3); // Maybe an empty line was deleted
|
||||
|
||||
text->SetSelection();
|
||||
#else
|
||||
buffer_->text->
|
||||
SetCursorFromCoordinates(ev->xbutton.x - ob->x,
|
||||
ev->xbutton.y - ob->y +
|
||||
@ -849,6 +1024,7 @@ int BufferView::WorkAreaMotionNotify(FL_OBJECT *ob, Window,
|
||||
buffer_->update(-3); // Maybe an empty line was deleted
|
||||
|
||||
buffer_->text->SetSelection();
|
||||
#endif
|
||||
screen->ToggleToggle();
|
||||
if (screen->FitCursor())
|
||||
updateScrollbar();
|
||||
@ -860,6 +1036,168 @@ int BufferView::WorkAreaMotionNotify(FL_OBJECT *ob, Window,
|
||||
|
||||
extern int bibitemMaxWidth(LyXFont const &);
|
||||
|
||||
#ifdef MOVE_TEXT
|
||||
// Single-click on work area
|
||||
int BufferView::WorkAreaButtonPress(FL_OBJECT *ob, Window,
|
||||
int /*w*/, int /*h*/, XEvent *ev, void */*d*/)
|
||||
{
|
||||
last_click_x = -1;
|
||||
last_click_y = -1;
|
||||
|
||||
if (buffer_ == 0) return 0;
|
||||
if (!screen) return 0;
|
||||
|
||||
int const x = ev->xbutton.x - ob->x;
|
||||
int const y = ev->xbutton.y - ob->y;
|
||||
// If we hit an inset, we have the inset coordinates in these
|
||||
// and inset_hit points to the inset. If we do not hit an
|
||||
// inset, inset_hit is 0, and inset_x == x, inset_y == y.
|
||||
int inset_x = x;
|
||||
int inset_y = y;
|
||||
Inset * inset_hit = checkInsetHit(inset_x, inset_y);
|
||||
|
||||
// ok ok, this is a hack.
|
||||
int button = ev->xbutton.button;
|
||||
if (button == 4 || button == 5) goto wheel;
|
||||
|
||||
{
|
||||
|
||||
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->
|
||||
InsetButtonPress(inset_x, inset_y, button);
|
||||
return 0;
|
||||
} else {
|
||||
UnlockInset(buffer_->the_locking_inset);
|
||||
}
|
||||
}
|
||||
|
||||
selection_possible = true;
|
||||
screen->HideCursor();
|
||||
|
||||
// Right button mouse click on a table
|
||||
if (button == 3 &&
|
||||
(text->cursor.par->table ||
|
||||
text->MouseHitInTable(x, y + screen->first))) {
|
||||
// Set the cursor to the press-position
|
||||
text->SetCursorFromCoordinates(x, y + screen->first);
|
||||
bool doit = true;
|
||||
|
||||
// Only show the table popup if the hit is in the table, too
|
||||
if (!text->HitInTable(text->cursor.row, x))
|
||||
doit = false;
|
||||
|
||||
// Hit above or below the table?
|
||||
if (doit) {
|
||||
if (!text->selection) {
|
||||
screen->ToggleSelection();
|
||||
text->ClearSelection();
|
||||
text->FullRebreak();
|
||||
screen->Update();
|
||||
updateScrollbar();
|
||||
}
|
||||
// Popup table popup when on a table.
|
||||
// This is obviously temporary, since we should be
|
||||
// able to
|
||||
// popup various context-sensitive-menus with the
|
||||
// the right mouse. So this should be done more
|
||||
// general in the future. Matthias.
|
||||
selection_possible = false;
|
||||
owner_->getLyXFunc()->Dispatch(LFUN_LAYOUT_TABLE,
|
||||
"true");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
int screen_first = screen->first;
|
||||
|
||||
// Middle button press pastes if we have a selection
|
||||
bool paste_internally = false;
|
||||
if (button == 2 // && !buffer_->the_locking_inset
|
||||
&& text->selection) {
|
||||
owner_->getLyXFunc()->Dispatch(LFUN_COPY);
|
||||
paste_internally = true;
|
||||
}
|
||||
|
||||
// Clear the selection
|
||||
screen->ToggleSelection();
|
||||
text->ClearSelection();
|
||||
text->FullRebreak();
|
||||
screen->Update();
|
||||
updateScrollbar();
|
||||
|
||||
// Single left click in math inset?
|
||||
if (inset_hit != 0 && inset_hit->Editable() == 2) {
|
||||
// Highly editable inset, like math
|
||||
selection_possible = false;
|
||||
owner_->updateLayoutChoice();
|
||||
owner_->getMiniBuffer()->Set(inset_hit->EditMessage());
|
||||
inset_hit->Edit(inset_x, inset_y);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Right click on a footnote flag opens float menu
|
||||
if (button == 3) {
|
||||
selection_possible = false;
|
||||
return 0;
|
||||
}
|
||||
|
||||
text->SetCursorFromCoordinates(x, y + screen_first);
|
||||
text->FinishUndo();
|
||||
text->sel_cursor = text->cursor;
|
||||
text->cursor.x_fix = text->cursor.x;
|
||||
|
||||
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 (paste_internally)
|
||||
owner_->getLyXFunc()->Dispatch(LFUN_PASTE);
|
||||
else
|
||||
owner_->getLyXFunc()->Dispatch(LFUN_PASTESELECTION,
|
||||
"paragraph");
|
||||
selection_possible = false;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
goto out;
|
||||
wheel: {
|
||||
// I am not quite sure if this is the correct place to put this,
|
||||
// but it will not cause any harm.
|
||||
// Patch from Mark Huang (markman@mit.edu) to make LyX recognise
|
||||
// button 4 and 5. This enables LyX use use the scrollwhell on
|
||||
// certain mice for something useful. (Lgb)
|
||||
// Added wheel acceleration detection code. (Rvdk)
|
||||
static Time lastTime = 0;
|
||||
int diff = ev->xbutton.time - lastTime;
|
||||
int scroll = int(1.0 + (4.0/(abs(diff)+1.0))*200.0);
|
||||
switch (button) {
|
||||
case 4:
|
||||
ScrollUp(scroll);
|
||||
break;
|
||||
case 5:
|
||||
ScrollDown(scroll);
|
||||
break;
|
||||
}
|
||||
lastTime = ev->xbutton.time;
|
||||
return 0;
|
||||
}
|
||||
out:
|
||||
last_click_x = x;
|
||||
last_click_y = y;
|
||||
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
// Single-click on work area
|
||||
int BufferView::WorkAreaButtonPress(FL_OBJECT *ob, Window,
|
||||
int /*w*/, int /*h*/, XEvent *ev, void */*d*/)
|
||||
@ -1020,8 +1358,163 @@ int BufferView::WorkAreaButtonPress(FL_OBJECT *ob, Window,
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef MOVE_TEXT
|
||||
int BufferView::WorkAreaButtonRelease(FL_OBJECT * ob, Window ,
|
||||
int /*w*/, int /*h*/, XEvent * ev, void * /*d*/)
|
||||
{
|
||||
if (buffer_ == 0 || screen == 0) return 0;
|
||||
|
||||
int const x = ev->xbutton.x - ob->x;
|
||||
int const y = ev->xbutton.y - ob->y;
|
||||
|
||||
// If we hit an inset, we have the inset coordinates in these
|
||||
// and inset_hit points to the inset. If we do not hit an
|
||||
// inset, inset_hit is 0, and inset_x == x, inset_y == y.
|
||||
int inset_x = x;
|
||||
int inset_y = y;
|
||||
Inset * inset_hit = checkInsetHit(inset_x, inset_y);
|
||||
|
||||
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->
|
||||
InsetButtonRelease(inset_x, inset_y,
|
||||
ev->xbutton.button);
|
||||
return 0;
|
||||
}
|
||||
|
||||
selection_possible = false;
|
||||
if (text->cursor.par->table) {
|
||||
int cell = text->
|
||||
NumberOfCell(text->cursor.par,
|
||||
text->cursor.pos);
|
||||
if (text->cursor.par->table->IsContRow(cell) &&
|
||||
text->cursor.par->table->
|
||||
CellHasContRow(text->cursor.par->table->
|
||||
GetCellAbove(cell))<0) {
|
||||
text->CursorUp();
|
||||
}
|
||||
}
|
||||
|
||||
if (ev->xbutton.button >= 2)
|
||||
return 0;
|
||||
|
||||
// Make sure that the press was not far from the release
|
||||
if ((abs(last_click_x - x) >= 5) ||
|
||||
(abs(last_click_y - y) >= 5)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Did we hit an editable inset?
|
||||
if (inset_hit != 0) {
|
||||
// Inset like error, notes and figures
|
||||
selection_possible = false;
|
||||
#ifdef WITH_WARNINGS
|
||||
#warning fix this proper in 0.13
|
||||
#endif
|
||||
// Following a ref shouldn't issue
|
||||
// a push on the undo-stack
|
||||
// anylonger, now that we have
|
||||
// keybindings for following
|
||||
// references and returning from
|
||||
// references. IMHO though, it
|
||||
// should be the inset's own business
|
||||
// to push or not push on the undo
|
||||
// stack. They don't *have* to
|
||||
// alter the document...
|
||||
// (Joacim)
|
||||
// ...or maybe the SetCursorParUndo()
|
||||
// below isn't necessary at all anylonger?
|
||||
if (inset_hit->LyxCode() == Inset::REF_CODE) {
|
||||
text->SetCursorParUndo();
|
||||
}
|
||||
|
||||
owner_->getMiniBuffer()->Set(inset_hit->EditMessage());
|
||||
inset_hit->Edit(inset_x, inset_y);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// check whether we want to open a float
|
||||
if (text) {
|
||||
bool hit = false;
|
||||
char c = ' ';
|
||||
if (text->cursor.pos <
|
||||
text->cursor.par->Last()) {
|
||||
c = text->cursor.par->
|
||||
GetChar(text->cursor.pos);
|
||||
}
|
||||
if (c == LyXParagraph::META_FOOTNOTE
|
||||
|| c == LyXParagraph::META_MARGIN
|
||||
|| c == LyXParagraph::META_FIG
|
||||
|| c == LyXParagraph::META_TAB
|
||||
|| c == LyXParagraph::META_WIDE_FIG
|
||||
|| c == LyXParagraph::META_WIDE_TAB
|
||||
|| c == LyXParagraph::META_ALGORITHM){
|
||||
hit = true;
|
||||
} else if (text->cursor.pos - 1 >= 0) {
|
||||
c = text->cursor.par->
|
||||
GetChar(text->cursor.pos - 1);
|
||||
if (c == LyXParagraph::META_FOOTNOTE
|
||||
|| c == LyXParagraph::META_MARGIN
|
||||
|| c == LyXParagraph::META_FIG
|
||||
|| c == LyXParagraph::META_TAB
|
||||
|| c == LyXParagraph::META_WIDE_FIG
|
||||
|| c == LyXParagraph::META_WIDE_TAB
|
||||
|| c == LyXParagraph::META_ALGORITHM){
|
||||
// We are one step too far to the right
|
||||
text->CursorLeft();
|
||||
hit = true;
|
||||
}
|
||||
}
|
||||
if (hit == true) {
|
||||
ToggleFloat();
|
||||
selection_possible = false;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Do we want to close a float? (click on the float-label)
|
||||
if (text->cursor.row->par->footnoteflag ==
|
||||
LyXParagraph::OPEN_FOOTNOTE
|
||||
&& text->cursor.pos == 0
|
||||
&& text->cursor.row->previous &&
|
||||
text->cursor.row->previous->par->
|
||||
footnoteflag != LyXParagraph::OPEN_FOOTNOTE){
|
||||
LyXFont font (LyXFont::ALL_SANE);
|
||||
font.setSize(LyXFont::SIZE_SMALL);
|
||||
|
||||
int box_x = 20; // LYX_PAPER_MARGIN;
|
||||
box_x += font.textWidth("Mwide-figM", 10);
|
||||
|
||||
int screen_first = screen->first;
|
||||
|
||||
if (x < box_x
|
||||
&& y + screen_first > text->cursor.y -
|
||||
text->cursor.row->baseline
|
||||
&& y + screen_first < text->cursor.y -
|
||||
text->cursor.row->baseline
|
||||
+ font.maxAscent()*1.2 + font.maxDescent()*1.2) {
|
||||
ToggleFloat();
|
||||
selection_possible = false;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Maybe we want to edit a bibitem ale970302
|
||||
if (text->cursor.par->bibkey && x < 20 +
|
||||
bibitemMaxWidth(textclasslist.TextClass(buffer_->
|
||||
params.textclass).defaultfont())) {
|
||||
text->cursor.par->bibkey->Edit(0, 0);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
int BufferView::WorkAreaButtonRelease(FL_OBJECT *ob, Window ,
|
||||
int /*w*/, int /*h*/, XEvent *ev, void */*d*/)
|
||||
{
|
||||
@ -1175,13 +1668,55 @@ int BufferView::WorkAreaButtonRelease(FL_OBJECT *ob, Window ,
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Returns an inset if inset was hit. 0 otherwise.
|
||||
* If hit, the coordinates are changed relative to the inset.
|
||||
* Otherwise coordinates are not changed, and false is returned.
|
||||
*/
|
||||
#ifdef MOVE_TEXT
|
||||
Inset * BufferView::checkInsetHit(int & x, int & y)
|
||||
{
|
||||
if (!getScreen())
|
||||
return 0;
|
||||
|
||||
int y_tmp = y + getScreen()->first;
|
||||
|
||||
LyXCursor cursor = text->cursor;
|
||||
if (cursor.pos < cursor.par->Last()
|
||||
&& cursor.par->GetChar(cursor.pos) == LyXParagraph::META_INSET
|
||||
&& cursor.par->GetInset(cursor.pos)
|
||||
&& cursor.par->GetInset(cursor.pos)->Editable()) {
|
||||
|
||||
// Check whether the inset really was hit
|
||||
Inset * tmpinset = cursor.par->GetInset(cursor.pos);
|
||||
LyXFont font = text->GetFont(cursor.par, cursor.pos);
|
||||
if (x > cursor.x
|
||||
&& x < cursor.x + tmpinset->Width(font)
|
||||
&& y_tmp > cursor.y - tmpinset->Ascent(font)
|
||||
&& y_tmp < cursor.y + tmpinset->Descent(font)) {
|
||||
x = x - cursor.x;
|
||||
// The origin of an inset is on the baseline
|
||||
y = y_tmp - (cursor.y);
|
||||
return tmpinset;
|
||||
}
|
||||
} else if (cursor.pos - 1 >= 0
|
||||
&& cursor.par->GetChar(cursor.pos - 1) == LyXParagraph::META_INSET
|
||||
&& cursor.par->GetInset(cursor.pos - 1)
|
||||
&& cursor.par->GetInset(cursor.pos - 1)->Editable()) {
|
||||
text->CursorLeft();
|
||||
Inset * result = checkInsetHit(x, y);
|
||||
if (result == 0) {
|
||||
text->CursorRight();
|
||||
return 0;
|
||||
} else {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
Inset * BufferView::checkInsetHit(int & x, int & y)
|
||||
{
|
||||
if (!getScreen())
|
||||
@ -1196,7 +1731,7 @@ Inset * BufferView::checkInsetHit(int & x, int & y)
|
||||
&& cursor.par->GetInset(cursor.pos)->Editable()) {
|
||||
|
||||
// Check whether the inset really was hit
|
||||
Inset* tmpinset = cursor.par->GetInset(cursor.pos);
|
||||
Inset * tmpinset = cursor.par->GetInset(cursor.pos);
|
||||
LyXFont font = buffer_->text->GetFont(cursor.par, cursor.pos);
|
||||
if (x > cursor.x
|
||||
&& x < cursor.x + tmpinset->Width(font)
|
||||
@ -1222,7 +1757,7 @@ Inset * BufferView::checkInsetHit(int & x, int & y)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
int BufferView::workAreaExpose()
|
||||
{
|
||||
@ -1437,6 +1972,13 @@ int BufferView::WorkAreaSelectionNotify(FL_OBJECT *, Window win,
|
||||
XFlush(fl_display);
|
||||
|
||||
if (uc){
|
||||
#ifdef MOVE_TEXT
|
||||
if (!ascii_type) {
|
||||
text->InsertStringA(reinterpret_cast<char*>(uc));
|
||||
} else {
|
||||
text->InsertStringB(reinterpret_cast<char*>(uc));
|
||||
}
|
||||
#else
|
||||
if (!ascii_type) {
|
||||
buffer_->text->
|
||||
InsertStringA(reinterpret_cast<char*>(uc));
|
||||
@ -1444,16 +1986,60 @@ int BufferView::WorkAreaSelectionNotify(FL_OBJECT *, Window win,
|
||||
buffer_->text->
|
||||
InsertStringB(reinterpret_cast<char*>(uc));
|
||||
}
|
||||
#endif
|
||||
free(uc);
|
||||
uc = 0;
|
||||
}
|
||||
|
||||
|
||||
#ifdef MOVE_TEXT
|
||||
update(1);
|
||||
#else
|
||||
buffer_->update(1);
|
||||
#endif
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
#ifdef MOVE_TEXT
|
||||
void BufferView::cursorPrevious()
|
||||
{
|
||||
if (!text->cursor.row->previous) return;
|
||||
|
||||
long y = getScreen()->first;
|
||||
Row * cursorrow = text->cursor.row;
|
||||
text->SetCursorFromCoordinates(text->cursor.x_fix, y);
|
||||
text->FinishUndo();
|
||||
// this is to allow jumping over large insets
|
||||
if ((cursorrow == text->cursor.row))
|
||||
text->CursorUp();
|
||||
|
||||
if (text->cursor.row->height < work_area->h)
|
||||
getScreen()->Draw(text->cursor.y
|
||||
- text->cursor.row->baseline
|
||||
+ text->cursor.row->height
|
||||
- work_area->h +1 );
|
||||
}
|
||||
|
||||
|
||||
void BufferView::cursorNext()
|
||||
{
|
||||
if (!text->cursor.row->next) return;
|
||||
|
||||
long y = getScreen()->first;
|
||||
text->GetRowNearY(y);
|
||||
Row * cursorrow = text->cursor.row;
|
||||
text->SetCursorFromCoordinates(text->cursor.x_fix, y + work_area->h);
|
||||
text->FinishUndo();
|
||||
/* this is to allow jumping over large insets */
|
||||
if ((cursorrow == text->cursor.row))
|
||||
text->CursorDown();
|
||||
|
||||
if (text->cursor.row->height < work_area->h)
|
||||
getScreen()->Draw(text->cursor.y
|
||||
- text->cursor.row->baseline);
|
||||
}
|
||||
#else
|
||||
void BufferView::cursorPrevious()
|
||||
{
|
||||
if (!buffer()->text->cursor.row->previous) return;
|
||||
@ -1497,20 +2083,30 @@ void BufferView::cursorNext()
|
||||
getScreen()->Draw(buffer()->text->cursor.y
|
||||
- buffer()->text->cursor.row->baseline);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
bool BufferView::available() const
|
||||
{
|
||||
#ifdef MOVE_TEXT
|
||||
if (buffer_ && text) return true;
|
||||
#else
|
||||
if (buffer_ && buffer_->text) return true;
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void BufferView::savePosition()
|
||||
{
|
||||
#ifdef MOVE_TEXT
|
||||
backstack.push(buffer()->fileName(),
|
||||
text->cursor.x,
|
||||
text->cursor.y);
|
||||
#else
|
||||
backstack.push(buffer()->getFileName(),
|
||||
buffer()->text->cursor.x,
|
||||
buffer()->text->cursor.y);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -1525,6 +2121,42 @@ void BufferView::restorePosition()
|
||||
Buffer * b = (bufferlist.exists(fname)) ? bufferlist.getBuffer(fname):
|
||||
bufferlist.loadLyXFile(fname); // don't ask, just load it
|
||||
buffer(b);
|
||||
#ifdef MOVE_TEXT
|
||||
text->SetCursorFromCoordinates(x, y);
|
||||
update(0);
|
||||
#else
|
||||
buffer()->text->SetCursorFromCoordinates(x, y);
|
||||
buffer()->update(0);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
#ifdef MOVE_TEXT
|
||||
// candidate for move to BufferView
|
||||
void BufferView::update(signed char f)
|
||||
{
|
||||
owner()->updateLayoutChoice();
|
||||
|
||||
if (!text->selection && f > -3)
|
||||
text->sel_cursor = text->cursor;
|
||||
|
||||
FreeUpdateTimer();
|
||||
text->FullRebreak();
|
||||
|
||||
update();
|
||||
|
||||
if (f != 3 && f != -3) {
|
||||
fitCursor();
|
||||
updateScrollbar();
|
||||
}
|
||||
|
||||
if (f == 1 || f == -1) {
|
||||
if (buffer()->isLyxClean()) {
|
||||
buffer()->markDirty();
|
||||
owner()->getMiniBuffer()->setTimer(4);
|
||||
} else {
|
||||
buffer()->markDirty();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -18,6 +18,9 @@
|
||||
|
||||
#include FORMS_H_LOCATION
|
||||
#include "BackStack.h"
|
||||
#include "lyxtext.h"
|
||||
|
||||
#define MOVE_TEXT 1
|
||||
|
||||
class LyXView;
|
||||
class Buffer;
|
||||
@ -30,6 +33,8 @@ public:
|
||||
///
|
||||
BufferView(LyXView *owner, int , int , int, int);
|
||||
///
|
||||
~BufferView();
|
||||
///
|
||||
Buffer * buffer() const { return buffer_; }
|
||||
///
|
||||
FL_OBJECT * getWorkArea() { return work_area; }
|
||||
@ -43,6 +48,10 @@ public:
|
||||
void fitCursor();
|
||||
///
|
||||
void update();
|
||||
#ifdef MOVE_TEXT
|
||||
///
|
||||
void update(signed char f);
|
||||
#endif
|
||||
///
|
||||
void updateScrollbar();
|
||||
///
|
||||
@ -69,6 +78,12 @@ public:
|
||||
void savePosition();
|
||||
///
|
||||
void restorePosition();
|
||||
#ifdef MOVE_TEXT
|
||||
/** This holds the mapping between buffer paragraphs and screen rows.
|
||||
This should be private...but not yet. (Lgb)
|
||||
*/
|
||||
LyXText * text;
|
||||
#endif
|
||||
private:
|
||||
/// Update pixmap of screen
|
||||
void updateScreen();
|
||||
|
@ -85,7 +85,7 @@ void SendtoApplyCB(FL_OBJECT *, long)
|
||||
command = subst(command, "$$FName", fname);
|
||||
command += " &"; // execute in background
|
||||
// push directorypath, if necessary
|
||||
string path = OnlyPath(buffer->getFileName());
|
||||
string path = OnlyPath(buffer->fileName());
|
||||
if (lyxrc->use_tempdir || (IsDirWriteable(path) < 1)){
|
||||
path = buffer->tmppath;
|
||||
}
|
||||
|
@ -86,7 +86,11 @@ void LyXView::UpdateTimerCB(FL_OBJECT * ob, long)
|
||||
return;
|
||||
|
||||
view->view()->getScreen()->HideCursor();
|
||||
#ifdef MOVE_TEXT
|
||||
view->view()->update(-2);
|
||||
#else
|
||||
view->buffer()->update(-2);
|
||||
#endif
|
||||
/* This update can happen, even when the work area has lost
|
||||
* the focus. So suppress the cursor in that case */
|
||||
updatetimer = 0;
|
||||
@ -310,8 +314,12 @@ void LyXView::updateLayoutChoice()
|
||||
}
|
||||
// we need to do this.
|
||||
toolbar->combox->Redraw();
|
||||
|
||||
|
||||
#ifdef MOVE_TEXT
|
||||
char layout = bufferview->text->cursor.par->GetLayout();
|
||||
#else
|
||||
char layout = buffer()->text->cursor.par->GetLayout();
|
||||
#endif
|
||||
|
||||
if (layout != current_layout){
|
||||
toolbar->combox->select(layout + 1);
|
||||
@ -364,7 +372,7 @@ void LyXView::updateWindowTitle() {
|
||||
string title = "LyX";
|
||||
|
||||
if (view()->available()) {
|
||||
string cur_title = buffer()->getFileName();
|
||||
string cur_title = buffer()->fileName();
|
||||
if (!cur_title.empty()){
|
||||
title += ": " + OnlyFilename(cur_title);
|
||||
if (!buffer()->isLyxClean())
|
||||
|
@ -76,7 +76,11 @@ bool UpdateParagraphExtra()
|
||||
bool update = false;
|
||||
if (current_view->getScreen() && current_view->available()) {
|
||||
update = true;
|
||||
#ifdef MOVE_TEXT
|
||||
LyXParagraph * par = current_view->text->cursor.par;
|
||||
#else
|
||||
LyXParagraph * par = current_view->buffer()->text->cursor.par;
|
||||
#endif
|
||||
|
||||
EnableParagraphExtra();
|
||||
|
||||
@ -171,7 +175,11 @@ void ParagraphExtraApplyCB(FL_OBJECT *, long)
|
||||
FD_form_paragraph_extra const * fd = fd_form_paragraph_extra;
|
||||
char const * width = fl_get_input(fd->input_pextra_width);
|
||||
char const * widthp = fl_get_input(fd->input_pextra_widthp);
|
||||
#ifdef MOVE_TEXT
|
||||
LyXText * text = current_view->text;
|
||||
#else
|
||||
LyXText * text = current_view->buffer()->text;
|
||||
#endif
|
||||
int type = LyXParagraph::PEXTRA_NONE;
|
||||
LyXParagraph::MINIPAGE_ALIGNMENT alignment =
|
||||
LyXParagraph::MINIPAGE_ALIGN_TOP;
|
||||
@ -197,7 +205,11 @@ void ParagraphExtraApplyCB(FL_OBJECT *, long)
|
||||
}
|
||||
text->SetParagraphExtraOpt(type, width, widthp, alignment, hfill,
|
||||
start_minipage);
|
||||
#ifdef MOVE_TEXT
|
||||
current_view->update(1);
|
||||
#else
|
||||
current_view->buffer()->update(1);
|
||||
#endif
|
||||
minibuffer->Set(_("ParagraphExtra layout set"));
|
||||
}
|
||||
return;
|
||||
|
@ -36,6 +36,190 @@ static int extra_col_cursor_x; // need no y's, one-line input fields
|
||||
static int extra_multicol_cursor_x;
|
||||
// Joacim
|
||||
|
||||
#ifdef MOVE_TEXT
|
||||
bool UpdateLayoutTable(int flag)
|
||||
{
|
||||
bool update = true;
|
||||
if (!current_view->getScreen() || !current_view->available())
|
||||
update = false;
|
||||
|
||||
if (update && current_view->text->cursor.par->table) {
|
||||
char buf[12];
|
||||
string pwidth, special;
|
||||
|
||||
LyXTable * table = current_view->text->cursor.par->table;
|
||||
|
||||
int cell = current_view->text->
|
||||
NumberOfCell(current_view->text->cursor.par,
|
||||
current_view->text->cursor.pos);
|
||||
ActCell = cell;
|
||||
int column = table->column_of_cell(cell)+1;
|
||||
fl_set_object_label(fd_form_table_options->text_warning, "");
|
||||
Confirmed = false;
|
||||
fl_activate_object(fd_form_table_extra->input_special_alignment);
|
||||
fl_activate_object(fd_form_table_extra->input_special_multialign);
|
||||
fl_activate_object(fd_form_table_options->input_column_width);
|
||||
sprintf(buf, "%d", column);
|
||||
fl_set_input(fd_form_table_options->input_table_column, buf);
|
||||
fl_deactivate_object(fd_form_table_options->input_table_column);
|
||||
int row = table->row_of_cell(cell)+1;
|
||||
sprintf(buf, "%d", row);
|
||||
fl_set_input(fd_form_table_options->input_table_row, buf);
|
||||
fl_deactivate_object(fd_form_table_options->input_table_row);
|
||||
if (table->IsMultiColumn(cell))
|
||||
fl_set_button(fd_form_table_options->radio_multicolumn, 1);
|
||||
else
|
||||
fl_set_button(fd_form_table_options->radio_multicolumn, 0);
|
||||
if (table->RotateCell(cell))
|
||||
fl_set_button(fd_form_table_options->radio_rotate_cell, 1);
|
||||
else
|
||||
fl_set_button(fd_form_table_options->radio_rotate_cell, 0);
|
||||
if (table->TopLine(cell))
|
||||
fl_set_button(fd_form_table_options->radio_border_top, 1);
|
||||
else
|
||||
fl_set_button(fd_form_table_options->radio_border_top, 0);
|
||||
if (table->BottomLine(cell))
|
||||
fl_set_button(fd_form_table_options->radio_border_bottom, 1);
|
||||
else
|
||||
fl_set_button(fd_form_table_options->radio_border_bottom, 0);
|
||||
if (table->LeftLine(cell))
|
||||
fl_set_button(fd_form_table_options->radio_border_left, 1);
|
||||
else
|
||||
fl_set_button(fd_form_table_options->radio_border_left, 0);
|
||||
if (table->RightLine(cell))
|
||||
fl_set_button(fd_form_table_options->radio_border_right, 1);
|
||||
else
|
||||
fl_set_button(fd_form_table_options->radio_border_right, 0);
|
||||
int align = table->GetAlignment(cell);
|
||||
fl_set_button(fd_form_table_options->radio_align_left, 0);
|
||||
fl_set_button(fd_form_table_options->radio_align_right, 0);
|
||||
fl_set_button(fd_form_table_options->radio_align_center, 0);
|
||||
special = table->GetAlignSpecial(cell, LyXTable::SET_SPECIAL_COLUMN);
|
||||
if (flag)
|
||||
{
|
||||
fl_set_input(fd_form_table_extra->input_special_alignment,
|
||||
special.c_str());
|
||||
fl_set_input_cursorpos(fd_form_table_extra->input_special_alignment,
|
||||
extra_col_cursor_x, 0); // restore the cursor
|
||||
}
|
||||
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(fd_form_table_extra->input_special_multialign,
|
||||
special.c_str());
|
||||
fl_set_input_cursorpos(fd_form_table_extra->input_special_multialign,
|
||||
extra_multicol_cursor_x, 0); // restore the cursor
|
||||
}
|
||||
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->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);
|
||||
fl_set_object_lcol(fd_form_table_options->radio_linebreak_cell,
|
||||
FL_BLACK);
|
||||
fl_set_button(fd_form_table_options->radio_linebreak_cell,
|
||||
table->Linebreaks(table->FirstVirtualCell(cell)));
|
||||
} else {
|
||||
fl_deactivate_object(fd_form_table_options->radio_linebreak_cell);
|
||||
fl_set_object_lcol(fd_form_table_options->radio_linebreak_cell,
|
||||
FL_INACTIVE);
|
||||
fl_set_button(fd_form_table_options->radio_linebreak_cell, 0);
|
||||
}
|
||||
if ((!pwidth.empty() && !table->IsMultiColumn(cell)) ||
|
||||
(align == LYX_ALIGN_LEFT))
|
||||
fl_set_button(fd_form_table_options->radio_align_left, 1);
|
||||
else if (align == LYX_ALIGN_RIGHT)
|
||||
fl_set_button(fd_form_table_options->radio_align_right, 1);
|
||||
else
|
||||
fl_set_button(fd_form_table_options->radio_align_center, 1);
|
||||
if (!pwidth.empty() && !table->IsMultiColumn(cell)) {
|
||||
fl_deactivate_object(fd_form_table_options->radio_align_left);
|
||||
fl_deactivate_object(fd_form_table_options->radio_align_right);
|
||||
fl_deactivate_object(fd_form_table_options->radio_align_center);
|
||||
fl_set_object_lcol(fd_form_table_options->radio_align_left,
|
||||
FL_INACTIVE);
|
||||
fl_set_object_lcol(fd_form_table_options->radio_align_right,
|
||||
FL_INACTIVE);
|
||||
fl_set_object_lcol(fd_form_table_options->radio_align_center,
|
||||
FL_INACTIVE);
|
||||
} else {
|
||||
fl_activate_object(fd_form_table_options->radio_align_left);
|
||||
fl_activate_object(fd_form_table_options->radio_align_right);
|
||||
fl_activate_object(fd_form_table_options->radio_align_center);
|
||||
fl_set_object_lcol(fd_form_table_options->radio_align_left,
|
||||
FL_BLACK);
|
||||
fl_set_object_lcol(fd_form_table_options->radio_align_right,
|
||||
FL_BLACK);
|
||||
fl_set_object_lcol(fd_form_table_options->radio_align_center,
|
||||
FL_BLACK);
|
||||
}
|
||||
fl_set_button(fd_form_table_options->radio_longtable, table->IsLongTable());
|
||||
if (table->IsLongTable()) {
|
||||
fl_activate_object(fd_form_table_options->radio_lt_firsthead);
|
||||
fl_activate_object(fd_form_table_options->radio_lt_head);
|
||||
fl_activate_object(fd_form_table_options->radio_lt_foot);
|
||||
fl_activate_object(fd_form_table_options->radio_lt_lastfoot);
|
||||
fl_activate_object(fd_form_table_options->radio_lt_newpage);
|
||||
fl_set_object_lcol(fd_form_table_options->radio_lt_firsthead,
|
||||
FL_BLACK);
|
||||
fl_set_object_lcol(fd_form_table_options->radio_lt_head,
|
||||
FL_BLACK);
|
||||
fl_set_object_lcol(fd_form_table_options->radio_lt_foot,
|
||||
FL_BLACK);
|
||||
fl_set_object_lcol(fd_form_table_options->radio_lt_lastfoot,
|
||||
FL_BLACK);
|
||||
fl_set_object_lcol(fd_form_table_options->radio_lt_newpage,
|
||||
FL_BLACK);
|
||||
fl_set_button(fd_form_table_options->radio_lt_firsthead,
|
||||
table->RowOfLTFirstHead(cell));
|
||||
fl_set_button(fd_form_table_options->radio_lt_head,
|
||||
table->RowOfLTHead(cell));
|
||||
fl_set_button(fd_form_table_options->radio_lt_foot,
|
||||
table->RowOfLTFoot(cell));
|
||||
fl_set_button(fd_form_table_options->radio_lt_lastfoot,
|
||||
table->RowOfLTLastFoot(cell));
|
||||
fl_set_button(fd_form_table_options->radio_lt_newpage,
|
||||
table->LTNewPage(cell));
|
||||
} else {
|
||||
fl_deactivate_object(fd_form_table_options->radio_lt_firsthead);
|
||||
fl_deactivate_object(fd_form_table_options->radio_lt_head);
|
||||
fl_deactivate_object(fd_form_table_options->radio_lt_foot);
|
||||
fl_deactivate_object(fd_form_table_options->radio_lt_lastfoot);
|
||||
fl_deactivate_object(fd_form_table_options->radio_lt_newpage);
|
||||
fl_set_button(fd_form_table_options->radio_lt_firsthead, 0);
|
||||
fl_set_button(fd_form_table_options->radio_lt_head, 0);
|
||||
fl_set_button(fd_form_table_options->radio_lt_foot, 0);
|
||||
fl_set_button(fd_form_table_options->radio_lt_lastfoot, 0);
|
||||
fl_set_button(fd_form_table_options->radio_lt_newpage, 0);
|
||||
fl_set_object_lcol(fd_form_table_options->radio_lt_firsthead,
|
||||
FL_INACTIVE);
|
||||
fl_set_object_lcol(fd_form_table_options->radio_lt_head,
|
||||
FL_INACTIVE);
|
||||
fl_set_object_lcol(fd_form_table_options->radio_lt_foot,
|
||||
FL_INACTIVE);
|
||||
fl_set_object_lcol(fd_form_table_options->radio_lt_lastfoot,
|
||||
FL_INACTIVE);
|
||||
fl_set_object_lcol(fd_form_table_options->radio_lt_newpage,
|
||||
FL_INACTIVE);
|
||||
}
|
||||
fl_set_button(fd_form_table_options->radio_rotate_table,
|
||||
table->RotateTable());
|
||||
fl_set_focus_object(fd_form_table_options->form_table_options,
|
||||
fd_form_table_options->button_table_delete);
|
||||
} else if (fd_form_table_options->form_table_options->visible) {
|
||||
fl_set_focus_object(fd_form_table_options->form_table_options,
|
||||
fd_form_table_options->button_table_delete);
|
||||
fl_hide_form(fd_form_table_options->form_table_options);
|
||||
}
|
||||
return update;
|
||||
}
|
||||
#else
|
||||
bool UpdateLayoutTable(int flag)
|
||||
{
|
||||
bool update = true;
|
||||
@ -218,7 +402,7 @@ bool UpdateLayoutTable(int flag)
|
||||
}
|
||||
return update;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void OpenLayoutTableExtra()
|
||||
{
|
||||
@ -258,13 +442,28 @@ void MenuLayoutTable(int flag)
|
||||
void TableOptionsCB(FL_OBJECT * ob, long)
|
||||
{
|
||||
LyXTable * table = 0;
|
||||
int
|
||||
s,
|
||||
num = 0;
|
||||
string
|
||||
special,
|
||||
str;
|
||||
int s, num = 0;
|
||||
string special, str;
|
||||
|
||||
#ifdef MOVE_TEXT
|
||||
if (!current_view->available()
|
||||
|| !(table = current_view->text->cursor.par->table)) {
|
||||
MenuLayoutTable(0);
|
||||
return;
|
||||
}
|
||||
int cell = current_view->text->
|
||||
NumberOfCell(current_view->text->cursor.par,
|
||||
current_view->text->cursor.pos);
|
||||
if (ActCell != cell) {
|
||||
MenuLayoutTable(0);
|
||||
fl_set_object_label(fd_form_table_options->text_warning,
|
||||
_("Warning: Wrong Cursor position, updated window"));
|
||||
fl_show_object(fd_form_table_options->text_warning);
|
||||
extra_col_cursor_x = 0; // would rather place it at the end, but...
|
||||
extra_multicol_cursor_x = 0;
|
||||
return;
|
||||
}
|
||||
#else
|
||||
if (!current_view->available()
|
||||
||
|
||||
!(table = current_view->buffer()->text->cursor.par->table)) {
|
||||
@ -283,6 +482,7 @@ void TableOptionsCB(FL_OBJECT * ob, long)
|
||||
extra_multicol_cursor_x = 0;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
// 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->buffer()->isReadonly()) {
|
||||
@ -424,6 +624,18 @@ void TableOptionsCB(FL_OBJECT * ob, long)
|
||||
return;
|
||||
if (current_view->available()){
|
||||
current_view->getScreen()->HideCursor();
|
||||
#ifdef MOVE_TEXT
|
||||
if (!current_view->text->selection){
|
||||
BeforeChange();
|
||||
current_view->update(-2);
|
||||
}
|
||||
if ((num == LyXTable::SET_SPECIAL_COLUMN) ||
|
||||
(num == LyXTable::SET_SPECIAL_MULTI))
|
||||
current_view->text->TableFeatures(num, special);
|
||||
else
|
||||
current_view->text->TableFeatures(num);
|
||||
current_view->update(1);
|
||||
#else
|
||||
if (!current_view->buffer()->text->selection){
|
||||
BeforeChange();
|
||||
current_view->buffer()->update(-2);
|
||||
@ -434,6 +646,7 @@ void TableOptionsCB(FL_OBJECT * ob, long)
|
||||
else
|
||||
current_view->buffer()->text->TableFeatures(num);
|
||||
current_view->buffer()->update(1);
|
||||
#endif
|
||||
}
|
||||
if (num == LyXTable::DELETE_TABLE) {
|
||||
fl_set_focus_object(fd_form_table_options->form_table_options,
|
||||
@ -476,12 +689,21 @@ void SetPWidthCB(FL_OBJECT *ob, long)
|
||||
}
|
||||
if (current_view->available()){
|
||||
current_view->getScreen()->HideCursor();
|
||||
#ifdef MOVE_TEXT
|
||||
if (!current_view->text->selection){
|
||||
BeforeChange();
|
||||
current_view->update(-2);
|
||||
}
|
||||
current_view->text->TableFeatures(LyXTable::SET_PWIDTH, str);
|
||||
current_view->update(1);
|
||||
#else
|
||||
if (!current_view->buffer()->text->selection){
|
||||
BeforeChange();
|
||||
current_view->buffer()->update(-2);
|
||||
}
|
||||
current_view->buffer()->text->TableFeatures(LyXTable::SET_PWIDTH, str);
|
||||
current_view->buffer()->update(1);
|
||||
#endif
|
||||
}
|
||||
MenuLayoutTable(0); // update for alignment
|
||||
}
|
||||
|
352
src/buffer.C
352
src/buffer.C
@ -43,6 +43,7 @@ using std::setw;
|
||||
#include "bufferlist.h"
|
||||
#include "lyx_main.h"
|
||||
#include "lyx_gui_misc.h"
|
||||
#include "LyXAction.h"
|
||||
#include "lyxrc.h"
|
||||
#include "lyxlex.h"
|
||||
#include "tex-strings.h"
|
||||
@ -103,6 +104,16 @@ extern void SmallUpdate(signed char);
|
||||
extern unsigned char GetCurrentTextClass();
|
||||
extern void BeforeChange();
|
||||
|
||||
extern void MenuMakeLaTeX(Buffer *);
|
||||
extern void MenuMakeLinuxDoc(Buffer *);
|
||||
extern void MenuMakeDocBook(Buffer *);
|
||||
extern void MenuRunLaTeX(Buffer *);
|
||||
extern void MenuPrint(Buffer *);
|
||||
extern void MenuMakeAscii(Buffer *);
|
||||
extern void MenuSendto();
|
||||
extern LyXAction lyxaction;
|
||||
|
||||
|
||||
static const float LYX_FORMAT = 2.15;
|
||||
|
||||
extern int tex_code_break_column;
|
||||
@ -116,7 +127,9 @@ Buffer::Buffer(string const & file, LyXRC * lyxrc, bool ronly)
|
||||
filename = file;
|
||||
filepath = OnlyPath(file);
|
||||
paragraph = 0;
|
||||
#ifndef MOVE_TEXT
|
||||
text = 0;
|
||||
#endif
|
||||
the_locking_inset = 0;
|
||||
lyx_clean = true;
|
||||
bak_clean = true;
|
||||
@ -156,7 +169,9 @@ Buffer::~Buffer()
|
||||
par = tmppar;
|
||||
}
|
||||
paragraph = 0;
|
||||
#ifndef MOVE_TEXT
|
||||
delete text;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -192,7 +207,7 @@ void Buffer::resetAutosaveTimers()
|
||||
}
|
||||
|
||||
|
||||
void Buffer::setFileName(string const & newfile)
|
||||
void Buffer::fileName(string const & newfile)
|
||||
{
|
||||
filename = MakeAbsPath(newfile);
|
||||
filepath = OnlyPath(filename);
|
||||
@ -200,17 +215,24 @@ void Buffer::setFileName(string const & newfile)
|
||||
updateTitles();
|
||||
}
|
||||
|
||||
|
||||
// candidate for move to BufferView
|
||||
void Buffer::InsetUnlock()
|
||||
{
|
||||
if (the_locking_inset) {
|
||||
if (!inset_slept) the_locking_inset->InsetUnlock();
|
||||
the_locking_inset = 0;
|
||||
#ifdef MOVE_TEXT
|
||||
users->text->FinishUndo();
|
||||
#else
|
||||
text->FinishUndo();
|
||||
#endif
|
||||
inset_slept = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// candidate for move to BufferView
|
||||
// Inserts a file into current document
|
||||
bool Buffer::insertLyXFile(string const & filen)
|
||||
//
|
||||
@ -251,6 +273,15 @@ bool Buffer::insertLyXFile(string const & filen)
|
||||
|
||||
bool res = true;
|
||||
|
||||
#ifdef MOVE_TEXT
|
||||
if (c == '#') {
|
||||
lyxerr.debug() << "Will insert file with header" << endl;
|
||||
res = readFile(lex, users->text->cursor.par);
|
||||
} else {
|
||||
lyxerr.debug() << "Will insert file without header" << endl;
|
||||
res = readLyXformat2(lex, users->text->cursor.par);
|
||||
}
|
||||
#else
|
||||
if (c == '#') {
|
||||
lyxerr.debug() << "Will insert file with header" << endl;
|
||||
res = readFile(lex, text->cursor.par);
|
||||
@ -258,11 +289,14 @@ bool Buffer::insertLyXFile(string const & filen)
|
||||
lyxerr.debug() << "Will insert file without header" << endl;
|
||||
res = readLyXformat2(lex, text->cursor.par);
|
||||
}
|
||||
#endif
|
||||
resize();
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
// candidate for move to BufferView
|
||||
// (at least some parts in the beginning of the func)
|
||||
//
|
||||
// Uwe C. Schroeder
|
||||
// changed to be public and have one parameter
|
||||
@ -290,8 +324,13 @@ bool Buffer::readLyXformat2(LyXLex & lex, LyXParagraph * par)
|
||||
if(!par) {
|
||||
par = new LyXParagraph;
|
||||
} else {
|
||||
#ifdef MOVE_TEXT
|
||||
users->text->BreakParagraph();
|
||||
return_par = users->text->FirstParagraph();
|
||||
#else
|
||||
text->BreakParagraph();
|
||||
return_par = text->FirstParagraph();
|
||||
#endif
|
||||
pos = 0;
|
||||
markDirty();
|
||||
// We don't want to adopt the parameters from the
|
||||
@ -1401,22 +1440,24 @@ void Buffer::writeFileAscii(string const & filename, int linelen)
|
||||
break;
|
||||
}
|
||||
if (ltype_depth > depth) {
|
||||
for(j = ltype_depth-1; j>depth; j--)
|
||||
for(j = ltype_depth - 1; j > depth; --j)
|
||||
ofs << " ";
|
||||
currlinelen += (ltype_depth-depth)*2;
|
||||
}
|
||||
if (par->table) {
|
||||
for(j = 0;j<cells;j++) {
|
||||
for(j = 0; j < cells; ++j) {
|
||||
ofs << '+';
|
||||
for(h = 0; h < (clen[j]+1); h++)
|
||||
for(h = 0; h < (clen[j] + 1);
|
||||
++h)
|
||||
ofs << '-';
|
||||
}
|
||||
ofs << "+\n";
|
||||
for(j = 0; j<depth; j++)
|
||||
for(j = 0; j < depth; ++j)
|
||||
ofs << " ";
|
||||
currlinelen = depth*2;
|
||||
currlinelen = depth * 2;
|
||||
if (ltype_depth > depth) {
|
||||
for(j = ltype_depth; j>depth; j--)
|
||||
for(j = ltype_depth;
|
||||
j > depth; --j)
|
||||
ofs << " ";
|
||||
currlinelen += (ltype_depth-depth)*2;
|
||||
}
|
||||
@ -1451,32 +1492,34 @@ void Buffer::writeFileAscii(string const & filename, int linelen)
|
||||
for(j = actpos; j < clen[cell-1];j++)
|
||||
ofs << ' ';
|
||||
ofs << " |\n";
|
||||
for(j = 0; j<depth; j++)
|
||||
for(j = 0; j < depth; ++j)
|
||||
ofs << " ";
|
||||
currlinelen = depth*2;
|
||||
if (ltype_depth > depth) {
|
||||
for(j = ltype_depth; j>depth; j--)
|
||||
for(j = ltype_depth; j > depth; --j)
|
||||
ofs << " ";
|
||||
currlinelen += (ltype_depth-depth)*2;
|
||||
currlinelen += (ltype_depth-depth) * 2;
|
||||
}
|
||||
for(j = 0;j<cells;j++) {
|
||||
for(j = 0; j < cells; ++j) {
|
||||
ofs << '+';
|
||||
for(h = 0; h < (clen[j]+1); ++h)
|
||||
for(h = 0; h < (clen[j] + 1); ++h)
|
||||
ofs << '-';
|
||||
}
|
||||
ofs << "+\n";
|
||||
for(j = 0; j<depth; j++)
|
||||
for(j = 0; j < depth; ++j)
|
||||
ofs << " ";
|
||||
currlinelen = depth*2;
|
||||
currlinelen = depth * 2;
|
||||
if (ltype_depth > depth) {
|
||||
for(j = ltype_depth; j>depth; j--)
|
||||
for(j = ltype_depth;
|
||||
j > depth; --j)
|
||||
ofs << " ";
|
||||
currlinelen += (ltype_depth-depth)*2;
|
||||
}
|
||||
ofs << "| ";
|
||||
cell = 1;
|
||||
} else {
|
||||
for(j = actpos; j<clen[cell-1]; j++)
|
||||
for(j = actpos;
|
||||
j < clen[cell - 1]; ++j)
|
||||
ofs << ' ';
|
||||
ofs << " | ";
|
||||
++cell;
|
||||
@ -1485,13 +1528,14 @@ void Buffer::writeFileAscii(string const & filename, int linelen)
|
||||
currlinelen = actpos = 0;
|
||||
} else {
|
||||
ofs << "\n";
|
||||
for(j = 0; j<depth; j++)
|
||||
for(j = 0; j < depth; ++j)
|
||||
ofs << " ";
|
||||
currlinelen = depth * 2;
|
||||
if (ltype_depth > depth) {
|
||||
for(j = ltype_depth; j>depth; j--)
|
||||
for(j = ltype_depth;
|
||||
j > depth; --j)
|
||||
ofs << " ";
|
||||
currlinelen += (ltype_depth-depth)*2;
|
||||
currlinelen += (ltype_depth - depth) * 2;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -1529,15 +1573,15 @@ void Buffer::writeFileAscii(string const & filename, int linelen)
|
||||
for(j = actpos; j < clen[cell - 1]; ++j)
|
||||
ofs << ' ';
|
||||
ofs << " |\n";
|
||||
for(j = 0; j<depth; j++)
|
||||
for(j = 0; j < depth; ++j)
|
||||
ofs << " ";
|
||||
currlinelen = depth * 2;
|
||||
if (ltype_depth > depth) {
|
||||
for(j = ltype_depth; j > depth; --j)
|
||||
ofs << " ";
|
||||
currlinelen += (ltype_depth-depth)*2;
|
||||
currlinelen += (ltype_depth - depth) * 2;
|
||||
}
|
||||
for(j = 0;j<cells; ++j) {
|
||||
for(j = 0; j < cells; ++j) {
|
||||
ofs << '+';
|
||||
for(h = 0; h < (clen[j] + 1); ++h)
|
||||
ofs << '-';
|
||||
@ -1676,7 +1720,8 @@ void Buffer::makeLaTeXFile(string const & filename,
|
||||
options += "onecolumn,";
|
||||
}
|
||||
|
||||
if (!params.use_geometry && params.orientation == BufferParams::ORIENTATION_LANDSCAPE)
|
||||
if (!params.use_geometry
|
||||
&& params.orientation == BufferParams::ORIENTATION_LANDSCAPE)
|
||||
options += "landscape,";
|
||||
|
||||
// language should be a parameter to \documentclass
|
||||
@ -3120,11 +3165,16 @@ void Buffer::SimpleDocBookOnePar(string & file, string & extra,
|
||||
}
|
||||
|
||||
|
||||
// candidate for move to BufferView
|
||||
bool Buffer::removeAutoInsets()
|
||||
{
|
||||
LyXParagraph *par = paragraph;
|
||||
|
||||
#ifdef MOVE_TEXT
|
||||
LyXCursor cursor = users->text->cursor;
|
||||
#else
|
||||
LyXCursor cursor = text->cursor;
|
||||
#endif
|
||||
LyXCursor tmpcursor = cursor;
|
||||
cursor.par = tmpcursor.par->ParFromPos(tmpcursor.pos);
|
||||
cursor.pos = tmpcursor.par->PositionInParFromPos(tmpcursor.pos);
|
||||
@ -3134,11 +3184,19 @@ bool Buffer::removeAutoInsets()
|
||||
if (par->AutoDeleteInsets()){
|
||||
a = true;
|
||||
if (par->footnoteflag != LyXParagraph::CLOSED_FOOTNOTE){
|
||||
#ifdef MOVE_TEXT
|
||||
/* this is possible now, since SetCursor takes
|
||||
care about footnotes */
|
||||
users->text->SetCursorIntern(par, 0);
|
||||
users->text->RedoParagraphs(users->text->cursor, users->text->cursor.par->Next());
|
||||
users->text->FullRebreak();
|
||||
#else
|
||||
/* this is possible now, since SetCursor takes
|
||||
care about footnotes */
|
||||
text->SetCursorIntern(par, 0);
|
||||
text->RedoParagraphs(text->cursor, text->cursor.par->Next());
|
||||
text->FullRebreak();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
par = par->next;
|
||||
@ -3146,7 +3204,11 @@ bool Buffer::removeAutoInsets()
|
||||
/* avoid forbidden cursor positions caused by error removing */
|
||||
if (cursor.pos > cursor.par->Last())
|
||||
cursor.pos = cursor.par->Last();
|
||||
#ifdef MOVE_TEXT
|
||||
users->text->SetCursorIntern(cursor.par, cursor.pos);
|
||||
#else
|
||||
text->SetCursorIntern(cursor.par, cursor.pos);
|
||||
#endif
|
||||
|
||||
return a;
|
||||
}
|
||||
@ -3154,7 +3216,11 @@ bool Buffer::removeAutoInsets()
|
||||
|
||||
int Buffer::runLaTeX()
|
||||
{
|
||||
#ifdef MOVE_TEXT
|
||||
if (!users->text) return 0;
|
||||
#else
|
||||
if (!text) return 0;
|
||||
#endif
|
||||
|
||||
ProhibitInput();
|
||||
|
||||
@ -3217,7 +3283,11 @@ int Buffer::runLaTeX()
|
||||
|
||||
int Buffer::runLiterate()
|
||||
{
|
||||
#ifdef MOVE_TEXT
|
||||
if (!users->text) return 0;
|
||||
#else
|
||||
if (!text) return 0;
|
||||
#endif
|
||||
|
||||
ProhibitInput();
|
||||
|
||||
@ -3286,7 +3356,11 @@ int Buffer::runLiterate()
|
||||
|
||||
int Buffer::buildProgram()
|
||||
{
|
||||
#ifdef MOVE_TEXT
|
||||
if (!users->text) return 0;
|
||||
#else
|
||||
if (!text) return 0;
|
||||
#endif
|
||||
|
||||
ProhibitInput();
|
||||
|
||||
@ -3357,7 +3431,11 @@ int Buffer::buildProgram()
|
||||
// Other flags: -wall -v0 -x
|
||||
int Buffer::runChktex()
|
||||
{
|
||||
#ifdef MOVE_TEXT
|
||||
if (!users->text) return 0;
|
||||
#else
|
||||
if (!text) return 0;
|
||||
#endif
|
||||
|
||||
ProhibitInput();
|
||||
|
||||
@ -3410,10 +3488,16 @@ int Buffer::runChktex()
|
||||
extern void AllFloats(char, char);
|
||||
|
||||
|
||||
// candidate for move to BufferView
|
||||
void Buffer::insertErrors(TeXErrors & terr)
|
||||
{
|
||||
#ifdef MOVE_TEXT
|
||||
// Save the cursor position
|
||||
LyXCursor cursor = users->text->cursor;
|
||||
#else
|
||||
// Save the cursor position
|
||||
LyXCursor cursor = text->cursor;
|
||||
#endif
|
||||
|
||||
// This is drastic, but it's the only fix, I could find. (Asger)
|
||||
AllFloats(1, 0);
|
||||
@ -3433,29 +3517,47 @@ void Buffer::insertErrors(TeXErrors & terr)
|
||||
|
||||
texrow.getIdFromRow(errorrow, tmpid, tmppos);
|
||||
|
||||
LyXParagraph* texrowpar;
|
||||
LyXParagraph * texrowpar = 0;
|
||||
|
||||
#ifdef MOVE_TEXT
|
||||
if (tmpid == -1) {
|
||||
texrowpar = users->text->FirstParagraph();
|
||||
tmppos = 0;
|
||||
} else {
|
||||
texrowpar = users->text->GetParFromID(tmpid);
|
||||
}
|
||||
#else
|
||||
if (tmpid == -1) {
|
||||
texrowpar = text->FirstParagraph();
|
||||
tmppos = 0;
|
||||
} else {
|
||||
texrowpar = text->GetParFromID(tmpid);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (texrowpar == 0)
|
||||
continue;
|
||||
|
||||
InsetError * new_inset = new InsetError(msgtxt);
|
||||
|
||||
#ifdef MOVE_TEXT
|
||||
users->text->SetCursorIntern(texrowpar, tmppos);
|
||||
users->text->InsertInset(new_inset);
|
||||
users->text->FullRebreak();
|
||||
}
|
||||
// Restore the cursor position
|
||||
users->text->SetCursorIntern(cursor.par, cursor.pos);
|
||||
#else
|
||||
text->SetCursorIntern(texrowpar, tmppos);
|
||||
text->InsertInset(new_inset);
|
||||
text->FullRebreak();
|
||||
}
|
||||
// Restore the cursor position
|
||||
text->SetCursorIntern(cursor.par, cursor.pos);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
// candidate for move to BufferView
|
||||
void Buffer::setCursorFromRow (int row)
|
||||
{
|
||||
int tmpid = -1;
|
||||
@ -3463,8 +3565,17 @@ void Buffer::setCursorFromRow (int row)
|
||||
|
||||
texrow.getIdFromRow(row, tmpid, tmppos);
|
||||
|
||||
LyXParagraph* texrowpar;
|
||||
LyXParagraph * texrowpar;
|
||||
|
||||
#ifdef MOVE_TEXT
|
||||
if (tmpid == -1) {
|
||||
texrowpar = users->text->FirstParagraph();
|
||||
tmppos = 0;
|
||||
} else {
|
||||
texrowpar = users->text->GetParFromID(tmpid);
|
||||
}
|
||||
users->text->SetCursor(texrowpar, tmppos);
|
||||
#else
|
||||
if (tmpid == -1) {
|
||||
texrowpar = text->FirstParagraph();
|
||||
tmppos = 0;
|
||||
@ -3472,6 +3583,7 @@ void Buffer::setCursorFromRow (int row)
|
||||
texrowpar = text->GetParFromID(tmpid);
|
||||
}
|
||||
text->SetCursor(texrowpar, tmppos);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -3622,17 +3734,19 @@ void Buffer::markDviDirty()
|
||||
}
|
||||
|
||||
|
||||
#ifndef MOVE_TEXT
|
||||
// candidate for move to BufferView
|
||||
void Buffer::update(signed char f)
|
||||
{
|
||||
if (!users) return;
|
||||
|
||||
users->owner()->updateLayoutChoice();
|
||||
|
||||
if (!text->selection && f > -3)
|
||||
text->sel_cursor = text->cursor;
|
||||
|
||||
FreeUpdateTimer();
|
||||
text->FullRebreak();
|
||||
|
||||
users->update();
|
||||
|
||||
if (f != 3 && f != -3) {
|
||||
@ -3649,7 +3763,7 @@ void Buffer::update(signed char f)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void Buffer::validate(LaTeXFeatures & features)
|
||||
{
|
||||
@ -3762,6 +3876,60 @@ void Buffer::setOldPaperStuff()
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef MOVE_TEXT
|
||||
// candidate for move to BufferView
|
||||
void Buffer::insertInset(Inset * inset, string const & lout,
|
||||
bool no_table)
|
||||
{
|
||||
// check for table/list in tables
|
||||
if (no_table && users->text->cursor.par->table){
|
||||
WriteAlert(_("Impossible Operation!"),
|
||||
_("Cannot insert table/list in table."),
|
||||
_("Sorry."));
|
||||
return;
|
||||
}
|
||||
// not quite sure if we want this...
|
||||
users->text->SetCursorParUndo();
|
||||
users->text->FreezeUndo();
|
||||
|
||||
BeforeChange();
|
||||
if (!lout.empty()) {
|
||||
users->update(-2);
|
||||
users->text->BreakParagraph();
|
||||
users->update(-1);
|
||||
|
||||
if (users->text->cursor.par->Last()) {
|
||||
users->text->CursorLeft();
|
||||
|
||||
users->text->BreakParagraph();
|
||||
users->update(-1);
|
||||
}
|
||||
|
||||
int lay = textclasslist.NumberOfLayout(params.textclass,
|
||||
lout).second;
|
||||
if (lay == -1) // layout not found
|
||||
// use default layout "Standard" (0)
|
||||
lay = 0;
|
||||
|
||||
users->text->SetLayout(lay);
|
||||
|
||||
users->text->SetParagraph(0, 0,
|
||||
0, 0,
|
||||
VSpace(VSpace::NONE), VSpace(VSpace::NONE),
|
||||
LYX_ALIGN_LAYOUT,
|
||||
string(),
|
||||
0);
|
||||
users->update(-1);
|
||||
|
||||
users->text->current_font.setLatex(LyXFont::OFF);
|
||||
}
|
||||
|
||||
users->text->InsertInset(inset);
|
||||
users->update(-1);
|
||||
|
||||
users->text->UnFreezeUndo();
|
||||
}
|
||||
#else
|
||||
void Buffer::insertInset(Inset * inset, string const & lout,
|
||||
bool no_table)
|
||||
{
|
||||
@ -3813,17 +3981,27 @@ void Buffer::insertInset(Inset * inset, string const & lout,
|
||||
|
||||
text->UnFreezeUndo();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// Open and lock an updatable inset
|
||||
// candidate for move to BufferView
|
||||
void Buffer::open_new_inset(UpdatableInset * new_inset)
|
||||
{
|
||||
#ifdef MOVE_TEXT
|
||||
BeforeChange();
|
||||
users->text->FinishUndo();
|
||||
insertInset(new_inset);
|
||||
users->text->CursorLeft();
|
||||
users->update(1);
|
||||
new_inset->Edit(0, 0);
|
||||
#else
|
||||
BeforeChange();
|
||||
text->FinishUndo();
|
||||
insertInset(new_inset);
|
||||
text->CursorLeft();
|
||||
update(1);
|
||||
new_inset->Edit(0, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -3862,12 +4040,12 @@ string Buffer::getReferenceList(char delim)
|
||||
/// if this is a child document and the parent is already loaded
|
||||
/// Use the parent's list instead [ale990407]
|
||||
if (!params.parentname.empty() && bufferlist.exists(params.parentname)) {
|
||||
Buffer *tmp = bufferlist.getBuffer(params.parentname);
|
||||
Buffer * tmp = bufferlist.getBuffer(params.parentname);
|
||||
if (tmp)
|
||||
return tmp->getReferenceList(delim);
|
||||
}
|
||||
|
||||
LyXParagraph *par = paragraph;
|
||||
LyXParagraph * par = paragraph;
|
||||
LyXParagraph::size_type pos;
|
||||
Inset * inset;
|
||||
string lst;
|
||||
@ -3894,7 +4072,7 @@ string Buffer::getBibkeyList(char delim)
|
||||
/// if this is a child document and the parent is already loaded
|
||||
/// Use the parent's list instead [ale990412]
|
||||
if (!params.parentname.empty() && bufferlist.exists(params.parentname)) {
|
||||
Buffer *tmp = bufferlist.getBuffer(params.parentname);
|
||||
Buffer * tmp = bufferlist.getBuffer(params.parentname);
|
||||
if (tmp)
|
||||
return tmp->getBibkeyList(delim);
|
||||
}
|
||||
@ -3942,6 +4120,7 @@ string Buffer::getBibkeyList(char delim)
|
||||
}
|
||||
|
||||
|
||||
// candidate for move to BufferView
|
||||
/* This is also a buffer property (ale) */
|
||||
// Not so sure about that. a goto Label function can not be buffer local, just
|
||||
// think how this will work in a multiwindo/buffer environment, all the
|
||||
@ -3958,11 +4137,19 @@ bool Buffer::gotoLabel(string const & label)
|
||||
while ((inset = par->ReturnNextInsetPointer(pos))){
|
||||
for (int i = 0; i < inset->GetNumberOfLabels(); i++) {
|
||||
if (label == inset->getLabel(i)) {
|
||||
#ifdef MOVE_TEXT
|
||||
BeforeChange();
|
||||
users->text->SetCursor(par, pos);
|
||||
users->text->sel_cursor = users->text->cursor;
|
||||
users->update(0);
|
||||
return true;
|
||||
#else
|
||||
BeforeChange();
|
||||
text->SetCursor(par, pos);
|
||||
text->sel_cursor = text->cursor;
|
||||
update(0);
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
pos++;
|
||||
@ -4004,3 +4191,104 @@ void Buffer::markDepClean(string const & name)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Buffer::Dispatch(const string & command)
|
||||
{
|
||||
// Split command string into command and argument
|
||||
string cmd, line = frontStrip(command);
|
||||
string arg = strip(frontStrip(split(line, cmd, ' ')));
|
||||
|
||||
return Dispatch(lyxaction.LookupFunc(cmd.c_str()), arg.c_str());
|
||||
}
|
||||
|
||||
void Buffer::Dispatch(int action, const string & argument)
|
||||
{
|
||||
switch (action) {
|
||||
case LFUN_EXPORT: {
|
||||
// latex
|
||||
if (argument == "latex") {
|
||||
// make sure that this buffer is not linuxdoc
|
||||
MenuMakeLaTeX(this);
|
||||
}
|
||||
// linuxdoc
|
||||
else if (argument == "linuxdoc") {
|
||||
// make sure that this buffer is not latex
|
||||
MenuMakeLinuxDoc(this);
|
||||
}
|
||||
// docbook
|
||||
else if (argument == "docbook") {
|
||||
// make sure that this buffer is not latex or linuxdoc
|
||||
MenuMakeDocBook(this);
|
||||
}
|
||||
// dvi
|
||||
else if (argument == "dvi") {
|
||||
// Run LaTeX as "Update dvi..." Bernhard.
|
||||
// We want the dvi in the current directory. This
|
||||
// is achieved by temporarily disabling use of
|
||||
// temp directory. As a side-effect, we get
|
||||
// *.log and *.aux files also. (Asger)
|
||||
bool flag = lyxrc->use_tempdir;
|
||||
lyxrc->use_tempdir = false;
|
||||
MenuRunLaTeX(this);
|
||||
lyxrc->use_tempdir = flag;
|
||||
}
|
||||
// postscript
|
||||
else if (argument == "postscript") {
|
||||
// Start Print-dialog. Not as good as dvi... Bernhard.
|
||||
MenuPrint(this);
|
||||
// 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 (argument == "ascii") {
|
||||
MenuMakeAscii(this);
|
||||
}
|
||||
else if (argument == "custom") {
|
||||
MenuSendto();
|
||||
break;
|
||||
}
|
||||
// HTML
|
||||
else if (argument == "html" && lyxrc->html_command != "none") {
|
||||
// First, create LaTeX file
|
||||
MenuMakeLaTeX(this);
|
||||
|
||||
// And now, run the converter
|
||||
string file = fileName();
|
||||
Path path(OnlyPath(file));
|
||||
// the tex file name has to be correct for
|
||||
// latex, but the html file name can be
|
||||
// anything.
|
||||
string result = ChangeExtension(file, ".html", false);
|
||||
file = ChangeExtension(MakeLatexName(file), ".tex", false);
|
||||
string tmp = lyxrc->html_command;
|
||||
tmp = subst(tmp, "$$FName", file);
|
||||
tmp = subst(tmp, "$$OutName", result);
|
||||
Systemcalls one;
|
||||
/*int res = */ one.startscript(Systemcalls::System, tmp);
|
||||
//
|
||||
// Hi, Asger. This time I plead guilty and I promise to clean it up
|
||||
//
|
||||
// if (res == 0) {
|
||||
// setMessage(N_("Document exported as HTML to file `")
|
||||
// + MakeDisplayPath(result) +'\ '');
|
||||
// } else {
|
||||
// setErrorMessage(N_("Unable to convert to HTML the file `")
|
||||
// + MakeDisplayPath(file)
|
||||
// + '\'');
|
||||
// }
|
||||
}
|
||||
else {
|
||||
// setErrorMessage(N_("Unknown export type: ")
|
||||
// + argument);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
lyxerr << "A truly unknown func!" << endl;
|
||||
break;
|
||||
|
||||
} // end of switch
|
||||
|
||||
}
|
||||
|
38
src/buffer.h
38
src/buffer.h
@ -34,6 +34,7 @@
|
||||
#include "lyxtext.h"
|
||||
#include "support/filetools.h"
|
||||
|
||||
#define MOVE_TEXT 1
|
||||
|
||||
class LyXRC;
|
||||
class TeXErrors;
|
||||
@ -79,15 +80,26 @@ public:
|
||||
*/
|
||||
bool saveParamsAsDefaults();
|
||||
|
||||
/** high-level interface to buffer functionality
|
||||
This function parses a command string and executes it
|
||||
*/
|
||||
void Dispatch(const string & command);
|
||||
|
||||
/// Maybe we know the function already by number...
|
||||
void Dispatch(int ac, const string & argument);
|
||||
|
||||
/// should be changed to work for a list.
|
||||
void resize()
|
||||
{
|
||||
if (users) {
|
||||
users->resize();
|
||||
} else if (text) {
|
||||
}
|
||||
#ifndef MOVE_TEXT
|
||||
else if (text) {
|
||||
delete text;
|
||||
text = 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/// Update window titles of all users
|
||||
@ -106,9 +118,11 @@ public:
|
||||
Since we only can have one at the moment, we just reset it.
|
||||
*/
|
||||
void delUser(BufferView *){ users = 0; }
|
||||
|
||||
|
||||
#ifndef MOVE_TEXT
|
||||
///
|
||||
void update(signed char f);
|
||||
#endif
|
||||
|
||||
///
|
||||
void redraw() {
|
||||
@ -231,7 +245,7 @@ public:
|
||||
}
|
||||
|
||||
///
|
||||
string getFileName() const { return filename; }
|
||||
string const & fileName() const { return filename; }
|
||||
|
||||
/// A transformed version of the file name, adequate for LaTeX
|
||||
string getLatexName() const {
|
||||
@ -239,7 +253,7 @@ public:
|
||||
}
|
||||
|
||||
/// Change name of buffer. Updates "read-only" flag.
|
||||
void setFileName(string const & newfile);
|
||||
void fileName(string const & newfile);
|
||||
|
||||
/// Name of the document's parent
|
||||
void setParentName(string const &);
|
||||
@ -329,13 +343,14 @@ public:
|
||||
/** is a list of paragraphs.
|
||||
*/
|
||||
LyXParagraph * paragraph;
|
||||
|
||||
|
||||
#ifndef MOVE_TEXT
|
||||
/** This holds the mapping between buffer paragraphs and screen rows.
|
||||
Should be moved to BufferView. (Asger)
|
||||
*/
|
||||
LyXText * text;
|
||||
|
||||
///
|
||||
#endif
|
||||
/// per view not per buffer?
|
||||
UpdatableInset * the_locking_inset;
|
||||
|
||||
/// RCS object
|
||||
@ -350,7 +365,7 @@ public:
|
||||
/** While writing as LaTeX, tells whether we are
|
||||
doing a 'nice' LaTeX file */
|
||||
bool niceFile;
|
||||
protected:
|
||||
|
||||
///
|
||||
void InsetUnlock();
|
||||
|
||||
@ -377,7 +392,7 @@ private:
|
||||
///
|
||||
void DocBookHandleCaption(ostream & os, string & inner_tag,
|
||||
int const depth, int desc_on,
|
||||
LyXParagraph * &par);
|
||||
LyXParagraph * & par);
|
||||
///
|
||||
void DocBookHandleFootnote(ostream & os,
|
||||
LyXParagraph * & par, int const depth);
|
||||
@ -446,11 +461,6 @@ private:
|
||||
*/
|
||||
BufferView * users;
|
||||
|
||||
///
|
||||
friend class BufferList;
|
||||
///
|
||||
friend class BufferView;
|
||||
|
||||
/// Used when typesetting to place errorboxes.
|
||||
TexRow texrow;
|
||||
};
|
||||
|
@ -96,7 +96,7 @@ bool BufferList::QwriteAll()
|
||||
it != bstore.end(); ++it) {
|
||||
if (!(*it)->isLyxClean()) {
|
||||
switch(AskConfirmation(_("Changes in document:"),
|
||||
MakeDisplayPath((*it)->filename,
|
||||
MakeDisplayPath((*it)->fileName(),
|
||||
50),
|
||||
_("Save document?"))) {
|
||||
case 1: // Yes
|
||||
@ -104,7 +104,7 @@ bool BufferList::QwriteAll()
|
||||
break;
|
||||
case 2: // No
|
||||
askMoreConfirmation = true;
|
||||
unsaved += MakeDisplayPath((*it)->filename, 50);
|
||||
unsaved += MakeDisplayPath((*it)->fileName(), 50);
|
||||
unsaved += "\n";
|
||||
break;
|
||||
case 3: // Cancel
|
||||
@ -127,14 +127,14 @@ bool BufferList::QwriteAll()
|
||||
bool BufferList::write(Buffer * buf, bool makeBackup)
|
||||
{
|
||||
minibuffer->Set(_("Saving document"),
|
||||
MakeDisplayPath(buf->filename), "...");
|
||||
MakeDisplayPath(buf->fileName()), "...");
|
||||
|
||||
// We don't need autosaves in the immediate future. (Asger)
|
||||
buf->resetAutosaveTimers();
|
||||
|
||||
// make a backup
|
||||
if (makeBackup) {
|
||||
string s = buf->filename + '~';
|
||||
string s = buf->fileName() + '~';
|
||||
// Rename is the wrong way of making a backup,
|
||||
// this is the correct way.
|
||||
/* truss cp fil fil2:
|
||||
@ -159,7 +159,7 @@ bool BufferList::write(Buffer * buf, bool makeBackup)
|
||||
// Doing it this way, also makes the inodes stay the same.
|
||||
// This is still not a very good solution, in particular we
|
||||
// might loose the owner of the backup.
|
||||
FileInfo finfo(buf->filename);
|
||||
FileInfo finfo(buf->fileName());
|
||||
if (finfo.exist()) {
|
||||
mode_t fmode = finfo.getMode();
|
||||
|
||||
@ -169,7 +169,7 @@ bool BufferList::write(Buffer * buf, bool makeBackup)
|
||||
times->modtime = finfo.getModificationTime();
|
||||
long blksize = finfo.getBlockSize();
|
||||
lyxerr.debug() << "BlockSize: " << blksize << endl;
|
||||
FilePtr fin(buf->filename, FilePtr::read);
|
||||
FilePtr fin(buf->fileName(), FilePtr::read);
|
||||
FilePtr fout(s, FilePtr::truncate);
|
||||
if (fin() && fout()) {
|
||||
char * cbuf = new char[blksize+1];
|
||||
@ -196,16 +196,16 @@ bool BufferList::write(Buffer * buf, bool makeBackup)
|
||||
}
|
||||
}
|
||||
|
||||
if (buf->writeFile(buf->filename, false)) {
|
||||
if (buf->writeFile(buf->fileName(), false)) {
|
||||
buf->markLyxClean();
|
||||
|
||||
minibuffer->Set(_("Document saved as"),
|
||||
MakeDisplayPath(buf->filename));
|
||||
MakeDisplayPath(buf->fileName()));
|
||||
|
||||
// now delete the autosavefile
|
||||
string a = OnlyPath(buf->filename);
|
||||
string a = OnlyPath(buf->fileName());
|
||||
a += '#';
|
||||
a += OnlyFilename(buf->filename);
|
||||
a += OnlyFilename(buf->fileName());
|
||||
a += '#';
|
||||
FileInfo fileinfo(a);
|
||||
if (fileinfo.exist()) {
|
||||
@ -217,8 +217,8 @@ bool BufferList::write(Buffer * buf, bool makeBackup)
|
||||
} else {
|
||||
// Saving failed, so backup is not backup
|
||||
if (makeBackup) {
|
||||
string s = buf->filename + '~';
|
||||
rename(s.c_str(), buf->filename.c_str());
|
||||
string s = buf->fileName() + '~';
|
||||
rename(s.c_str(), buf->fileName().c_str());
|
||||
}
|
||||
minibuffer->Set(_("Save failed!"));
|
||||
return false;
|
||||
@ -254,11 +254,11 @@ bool BufferList::close(Buffer * buf)
|
||||
if (buf->paragraph && !buf->isLyxClean() && !quitting) {
|
||||
ProhibitInput();
|
||||
switch(AskConfirmation(_("Changes in document:"),
|
||||
MakeDisplayPath(buf->filename, 50),
|
||||
MakeDisplayPath(buf->fileName(), 50),
|
||||
_("Save document?"))){
|
||||
case 1: // Yes
|
||||
if (write(buf)) {
|
||||
lastfiles->newFile(buf->filename);
|
||||
lastfiles->newFile(buf->fileName());
|
||||
} else {
|
||||
AllowInput();
|
||||
return false;
|
||||
@ -284,7 +284,7 @@ void BufferList::makePup(int pup)
|
||||
int ant = 0;
|
||||
for(BufferStorage::iterator it = bstore.begin();
|
||||
it != bstore.end(); ++it) {
|
||||
string relbuf = MakeDisplayPath((*it)->filename, 30);
|
||||
string relbuf = MakeDisplayPath((*it)->fileName(), 30);
|
||||
fl_addtopup(pup, relbuf.c_str());
|
||||
++ant;
|
||||
}
|
||||
@ -310,11 +310,19 @@ void BufferList::updateInset(Inset * inset, bool mark_dirty)
|
||||
{
|
||||
for (BufferStorage::iterator it = bstore.begin();
|
||||
it != bstore.end(); ++it) {
|
||||
#ifdef MOVE_TEXT
|
||||
if ((*it)->getUser() && (*it)->getUser()->text->UpdateInset(inset)) {
|
||||
if (mark_dirty)
|
||||
(*it)->markDirty();
|
||||
break;
|
||||
}
|
||||
#else
|
||||
if ((*it)->text && (*it)->text->UpdateInset(inset)) {
|
||||
if (mark_dirty)
|
||||
(*it)->markDirty();
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -340,7 +348,7 @@ void BufferList::updateIncludedTeXfiles(string const & mastertmpdir)
|
||||
if (!(*it)->isDepClean(mastertmpdir)) {
|
||||
string writefile = mastertmpdir;
|
||||
writefile += '/';
|
||||
writefile += ChangeExtension((*it)->getFileName(),
|
||||
writefile += ChangeExtension((*it)->fileName(),
|
||||
".tex", true);
|
||||
(*it)->makeLaTeXFile(writefile, mastertmpdir,
|
||||
false, true);
|
||||
@ -360,7 +368,7 @@ void BufferList::emergencyWriteAll()
|
||||
|
||||
lyxerr <<_("lyx: Attempting to save"
|
||||
" document ")
|
||||
<< (*it)->filename
|
||||
<< (*it)->fileName()
|
||||
<< _(" as...") << endl;
|
||||
|
||||
for (int i = 0; i < 3 && !madeit; ++i) {
|
||||
@ -371,13 +379,13 @@ void BufferList::emergencyWriteAll()
|
||||
// 2) In HOME directory.
|
||||
// 3) In "/tmp" directory.
|
||||
if (i == 0) {
|
||||
s = (*it)->filename;
|
||||
s = (*it)->fileName();
|
||||
} else if (i == 1) {
|
||||
s = AddName(GetEnvPath("HOME"),
|
||||
(*it)->filename);
|
||||
(*it)->fileName());
|
||||
} else { // MakeAbsPath to prepend the current drive letter on OS/2
|
||||
s = AddName(MakeAbsPath("/tmp/"),
|
||||
(*it)->filename);
|
||||
(*it)->fileName());
|
||||
}
|
||||
s += ".emergency";
|
||||
|
||||
@ -473,7 +481,7 @@ bool BufferList::exists(string const & s)
|
||||
{
|
||||
for (BufferStorage::iterator it = bstore.begin();
|
||||
it != bstore.end(); ++it) {
|
||||
if ((*it)->filename == s)
|
||||
if ((*it)->fileName() == s)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -484,7 +492,7 @@ Buffer * BufferList::getBuffer(string const & s)
|
||||
{
|
||||
for(BufferStorage::iterator it = bstore.begin();
|
||||
it != bstore.end(); ++it) {
|
||||
if ((*it)->filename == s)
|
||||
if ((*it)->fileName() == s)
|
||||
return (*it);
|
||||
}
|
||||
return 0;
|
||||
@ -600,7 +608,7 @@ Buffer * BufferList::loadLyXFile(string const & filename, bool tolastfiles)
|
||||
}
|
||||
|
||||
if (b && tolastfiles)
|
||||
lastfiles->newFile(b->getFileName());
|
||||
lastfiles->newFile(b->fileName());
|
||||
|
||||
return b;
|
||||
}
|
||||
|
@ -1113,7 +1113,7 @@ void InsetFig::Write(ostream & os)
|
||||
Regenerate();
|
||||
os << "Figure size " << wid << " " << hgh << "\n";
|
||||
if (!fname.empty()) {
|
||||
string buf1 = OnlyPath(owner->getFileName());
|
||||
string buf1 = OnlyPath(owner->fileName());
|
||||
string fname2 = MakeRelPath(fname, buf1);
|
||||
os << "file " << fname2 << "\n";
|
||||
}
|
||||
@ -1145,7 +1145,7 @@ void InsetFig::Read(LyXLex & lex)
|
||||
} else if (token == "file") {
|
||||
if (lex.next()) {
|
||||
buf = lex.GetString();
|
||||
string buf1 = OnlyPath(owner->getFileName());
|
||||
string buf1 = OnlyPath(owner->fileName());
|
||||
fname = MakeAbsPath(buf, buf1);
|
||||
changedfname = true;
|
||||
}
|
||||
@ -1354,7 +1354,7 @@ void InsetFig::Regenerate()
|
||||
return;
|
||||
}
|
||||
|
||||
string buf1 = OnlyPath(owner->getFileName());
|
||||
string buf1 = OnlyPath(owner->fileName());
|
||||
string fname2 = MakeRelPath(fname, buf1);
|
||||
|
||||
string gcmd = "\\includegraphics{" + fname2 + '}';
|
||||
@ -1486,7 +1486,7 @@ void InsetFig::TempRegenerate()
|
||||
return;
|
||||
}
|
||||
|
||||
string buf1 = OnlyPath(owner->getFileName());
|
||||
string buf1 = OnlyPath(owner->fileName());
|
||||
string fname2 = MakeRelPath(tfname, buf1);
|
||||
// \includegraphics*[<llx,lly>][<urx,ury>]{file}
|
||||
string gcmd = "\\includegraphics{" + fname2 + '}';
|
||||
@ -1894,7 +1894,7 @@ void InsetFig::CallbackFig(long arg)
|
||||
angle = atof(fl_get_input(form->Angle));
|
||||
p = fl_get_input(form->EpsFile);
|
||||
if (p && *p) {
|
||||
string buf1 = OnlyPath(owner->getFileName());
|
||||
string buf1 = OnlyPath(owner->fileName());
|
||||
fname = MakeAbsPath(p, buf1);
|
||||
changedfname = true;
|
||||
} else {
|
||||
@ -1935,6 +1935,7 @@ void InsetFig::CallbackFig(long arg)
|
||||
fl_hide_form(form->Figure);
|
||||
#if FL_REVISION == 89
|
||||
#warning Reactivate this free_form calls
|
||||
#warning Jug, is this still a problem?
|
||||
#else
|
||||
fl_free_form(form->Figure);
|
||||
free(form);
|
||||
@ -2067,7 +2068,7 @@ void InsetFig::RestoreForm()
|
||||
sprintf(buf, "%g", angle);
|
||||
fl_set_input(form->Angle, buf);
|
||||
if (!fname.empty()){
|
||||
string buf1 = OnlyPath(owner->getFileName());
|
||||
string buf1 = OnlyPath(owner->fileName());
|
||||
string fname2 = MakeRelPath(fname, buf1);
|
||||
fl_set_input(form->EpsFile, fname2.c_str());
|
||||
}
|
||||
@ -2093,7 +2094,7 @@ void InsetFig::Preview(char const * p)
|
||||
return; // parent process
|
||||
}
|
||||
|
||||
string buf1 = OnlyPath(owner->getFileName());
|
||||
string buf1 = OnlyPath(owner->fileName());
|
||||
string buf2 = MakeAbsPath(p, buf1);
|
||||
|
||||
lyxerr << "Error during rendering "
|
||||
@ -2113,17 +2114,17 @@ void InsetFig::BrowseFile()
|
||||
|
||||
if (lyxerr.debugging()) {
|
||||
lyxerr << "Filename: "
|
||||
<< owner->getFileName() << endl;
|
||||
<< owner->fileName() << endl;
|
||||
}
|
||||
string p = fl_get_input(form->EpsFile);
|
||||
|
||||
string buf = MakeAbsPath(owner->getFileName());
|
||||
string buf = MakeAbsPath(owner->fileName());
|
||||
string buf2 = OnlyPath(buf);
|
||||
if (!p.empty()) {
|
||||
buf = MakeAbsPath(p, buf2);
|
||||
buf = OnlyPath(buf);
|
||||
} else {
|
||||
buf = OnlyPath(owner->getFileName().c_str());
|
||||
buf = OnlyPath(owner->fileName().c_str());
|
||||
}
|
||||
|
||||
// Does user clipart directory exist?
|
||||
|
@ -61,8 +61,13 @@ extern "C" void bibitem_cb(FL_OBJECT *, long data)
|
||||
inset->setOptions(fl_get_input(bibitem_form->label));
|
||||
fl_hide_form(bibitem_form->bibitem_form);
|
||||
// Does look like a hack? It is! (but will change at 0.13)
|
||||
#ifdef MOVE_TEXT
|
||||
current_view->text->RedoParagraph();
|
||||
current_view->update(1);
|
||||
#else
|
||||
current_view->buffer()->text->RedoParagraph();
|
||||
current_view->buffer()->update(1);
|
||||
#endif
|
||||
break;
|
||||
} // fall through to Cancel on RO-mode
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ public:
|
||||
///
|
||||
void setFilename(string const & n) { setContents(n); }
|
||||
///
|
||||
string getMasterFilename() const { return master->getFileName(); }
|
||||
string getMasterFilename() const { return master->fileName(); }
|
||||
///
|
||||
string getFileName() const {
|
||||
return filename;
|
||||
|
@ -32,7 +32,7 @@ InsetParent::InsetParent(string const & fn, Buffer * owner)
|
||||
: InsetCommand("lyxparent")
|
||||
{
|
||||
if (owner)
|
||||
setContents(MakeAbsPath(fn, OnlyPath(owner->getFileName())));
|
||||
setContents(MakeAbsPath(fn, OnlyPath(owner->fileName())));
|
||||
else
|
||||
setContents(fn);
|
||||
}
|
||||
|
11
src/intl.C
11
src/intl.C
@ -48,11 +48,6 @@ Intl::Intl()
|
||||
}
|
||||
|
||||
|
||||
Intl::~Intl()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
int Intl::SetPrimary(string const & lang)
|
||||
{
|
||||
if (lyxerr.debugging(Debug::KBMAP))
|
||||
@ -129,19 +124,17 @@ void Intl::ToggleKeyMap()
|
||||
|
||||
void Intl::KeyMapPrim()
|
||||
{
|
||||
int i;
|
||||
string p;
|
||||
|
||||
fl_set_button(fd_form_keymap->KeyOffBtn, 0);
|
||||
fl_set_button(fd_form_keymap->KeyOnBtn, 1);
|
||||
fl_set_button(fd_form_keymap->KeyOnBtn2, 0);
|
||||
|
||||
/* read text from choice */
|
||||
i = Language->get();
|
||||
int i = Language->get();
|
||||
|
||||
if (lyxerr.debugging(Debug::KBMAP))
|
||||
lyxerr << "Table: " << tex_babel[i-1] << endl;
|
||||
|
||||
string p;
|
||||
if (i == otherkeymap)
|
||||
p = fl_get_input(fd_form_keymap->OtherKeymap);
|
||||
else
|
||||
|
23
src/intl.h
23
src/intl.h
@ -31,8 +31,6 @@ class Intl
|
||||
public:
|
||||
///
|
||||
Intl();
|
||||
///
|
||||
~Intl();
|
||||
|
||||
/// show key mapping dialog
|
||||
void MenuKeymap();
|
||||
@ -52,23 +50,18 @@ public:
|
||||
///
|
||||
int SetSecondary(string const &);
|
||||
|
||||
// insert correct stuff into paragraph
|
||||
//void TranslateAndInsert(char c, LyXText *text);
|
||||
|
||||
/// initialize key mapper
|
||||
void InitKeyMapper(bool on);
|
||||
|
||||
/// Get the Translation Manager
|
||||
inline TransManager *getTrans();
|
||||
inline TransManager * getTrans();
|
||||
///
|
||||
bool keymapon;
|
||||
///
|
||||
char *chsetcode;
|
||||
char * chsetcode;
|
||||
///
|
||||
static void DispatchCallback(FL_OBJECT*, long);
|
||||
static void DispatchCallback(FL_OBJECT *, long);
|
||||
private:
|
||||
///
|
||||
//int SelectCharset(char const *code);
|
||||
///
|
||||
void update();
|
||||
///
|
||||
@ -85,21 +78,21 @@ private:
|
||||
int otherkeymap;
|
||||
|
||||
///
|
||||
FD_KeyMap *fd_form_keymap;
|
||||
FD_KeyMap * fd_form_keymap;
|
||||
///
|
||||
Combox *Language;
|
||||
Combox * Language;
|
||||
///
|
||||
Combox *Language2;
|
||||
Combox * Language2;
|
||||
///
|
||||
string & prim_lang;
|
||||
///
|
||||
string & sec_lang;
|
||||
///
|
||||
TransManager *trans;
|
||||
TransManager * trans;
|
||||
};
|
||||
|
||||
|
||||
TransManager* Intl::getTrans()
|
||||
TransManager * Intl::getTrans()
|
||||
{
|
||||
return trans;
|
||||
}
|
||||
|
992
src/lyx_cb.C
992
src/lyx_cb.C
File diff suppressed because it is too large
Load Diff
@ -413,6 +413,6 @@ void WarnReadonly()
|
||||
{
|
||||
WriteAlert(_("Any changes will be ignored"),
|
||||
_("The document is read-only:"),
|
||||
current_view->buffer()->getFileName());
|
||||
current_view->buffer()->fileName());
|
||||
}
|
||||
|
||||
|
@ -114,6 +114,16 @@ LyX::LyX(int * argc, char * argv[])
|
||||
lyxerr.debug() << "Yes we loaded some files." << endl;
|
||||
lyxGUI->regBuf(last_loaded);
|
||||
}
|
||||
|
||||
// Execute batch commands if available
|
||||
if (!batch_command.empty() && last_loaded) {
|
||||
lyxerr << "About to handle -x '" << batch_command << "'" << endl;
|
||||
//Buffer buffer("Script Buffer");
|
||||
//buffer.Dispatch(batch_command);
|
||||
last_loaded->Dispatch(batch_command);
|
||||
lyxerr << "We are done!" << endl;
|
||||
return; // Maybe we could do something more clever than aborting..
|
||||
}
|
||||
|
||||
// Let the ball begin...
|
||||
lyxGUI->runTime();
|
||||
@ -473,30 +483,30 @@ bool LyX::easyParse(int * argc, char * argv[])
|
||||
string arg = argv[i];
|
||||
// Check for -dbg int
|
||||
if (arg == "-dbg") {
|
||||
if (i+1 < *argc) {
|
||||
setDebuggingLevel(argv[i+1]);
|
||||
if (i + 1 < *argc) {
|
||||
setDebuggingLevel(argv[i + 1]);
|
||||
|
||||
// Now, remove these two arguments by shifting
|
||||
// the following two places down.
|
||||
(*argc) -= 2;
|
||||
for (int j= i; j < (*argc); j++)
|
||||
argv[j] = argv[j+2];
|
||||
i--; // After shift, check this number again.
|
||||
for (int j = i; j < (*argc); ++j)
|
||||
argv[j] = argv[j + 2];
|
||||
--i; // After shift, check this number again.
|
||||
} else
|
||||
lyxerr << _("Missing number for -dbg switch!")
|
||||
<< endl;
|
||||
}
|
||||
// Check for "-sysdir"
|
||||
else if (arg == "-sysdir") {
|
||||
if (i+1 < *argc) {
|
||||
system_lyxdir = argv[i+1];
|
||||
if (i + 1 < *argc) {
|
||||
system_lyxdir = argv[i + 1];
|
||||
|
||||
// Now, remove these two arguments by shifting
|
||||
// the following two places down.
|
||||
(*argc) -= 2;
|
||||
for (int j= i; j < (*argc); j++)
|
||||
argv[j] = argv[j+2];
|
||||
i--; // After shift, check this number again.
|
||||
for (int j= i; j < (*argc); ++j)
|
||||
argv[j] = argv[j + 2];
|
||||
--i; // After shift, check this number again.
|
||||
} else
|
||||
lyxerr << _("Missing directory for -sysdir switch!")
|
||||
<< endl;
|
||||
@ -509,6 +519,56 @@ bool LyX::easyParse(int * argc, char * argv[])
|
||||
else if (arg == "-nw") {
|
||||
gui = false;
|
||||
}
|
||||
|
||||
// Check for "-x": Execute commands
|
||||
else if (arg == "-x" || arg == "--execute") {
|
||||
if (i + 1 < *argc) {
|
||||
batch_command = string(argv[i + 1]);
|
||||
|
||||
// Now, remove these two arguments by shifting
|
||||
// the following two places down.
|
||||
(*argc) -= 2;
|
||||
for (int j = i; j < (*argc); ++j)
|
||||
argv[j] = argv[j + 2];
|
||||
--i; // After shift, check this number again.
|
||||
|
||||
}
|
||||
else
|
||||
lyxerr << _("Missing command string after -x switch!") << endl;
|
||||
|
||||
// Argh. Setting gui to false segfaults..
|
||||
//gui = false;
|
||||
}
|
||||
|
||||
else if (arg == "-e" || arg == "--export") {
|
||||
if (i + 1 < *argc) {
|
||||
string type(argv[i+1]);
|
||||
|
||||
(*argc) -= 2;
|
||||
for (int j = i; j < (*argc); ++j)
|
||||
argv[j] = argv[j + 2];
|
||||
--i; // After shift, check this number again.
|
||||
|
||||
if (type == "tex")
|
||||
type = "latex";
|
||||
else if (type == "ps")
|
||||
type = "postscript";
|
||||
else if (type == "text" || type == "txt")
|
||||
type = "ascii";
|
||||
|
||||
if (type == "latex" || type == "postscript"
|
||||
|| type == "ascii" || type == "html")
|
||||
batch_command = "buffer-export " + type;
|
||||
else
|
||||
lyxerr << _("Unknown file type '")
|
||||
<< type << _("' after ")
|
||||
<< arg << _(" switch!") << endl;
|
||||
}
|
||||
else
|
||||
lyxerr << _("Missing file type [eg latex, "
|
||||
"ps...] after ")
|
||||
<< arg << _(" switch!") << endl;
|
||||
}
|
||||
}
|
||||
return gui;
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ public:
|
||||
/**@name Constructors and Deconstructors */
|
||||
//@{
|
||||
/// the only allowed constructor
|
||||
LyX(int *argc, char *argv[]); // constructor
|
||||
LyX(int * argc, char * argv[]); // constructor
|
||||
// Always is useful a destructor
|
||||
~LyX();
|
||||
//@}
|
||||
@ -58,9 +58,9 @@ private:
|
||||
/**@name Constructors and Deconstructors */
|
||||
//@{
|
||||
/// not allowed
|
||||
LyX(const LyX &){;} // not allowed
|
||||
LyX(const LyX &) {} // not allowed
|
||||
/// not allowed
|
||||
LyX(){;} // not allowed
|
||||
LyX() {} // not allowed
|
||||
//@}
|
||||
|
||||
/**@name Private variables */
|
||||
@ -68,6 +68,8 @@ private:
|
||||
/// does this user start lyx for the first time?
|
||||
bool first_start;
|
||||
///
|
||||
string batch_command;
|
||||
///
|
||||
struct sigaction act_;
|
||||
//@}
|
||||
/**@name Private Members */
|
||||
|
66
src/lyxfr1.C
66
src/lyxfr1.C
@ -131,16 +131,19 @@ void LyXFindReplace1::StartSearch()
|
||||
LyXFindReplace0::StartSearch();
|
||||
SetReplaceEnabled(!current_view->buffer()->isReadonly());
|
||||
searchForward = true;
|
||||
#ifdef MOVE_TEXT
|
||||
if (lsSearch.empty())
|
||||
SetSearchString(GetSelectionOrWordAtCursor(current_view->text));
|
||||
#else
|
||||
if (lsSearch.empty())
|
||||
SetSearchString(GetSelectionOrWordAtCursor(current_view->buffer()->text));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
// TODO?: the user can insert multiple spaces with this routine (1999-01-11, dnaber)
|
||||
void LyXFindReplace1::SearchReplaceCB()
|
||||
{
|
||||
LyXText *ltCur;
|
||||
|
||||
if (!current_view->getScreen())
|
||||
return;
|
||||
if (current_view->buffer()->isReadonly())
|
||||
@ -159,9 +162,23 @@ void LyXFindReplace1::SearchReplaceCB()
|
||||
string const replacestring = ReplaceString();
|
||||
|
||||
current_view->getScreen()->HideCursor();
|
||||
#ifdef MOVE_TEXT
|
||||
current_view->update(-2);
|
||||
|
||||
LyXText * ltCur = current_view->text;
|
||||
if (ltCur->selection) {
|
||||
// clear the selection (if there is any)
|
||||
current_view->getScreen()->ToggleSelection(false);
|
||||
current_view->text->
|
||||
ReplaceSelectionWithString(replacestring.c_str());
|
||||
current_view->text->
|
||||
SetSelectionOverString(replacestring.c_str());
|
||||
current_view->update(1);
|
||||
}
|
||||
#else
|
||||
current_view->buffer()->update(-2);
|
||||
|
||||
ltCur = current_view->buffer()->text;
|
||||
LyXText * ltCur = current_view->buffer()->text;
|
||||
if (ltCur->selection) {
|
||||
// clear the selection (if there is any)
|
||||
current_view->getScreen()->ToggleSelection(false);
|
||||
@ -171,6 +188,7 @@ void LyXFindReplace1::SearchReplaceCB()
|
||||
SetSelectionOverString(replacestring.c_str());
|
||||
current_view->buffer()->update(1);
|
||||
}
|
||||
#endif
|
||||
|
||||
// jump to next match:
|
||||
SearchCB( searchForward );
|
||||
@ -180,7 +198,7 @@ void LyXFindReplace1::SearchReplaceCB()
|
||||
// replaces all occurences of a string (1999-01-15, dnaber@mini.gt.owl.de)
|
||||
void LyXFindReplace1::SearchReplaceAllCB()
|
||||
{
|
||||
LyXText *ltCur;
|
||||
LyXText * ltCur;
|
||||
|
||||
if (!current_view->getScreen())
|
||||
return;
|
||||
@ -201,6 +219,26 @@ void LyXFindReplace1::SearchReplaceAllCB()
|
||||
|
||||
current_view->getScreen()->HideCursor();
|
||||
|
||||
#ifdef MOVE_TEXT
|
||||
// start at top
|
||||
current_view->text->ClearSelection();
|
||||
current_view->text->CursorTop();
|
||||
|
||||
int replace_count = 0;
|
||||
do {
|
||||
ltCur = current_view->text;
|
||||
if (ltCur->selection) {
|
||||
current_view->update(-2);
|
||||
current_view->getScreen()->ToggleSelection(false);
|
||||
current_view->text->
|
||||
ReplaceSelectionWithString(replacestring.c_str());
|
||||
current_view->text->
|
||||
SetSelectionOverString(replacestring.c_str());
|
||||
current_view->update(1);
|
||||
++replace_count;
|
||||
}
|
||||
} while( SearchCB(true) );
|
||||
#else
|
||||
// start at top
|
||||
current_view->buffer()->text->ClearSelection();
|
||||
current_view->buffer()->text->CursorTop();
|
||||
@ -219,7 +257,7 @@ void LyXFindReplace1::SearchReplaceAllCB()
|
||||
replace_count++;
|
||||
}
|
||||
} while( SearchCB(true) );
|
||||
|
||||
#endif
|
||||
if( replace_count == 0 ) {
|
||||
LyXBell();
|
||||
minibuffer->Set(_("String not found!"));
|
||||
@ -237,7 +275,7 @@ void LyXFindReplace1::SearchReplaceAllCB()
|
||||
|
||||
bool LyXFindReplace1::SearchCB(bool fForward)
|
||||
{
|
||||
LyXText *ltCur;
|
||||
LyXText * ltCur;
|
||||
bool result;
|
||||
|
||||
// store search direction
|
||||
@ -247,8 +285,13 @@ bool LyXFindReplace1::SearchCB(bool fForward)
|
||||
return(false);
|
||||
|
||||
current_view->getScreen()->HideCursor();
|
||||
#ifdef MOVE_TEXT
|
||||
current_view->update(-2);
|
||||
ltCur = current_view->text;
|
||||
#else
|
||||
current_view->buffer()->update(-2);
|
||||
ltCur = current_view->buffer()->text;
|
||||
#endif
|
||||
if (ltCur->selection)
|
||||
ltCur->cursor = fForward ? ltCur->sel_end_cursor :
|
||||
ltCur->sel_start_cursor;
|
||||
@ -258,6 +301,16 @@ bool LyXFindReplace1::SearchCB(bool fForward)
|
||||
|
||||
if (!ValidSearchData() ||
|
||||
(fForward ? SearchForward(ltCur) : SearchBackward(ltCur))) {
|
||||
#ifdef MOVE_TEXT
|
||||
current_view->update(-2);
|
||||
|
||||
// clear the selection (if there is any)
|
||||
current_view->getScreen()->ToggleSelection();
|
||||
current_view->text->ClearSelection();
|
||||
|
||||
// set the new selection
|
||||
SetSelectionOverLenChars(current_view->text, iLenSelected);
|
||||
#else
|
||||
current_view->buffer()->update(-2);
|
||||
|
||||
// clear the selection (if there is any)
|
||||
@ -266,6 +319,7 @@ bool LyXFindReplace1::SearchCB(bool fForward)
|
||||
|
||||
// set the new selection
|
||||
SetSelectionOverLenChars(current_view->buffer()->text, iLenSelected);
|
||||
#endif
|
||||
current_view->getScreen()->ToggleSelection(false);
|
||||
minibuffer->Set(_("Found."));
|
||||
result = true;
|
||||
|
2115
src/lyxfunc.C
2115
src/lyxfunc.C
File diff suppressed because it is too large
Load Diff
@ -78,14 +78,14 @@ void LyXVC::registrer()
|
||||
// so... we use RCS as default, later this should perhaps be
|
||||
// a lyxrc option.
|
||||
if (!vcs) {
|
||||
vcs = new RCS(owner_->getFileName());
|
||||
vcs = new RCS(owner_->fileName());
|
||||
vcs->owner(owner_);
|
||||
}
|
||||
|
||||
// If the document is changed, we might want to save it
|
||||
if (!vcs->owner()->isLyxClean() &&
|
||||
AskQuestion(_("Changes in document:"),
|
||||
MakeDisplayPath(vcs->owner()->getFileName(), 50),
|
||||
MakeDisplayPath(vcs->owner()->fileName(), 50),
|
||||
_("Save document and proceed?"))) {
|
||||
vcs->owner()->getUser()->owner()
|
||||
->getLyXFunc()->Dispatch(LFUN_MENUWRITE);
|
||||
@ -115,7 +115,7 @@ void LyXVC::checkIn()
|
||||
// If the document is changed, we might want to save it
|
||||
if (!vcs->owner()->isLyxClean() &&
|
||||
AskQuestion(_("Changes in document:"),
|
||||
MakeDisplayPath(vcs->owner()->getFileName(), 50),
|
||||
MakeDisplayPath(vcs->owner()->fileName(), 50),
|
||||
_("Save document and proceed?"))) {
|
||||
vcs->owner()->getUser()->owner()
|
||||
->getLyXFunc()->Dispatch(LFUN_MENUWRITE);
|
||||
@ -141,7 +141,7 @@ void LyXVC::checkOut()
|
||||
lyxerr[Debug::LYXVC] << "LyXVC: checkOut" << endl;
|
||||
if (!vcs->owner()->isLyxClean()
|
||||
&& !AskQuestion(_("Changes in document:"),
|
||||
MakeDisplayPath(vcs->owner()->getFileName(), 50),
|
||||
MakeDisplayPath(vcs->owner()->fileName(), 50),
|
||||
_("Ignore changes and proceed with check out?"))) {
|
||||
return;
|
||||
}
|
||||
|
333
src/menus.C
333
src/menus.C
@ -800,7 +800,328 @@ void Menus::ShowFileMenu2(FL_OBJECT * ob, long)
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef MOVE_TEXT
|
||||
void Menus::ShowEditMenu(FL_OBJECT * ob, long)
|
||||
{
|
||||
Menus * men = static_cast<Menus*>(ob->u_vdata);
|
||||
|
||||
// set the pseudo menu-button
|
||||
fl_set_object_boxtype(ob, FL_UP_BOX);
|
||||
fl_set_button(ob, 0);
|
||||
fl_redraw_object(ob);
|
||||
|
||||
Buffer * tmpbuffer = men->_view->buffer();
|
||||
LyXFunc * tmpfunc = men->_view->getLyXFunc();
|
||||
|
||||
// Floats & Insets submenu
|
||||
int SubEditFloats= fl_defpup(FL_ObjWin(ob),
|
||||
_("Floats & Insets%t"
|
||||
"|Open/Close%x21"
|
||||
"|Melt%x22"
|
||||
"|Open All Footnotes/Margin Notes%x23"
|
||||
"|Close All Footnotes/Margin Notes%x24"
|
||||
"|Open All Figures/Tables%x25"
|
||||
"|Close All Figures/Tables%x26%l"
|
||||
"|Remove all Error Boxes%x27"));
|
||||
|
||||
fl_setpup_shortcut(SubEditFloats, 21, scex(_("EMF|Oo#o#O")));
|
||||
fl_setpup_shortcut(SubEditFloats, 22, scex(_("EMF|Mm#m#M")));
|
||||
fl_setpup_shortcut(SubEditFloats, 23, scex(_("EMF|Aa#a#A")));
|
||||
fl_setpup_shortcut(SubEditFloats, 24, scex(_("EMF|Cc#c#C")));
|
||||
fl_setpup_shortcut(SubEditFloats, 25, scex(_("EMF|Ff#f#F")));
|
||||
fl_setpup_shortcut(SubEditFloats, 26, scex(_("EMF|Tt#t#T")));
|
||||
fl_setpup_shortcut(SubEditFloats, 27, scex(_("EMF|Rr#r#R")));
|
||||
|
||||
// Table submenu
|
||||
int SubEditTable = fl_newpup(FL_ObjWin(ob));
|
||||
if (men->currentView()->available() &&
|
||||
men->currentView()->text->cursor.par->table &&
|
||||
!tmpbuffer->isReadonly()){
|
||||
|
||||
fl_addtopup(SubEditTable, _("Table%t"));
|
||||
|
||||
if (men->currentView()->text->cursor.par->table->
|
||||
IsMultiColumn(men->currentView()->text->
|
||||
NumberOfCell(men->currentView()->
|
||||
text->cursor.par,
|
||||
men->currentView()->
|
||||
text->cursor.pos)))
|
||||
fl_addtopup(SubEditTable, _("|Multicolumn%B%x44%l"));
|
||||
else
|
||||
fl_addtopup(SubEditTable, _("|Multicolumn%b%x44%l"));
|
||||
fl_setpup_shortcut(SubEditTable, 44, scex(_("EMT|Mm#m#M")));
|
||||
|
||||
if (men->currentView()->text->cursor.par->table->
|
||||
TopLine(men->currentView()->text->
|
||||
NumberOfCell(men->currentView()->
|
||||
text->cursor.par,
|
||||
men->currentView()->text->
|
||||
cursor.pos)))
|
||||
fl_addtopup(SubEditTable, _("|Line Top%B%x36"));
|
||||
else
|
||||
fl_addtopup(SubEditTable, _("|Line Top%b%x36"));
|
||||
fl_setpup_shortcut(SubEditTable, 36, scex(_("EMT|Tt#t#T")));
|
||||
|
||||
if (men->currentView()->text->cursor.par->table->
|
||||
BottomLine(men->currentView()->text->
|
||||
NumberOfCell(men->currentView()->
|
||||
text->cursor.par,
|
||||
men->currentView()->
|
||||
text->cursor.pos)))
|
||||
fl_addtopup(SubEditTable, _("|Line Bottom%B%x37"));
|
||||
else
|
||||
fl_addtopup(SubEditTable, _("|Line Bottom%b%x37"));
|
||||
fl_setpup_shortcut(SubEditTable, 37, scex(_("EMT|Bb#b#B")));
|
||||
|
||||
if (men->currentView()->text->cursor.par->table->
|
||||
LeftLine(men->currentView()->text->
|
||||
NumberOfCell(men->currentView()->
|
||||
text->cursor.par,
|
||||
men->currentView()->
|
||||
text->cursor.pos)))
|
||||
fl_addtopup(SubEditTable, _("|Line Left%B%x38"));
|
||||
else
|
||||
fl_addtopup(SubEditTable, _("|Line Left%b%x38"));
|
||||
fl_setpup_shortcut(SubEditTable, 38, scex(_("EMT|Ll#l#L")));
|
||||
|
||||
if (men->currentView()->text->cursor.par->table->
|
||||
RightLine(men->currentView()->text->
|
||||
NumberOfCell(men->currentView()->
|
||||
text->cursor.par,
|
||||
men->currentView()->
|
||||
text->cursor.pos)))
|
||||
fl_addtopup(SubEditTable, _("|Line Right%B%x39%l"));
|
||||
else
|
||||
fl_addtopup(SubEditTable, _("|Line Right%b%x39%l"));
|
||||
fl_setpup_shortcut(SubEditTable, 39, scex(_("EMT|Rr#r#R")));
|
||||
|
||||
int align = men->currentView()->text->cursor.par->
|
||||
table->GetAlignment(men->currentView()->text->
|
||||
NumberOfCell(men->currentView()->
|
||||
text->cursor.par,
|
||||
men->currentView()->
|
||||
text->cursor.pos));
|
||||
if (align == LYX_ALIGN_LEFT)
|
||||
fl_addtopup(SubEditTable, _("|Align Left%R%x40"));
|
||||
else
|
||||
fl_addtopup(SubEditTable, _("|Align Left%r%x40"));
|
||||
fl_setpup_shortcut(SubEditTable, 40, scex(_("EMT|eE#e#E")));
|
||||
|
||||
if (align == LYX_ALIGN_RIGHT)
|
||||
fl_addtopup(SubEditTable, _("|Align Right%R%x41"));
|
||||
else
|
||||
fl_addtopup(SubEditTable, _("|Align Right%r%x41"));
|
||||
fl_setpup_shortcut(SubEditTable, 41, scex(_("EMT|iI#i#I")));
|
||||
|
||||
if (align == LYX_ALIGN_CENTER)
|
||||
fl_addtopup(SubEditTable, _("|Align Center%R%x42%l"));
|
||||
else
|
||||
fl_addtopup(SubEditTable, _("|Align Center%r%x42%l"));
|
||||
fl_setpup_shortcut(SubEditTable, 42, scex(_("EMT|Cc#c#C")));
|
||||
|
||||
// xgettext:no-c-format
|
||||
fl_addtopup(SubEditTable, _("|Append Row%x32"));
|
||||
fl_setpup_shortcut(SubEditTable, 32, scex(_("EMT|oO#o#O")));
|
||||
// xgettext:no-c-format
|
||||
fl_addtopup(SubEditTable, _("|Append Column%x33%l"));
|
||||
fl_setpup_shortcut(SubEditTable, 33, scex(_("EMT|uU#u#U")));
|
||||
// xgettext:no-c-format
|
||||
fl_addtopup(SubEditTable, _("|Delete Row%x34"));
|
||||
fl_setpup_shortcut(SubEditTable, 34, scex(_("EMT|wW#w#W")));
|
||||
// xgettext:no-c-format
|
||||
fl_addtopup(SubEditTable, _("|Delete Column%x35%l"));
|
||||
fl_setpup_shortcut(SubEditTable, 35, scex(_("EMT|nN#n#N")));
|
||||
// xgettext:no-c-format
|
||||
fl_addtopup(SubEditTable, _("|Delete Table%x43"));
|
||||
fl_setpup_shortcut(SubEditTable, 43, scex(_("EMT|Dd#d#D")));
|
||||
}
|
||||
else {
|
||||
fl_addtopup(SubEditTable, _("Table%t"));
|
||||
// xgettext:no-c-format
|
||||
fl_addtopup(SubEditTable, _("|Insert table%x31"));
|
||||
fl_setpup_shortcut(SubEditTable, 31, scex(_("EMT|Ii#i#I")));
|
||||
}
|
||||
|
||||
int SubVersionControl = fl_newpup(FL_ObjWin(ob));
|
||||
fl_addtopup(SubVersionControl, _("Version Control%t"));
|
||||
if (tmpbuffer->lyxvc.inUse()) {
|
||||
// xgettext:no-c-format
|
||||
fl_addtopup(SubVersionControl, _("|Register%d%x51"));
|
||||
if (tmpbuffer->isReadonly()) {
|
||||
// signifies that the file is not checked out
|
||||
// xgettext:no-c-format
|
||||
fl_addtopup(SubVersionControl, _("|Check In Changes%d%x52"));
|
||||
// xgettext:no-c-format
|
||||
fl_addtopup(SubVersionControl, _("|Check Out for Edit%x53"));
|
||||
} else {
|
||||
// signifies that the file is checked out
|
||||
// xgettext:no-c-format
|
||||
fl_addtopup(SubVersionControl, _("|Check In Changes%x52"));
|
||||
// xgettext:no-c-format
|
||||
fl_addtopup(SubVersionControl, _("|Check Out for Edit%d%x53"));
|
||||
}
|
||||
// xgettext:no-c-format
|
||||
fl_addtopup(SubVersionControl, _("|Revert to last version%x54"));
|
||||
// xgettext:no-c-format
|
||||
fl_addtopup(SubVersionControl, _("|Undo last check in%x55"));
|
||||
// xgettext:no-c-format
|
||||
fl_addtopup(SubVersionControl, _("|Show History%x56"));
|
||||
} else {
|
||||
// xgettext:no-c-format
|
||||
fl_addtopup(SubVersionControl, _("|Register%x51"));
|
||||
}
|
||||
// the shortcuts are not good.
|
||||
fl_setpup_shortcut(SubVersionControl, 51, scex(_("EMV|Rr#r#R")));
|
||||
fl_setpup_shortcut(SubVersionControl, 52, scex(_("EMV|Ii#i#I")));
|
||||
fl_setpup_shortcut(SubVersionControl, 53, scex(_("EMV|Oo#o#O")));
|
||||
fl_setpup_shortcut(SubVersionControl, 54, scex(_("EMV|lL#l#l")));
|
||||
fl_setpup_shortcut(SubVersionControl, 55, scex(_("EMV|Uu#u#U")));
|
||||
fl_setpup_shortcut(SubVersionControl, 56, scex(_("EMV|Hh#h#H")));
|
||||
|
||||
int EditMenu= fl_defpup(FL_ObjWin(ob),
|
||||
_("Undo"
|
||||
"|Redo %l"
|
||||
"|Cut"
|
||||
"|Copy"
|
||||
"|Paste%l"
|
||||
"|Find & Replace..."
|
||||
"|Go to Error"
|
||||
"|Go to Note"
|
||||
"|Floats & Insets%m"
|
||||
"|Table%m"
|
||||
"|Spellchecker...."
|
||||
"|Check TeX"
|
||||
"|Table of Contents...%l"
|
||||
"|Version Control%m%l"
|
||||
"|View LaTeX log file%l"
|
||||
"|Paste Primary Selection as Lines"
|
||||
"|Paste Primary Selection as Paragraphs"),
|
||||
SubEditFloats, SubEditTable, SubVersionControl);
|
||||
|
||||
fl_setpup_shortcut(EditMenu, 1, scex(_("EM|Uu#u#U")));
|
||||
fl_setpup_shortcut(EditMenu, 2, scex(_("EM|Rr#r#R")));
|
||||
fl_setpup_shortcut(EditMenu, 3, scex(_("EM|Cc#c#C")));
|
||||
fl_setpup_shortcut(EditMenu, 4, scex(_("EM|oO#o#O")));
|
||||
fl_setpup_shortcut(EditMenu, 5, scex(_("EM|Pp#p#P")));
|
||||
fl_setpup_shortcut(EditMenu, 6, scex(_("EM|Ff#f#F")));
|
||||
fl_setpup_shortcut(EditMenu, 7, scex(_("EM|Ee#e#E")));
|
||||
fl_setpup_shortcut(EditMenu, 8, scex(_("EM|Nn#n#N")));
|
||||
fl_setpup_shortcut(EditMenu, 9, scex(_("EM|Ii#i#I")));
|
||||
fl_setpup_shortcut(EditMenu, 10, scex(_("EM|Tt#t#T")));
|
||||
fl_setpup_shortcut(EditMenu, 11, scex(_("EM|Ss#s#S")));
|
||||
fl_setpup_shortcut(EditMenu, 12, scex(_("EM|hH#h#H")));
|
||||
fl_setpup_shortcut(EditMenu, 13, scex(_("EM|aA#a#A")));
|
||||
fl_setpup_shortcut(EditMenu, 14, scex(_("EM|Vv#v#V")));
|
||||
fl_setpup_shortcut(EditMenu, 15, scex(_("EM|wW#w#W")));
|
||||
fl_setpup_shortcut(EditMenu, 16, scex(_("EM|Ll#l#L")));
|
||||
fl_setpup_shortcut(EditMenu, 17, scex(_("EM|gG#g#G")));
|
||||
|
||||
// disable unavailable entries.
|
||||
if(tmpbuffer->undostack.empty())
|
||||
fl_setpup_mode(EditMenu, 1, FL_PUP_GREY);
|
||||
if(tmpbuffer->redostack.empty())
|
||||
fl_setpup_mode(EditMenu, 2, FL_PUP_GREY);
|
||||
if(lyxrc->isp_command == "none")
|
||||
fl_setpup_mode(EditMenu, 11, FL_PUP_GREY);
|
||||
if(lyxrc->chktex_command == "none")
|
||||
fl_setpup_mode(EditMenu, 12, FL_PUP_GREY);
|
||||
|
||||
if (tmpbuffer->isReadonly()) {
|
||||
fl_setpup_mode(EditMenu, 1, FL_PUP_GREY);
|
||||
fl_setpup_mode(EditMenu, 2, FL_PUP_GREY);
|
||||
fl_setpup_mode(EditMenu, 3, FL_PUP_GREY);
|
||||
fl_setpup_mode(EditMenu, 5, FL_PUP_GREY);
|
||||
fl_setpup_mode(EditMenu, 16, FL_PUP_GREY);
|
||||
fl_setpup_mode(EditMenu, 17, FL_PUP_GREY);
|
||||
}
|
||||
|
||||
fl_setpup_position(men->_view->getForm()->x + ob->x,
|
||||
men->_view->getForm()->y + ob->y +
|
||||
ob->h + 10);
|
||||
int choice = fl_dopup(EditMenu);
|
||||
XFlush(fl_display);
|
||||
|
||||
// set the pseudo menu-button back
|
||||
fl_set_object_boxtype(ob, FL_FLAT_BOX);
|
||||
fl_redraw_object(ob);
|
||||
|
||||
switch (choice) {
|
||||
case 1: tmpfunc->Dispatch(LFUN_UNDO); break;
|
||||
case 2: tmpfunc->Dispatch(LFUN_REDO); break;
|
||||
case 3: tmpfunc->Dispatch(LFUN_CUT); break;
|
||||
case 4: tmpfunc->Dispatch(LFUN_COPY); break;
|
||||
case 5: tmpfunc->Dispatch(LFUN_PASTE); break;
|
||||
case 6: tmpfunc->Dispatch(LFUN_MENUSEARCH); break;
|
||||
case 7: tmpfunc->Dispatch(LFUN_GOTOERROR); break;
|
||||
case 8: tmpfunc->Dispatch(LFUN_GOTONOTE); break;
|
||||
case 9: // floats & insets
|
||||
break;
|
||||
case 10:// table
|
||||
break;
|
||||
case 11: tmpfunc->Dispatch(LFUN_SPELLCHECK); break;
|
||||
case 12: tmpfunc->Dispatch(LFUN_RUNCHKTEX); break;
|
||||
case 13: tmpfunc->Dispatch(LFUN_TOCVIEW); break;
|
||||
case 14: // version control
|
||||
break;
|
||||
case 15: tmpfunc->Dispatch(LFUN_LATEX_LOG); break;
|
||||
case 16: tmpfunc->Dispatch(LFUN_PASTESELECTION, "line"); break;
|
||||
case 17: tmpfunc->Dispatch(LFUN_PASTESELECTION, "paragraph"); break;
|
||||
|
||||
// floats & insets sub-menu
|
||||
case 21: ToggleFloat(); break;
|
||||
case 22: tmpfunc->Dispatch(LFUN_MELT); break;
|
||||
case 23: AllFloats(1, 0); break;
|
||||
case 24: AllFloats(0, 0); break;
|
||||
case 25: AllFloats(1, 1); break;
|
||||
case 26: AllFloats(0, 1); break;
|
||||
case 27: tmpfunc->Dispatch(LFUN_REMOVEERRORS); break;
|
||||
|
||||
case 31: tmpfunc->Dispatch(LFUN_TABLE); break;
|
||||
// this is really temporary. We need new function in keybind.C
|
||||
// These should set the minibuffer, too.
|
||||
case 32: case 33: case 34:
|
||||
case 35: case 36: case 37:
|
||||
case 38: case 39: case 40:
|
||||
case 41: case 42: case 43:
|
||||
case 44:
|
||||
if (men->currentView()->available()){
|
||||
men->currentView()->getScreen()->HideCursor();
|
||||
if (!men->currentView()->text->selection){
|
||||
BeforeChange();
|
||||
men->currentView()->update(-2);
|
||||
}
|
||||
men->currentView()->text->
|
||||
TableFeatures(choice - 32);
|
||||
men->currentView()->update(1);
|
||||
}
|
||||
break;
|
||||
// version control sub-menu
|
||||
case 51: // register
|
||||
tmpfunc->Dispatch(LFUN_VC_REGISTER);
|
||||
break;
|
||||
case 52: // check in
|
||||
tmpfunc->Dispatch(LFUN_VC_CHECKIN);
|
||||
break;
|
||||
case 53: // check out
|
||||
tmpfunc->Dispatch(LFUN_VC_CHECKOUT);
|
||||
break;
|
||||
case 54: // revert to last
|
||||
tmpfunc->Dispatch(LFUN_VC_REVERT);
|
||||
break;
|
||||
case 55: // undo last
|
||||
tmpfunc->Dispatch(LFUN_VC_UNDO);
|
||||
break;
|
||||
case 56: // show history
|
||||
tmpfunc->Dispatch(LFUN_VC_HISTORY);
|
||||
break;
|
||||
}
|
||||
|
||||
fl_freepup(EditMenu);
|
||||
fl_freepup(SubEditFloats);
|
||||
fl_freepup(SubEditTable);
|
||||
fl_freepup(SubVersionControl);
|
||||
}
|
||||
#else
|
||||
void Menus::ShowEditMenu(FL_OBJECT * ob, long)
|
||||
{
|
||||
Menus * men = static_cast<Menus*>(ob->u_vdata);
|
||||
@ -1121,6 +1442,7 @@ void Menus::ShowEditMenu(FL_OBJECT * ob, long)
|
||||
fl_freepup(SubEditTable);
|
||||
fl_freepup(SubVersionControl);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
void Menus::ShowLayoutMenu(FL_OBJECT * ob, long)
|
||||
@ -1167,7 +1489,11 @@ void Menus::ShowLayoutMenu(FL_OBJECT * ob, long)
|
||||
fl_setpup_shortcut(LayoutMenu, 13, scex(_("LM|Ss#s#S")));
|
||||
|
||||
// Set values of checkboxes according to font
|
||||
#ifdef MOVE_TEXT
|
||||
LyXFont font = men->currentView()->text->real_current_font;
|
||||
#else
|
||||
LyXFont font = tmpbuffer->text->real_current_font;
|
||||
#endif
|
||||
if (font.emph() == LyXFont::ON)
|
||||
fl_setpup_mode(LayoutMenu, 7, FL_PUP_CHECK);
|
||||
if (font.noun() == LyXFont::ON)
|
||||
@ -1178,8 +1504,13 @@ void Menus::ShowLayoutMenu(FL_OBJECT * ob, long)
|
||||
fl_setpup_mode(LayoutMenu, 10, FL_PUP_CHECK);
|
||||
|
||||
// Grey out unavailable entries
|
||||
#ifdef MOVE_TEXT
|
||||
if (!men->currentView()->text->cursor.par->table)
|
||||
fl_setpup_mode(LayoutMenu, 5, FL_PUP_GREY);
|
||||
#else
|
||||
if (!tmpbuffer->text->cursor.par->table)
|
||||
fl_setpup_mode(LayoutMenu, 5, FL_PUP_GREY);
|
||||
#endif
|
||||
|
||||
if (tmpbuffer->isReadonly()) {
|
||||
fl_setpup_mode(LayoutMenu, 1, FL_PUP_GREY);
|
||||
@ -1497,7 +1828,7 @@ void Menus::ShowMathMenu(FL_OBJECT * ob, long)
|
||||
show_symbols_form(tmpfunc);
|
||||
break;
|
||||
}
|
||||
tmpbuffer->update(0);
|
||||
men->currentView()->update(0);
|
||||
}
|
||||
fl_freepup(MathMenu);
|
||||
}
|
||||
|
@ -199,7 +199,7 @@ void MiniBuffer::Init()
|
||||
else if (owner->view()->available()) {
|
||||
string nicename =
|
||||
MakeDisplayPath(owner->buffer()->
|
||||
getFileName());
|
||||
fileName());
|
||||
// Should we do this instead? (kindo like emacs)
|
||||
// leaves more room for other information
|
||||
text = "LyX: ";
|
||||
|
@ -260,7 +260,7 @@ int Trans::Load(LyXLex & lex)
|
||||
}
|
||||
break;
|
||||
case KMAP: {
|
||||
char key_from;
|
||||
unsigned char key_from;
|
||||
char * string_to;
|
||||
|
||||
if (lyxerr.debugging(Debug::KBMAP))
|
||||
@ -276,7 +276,7 @@ int Trans::Load(LyXLex & lex)
|
||||
if (lex.next(true)) {
|
||||
char const * t = lex.text();
|
||||
string_to = strcpy(new char[strlen(t)+1], t);
|
||||
if (key_from == char(254))
|
||||
if (key_from == 254)
|
||||
lyxerr << "check two triggered"
|
||||
<< endl;
|
||||
keymap_[key_from] = string_to;
|
||||
@ -351,7 +351,7 @@ string Trans::process(char c, TransManager & k)
|
||||
char * dt = dummy;
|
||||
char * t = Match(c);
|
||||
|
||||
if ((t == 0 && (dt[0] = c)) || (t[0] != 0 && (dt = t)) ){
|
||||
if ((t == 0 && (*dt = c)) || (t[0] != 0 && (dt = t)) ){
|
||||
return k.normalkey(c, dt);
|
||||
} else {
|
||||
return k.deadkey(c, *kmod_list_[(tex_accent)t[1]]);
|
||||
|
@ -36,9 +36,6 @@ TransFSMData::TransFSMData()
|
||||
char const TransState::TOKEN_SEP = 4;
|
||||
|
||||
|
||||
TransState::~TransState() {}
|
||||
|
||||
|
||||
// TransInitState
|
||||
TransInitState::TransInitState()
|
||||
{
|
||||
@ -49,7 +46,7 @@ TransInitState::TransInitState()
|
||||
string TransInitState::normalkey(char c, char * t)
|
||||
{
|
||||
string res;
|
||||
if (t!= 0)
|
||||
if (t != 0)
|
||||
res = t;
|
||||
else
|
||||
res = c;
|
||||
@ -188,12 +185,12 @@ string TransCombinedState::deadkey(char c, KmodInfo d)
|
||||
// Third key in a row. Output the first one and
|
||||
// reenter with shifted deadkeys
|
||||
string res;
|
||||
if (deadkey_!= 0)
|
||||
if (deadkey_ != 0)
|
||||
res = deadkey_;
|
||||
res+= TOKEN_SEP;
|
||||
res += TOKEN_SEP;
|
||||
deadkey_ = deadkey2_;
|
||||
deadkey_info_ = deadkey2_info_;
|
||||
res+= deadkey_state_->deadkey(c, d);
|
||||
res += deadkey_state_->deadkey(c, d);
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -311,7 +308,7 @@ void TransManager::insert(string str, LyXText * text)
|
||||
// encoding (chset_->name()) matches the current font_norm
|
||||
// (lyrxc->font_norm
|
||||
|
||||
if (chset_.getName()!= lyxrc->font_norm ||
|
||||
if (chset_.getName() != lyxrc->font_norm ||
|
||||
chset_.encodeString(str) == false) {
|
||||
// Could not find an encoding
|
||||
InsetLatexAccent ins(str);
|
||||
@ -330,7 +327,7 @@ void TransManager::deadkey(char c, tex_accent accent, LyXText * t)
|
||||
KmodInfo i;
|
||||
string res;
|
||||
|
||||
if (c == 0 && active_!= default_) {
|
||||
if (c == 0 && active_ != default_) {
|
||||
// A deadkey was pressed that cannot be printed
|
||||
// or a accent command was typed in the minibuffer
|
||||
|
||||
|
@ -18,7 +18,7 @@ class Trans;
|
||||
class TransState {
|
||||
public:
|
||||
///
|
||||
virtual ~TransState();
|
||||
virtual ~TransState() {}
|
||||
///
|
||||
virtual string normalkey(char, char *) = 0;
|
||||
///
|
||||
@ -182,7 +182,6 @@ public:
|
||||
inline string normalkey(char, char *);
|
||||
///
|
||||
void deadkey(char, tex_accent, LyXText *);
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
@ -131,7 +131,7 @@ void RCS::registrer(string const & msg)
|
||||
string cmd = "ci -q -u -i -t-\"";
|
||||
cmd += msg;
|
||||
cmd += "\" \"";
|
||||
cmd += OnlyFilename(owner_->getFileName());
|
||||
cmd += OnlyFilename(owner_->fileName());
|
||||
cmd += "\"";
|
||||
doVCCommand(cmd);
|
||||
owner_->getUser()->owner()->getLyXFunc()->Dispatch("buffer-reload");
|
||||
@ -141,7 +141,7 @@ void RCS::registrer(string const & msg)
|
||||
void RCS::checkIn(string const & msg)
|
||||
{
|
||||
doVCCommand("ci -q -u -m\"" + msg + "\" \""
|
||||
+ OnlyFilename(owner_->getFileName()) + "\"");
|
||||
+ OnlyFilename(owner_->fileName()) + "\"");
|
||||
owner_->getUser()->owner()->getLyXFunc()->Dispatch("buffer-reload");
|
||||
}
|
||||
|
||||
@ -150,7 +150,7 @@ void RCS::checkOut()
|
||||
{
|
||||
owner_->markLyxClean();
|
||||
doVCCommand("co -q -l \""
|
||||
+ OnlyFilename(owner_->getFileName()) + "\"");
|
||||
+ OnlyFilename(owner_->fileName()) + "\"");
|
||||
owner_->getUser()->owner()->getLyXFunc()->Dispatch("buffer-reload");
|
||||
}
|
||||
|
||||
@ -158,7 +158,7 @@ void RCS::checkOut()
|
||||
void RCS::revert()
|
||||
{
|
||||
doVCCommand("co -f -u" + version() + " \""
|
||||
+ OnlyFilename(owner_->getFileName()) + "\"");
|
||||
+ OnlyFilename(owner_->fileName()) + "\"");
|
||||
// We ignore changes and just reload!
|
||||
owner_->markLyxClean();
|
||||
owner_->getUser()->owner()
|
||||
@ -170,14 +170,14 @@ void RCS::undoLast()
|
||||
{
|
||||
lyxerr[Debug::LYXVC] << "LyXVC: undoLast" << endl;
|
||||
doVCCommand("rcs -o" + version() + " \""
|
||||
+ OnlyFilename(owner_->getFileName()) + "\"");
|
||||
+ OnlyFilename(owner_->fileName()) + "\"");
|
||||
}
|
||||
|
||||
|
||||
void RCS::getLog(string const & tmpf)
|
||||
{
|
||||
doVCCommand("rlog \""
|
||||
+ OnlyFilename(owner_->getFileName()) + "\" > " + tmpf);
|
||||
+ OnlyFilename(owner_->fileName()) + "\" > " + tmpf);
|
||||
}
|
||||
|
||||
|
||||
@ -263,7 +263,7 @@ void CVS::scanMaster()
|
||||
void CVS::registrer(string const & msg)
|
||||
{
|
||||
doVCCommand("cvs -q add -m \"" + msg + "\" \""
|
||||
+ OnlyFilename(owner_->getFileName()) + "\"");
|
||||
+ OnlyFilename(owner_->fileName()) + "\"");
|
||||
owner_->getUser()->owner()->getLyXFunc()->Dispatch("buffer-reload");
|
||||
}
|
||||
|
||||
@ -271,7 +271,7 @@ void CVS::registrer(string const & msg)
|
||||
void CVS::checkIn(string const & msg)
|
||||
{
|
||||
doVCCommand("cvs -q commit -m \"" + msg + "\" \""
|
||||
+ OnlyFilename(owner_->getFileName()) + "\"");
|
||||
+ OnlyFilename(owner_->fileName()) + "\"");
|
||||
owner_->getUser()->owner()->getLyXFunc()->Dispatch("buffer-reload");
|
||||
}
|
||||
|
||||
|
@ -492,7 +492,11 @@ string VSpace::asLatexCommand() const
|
||||
int VSpace::inPixels() const
|
||||
{
|
||||
// Height of a normal line in pixels (zoom factor considered)
|
||||
#ifdef MOVE_TEXT
|
||||
int height = current_view->text->DefaultHeight(); // [pixels]
|
||||
#else
|
||||
int height = current_view->buffer()->text->DefaultHeight(); // [pixels]
|
||||
#endif
|
||||
|
||||
// Zoom factor specified by user in percent
|
||||
float const zoom = lyxrc->zoom / 100.0; // [percent]
|
||||
|
Loading…
Reference in New Issue
Block a user