mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 01:59:02 +00:00
several changes and fixes. Read the ChangeLog
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@694 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
e8cc17cba7
commit
82fa210ea8
99
ChangeLog
99
ChangeLog
@ -1,3 +1,102 @@
|
||||
2000-04-26 Lars Gullik Bjønnes <larsbj@lyx.org>
|
||||
|
||||
* src/text2.C (GetRowNearY): remove currentrow code
|
||||
|
||||
* src/text.C (GetRow): remove currentrow code
|
||||
|
||||
* src/screen.C (Update): rewritten a bit.
|
||||
(SmallUpdate): removed func
|
||||
|
||||
* src/lyxtext.h (text_status): removed NEED_LITTLE_REFRESH, never
|
||||
used.
|
||||
(FullRebreak): return bool
|
||||
(currentrow): remove var
|
||||
(currentrow_y): ditto
|
||||
|
||||
* src/lyxscreen.h (Draw): change arg to unsigned long
|
||||
(FitCursor): return bool
|
||||
(FitManualCursor): ditto
|
||||
(Smallpdate): remove func
|
||||
(first): change to unsigned long
|
||||
(DrawOneRow): change second arg to long (from long &)
|
||||
(screen_refresh_y): remove var
|
||||
(scree_refresh_row): ditto
|
||||
|
||||
* src/lyxrow.h: change baseline to usigned int from unsigned
|
||||
short, this brings some implicit/unsigned issues out in the open.
|
||||
|
||||
* src/lyxfunc.C (moveCursorUpdate): update(0) == update(-2) change
|
||||
accordingly.
|
||||
(Dispatch): don't call updateScrollbar after fitCursor. Use update
|
||||
instead of smallUpdate.
|
||||
|
||||
* src/lyxcursor.h: change y to unsigned long
|
||||
|
||||
* src/buffer.h: don't call updateScrollbar after fitcursor
|
||||
|
||||
* src/buffer.C (parseSingleLyXformat2Token): move variables to
|
||||
where they are used. Removed "\\direction", this was not present
|
||||
in 1.1.4 and is already obsolete. Commented out some code that I
|
||||
believe to never be called.
|
||||
(runLiterate): don't call updateScrollbar after fitCursor
|
||||
(runLaTeX): ditto
|
||||
(buildProgram): ditto
|
||||
(runChktex): ditto
|
||||
|
||||
* src/WorkArea.h (workWidth): change return val to unsigned
|
||||
(width): ditto
|
||||
(height): ditto
|
||||
(redraw): remove the button redraws
|
||||
(setScrollbarValue): change for scrollbar
|
||||
(getScrollbarValue): change for scrollbar
|
||||
(getScrollbarBounds): change for scrollbar
|
||||
|
||||
* src/WorkArea.C (C_WorkArea_up_cb): removed func
|
||||
(C_WorkArea_down_cb): removed func
|
||||
(WorkArea): use fl_add_scrollbar instead of two buttons and a slider.
|
||||
(resize): change for scrollbar
|
||||
(setScrollbar): ditto
|
||||
(setScrollbarBounds): ditto
|
||||
(setScrollbarIncrements): ditto
|
||||
(up_cb): removed func
|
||||
(down_cb): removed func
|
||||
(scroll_cb): change for scrollbar
|
||||
(work_area_handler): ditto
|
||||
|
||||
* src/BufferView_pimpl.C (fitCursor): only call updateScrollbar
|
||||
when FitCursor did something.
|
||||
(updateScrollbar): some unsigned changes
|
||||
(downCB): removed func
|
||||
(scrollUpOnePage): removed func
|
||||
(scrollDownOnePage): remvoed func
|
||||
(workAreaMotionNotify): don't call screen->FitCursor but use
|
||||
fitCursor instead. and bool return val
|
||||
(workAreaButtonPress): ditto
|
||||
(workAreaButtonRelease): some unsigned changes
|
||||
(checkInsetHit): ditto
|
||||
(workAreaExpose): ditto
|
||||
(update): parts rewritten, comments about the signed char arg added
|
||||
(smallUpdate): removed func
|
||||
(cursorPrevious): call needed updateScrollbar
|
||||
(cursorNext): ditto
|
||||
|
||||
* src/BufferView2.C (allFloats): don't call updateScrollbar after
|
||||
fitCursor.
|
||||
|
||||
* src/BufferView.[Ch] (upCB): removed func
|
||||
(downCB): removed func
|
||||
(smallUpdate): removed func
|
||||
|
||||
2000-04-25 Lars Gullik Bjønnes <larsbj@lyx.org>
|
||||
|
||||
* src/lyxtext.h src/text.C src/text2.C: removed support for the
|
||||
currentrow, currentrow_y optimization. This did not help a lot and
|
||||
if we want to do this kind of optimization we should rather use
|
||||
cursor.row instead of the currentrow.
|
||||
|
||||
* src/buffer.C (parseSingleLyXformat2Token): fixed mistake in
|
||||
buffer spacing and klyx spacing support.
|
||||
|
||||
2000-04-25 Dekel Tsur <dekel@math.tau.ac.il>
|
||||
|
||||
* src/spellchecker.C (RunSpellChecker): Speedup spellchecking by
|
||||
|
39
development/Seminar.txt
Normal file
39
development/Seminar.txt
Normal file
@ -0,0 +1,39 @@
|
||||
|
||||
How to support the seminar package in LyX
|
||||
===========================================
|
||||
|
||||
Seminar.cls is a nice LaTeX2e package aimed a producing
|
||||
nice and clear slides. It can work together with pstricks and
|
||||
the color package, and can procduce fance slides indeed.
|
||||
|
||||
The seminar class has some important class options:
|
||||
- article Produce the whole seminar document as a regular
|
||||
latex article with the slides as floating
|
||||
bodies and the notes as running text.
|
||||
- slidesonly Generates only the slides, not the notes.
|
||||
- notesonly Generates only the notes.
|
||||
-
|
||||
|
||||
Variables for the slide environment
|
||||
===================================
|
||||
|
||||
\slideleftmargin
|
||||
\sliderightmargin
|
||||
\slidetopmargin
|
||||
\slidebottommargin
|
||||
\paperwidth
|
||||
\paperheight
|
||||
... and a lot of others
|
||||
|
||||
Goal
|
||||
====
|
||||
|
||||
The ultimate goad would be to be able to do all that is
|
||||
done in the Seminar FAQ inside LyX.
|
||||
|
||||
References
|
||||
==========
|
||||
|
||||
CTAN/macros/latex/contrib/other/seminar
|
||||
http://www.tug.org/applications/Seminar
|
||||
The Seminar FAQ
|
122
development/lazy_lyxtext.txt
Normal file
122
development/lazy_lyxtext.txt
Normal file
@ -0,0 +1,122 @@
|
||||
|
||||
Lazy Generation of LyXText
|
||||
--------------------------
|
||||
|
||||
Currently we generate the Row structure at the time of LyXText
|
||||
creation. This is the "formatting" period of the document
|
||||
loading. As can be seen this has a significant hit on the amount
|
||||
of time used to load large documents. On my computer this
|
||||
manifests itself as a 15 second load time of the UserGuide. In
|
||||
many ways this is acceptable, but we actually get the same hit
|
||||
when switching between documents. Because of this the TextCache
|
||||
was created, however it seems that textcache has some internal
|
||||
problems or it makes problems in LyXText show.
|
||||
|
||||
My suggestion is to make LyXText only generate Rows as need, i.e.
|
||||
lazy evaluation/generation of the on screen formatting. This will
|
||||
give us: blinding fast document loading. It also lessens the need
|
||||
for the TextCache class significantly and with some small further
|
||||
alterations TextCache can be removed completely.
|
||||
|
||||
The Rows are currently stored in a home made double linked list.
|
||||
To achieve the lazy evaluation this should be changed slightly:
|
||||
|
||||
struct RowPar {
|
||||
// Pointer to the paragraph that this rowpar holds rows for.
|
||||
LyXParagraph * par;
|
||||
// Only used for lazy evaluation when switching between buffers.
|
||||
unsigned int par_y;
|
||||
typedef vector<Row> Rows;
|
||||
// The actual rows, generated as needed.
|
||||
Rows rows;
|
||||
};
|
||||
|
||||
struct Row {
|
||||
LyXParagraph::size_type pos;
|
||||
mutable int fill;
|
||||
unsigned short height;
|
||||
unsigned short ascent_of_text;
|
||||
unsigned baseline;
|
||||
};
|
||||
|
||||
typedef list<RowPar> ParRowList;
|
||||
ParRowList parrow;
|
||||
|
||||
Several LyXText methods needs to be changed to handle this new
|
||||
structure.
|
||||
|
||||
Note about RowPar::par_y: If we only want top-down¹ this variable
|
||||
is not needed. If we however want to be able to begin evaluation
|
||||
at the location of the cursor it is needed. Then we don't have to
|
||||
store the formatted document in the textcache. Only a list of
|
||||
|
||||
struct Cache {
|
||||
LyXParagraph * par;
|
||||
unsigned int par_y;
|
||||
};
|
||||
|
||||
is needed. Since we regenerate all the rows subtleties with row
|
||||
lifetime etc. are avoided.
|
||||
|
||||
Memory usage: the current Row has a size of about 28 bytes on a
|
||||
32 bit machine and we have one Row for each line on the screen.
|
||||
For a 10 page document with ca. 50 lines on each page this is
|
||||
28 * 10 * 50 = 14000 bytes.
|
||||
The approach above has three pointer less in each row, so
|
||||
this is 16 * 10 * 50 = 8000 bytes, we have however some
|
||||
additional overhead: the RowPars one for each paragraph if we
|
||||
assume 5 lines per paragraph and 20 bytes for each RowPar we get:
|
||||
10 * 50 / 5 * 20 = 2000. This is a sum of 10000 on the new scheme.
|
||||
|
||||
Speed: some operations will most likely be somewhat faster since
|
||||
they now can operate on the number of paragraph instead of the
|
||||
number of rows. I do not foresee any operations becoming slower.
|
||||
The actual lazy evaluation will be done upon displaying, and when
|
||||
the lyx process is idle (idle_callback), this will mostly be
|
||||
initiated by LyXScreen and done in LyXText::GetRowNearY and in
|
||||
LyXText::GetRow. Perhaps also in LyXText::GetVisibleRow. All of
|
||||
the evaluation will be done on a per-paragraph basis.
|
||||
|
||||
If we want to operate on rows only it is easy to create iterators
|
||||
that can handle this. (This means that a way to force the
|
||||
evaluation of the rows might be something like:
|
||||
|
||||
// traverse all the rows and generate the missing ones.
|
||||
for_each(rowlist.begin(), rowlist.end(), dummy_func);
|
||||
|
||||
Note about the buffer structure in the lyx repository: LyXText
|
||||
really is orthogonal to the new buffer structure in that the
|
||||
BufferStructure is used for storage of the paragraphs, and
|
||||
LyXText is used for the caching of on-screen display (of
|
||||
lines/rows).
|
||||
|
||||
Note on impact on other code: Since the current rowlist is
|
||||
internal to LyXText the impact on code outside LyXText will be
|
||||
very small. However _inside_ LyXText the impact will be huge, and
|
||||
all methods that access the rowlist will have to change.
|
||||
|
||||
When to begin coding on this. Of course since this is something
|
||||
that I want to do, I'd like to begin right away. There can be
|
||||
argued that this should wait until table and floats has been
|
||||
moved out of LyXText, but I only partially agree. These changes
|
||||
will be on a fairly low-level and the removal of table and floats
|
||||
will not impact the development of this code much. Also this can
|
||||
very well be done in a separate branch in cvs. Anyway this coding
|
||||
will not begin until after 1.1.5 is released.
|
||||
|
||||
Fun stuff: Instead of doing the lazy evaluation only when needed
|
||||
or by the idle callback this could also be done by a separate
|
||||
thread taking advantage of SMP and/or io-blocking in the main
|
||||
thread. We could even have the evaluation of each paragraph we
|
||||
done in its own thread (or by a few² worker threads)
|
||||
|
||||
|
||||
Lgb
|
||||
|
||||
¹ Row evaluation from the beginning of the document to the end. Never
|
||||
from the middle.
|
||||
|
||||
² Number of CPUs f.ex.
|
||||
|
||||
|
||||
|
@ -129,6 +129,7 @@ extern "C" {
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
// Callback for scrollbar up button
|
||||
void BufferView::upCB(long time, int button)
|
||||
{
|
||||
@ -146,6 +147,7 @@ void BufferView::upCB(long time, int button)
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
void BufferView::enterView()
|
||||
@ -167,11 +169,13 @@ void BufferView::scrollCB(double value)
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
// Callback for scrollbar down button
|
||||
void BufferView::downCB(long time, int button)
|
||||
{
|
||||
pimpl_->downCB(time, button);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
void BufferView::workAreaMotionNotify(int x, int y, unsigned int state)
|
||||
@ -270,10 +274,12 @@ void BufferView::update(signed char f)
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
void BufferView::smallUpdate(signed char f)
|
||||
{
|
||||
pimpl_->smallUpdate(f);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
void BufferView::setState()
|
||||
|
@ -48,8 +48,10 @@ public:
|
||||
void update();
|
||||
///
|
||||
void update(signed char f);
|
||||
#if 0
|
||||
///
|
||||
void smallUpdate(signed char f);
|
||||
#endif
|
||||
///
|
||||
void updateScrollbar();
|
||||
///
|
||||
@ -190,12 +192,14 @@ public:
|
||||
bool active() const;
|
||||
///
|
||||
bool belowMouse() const;
|
||||
#if 0
|
||||
/// A callback for the up arrow in the scrollbar.
|
||||
void upCB(long time, int button);
|
||||
/// A callback for the slider in the scrollbar.
|
||||
void scrollCB(double);
|
||||
/// A callback for the down arrow in the scrollbar.
|
||||
void downCB(long time, int button);
|
||||
#endif
|
||||
/// A callback for the slider in the scrollbar.
|
||||
void scrollCB(double);
|
||||
|
||||
///
|
||||
static void cursorToggleCB(FL_OBJECT * ob, long);
|
||||
|
@ -379,7 +379,7 @@ void BufferView::allFloats(char flag, char figmar)
|
||||
text->SetCursorIntern(cursor.par, cursor.pos);
|
||||
redraw();
|
||||
fitCursor();
|
||||
updateScrollbar();
|
||||
//updateScrollbar();
|
||||
}
|
||||
|
||||
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include "lyx_gui_misc.h"
|
||||
#include "lyxrc.h"
|
||||
#include "intl.h"
|
||||
|
||||
#include "support/LAssert.h"
|
||||
using std::pair;
|
||||
using std::endl;
|
||||
|
||||
@ -181,10 +181,13 @@ void BufferView::Pimpl::redraw()
|
||||
}
|
||||
|
||||
|
||||
void BufferView::Pimpl::fitCursor()
|
||||
bool BufferView::Pimpl::fitCursor()
|
||||
{
|
||||
if (screen) screen->FitCursor();
|
||||
updateScrollbar();
|
||||
Assert(screen); // it is a programming error to call fitCursor
|
||||
// without a valid screen.
|
||||
bool ret = screen->FitCursor();
|
||||
if (ret) updateScrollbar();
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@ -346,10 +349,10 @@ void BufferView::Pimpl::updateScrollbar()
|
||||
return;
|
||||
}
|
||||
|
||||
static long max2 = 0;
|
||||
static long height2 = 0;
|
||||
static unsigned long max2 = 0;
|
||||
static unsigned long height2 = 0;
|
||||
|
||||
long cbth = 0;
|
||||
unsigned long cbth = 0;
|
||||
long cbsf = 0;
|
||||
|
||||
if (bv_->text)
|
||||
@ -414,7 +417,7 @@ void BufferView::Pimpl::scrollCB(double value)
|
||||
|
||||
if (cursor_follows_scrollbar) {
|
||||
LyXText * vbt = bv_->text;
|
||||
int height = vbt->DefaultHeight();
|
||||
unsigned int height = vbt->DefaultHeight();
|
||||
|
||||
if (vbt->cursor.y < screen->first + height) {
|
||||
vbt->SetCursorFromCoordinates(0,
|
||||
@ -432,6 +435,7 @@ void BufferView::Pimpl::scrollCB(double value)
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
// Callback for scrollbar down button
|
||||
void BufferView::Pimpl::downCB(long time, int button)
|
||||
{
|
||||
@ -449,6 +453,7 @@ void BufferView::Pimpl::downCB(long time, int button)
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
int BufferView::Pimpl::scrollUp(long time)
|
||||
@ -508,7 +513,7 @@ int BufferView::Pimpl::scrollDown(long time)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
void BufferView::Pimpl::scrollUpOnePage()
|
||||
{
|
||||
if (buffer_ == 0) return;
|
||||
@ -526,8 +531,9 @@ void BufferView::Pimpl::scrollUpOnePage()
|
||||
|
||||
bv_->scrollCB(y);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if 0
|
||||
void BufferView::Pimpl::scrollDownOnePage()
|
||||
{
|
||||
if (buffer_ == 0) return;
|
||||
@ -545,6 +551,7 @@ void BufferView::Pimpl::scrollDownOnePage()
|
||||
|
||||
bv_->scrollCB(y);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
void BufferView::Pimpl::workAreaMotionNotify(int x, int y, unsigned int state)
|
||||
@ -578,8 +585,7 @@ void BufferView::Pimpl::workAreaMotionNotify(int x, int y, unsigned int state)
|
||||
|
||||
bv_->text->SetSelection();
|
||||
screen->ToggleToggle();
|
||||
if (screen->FitCursor())
|
||||
updateScrollbar();
|
||||
fitCursor();
|
||||
screen->ShowCursor();
|
||||
}
|
||||
return;
|
||||
@ -708,8 +714,7 @@ void BufferView::Pimpl::workAreaButtonPress(int xpos, int ypos,
|
||||
bv_->text->cursor.x_fix = bv_->text->cursor.x;
|
||||
|
||||
owner_->updateLayoutChoice();
|
||||
if (screen->FitCursor()){
|
||||
updateScrollbar();
|
||||
if (fitCursor()) {
|
||||
selection_possible = false;
|
||||
}
|
||||
|
||||
@ -781,7 +786,8 @@ void BufferView::Pimpl::leaveView()
|
||||
}
|
||||
|
||||
|
||||
void BufferView::Pimpl::workAreaButtonRelease(int x, int y, unsigned int button)
|
||||
void BufferView::Pimpl::workAreaButtonRelease(int x, int y,
|
||||
unsigned int button)
|
||||
{
|
||||
if (buffer_ == 0 || screen == 0) return;
|
||||
|
||||
@ -823,9 +829,9 @@ void BufferView::Pimpl::workAreaButtonRelease(int x, int y, unsigned int button)
|
||||
if (inset_hit != 0) {
|
||||
// Inset like error, notes and figures
|
||||
selection_possible = false;
|
||||
#ifdef WITH_WARNINGS
|
||||
#warning fix this proper in 0.13
|
||||
#endif
|
||||
|
||||
// CHECK fix this proper in 0.13
|
||||
|
||||
// Following a ref shouldn't issue
|
||||
// a push on the undo-stack
|
||||
// anylonger, now that we have
|
||||
@ -907,7 +913,7 @@ void BufferView::Pimpl::workAreaButtonRelease(int x, int y, unsigned int button)
|
||||
int box_x = 20; // LYX_PAPER_MARGIN;
|
||||
box_x += lyxfont::width(" wide-tab ", font);
|
||||
|
||||
int screen_first = screen->first;
|
||||
unsigned int screen_first = screen->first;
|
||||
|
||||
if (x < box_x
|
||||
&& y + screen_first > bv_->text->cursor.y -
|
||||
@ -945,7 +951,7 @@ Inset * BufferView::Pimpl::checkInsetHit(int & x, int & y,
|
||||
if (!screen)
|
||||
return 0;
|
||||
|
||||
int y_tmp = y + screen->first;
|
||||
unsigned int y_tmp = y + screen->first;
|
||||
|
||||
LyXCursor cursor;
|
||||
bv_->text->SetCursorFromCoordinates(cursor, x, y_tmp);
|
||||
@ -1027,8 +1033,8 @@ void BufferView::Pimpl::workAreaExpose()
|
||||
// redraw();
|
||||
//}
|
||||
|
||||
static int work_area_width = -1;
|
||||
static int work_area_height = -1;
|
||||
static unsigned int work_area_width = 0;
|
||||
static unsigned int work_area_height = 0;
|
||||
|
||||
bool widthChange = workarea->workWidth() != work_area_width;
|
||||
bool heightChange = workarea->height() != work_area_height;
|
||||
@ -1156,9 +1162,46 @@ void BufferView::Pimpl::update()
|
||||
if (screen) screen->Update();
|
||||
}
|
||||
|
||||
|
||||
// Values used when calling update:
|
||||
// -3 - update
|
||||
// -2 - update, move sel_cursor if selection, fitcursor
|
||||
// -1 - update, move sel_cursor if selection, fitcursor, mark dirty
|
||||
// 0 - update, move sel_cursor if selection, fitcursor
|
||||
// 1 - update, move sel_cursor if selection, fitcursor, mark dirty
|
||||
// 3 - update, move sel_cursor if selection
|
||||
//
|
||||
// update -
|
||||
// a simple redraw of the parts that need refresh
|
||||
//
|
||||
// move sel_cursor if selection -
|
||||
// the text's sel_cursor is moved if there is selection is progress
|
||||
//
|
||||
// fitcursor -
|
||||
// fitCursor() is called and the scrollbar updated
|
||||
//
|
||||
// mark dirty -
|
||||
// the buffer is marked dirty.
|
||||
//
|
||||
// enum {
|
||||
// UPDATE = 0,
|
||||
// SELECT = 1,
|
||||
// FITCUR = 2,
|
||||
// CHANGE = 4
|
||||
// };
|
||||
//
|
||||
// UPDATE_ONLY = UPDATE;
|
||||
// UPDATE_SELECT = UPDATE | SELECT;
|
||||
// UPDATE_SELECT_MOVE = UPDATE | SELECT | FITCUR;
|
||||
// UPDATE_SELECT_MOVE_AFTER_CHANGE = UPDATE | SELECT | FITCUR | CHANGE;
|
||||
//
|
||||
// update(-3) -> update(0) -> update(0) -> update(UPDATE)
|
||||
// update(-2) -> update(1 + 2) -> update(3) -> update(SELECT|FITCUR)
|
||||
// update(-1) -> update(1 + 2 + 4) -> update(7) -> update(SELECT|FITCUR|CHANGE)
|
||||
// update(1) -> update(1 + 2 + 4) -> update(7) -> update(SELECT|FITCUR|CHANGE)
|
||||
// update(3) -> update(1) -> update(1) -> update(SELECT)
|
||||
void BufferView::Pimpl::update(signed char f)
|
||||
{
|
||||
#if 1
|
||||
owner_->updateLayoutChoice();
|
||||
|
||||
if (!bv_->text->selection && f > -3)
|
||||
@ -1171,7 +1214,7 @@ void BufferView::Pimpl::update(signed char f)
|
||||
|
||||
if (f != 3 && f != -3) {
|
||||
fitCursor();
|
||||
updateScrollbar();
|
||||
//updateScrollbar();
|
||||
}
|
||||
|
||||
if (f == 1 || f == -1) {
|
||||
@ -1182,11 +1225,40 @@ void BufferView::Pimpl::update(signed char f)
|
||||
buffer_->markDirty();
|
||||
}
|
||||
}
|
||||
#else
|
||||
owner_->updateLayoutChoice();
|
||||
|
||||
if (!bv_->text->selection && (f & SELECT))
|
||||
bv_->text->sel_cursor = bv_->text->cursor;
|
||||
|
||||
FreeUpdateTimer();
|
||||
bv_->text->FullRebreak();
|
||||
|
||||
update();
|
||||
|
||||
if ((f & FITCUR)) {
|
||||
fitCursor();
|
||||
//updateScrollbar();
|
||||
}
|
||||
|
||||
if ((f & CHANGE)) {
|
||||
if (buffer_->isLyxClean()) {
|
||||
buffer_->markDirty();
|
||||
owner_->getMiniBuffer()->setTimer(4);
|
||||
} else {
|
||||
buffer_->markDirty();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
void BufferView::Pimpl::smallUpdate(signed char f)
|
||||
{
|
||||
#if 1
|
||||
update(f);
|
||||
#else
|
||||
screen->SmallUpdate();
|
||||
if (screen->TopCursorVisible()
|
||||
!= screen->first) {
|
||||
@ -1195,7 +1267,7 @@ void BufferView::Pimpl::smallUpdate(signed char f)
|
||||
}
|
||||
|
||||
fitCursor();
|
||||
updateScrollbar();
|
||||
//updateScrollbar();
|
||||
|
||||
if (!bv_->text->selection)
|
||||
bv_->text->sel_cursor = bv_->text->cursor;
|
||||
@ -1208,7 +1280,9 @@ void BufferView::Pimpl::smallUpdate(signed char f)
|
||||
buffer_->markDirty();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
// Callback for cursor timer
|
||||
@ -1331,6 +1405,7 @@ void BufferView::Pimpl::cursorPrevious()
|
||||
- bv_->text->cursor.row->baseline
|
||||
+ bv_->text->cursor.row->height
|
||||
- workarea->height() + 1 );
|
||||
updateScrollbar();
|
||||
}
|
||||
|
||||
|
||||
@ -1351,6 +1426,7 @@ void BufferView::Pimpl::cursorNext()
|
||||
if (bv_->text->cursor.row->height < workarea->height())
|
||||
screen->Draw(bv_->text->cursor.y
|
||||
- bv_->text->cursor.row->baseline);
|
||||
updateScrollbar();
|
||||
}
|
||||
|
||||
|
||||
|
@ -28,8 +28,8 @@ struct BufferView::Pimpl {
|
||||
void resize();
|
||||
///
|
||||
void redraw();
|
||||
///
|
||||
void fitCursor();
|
||||
/// Return true if the cursor was fitted.
|
||||
bool fitCursor();
|
||||
///
|
||||
void redoCurrentBuffer();
|
||||
///
|
||||
@ -38,8 +38,10 @@ struct BufferView::Pimpl {
|
||||
void update();
|
||||
///
|
||||
void update(signed char f);
|
||||
#if 0
|
||||
///
|
||||
void smallUpdate(signed char f);
|
||||
#endif
|
||||
///
|
||||
void gotoError();
|
||||
/// Update pixmap of screen
|
||||
@ -50,12 +52,18 @@ struct BufferView::Pimpl {
|
||||
void updateScrollbar();
|
||||
///
|
||||
void scrollCB(double value);
|
||||
#if 0
|
||||
///
|
||||
void downCB(long time, int button);
|
||||
#endif
|
||||
#if 0
|
||||
///
|
||||
void scrollUpOnePage();
|
||||
#endif
|
||||
#if 0
|
||||
///
|
||||
void scrollDownOnePage();
|
||||
#endif
|
||||
///
|
||||
void create_view();
|
||||
///
|
||||
|
@ -16,8 +16,10 @@
|
||||
#endif
|
||||
|
||||
#include "WorkArea.h"
|
||||
#ifndef USE_FL_SCROLLBAR
|
||||
#include "up.xpm"
|
||||
#include "down.xpm"
|
||||
#endif
|
||||
#include "debug.h"
|
||||
#include "support/lstrings.h"
|
||||
#include "BufferView.h"
|
||||
@ -38,6 +40,7 @@ void waitForX()
|
||||
|
||||
extern "C" {
|
||||
// Just a bunch of C wrappers around static members of WorkArea
|
||||
#ifndef USE_FL_SCROLLBAR
|
||||
void C_WorkArea_up_cb(FL_OBJECT * ob, long buf)
|
||||
{
|
||||
WorkArea::up_cb(ob, buf);
|
||||
@ -47,7 +50,7 @@ extern "C" {
|
||||
{
|
||||
WorkArea::down_cb(ob, buf);
|
||||
}
|
||||
|
||||
#endif
|
||||
void C_WorkArea_scroll_cb(FL_OBJECT * ob, long buf)
|
||||
{
|
||||
WorkArea::scroll_cb(ob, buf);
|
||||
@ -103,6 +106,17 @@ WorkArea::WorkArea(BufferView * o, int xpos, int ypos, int width, int height)
|
||||
// THE SCROLLBAR
|
||||
//
|
||||
|
||||
#ifdef USE_FL_SCROLLBAR
|
||||
scrollbar = obj = fl_add_scrollbar(FL_VERT_SCROLLBAR,
|
||||
xpos + width - 15,
|
||||
ypos, 17, height, "");
|
||||
fl_set_object_boxtype(obj, FL_UP_BOX);
|
||||
//fl_set_object_color(obj, FL_MCOL, FL_BLUE);
|
||||
fl_set_object_resize(obj, FL_RESIZE_ALL);
|
||||
fl_set_object_gravity(obj, NorthEastGravity, SouthEastGravity);
|
||||
obj->u_vdata = this;
|
||||
fl_set_object_callback(obj, C_WorkArea_scroll_cb, 0);
|
||||
#else
|
||||
// up - scrollbar button
|
||||
fl_set_border_width(-1);
|
||||
|
||||
@ -165,9 +179,9 @@ WorkArea::WorkArea(BufferView * o, int xpos, int ypos, int width, int height)
|
||||
fl_set_pixmapbutton_data(obj, const_cast<char**>(down_xpm));
|
||||
|
||||
fl_set_border_width(-bw);
|
||||
|
||||
// Remove the blue feedback rectangle
|
||||
fl_set_pixmapbutton_focus_outline(obj,0);
|
||||
#endif
|
||||
|
||||
///
|
||||
/// The free object
|
||||
@ -242,7 +256,10 @@ void WorkArea::resize(int xpos, int ypos, int width, int height)
|
||||
//
|
||||
// THE SCROLLBAR
|
||||
//
|
||||
|
||||
#ifdef USE_FL_SCROLLBAR
|
||||
fl_set_object_geometry(scrollbar, xpos + width - 15,
|
||||
ypos, 17, height);
|
||||
#else
|
||||
// up - scrollbar button
|
||||
fl_set_object_geometry(button_up, xpos + width - 15,
|
||||
ypos,
|
||||
@ -255,7 +272,7 @@ void WorkArea::resize(int xpos, int ypos, int width, int height)
|
||||
fl_set_object_geometry(button_down, xpos + width - 15,
|
||||
ypos + height - 15,
|
||||
15, 15);
|
||||
|
||||
#endif
|
||||
// Create the workarea pixmap
|
||||
createPixmap(width - 15 - 2 * bw, height - 2 * bw);
|
||||
|
||||
@ -313,23 +330,36 @@ void WorkArea::setFocus() const
|
||||
|
||||
void WorkArea::setScrollbar(double pos, double length_fraction) const
|
||||
{
|
||||
#ifdef USE_FL_SCROLLBAR
|
||||
fl_set_scrollbar_value(scrollbar, pos);
|
||||
fl_set_scrollbar_size(scrollbar, scrollbar->h * length_fraction);
|
||||
#else
|
||||
fl_set_slider_value(scrollbar, pos);
|
||||
fl_set_slider_size(scrollbar, scrollbar->h * length_fraction);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void WorkArea::setScrollbarBounds(double l1, double l2) const
|
||||
{
|
||||
#ifdef USE_FL_SCROLLBAR
|
||||
fl_set_scrollbar_bounds(scrollbar, l1, l2);
|
||||
#else
|
||||
fl_set_slider_bounds(scrollbar, l1, l2);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void WorkArea::setScrollbarIncrements(float inc) const
|
||||
void WorkArea::setScrollbarIncrements(double inc) const
|
||||
{
|
||||
#ifdef USE_FL_SCROLLBAR
|
||||
fl_set_scrollbar_increment(scrollbar, work_area->h - inc, inc);
|
||||
#else
|
||||
fl_set_slider_increment(scrollbar, work_area->h - inc, inc);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
#ifndef USE_FL_SCROLLBAR
|
||||
void WorkArea::up_cb(FL_OBJECT * ob, long)
|
||||
{
|
||||
WorkArea * area = static_cast<WorkArea*>(ob->u_vdata);
|
||||
@ -338,7 +368,6 @@ void WorkArea::up_cb(FL_OBJECT * ob, long)
|
||||
ev2 = fl_last_event();
|
||||
if (ev2->type == ButtonPress || ev2->type == ButtonRelease)
|
||||
time = 0;
|
||||
//area->up(time++, fl_get_button_numb(ob));
|
||||
area->owner->upCB(time++, fl_get_button_numb(ob));
|
||||
}
|
||||
|
||||
@ -350,18 +379,23 @@ void WorkArea::down_cb(FL_OBJECT * ob, long)
|
||||
static long time = 0;
|
||||
if (ev2->type == ButtonPress || ev2->type == ButtonRelease)
|
||||
time = 0;
|
||||
//area->down(time++, fl_get_button_numb(ob));
|
||||
area->owner->downCB(time++, fl_get_button_numb(ob));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
// Callback for scrollbar slider
|
||||
void WorkArea::scroll_cb(FL_OBJECT * ob, long)
|
||||
{
|
||||
WorkArea * area = static_cast<WorkArea*>(ob->u_vdata);
|
||||
|
||||
//area->scroll(fl_get_slider_value(ob));
|
||||
#ifdef USE_FL_SCROLLBAR
|
||||
// If we really want the accellerating scroll we can do that
|
||||
// from here. IMHO that is a waste of effort since we already
|
||||
// have other ways to move fast around in the document. (Lgb)
|
||||
area->owner->scrollCB(fl_get_scrollbar_value(ob));
|
||||
#else
|
||||
area->owner->scrollCB(fl_get_slider_value(ob));
|
||||
#endif
|
||||
waitForX();
|
||||
}
|
||||
|
||||
@ -411,7 +445,12 @@ int WorkArea::work_area_handler(FL_OBJECT * ob, int event,
|
||||
if (!ev || ! area->scrollbar) break;
|
||||
if (ev->xmotion.x != x_old ||
|
||||
ev->xmotion.y != y_old ||
|
||||
fl_get_slider_value(area->scrollbar) != scrollbar_value_old) {
|
||||
#ifdef USE_FL_SCROLLBAR
|
||||
fl_get_scrollbar_value(area->scrollbar) != scrollbar_value_old
|
||||
#else
|
||||
fl_get_slider_value(area->scrollbar) != scrollbar_value_old
|
||||
#endif
|
||||
) {
|
||||
lyxerr.debug() << "Workarea event: MOUSE" << endl;
|
||||
area->owner->workAreaMotionNotify(ev->xmotion.x - ob->x,
|
||||
ev->xmotion.y - ob->y,
|
||||
|
@ -23,6 +23,8 @@
|
||||
|
||||
class BufferView;
|
||||
|
||||
#define USE_FL_SCROLLBAR 1
|
||||
|
||||
class WorkArea {
|
||||
public:
|
||||
///
|
||||
@ -32,11 +34,11 @@ public:
|
||||
///
|
||||
Painter & getPainter() { return painter_; }
|
||||
///
|
||||
int workWidth() const { return work_area->w; }
|
||||
unsigned int workWidth() const { return work_area->w; }
|
||||
///
|
||||
int width() const { return work_area->w + scrollbar->w; }
|
||||
unsigned int width() const { return work_area->w + scrollbar->w; }
|
||||
///
|
||||
int height() const { return work_area->h; }
|
||||
unsigned int height() const { return work_area->h; }
|
||||
///
|
||||
int xpos() const { return work_area->x; }
|
||||
///
|
||||
@ -47,8 +49,10 @@ public:
|
||||
void redraw() const {
|
||||
fl_redraw_object(work_area);
|
||||
fl_redraw_object(scrollbar);
|
||||
#ifndef USE_FL_SCROLLBAR
|
||||
fl_redraw_object(button_down);
|
||||
fl_redraw_object(button_up);
|
||||
#endif
|
||||
}
|
||||
///
|
||||
void setFocus() const;
|
||||
@ -67,31 +71,52 @@ public:
|
||||
///
|
||||
void setScrollbar(double pos, double length_fraction) const;
|
||||
///
|
||||
void setScrollbarValue(double y) const { fl_set_slider_value(scrollbar, y); }
|
||||
void setScrollbarValue(double y) const {
|
||||
#ifdef USE_FL_SCROLLBAR
|
||||
fl_set_scrollbar_value(scrollbar, y);
|
||||
#else
|
||||
fl_set_slider_value(scrollbar, y);
|
||||
#endif
|
||||
}
|
||||
///
|
||||
void setScrollbarBounds(double, double) const;
|
||||
///
|
||||
void setScrollbarIncrements(float inc) const;
|
||||
void setScrollbarIncrements(double inc) const;
|
||||
///
|
||||
double getScrollbarValue() const {
|
||||
#ifdef USE_FL_SCROLLBAR
|
||||
return fl_get_scrollbar_value(scrollbar);
|
||||
#else
|
||||
return fl_get_slider_value(scrollbar);
|
||||
#endif
|
||||
}
|
||||
#ifdef USE_FL_SCROLLBAR
|
||||
///
|
||||
std::pair<float, float> getScrollbarBounds() const {
|
||||
std::pair<float, float> p;
|
||||
fl_get_scrollbar_bounds(scrollbar, &p.first, &p.second);
|
||||
return p;
|
||||
}
|
||||
#else
|
||||
///
|
||||
std::pair<double, double> getScrollbarBounds() const {
|
||||
std::pair<double, double> p;
|
||||
fl_get_slider_bounds(scrollbar, &p.first, &p.second);
|
||||
return p;
|
||||
}
|
||||
#endif
|
||||
///
|
||||
Pixmap getPixmap() const { return workareapixmap; }
|
||||
/// xforms callback
|
||||
static int work_area_handler(FL_OBJECT *, int event,
|
||||
FL_Coord, FL_Coord,
|
||||
int /*key*/, void * xev);
|
||||
#ifndef USE_FL_SCROLLBAR
|
||||
/// xforms callback
|
||||
static void up_cb(FL_OBJECT *, long);
|
||||
/// xforms callback
|
||||
static void down_cb(FL_OBJECT *, long);
|
||||
#endif
|
||||
/// xforms callback
|
||||
static void scroll_cb(FL_OBJECT *, long);
|
||||
private:
|
||||
@ -103,10 +128,12 @@ private:
|
||||
FL_OBJECT * work_area;
|
||||
///
|
||||
FL_OBJECT * scrollbar;
|
||||
#ifndef USE_FL_SCROLLBAR
|
||||
///
|
||||
FL_OBJECT * button_down;
|
||||
///
|
||||
FL_OBJECT * button_up;
|
||||
#endif
|
||||
///
|
||||
BufferView * owner;
|
||||
/// The pixmap overlay on the workarea
|
||||
|
222
src/buffer.C
222
src/buffer.C
@ -44,7 +44,6 @@
|
||||
#include "lyxlex.h"
|
||||
#include "tex-strings.h"
|
||||
#include "layout.h"
|
||||
//#include "lyx_cb.h"
|
||||
#include "bufferview_funcs.h"
|
||||
#include "minibuffer.h"
|
||||
#include "lyxfont.h"
|
||||
@ -96,16 +95,6 @@ using std::setw;
|
||||
using std::endl;
|
||||
using std::pair;
|
||||
|
||||
// Uncomment this line to enable a workaround for the weird behaviour
|
||||
// of the cursor between a displayed inset and last character
|
||||
// at the upper line. (Alejandro 20.9.96)
|
||||
// #define BREAK_BEFORE_INSET
|
||||
|
||||
/* Lars, when changing this file sometime in the future to a list,
|
||||
* please check out the figinsets-sideeffects described at the
|
||||
* beginning of figinset.C Matthias (04.07.1996)
|
||||
*/
|
||||
|
||||
|
||||
// all these externs should eventually be removed.
|
||||
extern BufferList bufferlist;
|
||||
@ -165,14 +154,14 @@ Buffer::~Buffer()
|
||||
}
|
||||
|
||||
|
||||
string Buffer::getLatexName(bool no_path /* = true */) const
|
||||
string Buffer::getLatexName(bool no_path) const
|
||||
{
|
||||
return ChangeExtension(MakeLatexName(filename),
|
||||
".tex", no_path);
|
||||
}
|
||||
|
||||
|
||||
void Buffer::setReadonly(bool flag /* = true */)
|
||||
void Buffer::setReadonly(bool flag)
|
||||
{
|
||||
if (read_only != flag) {
|
||||
read_only = flag;
|
||||
@ -188,7 +177,7 @@ void Buffer::setReadonly(bool flag /* = true */)
|
||||
bool Buffer::saveParamsAsDefaults()
|
||||
{
|
||||
string fname = AddName(AddPath(user_lyxdir, "templates/"),
|
||||
"defaults.lyx");
|
||||
"defaults.lyx");
|
||||
Buffer defaults = Buffer(fname);
|
||||
|
||||
// Use the current buffer's parameters as default
|
||||
@ -245,7 +234,7 @@ bool Buffer::readLyXformat2(LyXLex & lex, LyXParagraph * par)
|
||||
bool the_end_read = false;
|
||||
|
||||
LyXParagraph * return_par = 0;
|
||||
LyXFont font(LyXFont::ALL_INHERIT,params.language_info);
|
||||
LyXFont font(LyXFont::ALL_INHERIT, params.language_info);
|
||||
if (format < 2.16 && params.language == "hebrew")
|
||||
font.setLanguage(default_language);
|
||||
|
||||
@ -308,7 +297,6 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
|
||||
LyXParagraph::footnote_flag & footnoteflag,
|
||||
LyXParagraph::footnote_kind & footnotekind)
|
||||
{
|
||||
int tmpret, tmpret2;
|
||||
bool the_end_read = false;
|
||||
|
||||
if (token[0] != '\\') {
|
||||
@ -355,7 +343,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
|
||||
par->footnoteflag = footnoteflag;
|
||||
par->footnotekind = footnotekind;
|
||||
par->depth = depth;
|
||||
font = LyXFont(LyXFont::ALL_INHERIT,params.language_info);
|
||||
font = LyXFont(LyXFont::ALL_INHERIT, params.language_info);
|
||||
if (format < 2.16 && params.language == "hebrew")
|
||||
font.setLanguage(default_language);
|
||||
} else if (token == "\\end_float") {
|
||||
@ -374,7 +362,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
|
||||
if (format < 2.16 && params.language == "hebrew")
|
||||
font.setLanguage(default_language);
|
||||
} else if (token == "\\begin_float") {
|
||||
tmpret = lex.FindToken(string_footnotekinds);
|
||||
int tmpret = lex.FindToken(string_footnotekinds);
|
||||
if (tmpret == -1) ++tmpret;
|
||||
if (tmpret != LYX_LAYOUT_DEFAULT)
|
||||
footnotekind = static_cast<LyXParagraph::footnote_kind>(tmpret); // bad
|
||||
@ -448,7 +436,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
|
||||
} else if (token == "\\start_of_appendix") {
|
||||
par->start_of_appendix = true;
|
||||
} else if (token == "\\paragraph_separation") {
|
||||
tmpret = lex.FindToken(string_paragraph_separation);
|
||||
int tmpret = lex.FindToken(string_paragraph_separation);
|
||||
if (tmpret == -1) ++tmpret;
|
||||
if (tmpret != LYX_LAYOUT_DEFAULT)
|
||||
params.paragraph_separation =
|
||||
@ -462,7 +450,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
|
||||
// in existing documents are irretrivably lost. (Asger)
|
||||
params.readGraphicsDriver(lex);
|
||||
} else if (token == "\\quotes_language") {
|
||||
tmpret = lex.FindToken(string_quotes_language);
|
||||
int tmpret = lex.FindToken(string_quotes_language);
|
||||
if (tmpret == -1) ++tmpret;
|
||||
if (tmpret != LYX_LAYOUT_DEFAULT) {
|
||||
InsetQuotes::quote_language tmpl =
|
||||
@ -500,13 +488,13 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
|
||||
break;
|
||||
}
|
||||
} else if (token == "\\papersize") {
|
||||
tmpret = lex.FindToken(string_papersize);
|
||||
int tmpret = lex.FindToken(string_papersize);
|
||||
if (tmpret == -1)
|
||||
++tmpret;
|
||||
else
|
||||
params.papersize2 = tmpret;
|
||||
} else if (token == "\\paperpackage") {
|
||||
tmpret = lex.FindToken(string_paperpackages);
|
||||
int tmpret = lex.FindToken(string_paperpackages);
|
||||
if (tmpret == -1) {
|
||||
++tmpret;
|
||||
params.paperpackage = BufferParams::PACKAGE_NONE;
|
||||
@ -519,7 +507,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
|
||||
lex.nextToken();
|
||||
params.use_amsmath = lex.GetInteger();
|
||||
} else if (token == "\\paperorientation") {
|
||||
tmpret = lex.FindToken(string_orientation);
|
||||
int tmpret = lex.FindToken(string_orientation);
|
||||
if (tmpret == -1) ++tmpret;
|
||||
if (tmpret != LYX_LAYOUT_DEFAULT)
|
||||
params.orientation = static_cast<BufferParams::PAPER_ORIENTATION>(tmpret);
|
||||
@ -627,25 +615,26 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
|
||||
lex.next();
|
||||
string tmp = strip(lex.GetString());
|
||||
Spacing::Space tmp_space = Spacing::Default;
|
||||
float tmp_val = 0.0;
|
||||
if (tmp == "single") {
|
||||
params.spacing.set(Spacing::Single);
|
||||
tmp_space = Spacing::Single;
|
||||
} else if (tmp == "onehalf") {
|
||||
params.spacing.set(Spacing::Onehalf);
|
||||
tmp_space = Spacing::Onehalf;
|
||||
} else if (tmp == "double") {
|
||||
params.spacing.set(Spacing::Double);
|
||||
tmp_space = Spacing::Double;
|
||||
} else if (tmp == "other") {
|
||||
lex.next();
|
||||
params.spacing.set(Spacing::Other,
|
||||
lex.GetFloat());
|
||||
tmp_space = Spacing::Other;
|
||||
tmp_val = lex.GetFloat();
|
||||
} else {
|
||||
lex.printError("Unknown spacing token: '$$Token'");
|
||||
}
|
||||
// Small hack so that files written with klyx will be
|
||||
// parsed correctly.
|
||||
if (return_par) {
|
||||
par->spacing.set(tmp_space);
|
||||
par->spacing.set(tmp_space, tmp_val);
|
||||
} else {
|
||||
params.spacing.set(tmp_space);
|
||||
params.spacing.set(tmp_space, tmp_val);
|
||||
}
|
||||
} else if (token == "\\paragraph_spacing") {
|
||||
lex.next();
|
||||
@ -706,22 +695,6 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
|
||||
font.setLanguage(params.language_info);
|
||||
lex.printError("Unknown language `$$Token'");
|
||||
}
|
||||
#if 0
|
||||
} else if (token == "\\direction") { // obsolete
|
||||
if (format >= 2.16)
|
||||
lex.printError("Command \\direction is obsolete");
|
||||
lex.next();
|
||||
string tok = lex.GetString();
|
||||
if (tok == "rtl")
|
||||
font.setLanguage(&languages["hebrew"]);
|
||||
else if (tok == "default")
|
||||
if (params.language == "hebrew")
|
||||
font.setLanguage(default_language);
|
||||
else
|
||||
font.setLanguage(params.language_info);
|
||||
else
|
||||
lex.printError("Unknown direction `$$Token'");
|
||||
#endif
|
||||
} else if (token == "\\emph") {
|
||||
lex.next();
|
||||
font.setEmph(font.setLyXMisc(lex.GetString()));
|
||||
@ -745,10 +718,10 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
|
||||
lex.next();
|
||||
font.setLyXColor(lex.GetString());
|
||||
} else if (token == "\\align") {
|
||||
tmpret = lex.FindToken(string_align);
|
||||
int tmpret = lex.FindToken(string_align);
|
||||
if (tmpret == -1) ++tmpret;
|
||||
if (tmpret != LYX_LAYOUT_DEFAULT) { // tmpret != 99 ???
|
||||
tmpret2 = 1;
|
||||
int tmpret2 = 1;
|
||||
for (; tmpret > 0; --tmpret)
|
||||
tmpret2 = tmpret2 * 2;
|
||||
par->align = LyXAlignment(tmpret2);
|
||||
@ -780,16 +753,17 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
|
||||
} else if (token == "\\labelwidthstring") {
|
||||
lex.EatLine();
|
||||
par->labelwidthstring = lex.GetString();
|
||||
/* do not delete this token, it is still needed! */
|
||||
// do not delete this token, it is still needed!
|
||||
} else if (token == "\\end_inset") {
|
||||
/* simple ignore this. The insets do not have
|
||||
* to read this */
|
||||
// but insets should read it, it is a part of
|
||||
//the inset isn't it? Lgb.
|
||||
// Simply ignore this. The insets do not have
|
||||
// to read this.
|
||||
// But insets should read it, it is a part of
|
||||
// the inset isn't it? Lgb.
|
||||
} else if (token == "\\begin_inset") {
|
||||
// Should be moved out into its own function/method. (Lgb)
|
||||
lex.next();
|
||||
string tmptok = lex.GetString();
|
||||
/* test the different insets */
|
||||
// test the different insets
|
||||
if (tmptok == "Quotes") {
|
||||
Inset * inset = new InsetQuotes;
|
||||
inset->Read(lex);
|
||||
@ -797,6 +771,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
|
||||
par->InsertInset(pos, inset);
|
||||
par->SetFont(pos, font);
|
||||
++pos;
|
||||
#if 0
|
||||
} else if (tmptok == "\\i") {
|
||||
Inset * inset = new InsetLatexAccent;
|
||||
inset->Read(lex);
|
||||
@ -804,6 +779,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
|
||||
par->InsertInset(pos, inset);
|
||||
par->SetFont(pos, font);
|
||||
++pos;
|
||||
#endif
|
||||
} else if (tmptok == "FormulaMacro") {
|
||||
Inset * inset = new InsetFormulaMacro;
|
||||
inset->Read(lex);
|
||||
@ -869,7 +845,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
|
||||
} else if (tmptok == "LatexCommand") {
|
||||
InsetCommand inscmd;
|
||||
inscmd.Read(lex);
|
||||
Inset * inset;
|
||||
Inset * inset = 0;
|
||||
if (inscmd.getCmdName() == "cite") {
|
||||
inset = new InsetCitation(inscmd.getContents(), inscmd.getOptions());
|
||||
} else if (inscmd.getCmdName() == "bibitem") {
|
||||
@ -891,7 +867,8 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
|
||||
if (!inscmd.getOptions().empty() || !inscmd.getContents().empty()) {
|
||||
inset = new InsetRef(inscmd, this);
|
||||
}
|
||||
#warning Check if this else clause is still needed. (Lgb)
|
||||
// CHECK if this else clause
|
||||
//is still needed. (Lgb)
|
||||
#if 0
|
||||
// This condition comes from a
|
||||
// temporary solution to the latexdel
|
||||
@ -968,6 +945,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
|
||||
++pos;
|
||||
}
|
||||
}
|
||||
#if 0
|
||||
} else if (token == "\\InsetQuotes") {
|
||||
lyxerr << "InsetQuotes" << endl;
|
||||
Inset * inset = new InsetQuotes;
|
||||
@ -976,6 +954,8 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
|
||||
par->InsertInset(pos, inset);
|
||||
par->SetFont(pos, font);
|
||||
++pos;
|
||||
#endif
|
||||
#if 0
|
||||
} else if (token == "\\InsetFormula") {
|
||||
lyxerr << "InsetFormula" << endl;
|
||||
Inset * inset = new InsetFormula;
|
||||
@ -984,6 +964,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
|
||||
par->InsertInset(pos, inset);
|
||||
par->SetFont(pos, font);
|
||||
++pos;
|
||||
#endif
|
||||
} else if (token == "\\SpecialChar") {
|
||||
LyXLayout const & layout =
|
||||
textclasslist.Style(params.textclass,
|
||||
@ -1016,6 +997,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
|
||||
par->SetFont(pos, font);
|
||||
}
|
||||
++pos;
|
||||
#if 0
|
||||
} else if (token == "\\Figure") {
|
||||
lyxerr << "Figure" << endl;
|
||||
Inset * inset = new InsetFig(100, 100, this);
|
||||
@ -1024,6 +1006,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
|
||||
par->InsertInset(pos, inset);
|
||||
par->SetFont(pos, font);
|
||||
++pos;
|
||||
#endif
|
||||
} else if (token == "\\newline") {
|
||||
par->InsertChar(pos, LyXParagraph::META_NEWLINE);
|
||||
par->SetFont(pos, font);
|
||||
@ -1035,6 +1018,9 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
|
||||
par->SetFont(pos, font);
|
||||
++pos;
|
||||
} else if (token == "\\protected_separator") { // obsolete
|
||||
// This is a backward compability thingie. (Lgb)
|
||||
// Remove it later some time...introduced with fileformat
|
||||
// 2.16. (Lgb)
|
||||
LyXLayout const & layout =
|
||||
textclasslist.Style(params.textclass,
|
||||
par->GetLayout());
|
||||
@ -1376,17 +1362,16 @@ void Buffer::writeFileAscii(string const & fname, int linelen)
|
||||
/* noindent ? */
|
||||
|
||||
/* what about the alignment */
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
/* dummy layout, that means a footnote ended */
|
||||
footnoteflag = LyXParagraph::NO_FOOTNOTE;
|
||||
ofs << ") ";
|
||||
noparbreak = 1;
|
||||
}
|
||||
|
||||
LyXLayout const & layout =
|
||||
textclasslist.Style(params.textclass,
|
||||
par->GetLayout());
|
||||
//LyXLayout const & layout =
|
||||
// textclasslist.Style(params.textclass,
|
||||
// par->GetLayout()); // unused
|
||||
//bool free_spc = layout.free_spacing; //unused
|
||||
|
||||
/* It might be a table */
|
||||
@ -1435,7 +1420,7 @@ void Buffer::writeFileAscii(string const & fname, int linelen)
|
||||
clen[j] = h;
|
||||
}
|
||||
|
||||
font1 = LyXFont(LyXFont::ALL_INHERIT,params.language_info);
|
||||
font1 = LyXFont(LyXFont::ALL_INHERIT, params.language_info);
|
||||
actcell = 0;
|
||||
for (i = 0, actpos = 1; i < par->size(); ++i, ++actpos) {
|
||||
if (!i && !footnoteflag && !noparbreak){
|
||||
@ -1492,8 +1477,7 @@ void Buffer::writeFileAscii(string const & fname, int linelen)
|
||||
islatex = 0;
|
||||
else
|
||||
islatex = 1;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
islatex = 0;
|
||||
}
|
||||
c = par->GetChar(i);
|
||||
@ -1751,7 +1735,7 @@ void Buffer::makeLaTeXFile(string const & fname,
|
||||
options += (*cit)->lang + ",";
|
||||
}
|
||||
if (default_language != params.language_info)
|
||||
options += default_language ->lang + ',';
|
||||
options += default_language->lang + ',';
|
||||
options += params.language_info->lang + ',';
|
||||
}
|
||||
|
||||
@ -1788,7 +1772,7 @@ void Buffer::makeLaTeXFile(string const & fname,
|
||||
texrow.newline();
|
||||
}
|
||||
|
||||
/* at the very beginning the text parameters */
|
||||
// At the very beginning the text parameters.
|
||||
if (params.paperpackage != BufferParams::PACKAGE_NONE) {
|
||||
switch (params.paperpackage) {
|
||||
case BufferParams::PACKAGE_A4:
|
||||
@ -2219,7 +2203,7 @@ void Buffer::makeLinuxDocFile(string const & fname, int column)
|
||||
string environment_stack[10];
|
||||
string item_name;
|
||||
|
||||
int depth = 0; /* paragraph depth */
|
||||
int depth = 0; // paragraph depth
|
||||
|
||||
ofstream ofs(fname.c_str());
|
||||
|
||||
@ -2253,13 +2237,13 @@ void Buffer::makeLinuxDocFile(string const & fname, int column)
|
||||
}
|
||||
|
||||
while (par) {
|
||||
int desc_on = 0; /* description mode*/
|
||||
int desc_on = 0; // description mode
|
||||
LyXLayout const & style =
|
||||
textclasslist.Style(users->buffer()->params.textclass,
|
||||
par->layout);
|
||||
par->AutoDeleteInsets();
|
||||
|
||||
/* treat <toc> as a special case for compatibility with old code */
|
||||
// treat <toc> as a special case for compatibility with old code
|
||||
if (par->GetChar(0) == LyXParagraph::META_INSET) {
|
||||
Inset * inset = par->GetInset(0);
|
||||
char lyx_code = inset->LyxCode();
|
||||
@ -2296,7 +2280,9 @@ void Buffer::makeLinuxDocFile(string const & fname, int column)
|
||||
|
||||
case LATEX_COMMAND:
|
||||
if (depth!= 0)
|
||||
LinuxDocError(par, 0, _("Error : Wrong depth for LatexType Command.\n"));
|
||||
LinuxDocError(par, 0,
|
||||
_("Error : Wrong depth for"
|
||||
" LatexType Command.\n"));
|
||||
|
||||
if (!environment_stack[depth].empty()){
|
||||
sgmlCloseTag(ofs, depth,
|
||||
@ -2328,7 +2314,8 @@ void Buffer::makeLinuxDocFile(string const & fname, int column)
|
||||
sgmlOpenTag(ofs, depth, temp);
|
||||
}
|
||||
environment_stack[depth] = style.latexname();
|
||||
sgmlOpenTag(ofs, depth, environment_stack[depth]);
|
||||
sgmlOpenTag(ofs, depth,
|
||||
environment_stack[depth]);
|
||||
}
|
||||
if(style.latextype == LATEX_ENVIRONMENT) break;
|
||||
|
||||
@ -2355,7 +2342,7 @@ void Buffer::makeLinuxDocFile(string const & fname, int column)
|
||||
while(par && par->IsDummy());
|
||||
|
||||
ofs << "\n";
|
||||
/* write closing SGML tags */
|
||||
// write closing SGML tags
|
||||
switch(style.latextype) {
|
||||
case LATEX_COMMAND:
|
||||
case LATEX_ENVIRONMENT:
|
||||
@ -2367,7 +2354,7 @@ void Buffer::makeLinuxDocFile(string const & fname, int column)
|
||||
}
|
||||
}
|
||||
|
||||
/* Close open tags */
|
||||
// Close open tags
|
||||
for(; depth > 0; --depth)
|
||||
sgmlCloseTag(ofs, depth, environment_stack[depth]);
|
||||
|
||||
@ -2447,9 +2434,9 @@ void Buffer::DocBookHandleFootnote(ostream & os, LyXParagraph * & par,
|
||||
sgmlCloseTag(os, depth + 1, inner_tag);
|
||||
sgmlOpenTag(os, depth + 1, inner_tag);
|
||||
}
|
||||
}
|
||||
else
|
||||
} else {
|
||||
os << "\n";
|
||||
}
|
||||
} else {
|
||||
os << tmp_par;
|
||||
if(!inner_tag.empty()) sgmlCloseTag(os, depth + 1,
|
||||
@ -2528,18 +2515,18 @@ void Buffer::DocBookHandleFootnote(ostream & os, LyXParagraph * & par,
|
||||
}
|
||||
|
||||
|
||||
/* push a tag in a style stack */
|
||||
// push a tag in a style stack
|
||||
void Buffer::push_tag(ostream & os, char const * tag,
|
||||
int & pos, char stack[5][3])
|
||||
{
|
||||
/* pop all previous tags */
|
||||
// pop all previous tags
|
||||
for (int j = pos; j >= 0; --j)
|
||||
os << "</" << stack[j] << ">";
|
||||
|
||||
/* add new tag */
|
||||
// add new tag
|
||||
sprintf(stack[++pos], "%s", tag);
|
||||
|
||||
/* push all tags */
|
||||
// push all tags
|
||||
for (int i = 0; i <= pos; ++i)
|
||||
os << "<" << stack[i] << ">";
|
||||
}
|
||||
@ -2566,7 +2553,7 @@ void Buffer::pop_tag(ostream & os, char const * tag,
|
||||
}
|
||||
|
||||
|
||||
/* handle internal paragraph parsing -- layout already processed */
|
||||
// Handle internal paragraph parsing -- layout already processed.
|
||||
|
||||
// checks, if newcol chars should be put into this line
|
||||
// writes newline, if necessary.
|
||||
@ -2598,7 +2585,8 @@ void Buffer::SimpleLinuxDocOnePar(ostream & os, LyXParagraph * par,
|
||||
char shape_type = 0; // shape font flag
|
||||
bool is_em = false; // emphasis (italic) font flag
|
||||
|
||||
int stack_num = -1; // style stack position
|
||||
int stack_num = -1; // style stack position
|
||||
// Can this be rewritten to use a std::stack, please. (Lgb)
|
||||
char stack[5][3]; // style stack
|
||||
unsigned int char_line_count = 5; // Heuristic choice ;-)
|
||||
|
||||
@ -2607,18 +2595,18 @@ void Buffer::SimpleLinuxDocOnePar(ostream & os, LyXParagraph * par,
|
||||
else
|
||||
main_body = par->BeginningOfMainBody();
|
||||
|
||||
/* gets paragraph main font */
|
||||
// gets paragraph main font
|
||||
if (main_body > 0)
|
||||
font1 = style.labelfont;
|
||||
else
|
||||
font1 = style.font;
|
||||
|
||||
|
||||
/* parsing main loop */
|
||||
// parsing main loop
|
||||
for (LyXParagraph::size_type i = 0;
|
||||
i < par->size(); ++i) {
|
||||
|
||||
/* handle quote tag */
|
||||
// handle quote tag
|
||||
if (i == main_body && !par->IsDummy()) {
|
||||
if (main_body > 0)
|
||||
font1 = style.font;
|
||||
@ -2660,7 +2648,7 @@ void Buffer::SimpleLinuxDocOnePar(ostream & os, LyXParagraph * par,
|
||||
}
|
||||
}
|
||||
|
||||
/* handle bold face */
|
||||
// handle bold face
|
||||
if (font1.series() != font2.series()) {
|
||||
if (font2.series() == LyXFont::BOLD_SERIES) {
|
||||
push_tag(os, "bf", stack_num, stack);
|
||||
@ -2672,7 +2660,7 @@ void Buffer::SimpleLinuxDocOnePar(ostream & os, LyXParagraph * par,
|
||||
}
|
||||
}
|
||||
|
||||
/* handle italic and slanted fonts */
|
||||
// handle italic and slanted fonts
|
||||
if (font1.shape() != font2.shape()) {
|
||||
switch(shape_type) {
|
||||
case 0:
|
||||
@ -2706,7 +2694,7 @@ void Buffer::SimpleLinuxDocOnePar(ostream & os, LyXParagraph * par,
|
||||
}
|
||||
}
|
||||
}
|
||||
/* handle <em> tag */
|
||||
// handle <em> tag
|
||||
if (font1.emph() != font2.emph()) {
|
||||
if (font2.emph() == LyXFont::ON) {
|
||||
push_tag(os, "em", stack_num, stack);
|
||||
@ -2753,12 +2741,12 @@ void Buffer::SimpleLinuxDocOnePar(ostream & os, LyXParagraph * par,
|
||||
font1 = font2;
|
||||
}
|
||||
|
||||
/* needed if there is an optional argument but no contents */
|
||||
// needed if there is an optional argument but no contents
|
||||
if (main_body > 0 && main_body == par->size()) {
|
||||
font1 = style.font;
|
||||
}
|
||||
|
||||
/* pop all defined Styles */
|
||||
// pop all defined Styles
|
||||
for (j = stack_num; j >= 0; --j) {
|
||||
linux_doc_line_break(os,
|
||||
char_line_count,
|
||||
@ -2766,27 +2754,27 @@ void Buffer::SimpleLinuxDocOnePar(ostream & os, LyXParagraph * par,
|
||||
os << "</" << stack[j] << ">";
|
||||
}
|
||||
|
||||
/* resets description flag correctly */
|
||||
// resets description flag correctly
|
||||
switch(desc_on){
|
||||
case 1:
|
||||
/* <tag> not closed... */
|
||||
// <tag> not closed...
|
||||
linux_doc_line_break(os, char_line_count, 6);
|
||||
os << "</tag>";
|
||||
break;
|
||||
case 2:
|
||||
/* fprintf(file, "</p>");*/
|
||||
// fprintf(file, "</p>");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* print an error message */
|
||||
// Print an error message.
|
||||
void Buffer::LinuxDocError(LyXParagraph * par, int pos,
|
||||
char const * message)
|
||||
{
|
||||
InsetError * new_inset;
|
||||
|
||||
/* insert an error marker in text */
|
||||
// insert an error marker in text
|
||||
new_inset = new InsetError(message);
|
||||
par->InsertChar(pos, LyXParagraph::META_INSET);
|
||||
par->InsertInset(pos, new_inset);
|
||||
@ -2805,8 +2793,10 @@ void Buffer::makeDocBookFile(string const & fname, int column)
|
||||
LyXParagraph * par = paragraph;
|
||||
|
||||
string top_element= textclasslist.LatexnameOfClass(params.textclass);
|
||||
// Please use a real stack.
|
||||
string environment_stack[MAX_NEST_LEVEL];
|
||||
string environment_inner[MAX_NEST_LEVEL];
|
||||
// Please use a real stack.
|
||||
string command_stack[MAX_NEST_LEVEL];
|
||||
bool command_flag= false;
|
||||
int command_depth= 0, command_base= 0, cmd_depth= 0;
|
||||
@ -2814,7 +2804,7 @@ void Buffer::makeDocBookFile(string const & fname, int column)
|
||||
string item_name, command_name;
|
||||
string c_depth, c_params, tmps;
|
||||
|
||||
int depth= 0; /* paragraph depth */
|
||||
int depth = 0; // paragraph depth
|
||||
|
||||
tex_code_break_column = column;
|
||||
|
||||
@ -2847,13 +2837,13 @@ void Buffer::makeDocBookFile(string const & fname, int column)
|
||||
}
|
||||
|
||||
while (par) {
|
||||
int desc_on = 0; /* description mode*/
|
||||
int desc_on = 0; // description mode
|
||||
LyXLayout const & style =
|
||||
textclasslist.Style(users->buffer()->params.textclass,
|
||||
par->layout);
|
||||
par->AutoDeleteInsets();
|
||||
|
||||
/* environment tag closing */
|
||||
// environment tag closing
|
||||
for( ; depth > par->depth; --depth) {
|
||||
if(environment_inner[depth] != "!-- --") {
|
||||
item_name= "listitem";
|
||||
@ -3023,7 +3013,7 @@ void Buffer::makeDocBookFile(string const & fname, int column)
|
||||
while(par && par->IsDummy());
|
||||
|
||||
string end_tag;
|
||||
/* write closing SGML tags */
|
||||
// write closing SGML tags
|
||||
switch(style.latextype) {
|
||||
case LATEX_COMMAND:
|
||||
end_tag = "title";
|
||||
@ -3101,10 +3091,6 @@ void Buffer::SimpleDocBookOnePar(ostream & os, string & extra,
|
||||
main_body = par->BeginningOfMainBody();
|
||||
|
||||
// gets paragraph main font
|
||||
//if (main_body > 0)
|
||||
// font1 = style.labelfont;
|
||||
//else
|
||||
// font1 = style.font;
|
||||
LyXFont font1 = main_body > 0 ? style.labelfont : style.font;
|
||||
|
||||
int char_line_count = depth;
|
||||
@ -3169,8 +3155,7 @@ void Buffer::SimpleDocBookOnePar(ostream & os, string & extra,
|
||||
if (c != '\0')
|
||||
os << c;
|
||||
++char_line_count;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
string sgml_string;
|
||||
if (par->linuxDocConvertChar(c, sgml_string)
|
||||
&& !style.free_spacing) { // in freespacing
|
||||
@ -3181,19 +3166,17 @@ void Buffer::SimpleDocBookOnePar(ostream & os, string & extra,
|
||||
++char_line_count;
|
||||
os << "\n</term><listitem><para>";
|
||||
desc_on = 2;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
os << c;
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
os << sgml_string;
|
||||
}
|
||||
}
|
||||
font1 = font2;
|
||||
}
|
||||
|
||||
/* needed if there is an optional argument but no contents */
|
||||
// needed if there is an optional argument but no contents
|
||||
if (main_body > 0 && main_body == par->size()) {
|
||||
font1 = style.font;
|
||||
}
|
||||
@ -3201,10 +3184,10 @@ void Buffer::SimpleDocBookOnePar(ostream & os, string & extra,
|
||||
os << "</emphasis>";
|
||||
}
|
||||
|
||||
/* resets description flag correctly */
|
||||
// resets description flag correctly
|
||||
switch(desc_on){
|
||||
case 1:
|
||||
/* <term> not closed... */
|
||||
// <term> not closed...
|
||||
os << "</term>";
|
||||
break;
|
||||
}
|
||||
@ -3269,7 +3252,7 @@ int Buffer::runLaTeX()
|
||||
if (a || (res & LaTeX::ERRORS)){
|
||||
users->redraw();
|
||||
users->fitCursor();
|
||||
users->updateScrollbar();
|
||||
//users->updateScrollbar();
|
||||
}
|
||||
AllowInput(users);
|
||||
|
||||
@ -3340,7 +3323,7 @@ int Buffer::runLiterate()
|
||||
if (a || (res & Literate::ERRORS)){
|
||||
users->redraw();
|
||||
users->fitCursor();
|
||||
users->updateScrollbar();
|
||||
//users->updateScrollbar();
|
||||
}
|
||||
AllowInput(users);
|
||||
|
||||
@ -3405,12 +3388,13 @@ int Buffer::buildProgram()
|
||||
markNwClean();
|
||||
}
|
||||
|
||||
// if we removed error insets before we ran Literate/Build or if we inserted
|
||||
// error insets after we ran Literate/Build this must be run:
|
||||
// if we removed error insets before we ran Literate/Build or
|
||||
// if we inserted error insets after we ran Literate/Build this
|
||||
// must be run:
|
||||
if (a || (res & Literate::ERRORS)){
|
||||
users->redraw();
|
||||
users->fitCursor();
|
||||
users->updateScrollbar();
|
||||
//users->updateScrollbar();
|
||||
}
|
||||
AllowInput(users);
|
||||
|
||||
@ -3465,7 +3449,7 @@ int Buffer::runChktex()
|
||||
if (a || res){
|
||||
users->redraw();
|
||||
users->fitCursor();
|
||||
users->updateScrollbar();
|
||||
//users->updateScrollbar();
|
||||
}
|
||||
AllowInput(users);
|
||||
|
||||
@ -3883,16 +3867,18 @@ void Buffer::Dispatch(int action, string const & argument)
|
||||
} // end of switch
|
||||
}
|
||||
|
||||
|
||||
void Buffer::ChangeLanguage(Language const * from, Language const * to)
|
||||
{
|
||||
|
||||
LyXParagraph * par = paragraph;
|
||||
while (par) {
|
||||
par->ChangeLanguage(from,to);
|
||||
par->ChangeLanguage(from, to);
|
||||
par = par->next;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool Buffer::isMultiLingual()
|
||||
{
|
||||
|
||||
|
@ -113,7 +113,7 @@ public:
|
||||
void redraw() {
|
||||
users->redraw();
|
||||
users->fitCursor();
|
||||
users->updateScrollbar();
|
||||
//users->updateScrollbar();
|
||||
}
|
||||
|
||||
///
|
||||
|
@ -611,27 +611,32 @@ void runqueue()
|
||||
::sleep(1);
|
||||
XGrabServer(tempdisp);
|
||||
}
|
||||
#ifdef HAVE_SSTREAM
|
||||
XChangeProperty(tempdisp,
|
||||
fl_get_canvas_id(figinset_canvas),
|
||||
XInternAtom(tempdisp, "GHOSTVIEW", false),
|
||||
XInternAtom(tempdisp, "STRING", false),
|
||||
8, PropModeAppend,
|
||||
#ifdef HAVE_SSTREAM
|
||||
reinterpret_cast<unsigned char*>(const_cast<char*>(t1.str().c_str())),
|
||||
t1.str().size()
|
||||
t1.str().size());
|
||||
#else
|
||||
|
||||
XChangeProperty(tempdisp,
|
||||
fl_get_canvas_id(figinset_canvas),
|
||||
XInternAtom(tempdisp, "GHOSTVIEW", false),
|
||||
XInternAtom(tempdisp, "STRING", false),
|
||||
8, PropModeAppend,
|
||||
reinterpret_cast<unsigned char*>(const_cast<char*>(t1.str())),
|
||||
strlen(t1.str())
|
||||
::strlen(t1.str()));
|
||||
#endif
|
||||
);
|
||||
XUngrabServer(tempdisp);
|
||||
XFlush(tempdisp);
|
||||
|
||||
#ifdef HAVE_SSTREAM
|
||||
ostringstream t3;
|
||||
#else
|
||||
char tbuf3[384];
|
||||
ostrstream t3(tbuf3, sizeof(tbuf3));
|
||||
//char tbuf[384];
|
||||
ostrstream t3(tbuf, sizeof(tbuf));
|
||||
#endif
|
||||
switch (p->data->flags & 3) {
|
||||
case 0: t3 << 'H'; break; // Hidden
|
||||
@ -652,20 +657,25 @@ void runqueue()
|
||||
#endif
|
||||
|
||||
XGrabServer(tempdisp);
|
||||
#ifdef HAVE_SSTREAM
|
||||
XChangeProperty(tempdisp,
|
||||
fl_get_canvas_id(figinset_canvas),
|
||||
XInternAtom(tempdisp,
|
||||
"GHOSTVIEW_COLORS", false),
|
||||
XInternAtom(tempdisp, "STRING", false),
|
||||
8, PropModeReplace,
|
||||
#ifdef HAVE_SSTREAM
|
||||
reinterpret_cast<unsigned char*>(const_cast<char*>(t3.str().c_str())),
|
||||
t3.str().size()
|
||||
t3.str().size());
|
||||
#else
|
||||
XChangeProperty(tempdisp,
|
||||
fl_get_canvas_id(figinset_canvas),
|
||||
XInternAtom(tempdisp,
|
||||
"GHOSTVIEW_COLORS", false),
|
||||
XInternAtom(tempdisp, "STRING", false),
|
||||
8, PropModeReplace,
|
||||
reinterpret_cast<unsigned char*>(const_cast<char*>(t3.str())),
|
||||
strlen(t3.str())
|
||||
::strlen(t3.str()));
|
||||
#endif
|
||||
);
|
||||
XUngrabServer(tempdisp);
|
||||
XFlush(tempdisp);
|
||||
|
||||
@ -963,7 +973,7 @@ void UnregisterFigure(InsetFig * fi)
|
||||
fl_hide_form(tmpfig->inset->form->Figure);
|
||||
}
|
||||
#if FL_REVISION == 89
|
||||
#warning Reactivate this free_form calls
|
||||
// CHECK Reactivate this free_form calls
|
||||
#else
|
||||
fl_free_form(tmpfig->inset->form->Figure);
|
||||
free(tmpfig->inset->form); // Why free?
|
||||
@ -1768,7 +1778,7 @@ void InsetFig::CallbackFig(long arg)
|
||||
fl_set_focus_object(form->Figure, form->OkBtn);
|
||||
fl_hide_form(form->Figure);
|
||||
#if FL_REVISION == 89
|
||||
#warning Reactivate this free_form calls
|
||||
// CHECK Reactivate this free_form calls
|
||||
#else
|
||||
fl_free_form(form->Figure);
|
||||
free(form); // Why free?
|
||||
@ -1785,8 +1795,8 @@ void InsetFig::CallbackFig(long arg)
|
||||
fl_set_focus_object(form->Figure, form->OkBtn);
|
||||
fl_hide_form(form->Figure);
|
||||
#if FL_REVISION == 89
|
||||
#warning Reactivate this free_form calls
|
||||
#warning Jug, is this still a problem?
|
||||
// CHECK Reactivate this free_form calls
|
||||
// Jug, is this still a problem?
|
||||
#else
|
||||
fl_free_form(form->Figure);
|
||||
free(form); // Why free?
|
||||
|
@ -17,7 +17,6 @@
|
||||
#include "gettext.h"
|
||||
#include "lyxfont.h"
|
||||
#include "BufferView.h"
|
||||
#include "lyxscreen.h"
|
||||
#include "Painter.h"
|
||||
#include "support/LOstream.h"
|
||||
|
||||
|
@ -1019,7 +1019,8 @@ void InsetText::setPos(Painter & pain, int x, int y) const
|
||||
cursor.y = top_baseline;
|
||||
y += cursor.y;
|
||||
for(unsigned int i = 1;
|
||||
((cursor.y + rows[i - 1].desc) < y) && (i < rows.size() - 1); ++i) {
|
||||
(long(cursor.y + rows[i - 1].desc) < y)
|
||||
&& (i < rows.size() - 1); ++i) {
|
||||
cursor.y = rows[i].baseline;
|
||||
cursor.pos = rows[i].pos;
|
||||
actrow = i;
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include "gettext.h"
|
||||
|
||||
Languages languages;
|
||||
Language const * default_language;
|
||||
Language const *default_language;
|
||||
Language ignore_lang = {"ignore", "Ignore", false};
|
||||
Language const * ignore_language = &ignore_lang;
|
||||
|
||||
|
@ -11,9 +11,25 @@ struct Language {
|
||||
bool RightToLeft;
|
||||
};
|
||||
|
||||
#if 0
|
||||
bool operator==(Language const & l1, Language const & l2)
|
||||
{
|
||||
return l1.lang == l2.lang
|
||||
&& l1.display == l2.display
|
||||
&& l1.RightToLeft == l2.RightToLeft;
|
||||
}
|
||||
|
||||
|
||||
bool operator!=(Language const l1, Language const & l2)
|
||||
{
|
||||
return !(l1 == l2);
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
typedef std::map<string, Language> Languages;
|
||||
extern Languages languages;
|
||||
extern Language const * default_language;
|
||||
extern Language const * ignore_language;
|
||||
extern Language const *ignore_language;
|
||||
|
||||
#endif
|
||||
|
15
src/lyx_cb.C
15
src/lyx_cb.C
@ -479,9 +479,7 @@ bool RunScript(Buffer * buffer, bool wait,
|
||||
// the return code of the command. This means that all
|
||||
// the code I added in PrintApplyCB is currently
|
||||
// useless...
|
||||
#ifdef WITH_WARNINGS
|
||||
#warning What should we do here?
|
||||
#endif
|
||||
// CHECK What should we do here?
|
||||
ShowMessage(buffer, _("Executing command:"), cmd);
|
||||
result = one.startscript(Systemcalls::System, cmd);
|
||||
} else {
|
||||
@ -1279,9 +1277,9 @@ int RunLinuxDoc(BufferView * bv, int flag, string const & filename)
|
||||
if (!bv->available())
|
||||
return 0;
|
||||
bv->buffer()->makeLinuxDocFile(name, 0);
|
||||
#ifdef WITH_WARNINGS
|
||||
#warning remove this once we have a proper geometry class
|
||||
#endif
|
||||
|
||||
// CHECK remove this once we have a proper geometry class
|
||||
|
||||
BufferParams::PAPER_SIZE ps =
|
||||
static_cast<BufferParams::PAPER_SIZE>(bv->buffer()->params.papersize);
|
||||
switch (ps) {
|
||||
@ -2364,9 +2362,10 @@ extern "C" void DocumentApplyCB(FL_OBJECT *, long)
|
||||
BufferParams * params = &(current_view->buffer()->params);
|
||||
|
||||
Language const * old_language = params->language_info;
|
||||
Language const * new_language;
|
||||
params->language = combo_language->getline();
|
||||
Languages::iterator lit = languages.find(params->language);
|
||||
|
||||
Language const * new_language;
|
||||
if (lit != languages.end())
|
||||
new_language = &(*lit).second;
|
||||
else
|
||||
@ -2707,7 +2706,7 @@ extern "C" void TableApplyCB(FL_OBJECT *, long)
|
||||
|
||||
Language const * lang =
|
||||
current_view->text->cursor.par->getParLanguage();
|
||||
LyXFont font(LyXFont::ALL_INHERIT,lang);
|
||||
LyXFont font(LyXFont::ALL_INHERIT, lang);
|
||||
for (int i = 0; i < xsize * ysize - 1; ++i) {
|
||||
current_view->text->cursor.par->InsertChar(0, LyXParagraph::META_NEWLINE);
|
||||
current_view->text->cursor.par->SetFont(0, font);
|
||||
|
@ -28,7 +28,7 @@ struct LyXCursor {
|
||||
///
|
||||
int x_fix;
|
||||
///
|
||||
long y;
|
||||
unsigned long y;
|
||||
///
|
||||
Row * row;
|
||||
};
|
||||
|
@ -515,7 +515,7 @@ LyXFont & LyXFont::setLyXColor(string const & col)
|
||||
/// Sets size after GUI name
|
||||
LyXFont & LyXFont::setGUISize(string const & siz)
|
||||
{
|
||||
#warning this might be wrong.
|
||||
// CHECK this might be wrong.
|
||||
/// ??????
|
||||
// this is how it was how it was done in the lyx repository...
|
||||
// but this does not make sense.
|
||||
|
@ -443,6 +443,7 @@ LyXFont::LyXFont(LyXFont::FONT_INIT3, Language const * l)
|
||||
lang = l;
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
LyXFont & LyXFont::operator=(LyXFont const & x)
|
||||
{
|
||||
|
@ -164,12 +164,12 @@ void LyXFunc::moveCursorUpdate(bool selecting)
|
||||
if (selecting || owner->view()->text->mark_set) {
|
||||
owner->view()->text->SetSelection();
|
||||
owner->view()->toggleToggle();
|
||||
owner->view()->update(0);
|
||||
} else {
|
||||
owner->view()->update(-2); // this IS necessary
|
||||
//owner->view()->update(0);
|
||||
//} else {
|
||||
//owner->view()->update(-2); // this IS necessary
|
||||
// (Matthias)
|
||||
}
|
||||
|
||||
owner->view()->update(0);
|
||||
owner->view()->showCursor();
|
||||
|
||||
/* ---> Everytime the cursor is moved, show the current font state. */
|
||||
@ -948,7 +948,7 @@ string LyXFunc::Dispatch(int ac,
|
||||
if (owner->view()->removeAutoInsets()) {
|
||||
owner->view()->redraw();
|
||||
owner->view()->fitCursor();
|
||||
owner->view()->updateScrollbar();
|
||||
//owner->view()->updateScrollbar();
|
||||
}
|
||||
break;
|
||||
|
||||
@ -1680,7 +1680,11 @@ string LyXFunc::Dispatch(int ac,
|
||||
case LFUN_BREAKLINE:
|
||||
owner->view()->beforeChange();
|
||||
owner->view()->text->InsertChar(LyXParagraph::META_NEWLINE);
|
||||
#if 1
|
||||
owner->view()->update(1);
|
||||
#else
|
||||
owner->view()->smallUpdate(1);
|
||||
#endif
|
||||
SetUpdateTimer(0.01);
|
||||
moveCursorUpdate(false);
|
||||
break;
|
||||
@ -1722,7 +1726,11 @@ string LyXFunc::Dispatch(int ac,
|
||||
owner->view()->text->Delete();
|
||||
owner->view()->text->sel_cursor =
|
||||
owner->view()->text->cursor;
|
||||
#if 1
|
||||
owner->view()->update(1);
|
||||
#else
|
||||
owner->view()->smallUpdate(1);
|
||||
#endif
|
||||
// It is possible to make it a lot faster still
|
||||
// just comment out the lone below...
|
||||
owner->view()->showCursor();
|
||||
@ -1765,13 +1773,21 @@ string LyXFunc::Dispatch(int ac,
|
||||
owner->view()->text->Delete();
|
||||
owner->view()->text->sel_cursor =
|
||||
owner->view()->text->cursor;
|
||||
#if 1
|
||||
owner->view()->update(1);
|
||||
#else
|
||||
owner->view()->smallUpdate(1);
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
owner->view()->text->Delete();
|
||||
owner->view()->text->sel_cursor =
|
||||
owner->view()->text->cursor;
|
||||
#if 1
|
||||
owner->view()->update(1);
|
||||
#else
|
||||
owner->view()->smallUpdate(1);
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
owner->view()->cut();
|
||||
@ -1839,7 +1855,11 @@ string LyXFunc::Dispatch(int ac,
|
||||
owner->view()->text->Backspace();
|
||||
owner->view()->text->sel_cursor =
|
||||
owner->view()->text->cursor;
|
||||
#if 1
|
||||
owner->view()->update(1);
|
||||
#else
|
||||
owner->view()->smallUpdate(1);
|
||||
#endif
|
||||
// It is possible to make it a lot faster still
|
||||
// just comment out the lone below...
|
||||
owner->view()->showCursor();
|
||||
@ -1877,7 +1897,11 @@ string LyXFunc::Dispatch(int ac,
|
||||
owner->view()->text->Backspace();
|
||||
owner->view()->text->sel_cursor
|
||||
= cursor;
|
||||
#if 1
|
||||
owner->view()->update(1);
|
||||
#else
|
||||
owner->view()->smallUpdate (1);
|
||||
#endif
|
||||
}
|
||||
} else
|
||||
owner->view()->cut();
|
||||
@ -1889,7 +1913,11 @@ string LyXFunc::Dispatch(int ac,
|
||||
{
|
||||
owner->view()->beforeChange();
|
||||
owner->view()->text->BreakParagraph(0);
|
||||
#if 1
|
||||
owner->view()->update(1);
|
||||
#else
|
||||
owner->view()->smallUpdate(1);
|
||||
#endif
|
||||
SetUpdateTimer(0.01);
|
||||
owner->view()->text->sel_cursor =
|
||||
owner->view()->text->cursor;
|
||||
@ -1902,7 +1930,11 @@ string LyXFunc::Dispatch(int ac,
|
||||
{
|
||||
owner->view()->beforeChange();
|
||||
owner->view()->text->BreakParagraph(1);
|
||||
#if 1
|
||||
owner->view()->update(1);
|
||||
#else
|
||||
owner->view()->smallUpdate(1);
|
||||
#endif
|
||||
SetUpdateTimer(0.01);
|
||||
owner->view()->text->sel_cursor =
|
||||
owner->view()->text->cursor;
|
||||
@ -1935,7 +1967,11 @@ string LyXFunc::Dispatch(int ac,
|
||||
}
|
||||
else {
|
||||
owner->view()->text->BreakParagraph(0);
|
||||
#if 1
|
||||
owner->view()->update(1);
|
||||
#else
|
||||
owner->view()->smallUpdate(1);
|
||||
#endif
|
||||
}
|
||||
SetUpdateTimer(0.01);
|
||||
owner->view()->text->sel_cursor = cursor;
|
||||
@ -1995,7 +2031,11 @@ string LyXFunc::Dispatch(int ac,
|
||||
case LFUN_QUOTE:
|
||||
owner->view()->beforeChange();
|
||||
owner->view()->text->InsertChar('\"'); // This " matches the single quote in the code
|
||||
#if 1
|
||||
owner->view()->update(1);
|
||||
#else
|
||||
owner->view()->smallUpdate(1);
|
||||
#endif
|
||||
SetUpdateTimer();
|
||||
moveCursorUpdate(false);
|
||||
break;
|
||||
@ -2191,7 +2231,11 @@ string LyXFunc::Dispatch(int ac,
|
||||
keyseq.length = 0;
|
||||
|
||||
// copied verbatim from do_accent_char
|
||||
#if 1
|
||||
owner->view()->update(1);
|
||||
#else
|
||||
owner->view()->smallUpdate(1);
|
||||
#endif
|
||||
SetUpdateTimer();
|
||||
owner->view()->text->sel_cursor =
|
||||
owner->view()->text->cursor;
|
||||
@ -2545,7 +2589,11 @@ string LyXFunc::Dispatch(int ac,
|
||||
owner->view()->text->InsertChar(argument[i]);
|
||||
// This needs to be in the loop, or else we
|
||||
// won't break lines correctly. (Asger)
|
||||
#if 1
|
||||
owner->view()->update(1);
|
||||
#else
|
||||
owner->view()->smallUpdate(1);
|
||||
#endif
|
||||
}
|
||||
SetUpdateTimer();
|
||||
owner->view()->text->sel_cursor =
|
||||
@ -2583,7 +2631,11 @@ string LyXFunc::Dispatch(int ac,
|
||||
datetmp_len = (int) strftime(datetmp, 32, arg.c_str(), now_tm);
|
||||
for (int i = 0; i < datetmp_len; i++) {
|
||||
owner->view()->text->InsertChar(datetmp[i]);
|
||||
#if 1
|
||||
owner->view()->update(1);
|
||||
#else
|
||||
owner->view()->smallUpdate(1);
|
||||
#endif
|
||||
}
|
||||
SetUpdateTimer();
|
||||
owner->view()->text->sel_cursor = owner->view()->text->cursor;
|
||||
@ -2637,8 +2689,12 @@ string LyXFunc::Dispatch(int ac,
|
||||
} else
|
||||
owner->getIntl()->getTrans()->TranslateAndInsert(argument[i], owner->view()->text);
|
||||
}
|
||||
|
||||
|
||||
#if 1
|
||||
owner->view()->update(1);
|
||||
#else
|
||||
owner->view()->smallUpdate(1);
|
||||
#endif
|
||||
SetUpdateTimer();
|
||||
|
||||
owner->view()->text->sel_cursor =
|
||||
|
15
src/lyxrow.h
15
src/lyxrow.h
@ -17,16 +17,9 @@
|
||||
///
|
||||
struct Row {
|
||||
///
|
||||
Row()
|
||||
: par(0), pos(0), baseline(0), fill(0), height(0),
|
||||
ascent_of_text(0), next(0), previous(0)
|
||||
{}
|
||||
///
|
||||
LyXParagraph * par;
|
||||
///
|
||||
LyXParagraph::size_type pos;
|
||||
///
|
||||
unsigned short baseline;
|
||||
/** what is missing to a full row can be negative.
|
||||
Needed for hfills, flushright, block etc. */
|
||||
mutable int fill;
|
||||
@ -34,7 +27,13 @@ struct Row {
|
||||
unsigned short height;
|
||||
///
|
||||
unsigned short ascent_of_text;
|
||||
|
||||
///
|
||||
unsigned int baseline;
|
||||
///
|
||||
Row()
|
||||
: par(0), pos(0), fill(0), height(0),
|
||||
ascent_of_text(0), baseline(0), next(0), previous(0)
|
||||
{}
|
||||
///
|
||||
Row * next;
|
||||
///
|
||||
|
@ -47,15 +47,15 @@ public:
|
||||
|
||||
/** Draws the screen form textposition y. Uses as much of
|
||||
the already printed pixmap as possible */
|
||||
void Draw(long y );
|
||||
void Draw(unsigned long y );
|
||||
|
||||
/// Redraws the screen, without using existing pixmap
|
||||
void Redraw();
|
||||
|
||||
/// Returns a new top so that the cursor is visible
|
||||
long TopCursorVisible();
|
||||
unsigned long TopCursorVisible();
|
||||
/// Redraws the screen such that the cursor is visible
|
||||
int FitCursor();
|
||||
bool FitCursor();
|
||||
///
|
||||
void ShowCursor();
|
||||
///
|
||||
@ -66,7 +66,7 @@ public:
|
||||
void ShowManualCursor(long x, long y, int asc, int desc,
|
||||
Cursor_Shape shape);
|
||||
/// returns 1 if first has changed, otherwise 0
|
||||
int FitManualCursor(long, long, int, int);
|
||||
bool FitManualCursor(long, long, int, int);
|
||||
///
|
||||
void ToggleSelection(bool = true);
|
||||
///
|
||||
@ -79,12 +79,13 @@ public:
|
||||
we only update the current row. */
|
||||
void Update();
|
||||
|
||||
#if 0
|
||||
/** Updates part of the screen. Updates till row with cursor,
|
||||
or only current row */
|
||||
void SmallUpdate();
|
||||
|
||||
#endif
|
||||
/// first visible pixel-row
|
||||
long first;
|
||||
unsigned long first;
|
||||
|
||||
///
|
||||
bool cursor_visible;
|
||||
@ -94,9 +95,14 @@ private:
|
||||
|
||||
/// y1 and y2 are coordinates of the screen
|
||||
void DrawFromTo(int y1, int y2);
|
||||
|
||||
|
||||
#if 1
|
||||
/// y is a coordinate of the text
|
||||
void DrawOneRow(Row * row, long y_text);
|
||||
#else
|
||||
/// y is a coordinate of the text
|
||||
void DrawOneRow(Row * row, long & y_text);
|
||||
#endif
|
||||
|
||||
///
|
||||
WorkArea & owner;
|
||||
@ -114,11 +120,12 @@ private:
|
||||
int cursor_pixmap_w;
|
||||
///
|
||||
int cursor_pixmap_h;
|
||||
#if 0
|
||||
///
|
||||
long screen_refresh_y;
|
||||
///
|
||||
Row * screen_refresh_row;
|
||||
|
||||
#endif
|
||||
///
|
||||
GC gc_copy;
|
||||
};
|
||||
|
@ -27,6 +27,7 @@ class BufferParams;
|
||||
class Row;
|
||||
class BufferView;
|
||||
|
||||
|
||||
/**
|
||||
This class holds the mapping between buffer paragraphs and screen rows.
|
||||
*/
|
||||
@ -37,8 +38,6 @@ public:
|
||||
///
|
||||
UNCHANGED,
|
||||
///
|
||||
NEED_LITTLE_REFRESH,
|
||||
///
|
||||
NEED_MORE_REFRESH,
|
||||
///
|
||||
NEED_VERY_LITTLE_REFRESH
|
||||
@ -144,8 +143,9 @@ public:
|
||||
///
|
||||
void InsertInset(Inset * inset);
|
||||
|
||||
/// completes the insertion with a full rebreak
|
||||
int FullRebreak();
|
||||
/** Completes the insertion with a full rebreak.
|
||||
Returns true if something was broken. */
|
||||
bool FullRebreak();
|
||||
|
||||
///
|
||||
LyXParagraph::footnote_flag GetFootnoteFlag(int row);
|
||||
@ -485,18 +485,13 @@ private:
|
||||
mutable Row * firstrow;
|
||||
///
|
||||
mutable Row * lastrow;
|
||||
|
||||
|
||||
/** Copybuffer for copy environment type
|
||||
Asger has learned that this should be a buffer-property instead
|
||||
Lgb has learned that 'char' is a lousy type for non-characters
|
||||
*/
|
||||
LyXTextClass::size_type copylayouttype;
|
||||
|
||||
/// the currentrow is needed to access rows faster*/
|
||||
mutable Row * currentrow; // pointer to the current row
|
||||
/// position in the text
|
||||
mutable long currentrow_y;
|
||||
|
||||
/** inserts a new row behind the specified row, increments
|
||||
* the touched counters */
|
||||
void InsertRow(Row * row, LyXParagraph * par,
|
||||
@ -590,13 +585,13 @@ private:
|
||||
|
||||
/// like NumberOfHfills, but only those in the manual label!
|
||||
int NumberOfLabelHfills(Row const * row) const;
|
||||
|
||||
/** returns true, if a expansion is needed. Rules are given by
|
||||
LaTeX
|
||||
*/
|
||||
bool HfillExpansion(Row const * row_ptr,
|
||||
LyXParagraph::size_type pos) const;
|
||||
|
||||
|
||||
///
|
||||
mutable std::vector<LyXParagraph::size_type> log2vis_list;
|
||||
|
||||
|
@ -339,7 +339,6 @@ void mathed_write(MathParInset * p, ostream & os, int * newlines,
|
||||
//if it is not there? The reason why I want to avoid this is
|
||||
// because of the "backlook" into the output stream.
|
||||
// Lgb.
|
||||
#warning CHECK
|
||||
#if 0
|
||||
if (!suffixIs(outf, '\n')) {
|
||||
// in batchmode we need to make sure
|
||||
|
@ -4218,7 +4218,7 @@ void LyXParagraph::ChangeLanguage(Language const * from, Language const * to)
|
||||
LyXFont font = GetFontSettings(i);
|
||||
if (font.language() == from) {
|
||||
font.setLanguage(to);
|
||||
SetFont(i,font);
|
||||
SetFont(i, font);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
171
src/screen.C
171
src/screen.C
@ -52,8 +52,9 @@ LyXScreen::LyXScreen(WorkArea & o, LyXText * text_ptr)
|
||||
|
||||
/* the cursor isnt yet visible */
|
||||
cursor_visible = false;
|
||||
#if 0
|
||||
screen_refresh_y = -1;
|
||||
|
||||
#endif
|
||||
cursor_pixmap = 0;
|
||||
cursor_pixmap_x = 0;
|
||||
cursor_pixmap_y = 0;
|
||||
@ -68,7 +69,9 @@ LyXScreen::LyXScreen(WorkArea & o, LyXText * text_ptr)
|
||||
void LyXScreen::Redraw()
|
||||
{
|
||||
DrawFromTo(0, owner.height());
|
||||
#if 0
|
||||
screen_refresh_y = -1;
|
||||
#endif
|
||||
expose(0, 0, owner.workWidth(), owner.height());
|
||||
if (cursor_visible) {
|
||||
cursor_visible = false;
|
||||
@ -117,26 +120,38 @@ void LyXScreen::DrawFromTo(int y1, int y2)
|
||||
}
|
||||
|
||||
|
||||
#if 1
|
||||
void LyXScreen::DrawOneRow(Row * row, long y_text)
|
||||
{
|
||||
long y = y_text - first;
|
||||
|
||||
if (y + row->height > 0 && y - row->height <= long(owner.height())) {
|
||||
/* ok there is something visible */
|
||||
text->GetVisibleRow(y, row, y + first);
|
||||
}
|
||||
}
|
||||
#else
|
||||
void LyXScreen::DrawOneRow(Row * row, long & y_text)
|
||||
{
|
||||
long y = y_text - first;
|
||||
|
||||
if (y + row->height > 0 && y - row->height <= owner.height()) {
|
||||
if (y + row->height > 0 && y - row->height <= long(owner.height())) {
|
||||
/* ok there is something visible */
|
||||
text->GetVisibleRow(y, row, y + first);
|
||||
}
|
||||
y_text += row->height;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* draws the screen, starting with textposition y. uses as much already
|
||||
* printed pixels as possible */
|
||||
void LyXScreen::Draw(long y)
|
||||
void LyXScreen::Draw(unsigned long y)
|
||||
{
|
||||
if (cursor_visible) HideCursor();
|
||||
|
||||
if (y < 0) y = 0;
|
||||
long old_first = first;
|
||||
//if (y < 0) y = 0;
|
||||
unsigned long old_first = first;
|
||||
first = y;
|
||||
|
||||
/* is any optimiziation possible? */
|
||||
@ -203,45 +218,47 @@ void LyXScreen::ShowCursor()
|
||||
}
|
||||
|
||||
|
||||
/* returns 1 if first has changed, otherwise 0 */
|
||||
int LyXScreen::FitManualCursor(long /*x*/, long y, int asc, int desc)
|
||||
/* returns true if first has changed, otherwise false */
|
||||
bool LyXScreen::FitManualCursor(long /*x*/, long y, int asc, int desc)
|
||||
{
|
||||
long newtop = first;
|
||||
long newtop = first;
|
||||
|
||||
if (y + desc - first >= owner.height())
|
||||
if (y + desc - first >= owner.height())
|
||||
newtop = y - 3 * owner.height() / 4; /* the scroll region must be so big!! */
|
||||
else if (y - asc < first
|
||||
&& first > 0) {
|
||||
else if (y - asc < long(first)
|
||||
&& first > 0) {
|
||||
newtop = y - owner.height() / 4;
|
||||
}
|
||||
if (newtop < 0)
|
||||
newtop = 0;
|
||||
//if (newtop < 0)
|
||||
newtop = max(newtop, 0L); // can newtop ever be < 0? (Lgb)
|
||||
|
||||
if (newtop != first){
|
||||
if (newtop != long(first)) {
|
||||
Draw(newtop);
|
||||
first = newtop;
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void LyXScreen::ShowManualCursor(long x, long y, int asc, int desc,
|
||||
void LyXScreen::ShowManualCursor(long x, long y, int asc, int desc,
|
||||
Cursor_Shape shape)
|
||||
{
|
||||
long y1 = max(y - first - asc, 0L);
|
||||
long y2 = min(y - first + desc, long(owner.height()));
|
||||
unsigned long y1 = max(y - first - asc, 0UL);
|
||||
typedef unsigned long ulong;
|
||||
|
||||
unsigned long y2 = min(y - first + desc, ulong(owner.height()));
|
||||
|
||||
// Secure against very strange situations
|
||||
if (y2 < y1) y2 = y1;
|
||||
|
||||
//if (y2 < y1) y2 = y1;
|
||||
y2 = max(y2, y1);
|
||||
|
||||
if (cursor_pixmap){
|
||||
XFreePixmap(fl_display, cursor_pixmap);
|
||||
cursor_pixmap = 0;
|
||||
}
|
||||
|
||||
if (y2 > 0 && y1 <
|
||||
owner.height()) {
|
||||
if (y2 > 0 && y1 < owner.height()) {
|
||||
cursor_pixmap_h = y2 - y1 + 1;
|
||||
cursor_pixmap_y = y1;
|
||||
|
||||
@ -330,7 +347,7 @@ void LyXScreen::CursorToggle()
|
||||
|
||||
|
||||
/* returns a new top so that the cursor is visible */
|
||||
long LyXScreen::TopCursorVisible()
|
||||
unsigned long LyXScreen::TopCursorVisible()
|
||||
{
|
||||
long newtop = first;
|
||||
|
||||
@ -346,31 +363,32 @@ long LyXScreen::TopCursorVisible()
|
||||
else
|
||||
newtop = text->cursor.y
|
||||
- 3 * owner.height() / 4; /* the scroll region must be so big!! */
|
||||
} else if (text->cursor.y - text->cursor.row->baseline < first
|
||||
} else if (text->cursor.y - text->cursor.row->baseline < first
|
||||
&& first > 0) {
|
||||
if (text->cursor.row->height < owner.height()
|
||||
&& text->cursor.row->height > owner.height() / 4)
|
||||
newtop = text->cursor.y - text->cursor.row->baseline;
|
||||
else {
|
||||
newtop = text->cursor.y - owner.height() / 4;
|
||||
if (newtop > first)
|
||||
newtop = first;
|
||||
//if (newtop > long(first))
|
||||
newtop = min(newtop, long(first));
|
||||
}
|
||||
}
|
||||
if (newtop < 0)
|
||||
newtop = 0;
|
||||
|
||||
//if (newtop < 0)
|
||||
// newtop = 0;
|
||||
newtop = max(newtop, 0L);
|
||||
|
||||
return newtop;
|
||||
}
|
||||
|
||||
|
||||
/* scrolls the screen so that the cursor is visible, if necessary.
|
||||
* returns 1 if a change was made, otherwise 0 */
|
||||
int LyXScreen::FitCursor()
|
||||
* returns true if a change was made, otherwise false */
|
||||
bool LyXScreen::FitCursor()
|
||||
{
|
||||
/* is a change necessary */
|
||||
long newtop = TopCursorVisible();
|
||||
int result = (newtop != first);
|
||||
// Is a change necessary?
|
||||
unsigned long newtop = TopCursorVisible();
|
||||
bool result = (newtop != first);
|
||||
if (result)
|
||||
Draw(newtop);
|
||||
return result;
|
||||
@ -379,6 +397,33 @@ int LyXScreen::FitCursor()
|
||||
|
||||
void LyXScreen::Update()
|
||||
{
|
||||
#if 1
|
||||
switch(text->status) {
|
||||
case LyXText::NEED_MORE_REFRESH:
|
||||
{
|
||||
long y = max(text->refresh_y - long(first), 0L);
|
||||
|
||||
DrawFromTo(y, owner.height());
|
||||
text->refresh_y = 0;
|
||||
text->status = LyXText::UNCHANGED;
|
||||
expose(0, y,
|
||||
owner.workWidth(), owner.height() - y);
|
||||
}
|
||||
break;
|
||||
case LyXText::NEED_VERY_LITTLE_REFRESH:
|
||||
{
|
||||
/* ok I will update the current cursor row */
|
||||
DrawOneRow(text->refresh_row, text->refresh_y);
|
||||
text->status = LyXText::UNCHANGED;
|
||||
expose(0, text->refresh_y - first,
|
||||
owner.workWidth(), text->refresh_row->height);
|
||||
}
|
||||
break;
|
||||
case LyXText::UNCHANGED:
|
||||
// Nothing needs done
|
||||
break;
|
||||
}
|
||||
#else
|
||||
if (text->status == LyXText::NEED_MORE_REFRESH
|
||||
|| screen_refresh_y > -1 ) {
|
||||
long y = 0;
|
||||
@ -388,7 +433,8 @@ void LyXScreen::Update()
|
||||
else
|
||||
y = text->refresh_y;
|
||||
|
||||
if (y < first) y = first;
|
||||
//if (y < first) y = first;
|
||||
y = max(y, long(first));
|
||||
|
||||
DrawFromTo(y - first, owner.height());
|
||||
text->refresh_y = 0;
|
||||
@ -404,25 +450,30 @@ void LyXScreen::Update()
|
||||
expose(0, text->refresh_y - first,
|
||||
owner.workWidth(), text->refresh_row->height);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
void LyXScreen::SmallUpdate()
|
||||
{
|
||||
#if 1
|
||||
Update();
|
||||
#else
|
||||
if (text->status == LyXText::NEED_MORE_REFRESH) {
|
||||
/* ok I will update till the current cursor row */
|
||||
Row * row = text->refresh_row;
|
||||
long y = text->refresh_y;
|
||||
long y2 = y;
|
||||
|
||||
if (y > text->cursor.y) {
|
||||
if (y > long(text->cursor.y)) {
|
||||
Update();
|
||||
return;
|
||||
}
|
||||
|
||||
while (row
|
||||
&& row != text->cursor.row
|
||||
&& y < first + owner.height()) {
|
||||
&& y < long(first + owner.height())) {
|
||||
DrawOneRow(row, y);
|
||||
row = row->next;
|
||||
}
|
||||
@ -442,7 +493,9 @@ void LyXScreen::SmallUpdate()
|
||||
expose(0, text->refresh_y - first,
|
||||
owner.workWidth(), text->refresh_row->height);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
void LyXScreen::ToggleSelection(bool kill_selection)
|
||||
@ -450,21 +503,24 @@ void LyXScreen::ToggleSelection(bool kill_selection)
|
||||
/* only if there is a selection */
|
||||
if (!text->selection) return;
|
||||
|
||||
long top = text->sel_start_cursor.y
|
||||
- text->sel_start_cursor.row->baseline;
|
||||
long bottom = text->sel_end_cursor.y
|
||||
- text->sel_end_cursor.row->baseline
|
||||
+ text->sel_end_cursor.row->height;
|
||||
//long top = text->sel_start_cursor.y
|
||||
// - text->sel_start_cursor.row->baseline;
|
||||
//long bottom = text->sel_end_cursor.y
|
||||
// - text->sel_end_cursor.row->baseline
|
||||
// + text->sel_end_cursor.row->height;
|
||||
|
||||
if (top < first)
|
||||
top = max(top, first);
|
||||
if (bottom < first)
|
||||
bottom = max(bottom, first);
|
||||
//top = max(top, first);
|
||||
//bottom = max(bottom, first);
|
||||
|
||||
if (bottom > first + owner.height())
|
||||
bottom = first + owner.height();
|
||||
if (top > first + owner.height())
|
||||
top = first + owner.height();
|
||||
//bottom = min(max(bottom, first), first + owner.height());
|
||||
//top = min(max(top, first), first + owner.height());
|
||||
long bottom = min(max(text->sel_end_cursor.y
|
||||
- text->sel_end_cursor.row->baseline
|
||||
+ text->sel_end_cursor.row->height, first),
|
||||
first + owner.height());
|
||||
long top = min(max(text->sel_start_cursor.y
|
||||
- text->sel_start_cursor.row->baseline, first),
|
||||
first + owner.height());
|
||||
|
||||
if (kill_selection)
|
||||
text->selection = 0;
|
||||
@ -487,15 +543,12 @@ void LyXScreen::ToggleToggle()
|
||||
- text->toggle_end_cursor.row->baseline
|
||||
+ text->toggle_end_cursor.row->height;
|
||||
|
||||
if (top - first < 0)
|
||||
top = first;
|
||||
if (bottom - first < 0)
|
||||
bottom = first;
|
||||
//top = max(top, first);
|
||||
//bottom = max(bottom, first);
|
||||
typedef unsigned long ulong;
|
||||
|
||||
if (bottom - first > owner.height())
|
||||
bottom = first + owner.height();
|
||||
if (top - first > owner.height())
|
||||
top = first + owner.height();
|
||||
bottom = min(max(ulong(bottom), first), first + owner.height());
|
||||
top = min(max(ulong(top), first), first + owner.height());
|
||||
|
||||
DrawFromTo(top - first, bottom - first);
|
||||
expose(0, top - first, owner.workWidth(),
|
||||
|
@ -91,9 +91,7 @@ string MakeLatexName(string const & file)
|
||||
// Substitutes spaces with underscores in filename (and path)
|
||||
string QuoteName(string const & name)
|
||||
{
|
||||
#ifdef WITH_WARNINGS
|
||||
#warning Add proper emx support here!
|
||||
#endif
|
||||
// CHECK Add proper emx support here!
|
||||
#ifndef __EMX__
|
||||
return '\'' + name + '\'';
|
||||
#else
|
||||
@ -305,9 +303,7 @@ string GetEnvPath(string const & name)
|
||||
|
||||
bool PutEnv(string const & envstr)
|
||||
{
|
||||
#ifdef WITH_WARNINGS
|
||||
#warning Look at and fix this.
|
||||
#endif
|
||||
// CHECK Look at and fix this.
|
||||
// f.ex. what about error checking?
|
||||
#if HAVE_PUTENV
|
||||
// this leaks, but what can we do about it?
|
||||
|
@ -95,9 +95,10 @@ void Systemcalls::kill(int /*tolerance*/) {
|
||||
// Here, we should add the PID to a list of
|
||||
// waiting processes to kill if they are not
|
||||
// dead without tolerance seconds
|
||||
#ifdef WITH_WARNINGS
|
||||
#warning Implement this using the timer of the singleton systemcontroller (Asger)
|
||||
#endif
|
||||
|
||||
// CHECK Implement this using the timer of
|
||||
// the singleton systemcontroller (Asger)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
85
src/text.C
85
src/text.C
@ -775,8 +775,8 @@ int LyXText::LeftMargin(Row const * row) const
|
||||
}
|
||||
return x;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int LyXText::RightMargin(Row const * row) const
|
||||
{
|
||||
LyXLayout const & layout =
|
||||
@ -1800,7 +1800,7 @@ void LyXText::OpenFootnote()
|
||||
/* set the dimensions of the cursor row */
|
||||
row->fill = Fill(row, paperwidth);
|
||||
SetHeightOfRow(row);
|
||||
#warning See comment on top of text.C
|
||||
// CHECK See comment on top of text.C
|
||||
tmppar = tmppar->Next();
|
||||
|
||||
while (tmppar != endpar) {
|
||||
@ -2401,7 +2401,7 @@ void LyXText::CheckParagraphInTable(LyXParagraph * par,
|
||||
/* redraw only the row */
|
||||
LyXCursor tmpcursor = cursor;
|
||||
SetCursorIntern(par, pos);
|
||||
#warning See comment on top of text.C
|
||||
//CHECK See comment on top of text.C
|
||||
refresh_y = y;
|
||||
refresh_x = cursor.x;
|
||||
refresh_row = row;
|
||||
@ -2525,9 +2525,7 @@ void LyXText::InsertChar(char c)
|
||||
// The bug is triggered when we type in a description environment:
|
||||
// The current_font is not changed when we go from label to main text
|
||||
// and it should (along with realtmpfont) when we type the space.
|
||||
#ifdef WITH_WARNINGS
|
||||
#warning There is a bug here! (Asger)
|
||||
#endif
|
||||
// CHECK There is a bug here! (Asger)
|
||||
|
||||
LyXFont realtmpfont = real_current_font;
|
||||
LyXFont rawtmpfont = current_font; /* store the current font.
|
||||
@ -2835,7 +2833,7 @@ void LyXText::CursorRightOneWord() const
|
||||
{
|
||||
// treat floats, HFills and Insets as words
|
||||
LyXCursor tmpcursor = cursor;
|
||||
#warning See comment on top of text.C
|
||||
// CHECK See comment on top of text.C
|
||||
|
||||
if (tmpcursor.pos == tmpcursor.par->Last()
|
||||
&& tmpcursor.par->Next())
|
||||
@ -3114,7 +3112,7 @@ void LyXText::DeleteWordForward()
|
||||
|
||||
if (!cursor.par->Last())
|
||||
CursorRight();
|
||||
#warning See comment on top of text.C
|
||||
// CHECK See comment on top of text.C
|
||||
else {
|
||||
/* -------> Skip initial non-word stuff. */
|
||||
while ( cursor.pos < cursor.par->Last()
|
||||
@ -3141,7 +3139,7 @@ void LyXText::DeleteWordBackward()
|
||||
LyXCursor tmpcursor = cursor;
|
||||
if (!cursor.par->Last())
|
||||
CursorLeft();
|
||||
#warning See comment on top of text.C
|
||||
// CHECK See comment on top of text.C
|
||||
else{
|
||||
selection = true; // to avoid deletion
|
||||
CursorLeftOneWord();
|
||||
@ -3159,7 +3157,7 @@ void LyXText::DeleteLineForward()
|
||||
LyXCursor tmpcursor = cursor;
|
||||
if (!cursor.par->Last())
|
||||
CursorRight();
|
||||
#warning See comment on top of text.C
|
||||
// CHECK See comment on top of text.C
|
||||
else {
|
||||
CursorEnd();
|
||||
sel_cursor = cursor;
|
||||
@ -3233,7 +3231,7 @@ void LyXText::Delete()
|
||||
// just move to the right
|
||||
CursorRightIntern();
|
||||
|
||||
#warning Look at the comment here.
|
||||
// CHECK Look at the comment here.
|
||||
// This check is not very good...
|
||||
// The CursorRightIntern calls DeleteEmptyParagrapgMechanism
|
||||
// and that can very well delete the par or par->previous in
|
||||
@ -3593,8 +3591,7 @@ void LyXText::GetVisibleRow(int offset, Row * row_ptr, long y)
|
||||
PrepareToPrint(row_ptr, x, fill_separator,
|
||||
fill_hfill, fill_label_hfill);
|
||||
|
||||
/* initialize the pixmap */
|
||||
|
||||
// clear the area where we want to paint/print
|
||||
pain.fillRectangle(0, offset, paperwidth, row_ptr->height);
|
||||
|
||||
if (selection) {
|
||||
@ -3634,14 +3631,16 @@ void LyXText::GetVisibleRow(int offset, Row * row_ptr, long y)
|
||||
sel_end_cursor.x,
|
||||
row_ptr->height,
|
||||
LColor::selection);
|
||||
} else if (y > sel_start_cursor.y && y < sel_end_cursor.y) {
|
||||
} else if (y > long(sel_start_cursor.y)
|
||||
&& y < long(sel_end_cursor.y)) {
|
||||
pain.fillRectangle(0, offset,
|
||||
paperwidth, row_ptr->height,
|
||||
LColor::selection);
|
||||
}
|
||||
} else if ( sel_start_cursor.row != row_ptr &&
|
||||
sel_end_cursor.row != row_ptr &&
|
||||
y > sel_start_cursor.y && y < sel_end_cursor.y) {
|
||||
y > long(sel_start_cursor.y)
|
||||
&& y < long(sel_end_cursor.y)) {
|
||||
pain.fillRectangle(0, offset,
|
||||
paperwidth, row_ptr->height,
|
||||
LColor::selection);
|
||||
@ -4592,56 +4591,9 @@ void LyXText::InsertFootnoteEnvironment(LyXParagraph::footnote_kind kind)
|
||||
Row * LyXText::GetRow(LyXParagraph * par,
|
||||
LyXParagraph::size_type pos, long & y) const
|
||||
{
|
||||
Row * tmprow;
|
||||
|
||||
if (currentrow) {
|
||||
if (par == currentrow->par
|
||||
|| par == currentrow->par->Previous()) {
|
||||
// do not dereference par, it may have been deleted
|
||||
// already! (Matthias)
|
||||
|
||||
// Walk backwards as long as the previous
|
||||
// rows par is not par
|
||||
while (currentrow->previous
|
||||
&& currentrow->previous->par != par) {
|
||||
currentrow = currentrow->previous;
|
||||
currentrow_y -= currentrow->height;
|
||||
}
|
||||
// Walk backwards as long as the previous
|
||||
// rows par _is_ par
|
||||
while (currentrow->previous
|
||||
&& currentrow->previous->par == par) {
|
||||
currentrow = currentrow->previous;
|
||||
currentrow_y -= currentrow->height;
|
||||
}
|
||||
}
|
||||
|
||||
tmprow = currentrow;
|
||||
y = currentrow_y;
|
||||
// find the first row of the specified paragraph
|
||||
while (tmprow->next
|
||||
&& tmprow->par != par) {
|
||||
y += tmprow->height;
|
||||
tmprow = tmprow->next;
|
||||
}
|
||||
|
||||
if (tmprow->par == par){
|
||||
// now find the wanted row
|
||||
while (tmprow->pos < pos
|
||||
&& tmprow->next
|
||||
&& tmprow->next->par == par
|
||||
&& tmprow->next->pos <= pos) {
|
||||
y += tmprow->height;
|
||||
tmprow = tmprow->next;
|
||||
}
|
||||
currentrow = tmprow;
|
||||
currentrow_y = y;
|
||||
return tmprow;
|
||||
}
|
||||
}
|
||||
|
||||
tmprow = firstrow;
|
||||
Row * tmprow = firstrow;
|
||||
y = 0;
|
||||
|
||||
// find the first row of the specified paragraph
|
||||
while (tmprow->next && tmprow->par != par) {
|
||||
y += tmprow->height;
|
||||
@ -4657,8 +4609,5 @@ Row * LyXText::GetRow(LyXParagraph * par,
|
||||
tmprow = tmprow->next;
|
||||
}
|
||||
|
||||
currentrow = tmprow;
|
||||
currentrow_y = y;
|
||||
|
||||
return tmprow;
|
||||
}
|
||||
|
76
src/text2.C
76
src/text2.C
@ -51,10 +51,7 @@ LyXText::LyXText(BufferView * bv, int pw, Buffer * p)
|
||||
owner_ = bv;
|
||||
firstrow = 0;
|
||||
lastrow = 0;
|
||||
currentrow = 0;
|
||||
currentrow_y = 0;
|
||||
paperwidth = pw;
|
||||
//bparams = &p->params;
|
||||
buffer = p;
|
||||
number_of_rows = 0;
|
||||
refresh_y = 0;
|
||||
@ -87,6 +84,22 @@ LyXText::LyXText(BufferView * bv, int pw, Buffer * p)
|
||||
|
||||
// Default layouttype for copy environment type
|
||||
copylayouttype = 0;
|
||||
|
||||
#if 0
|
||||
// Dump all rowinformation:
|
||||
Row * tmprow = firstrow;
|
||||
lyxerr << "Baseline Paragraph Pos Height Ascent Fill\n";
|
||||
while (tmprow) {
|
||||
lyxerr << tmprow->baseline << '\t'
|
||||
<< tmprow->par << '\t'
|
||||
<< tmprow->pos << '\t'
|
||||
<< tmprow->height << '\t'
|
||||
<< tmprow->ascent_of_text << '\t'
|
||||
<< tmprow->fill << '\n';
|
||||
tmprow = tmprow->next;
|
||||
}
|
||||
lyxerr.flush();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -282,11 +295,6 @@ void LyXText::RemoveRow(Row * row) const
|
||||
row of this row */
|
||||
long unused_y;
|
||||
GetRow(row->par, row->pos, unused_y);
|
||||
currentrow = currentrow->previous;
|
||||
if (currentrow)
|
||||
currentrow_y -= currentrow->height;
|
||||
else
|
||||
currentrow_y = 0;
|
||||
|
||||
if (row->next)
|
||||
row->next->previous = row->previous;
|
||||
@ -910,14 +918,14 @@ void LyXText::RedoParagraphs(LyXCursor const & cur,
|
||||
}
|
||||
|
||||
|
||||
int LyXText::FullRebreak()
|
||||
bool LyXText::FullRebreak()
|
||||
{
|
||||
if (need_break_row) {
|
||||
BreakAgain(need_break_row);
|
||||
need_break_row = 0;
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -1041,38 +1049,21 @@ void LyXText::CursorBottom() const
|
||||
|
||||
/* returns a pointer to the row near the specified y-coordinate
|
||||
* (relative to the whole text). y is set to the real beginning
|
||||
* of this row */
|
||||
* of this row */
|
||||
Row * LyXText::GetRowNearY(long & y) const
|
||||
{
|
||||
Row * tmprow;
|
||||
long tmpy;
|
||||
|
||||
if (currentrow) {
|
||||
tmprow = currentrow;
|
||||
tmpy = currentrow_y;
|
||||
} else {
|
||||
tmprow = firstrow;
|
||||
tmpy = 0;
|
||||
Row * tmprow = firstrow;
|
||||
long tmpy = 0;
|
||||
|
||||
while (tmprow->next && tmpy + tmprow->height <= y) {
|
||||
tmpy += tmprow->height;
|
||||
tmprow = tmprow->next;
|
||||
}
|
||||
|
||||
if (tmpy <= y)
|
||||
while (tmprow->next && tmpy + tmprow->height <= y) {
|
||||
tmpy += tmprow->height;
|
||||
tmprow = tmprow->next;
|
||||
}
|
||||
else
|
||||
while (tmprow->previous && tmpy > y) {
|
||||
tmprow = tmprow->previous;
|
||||
tmpy -= tmprow->height;
|
||||
}
|
||||
|
||||
currentrow = tmprow;
|
||||
currentrow_y = tmpy;
|
||||
|
||||
y = tmpy; // return the real y
|
||||
return tmprow;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void LyXText::ToggleFree(LyXFont const & font, bool toggleall)
|
||||
{
|
||||
@ -2897,8 +2888,8 @@ bool LyXText::GotoNextNote() const
|
||||
void LyXText::CheckParagraph(LyXParagraph * par,
|
||||
LyXParagraph::size_type pos)
|
||||
{
|
||||
|
||||
LyXCursor tmpcursor;
|
||||
LyXCursor tmpcursor;
|
||||
|
||||
|
||||
/* table stuff -- begin*/
|
||||
|
||||
@ -3699,17 +3690,8 @@ bool LyXText::TextHandleUndo(Undo * undo)
|
||||
if (undo->kind == Undo::EDIT) {
|
||||
tmppar2->setContentsFromPar(tmppar);
|
||||
tmppar->clearContents();
|
||||
//tmppar2->text = tmppar->text;
|
||||
//tmppar->text.clear();
|
||||
tmppar2 = tmppar2->next;
|
||||
}
|
||||
if ( currentrow && currentrow->par == tmppar )
|
||||
currentrow = currentrow -> previous;
|
||||
// Commenting out this might remove the error
|
||||
// reported by Purify, but it might also
|
||||
// introduce a memory leak. We need to
|
||||
// check this (Lgb)
|
||||
//delete tmppar;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user