mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-25 22:06:15 +00:00
remove the old painter, remove support for mono_video, reverse_video, fast selection, work in progress to make insetlaex accent better. editable insetcommand drawn as buttons.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@560 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
17818a9141
commit
a0cf758d5a
20
ChangeLog
20
ChangeLog
@ -1,3 +1,23 @@
|
|||||||
|
2000-02-17 Lars Gullik Bjønnes <larsbj@lyx.org>
|
||||||
|
|
||||||
|
* src/Makefile.am: add missing direction.h
|
||||||
|
|
||||||
|
* src/PainterBase.h: made the width functions const.
|
||||||
|
|
||||||
|
* lib/kbd/iso8859-1.cdef: fix a couple of entries and define some
|
||||||
|
missing ones.
|
||||||
|
|
||||||
|
* src/insets/insetcommand.C (draw): draw Editable as buttons.
|
||||||
|
|
||||||
|
* src/insets/insetlatexaccent.C (draw): make the accents draw
|
||||||
|
better, at present this will only work well with iso8859-1.
|
||||||
|
|
||||||
|
* several files: remove the old drawing code, now we use the new
|
||||||
|
painter only.
|
||||||
|
|
||||||
|
* several files: remove support for mono_video, reverse_video and
|
||||||
|
fast selection.
|
||||||
|
|
||||||
2000-02-17 Juergen Vigna <jug@sad.it>
|
2000-02-17 Juergen Vigna <jug@sad.it>
|
||||||
|
|
||||||
* src/mathed/math_cursor.[Ch] (SelGetArea): Changed form int * to
|
* src/mathed/math_cursor.[Ch] (SelGetArea): Changed form int * to
|
||||||
|
@ -6,37 +6,38 @@
|
|||||||
# Any takers to complete the stuff?
|
# Any takers to complete the stuff?
|
||||||
#
|
#
|
||||||
|
|
||||||
161 "!`" # mirrored !
|
160 "\nobreakspace"
|
||||||
#162 Cent sign?
|
161 "\textexclamdown"
|
||||||
|
#162 "\textcent"
|
||||||
163 "\pounds{}" # pound sign
|
163 "\pounds{}" # pound sign
|
||||||
#164 String sign?
|
#164 "\textcurrency"
|
||||||
#165 Yen sign?
|
#165 "\textyen"
|
||||||
#166 What's this?
|
#166 "\textbrokenbar"
|
||||||
167 "\S{}" # paragraph
|
167 "\S{}" # paragraph
|
||||||
168 "\"{}" # umlaut
|
168 "\"{}" # umlaut
|
||||||
169 "\copyright{}"
|
169 "\copyright{}"
|
||||||
170 "\b{a}" # a macron
|
170 "\textordfeminine"
|
||||||
171 "\guillemotleft{}"
|
171 "\guillemotleft{}"
|
||||||
#172 What's this?
|
172 "$\lnot$"
|
||||||
#173 horiz. line?
|
173 "\-{}"
|
||||||
#174 Registered?
|
174 "\textregistered"
|
||||||
#175 horiz. line at the top?
|
175 "\={}"
|
||||||
176 "\b{}" # circle
|
176 "\textdegree" # circle
|
||||||
#177 Plusminus?
|
177 "$\pm$"
|
||||||
#178 ^2?
|
178 "$\mathtwosuperios$"
|
||||||
#179 ^3?
|
179 "$\maththreesuperior$"
|
||||||
180 "\'{}" # acute
|
180 "\'{}" # acute
|
||||||
181 "$\mu$" # micro
|
181 "$\mu$" # micro
|
||||||
#182 Paragraph?
|
182 "\P{}"
|
||||||
183 "$\cdot$"
|
183 "$\cdot$"
|
||||||
184 "\c{}" # cedilla
|
184 "\c{}" # cedilla
|
||||||
185 "${^1}$"
|
185 "$\mathonesuperior$"
|
||||||
186 "\b{o}" # o macron
|
186 "\textordmasculine"
|
||||||
187 "\guillemotright{}"
|
187 "\guillemotright{}"
|
||||||
188 "\ensuremath{\frac14}"
|
188 "\textonequarter"
|
||||||
189 "\ensuremath{\frac12}"
|
189 "\textonehalf"
|
||||||
190 "\ensuremath{\frac34}" # "0BE
|
190 "\textthreequarters" # "0BE
|
||||||
191 "?`" # mirrored ?
|
191 "\textquestiondown" # mirrored ?
|
||||||
192 "\`{A}"
|
192 "\`{A}"
|
||||||
193 "\'{A}"
|
193 "\'{A}"
|
||||||
194 "\^{A}"
|
194 "\^{A}"
|
||||||
|
@ -75,7 +75,6 @@ src/mathed/math_panel.C
|
|||||||
src/menus.C
|
src/menus.C
|
||||||
src/minibuffer.C
|
src/minibuffer.C
|
||||||
src/minibuffer.h
|
src/minibuffer.h
|
||||||
src/newinsets/newinset.h
|
|
||||||
src/Painter.C
|
src/Painter.C
|
||||||
src/PaperLayout.C
|
src/PaperLayout.C
|
||||||
src/paragraph.C
|
src/paragraph.C
|
||||||
|
207
src/BufferView.C
207
src/BufferView.C
@ -47,9 +47,6 @@ using std::for_each;
|
|||||||
#include "lyxrc.h"
|
#include "lyxrc.h"
|
||||||
#include "lyxrow.h"
|
#include "lyxrow.h"
|
||||||
#include "WorkArea.h"
|
#include "WorkArea.h"
|
||||||
#ifndef USE_PAINTER
|
|
||||||
#include "lyxdraw.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
using std::find_if;
|
using std::find_if;
|
||||||
|
|
||||||
@ -94,12 +91,10 @@ BufferView::~BufferView()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_PAINTER
|
|
||||||
Painter & BufferView::painter()
|
Painter & BufferView::painter()
|
||||||
{
|
{
|
||||||
return workarea->getPainter();
|
return workarea->getPainter();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
void BufferView::buffer(Buffer * b)
|
void BufferView::buffer(Buffer * b)
|
||||||
@ -364,7 +359,7 @@ int BufferView::resizeCurrentBuffer()
|
|||||||
updateScrollbar();
|
updateScrollbar();
|
||||||
redraw();
|
redraw();
|
||||||
owner_->getMiniBuffer()->Init();
|
owner_->getMiniBuffer()->Init();
|
||||||
SetState();
|
setState();
|
||||||
AllowInput();
|
AllowInput();
|
||||||
|
|
||||||
// Now if the title form still exist kill it
|
// Now if the title form still exist kill it
|
||||||
@ -409,7 +404,7 @@ void BufferView::gotoError()
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
void C_BufferView_CursorToggleCB(FL_OBJECT * ob, long buf)
|
void C_BufferView_CursorToggleCB(FL_OBJECT * ob, long buf)
|
||||||
{
|
{
|
||||||
BufferView::CursorToggleCB(ob, buf);
|
BufferView::cursorToggleCB(ob, buf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -431,19 +426,19 @@ void BufferView::create_view()
|
|||||||
|
|
||||||
|
|
||||||
// Callback for scrollbar up button
|
// Callback for scrollbar up button
|
||||||
void BufferView::UpCB(long time, int button)
|
void BufferView::upCB(long time, int button)
|
||||||
{
|
{
|
||||||
if (buffer_ == 0) return;
|
if (buffer_ == 0) return;
|
||||||
|
|
||||||
switch (button) {
|
switch (button) {
|
||||||
case 3:
|
case 3:
|
||||||
ScrollUpOnePage();
|
scrollUpOnePage();
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
ScrollDownOnePage();
|
scrollDownOnePage();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ScrollUp(time);
|
scrollUp(time);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -457,7 +452,7 @@ void waitForX()
|
|||||||
|
|
||||||
|
|
||||||
// Callback for scrollbar slider
|
// Callback for scrollbar slider
|
||||||
void BufferView::ScrollCB(double value)
|
void BufferView::scrollCB(double value)
|
||||||
{
|
{
|
||||||
extern bool cursor_follows_scrollbar;
|
extern bool cursor_follows_scrollbar;
|
||||||
|
|
||||||
@ -493,25 +488,25 @@ void BufferView::ScrollCB(double value)
|
|||||||
|
|
||||||
|
|
||||||
// Callback for scrollbar down button
|
// Callback for scrollbar down button
|
||||||
void BufferView::DownCB(long time, int button)
|
void BufferView::downCB(long time, int button)
|
||||||
{
|
{
|
||||||
if (buffer_ == 0) return;
|
if (buffer_ == 0) return;
|
||||||
|
|
||||||
switch (button) {
|
switch (button) {
|
||||||
case 2:
|
case 2:
|
||||||
ScrollUpOnePage();
|
scrollUpOnePage();
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
ScrollDownOnePage();
|
scrollDownOnePage();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ScrollDown(time);
|
scrollDown(time);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int BufferView::ScrollUp(long time)
|
int BufferView::scrollUp(long time)
|
||||||
{
|
{
|
||||||
if (buffer_ == 0) return 0;
|
if (buffer_ == 0) return 0;
|
||||||
if (!screen) return 0;
|
if (!screen) return 0;
|
||||||
@ -534,12 +529,12 @@ int BufferView::ScrollUp(long time)
|
|||||||
|
|
||||||
workarea->setScrollbarValue(value);
|
workarea->setScrollbarValue(value);
|
||||||
|
|
||||||
ScrollCB(value);
|
scrollCB(value);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int BufferView::ScrollDown(long time)
|
int BufferView::scrollDown(long time)
|
||||||
{
|
{
|
||||||
if (buffer_ == 0) return 0;
|
if (buffer_ == 0) return 0;
|
||||||
if (!screen) return 0;
|
if (!screen) return 0;
|
||||||
@ -564,12 +559,12 @@ int BufferView::ScrollDown(long time)
|
|||||||
|
|
||||||
workarea->setScrollbarValue(value);
|
workarea->setScrollbarValue(value);
|
||||||
|
|
||||||
ScrollCB(value);
|
scrollCB(value);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void BufferView::ScrollUpOnePage()
|
void BufferView::scrollUpOnePage()
|
||||||
{
|
{
|
||||||
if (buffer_ == 0) return;
|
if (buffer_ == 0) return;
|
||||||
if (!screen) return;
|
if (!screen) return;
|
||||||
@ -584,11 +579,11 @@ void BufferView::ScrollUpOnePage()
|
|||||||
|
|
||||||
workarea->setScrollbarValue(y);
|
workarea->setScrollbarValue(y);
|
||||||
|
|
||||||
ScrollCB(y);
|
scrollCB(y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void BufferView::ScrollDownOnePage()
|
void BufferView::scrollDownOnePage()
|
||||||
{
|
{
|
||||||
if (buffer_ == 0) return;
|
if (buffer_ == 0) return;
|
||||||
if (!screen) return;
|
if (!screen) return;
|
||||||
@ -603,11 +598,11 @@ void BufferView::ScrollDownOnePage()
|
|||||||
|
|
||||||
workarea->setScrollbarValue(y);
|
workarea->setScrollbarValue(y);
|
||||||
|
|
||||||
ScrollCB(y);
|
scrollCB(y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void BufferView::WorkAreaMotionNotify(int x, int y, unsigned int state)
|
void BufferView::workAreaMotionNotify(int x, int y, unsigned int state)
|
||||||
{
|
{
|
||||||
if (buffer_ == 0 || !screen) return;
|
if (buffer_ == 0 || !screen) return;
|
||||||
|
|
||||||
@ -645,14 +640,11 @@ void BufferView::WorkAreaMotionNotify(int x, int y, unsigned int state)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_PAINTER
|
|
||||||
extern int bibitemMaxWidth(Painter &, LyXFont const &);
|
extern int bibitemMaxWidth(Painter &, LyXFont const &);
|
||||||
#else
|
|
||||||
extern int bibitemMaxWidth(LyXFont const &);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Single-click on work area
|
// Single-click on work area
|
||||||
void BufferView::WorkAreaButtonPress(int xpos, int ypos, unsigned int button)
|
void BufferView::workAreaButtonPress(int xpos, int ypos, unsigned int button)
|
||||||
{
|
{
|
||||||
last_click_x = -1;
|
last_click_x = -1;
|
||||||
last_click_y = -1;
|
last_click_y = -1;
|
||||||
@ -665,10 +657,10 @@ void BufferView::WorkAreaButtonPress(int xpos, int ypos, unsigned int button)
|
|||||||
if (button == 4 || button == 5) {
|
if (button == 4 || button == 5) {
|
||||||
switch (button) {
|
switch (button) {
|
||||||
case 4:
|
case 4:
|
||||||
ScrollUp(100); // This number is only temporary
|
scrollUp(100); // This number is only temporary
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
ScrollDown(100);
|
scrollDown(100);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -786,7 +778,7 @@ void BufferView::WorkAreaButtonPress(int xpos, int ypos, unsigned int button)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void BufferView::WorkAreaButtonRelease(int x, int y, unsigned int button)
|
void BufferView::workAreaButtonRelease(int x, int y, unsigned int button)
|
||||||
{
|
{
|
||||||
if (buffer_ == 0 || screen == 0) return;
|
if (buffer_ == 0 || screen == 0) return;
|
||||||
|
|
||||||
@ -821,7 +813,7 @@ void BufferView::WorkAreaButtonRelease(int x, int y, unsigned int button)
|
|||||||
|
|
||||||
if (button >= 2) return;
|
if (button >= 2) return;
|
||||||
|
|
||||||
SetState();
|
setState();
|
||||||
owner_->getMiniBuffer()->Set(CurrentState());
|
owner_->getMiniBuffer()->Set(CurrentState());
|
||||||
|
|
||||||
// Did we hit an editable inset?
|
// Did we hit an editable inset?
|
||||||
@ -899,7 +891,7 @@ void BufferView::WorkAreaButtonRelease(int x, int y, unsigned int button)
|
|||||||
&& text->cursor.row->previous &&
|
&& text->cursor.row->previous &&
|
||||||
text->cursor.row->previous->par->
|
text->cursor.row->previous->par->
|
||||||
footnoteflag != LyXParagraph::OPEN_FOOTNOTE){
|
footnoteflag != LyXParagraph::OPEN_FOOTNOTE){
|
||||||
LyXFont font (LyXFont::ALL_SANE);
|
LyXFont font(LyXFont::ALL_SANE);
|
||||||
font.setSize(LyXFont::SIZE_FOOTNOTE);
|
font.setSize(LyXFont::SIZE_FOOTNOTE);
|
||||||
|
|
||||||
int box_x = 20; // LYX_PAPER_MARGIN;
|
int box_x = 20; // LYX_PAPER_MARGIN;
|
||||||
@ -920,7 +912,6 @@ void BufferView::WorkAreaButtonRelease(int x, int y, unsigned int button)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Maybe we want to edit a bibitem ale970302
|
// Maybe we want to edit a bibitem ale970302
|
||||||
#ifdef USE_PAINTER
|
|
||||||
if (text->cursor.par->bibkey && x < 20 +
|
if (text->cursor.par->bibkey && x < 20 +
|
||||||
bibitemMaxWidth(painter(),
|
bibitemMaxWidth(painter(),
|
||||||
textclasslist
|
textclasslist
|
||||||
@ -928,14 +919,6 @@ void BufferView::WorkAreaButtonRelease(int x, int y, unsigned int button)
|
|||||||
params.textclass).defaultfont())) {
|
params.textclass).defaultfont())) {
|
||||||
text->cursor.par->bibkey->Edit(0, 0);
|
text->cursor.par->bibkey->Edit(0, 0);
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
if (text->cursor.par->bibkey && x < 20 +
|
|
||||||
bibitemMaxWidth(textclasslist
|
|
||||||
.TextClass(buffer_->
|
|
||||||
params.textclass).defaultfont())) {
|
|
||||||
text->cursor.par->bibkey->Edit(0, 0);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -946,13 +929,12 @@ void BufferView::WorkAreaButtonRelease(int x, int y, unsigned int button)
|
|||||||
* If hit, the coordinates are changed relative to the inset.
|
* If hit, the coordinates are changed relative to the inset.
|
||||||
* Otherwise coordinates are not changed, and false is returned.
|
* Otherwise coordinates are not changed, and false is returned.
|
||||||
*/
|
*/
|
||||||
#ifdef USE_PAINTER
|
|
||||||
Inset * BufferView::checkInsetHit(int & x, int & y)
|
Inset * BufferView::checkInsetHit(int & x, int & y)
|
||||||
{
|
{
|
||||||
if (!getScreen())
|
if (!screen)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
int y_tmp = y + getScreen()->first;
|
int y_tmp = y + screen->first;
|
||||||
|
|
||||||
LyXCursor & cursor = text->cursor;
|
LyXCursor & cursor = text->cursor;
|
||||||
LyXDirection direction = text->real_current_font.getFontDirection();
|
LyXDirection direction = text->real_current_font.getFontDirection();
|
||||||
@ -1013,74 +995,6 @@ Inset * BufferView::checkInsetHit(int & x, int & y)
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
Inset * BufferView::checkInsetHit(int & x, int & y)
|
|
||||||
{
|
|
||||||
if (!getScreen())
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
int y_tmp = y + getScreen()->first;
|
|
||||||
|
|
||||||
LyXCursor & cursor = text->cursor;
|
|
||||||
LyXDirection direction = text->real_current_font.getFontDirection();
|
|
||||||
|
|
||||||
if (cursor.pos < cursor.par->Last()
|
|
||||||
&& cursor.par->GetChar(cursor.pos) == LyXParagraph::META_INSET
|
|
||||||
&& cursor.par->GetInset(cursor.pos)
|
|
||||||
&& cursor.par->GetInset(cursor.pos)->Editable()) {
|
|
||||||
|
|
||||||
// Check whether the inset really was hit
|
|
||||||
Inset * tmpinset = cursor.par->GetInset(cursor.pos);
|
|
||||||
LyXFont font = text->GetFont(cursor.par, cursor.pos);
|
|
||||||
int start_x, end_x;
|
|
||||||
if (direction == LYX_DIR_LEFT_TO_RIGHT) {
|
|
||||||
start_x = cursor.x;
|
|
||||||
end_x = cursor.x + tmpinset->Width(font);
|
|
||||||
} else {
|
|
||||||
start_x = cursor.x - tmpinset->Width(font);
|
|
||||||
end_x = cursor.x;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (x > start_x && x < end_x
|
|
||||||
&& y_tmp > cursor.y - tmpinset->Ascent(font)
|
|
||||||
&& y_tmp < cursor.y + tmpinset->Descent(font)) {
|
|
||||||
x = x - start_x;
|
|
||||||
// The origin of an inset is on the baseline
|
|
||||||
y = y_tmp - (cursor.y);
|
|
||||||
return tmpinset;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cursor.pos - 1 >= 0
|
|
||||||
&& cursor.par->GetChar(cursor.pos - 1) == LyXParagraph::META_INSET
|
|
||||||
&& cursor.par->GetInset(cursor.pos - 1)
|
|
||||||
&& cursor.par->GetInset(cursor.pos - 1)->Editable()) {
|
|
||||||
text->CursorLeft();
|
|
||||||
Inset * tmpinset = cursor.par->GetInset(cursor.pos);
|
|
||||||
LyXFont font = text->GetFont(cursor.par, cursor.pos);
|
|
||||||
int start_x, end_x;
|
|
||||||
if (direction == LYX_DIR_LEFT_TO_RIGHT) {
|
|
||||||
start_x = cursor.x;
|
|
||||||
end_x = cursor.x + tmpinset->Width(font);
|
|
||||||
} else {
|
|
||||||
start_x = cursor.x - tmpinset->Width(font);
|
|
||||||
end_x = cursor.x;
|
|
||||||
}
|
|
||||||
if (x > start_x && x < end_x
|
|
||||||
&& y_tmp > cursor.y - tmpinset->Ascent(font)
|
|
||||||
&& y_tmp < cursor.y + tmpinset->Descent(font)) {
|
|
||||||
x = x - start_x;
|
|
||||||
// The origin of an inset is on the baseline
|
|
||||||
y = y_tmp - (cursor.y);
|
|
||||||
return tmpinset;
|
|
||||||
} else {
|
|
||||||
text->CursorRight();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
void BufferView::workAreaExpose()
|
void BufferView::workAreaExpose()
|
||||||
@ -1141,7 +1055,7 @@ void BufferView::workAreaExpose()
|
|||||||
|
|
||||||
|
|
||||||
// Callback for cursor timer
|
// Callback for cursor timer
|
||||||
void BufferView::CursorToggleCB(FL_OBJECT * ob, long)
|
void BufferView::cursorToggleCB(FL_OBJECT * ob, long)
|
||||||
{
|
{
|
||||||
BufferView * view = static_cast<BufferView*>(ob->u_vdata);
|
BufferView * view = static_cast<BufferView*>(ob->u_vdata);
|
||||||
|
|
||||||
@ -1302,7 +1216,7 @@ string fromClipboard(Window win, XEvent * event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void BufferView::WorkAreaSelectionNotify(Window win, XEvent * event)
|
void BufferView::workAreaSelectionNotify(Window win, XEvent * event)
|
||||||
{
|
{
|
||||||
if (buffer_ == 0) return;
|
if (buffer_ == 0) return;
|
||||||
|
|
||||||
@ -1325,7 +1239,7 @@ void BufferView::cursorPrevious()
|
|||||||
{
|
{
|
||||||
if (!text->cursor.row->previous) return;
|
if (!text->cursor.row->previous) return;
|
||||||
|
|
||||||
long y = getScreen()->first;
|
long y = screen->first;
|
||||||
Row * cursorrow = text->cursor.row;
|
Row * cursorrow = text->cursor.row;
|
||||||
text->SetCursorFromCoordinates(text->cursor.x_fix, y);
|
text->SetCursorFromCoordinates(text->cursor.x_fix, y);
|
||||||
text->FinishUndo();
|
text->FinishUndo();
|
||||||
@ -1334,7 +1248,7 @@ void BufferView::cursorPrevious()
|
|||||||
text->CursorUp();
|
text->CursorUp();
|
||||||
|
|
||||||
if (text->cursor.row->height < workarea->height())
|
if (text->cursor.row->height < workarea->height())
|
||||||
getScreen()->Draw(text->cursor.y
|
screen->Draw(text->cursor.y
|
||||||
- text->cursor.row->baseline
|
- text->cursor.row->baseline
|
||||||
+ text->cursor.row->height
|
+ text->cursor.row->height
|
||||||
- workarea->height() + 1 );
|
- workarea->height() + 1 );
|
||||||
@ -1345,7 +1259,7 @@ void BufferView::cursorNext()
|
|||||||
{
|
{
|
||||||
if (!text->cursor.row->next) return;
|
if (!text->cursor.row->next) return;
|
||||||
|
|
||||||
long y = getScreen()->first;
|
long y = screen->first;
|
||||||
text->GetRowNearY(y);
|
text->GetRowNearY(y);
|
||||||
Row * cursorrow = text->cursor.row;
|
Row * cursorrow = text->cursor.row;
|
||||||
text->SetCursorFromCoordinates(text->cursor.x_fix, y
|
text->SetCursorFromCoordinates(text->cursor.x_fix, y
|
||||||
@ -1356,7 +1270,7 @@ void BufferView::cursorNext()
|
|||||||
text->CursorDown();
|
text->CursorDown();
|
||||||
|
|
||||||
if (text->cursor.row->height < workarea->height())
|
if (text->cursor.row->height < workarea->height())
|
||||||
getScreen()->Draw(text->cursor.y
|
screen->Draw(text->cursor.y
|
||||||
- text->cursor.row->baseline);
|
- text->cursor.row->baseline);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1370,7 +1284,7 @@ bool BufferView::available() const
|
|||||||
|
|
||||||
void BufferView::beforeChange()
|
void BufferView::beforeChange()
|
||||||
{
|
{
|
||||||
getScreen()->ToggleSelection();
|
toggleSelection();
|
||||||
text->ClearSelection();
|
text->ClearSelection();
|
||||||
FreeUpdateTimer();
|
FreeUpdateTimer();
|
||||||
}
|
}
|
||||||
@ -1431,9 +1345,9 @@ void BufferView::update(signed char f)
|
|||||||
|
|
||||||
void BufferView::smallUpdate(signed char f)
|
void BufferView::smallUpdate(signed char f)
|
||||||
{
|
{
|
||||||
getScreen()->SmallUpdate();
|
screen->SmallUpdate();
|
||||||
if (getScreen()->TopCursorVisible()
|
if (screen->TopCursorVisible()
|
||||||
!= getScreen()->first) {
|
!= screen->first) {
|
||||||
update(f);
|
update(f);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1455,7 +1369,7 @@ void BufferView::smallUpdate(signed char f)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void BufferView::SetState()
|
void BufferView::setState()
|
||||||
{
|
{
|
||||||
if (!lyxrc->rtl_support)
|
if (!lyxrc->rtl_support)
|
||||||
return;
|
return;
|
||||||
@ -1517,3 +1431,44 @@ bool BufferView::active() const
|
|||||||
{
|
{
|
||||||
return workarea->active();
|
return workarea->active();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void BufferView::showCursor()
|
||||||
|
{
|
||||||
|
if (screen)
|
||||||
|
screen->ShowCursor();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void BufferView::hideCursor()
|
||||||
|
{
|
||||||
|
if (screen)
|
||||||
|
screen->HideCursor();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void BufferView::toggleSelection(bool b)
|
||||||
|
{
|
||||||
|
if (screen)
|
||||||
|
screen->ToggleSelection(b);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void BufferView::toggleToggle()
|
||||||
|
{
|
||||||
|
if (screen)
|
||||||
|
screen->ToggleToggle();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void BufferView::center()
|
||||||
|
{
|
||||||
|
beforeChange();
|
||||||
|
if (text->cursor.y > workarea->height() / 2) {
|
||||||
|
screen->Draw(text->cursor.y - workarea->height() / 2);
|
||||||
|
} else {
|
||||||
|
screen->Draw(0);
|
||||||
|
}
|
||||||
|
update(0);
|
||||||
|
redraw();
|
||||||
|
}
|
||||||
|
@ -37,12 +37,8 @@ public:
|
|||||||
~BufferView();
|
~BufferView();
|
||||||
///
|
///
|
||||||
Buffer * buffer() const { return buffer_; }
|
Buffer * buffer() const { return buffer_; }
|
||||||
#ifdef USE_PAINTER
|
|
||||||
///
|
///
|
||||||
Painter & painter();
|
Painter & painter();
|
||||||
#endif
|
|
||||||
///
|
|
||||||
WorkArea * getWorkArea() { return workarea; }
|
|
||||||
///
|
///
|
||||||
void buffer(Buffer * b);
|
void buffer(Buffer * b);
|
||||||
///
|
///
|
||||||
@ -76,11 +72,6 @@ public:
|
|||||||
///
|
///
|
||||||
LyXView * owner() const { return owner_; }
|
LyXView * owner() const { return owner_; }
|
||||||
///
|
///
|
||||||
LyXScreen * getScreen() {
|
|
||||||
fl_set_timer(timer_cursor, 0.4);
|
|
||||||
return screen;
|
|
||||||
}
|
|
||||||
///
|
|
||||||
void beforeChange();
|
void beforeChange();
|
||||||
///
|
///
|
||||||
void savePosition();
|
void savePosition();
|
||||||
@ -174,13 +165,24 @@ public:
|
|||||||
///
|
///
|
||||||
void showLockedInsetCursor(long x, long y, int asc, int desc);
|
void showLockedInsetCursor(long x, long y, int asc, int desc);
|
||||||
///
|
///
|
||||||
void hideLockedInsetCursor(long x, long y, int asc, int desc);
|
void hideLockedInsetCursor();
|
||||||
///
|
///
|
||||||
void fitLockedInsetCursor(long x, long y, int asc, int desc);
|
void fitLockedInsetCursor(long x, long y, int asc, int desc);
|
||||||
///
|
///
|
||||||
int unlockInset(UpdatableInset * inset);
|
int unlockInset(UpdatableInset * inset);
|
||||||
///
|
///
|
||||||
void lockedInsetStoreUndo(Undo::undo_kind kind);
|
void lockedInsetStoreUndo(Undo::undo_kind kind);
|
||||||
|
///
|
||||||
|
void showCursor();
|
||||||
|
///
|
||||||
|
void hideCursor();
|
||||||
|
///
|
||||||
|
void toggleSelection(bool = true);
|
||||||
|
///
|
||||||
|
void toggleToggle();
|
||||||
|
///
|
||||||
|
void center();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class WorkArea;
|
friend class WorkArea;
|
||||||
|
|
||||||
@ -189,17 +191,17 @@ private:
|
|||||||
///
|
///
|
||||||
void workAreaExpose();
|
void workAreaExpose();
|
||||||
///
|
///
|
||||||
void ScrollUpOnePage();
|
void scrollUpOnePage();
|
||||||
///
|
///
|
||||||
void ScrollDownOnePage();
|
void scrollDownOnePage();
|
||||||
///
|
///
|
||||||
void create_view();
|
void create_view();
|
||||||
///
|
///
|
||||||
Inset * checkInsetHit(int & x, int & y);
|
Inset * checkInsetHit(int & x, int & y);
|
||||||
///
|
///
|
||||||
int ScrollUp(long time);
|
int scrollUp(long time);
|
||||||
///
|
///
|
||||||
int ScrollDown(long time);
|
int scrollDown(long time);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
///
|
///
|
||||||
@ -209,33 +211,27 @@ public:
|
|||||||
///
|
///
|
||||||
bool active() const;
|
bool active() const;
|
||||||
/// A callback for the up arrow in the scrollbar.
|
/// A callback for the up arrow in the scrollbar.
|
||||||
void UpCB(long time, int button);
|
void upCB(long time, int button);
|
||||||
/// A callback for the slider in the scrollbar.
|
/// A callback for the slider in the scrollbar.
|
||||||
void ScrollCB(double);
|
void scrollCB(double);
|
||||||
/// A callback for the down arrow in the scrollbar.
|
/// A callback for the down arrow in the scrollbar.
|
||||||
void DownCB(long time, int button);
|
void downCB(long time, int button);
|
||||||
|
|
||||||
///
|
///
|
||||||
static void CursorToggleCB(FL_OBJECT * ob, long);
|
static void cursorToggleCB(FL_OBJECT * ob, long);
|
||||||
#if 0
|
|
||||||
/** Work area free object handler
|
|
||||||
*/
|
|
||||||
static int work_area_handler(FL_OBJECT *, int event,
|
|
||||||
FL_Coord, FL_Coord, int key, void *xev);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
///
|
///
|
||||||
void SetState();
|
void setState();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
///
|
///
|
||||||
void WorkAreaMotionNotify(int x, int y, unsigned int state);
|
void workAreaMotionNotify(int x, int y, unsigned int state);
|
||||||
///
|
///
|
||||||
void WorkAreaButtonPress(int x, int y, unsigned int button);
|
void workAreaButtonPress(int x, int y, unsigned int button);
|
||||||
///
|
///
|
||||||
void WorkAreaButtonRelease(int x, int y, unsigned int button);
|
void workAreaButtonRelease(int x, int y, unsigned int button);
|
||||||
///
|
///
|
||||||
void WorkAreaSelectionNotify(Window win, XEvent * event);
|
void workAreaSelectionNotify(Window win, XEvent * event);
|
||||||
///
|
///
|
||||||
LyXView * owner_;
|
LyXView * owner_;
|
||||||
///
|
///
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
#include "minibuffer.h"
|
#include "minibuffer.h"
|
||||||
#include "bufferlist.h"
|
#include "bufferlist.h"
|
||||||
#include "support/FileInfo.h"
|
#include "support/FileInfo.h"
|
||||||
|
#include "lyxscreen.h"
|
||||||
|
|
||||||
extern BufferList bufferlist;
|
extern BufferList bufferlist;
|
||||||
|
|
||||||
@ -367,12 +368,12 @@ void BufferView::openStuff()
|
|||||||
{
|
{
|
||||||
if (available()) {
|
if (available()) {
|
||||||
owner()->getMiniBuffer()->Set(_("Open/Close..."));
|
owner()->getMiniBuffer()->Set(_("Open/Close..."));
|
||||||
getScreen()->HideCursor();
|
hideCursor();
|
||||||
beforeChange();
|
beforeChange();
|
||||||
update(-2);
|
update(-2);
|
||||||
text->OpenStuff();
|
text->OpenStuff();
|
||||||
update(0);
|
update(0);
|
||||||
SetState();
|
setState();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -381,12 +382,12 @@ void BufferView::toggleFloat()
|
|||||||
{
|
{
|
||||||
if (available()) {
|
if (available()) {
|
||||||
owner()->getMiniBuffer()->Set(_("Open/Close..."));
|
owner()->getMiniBuffer()->Set(_("Open/Close..."));
|
||||||
getScreen()->HideCursor();
|
hideCursor();
|
||||||
beforeChange();
|
beforeChange();
|
||||||
update(-2);
|
update(-2);
|
||||||
text->ToggleFootnote();
|
text->ToggleFootnote();
|
||||||
update(0);
|
update(0);
|
||||||
SetState();
|
setState();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -394,14 +395,14 @@ void BufferView::menuUndo()
|
|||||||
{
|
{
|
||||||
if (available()) {
|
if (available()) {
|
||||||
owner()->getMiniBuffer()->Set(_("Undo"));
|
owner()->getMiniBuffer()->Set(_("Undo"));
|
||||||
getScreen()->HideCursor();
|
hideCursor();
|
||||||
beforeChange();
|
beforeChange();
|
||||||
update(-2);
|
update(-2);
|
||||||
if (!text->TextUndo())
|
if (!text->TextUndo())
|
||||||
owner()->getMiniBuffer()->Set(_("No further undo information"));
|
owner()->getMiniBuffer()->Set(_("No further undo information"));
|
||||||
else
|
else
|
||||||
update(-1);
|
update(-1);
|
||||||
SetState();
|
setState();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -415,14 +416,14 @@ void BufferView::menuRedo()
|
|||||||
|
|
||||||
if (available()) {
|
if (available()) {
|
||||||
owner()->getMiniBuffer()->Set(_("Redo"));
|
owner()->getMiniBuffer()->Set(_("Redo"));
|
||||||
getScreen()->HideCursor();
|
hideCursor();
|
||||||
beforeChange();
|
beforeChange();
|
||||||
update(-2);
|
update(-2);
|
||||||
if (!text->TextRedo())
|
if (!text->TextRedo())
|
||||||
owner()->getMiniBuffer()->Set(_("No further redo information"));
|
owner()->getMiniBuffer()->Set(_("No further redo information"));
|
||||||
else
|
else
|
||||||
update(-1);
|
update(-1);
|
||||||
SetState();
|
setState();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -430,7 +431,7 @@ void BufferView::menuRedo()
|
|||||||
void BufferView::hyphenationPoint()
|
void BufferView::hyphenationPoint()
|
||||||
{
|
{
|
||||||
if (available()) {
|
if (available()) {
|
||||||
getScreen()->HideCursor();
|
hideCursor();
|
||||||
update(-2);
|
update(-2);
|
||||||
InsetSpecialChar * new_inset =
|
InsetSpecialChar * new_inset =
|
||||||
new InsetSpecialChar(InsetSpecialChar::HYPHENATION);
|
new InsetSpecialChar(InsetSpecialChar::HYPHENATION);
|
||||||
@ -442,7 +443,7 @@ void BufferView::hyphenationPoint()
|
|||||||
void BufferView::ldots()
|
void BufferView::ldots()
|
||||||
{
|
{
|
||||||
if (available()) {
|
if (available()) {
|
||||||
getScreen()->HideCursor();
|
hideCursor();
|
||||||
update(-2);
|
update(-2);
|
||||||
InsetSpecialChar * new_inset =
|
InsetSpecialChar * new_inset =
|
||||||
new InsetSpecialChar(InsetSpecialChar::LDOTS);
|
new InsetSpecialChar(InsetSpecialChar::LDOTS);
|
||||||
@ -454,7 +455,7 @@ void BufferView::ldots()
|
|||||||
void BufferView::endOfSentenceDot()
|
void BufferView::endOfSentenceDot()
|
||||||
{
|
{
|
||||||
if (available()) {
|
if (available()) {
|
||||||
getScreen()->HideCursor();
|
hideCursor();
|
||||||
update(-2);
|
update(-2);
|
||||||
InsetSpecialChar * new_inset =
|
InsetSpecialChar * new_inset =
|
||||||
new InsetSpecialChar(InsetSpecialChar::END_OF_SENTENCE);
|
new InsetSpecialChar(InsetSpecialChar::END_OF_SENTENCE);
|
||||||
@ -466,7 +467,7 @@ void BufferView::endOfSentenceDot()
|
|||||||
void BufferView::menuSeparator()
|
void BufferView::menuSeparator()
|
||||||
{
|
{
|
||||||
if (available()) {
|
if (available()) {
|
||||||
getScreen()->HideCursor();
|
hideCursor();
|
||||||
update(-2);
|
update(-2);
|
||||||
InsetSpecialChar * new_inset =
|
InsetSpecialChar * new_inset =
|
||||||
new InsetSpecialChar(InsetSpecialChar::MENU_SEPARATOR);
|
new InsetSpecialChar(InsetSpecialChar::MENU_SEPARATOR);
|
||||||
@ -478,7 +479,7 @@ void BufferView::menuSeparator()
|
|||||||
void BufferView::newline()
|
void BufferView::newline()
|
||||||
{
|
{
|
||||||
if (available()) {
|
if (available()) {
|
||||||
getScreen()->HideCursor();
|
hideCursor();
|
||||||
update(-2);
|
update(-2);
|
||||||
text->InsertChar(LyXParagraph::META_NEWLINE);
|
text->InsertChar(LyXParagraph::META_NEWLINE);
|
||||||
update(-1);
|
update(-1);
|
||||||
@ -489,7 +490,7 @@ void BufferView::newline()
|
|||||||
void BufferView::protectedBlank()
|
void BufferView::protectedBlank()
|
||||||
{
|
{
|
||||||
if (available()) {
|
if (available()) {
|
||||||
getScreen()->HideCursor();
|
hideCursor();
|
||||||
update(-2);
|
update(-2);
|
||||||
text->InsertChar(LyXParagraph::META_PROTECTED_SEPARATOR);
|
text->InsertChar(LyXParagraph::META_PROTECTED_SEPARATOR);
|
||||||
update(-1);
|
update(-1);
|
||||||
@ -500,7 +501,7 @@ void BufferView::protectedBlank()
|
|||||||
void BufferView::hfill()
|
void BufferView::hfill()
|
||||||
{
|
{
|
||||||
if (available()) {
|
if (available()) {
|
||||||
getScreen()->HideCursor();
|
hideCursor();
|
||||||
update(-2);
|
update(-2);
|
||||||
text->InsertChar(LyXParagraph::META_HFILL);
|
text->InsertChar(LyXParagraph::META_HFILL);
|
||||||
update(-1);
|
update(-1);
|
||||||
@ -512,7 +513,7 @@ void BufferView::copyEnvironment()
|
|||||||
if (available()) {
|
if (available()) {
|
||||||
text->copyEnvironmentType();
|
text->copyEnvironmentType();
|
||||||
// clear the selection, even if mark_set
|
// clear the selection, even if mark_set
|
||||||
getScreen()->ToggleSelection();
|
toggleSelection();
|
||||||
text->ClearSelection();
|
text->ClearSelection();
|
||||||
update(-2);
|
update(-2);
|
||||||
owner()->getMiniBuffer()->Set(_("Paragraph environment type copied"));
|
owner()->getMiniBuffer()->Set(_("Paragraph environment type copied"));
|
||||||
@ -535,7 +536,7 @@ void BufferView::copy()
|
|||||||
if (available()) {
|
if (available()) {
|
||||||
text->CopySelection();
|
text->CopySelection();
|
||||||
// clear the selection, even if mark_set
|
// clear the selection, even if mark_set
|
||||||
getScreen()->ToggleSelection();
|
toggleSelection();
|
||||||
text->ClearSelection();
|
text->ClearSelection();
|
||||||
update(-2);
|
update(-2);
|
||||||
owner()->getMiniBuffer()->Set(_("Copy"));
|
owner()->getMiniBuffer()->Set(_("Copy"));
|
||||||
@ -545,7 +546,7 @@ void BufferView::copy()
|
|||||||
void BufferView::cut()
|
void BufferView::cut()
|
||||||
{
|
{
|
||||||
if (available()) {
|
if (available()) {
|
||||||
getScreen()->HideCursor();
|
hideCursor();
|
||||||
update(-2);
|
update(-2);
|
||||||
text->CutSelection();
|
text->CutSelection();
|
||||||
update(1);
|
update(1);
|
||||||
@ -559,9 +560,9 @@ void BufferView::paste()
|
|||||||
if (!available()) return;
|
if (!available()) return;
|
||||||
|
|
||||||
owner()->getMiniBuffer()->Set(_("Paste"));
|
owner()->getMiniBuffer()->Set(_("Paste"));
|
||||||
getScreen()->HideCursor();
|
hideCursor();
|
||||||
// clear the selection
|
// clear the selection
|
||||||
getScreen()->ToggleSelection();
|
toggleSelection();
|
||||||
text->ClearSelection();
|
text->ClearSelection();
|
||||||
update(-2);
|
update(-2);
|
||||||
|
|
||||||
@ -570,7 +571,7 @@ void BufferView::paste()
|
|||||||
update(1);
|
update(1);
|
||||||
|
|
||||||
// clear the selection
|
// clear the selection
|
||||||
getScreen()->ToggleSelection();
|
toggleSelection();
|
||||||
text->ClearSelection();
|
text->ClearSelection();
|
||||||
update(-2);
|
update(-2);
|
||||||
}
|
}
|
||||||
@ -578,9 +579,9 @@ void BufferView::paste()
|
|||||||
|
|
||||||
void BufferView::gotoNote()
|
void BufferView::gotoNote()
|
||||||
{
|
{
|
||||||
if (!getScreen()) return;
|
if (!available()) return;
|
||||||
|
|
||||||
getScreen()->HideCursor();
|
hideCursor();
|
||||||
beforeChange();
|
beforeChange();
|
||||||
update(-2);
|
update(-2);
|
||||||
LyXCursor tmp;
|
LyXCursor tmp;
|
||||||
@ -637,10 +638,10 @@ void BufferView::selectLastWord()
|
|||||||
{
|
{
|
||||||
if (!available()) return;
|
if (!available()) return;
|
||||||
|
|
||||||
getScreen()->HideCursor();
|
hideCursor();
|
||||||
beforeChange();
|
beforeChange();
|
||||||
text->SelectSelectedWord();
|
text->SelectSelectedWord();
|
||||||
getScreen()->ToggleSelection(false);
|
toggleSelection(false);
|
||||||
update(0);
|
update(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -649,25 +650,27 @@ void BufferView::endOfSpellCheck()
|
|||||||
{
|
{
|
||||||
if (!available()) return;
|
if (!available()) return;
|
||||||
|
|
||||||
getScreen()->HideCursor();
|
hideCursor();
|
||||||
beforeChange();
|
beforeChange();
|
||||||
text->SelectSelectedWord();
|
text->SelectSelectedWord();
|
||||||
text->ClearSelection();
|
text->ClearSelection();
|
||||||
update(0);
|
update(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void BufferView::replaceWord(string const & replacestring)
|
void BufferView::replaceWord(string const & replacestring)
|
||||||
{
|
{
|
||||||
if (!getScreen()) return;
|
if (!available()) return;
|
||||||
|
|
||||||
getScreen()->HideCursor();
|
hideCursor();
|
||||||
update(-2);
|
update(-2);
|
||||||
|
|
||||||
/* clear the selection (if there is any) */
|
/* clear the selection (if there is any) */
|
||||||
getScreen()->ToggleSelection(false);
|
toggleSelection(false);
|
||||||
update(-2);
|
update(-2);
|
||||||
|
|
||||||
/* clear the selection (if there is any) */
|
/* clear the selection (if there is any) */
|
||||||
getScreen()->ToggleSelection(false);
|
toggleSelection(false);
|
||||||
text->ReplaceSelectionWithString(replacestring.c_str());
|
text->ReplaceSelectionWithString(replacestring.c_str());
|
||||||
|
|
||||||
text->SetSelectionOverString(replacestring.c_str());
|
text->SetSelectionOverString(replacestring.c_str());
|
||||||
@ -695,29 +698,27 @@ int BufferView::lockInset(UpdatableInset * inset)
|
|||||||
|
|
||||||
void BufferView::showLockedInsetCursor(long x, long y, int asc, int desc)
|
void BufferView::showLockedInsetCursor(long x, long y, int asc, int desc)
|
||||||
{
|
{
|
||||||
if (the_locking_inset && getScreen()) {
|
if (the_locking_inset && available()) {
|
||||||
y += text->cursor.y;
|
y += text->cursor.y;
|
||||||
getScreen()->ShowManualCursor(x, y,
|
screen->ShowManualCursor(x, y,
|
||||||
asc, desc);
|
asc, desc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void BufferView::hideLockedInsetCursor(long x, long y, int asc, int desc)
|
void BufferView::hideLockedInsetCursor()
|
||||||
{
|
{
|
||||||
if (the_locking_inset && getScreen()) {
|
if (the_locking_inset && available()) {
|
||||||
y += text->cursor.y;
|
screen->HideManualCursor();
|
||||||
getScreen()->HideManualCursor(x, y,
|
|
||||||
asc, desc);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void BufferView::fitLockedInsetCursor(long x, long y, int asc, int desc)
|
void BufferView::fitLockedInsetCursor(long x, long y, int asc, int desc)
|
||||||
{
|
{
|
||||||
if (the_locking_inset && getScreen()){
|
if (the_locking_inset && available()){
|
||||||
y += text->cursor.y;
|
y += text->cursor.y;
|
||||||
if (getScreen()->FitManualCursor(x, y, asc, desc))
|
if (screen->FitManualCursor(x, y, asc, desc))
|
||||||
updateScrollbar();
|
updateScrollbar();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -227,8 +227,7 @@ XFontStruct * FontLoader::doLoad(LyXFont::FONT_FAMILY family,
|
|||||||
lyxerr << "Could not get font. Using 'fixed'." << endl;
|
lyxerr << "Could not get font. Using 'fixed'." << endl;
|
||||||
fs = XLoadQueryFont(fl_display, "fixed");
|
fs = XLoadQueryFont(fl_display, "fixed");
|
||||||
}
|
}
|
||||||
} else {
|
} else if (lyxerr.debugging(Debug::FONT)) {
|
||||||
if (lyxerr.debugging(Debug::FONT)) {
|
|
||||||
// Tell user the font matching
|
// Tell user the font matching
|
||||||
LyXFont f;
|
LyXFont f;
|
||||||
f.setFamily(family);
|
f.setFamily(family);
|
||||||
@ -240,15 +239,11 @@ XFontStruct * FontLoader::doLoad(LyXFont::FONT_FAMILY family,
|
|||||||
f.setUnderbar(LyXFont::INHERIT);
|
f.setUnderbar(LyXFont::INHERIT);
|
||||||
f.setNoun(LyXFont::INHERIT);
|
f.setNoun(LyXFont::INHERIT);
|
||||||
f.setLatex(LyXFont::INHERIT);
|
f.setLatex(LyXFont::INHERIT);
|
||||||
#ifdef USE_PAINTER
|
|
||||||
f.setColor(LColor::inherit);
|
f.setColor(LColor::inherit);
|
||||||
#else
|
|
||||||
f.setColor(LyXFont::INHERIT_COLOR);
|
|
||||||
#endif
|
|
||||||
lyxerr << "Font '" << f.stateText()
|
lyxerr << "Font '" << f.stateText()
|
||||||
<< "' matched by\n" << font << endl;
|
<< "' matched by\n" << font << endl;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
current_view->owner()->getMiniBuffer()->Reset();
|
current_view->owner()->getMiniBuffer()->Reset();
|
||||||
|
|
||||||
fontstruct[family][series][shape][size] = fs;
|
fontstruct[family][series][shape][size] = fs;
|
||||||
|
@ -16,8 +16,6 @@
|
|||||||
#pragma interface
|
#pragma interface
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define USE_PAINTER 1
|
|
||||||
|
|
||||||
|
|
||||||
#include FORMS_H_LOCATION
|
#include FORMS_H_LOCATION
|
||||||
#include "lyxfont.h"
|
#include "lyxfont.h"
|
||||||
|
@ -29,7 +29,6 @@
|
|||||||
#include "layout_forms.h"
|
#include "layout_forms.h"
|
||||||
#include "intl.h"
|
#include "intl.h"
|
||||||
#include "lyxrc.h"
|
#include "lyxrc.h"
|
||||||
#include "lyxscreen.h"
|
|
||||||
#include "support/filetools.h" // OnlyFilename()
|
#include "support/filetools.h" // OnlyFilename()
|
||||||
#include "layout.h"
|
#include "layout.h"
|
||||||
#include "lyxtext.h"
|
#include "lyxtext.h"
|
||||||
@ -81,10 +80,10 @@ void LyXView::UpdateTimerCB(FL_OBJECT * ob, long)
|
|||||||
LyXView * view = static_cast<LyXView*>(ob->u_vdata);
|
LyXView * view = static_cast<LyXView*>(ob->u_vdata);
|
||||||
if (!view->view()->available())
|
if (!view->view()->available())
|
||||||
return;
|
return;
|
||||||
if (!view->view()->getScreen() || !updatetimer)
|
if (!updatetimer)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
view->view()->getScreen()->HideCursor();
|
view->view()->hideCursor();
|
||||||
view->view()->update(-2);
|
view->view()->update(-2);
|
||||||
|
|
||||||
/* This update can happen, even when the work area has lost
|
/* This update can happen, even when the work area has lost
|
||||||
|
@ -82,6 +82,7 @@ lyx_SOURCES = \
|
|||||||
credits_form.h \
|
credits_form.h \
|
||||||
debug.C \
|
debug.C \
|
||||||
debug.h \
|
debug.h \
|
||||||
|
direction.h \
|
||||||
figure.h \
|
figure.h \
|
||||||
filedlg.C \
|
filedlg.C \
|
||||||
filedlg.h \
|
filedlg.h \
|
||||||
|
@ -8,8 +8,6 @@
|
|||||||
*
|
*
|
||||||
* ======================================================*/
|
* ======================================================*/
|
||||||
|
|
||||||
#define USE_PAINTER 1
|
|
||||||
|
|
||||||
#ifndef PAINTER_H
|
#ifndef PAINTER_H
|
||||||
#define PAINTER_H
|
#define PAINTER_H
|
||||||
|
|
||||||
|
@ -22,31 +22,31 @@ int PainterBase::dummy1 = 0;
|
|||||||
int PainterBase::dummy2 = 0;
|
int PainterBase::dummy2 = 0;
|
||||||
int PainterBase::dummy3 = 0;
|
int PainterBase::dummy3 = 0;
|
||||||
|
|
||||||
int PainterBase::paperMargin()
|
int PainterBase::paperMargin() const
|
||||||
{
|
{
|
||||||
return 20;
|
return 20;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int PainterBase::paperWidth()
|
int PainterBase::paperWidth() const
|
||||||
{
|
{
|
||||||
return owner.workWidth();
|
return owner.workWidth();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int PainterBase::width(string const & s, LyXFont const & f)
|
int PainterBase::width(string const & s, LyXFont const & f) const
|
||||||
{
|
{
|
||||||
return f.stringWidth(s);
|
return f.stringWidth(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int PainterBase::width(char const * s, int l, LyXFont const & f)
|
int PainterBase::width(char const * s, int l, LyXFont const & f) const
|
||||||
{
|
{
|
||||||
return f.textWidth(s, l);
|
return f.textWidth(s, l);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int PainterBase::width(char c, LyXFont const & f)
|
int PainterBase::width(char c, LyXFont const & f) const
|
||||||
{
|
{
|
||||||
return f.width(c);
|
return f.width(c);
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
class WorkArea;
|
class WorkArea;
|
||||||
class LyXFont;
|
class LyXFont;
|
||||||
class LyXScreen;
|
//class LyXScreen;
|
||||||
|
|
||||||
/** A painter class to encapsulate all graphics parameters and operations
|
/** A painter class to encapsulate all graphics parameters and operations
|
||||||
|
|
||||||
@ -64,9 +64,9 @@ public:
|
|||||||
|
|
||||||
/** Screen geometry */
|
/** Screen geometry */
|
||||||
///
|
///
|
||||||
int paperMargin();
|
int paperMargin() const;
|
||||||
///
|
///
|
||||||
int paperWidth();
|
int paperWidth() const;
|
||||||
|
|
||||||
/**@Basic drawing routines */
|
/**@Basic drawing routines */
|
||||||
/// Draw a line from point to point
|
/// Draw a line from point to point
|
||||||
@ -163,14 +163,14 @@ public:
|
|||||||
virtual PainterBase & text(int x, int y, char c, LyXFont const & f)=0;
|
virtual PainterBase & text(int x, int y, char c, LyXFont const & f)=0;
|
||||||
|
|
||||||
/// Get the width of text
|
/// Get the width of text
|
||||||
int width(string const & s, LyXFont const & f);
|
int width(string const & s, LyXFont const & f) const;
|
||||||
|
|
||||||
/** Get the width of text
|
/** Get the width of text
|
||||||
This is just for fast width */
|
This is just for fast width */
|
||||||
int width(char const * s, int l, LyXFont const & f);
|
int width(char const * s, int l, LyXFont const & f) const;
|
||||||
|
|
||||||
/// Get the width of text
|
/// Get the width of text
|
||||||
int width(char c, LyXFont const & f);
|
int width(char c, LyXFont const & f) const;
|
||||||
|
|
||||||
/** Draws a string and encloses it inside a rectangle. Returns
|
/** Draws a string and encloses it inside a rectangle. Returns
|
||||||
the size of the rectangle. If draw is false, we only calculate
|
the size of the rectangle. If draw is false, we only calculate
|
||||||
@ -192,9 +192,6 @@ public:
|
|||||||
int & width = PainterBase::dummy1,
|
int & width = PainterBase::dummy1,
|
||||||
int & ascent = PainterBase::dummy2,
|
int & ascent = PainterBase::dummy2,
|
||||||
int & descent = PainterBase::dummy3);
|
int & descent = PainterBase::dummy3);
|
||||||
/// This is preliminary
|
|
||||||
//BufferView const * getOwner() const { return &owner; }
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
WorkArea & owner;
|
WorkArea & owner;
|
||||||
};
|
};
|
||||||
|
@ -70,10 +70,11 @@ inline void EnableParagraphExtra ()
|
|||||||
fl_activate_object(fd_form_paragraph_extra->radio_pextra_startmp);
|
fl_activate_object(fd_form_paragraph_extra->radio_pextra_startmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool UpdateParagraphExtra()
|
bool UpdateParagraphExtra()
|
||||||
{
|
{
|
||||||
bool update = false;
|
bool update = false;
|
||||||
if (current_view->getScreen() && current_view->available()) {
|
if (current_view->available()) {
|
||||||
update = true;
|
update = true;
|
||||||
LyXParagraph * par = current_view->text->cursor.par;
|
LyXParagraph * par = current_view->text->cursor.par;
|
||||||
|
|
||||||
@ -166,7 +167,7 @@ void ParagraphExtraOpen(FL_OBJECT *, long)
|
|||||||
|
|
||||||
void ParagraphExtraApplyCB(FL_OBJECT *, long)
|
void ParagraphExtraApplyCB(FL_OBJECT *, long)
|
||||||
{
|
{
|
||||||
if (current_view->getScreen() && current_view->available()) {
|
if (current_view->available()) {
|
||||||
FD_form_paragraph_extra const * fd = fd_form_paragraph_extra;
|
FD_form_paragraph_extra const * fd = fd_form_paragraph_extra;
|
||||||
char const * width = fl_get_input(fd->input_pextra_width);
|
char const * width = fl_get_input(fd->input_pextra_width);
|
||||||
char const * widthp = fl_get_input(fd->input_pextra_widthp);
|
char const * widthp = fl_get_input(fd->input_pextra_widthp);
|
||||||
|
@ -12,7 +12,6 @@
|
|||||||
#include "vspace.h"
|
#include "vspace.h"
|
||||||
#include "lyx_gui_misc.h"
|
#include "lyx_gui_misc.h"
|
||||||
#include "BufferView.h"
|
#include "BufferView.h"
|
||||||
#include "lyxscreen.h"
|
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
#include "lyxtext.h"
|
#include "lyxtext.h"
|
||||||
#include "layout.h"
|
#include "layout.h"
|
||||||
@ -40,7 +39,7 @@ static int extra_multicol_cursor_x;
|
|||||||
bool UpdateLayoutTable(int flag)
|
bool UpdateLayoutTable(int flag)
|
||||||
{
|
{
|
||||||
bool update = true;
|
bool update = true;
|
||||||
if (!current_view->getScreen() || !current_view->available())
|
if (!current_view->available())
|
||||||
update = false;
|
update = false;
|
||||||
|
|
||||||
if (update && current_view->text->cursor.par->table) {
|
if (update && current_view->text->cursor.par->table) {
|
||||||
@ -420,7 +419,7 @@ void TableOptionsCB(FL_OBJECT * ob, long)
|
|||||||
} else
|
} else
|
||||||
return;
|
return;
|
||||||
if (current_view->available()) {
|
if (current_view->available()) {
|
||||||
current_view->getScreen()->HideCursor();
|
current_view->hideCursor();
|
||||||
if (!current_view->text->selection){
|
if (!current_view->text->selection){
|
||||||
current_view->beforeChange();
|
current_view->beforeChange();
|
||||||
current_view->update(-2);
|
current_view->update(-2);
|
||||||
@ -471,7 +470,7 @@ void SetPWidthCB(FL_OBJECT * ob, long)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (current_view->available()){
|
if (current_view->available()){
|
||||||
current_view->getScreen()->HideCursor();
|
current_view->hideCursor();
|
||||||
if (!current_view->text->selection) {
|
if (!current_view->text->selection) {
|
||||||
current_view->beforeChange();
|
current_view->beforeChange();
|
||||||
current_view->update(-2);
|
current_view->update(-2);
|
||||||
|
@ -59,10 +59,7 @@ extern "C" {
|
|||||||
|
|
||||||
|
|
||||||
WorkArea::WorkArea(BufferView * o, int xpos, int ypos, int width, int height)
|
WorkArea::WorkArea(BufferView * o, int xpos, int ypos, int width, int height)
|
||||||
: owner(o), workareapixmap(0)
|
: owner(o), workareapixmap(0), painter_(*this)
|
||||||
#ifdef USE_PAINTER
|
|
||||||
, painter_(*this)
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
fl_freeze_all_forms();
|
fl_freeze_all_forms();
|
||||||
|
|
||||||
@ -164,11 +161,10 @@ WorkArea::WorkArea(BufferView * o, int xpos, int ypos, int width, int height)
|
|||||||
|
|
||||||
// Create the workarea pixmap
|
// Create the workarea pixmap
|
||||||
createPixmap(width - 15 - 2 * bw, height - 2 * bw);
|
createPixmap(width - 15 - 2 * bw, height - 2 * bw);
|
||||||
#ifdef USE_PAINTER
|
|
||||||
// setup the painter
|
// setup the painter
|
||||||
painter_.setDisplay(fl_display);
|
painter_.setDisplay(fl_display);
|
||||||
painter_.setDrawable(workareapixmap);
|
painter_.setDrawable(workareapixmap);
|
||||||
#endif
|
|
||||||
|
|
||||||
// We add this object as late as possible to avoit problems
|
// We add this object as late as possible to avoit problems
|
||||||
// with drawing.
|
// with drawing.
|
||||||
@ -227,10 +223,8 @@ void WorkArea::resize(int xpos, int ypos, int width, int height)
|
|||||||
// Create the workarea pixmap
|
// Create the workarea pixmap
|
||||||
createPixmap(width - 15 - 2 * bw, height - 2 * bw);
|
createPixmap(width - 15 - 2 * bw, height - 2 * bw);
|
||||||
|
|
||||||
#ifdef USE_PAINTER
|
|
||||||
// reset the painter
|
// reset the painter
|
||||||
painter_.setDrawable(workareapixmap);
|
painter_.setDrawable(workareapixmap);
|
||||||
#endif
|
|
||||||
|
|
||||||
// the free object
|
// the free object
|
||||||
fl_set_object_geometry(work_area, xpos + bw, ypos + bw,
|
fl_set_object_geometry(work_area, xpos + bw, ypos + bw,
|
||||||
@ -309,7 +303,7 @@ void WorkArea::up_cb(FL_OBJECT * ob, long)
|
|||||||
if (ev2->type == ButtonPress || ev2->type == ButtonRelease)
|
if (ev2->type == ButtonPress || ev2->type == ButtonRelease)
|
||||||
time = 0;
|
time = 0;
|
||||||
//area->up(time++, fl_get_button_numb(ob));
|
//area->up(time++, fl_get_button_numb(ob));
|
||||||
area->owner->UpCB(time++, fl_get_button_numb(ob));
|
area->owner->upCB(time++, fl_get_button_numb(ob));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -321,7 +315,7 @@ void WorkArea::down_cb(FL_OBJECT * ob, long)
|
|||||||
if (ev2->type == ButtonPress || ev2->type == ButtonRelease)
|
if (ev2->type == ButtonPress || ev2->type == ButtonRelease)
|
||||||
time = 0;
|
time = 0;
|
||||||
//area->down(time++, fl_get_button_numb(ob));
|
//area->down(time++, fl_get_button_numb(ob));
|
||||||
area->owner->DownCB(time++, fl_get_button_numb(ob));
|
area->owner->downCB(time++, fl_get_button_numb(ob));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -331,7 +325,7 @@ void WorkArea::scroll_cb(FL_OBJECT * ob, long)
|
|||||||
WorkArea * area = static_cast<WorkArea*>(ob->u_vdata);
|
WorkArea * area = static_cast<WorkArea*>(ob->u_vdata);
|
||||||
|
|
||||||
//area->scroll(fl_get_slider_value(ob));
|
//area->scroll(fl_get_slider_value(ob));
|
||||||
area->owner->ScrollCB(fl_get_slider_value(ob));
|
area->owner->scrollCB(fl_get_slider_value(ob));
|
||||||
waitForX();
|
waitForX();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -358,7 +352,6 @@ int WorkArea::work_area_handler(FL_OBJECT * ob, int event,
|
|||||||
lyxerr.debug() << "Workarea event: DRAW" << endl;
|
lyxerr.debug() << "Workarea event: DRAW" << endl;
|
||||||
area->createPixmap(area->workWidth(), area->height());
|
area->createPixmap(area->workWidth(), area->height());
|
||||||
Lgb_bug_find_hack = true;
|
Lgb_bug_find_hack = true;
|
||||||
//area->expose();
|
|
||||||
area->owner->workAreaExpose();
|
area->owner->workAreaExpose();
|
||||||
Lgb_bug_find_hack = false;
|
Lgb_bug_find_hack = false;
|
||||||
break;
|
break;
|
||||||
@ -366,10 +359,7 @@ int WorkArea::work_area_handler(FL_OBJECT * ob, int event,
|
|||||||
if (!ev) break;
|
if (!ev) break;
|
||||||
// Should really have used xbutton.state
|
// Should really have used xbutton.state
|
||||||
lyxerr.debug() << "Workarea event: PUSH" << endl;
|
lyxerr.debug() << "Workarea event: PUSH" << endl;
|
||||||
//area->buttonPress(ev->xbutton.x - ob->x,
|
area->owner->workAreaButtonPress(ev->xbutton.x - ob->x,
|
||||||
// ev->xbutton.y - ob->y,
|
|
||||||
// ev->xbutton.button);
|
|
||||||
area->owner->WorkAreaButtonPress(ev->xbutton.x - ob->x,
|
|
||||||
ev->xbutton.y - ob->y,
|
ev->xbutton.y - ob->y,
|
||||||
ev->xbutton.button);
|
ev->xbutton.button);
|
||||||
break;
|
break;
|
||||||
@ -377,10 +367,7 @@ int WorkArea::work_area_handler(FL_OBJECT * ob, int event,
|
|||||||
if (!ev) break;
|
if (!ev) break;
|
||||||
// Should really have used xbutton.state
|
// Should really have used xbutton.state
|
||||||
lyxerr.debug() << "Workarea event: RELEASE" << endl;
|
lyxerr.debug() << "Workarea event: RELEASE" << endl;
|
||||||
//area->buttonRelease(ev->xbutton.x - ob->x,
|
area->owner->workAreaButtonRelease(ev->xbutton.x - ob->x,
|
||||||
// ev->xbutton.y - ob->y,
|
|
||||||
// ev->xbutton.button);
|
|
||||||
area->owner->WorkAreaButtonRelease(ev->xbutton.x - ob->x,
|
|
||||||
ev->xbutton.y - ob->y,
|
ev->xbutton.y - ob->y,
|
||||||
ev->xbutton.button);
|
ev->xbutton.button);
|
||||||
break;
|
break;
|
||||||
@ -390,10 +377,7 @@ int WorkArea::work_area_handler(FL_OBJECT * ob, int event,
|
|||||||
ev->xmotion.y != y_old ||
|
ev->xmotion.y != y_old ||
|
||||||
fl_get_slider_value(area->scrollbar) != scrollbar_value_old) {
|
fl_get_slider_value(area->scrollbar) != scrollbar_value_old) {
|
||||||
lyxerr.debug() << "Workarea event: MOUSE" << endl;
|
lyxerr.debug() << "Workarea event: MOUSE" << endl;
|
||||||
//area->motion(ev->xmotion.x - ob->x,
|
area->owner->workAreaMotionNotify(ev->xmotion.x - ob->x,
|
||||||
// ev->xmotion.y - ob->y,
|
|
||||||
// ev->xbutton.state);
|
|
||||||
area->owner->WorkAreaMotionNotify(ev->xmotion.x - ob->x,
|
|
||||||
ev->xmotion.y - ob->y,
|
ev->xmotion.y - ob->y,
|
||||||
ev->xbutton.state);
|
ev->xbutton.state);
|
||||||
}
|
}
|
||||||
@ -402,40 +386,29 @@ int WorkArea::work_area_handler(FL_OBJECT * ob, int event,
|
|||||||
// case FL_KEYBOARD: WorkAreaKeyPress(ob, 0,0,0,ev,0); break;
|
// case FL_KEYBOARD: WorkAreaKeyPress(ob, 0,0,0,ev,0); break;
|
||||||
case FL_FOCUS:
|
case FL_FOCUS:
|
||||||
lyxerr.debug() << "Workarea event: FOCUS" << endl;
|
lyxerr.debug() << "Workarea event: FOCUS" << endl;
|
||||||
//area->focus();
|
|
||||||
break;
|
break;
|
||||||
case FL_UNFOCUS:
|
case FL_UNFOCUS:
|
||||||
lyxerr.debug() << "Workarea event: UNFOCUS" << endl;
|
lyxerr.debug() << "Workarea event: UNFOCUS" << endl;
|
||||||
//area->unfocus();
|
|
||||||
break;
|
break;
|
||||||
case FL_ENTER:
|
case FL_ENTER:
|
||||||
lyxerr.debug() << "Workarea event: ENTER" << endl;
|
lyxerr.debug() << "Workarea event: ENTER" << endl;
|
||||||
//area->enter();
|
|
||||||
break;
|
break;
|
||||||
case FL_LEAVE:
|
case FL_LEAVE:
|
||||||
lyxerr.debug() << "Workarea event: LEAVE" << endl;
|
lyxerr.debug() << "Workarea event: LEAVE" << endl;
|
||||||
//area->leave();
|
|
||||||
break;
|
break;
|
||||||
case FL_DBLCLICK:
|
case FL_DBLCLICK:
|
||||||
if (!ev) break;
|
if (!ev) break;
|
||||||
lyxerr.debug() << "Workarea event: DBLCLICK" << endl;;
|
lyxerr.debug() << "Workarea event: DBLCLICK" << endl;;
|
||||||
//area->doubleclick(ev->xbutton.x,
|
|
||||||
// ev->xbutton.y,
|
|
||||||
// ev->xbutton.button);
|
|
||||||
break;
|
break;
|
||||||
case FL_TRPLCLICK:
|
case FL_TRPLCLICK:
|
||||||
if (!ev) break;
|
if (!ev) break;
|
||||||
lyxerr.debug() << "Workarea event: TRPLCLICK" << endl;
|
lyxerr.debug() << "Workarea event: TRPLCLICK" << endl;
|
||||||
//area->trippleclick(ev->xbutton.x,
|
|
||||||
// ev->xbutton.y,
|
|
||||||
// ev->xbutton.button);
|
|
||||||
break;
|
break;
|
||||||
case FL_OTHER:
|
case FL_OTHER:
|
||||||
if (!ev) break;
|
if (!ev) break;
|
||||||
if (ev->type == SelectionNotify) {
|
if (ev->type == SelectionNotify) {
|
||||||
lyxerr.debug() << "Workarea event: SELECTION" << endl;
|
lyxerr.debug() << "Workarea event: SELECTION" << endl;
|
||||||
//area->selection(area->work_area->form->window, ev);
|
area->owner->workAreaSelectionNotify(area->work_area->form->window, ev);
|
||||||
area->owner->WorkAreaSelectionNotify(area->work_area->form->window, ev);
|
|
||||||
} else
|
} else
|
||||||
lyxerr.debug() << "Workarea event: OTHER" << endl;
|
lyxerr.debug() << "Workarea event: OTHER" << endl;
|
||||||
|
|
||||||
|
@ -30,10 +30,8 @@ public:
|
|||||||
WorkArea(BufferView *, int xpos, int ypos, int width, int height);
|
WorkArea(BufferView *, int xpos, int ypos, int width, int height);
|
||||||
///
|
///
|
||||||
~WorkArea();
|
~WorkArea();
|
||||||
#ifdef USE_PAINTER
|
|
||||||
///
|
///
|
||||||
Painter & getPainter() { return painter_; }
|
Painter & getPainter() { return painter_; }
|
||||||
#endif
|
|
||||||
///
|
///
|
||||||
int workWidth() const { return work_area->w; }
|
int workWidth() const { return work_area->w; }
|
||||||
///
|
///
|
||||||
@ -112,10 +110,8 @@ private:
|
|||||||
BufferView * owner;
|
BufferView * owner;
|
||||||
/// The pixmap overlay on the workarea
|
/// The pixmap overlay on the workarea
|
||||||
Pixmap workareapixmap;
|
Pixmap workareapixmap;
|
||||||
#ifdef USE_PAINTER
|
|
||||||
///
|
///
|
||||||
Painter painter_;
|
Painter painter_;
|
||||||
#endif
|
|
||||||
///
|
///
|
||||||
FL_OBJECT * figinset_canvas;
|
FL_OBJECT * figinset_canvas;
|
||||||
};
|
};
|
||||||
|
@ -217,7 +217,7 @@ bool Buffer::readLyXformat2(LyXLex & lex, LyXParagraph * par)
|
|||||||
bool the_end_read = false;
|
bool the_end_read = false;
|
||||||
|
|
||||||
LyXParagraph * return_par = 0;
|
LyXParagraph * return_par = 0;
|
||||||
LyXFont font = LyXFont(LyXFont::ALL_INHERIT);
|
LyXFont font(LyXFont::ALL_INHERIT);
|
||||||
|
|
||||||
// If we are inserting, we cheat and get a token in advance
|
// If we are inserting, we cheat and get a token in advance
|
||||||
bool has_token = false;
|
bool has_token = false;
|
||||||
@ -3183,7 +3183,7 @@ int Buffer::runChktex()
|
|||||||
|
|
||||||
void Buffer::RoffAsciiTable(ostream & os, LyXParagraph * par)
|
void Buffer::RoffAsciiTable(ostream & os, LyXParagraph * par)
|
||||||
{
|
{
|
||||||
LyXFont font1 = LyXFont(LyXFont::ALL_INHERIT);
|
LyXFont font1(LyXFont::ALL_INHERIT);
|
||||||
LyXFont font2;
|
LyXFont font2;
|
||||||
Inset * inset;
|
Inset * inset;
|
||||||
LyXParagraph::size_type i;
|
LyXParagraph::size_type i;
|
||||||
|
@ -33,7 +33,6 @@
|
|||||||
#include "lastfiles.h"
|
#include "lastfiles.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "lyxrc.h"
|
#include "lyxrc.h"
|
||||||
#include "lyxscreen.h"
|
|
||||||
#include "lyxtext.h"
|
#include "lyxtext.h"
|
||||||
#include "lyx_cb.h"
|
#include "lyx_cb.h"
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
|
@ -11,10 +11,6 @@
|
|||||||
#include "bmtable.h"
|
#include "bmtable.h"
|
||||||
#include "support/filetools.h"
|
#include "support/filetools.h"
|
||||||
|
|
||||||
#ifdef MONO
|
|
||||||
extern int mono_video;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
FD_form_bullet *create_form_form_bullet(void)
|
FD_form_bullet *create_form_form_bullet(void)
|
||||||
{
|
{
|
||||||
FL_OBJECT *obj;
|
FL_OBJECT *obj;
|
||||||
@ -31,19 +27,9 @@ FD_form_bullet *create_form_form_bullet(void)
|
|||||||
fl_set_object_callback(obj, BulletBMTableCB, 0);
|
fl_set_object_callback(obj, BulletBMTableCB, 0);
|
||||||
fl_set_object_lcol(obj, FL_BLUE);
|
fl_set_object_lcol(obj, FL_BLUE);
|
||||||
fl_set_object_boxtype(obj, FL_UP_BOX);
|
fl_set_object_boxtype(obj, FL_UP_BOX);
|
||||||
#ifdef MONO
|
|
||||||
if (mono_video) {
|
|
||||||
fl_set_bmtable_file(obj, 6, 6,
|
|
||||||
LibFileSearch("images",
|
|
||||||
"standard.xbm").c_str());
|
|
||||||
} else {
|
|
||||||
#endif
|
|
||||||
fl_set_bmtable_pixmap_file(obj, 6, 6,
|
fl_set_bmtable_pixmap_file(obj, 6, 6,
|
||||||
LibFileSearch("images",
|
LibFileSearch("images",
|
||||||
"standard.xpm").c_str());
|
"standard.xpm").c_str());
|
||||||
#ifdef MONO
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
fl_set_border_width(-1);
|
fl_set_border_width(-1);
|
||||||
obj = fl_add_frame(FL_ENGRAVED_FRAME, 95, 20, 255, 70, "");
|
obj = fl_add_frame(FL_ENGRAVED_FRAME, 95, 20, 255, 70, "");
|
||||||
|
@ -11,10 +11,6 @@
|
|||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
#include "lyx_gui_misc.h" // CancelCloseBoxCB + WriteAlert
|
#include "lyx_gui_misc.h" // CancelCloseBoxCB + WriteAlert
|
||||||
|
|
||||||
#ifdef MONO
|
|
||||||
extern int mono_video;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extern BufferView * current_view;
|
extern BufferView * current_view;
|
||||||
FD_form_bullet * fd_form_bullet;
|
FD_form_bullet * fd_form_bullet;
|
||||||
|
|
||||||
@ -26,15 +22,11 @@ static int current_bullet_depth;
|
|||||||
void bulletForm()
|
void bulletForm()
|
||||||
{
|
{
|
||||||
if (!fd_form_bullet) {
|
if (!fd_form_bullet) {
|
||||||
if (
|
if ((XpmVersion < 4
|
||||||
#ifdef MONO
|
|
||||||
!mono_video &&
|
|
||||||
#endif
|
|
||||||
(XpmVersion < 4
|
|
||||||
|| (XpmVersion == 4 && XpmRevision < 7))) {
|
|| (XpmVersion == 4 && XpmRevision < 7))) {
|
||||||
WriteAlert(_("Sorry, your libXpm is too old."),
|
WriteAlert(_("Sorry, your libXpm is too old."),
|
||||||
_("This feature requires xpm-4.7 (a.k.a 3.4g) or newer."),
|
_("This feature requires xpm-4.7 (a.k.a 3.4g) or newer."),
|
||||||
_("Try running LyX in mono mode (lyx -Mono)."));
|
"");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
fd_form_bullet = create_form_form_bullet();
|
fd_form_bullet = create_form_form_bullet();
|
||||||
@ -226,19 +218,9 @@ void BulletPanelCB(FL_OBJECT * /*ob*/, long data)
|
|||||||
new_panel = "standard";
|
new_panel = "standard";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#ifdef MONO
|
|
||||||
if (mono_video) {
|
|
||||||
new_panel += ".xbm";
|
|
||||||
fl_set_bmtable_file(fd_form_bullet->bmtable_bullet_panel, 6, 6,
|
|
||||||
LibFileSearch("images", new_panel.c_str()).c_str());
|
|
||||||
} else {
|
|
||||||
#endif
|
|
||||||
new_panel += ".xpm";
|
new_panel += ".xpm";
|
||||||
fl_set_bmtable_pixmap_file(fd_form_bullet->bmtable_bullet_panel, 6, 6,
|
fl_set_bmtable_pixmap_file(fd_form_bullet->bmtable_bullet_panel, 6, 6,
|
||||||
LibFileSearch("images", new_panel.c_str()).c_str());
|
LibFileSearch("images", new_panel.c_str()).c_str());
|
||||||
#ifdef MONO
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
fl_redraw_object(fd_form_bullet->bmtable_bullet_panel);
|
fl_redraw_object(fd_form_bullet->bmtable_bullet_panel);
|
||||||
fl_unfreeze_form(fd_form_bullet->form_bullet);
|
fl_unfreeze_form(fd_form_bullet->form_bullet);
|
||||||
}
|
}
|
||||||
|
@ -2,9 +2,6 @@
|
|||||||
* figinset.C - part of LyX project
|
* figinset.C - part of LyX project
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef MONO
|
|
||||||
extern int reverse_video;
|
|
||||||
#endif
|
|
||||||
extern long int background_pixels;
|
extern long int background_pixels;
|
||||||
|
|
||||||
/* Rework of path-handling (Matthias 04.07.1996 )
|
/* Rework of path-handling (Matthias 04.07.1996 )
|
||||||
@ -60,9 +57,6 @@ using std::flush;
|
|||||||
#include "support/filetools.h"
|
#include "support/filetools.h"
|
||||||
#include "LyXView.h" // just because of form_main
|
#include "LyXView.h" // just because of form_main
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#ifndef USE_PAINTER
|
|
||||||
#include "lyxdraw.h"
|
|
||||||
#endif
|
|
||||||
#include "LaTeXFeatures.h"
|
#include "LaTeXFeatures.h"
|
||||||
#include "lyxrc.h"
|
#include "lyxrc.h"
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
@ -647,31 +641,9 @@ static void runqueue()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_PAINTER
|
|
||||||
#ifdef MONO
|
|
||||||
if (reverse_video) {
|
|
||||||
sprintf(tbuf+1, " %ld %ld", WhitePixelOfScreen(
|
|
||||||
DefaultScreenOfDisplay(fl_display)),
|
|
||||||
fl_get_pixel(FL_BLACK));
|
|
||||||
} else {
|
|
||||||
#endif
|
|
||||||
sprintf(tbuf+1, " %ld %ld", BlackPixelOfScreen(
|
sprintf(tbuf+1, " %ld %ld", BlackPixelOfScreen(
|
||||||
DefaultScreenOfDisplay(fl_display)),
|
DefaultScreenOfDisplay(fl_display)),
|
||||||
fl_get_pixel(FL_WHITE));
|
fl_get_pixel(FL_WHITE));
|
||||||
#ifdef MONO
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
if (reverse_video) {
|
|
||||||
sprintf(tbuf+1, " %ld %ld", WhitePixelOfScreen(
|
|
||||||
DefaultScreenOfDisplay(fl_display)),
|
|
||||||
background_pixels);
|
|
||||||
} else {
|
|
||||||
sprintf(tbuf+1, " %ld %ld", BlackPixelOfScreen(
|
|
||||||
DefaultScreenOfDisplay(fl_display)),
|
|
||||||
background_pixels);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
XChangeProperty(tempdisp,
|
XChangeProperty(tempdisp,
|
||||||
fl_get_canvas_id(figinset_canvas),
|
fl_get_canvas_id(figinset_canvas),
|
||||||
@ -1058,46 +1030,24 @@ InsetFig::~InsetFig()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_PAINTER
|
|
||||||
int InsetFig::ascent(Painter &, LyXFont const &) const
|
int InsetFig::ascent(Painter &, LyXFont const &) const
|
||||||
{
|
{
|
||||||
return hgh + 3;
|
return hgh + 3;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
int InsetFig::Ascent(LyXFont const &) const
|
|
||||||
{
|
|
||||||
return hgh + 3;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_PAINTER
|
|
||||||
int InsetFig::descent(Painter &, LyXFont const &) const
|
int InsetFig::descent(Painter &, LyXFont const &) const
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
int InsetFig::Descent(LyXFont const &) const
|
|
||||||
{
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_PAINTER
|
|
||||||
int InsetFig::width(Painter &, LyXFont const &) const
|
int InsetFig::width(Painter &, LyXFont const &) const
|
||||||
{
|
{
|
||||||
return wid + 2;
|
return wid + 2;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
int InsetFig::Width(LyXFont const &) const
|
|
||||||
{
|
|
||||||
return wid + 2;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_PAINTER
|
|
||||||
void InsetFig::draw(Painter & pain, LyXFont const & f,
|
void InsetFig::draw(Painter & pain, LyXFont const & f,
|
||||||
int baseline, float & x) const
|
int baseline, float & x) const
|
||||||
{
|
{
|
||||||
@ -1145,56 +1095,6 @@ void InsetFig::draw(Painter & pain, LyXFont const & f,
|
|||||||
}
|
}
|
||||||
x += width(pain, font); // ?
|
x += width(pain, font); // ?
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
void InsetFig::Draw(LyXFont font, LyXScreen & scr, int baseline, float & x)
|
|
||||||
{
|
|
||||||
if (bitmap_waiting) getbitmaps();
|
|
||||||
|
|
||||||
// I wish that I didn't have to use this
|
|
||||||
// but the figinset code is so complicated so
|
|
||||||
// I don't want to fiddle with it now.
|
|
||||||
unsigned long pm = scr.getForeground();
|
|
||||||
|
|
||||||
if (figure && figure->data && figure->data->bitmap &&
|
|
||||||
!figure->data->reading && !figure->data->broken) {
|
|
||||||
// draw the bitmap
|
|
||||||
XCopyArea(fl_display, figure->data->bitmap, pm, local_gc_copy,
|
|
||||||
0, 0, wid, hgh, int(x+1), baseline-hgh);
|
|
||||||
XFlush(fl_display);
|
|
||||||
if (flags & 4) XDrawRectangle(fl_display, pm, local_gc_copy,
|
|
||||||
int(x), baseline - hgh - 1,
|
|
||||||
wid+1, hgh+1);
|
|
||||||
} else {
|
|
||||||
char * msg = 0;
|
|
||||||
// draw frame
|
|
||||||
XDrawRectangle(fl_display, pm, local_gc_copy,
|
|
||||||
int(x),
|
|
||||||
baseline - hgh - 1, wid+1, hgh+1);
|
|
||||||
if (figure && figure->data) {
|
|
||||||
if (figure->data->broken) msg = _("[render error]");
|
|
||||||
else if (figure->data->reading) msg = _("[rendering ... ]");
|
|
||||||
} else
|
|
||||||
if (fname.empty()) msg = _("[no file]");
|
|
||||||
else if ((flags & 3) == 0) msg = _("[not displayed]");
|
|
||||||
else if (lyxrc->ps_command.empty()) msg = _("[no ghostscript]");
|
|
||||||
|
|
||||||
if (!msg) msg = _("[unknown error]");
|
|
||||||
|
|
||||||
font.setFamily (LyXFont::SANS_FAMILY);
|
|
||||||
font.setSize (LyXFont::SIZE_FOOTNOTE);
|
|
||||||
string justname = OnlyFilename (fname);
|
|
||||||
font.drawString(justname, pm,
|
|
||||||
baseline - font.maxAscent() - 4,
|
|
||||||
int(x) + 8);
|
|
||||||
font.setSize (LyXFont::SIZE_TINY);
|
|
||||||
font.drawText (msg, strlen(msg), pm,
|
|
||||||
baseline - 4,
|
|
||||||
int(x) + 8);
|
|
||||||
|
|
||||||
}
|
|
||||||
x += Width(font); // ?
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
void InsetFig::Write(ostream & os)
|
void InsetFig::Write(ostream & os)
|
||||||
|
@ -24,7 +24,6 @@ public:
|
|||||||
InsetFig(int tmpx, int tmpy, Buffer *);
|
InsetFig(int tmpx, int tmpy, Buffer *);
|
||||||
///
|
///
|
||||||
~InsetFig();
|
~InsetFig();
|
||||||
#ifdef USE_PAINTER
|
|
||||||
///
|
///
|
||||||
int ascent(Painter &, LyXFont const & font) const;
|
int ascent(Painter &, LyXFont const & font) const;
|
||||||
///
|
///
|
||||||
@ -34,16 +33,6 @@ public:
|
|||||||
///
|
///
|
||||||
void draw(Painter &, LyXFont const & font,
|
void draw(Painter &, LyXFont const & font,
|
||||||
int baseline, float & x) const;
|
int baseline, float & x) const;
|
||||||
#else
|
|
||||||
///
|
|
||||||
int Ascent(LyXFont const & font) const;
|
|
||||||
///
|
|
||||||
int Descent(LyXFont const & font) const;
|
|
||||||
///
|
|
||||||
int Width(LyXFont const & font) const;
|
|
||||||
///
|
|
||||||
void Draw(LyXFont font, LyXScreen & scr, int baseline, float & x);
|
|
||||||
#endif
|
|
||||||
///
|
///
|
||||||
void Write(ostream &);
|
void Write(ostream &);
|
||||||
///
|
///
|
||||||
|
@ -472,7 +472,6 @@ void BibitemUpdate(Combox * combox)
|
|||||||
|
|
||||||
|
|
||||||
// ale070405 This function maybe shouldn't be here. We'll fix this at 0.13.
|
// ale070405 This function maybe shouldn't be here. We'll fix this at 0.13.
|
||||||
#ifdef USE_PAINTER
|
|
||||||
int bibitemMaxWidth(Painter & pain, LyXFont const & font)
|
int bibitemMaxWidth(Painter & pain, LyXFont const & font)
|
||||||
{
|
{
|
||||||
int w = 0;
|
int w = 0;
|
||||||
@ -488,27 +487,9 @@ int bibitemMaxWidth(Painter & pain, LyXFont const & font)
|
|||||||
}
|
}
|
||||||
return w;
|
return w;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
int bibitemMaxWidth(LyXFont const & font)
|
|
||||||
{
|
|
||||||
int w = 0;
|
|
||||||
// Does look like a hack? It is! (but will change at 0.13)
|
|
||||||
LyXParagraph * par = current_view->buffer()->paragraph;
|
|
||||||
|
|
||||||
while (par) {
|
|
||||||
if (par->bibkey) {
|
|
||||||
int wx = par->bibkey->Width(font);
|
|
||||||
if (wx > w) w = wx;
|
|
||||||
}
|
|
||||||
par = par->next;
|
|
||||||
}
|
|
||||||
return w;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
// ale070405
|
// ale070405
|
||||||
#ifdef USE_PAINTER
|
|
||||||
string bibitemWidthest(Painter & pain)
|
string bibitemWidthest(Painter & pain)
|
||||||
{
|
{
|
||||||
int w = 0;
|
int w = 0;
|
||||||
@ -533,29 +514,3 @@ string bibitemWidthest(Painter & pain)
|
|||||||
|
|
||||||
return "99";
|
return "99";
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
string bibitemWidthest()
|
|
||||||
{
|
|
||||||
int w = 0;
|
|
||||||
// Does look like a hack? It is! (but will change at 0.13)
|
|
||||||
LyXParagraph * par = current_view->buffer()->paragraph;
|
|
||||||
InsetBibKey * bkey = 0;
|
|
||||||
LyXFont font;
|
|
||||||
|
|
||||||
while (par) {
|
|
||||||
if (par->bibkey) {
|
|
||||||
int wx = par->bibkey->Width(font);
|
|
||||||
if (wx > w) {
|
|
||||||
w = wx;
|
|
||||||
bkey = par->bibkey;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
par = par->next;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bkey && !bkey->getScreenLabel().empty())
|
|
||||||
return bkey->getScreenLabel();
|
|
||||||
|
|
||||||
return "99";
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
@ -15,9 +15,6 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "insetcommand.h"
|
#include "insetcommand.h"
|
||||||
#ifndef USE_PAINTER
|
|
||||||
#include "lyxdraw.h"
|
|
||||||
#endif
|
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "Painter.h"
|
#include "Painter.h"
|
||||||
|
|
||||||
@ -33,64 +30,107 @@ InsetCommand::InsetCommand(string const & cmd, string const & arg,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_PAINTER
|
int InsetCommand::ascent(Painter & pain, LyXFont const &) const
|
||||||
int InsetCommand::ascent(Painter &, LyXFont const & font) const
|
|
||||||
{
|
{
|
||||||
|
#if 1
|
||||||
|
LyXFont font(LyXFont::ALL_SANE);
|
||||||
|
font.decSize();
|
||||||
|
|
||||||
|
int width, ascent, descent;
|
||||||
|
string s = getScreenLabel();
|
||||||
|
|
||||||
|
if (Editable()) {
|
||||||
|
pain.buttonText(0, 0, s, font,
|
||||||
|
false, width, ascent, descent);
|
||||||
|
} else {
|
||||||
|
pain.rectText(0, 0, s, font,
|
||||||
|
LColor::commandbg, LColor::commandframe,
|
||||||
|
false, width, ascent, descent);
|
||||||
|
}
|
||||||
|
return ascent;
|
||||||
|
#else
|
||||||
LyXFont f = font;
|
LyXFont f = font;
|
||||||
f.decSize();
|
f.decSize();
|
||||||
return f.maxAscent() + 3;
|
return f.maxAscent() + 3;
|
||||||
}
|
|
||||||
#else
|
|
||||||
int InsetCommand::Ascent(LyXFont const & font) const
|
|
||||||
{
|
|
||||||
LyXFont f = font;
|
|
||||||
f.decSize();
|
|
||||||
return f.maxAscent() + 3;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_PAINTER
|
int InsetCommand::descent(Painter & pain, LyXFont const &) const
|
||||||
int InsetCommand::descent(Painter &, LyXFont const & font) const
|
|
||||||
{
|
{
|
||||||
|
#if 1
|
||||||
|
LyXFont font(LyXFont::ALL_SANE);
|
||||||
|
font.decSize();
|
||||||
|
|
||||||
|
int width, ascent, descent;
|
||||||
|
string s = getScreenLabel();
|
||||||
|
|
||||||
|
if (Editable()) {
|
||||||
|
pain.buttonText(0, 0, s, font,
|
||||||
|
false, width, ascent, descent);
|
||||||
|
} else {
|
||||||
|
pain.rectText(0, 0, s, font,
|
||||||
|
LColor::commandbg, LColor::commandframe,
|
||||||
|
false, width, ascent, descent);
|
||||||
|
}
|
||||||
|
return descent;
|
||||||
|
#else
|
||||||
LyXFont f = font;
|
LyXFont f = font;
|
||||||
f.decSize();
|
f.decSize();
|
||||||
return f.maxDescent() + 3;
|
return f.maxDescent() + 3;
|
||||||
}
|
|
||||||
#else
|
|
||||||
int InsetCommand::Descent(LyXFont const & font) const
|
|
||||||
{
|
|
||||||
LyXFont f = font;
|
|
||||||
f.decSize();
|
|
||||||
return f.maxDescent() + 3;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_PAINTER
|
int InsetCommand::width(Painter & pain, LyXFont const &) const
|
||||||
int InsetCommand::width(Painter &, LyXFont const & font) const
|
|
||||||
{
|
{
|
||||||
|
#if 1
|
||||||
|
LyXFont font(LyXFont::ALL_SANE);
|
||||||
|
font.decSize();
|
||||||
|
|
||||||
|
int width, ascent, descent;
|
||||||
|
string s = getScreenLabel();
|
||||||
|
|
||||||
|
if (Editable()) {
|
||||||
|
pain.buttonText(0, 0, s, font,
|
||||||
|
false, width, ascent, descent);
|
||||||
|
} else {
|
||||||
|
pain.rectText(0, 0, s, font,
|
||||||
|
LColor::commandbg, LColor::commandframe,
|
||||||
|
false, width, ascent, descent);
|
||||||
|
}
|
||||||
|
return width;
|
||||||
|
#else
|
||||||
LyXFont f = font;
|
LyXFont f = font;
|
||||||
f.decSize();
|
f.decSize();
|
||||||
string s = getScreenLabel();
|
string s = getScreenLabel();
|
||||||
return 10 + f.stringWidth(s);
|
return 10 + f.stringWidth(s);
|
||||||
}
|
|
||||||
#else
|
|
||||||
int InsetCommand::Width(LyXFont const & font) const
|
|
||||||
{
|
|
||||||
LyXFont f = font;
|
|
||||||
f.decSize();
|
|
||||||
string s = getScreenLabel();
|
|
||||||
return 10 + f.stringWidth(s);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_PAINTER
|
void InsetCommand::draw(Painter & pain, LyXFont const &,
|
||||||
void InsetCommand::draw(Painter & pain, LyXFont const & font,
|
|
||||||
int baseline, float & x) const
|
int baseline, float & x) const
|
||||||
{
|
{
|
||||||
// Draw it as a box with the LaTeX text
|
// Draw it as a box with the LaTeX text
|
||||||
|
#if 1
|
||||||
|
LyXFont font(LyXFont::ALL_SANE);
|
||||||
|
font.setColor(LColor::command).decSize();
|
||||||
|
|
||||||
|
int width;
|
||||||
|
string s = getScreenLabel();
|
||||||
|
|
||||||
|
if (Editable()) {
|
||||||
|
pain.buttonText(int(x), baseline, s, font, true, width);
|
||||||
|
} else {
|
||||||
|
pain.rectText(int(x), baseline, s, font,
|
||||||
|
LColor::commandbg, LColor::commandframe,
|
||||||
|
true, width);
|
||||||
|
}
|
||||||
|
|
||||||
|
x += width;
|
||||||
|
#else
|
||||||
|
|
||||||
x += 3;
|
x += 3;
|
||||||
|
|
||||||
pain.fillRectangle(int(x), baseline - ascent(pain, font) + 1,
|
pain.fillRectangle(int(x), baseline - ascent(pain, font) + 1,
|
||||||
@ -119,40 +159,8 @@ void InsetCommand::draw(Painter & pain, LyXFont const & font,
|
|||||||
pain.text(int(x + 2), baseline, s, f);
|
pain.text(int(x + 2), baseline, s, f);
|
||||||
|
|
||||||
x += width(pain, font) - 3;
|
x += width(pain, font) - 3;
|
||||||
}
|
|
||||||
#else
|
|
||||||
void InsetCommand::Draw(LyXFont font, LyXScreen & scr,
|
|
||||||
int baseline, float & x)
|
|
||||||
{
|
|
||||||
// Draw it as a box with the LaTeX text
|
|
||||||
x += 3;
|
|
||||||
|
|
||||||
scr.fillRectangle(gc_lighted,
|
|
||||||
int(x), baseline - Ascent(font) + 1,
|
|
||||||
Width(font) - 6,
|
|
||||||
Ascent(font) + Descent(font)-2);
|
|
||||||
// Tell whether this slows down the drawing (ale)
|
|
||||||
// lets draw editable and non-editable insets differently
|
|
||||||
if (Editable()) {
|
|
||||||
int y = baseline - Ascent(font)+1, w = Width(font)-6,
|
|
||||||
h = (Ascent(font)+Descent(font)-2);
|
|
||||||
scr.drawFrame(FL_UP_FRAME, int(x), y, w, h, FL_BLACK, -1);
|
|
||||||
} else {
|
|
||||||
scr.drawRectangle(gc_note_frame,
|
|
||||||
int(x), baseline - Ascent(font)+1,
|
|
||||||
Width(font)-6,
|
|
||||||
Ascent(font)+Descent(font)-2);
|
|
||||||
}
|
|
||||||
string s = getScreenLabel();
|
|
||||||
LyXFont f = font;
|
|
||||||
f.decSize();
|
|
||||||
f.setColor(LyXFont::NONE);
|
|
||||||
f.setLatex(LyXFont::OFF);
|
|
||||||
scr.drawString(f, s, baseline, int(x+2));
|
|
||||||
|
|
||||||
x += Width(font) - 3;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// In lyxf3 this will be just LaTeX
|
// In lyxf3 this will be just LaTeX
|
||||||
|
@ -32,7 +32,6 @@ public:
|
|||||||
///
|
///
|
||||||
InsetCommand(string const & name, string const & arg = string(),
|
InsetCommand(string const & name, string const & arg = string(),
|
||||||
string const & opt = string());
|
string const & opt = string());
|
||||||
#ifdef USE_PAINTER
|
|
||||||
///
|
///
|
||||||
int ascent(Painter &, LyXFont const &) const;
|
int ascent(Painter &, LyXFont const &) const;
|
||||||
///
|
///
|
||||||
@ -41,16 +40,6 @@ public:
|
|||||||
int width(Painter &, LyXFont const &) const;
|
int width(Painter &, LyXFont const &) const;
|
||||||
///
|
///
|
||||||
void draw(Painter &, LyXFont const &, int baseline, float & x) const;
|
void draw(Painter &, LyXFont const &, int baseline, float & x) const;
|
||||||
#else
|
|
||||||
///
|
|
||||||
int Ascent(LyXFont const & font) const;
|
|
||||||
///
|
|
||||||
int Descent(LyXFont const & font) const;
|
|
||||||
///
|
|
||||||
int Width(LyXFont const & font) const;
|
|
||||||
///
|
|
||||||
void Draw(LyXFont, LyXScreen & scr, int baseline, float & x);
|
|
||||||
#endif
|
|
||||||
///
|
///
|
||||||
void Write(ostream &);
|
void Write(ostream &);
|
||||||
/// Parse the command.
|
/// Parse the command.
|
||||||
|
@ -15,9 +15,6 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "inseterror.h"
|
#include "inseterror.h"
|
||||||
#ifndef USE_PAINTER
|
|
||||||
#include "lyxdraw.h"
|
|
||||||
#endif
|
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
#include "lyx_gui_misc.h" // CancelCloseBoxCB
|
#include "lyx_gui_misc.h" // CancelCloseBoxCB
|
||||||
#include "Painter.h"
|
#include "Painter.h"
|
||||||
@ -47,58 +44,30 @@ InsetError::~InsetError()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_PAINTER
|
|
||||||
int InsetError::ascent(Painter &, LyXFont const & font) const
|
int InsetError::ascent(Painter &, LyXFont const & font) const
|
||||||
{
|
{
|
||||||
LyXFont efont;
|
LyXFont efont;
|
||||||
efont.setSize(font.size()).decSize();
|
efont.setSize(font.size()).decSize();
|
||||||
return efont.maxAscent() + 1;
|
return efont.maxAscent() + 1;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
int InsetError::Ascent(LyXFont const & font) const
|
|
||||||
{
|
|
||||||
LyXFont efont;
|
|
||||||
efont.setSize(font.size()).decSize();
|
|
||||||
return efont.maxAscent()+1;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_PAINTER
|
|
||||||
int InsetError::descent(Painter &, LyXFont const & font) const
|
int InsetError::descent(Painter &, LyXFont const & font) const
|
||||||
{
|
{
|
||||||
LyXFont efont;
|
LyXFont efont;
|
||||||
efont.setSize(font.size()).decSize();
|
efont.setSize(font.size()).decSize();
|
||||||
return efont.maxDescent() + 1;
|
return efont.maxDescent() + 1;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
int InsetError::Descent(LyXFont const & font) const
|
|
||||||
{
|
|
||||||
LyXFont efont;
|
|
||||||
efont.setSize(font.size()).decSize();
|
|
||||||
return efont.maxDescent()+1;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_PAINTER
|
|
||||||
int InsetError::width(Painter &, LyXFont const & font) const
|
int InsetError::width(Painter &, LyXFont const & font) const
|
||||||
{
|
{
|
||||||
LyXFont efont;
|
LyXFont efont;
|
||||||
efont.setSize(font.size()).decSize();
|
efont.setSize(font.size()).decSize();
|
||||||
return 6 + efont.textWidth(_("Error"), strlen(_("Error")));
|
return 6 + efont.textWidth(_("Error"), strlen(_("Error")));
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
int InsetError::Width(LyXFont const & font) const
|
|
||||||
{
|
|
||||||
LyXFont efont;
|
|
||||||
efont.setSize(font.size()).decSize();
|
|
||||||
return 6 + efont.textWidth(_("Error"), strlen(_("Error")));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_PAINTER
|
|
||||||
void InsetError::draw(Painter & pain, LyXFont const & font,
|
void InsetError::draw(Painter & pain, LyXFont const & font,
|
||||||
int baseline, float & x) const
|
int baseline, float & x) const
|
||||||
{
|
{
|
||||||
@ -120,27 +89,7 @@ void InsetError::draw(Painter & pain, LyXFont const & font,
|
|||||||
|
|
||||||
x += width(pain, font) - 1;
|
x += width(pain, font) - 1;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
void InsetError::Draw(LyXFont font, LyXScreen & scr,
|
|
||||||
int baseline, float & x)
|
|
||||||
{
|
|
||||||
LyXFont efont;
|
|
||||||
efont.setSize(font.size()).decSize();
|
|
||||||
efont.setLatex(LyXFont::ON);
|
|
||||||
|
|
||||||
// Draw as "Error" in a framed box
|
|
||||||
x += 1;
|
|
||||||
scr.fillRectangle(gc_lighted,
|
|
||||||
int(x), baseline - Ascent(font)+1,
|
|
||||||
Width(font)-2, Ascent(font)+ Descent(font)-2);
|
|
||||||
scr.drawRectangle(gc_foot,
|
|
||||||
int(x), baseline-Ascent(font)+1,
|
|
||||||
Width(font)-2, Ascent(font)+Descent(font)-2);
|
|
||||||
scr.drawString(efont, _("Error"), baseline, int(x+2));
|
|
||||||
|
|
||||||
x += Width(font) - 1;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void InsetError::Write(ostream &)
|
void InsetError::Write(ostream &)
|
||||||
{
|
{
|
||||||
|
@ -34,7 +34,6 @@ public:
|
|||||||
InsetError();
|
InsetError();
|
||||||
///
|
///
|
||||||
~InsetError();
|
~InsetError();
|
||||||
#ifdef USE_PAINTER
|
|
||||||
///
|
///
|
||||||
int ascent(Painter &, LyXFont const & font) const;
|
int ascent(Painter &, LyXFont const & font) const;
|
||||||
///
|
///
|
||||||
@ -44,16 +43,6 @@ public:
|
|||||||
///
|
///
|
||||||
void draw(Painter &, LyXFont const & font,
|
void draw(Painter &, LyXFont const & font,
|
||||||
int baseline, float & x) const;
|
int baseline, float & x) const;
|
||||||
#else
|
|
||||||
///
|
|
||||||
int Ascent(LyXFont const & font) const;
|
|
||||||
///
|
|
||||||
int Descent(LyXFont const & font) const;
|
|
||||||
///
|
|
||||||
int Width(LyXFont const & font) const;
|
|
||||||
///
|
|
||||||
void Draw(LyXFont font, LyXScreen & scr, int baseline, float & x);
|
|
||||||
#endif
|
|
||||||
///
|
///
|
||||||
void Write(ostream &);
|
void Write(ostream &);
|
||||||
///
|
///
|
||||||
|
@ -24,9 +24,6 @@
|
|||||||
#include "buffer.h"
|
#include "buffer.h"
|
||||||
#include "support/lstrings.h"
|
#include "support/lstrings.h"
|
||||||
#include "Painter.h"
|
#include "Painter.h"
|
||||||
#ifndef USE_PAINTER
|
|
||||||
#include "lyxdraw.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Info, used for the Info boxes */
|
/* Info, used for the Info boxes */
|
||||||
|
|
||||||
@ -56,46 +53,24 @@ InsetInfo::~InsetInfo()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_PAINTER
|
|
||||||
int InsetInfo::ascent(Painter &, LyXFont const & font) const
|
int InsetInfo::ascent(Painter &, LyXFont const & font) const
|
||||||
{
|
{
|
||||||
return font.maxAscent() + 1;
|
return font.maxAscent() + 1;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
int InsetInfo::Ascent(LyXFont const & font) const
|
|
||||||
{
|
|
||||||
return font.maxAscent() + 1;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_PAINTER
|
|
||||||
int InsetInfo::descent(Painter &, LyXFont const & font) const
|
int InsetInfo::descent(Painter &, LyXFont const & font) const
|
||||||
{
|
{
|
||||||
return font.maxDescent() + 1;
|
return font.maxDescent() + 1;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
int InsetInfo::Descent(LyXFont const & font) const
|
|
||||||
{
|
|
||||||
return font.maxDescent() + 1;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_PAINTER
|
|
||||||
int InsetInfo::width(Painter &, LyXFont const & font) const
|
int InsetInfo::width(Painter &, LyXFont const & font) const
|
||||||
{
|
{
|
||||||
return 6 + font.textWidth(_("Note"), strlen(_("Note")));
|
return 6 + font.textWidth(_("Note"), strlen(_("Note")));
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
int InsetInfo::Width(LyXFont const & font) const
|
|
||||||
{
|
|
||||||
return 6 + font.textWidth(_("Note"), strlen(_("Note")));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_PAINTER
|
|
||||||
void InsetInfo::draw(Painter & pain, LyXFont const & f,
|
void InsetInfo::draw(Painter & pain, LyXFont const & f,
|
||||||
int baseline, float & x) const
|
int baseline, float & x) const
|
||||||
{
|
{
|
||||||
@ -116,26 +91,6 @@ void InsetInfo::draw(Painter & pain, LyXFont const & f,
|
|||||||
pain.text(int(x + 2), baseline, _("Note"), font);
|
pain.text(int(x + 2), baseline, _("Note"), font);
|
||||||
x += width(pain, font) - 1;
|
x += width(pain, font) - 1;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
void InsetInfo::Draw(LyXFont font, LyXScreen & scr,
|
|
||||||
int baseline, float & x)
|
|
||||||
{
|
|
||||||
/* Info-insets are never LaTeX, so just correct the font */
|
|
||||||
font.setLatex(LyXFont::OFF);
|
|
||||||
|
|
||||||
// Draw as "Note" in a yellow box
|
|
||||||
x += 1;
|
|
||||||
scr.fillRectangle(gc_note,
|
|
||||||
int(x), baseline - Ascent(font)+1,
|
|
||||||
Width(font)-2, Ascent(font)+Descent(font)-2);
|
|
||||||
scr.drawRectangle(gc_note_frame,
|
|
||||||
int(x), baseline- Ascent(font)+1,
|
|
||||||
Width(font)-2, Ascent(font)+Descent(font)-2);
|
|
||||||
|
|
||||||
scr.drawString(font, _("Note"), baseline, int(x+2));
|
|
||||||
x += Width(font) - 1;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
void InsetInfo::Write(ostream & os)
|
void InsetInfo::Write(ostream & os)
|
||||||
|
@ -36,7 +36,6 @@ public:
|
|||||||
InsetInfo(string const & string);
|
InsetInfo(string const & string);
|
||||||
///
|
///
|
||||||
~InsetInfo();
|
~InsetInfo();
|
||||||
#ifdef USE_PAINTER
|
|
||||||
///
|
///
|
||||||
int ascent(Painter &, LyXFont const &) const;
|
int ascent(Painter &, LyXFont const &) const;
|
||||||
///
|
///
|
||||||
@ -45,16 +44,6 @@ public:
|
|||||||
int width(Painter &, LyXFont const &) const;
|
int width(Painter &, LyXFont const &) const;
|
||||||
///
|
///
|
||||||
void draw(Painter &, LyXFont const &, int baseline, float & x) const;
|
void draw(Painter &, LyXFont const &, int baseline, float & x) const;
|
||||||
#else
|
|
||||||
///
|
|
||||||
int Ascent(LyXFont const & font) const;
|
|
||||||
///
|
|
||||||
int Descent(LyXFont const & font) const;
|
|
||||||
///
|
|
||||||
int Width(LyXFont const & font) const;
|
|
||||||
///
|
|
||||||
void Draw(LyXFont font, LyXScreen & scr, int baseline, float & x);
|
|
||||||
#endif
|
|
||||||
///
|
///
|
||||||
void Write(ostream &);
|
void Write(ostream &);
|
||||||
///
|
///
|
||||||
|
@ -17,9 +17,6 @@
|
|||||||
#include "insetlatexaccent.h"
|
#include "insetlatexaccent.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "lyxrc.h"
|
#include "lyxrc.h"
|
||||||
#ifndef USE_PAINTER
|
|
||||||
#include "lyxdraw.h"
|
|
||||||
#endif
|
|
||||||
#include "support/lstrings.h"
|
#include "support/lstrings.h"
|
||||||
#include "Painter.h"
|
#include "Painter.h"
|
||||||
|
|
||||||
@ -255,7 +252,6 @@ void InsetLatexAccent::checkContents()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_PAINTER
|
|
||||||
int InsetLatexAccent::ascent(Painter &, LyXFont const & font) const
|
int InsetLatexAccent::ascent(Painter &, LyXFont const & font) const
|
||||||
{
|
{
|
||||||
// This function is a bit too simplistix and is just a
|
// This function is a bit too simplistix and is just a
|
||||||
@ -274,29 +270,8 @@ int InsetLatexAccent::ascent(Painter &, LyXFont const & font) const
|
|||||||
max = font.maxAscent() + 4;
|
max = font.maxAscent() + 4;
|
||||||
return max;
|
return max;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
int InsetLatexAccent::Ascent(LyXFont const & font) const
|
|
||||||
{
|
|
||||||
// This function is a bit too simplistix and is just a
|
|
||||||
// "try to make a fit for all accents" approach, to
|
|
||||||
// make it better we need to know what kind of accent is
|
|
||||||
// used and add to max based on that.
|
|
||||||
int max;
|
|
||||||
if (candisp) {
|
|
||||||
if (ic == ' ')
|
|
||||||
max = font.ascent('a');
|
|
||||||
else
|
|
||||||
max = font.ascent(ic);
|
|
||||||
if (plusasc)
|
|
||||||
max += (font.maxAscent() + 3) / 3;
|
|
||||||
} else
|
|
||||||
max = font.maxAscent() + 4;
|
|
||||||
return max;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_PAINTER
|
|
||||||
int InsetLatexAccent::descent(Painter &, LyXFont const & font) const
|
int InsetLatexAccent::descent(Painter &, LyXFont const & font) const
|
||||||
{
|
{
|
||||||
int max;
|
int max;
|
||||||
@ -311,25 +286,8 @@ int InsetLatexAccent::descent(Painter &, LyXFont const & font) const
|
|||||||
max = font.maxDescent() + 4;
|
max = font.maxDescent() + 4;
|
||||||
return max;
|
return max;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
int InsetLatexAccent::Descent(LyXFont const & font) const
|
|
||||||
{
|
|
||||||
int max;
|
|
||||||
if (candisp) {
|
|
||||||
if (ic == ' ')
|
|
||||||
max = font.descent('a');
|
|
||||||
else
|
|
||||||
max = font.descent(ic);
|
|
||||||
if (plusdesc)
|
|
||||||
max += 3;
|
|
||||||
} else
|
|
||||||
max = font.maxDescent() + 4;
|
|
||||||
return max;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_PAINTER
|
|
||||||
int InsetLatexAccent::width(Painter &, LyXFont const & font) const
|
int InsetLatexAccent::width(Painter &, LyXFont const & font) const
|
||||||
{
|
{
|
||||||
if (candisp)
|
if (candisp)
|
||||||
@ -337,15 +295,6 @@ int InsetLatexAccent::width(Painter &, LyXFont const & font) const
|
|||||||
else
|
else
|
||||||
return font.stringWidth(contents) + 4;
|
return font.stringWidth(contents) + 4;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
int InsetLatexAccent::Width(LyXFont const & font) const
|
|
||||||
{
|
|
||||||
if (candisp)
|
|
||||||
return font.textWidth(&ic, 1);
|
|
||||||
else
|
|
||||||
return font.stringWidth(contents) + 4;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
int InsetLatexAccent::Lbearing(LyXFont const & font) const
|
int InsetLatexAccent::Lbearing(LyXFont const & font) const
|
||||||
@ -360,7 +309,6 @@ int InsetLatexAccent::Rbearing(LyXFont const & font) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_PAINTER
|
|
||||||
bool InsetLatexAccent::DisplayISO8859_9(Painter & pain, LyXFont const & font,
|
bool InsetLatexAccent::DisplayISO8859_9(Painter & pain, LyXFont const & font,
|
||||||
int baseline,
|
int baseline,
|
||||||
float & x) const
|
float & x) const
|
||||||
@ -402,53 +350,8 @@ bool InsetLatexAccent::DisplayISO8859_9(Painter & pain, LyXFont const & font,
|
|||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
bool InsetLatexAccent::DisplayISO8859_9(LyXFont font,
|
|
||||||
LyXScreen & scr,
|
|
||||||
int baseline,
|
|
||||||
float & x)
|
|
||||||
{
|
|
||||||
unsigned char tmpic = ic;
|
|
||||||
|
|
||||||
switch (modtype) {
|
|
||||||
case CEDILLA:
|
|
||||||
{
|
|
||||||
if (ic == 'c') tmpic = 0xe7;
|
|
||||||
if (ic == 'C') tmpic = 0xc7;
|
|
||||||
if (ic == 's') tmpic = 0xfe;
|
|
||||||
if (ic == 'S') tmpic = 0xde;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case BREVE:
|
|
||||||
{ if (ic == 'g') tmpic = 0xf0;
|
|
||||||
if (ic == 'G') tmpic = 0xd0;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case UMLAUT:
|
|
||||||
{
|
|
||||||
if (ic == 'o') tmpic = 0xf6;
|
|
||||||
if (ic == 'O') tmpic = 0xd6;
|
|
||||||
if (ic == 'u') tmpic = 0xfc;
|
|
||||||
if (ic == 'U') tmpic = 0xdc;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case DOT: if (ic == 'I') tmpic = 0xdd; break;
|
|
||||||
case DOT_LESS_I: tmpic = 0xfd; break;
|
|
||||||
default: return false;
|
|
||||||
}
|
|
||||||
if (tmpic != ic) {
|
|
||||||
char ch = char(tmpic);
|
|
||||||
scr.drawText(font, &ch, 1, baseline, int(x));
|
|
||||||
x += Width (font);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_PAINTER
|
|
||||||
void InsetLatexAccent::draw(Painter & pain, LyXFont const & font,
|
void InsetLatexAccent::draw(Painter & pain, LyXFont const & font,
|
||||||
int baseline, float & x) const
|
int baseline, float & x) const
|
||||||
{
|
{
|
||||||
@ -487,10 +390,6 @@ void InsetLatexAccent::draw(Painter & pain, LyXFont const & font,
|
|||||||
// first the letter
|
// first the letter
|
||||||
pain.text(int(x), baseline, ic, font);
|
pain.text(int(x), baseline, ic, font);
|
||||||
|
|
||||||
#if 0
|
|
||||||
GC pgc = GetAccentGC(font, int((hg + 3.0) / 5.0));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (remdot) {
|
if (remdot) {
|
||||||
int tmpvar = baseline - font.ascent('i');
|
int tmpvar = baseline - font.ascent('i');
|
||||||
float tmpx = 0;
|
float tmpx = 0;
|
||||||
@ -520,7 +419,8 @@ void InsetLatexAccent::draw(Painter & pain, LyXFont const & font,
|
|||||||
pain.line(int(x2), int(y + hg),
|
pain.line(int(x2), int(y + hg),
|
||||||
int(x2 + hg35), y + hg35);
|
int(x2 + hg35), y + hg35);
|
||||||
#else
|
#else
|
||||||
pain.text(x2 - font.width(0xB4) / 2, baseline,
|
pain.text(x2 - (font.rbearing(0xB4) - font.lbearing(0xB4)) / 2,
|
||||||
|
baseline - font.ascent(ic) - font.descent(0xB4) - (font.ascent(0xB4) + font.descent(0xB4)) / 2,
|
||||||
char(0xB4), font);
|
char(0xB4), font);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
@ -531,7 +431,8 @@ void InsetLatexAccent::draw(Painter & pain, LyXFont const & font,
|
|||||||
pain.line(int(x2), int(y + hg),
|
pain.line(int(x2), int(y + hg),
|
||||||
int(x2 - hg35), y + hg35);
|
int(x2 - hg35), y + hg35);
|
||||||
#else
|
#else
|
||||||
pain.text(x2 - font.width(0x60) / 2, baseline,
|
pain.text(x2 - (font.rbearing(0x60) - font.lbearing(0x60)) / 2,
|
||||||
|
baseline - font.ascent(ic) - font.descent(0x60) - (font.ascent(0x60) + font.descent(0x60)) / 2.0,
|
||||||
char(0x60), font);
|
char(0x60), font);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
@ -544,7 +445,8 @@ void InsetLatexAccent::draw(Painter & pain, LyXFont const & font,
|
|||||||
int(x2 + wid * 0.4),
|
int(x2 + wid * 0.4),
|
||||||
int(y + hg));
|
int(y + hg));
|
||||||
#else
|
#else
|
||||||
pain.text(x2 - font.width(0xAF) / 2, baseline,
|
pain.text(x2 - (font.rbearing(0xAF) - font.lbearing(0xAF)) / 2,
|
||||||
|
baseline - font.ascent(ic) - font.descent(0xAF) - (font.ascent(0xAF) + font.descent(0xAF)),
|
||||||
char(0xAF), font);
|
char(0xAF), font);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
@ -570,8 +472,8 @@ void InsetLatexAccent::draw(Painter & pain, LyXFont const & font,
|
|||||||
|
|
||||||
pain.lines(xp, yp, 4);
|
pain.lines(xp, yp, 4);
|
||||||
#else
|
#else
|
||||||
pain.text(x2 - font.width('~') / 2,
|
pain.text(x2 - (font.rbearing('~') - font.lbearing('~')) / 2,
|
||||||
baseline - font.ascent('~'),
|
baseline - font.ascent(ic) - font.descent('~') - (font.ascent('~') + font.descent('~')) / 2,
|
||||||
'~', font);
|
'~', font);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
@ -584,7 +486,7 @@ void InsetLatexAccent::draw(Painter & pain, LyXFont const & font,
|
|||||||
int(x2 + wid * 0.4),
|
int(x2 + wid * 0.4),
|
||||||
y + hg / 2.0);
|
y + hg / 2.0);
|
||||||
#else
|
#else
|
||||||
pain.text(x2 - font.width(0x5F) / 2, baseline,
|
pain.text(x2 - (font.rbearing(0x5F) - font.lbearing(0x5F)) / 2, baseline,
|
||||||
char(0x5F), font);
|
char(0x5F), font);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
@ -608,7 +510,7 @@ void InsetLatexAccent::draw(Painter & pain, LyXFont const & font,
|
|||||||
|
|
||||||
pain.lines(xp, yp, 4);
|
pain.lines(xp, yp, 4);
|
||||||
#else
|
#else
|
||||||
pain.text(x2 - font.width(0xB8) / 2, baseline,
|
pain.text(x2 - (font.rbearing(0xB8) - font.lbearing(0xB8)) / 2, baseline,
|
||||||
char(0xB8), font);
|
char(0xB8), font);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@ -616,17 +518,29 @@ void InsetLatexAccent::draw(Painter & pain, LyXFont const & font,
|
|||||||
}
|
}
|
||||||
case UNDERDOT: // underdot
|
case UNDERDOT: // underdot
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
pain.arc(int(x2), y + hg35,
|
pain.arc(int(x2), y + hg35,
|
||||||
3, 3, 0, 360 * 64);
|
3, 3, 0, 360 * 64);
|
||||||
|
#else
|
||||||
|
pain.text(x2 - (font.rbearing('.') - font.lbearing('.')) / 2.0,
|
||||||
|
baseline + 3.0 / 2.0 * (font.ascent('.') + font.descent('.')),
|
||||||
|
'.', font);
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case DOT: // dot
|
case DOT: // dot
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
pain.arc(int(x2), y + hg * 0.5,
|
pain.arc(int(x2), y + hg * 0.5,
|
||||||
(hg + 3.0)/5.0,
|
(hg + 3.0)/5.0,
|
||||||
(hg + 3.0)/5.0,
|
(hg + 3.0)/5.0,
|
||||||
0, 360 * 64);
|
0, 360 * 64);
|
||||||
|
#else
|
||||||
|
pain.text(x2 - (font.rbearing('.') - font.lbearing('.')) / 2.0,
|
||||||
|
baseline - font.ascent(ic) - font.descent('.') - (font.ascent('.') + font.descent('.')) / 2,
|
||||||
|
'.', font);
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -637,8 +551,11 @@ void InsetLatexAccent::draw(Painter & pain, LyXFont const & font,
|
|||||||
y + (hg / 2.0), hg, hg , 0,
|
y + (hg / 2.0), hg, hg , 0,
|
||||||
360 * 64);
|
360 * 64);
|
||||||
#else
|
#else
|
||||||
pain.text(x2 - font.width(0xB0) / 2, baseline,
|
LyXFont tmpf(font);
|
||||||
char(0xB0), font);
|
tmpf.decSize().decSize();
|
||||||
|
pain.text(x2 - (tmpf.rbearing(0xB0) - tmpf.lbearing(0xB0)) / 2.0,
|
||||||
|
baseline - font.ascent(ic) - tmpf.descent(0xB0) - (tmpf.ascent(0xB0) + tmpf.descent(0xB0)) / 3.0,
|
||||||
|
char(0xB0), tmpf);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -685,6 +602,7 @@ void InsetLatexAccent::draw(Painter & pain, LyXFont const & font,
|
|||||||
}
|
}
|
||||||
case HUNGARIAN_UMLAUT: // hung. umlaut
|
case HUNGARIAN_UMLAUT: // hung. umlaut
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
int xs1[2], xs2[2], ys1[2], ys2[2];
|
int xs1[2], xs2[2], ys1[2], ys2[2];
|
||||||
|
|
||||||
xs1[0] = int(x2 - (hg / 2.0));
|
xs1[0] = int(x2 - (hg / 2.0));
|
||||||
@ -700,6 +618,14 @@ void InsetLatexAccent::draw(Painter & pain, LyXFont const & font,
|
|||||||
ys2[1] = int(y + hg35);
|
ys2[1] = int(y + hg35);
|
||||||
|
|
||||||
pain.segments(xs1, ys1, xs2, ys2, 2);
|
pain.segments(xs1, ys1, xs2, ys2, 2);
|
||||||
|
#else
|
||||||
|
pain.text(x2 - (font.rbearing('´') - font.lbearing('´')),
|
||||||
|
baseline - font.ascent(ic) - font.descent('´') - (font.ascent('´') + font.descent('´')) / 2,
|
||||||
|
'´', font);
|
||||||
|
pain.text(x2,
|
||||||
|
baseline - font.ascent(ic) - font.descent('´') - (font.ascent('´') + font.descent('´')) / 2,
|
||||||
|
'´', font);
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case UMLAUT: // umlaut
|
case UMLAUT: // umlaut
|
||||||
@ -724,7 +650,8 @@ void InsetLatexAccent::draw(Painter & pain, LyXFont const & font,
|
|||||||
rad, rad, 0, 360*64);
|
rad, rad, 0, 360*64);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
pain.text(x2 - font.width('¨') / 2, baseline,
|
pain.text(x2 - (font.rbearing('¨') - font.lbearing('¨')) / 2,
|
||||||
|
baseline - font.ascent(ic) - font.descent('¨') - ( font.ascent('¨') + font.descent('¨')) / 2,
|
||||||
'¨', font);
|
'¨', font);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
@ -739,8 +666,11 @@ void InsetLatexAccent::draw(Painter & pain, LyXFont const & font,
|
|||||||
xp[2] = int(x2 + hg35); yp[2] = y + int(hg);
|
xp[2] = int(x2 + hg35); yp[2] = y + int(hg);
|
||||||
pain.lines(xp, yp, 3);
|
pain.lines(xp, yp, 3);
|
||||||
#else
|
#else
|
||||||
pain.text(x2 - font.width(0x5E) / 2, baseline,
|
LyXFont tmpf(font);
|
||||||
char(0x5E), font);
|
tmpf.decSize().decSize().decSize();
|
||||||
|
pain.text(x2 - (tmpf.rbearing(0x5E) - tmpf.lbearing(0x5E)) / 2,
|
||||||
|
baseline - font.ascent(ic) - tmpf.descent(0x5E) - (tmpf.ascent(0x5E) + tmpf.descent(0x5E)) / 3.0,
|
||||||
|
char(0x5E), tmpf);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -799,278 +729,6 @@ void InsetLatexAccent::draw(Painter & pain, LyXFont const & font,
|
|||||||
}
|
}
|
||||||
x += width(pain, font);
|
x += width(pain, font);
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
void InsetLatexAccent::Draw(LyXFont font,
|
|
||||||
LyXScreen & scr,
|
|
||||||
int baseline,
|
|
||||||
float & x)
|
|
||||||
{
|
|
||||||
if (lyxrc->font_norm == "iso8859-9")
|
|
||||||
if (DisplayISO8859_9 (font, scr, baseline, x))
|
|
||||||
return;
|
|
||||||
|
|
||||||
/* draw it! */
|
|
||||||
// All the manually drawn accents in this function could use an
|
|
||||||
// overhaul. Different ways of drawing (what metrics to use)
|
|
||||||
// should also be considered.
|
|
||||||
|
|
||||||
if (candisp) {
|
|
||||||
int asc = Ascent(font);
|
|
||||||
int desc = Descent(font);
|
|
||||||
int wid = Width(font);
|
|
||||||
float x2 = x + (Rbearing(font) - Lbearing(font)) / 2.0;
|
|
||||||
float hg;
|
|
||||||
int y;
|
|
||||||
if (plusasc) {
|
|
||||||
// mark at the top
|
|
||||||
hg = font.maxDescent();
|
|
||||||
y = baseline - asc;
|
|
||||||
|
|
||||||
if (font.shape() == LyXFont::ITALIC_SHAPE)
|
|
||||||
x2 += (4.0 * hg) / 5.0; // italic
|
|
||||||
} else {
|
|
||||||
// at the bottom
|
|
||||||
hg = desc;
|
|
||||||
y = baseline;
|
|
||||||
}
|
|
||||||
|
|
||||||
float hg35 = float(hg * 3.0) / 5.0;
|
|
||||||
|
|
||||||
// display with proper accent mark
|
|
||||||
// first the letter
|
|
||||||
scr.drawText(font, &ic, 1, baseline, int(x));
|
|
||||||
|
|
||||||
GC pgc = GetAccentGC(font, int((hg + 3.0) / 5.0));
|
|
||||||
|
|
||||||
if (remdot) {
|
|
||||||
int tmpvar = baseline - font.ascent('i');
|
|
||||||
float tmpx = 0;
|
|
||||||
if (font.shape() == LyXFont::ITALIC_SHAPE)
|
|
||||||
tmpx += (8.0 * hg) / 10.0; // italic
|
|
||||||
lyxerr[Debug::KEY] << "Removing dot." << endl;
|
|
||||||
// remove the dot first
|
|
||||||
scr.fillRectangle(gc_clear, int(x + tmpx),
|
|
||||||
tmpvar, wid,
|
|
||||||
font.ascent('i') -
|
|
||||||
font.ascent('x') - 1);
|
|
||||||
// the five lines below is a simple hack to
|
|
||||||
// make the display of accent 'i' and 'j'
|
|
||||||
// better. It makes the accent be written
|
|
||||||
// closer to the top of the dot-less 'i' or 'j'.
|
|
||||||
char tmpic = ic; // store the ic when we
|
|
||||||
ic = 'x'; // calculates the ascent of
|
|
||||||
asc = Ascent(font); // the dot-less version (here: 'x')
|
|
||||||
ic = tmpic; // set the orig ic back
|
|
||||||
y = baseline - asc; // update to new y coord.
|
|
||||||
}
|
|
||||||
// now the rest - draw within (x, y, x+wid, y+hg)
|
|
||||||
switch (modtype) {
|
|
||||||
case ACUTE: // acute
|
|
||||||
{
|
|
||||||
scr.drawLine(pgc, int(x2), int(y + hg),
|
|
||||||
int(x2 + hg35), y + hg35);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case GRAVE: // grave
|
|
||||||
{
|
|
||||||
scr.drawLine(pgc, int(x2), int(y + hg),
|
|
||||||
int(x2 - hg35), y + hg35);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case MACRON: // macron
|
|
||||||
{
|
|
||||||
scr.drawLine(pgc,
|
|
||||||
int(x2 - wid * 0.4),
|
|
||||||
int(y + hg),
|
|
||||||
int(x2 + wid * 0.4),
|
|
||||||
int(y + hg));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case TILDE: // tilde
|
|
||||||
{
|
|
||||||
if (hg35 > 2.0) hg35 -= 1.0;
|
|
||||||
x2 += (hg35 / 2.0);
|
|
||||||
XPoint p[4];
|
|
||||||
p[0].x = int(x2 - 2.0 * hg35); p[0].y = int(y + hg);
|
|
||||||
p[1].x = int(x2 - hg35); p[1].y = int(y + hg35);
|
|
||||||
p[2].x = int(x2); p[2].y = int(y + hg);
|
|
||||||
p[3].x = int(x2 + hg35); p[3].y = int(y + hg35);
|
|
||||||
scr.drawLines(pgc, p, 4);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case UNDERBAR: // underbar
|
|
||||||
{
|
|
||||||
scr.drawLine(pgc,
|
|
||||||
int(x2 - wid * 0.4),
|
|
||||||
y + (hg / 2.0),
|
|
||||||
int(x2 + wid * 0.4),
|
|
||||||
y + (hg / 2.0));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case CEDILLA: // cedilla
|
|
||||||
{
|
|
||||||
XPoint p[4];
|
|
||||||
p[0].x = int(x2); p[0].y = y;
|
|
||||||
p[1].x = int(x2); p[1].y = y + int(hg / 3.0);
|
|
||||||
p[2].x = int(x2 + (hg / 3.0));
|
|
||||||
p[2].y = y + int(hg / 2.0);
|
|
||||||
p[3].x = int(x2 - (hg / 4.0)); p[3].y = y + int(hg);
|
|
||||||
scr.drawLines(pgc, p, 4);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case UNDERDOT: // underdot
|
|
||||||
{
|
|
||||||
scr.fillArc(pgc, int(x2), y + hg35,
|
|
||||||
3, 3, 0, 360*64);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case DOT: // dot
|
|
||||||
{
|
|
||||||
scr.fillArc(pgc, int(x2), y + hg * 0.5,
|
|
||||||
(hg + 3.0)/5.0,
|
|
||||||
(hg + 3.0)/5.0, 0, 360*64);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case CIRCLE: // circle
|
|
||||||
{
|
|
||||||
scr.drawArc(pgc, int(x2 - (hg / 2.0)),
|
|
||||||
y + (hg / 2.0), hg, hg, 0,
|
|
||||||
360*64);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case TIE: // tie
|
|
||||||
{
|
|
||||||
scr.drawArc(pgc,
|
|
||||||
int(x2 + hg35), y + (hg / 2.0),
|
|
||||||
2 * hg, hg, 0, 360*32);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case BREVE: // breve
|
|
||||||
{
|
|
||||||
scr.drawArc(pgc,
|
|
||||||
int(x2 - (hg / 2.0)), y,
|
|
||||||
hg, hg, 0, -360*32);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case CARON: // caron
|
|
||||||
{
|
|
||||||
XPoint p[3];
|
|
||||||
p[0].x = int(x2 - hg35); p[0].y = int(y + hg35);
|
|
||||||
p[1].x = int(x2); p[1].y = int(y + hg);
|
|
||||||
p[2].x = int(x2 + hg35); p[2].y = int(y + hg35);
|
|
||||||
scr.drawLines(pgc, p, 3);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case SPECIAL_CARON: // special caron
|
|
||||||
{
|
|
||||||
switch (ic) {
|
|
||||||
case 'L': wid = int(4.0 * wid / 5.0); break;
|
|
||||||
case 't': y -= int(hg35 / 2.0); break;
|
|
||||||
}
|
|
||||||
XPoint p[3];
|
|
||||||
p[0].x = int(x + wid); p[0].y = int(y + hg35 + hg);
|
|
||||||
p[1].x = int(x + wid + (hg35 / 2.0));
|
|
||||||
p[1].y = int(y + hg + (hg35 / 2.0));
|
|
||||||
p[2].x = int(x + wid + (hg35 / 2.0));
|
|
||||||
p[2].y = y + int(hg);
|
|
||||||
scr.drawLines(pgc, p, 3);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case HUNGARIAN_UMLAUT: // hung. umlaut
|
|
||||||
{
|
|
||||||
XSegment s[2];
|
|
||||||
s[0].x1= int(x2 - (hg / 2.0)); s[0].y1 = int(y + hg);
|
|
||||||
s[0].x2 = int(x2 + hg35 - (hg / 2.0));
|
|
||||||
s[0].y2 = int(y + hg35);
|
|
||||||
s[1].x1 = int(x2 + (hg / 2.0));
|
|
||||||
s[1].y1 = int(y + hg);
|
|
||||||
s[1].x2 = int(x2 + hg35 + (hg / 2.0));
|
|
||||||
s[1].y2 = int(y + hg35);
|
|
||||||
|
|
||||||
scr.drawSegments(pgc, s, 2);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case UMLAUT: // umlaut
|
|
||||||
{
|
|
||||||
float rad = hg / 2.0;
|
|
||||||
if (rad <= 1.0) {
|
|
||||||
scr.drawPoint(pgc,
|
|
||||||
int(x2 - ((4.0 * hg) / 7.0)),
|
|
||||||
y + hg35);
|
|
||||||
scr.drawPoint(pgc,
|
|
||||||
int(x2 + ((4.0 * hg) / 7.0)),
|
|
||||||
y + hg35);
|
|
||||||
} else {
|
|
||||||
rad += .5; // this ensures that f.ex. 1.5 will
|
|
||||||
// not be rounded down to .5 and then
|
|
||||||
// converted to int = 0
|
|
||||||
scr.fillArc(pgc, int(x2 - ((2.0 * hg) / 4.0)),
|
|
||||||
y + hg35,
|
|
||||||
rad, rad, 0, 360*64);
|
|
||||||
scr.fillArc(pgc, int(x2 + ((2.0 * hg) / 4.0)),
|
|
||||||
y + hg35,
|
|
||||||
rad, rad, 0, 360*64);
|
|
||||||
}
|
|
||||||
//scr.drawText(font, "¨", 1, baseline, x2);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case CIRCUMFLEX: // circumflex
|
|
||||||
{
|
|
||||||
XPoint p[3];
|
|
||||||
p[0].x = int(x2 - hg35); p[0].y = y + int(hg);
|
|
||||||
p[1].x = int(x2); p[1].y = int(y + hg35);
|
|
||||||
p[2].x = int(x2 + hg35); p[2].y = y + int(hg);
|
|
||||||
scr.drawLines(pgc, p, 3);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case OGONEK: // ogonek
|
|
||||||
{
|
|
||||||
// this does probably not look like an ogonek, so
|
|
||||||
// it should certainly be refined
|
|
||||||
XPoint p[4];
|
|
||||||
p[0].x = int(x2); p[0].y = y;
|
|
||||||
p[1].x = int(x2); p[1].y = y + int(hg35);
|
|
||||||
p[2].x = int(x2 - hg35);
|
|
||||||
p[2].y = y + int(hg / 2.0);
|
|
||||||
p[3].x = int(x2 + (hg / 4.0)); p[3].y = y + int(hg);
|
|
||||||
scr.drawLines(pgc, p, 4);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case lSLASH:
|
|
||||||
case LSLASH:
|
|
||||||
{
|
|
||||||
XPoint p[2];
|
|
||||||
p[0].x = int(x);
|
|
||||||
p[0].y = y + int(3.0 * hg);
|
|
||||||
p[1].x = int(x + float(wid) * 0.75);
|
|
||||||
p[1].y = y + int(hg);
|
|
||||||
scr.drawLines(pgc, p, 2);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case DOT_LESS_I: // dotless-i
|
|
||||||
case DOT_LESS_J: // dotless-j
|
|
||||||
{
|
|
||||||
// nothing to do for these
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
scr.fillRectangle(gc_lighted,
|
|
||||||
int(x + 1), baseline - Ascent(font) + 1,
|
|
||||||
Width(font) - 2,
|
|
||||||
Ascent(font) + Descent(font) - 2);
|
|
||||||
|
|
||||||
scr.drawRectangle(gc_lighted,
|
|
||||||
int(x), baseline - Ascent(font),
|
|
||||||
Width(font) - 1,
|
|
||||||
Ascent(font) + Descent(font) - 1);
|
|
||||||
scr.drawString(font, contents, baseline, int(x + 2));
|
|
||||||
}
|
|
||||||
x += Width(font);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
void InsetLatexAccent::Write(ostream & os)
|
void InsetLatexAccent::Write(ostream & os)
|
||||||
|
@ -33,7 +33,6 @@ public:
|
|||||||
InsetLatexAccent();
|
InsetLatexAccent();
|
||||||
///
|
///
|
||||||
InsetLatexAccent(string const & string);
|
InsetLatexAccent(string const & string);
|
||||||
#ifdef USE_PAINTER
|
|
||||||
///
|
///
|
||||||
int ascent(Painter &, LyXFont const &) const;
|
int ascent(Painter &, LyXFont const &) const;
|
||||||
///
|
///
|
||||||
@ -42,29 +41,13 @@ public:
|
|||||||
int width(Painter &, LyXFont const &) const;
|
int width(Painter &, LyXFont const &) const;
|
||||||
///
|
///
|
||||||
void draw(Painter &, LyXFont const &, int baseline, float & x) const;
|
void draw(Painter &, LyXFont const &, int baseline, float & x) const;
|
||||||
#else
|
|
||||||
///
|
|
||||||
int Ascent(LyXFont const & font) const;
|
|
||||||
///
|
|
||||||
int Descent(LyXFont const & font) const;
|
|
||||||
///
|
|
||||||
int Width(LyXFont const & font) const;
|
|
||||||
///
|
|
||||||
void Draw(LyXFont, LyXScreen & scr, int baseline, float & x);
|
|
||||||
#endif
|
|
||||||
///
|
///
|
||||||
int Lbearing(LyXFont const & font) const;
|
int Lbearing(LyXFont const & font) const;
|
||||||
///
|
///
|
||||||
int Rbearing(LyXFont const & font) const;
|
int Rbearing(LyXFont const & font) const;
|
||||||
#ifdef USE_PAINTER
|
|
||||||
///
|
///
|
||||||
bool DisplayISO8859_9(Painter &, LyXFont const & font,
|
bool DisplayISO8859_9(Painter &, LyXFont const & font,
|
||||||
int baseline, float & x) const;
|
int baseline, float & x) const;
|
||||||
#else
|
|
||||||
///
|
|
||||||
bool DisplayISO8859_9(LyXFont font, LyXScreen & scr,
|
|
||||||
int baseline, float & x);
|
|
||||||
#endif
|
|
||||||
///
|
///
|
||||||
void Write(ostream &);
|
void Write(ostream &);
|
||||||
///
|
///
|
||||||
|
@ -156,33 +156,18 @@ string InsetQuotes::DispString() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_PAINTER
|
|
||||||
int InsetQuotes::ascent(Painter &, LyXFont const & font) const
|
int InsetQuotes::ascent(Painter &, LyXFont const & font) const
|
||||||
{
|
{
|
||||||
return font.maxAscent();
|
return font.maxAscent();
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
int InsetQuotes::Ascent(LyXFont const & font) const
|
|
||||||
{
|
|
||||||
return font.maxAscent();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_PAINTER
|
|
||||||
int InsetQuotes::descent(Painter &, LyXFont const & font) const
|
int InsetQuotes::descent(Painter &, LyXFont const & font) const
|
||||||
{
|
{
|
||||||
return font.maxDescent();
|
return font.maxDescent();
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
int InsetQuotes::Descent(LyXFont const & font) const
|
|
||||||
{
|
|
||||||
return font.maxDescent();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_PAINTER
|
|
||||||
int InsetQuotes::width(Painter &, LyXFont const & font) const
|
int InsetQuotes::width(Painter &, LyXFont const & font) const
|
||||||
{
|
{
|
||||||
string text = DispString();
|
string text = DispString();
|
||||||
@ -199,24 +184,6 @@ int InsetQuotes::width(Painter &, LyXFont const & font) const
|
|||||||
|
|
||||||
return w;
|
return w;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
int InsetQuotes::Width(LyXFont const & font) const
|
|
||||||
{
|
|
||||||
string text = DispString();
|
|
||||||
int w = 0;
|
|
||||||
|
|
||||||
for (string::size_type i = 0; i < text.length(); ++i) {
|
|
||||||
if (text[i] == ' ')
|
|
||||||
w += font.width('i');
|
|
||||||
else if (i == 0 || text[i] != text[i-1])
|
|
||||||
w += font.width(text[i]);
|
|
||||||
else
|
|
||||||
w += font.width(',');
|
|
||||||
}
|
|
||||||
|
|
||||||
return w;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
LyXFont InsetQuotes::ConvertFont(LyXFont font)
|
LyXFont InsetQuotes::ConvertFont(LyXFont font)
|
||||||
@ -227,7 +194,6 @@ LyXFont InsetQuotes::ConvertFont(LyXFont font)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_PAINTER
|
|
||||||
void InsetQuotes::draw(Painter & pain, LyXFont const & font,
|
void InsetQuotes::draw(Painter & pain, LyXFont const & font,
|
||||||
int baseline, float & x) const
|
int baseline, float & x) const
|
||||||
{
|
{
|
||||||
@ -236,16 +202,6 @@ void InsetQuotes::draw(Painter & pain, LyXFont const & font,
|
|||||||
pain.text(int(x), baseline, text, font);
|
pain.text(int(x), baseline, text, font);
|
||||||
x += width(pain, font);
|
x += width(pain, font);
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
void InsetQuotes::Draw(LyXFont font, LyXScreen & scr,
|
|
||||||
int baseline, float & x)
|
|
||||||
{
|
|
||||||
string text = DispString();
|
|
||||||
|
|
||||||
scr.drawString(font, text, baseline, int(x));
|
|
||||||
x += Width(font);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
void InsetQuotes::Write(ostream & os)
|
void InsetQuotes::Write(ostream & os)
|
||||||
|
@ -70,7 +70,6 @@ public:
|
|||||||
/// Create the right quote inset after character c
|
/// Create the right quote inset after character c
|
||||||
InsetQuotes(char c, BufferParams const & params);
|
InsetQuotes(char c, BufferParams const & params);
|
||||||
|
|
||||||
#ifdef USE_PAINTER
|
|
||||||
///
|
///
|
||||||
int ascent(Painter &, LyXFont const &) const;
|
int ascent(Painter &, LyXFont const &) const;
|
||||||
///
|
///
|
||||||
@ -79,16 +78,6 @@ public:
|
|||||||
int width(Painter &, LyXFont const &) const;
|
int width(Painter &, LyXFont const &) const;
|
||||||
///
|
///
|
||||||
void draw(Painter &, LyXFont const &, int baseline, float & x) const;
|
void draw(Painter &, LyXFont const &, int baseline, float & x) const;
|
||||||
#else
|
|
||||||
///
|
|
||||||
int Ascent(LyXFont const & font) const;
|
|
||||||
///
|
|
||||||
int Descent(LyXFont const & font) const;
|
|
||||||
///
|
|
||||||
int Width(LyXFont const & font) const;
|
|
||||||
///
|
|
||||||
void Draw(LyXFont font, LyXScreen & scr, int baseline, float & x);
|
|
||||||
#endif
|
|
||||||
///
|
///
|
||||||
LyXFont ConvertFont(LyXFont font);
|
LyXFont ConvertFont(LyXFont font);
|
||||||
///
|
///
|
||||||
|
@ -17,42 +17,25 @@
|
|||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "LaTeXFeatures.h"
|
#include "LaTeXFeatures.h"
|
||||||
#include "Painter.h"
|
#include "Painter.h"
|
||||||
#ifndef USE_PAINTER
|
|
||||||
#include "lyxdraw.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
InsetSpecialChar::InsetSpecialChar(Kind k)
|
InsetSpecialChar::InsetSpecialChar(Kind k)
|
||||||
: kind(k)
|
: kind(k)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_PAINTER
|
|
||||||
int InsetSpecialChar::ascent(Painter &, LyXFont const & font) const
|
int InsetSpecialChar::ascent(Painter &, LyXFont const & font) const
|
||||||
{
|
{
|
||||||
return font.maxAscent();
|
return font.maxAscent();
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
int InsetSpecialChar::Ascent(LyXFont const & font) const
|
|
||||||
{
|
|
||||||
return font.maxAscent();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_PAINTER
|
|
||||||
int InsetSpecialChar::descent(Painter &, LyXFont const & font) const
|
int InsetSpecialChar::descent(Painter &, LyXFont const & font) const
|
||||||
{
|
{
|
||||||
return font.maxDescent();
|
return font.maxDescent();
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
int InsetSpecialChar::Descent(LyXFont const & font) const
|
|
||||||
{
|
|
||||||
return font.maxDescent();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_PAINTER
|
|
||||||
int InsetSpecialChar::width(Painter &, LyXFont const & font) const
|
int InsetSpecialChar::width(Painter &, LyXFont const & font) const
|
||||||
{
|
{
|
||||||
LyXFont f(font);
|
LyXFont f(font);
|
||||||
@ -78,36 +61,8 @@ int InsetSpecialChar::width(Painter &, LyXFont const & font) const
|
|||||||
}
|
}
|
||||||
return 1; // To shut up gcc
|
return 1; // To shut up gcc
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
int InsetSpecialChar::Width(LyXFont const & font) const
|
|
||||||
{
|
|
||||||
LyXFont f = font;
|
|
||||||
switch (kind) {
|
|
||||||
case HYPHENATION:
|
|
||||||
{
|
|
||||||
int w = f.textWidth("-", 1);
|
|
||||||
if (w > 5)
|
|
||||||
w -= 2; // to make it look shorter
|
|
||||||
return w;
|
|
||||||
}
|
|
||||||
case END_OF_SENTENCE:
|
|
||||||
{
|
|
||||||
return f.textWidth(".", 1);
|
|
||||||
}
|
|
||||||
case LDOTS:
|
|
||||||
{
|
|
||||||
return f.textWidth(". . .", 5);
|
|
||||||
}
|
|
||||||
case MENU_SEPARATOR: {
|
|
||||||
return f.textWidth(" x ", 3);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 1; // To shut up gcc
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_PAINTER
|
|
||||||
void InsetSpecialChar::draw(Painter & pain, LyXFont const & f,
|
void InsetSpecialChar::draw(Painter & pain, LyXFont const & f,
|
||||||
int baseline, float & x) const
|
int baseline, float & x) const
|
||||||
{
|
{
|
||||||
@ -152,49 +107,6 @@ void InsetSpecialChar::draw(Painter & pain, LyXFont const & f,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
void InsetSpecialChar::Draw(LyXFont font, LyXScreen & scr,
|
|
||||||
int baseline, float & x)
|
|
||||||
{
|
|
||||||
switch (kind) {
|
|
||||||
case HYPHENATION:
|
|
||||||
{
|
|
||||||
font.setColor(LyXFont::BLUE);
|
|
||||||
scr.drawText(font, "-", 1, baseline, int(x));
|
|
||||||
x += Width(font);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case END_OF_SENTENCE:
|
|
||||||
{
|
|
||||||
font.setColor(LyXFont::BLUE);
|
|
||||||
scr.drawText(font, ".", 1, baseline, int(x));
|
|
||||||
x += Width(font);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case LDOTS:
|
|
||||||
{
|
|
||||||
font.setColor(LyXFont::BLUE);
|
|
||||||
scr.drawText(font, ". . .", 5, baseline, int(x));
|
|
||||||
x += Width(font);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case MENU_SEPARATOR:
|
|
||||||
{
|
|
||||||
// A triangle the width and height of an 'x'
|
|
||||||
int w = font.textWidth("x", 1);
|
|
||||||
int ox = font.textWidth(" ", 1) + int(x);
|
|
||||||
int h = font.ascent('x');
|
|
||||||
XPoint p[4];
|
|
||||||
p[0].x = ox; p[0].y = baseline;
|
|
||||||
p[1].x = ox; p[1].y = baseline - h;
|
|
||||||
p[2].x = ox + w;p[2].y = baseline - h/2;
|
|
||||||
p[3].x = ox; p[3].y = baseline;
|
|
||||||
scr.drawLines(getGC(gc_copy), p, 4);
|
|
||||||
x += Width(font);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
// In lyxf3 this will be just LaTeX
|
// In lyxf3 this will be just LaTeX
|
||||||
|
@ -40,7 +40,6 @@ public:
|
|||||||
InsetSpecialChar() {}
|
InsetSpecialChar() {}
|
||||||
///
|
///
|
||||||
InsetSpecialChar(Kind k);
|
InsetSpecialChar(Kind k);
|
||||||
#ifdef USE_PAINTER
|
|
||||||
///
|
///
|
||||||
int ascent(Painter &, LyXFont const &) const;
|
int ascent(Painter &, LyXFont const &) const;
|
||||||
///
|
///
|
||||||
@ -49,16 +48,6 @@ public:
|
|||||||
int width(Painter &, LyXFont const &) const;
|
int width(Painter &, LyXFont const &) const;
|
||||||
///
|
///
|
||||||
void draw(Painter &, LyXFont const &, int baseline, float & x) const;
|
void draw(Painter &, LyXFont const &, int baseline, float & x) const;
|
||||||
#else
|
|
||||||
///
|
|
||||||
int Ascent(LyXFont const & font) const;
|
|
||||||
///
|
|
||||||
int Descent(LyXFont const & font) const;
|
|
||||||
///
|
|
||||||
int Width(LyXFont const & font) const;
|
|
||||||
///
|
|
||||||
void Draw(LyXFont, LyXScreen & scr, int baseline, float & x);
|
|
||||||
#endif
|
|
||||||
///
|
///
|
||||||
void Write(ostream &);
|
void Write(ostream &);
|
||||||
/// Will not be used when lyxf3
|
/// Will not be used when lyxf3
|
||||||
|
@ -16,19 +16,11 @@
|
|||||||
#pragma interface
|
#pragma interface
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define USE_PAINTER 1
|
|
||||||
|
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
#include "lyxfont.h"
|
#include "lyxfont.h"
|
||||||
#include "lyxlex.h"
|
#include "lyxlex.h"
|
||||||
#include "lyxscreen.h"
|
|
||||||
|
|
||||||
//#define USE_PAINTER 1
|
|
||||||
|
|
||||||
#ifdef USE_PAINTER
|
|
||||||
class Painter;
|
class Painter;
|
||||||
#endif
|
|
||||||
|
|
||||||
class Buffer;
|
class Buffer;
|
||||||
struct LaTeXFeatures;
|
struct LaTeXFeatures;
|
||||||
|
|
||||||
@ -87,7 +79,6 @@ public:
|
|||||||
|
|
||||||
///
|
///
|
||||||
virtual ~Inset() {}
|
virtual ~Inset() {}
|
||||||
#ifdef USE_PAINTER
|
|
||||||
///
|
///
|
||||||
virtual int ascent(Painter &, LyXFont const &) const = 0;
|
virtual int ascent(Painter &, LyXFont const &) const = 0;
|
||||||
///
|
///
|
||||||
@ -97,17 +88,6 @@ public:
|
|||||||
///
|
///
|
||||||
virtual void draw(Painter &, LyXFont const &,
|
virtual void draw(Painter &, LyXFont const &,
|
||||||
int baseline, float & x) const = 0;
|
int baseline, float & x) const = 0;
|
||||||
#else
|
|
||||||
///
|
|
||||||
virtual int Ascent(LyXFont const & font) const = 0;
|
|
||||||
///
|
|
||||||
virtual int Descent(LyXFont const & font) const = 0;
|
|
||||||
///
|
|
||||||
virtual int Width(LyXFont const & font) const = 0;
|
|
||||||
///
|
|
||||||
virtual void Draw(LyXFont font, LyXScreen & scr,
|
|
||||||
int baseline, float & x) = 0;
|
|
||||||
#endif
|
|
||||||
///
|
///
|
||||||
virtual LyXFont ConvertFont(LyXFont font);
|
virtual LyXFont ConvertFont(LyXFont font);
|
||||||
/// what appears in the minibuffer when opening
|
/// what appears in the minibuffer when opening
|
||||||
|
64
src/lyx_cb.C
64
src/lyx_cb.C
@ -49,7 +49,6 @@ using std::ifstream;
|
|||||||
#include "LyXView.h"
|
#include "LyXView.h"
|
||||||
#include "lastfiles.h"
|
#include "lastfiles.h"
|
||||||
#include "support/FileInfo.h"
|
#include "support/FileInfo.h"
|
||||||
#include "lyxscreen.h"
|
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "support/syscall.h"
|
#include "support/syscall.h"
|
||||||
#include "support/lyxlib.h"
|
#include "support/lyxlib.h"
|
||||||
@ -187,8 +186,7 @@ void MenuLayoutSave();
|
|||||||
void ProhibitInput()
|
void ProhibitInput()
|
||||||
{
|
{
|
||||||
input_prohibited = true;
|
input_prohibited = true;
|
||||||
if (current_view->getScreen())
|
current_view->hideCursor();
|
||||||
current_view->getScreen()->HideCursor();
|
|
||||||
|
|
||||||
static Cursor cursor;
|
static Cursor cursor;
|
||||||
static bool cursor_undefined = true;
|
static bool cursor_undefined = true;
|
||||||
@ -1034,7 +1032,7 @@ void AutoSave()
|
|||||||
// should probably be moved into BufferList (Lgb)
|
// should probably be moved into BufferList (Lgb)
|
||||||
// Perfect target for a thread...
|
// Perfect target for a thread...
|
||||||
{
|
{
|
||||||
if (!current_view->getScreen() || !current_view->available())
|
if (!current_view->available())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (current_view->buffer()->isBakClean()
|
if (current_view->buffer()->isBakClean()
|
||||||
@ -1136,7 +1134,7 @@ void InsertAsciiFile(string const & f, bool asParagraph)
|
|||||||
string fname = f;
|
string fname = f;
|
||||||
LyXFileDlg fileDlg;
|
LyXFileDlg fileDlg;
|
||||||
|
|
||||||
if (!current_view->getScreen()) return;
|
if (!current_view->available()) return;
|
||||||
|
|
||||||
if (fname.empty()) {
|
if (fname.empty()) {
|
||||||
ProhibitInput();
|
ProhibitInput();
|
||||||
@ -1172,7 +1170,7 @@ void InsertAsciiFile(string const & f, bool asParagraph)
|
|||||||
tmppar->InsertChar(tmppar->text.size() - 1, '\0');
|
tmppar->InsertChar(tmppar->text.size() - 1, '\0');
|
||||||
|
|
||||||
// insert the string
|
// insert the string
|
||||||
current_view->getScreen()->HideCursor();
|
current_view->hideCursor();
|
||||||
|
|
||||||
// clear the selection
|
// clear the selection
|
||||||
current_view->beforeChange();
|
current_view->beforeChange();
|
||||||
@ -1247,7 +1245,7 @@ void MenuInsertRef()
|
|||||||
|
|
||||||
void MenuPasteSelection(char at)
|
void MenuPasteSelection(char at)
|
||||||
{
|
{
|
||||||
if (!current_view->getScreen())
|
if (!current_view->available())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ascii_type = at;
|
ascii_type = at;
|
||||||
@ -1272,7 +1270,7 @@ void Foot(BufferView * bv)
|
|||||||
|
|
||||||
bv->owner()->getMiniBuffer()
|
bv->owner()->getMiniBuffer()
|
||||||
->Set(_("Inserting Footnote..."));
|
->Set(_("Inserting Footnote..."));
|
||||||
bv->getScreen()->HideCursor();
|
bv->hideCursor();
|
||||||
bv->update(-2);
|
bv->update(-2);
|
||||||
bv->text->InsertFootnoteEnvironment(LyXParagraph::FOOTNOTE);
|
bv->text->InsertFootnoteEnvironment(LyXParagraph::FOOTNOTE);
|
||||||
bv->update(1);
|
bv->update(1);
|
||||||
@ -1508,7 +1506,7 @@ inline void EnableParagraphLayout ()
|
|||||||
|
|
||||||
bool UpdateLayoutParagraph()
|
bool UpdateLayoutParagraph()
|
||||||
{
|
{
|
||||||
if (!current_view->getScreen() || !current_view->available()) {
|
if (!current_view->available()) {
|
||||||
if (fd_form_paragraph->form_paragraph->visible)
|
if (fd_form_paragraph->form_paragraph->visible)
|
||||||
fl_hide_form(fd_form_paragraph->form_paragraph);
|
fl_hide_form(fd_form_paragraph->form_paragraph);
|
||||||
return false;
|
return false;
|
||||||
@ -1732,7 +1730,7 @@ void EnableDocumentLayout ()
|
|||||||
|
|
||||||
bool UpdateLayoutDocument(BufferParams * params)
|
bool UpdateLayoutDocument(BufferParams * params)
|
||||||
{
|
{
|
||||||
if (!current_view->getScreen() || !current_view->available()) {
|
if (!current_view->available()) {
|
||||||
if (fd_form_document->form_document->visible)
|
if (fd_form_document->form_document->visible)
|
||||||
fl_hide_form(fd_form_document->form_document);
|
fl_hide_form(fd_form_document->form_document);
|
||||||
return false;
|
return false;
|
||||||
@ -1906,8 +1904,7 @@ void MenuLayoutDocument()
|
|||||||
bool UpdateLayoutQuotes()
|
bool UpdateLayoutQuotes()
|
||||||
{
|
{
|
||||||
bool update = true;
|
bool update = true;
|
||||||
if (!current_view->getScreen()
|
if (!current_view->available()
|
||||||
|| !current_view->available()
|
|
||||||
|| current_view->buffer()->isReadonly())
|
|| current_view->buffer()->isReadonly())
|
||||||
update = false;
|
update = false;
|
||||||
|
|
||||||
@ -1945,7 +1942,7 @@ void MenuLayoutQuotes()
|
|||||||
bool UpdateLayoutPreamble()
|
bool UpdateLayoutPreamble()
|
||||||
{
|
{
|
||||||
bool update = true;
|
bool update = true;
|
||||||
if (!current_view->getScreen() || ! current_view->available())
|
if (!current_view->available())
|
||||||
update = false;
|
update = false;
|
||||||
|
|
||||||
if (update) {
|
if (update) {
|
||||||
@ -1998,7 +1995,7 @@ void MenuLayoutPreamble()
|
|||||||
|
|
||||||
void MenuLayoutSave()
|
void MenuLayoutSave()
|
||||||
{
|
{
|
||||||
if (!current_view->getScreen() || ! current_view->available())
|
if (!current_view->available())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (AskQuestion(_("Do you want to save the current settings"),
|
if (AskQuestion(_("Do you want to save the current settings"),
|
||||||
@ -2134,7 +2131,7 @@ static
|
|||||||
void ToggleAndShow(BufferView * bv, LyXFont const & font)
|
void ToggleAndShow(BufferView * bv, LyXFont const & font)
|
||||||
{
|
{
|
||||||
if (bv->available()) {
|
if (bv->available()) {
|
||||||
bv->getScreen()->HideCursor();
|
bv->hideCursor();
|
||||||
bv->update(-2);
|
bv->update(-2);
|
||||||
bv->text->ToggleFree(font, toggleall);
|
bv->text->ToggleFree(font, toggleall);
|
||||||
bv->update(1);
|
bv->update(1);
|
||||||
@ -2147,7 +2144,7 @@ void Margin(BufferView * bv)
|
|||||||
{
|
{
|
||||||
if (bv->available()) {
|
if (bv->available()) {
|
||||||
bv->owner()->getMiniBuffer()->Set(_("Inserting margin note..."));
|
bv->owner()->getMiniBuffer()->Set(_("Inserting margin note..."));
|
||||||
bv->getScreen()->HideCursor();
|
bv->hideCursor();
|
||||||
bv->update(-2);
|
bv->update(-2);
|
||||||
bv->text->InsertFootnoteEnvironment(LyXParagraph::MARGIN);
|
bv->text->InsertFootnoteEnvironment(LyXParagraph::MARGIN);
|
||||||
bv->update(1);
|
bv->update(1);
|
||||||
@ -2185,7 +2182,7 @@ void Melt(BufferView * bv)
|
|||||||
if (!bv->available()) return;
|
if (!bv->available()) return;
|
||||||
|
|
||||||
bv->owner()->getMiniBuffer()->Set(_("Melt"));
|
bv->owner()->getMiniBuffer()->Set(_("Melt"));
|
||||||
bv->getScreen()->HideCursor();
|
bv->hideCursor();
|
||||||
bv->beforeChange();
|
bv->beforeChange();
|
||||||
bv->update(-2);
|
bv->update(-2);
|
||||||
bv->text->MeltFootnoteEnvironment();
|
bv->text->MeltFootnoteEnvironment();
|
||||||
@ -2201,7 +2198,7 @@ void changeDepth(BufferView * bv, int decInc)
|
|||||||
{
|
{
|
||||||
if (!bv->available()) return;
|
if (!bv->available()) return;
|
||||||
|
|
||||||
bv->getScreen()->HideCursor();
|
bv->hideCursor();
|
||||||
bv->update(-2);
|
bv->update(-2);
|
||||||
if (decInc >= 0)
|
if (decInc >= 0)
|
||||||
bv->text->IncDepth();
|
bv->text->IncDepth();
|
||||||
@ -2284,7 +2281,6 @@ LyXFont UserFreeFont()
|
|||||||
}
|
}
|
||||||
|
|
||||||
pos = fl_get_choice(fd_form_character->choice_color);
|
pos = fl_get_choice(fd_form_character->choice_color);
|
||||||
#ifdef USE_PAINTER
|
|
||||||
switch(pos) {
|
switch(pos) {
|
||||||
case 1: font.setColor(LColor::ignore); break;
|
case 1: font.setColor(LColor::ignore); break;
|
||||||
case 2: font.setColor(LColor::none); break;
|
case 2: font.setColor(LColor::none); break;
|
||||||
@ -2298,21 +2294,7 @@ LyXFont UserFreeFont()
|
|||||||
case 10: font.setColor(LColor::yellow); break;
|
case 10: font.setColor(LColor::yellow); break;
|
||||||
case 11: font.setColor(LColor::inherit); break;
|
case 11: font.setColor(LColor::inherit); break;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
switch(pos) {
|
|
||||||
case 1: font.setColor(LyXFont::IGNORE_COLOR); break;
|
|
||||||
case 2: font.setColor(LyXFont::NONE); break;
|
|
||||||
case 3: font.setColor(LyXFont::BLACK); break;
|
|
||||||
case 4: font.setColor(LyXFont::WHITE); break;
|
|
||||||
case 5: font.setColor(LyXFont::RED); break;
|
|
||||||
case 6: font.setColor(LyXFont::GREEN); break;
|
|
||||||
case 7: font.setColor(LyXFont::BLUE); break;
|
|
||||||
case 8: font.setColor(LyXFont::CYAN); break;
|
|
||||||
case 9: font.setColor(LyXFont::MAGENTA); break;
|
|
||||||
case 10: font.setColor(LyXFont::YELLOW); break;
|
|
||||||
case 11: font.setColor(LyXFont::INHERIT_COLOR); break;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
return font;
|
return font;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2643,7 +2625,7 @@ extern "C" void DocumentApplyCB(FL_OBJECT *, long)
|
|||||||
if (lyxrc->rtl_support) {
|
if (lyxrc->rtl_support) {
|
||||||
current_view->text->SetCursor(current_view->text->cursor.par,
|
current_view->text->SetCursor(current_view->text->cursor.par,
|
||||||
current_view->text->cursor.pos);
|
current_view->text->cursor.pos);
|
||||||
current_view->SetState();
|
current_view->setState();
|
||||||
}
|
}
|
||||||
|
|
||||||
LyXTextClassList::ClassList::size_type new_class =
|
LyXTextClassList::ClassList::size_type new_class =
|
||||||
@ -2870,7 +2852,7 @@ extern "C" void PreambleOKCB(FL_OBJECT * ob, long data)
|
|||||||
|
|
||||||
extern "C" void TableApplyCB(FL_OBJECT *, long)
|
extern "C" void TableApplyCB(FL_OBJECT *, long)
|
||||||
{
|
{
|
||||||
if (!current_view->getScreen())
|
if (!current_view->available())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// check for tables in tables
|
// check for tables in tables
|
||||||
@ -2887,7 +2869,7 @@ extern "C" void TableApplyCB(FL_OBJECT *, long)
|
|||||||
int xsize = int(fl_get_slider_value(fd_form_table->slider_rows) + 0.5);
|
int xsize = int(fl_get_slider_value(fd_form_table->slider_rows) + 0.5);
|
||||||
|
|
||||||
|
|
||||||
current_view->getScreen()->HideCursor();
|
current_view->hideCursor();
|
||||||
current_view->beforeChange();
|
current_view->beforeChange();
|
||||||
current_view->update(-2);
|
current_view->update(-2);
|
||||||
|
|
||||||
@ -2944,7 +2926,7 @@ extern "C" void TableApplyCB(FL_OBJECT *, long)
|
|||||||
|
|
||||||
current_view->update(1);
|
current_view->update(1);
|
||||||
current_view->owner()->getMiniBuffer()->Set(_("Table inserted"));
|
current_view->owner()->getMiniBuffer()->Set(_("Table inserted"));
|
||||||
current_view->SetState();
|
current_view->setState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -3164,7 +3146,7 @@ extern "C" void FigureApplyCB(FL_OBJECT *, long)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
current_view->getScreen()->HideCursor();
|
current_view->hideCursor();
|
||||||
current_view->update(-2);
|
current_view->update(-2);
|
||||||
current_view->beforeChange();
|
current_view->beforeChange();
|
||||||
|
|
||||||
@ -3213,7 +3195,7 @@ extern "C" void FigureApplyCB(FL_OBJECT *, long)
|
|||||||
current_view->update(0);
|
current_view->update(0);
|
||||||
current_view->owner()->getMiniBuffer()->Set(_("Figure inserted"));
|
current_view->owner()->getMiniBuffer()->Set(_("Figure inserted"));
|
||||||
current_view->text->UnFreezeUndo();
|
current_view->text->UnFreezeUndo();
|
||||||
current_view->SetState();
|
current_view->setState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -3579,7 +3561,7 @@ void UpdateInset(BufferView * bv, Inset * inset, bool mark_dirty)
|
|||||||
|
|
||||||
/* first check the current buffer */
|
/* first check the current buffer */
|
||||||
if (bv->available()) {
|
if (bv->available()) {
|
||||||
bv->getScreen()->HideCursor();
|
bv->hideCursor();
|
||||||
bv->update(-3);
|
bv->update(-3);
|
||||||
if (bv->text->UpdateInset(inset)){
|
if (bv->text->UpdateInset(inset)){
|
||||||
if (mark_dirty)
|
if (mark_dirty)
|
||||||
|
@ -31,9 +31,6 @@
|
|||||||
#include "LyXView.h"
|
#include "LyXView.h"
|
||||||
#include "buffer.h"
|
#include "buffer.h"
|
||||||
#include "lyxserver.h"
|
#include "lyxserver.h"
|
||||||
#ifndef USE_PAINTER
|
|
||||||
#include "lyxdraw.h"
|
|
||||||
#endif
|
|
||||||
#include "lyxrc.h"
|
#include "lyxrc.h"
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
#include "lyx_gui_misc.h"
|
#include "lyx_gui_misc.h"
|
||||||
@ -79,11 +76,6 @@ FL_CMD_OPT cmdopt[] =
|
|||||||
{"-height", "*.height", XrmoptionSepArg, "510"},
|
{"-height", "*.height", XrmoptionSepArg, "510"},
|
||||||
{"-xpos", "*.xpos", XrmoptionSepArg, "-1"},
|
{"-xpos", "*.xpos", XrmoptionSepArg, "-1"},
|
||||||
{"-ypos", "*.ypos", XrmoptionSepArg, "-1"},
|
{"-ypos", "*.ypos", XrmoptionSepArg, "-1"},
|
||||||
#ifdef MONO
|
|
||||||
{"-Reverse", "*.Reverse", XrmoptionNoArg, "1"},
|
|
||||||
{"-Mono", "*.Mono", XrmoptionNoArg, "1"},
|
|
||||||
{"-FastSelection", "*.FastSelection", XrmoptionNoArg, "1"},
|
|
||||||
#endif
|
|
||||||
{"-MathColor", "*.MathColor", XrmoptionSepArg, "blue"},
|
{"-MathColor", "*.MathColor", XrmoptionSepArg, "blue"},
|
||||||
{"-MathFrameColor", "*.MathFrameColor", XrmoptionSepArg, "magenta"},
|
{"-MathFrameColor", "*.MathFrameColor", XrmoptionSepArg, "magenta"},
|
||||||
{"-FootColor", "*.FootColor", XrmoptionSepArg, "red"},
|
{"-FootColor", "*.FootColor", XrmoptionSepArg, "red"},
|
||||||
@ -103,11 +95,6 @@ static int width;
|
|||||||
static int height;
|
static int height;
|
||||||
static int xpos;
|
static int xpos;
|
||||||
static int ypos;
|
static int ypos;
|
||||||
#ifdef MONO
|
|
||||||
int reverse_video;
|
|
||||||
int mono_video;
|
|
||||||
int fast_selection;
|
|
||||||
#endif
|
|
||||||
bool cursor_follows_scrollbar;
|
bool cursor_follows_scrollbar;
|
||||||
char math_color[32];
|
char math_color[32];
|
||||||
char math_frame_color[32];
|
char math_frame_color[32];
|
||||||
@ -131,11 +118,6 @@ FL_resource res[] =
|
|||||||
{"height", "heightClass", FL_INT, &height, "510", 0},
|
{"height", "heightClass", FL_INT, &height, "510", 0},
|
||||||
{"xpos", "xposClass", FL_INT, &xpos, "-1", 0},
|
{"xpos", "xposClass", FL_INT, &xpos, "-1", 0},
|
||||||
{"ypos", "yposClass", FL_INT, &ypos, "-1", 0},
|
{"ypos", "yposClass", FL_INT, &ypos, "-1", 0},
|
||||||
#ifdef MONO
|
|
||||||
{"Reverse", "reverseClass", FL_INT, &reverse_video, "0", 0},
|
|
||||||
{"Mono", "monoClass", FL_INT, &mono_video, "0", 0},
|
|
||||||
{"FastSelection", "selectionClass", FL_INT, &fast_selection, "0", 0},
|
|
||||||
#endif
|
|
||||||
{"MathColor", "colorClass", FL_STRING, math_color, "blue", 31},
|
{"MathColor", "colorClass", FL_STRING, math_color, "blue", 31},
|
||||||
{"MathFrameColor", "colorClass", FL_STRING, math_frame_color, "magenta", 31},
|
{"MathFrameColor", "colorClass", FL_STRING, math_frame_color, "magenta", 31},
|
||||||
{"FootColor", "colorClass", FL_STRING, foot_color, "red", 31},
|
{"FootColor", "colorClass", FL_STRING, foot_color, "red", 31},
|
||||||
@ -304,13 +286,6 @@ void LyXGUI::init()
|
|||||||
// in 0.12 the initialisation of the LyXServer must be done here
|
// in 0.12 the initialisation of the LyXServer must be done here
|
||||||
// 0.13 it should be moved again...
|
// 0.13 it should be moved again...
|
||||||
lyxserver = new LyXServer(lyxViews->getLyXFunc(), lyxrc->lyxpipes);
|
lyxserver = new LyXServer(lyxViews->getLyXFunc(), lyxrc->lyxpipes);
|
||||||
|
|
||||||
#ifndef USE_PAINTER
|
|
||||||
// This is to make sure we get the selection color
|
|
||||||
getGC(gc_selection);
|
|
||||||
// This is to make sure we set the background_pixels
|
|
||||||
getGC(gc_clear);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -462,9 +462,6 @@ void commandLineHelp()
|
|||||||
"\t-dbg feature[,feature]...\n"
|
"\t-dbg feature[,feature]...\n"
|
||||||
" select the features to debug.\n"
|
" select the features to debug.\n"
|
||||||
" Type `lyx -dbg' to see the list of features\n"
|
" Type `lyx -dbg' to see the list of features\n"
|
||||||
"\t-Reverse swaps foreground & background colors\n"
|
|
||||||
"\t-Mono runs LyX in black and white mode\n"
|
|
||||||
"\t-FastSelection use a fast routine for drawing selections\n\n"
|
|
||||||
"Check the LyX man page for more options.") << endl;
|
"Check the LyX man page for more options.") << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
199
src/lyxfont.C
199
src/lyxfont.C
@ -22,9 +22,6 @@
|
|||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "lyxrc.h"
|
#include "lyxrc.h"
|
||||||
#include "lyxlex.h"
|
#include "lyxlex.h"
|
||||||
#ifndef USE_PAINTER
|
|
||||||
#include "lyxdraw.h"
|
|
||||||
#endif
|
|
||||||
#include "FontLoader.h"
|
#include "FontLoader.h"
|
||||||
#include "support/lstrings.h"
|
#include "support/lstrings.h"
|
||||||
|
|
||||||
@ -65,13 +62,6 @@ string const GUIDirectionNames[5] =
|
|||||||
{ N_("LTR"), N_("RTL"), N_("Toggle"), N_("Inherit"), N_("Ignore") };
|
{ N_("LTR"), N_("RTL"), N_("Toggle"), N_("Inherit"), N_("Ignore") };
|
||||||
|
|
||||||
|
|
||||||
#ifndef USE_PAINTER
|
|
||||||
string const GUIColorNames[13] =
|
|
||||||
{ N_("None"), N_("Black"), N_("White"), N_("Red"), N_("Green"), N_("Blue"),
|
|
||||||
N_("Cyan"), N_("Magenta"),
|
|
||||||
N_("Yellow"), N_("Math"), N_("Inset"), N_("Inherit"), N_("Ignore") };
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Strings used to read and write .lyx format files
|
// Strings used to read and write .lyx format files
|
||||||
//
|
//
|
||||||
@ -92,12 +82,6 @@ string const LyXSizeNames[14] =
|
|||||||
string const LyXMiscNames[12] =
|
string const LyXMiscNames[12] =
|
||||||
{ "off", "on", "toggle", "default", "error" };
|
{ "off", "on", "toggle", "default", "error" };
|
||||||
|
|
||||||
#ifndef USE_PAINTER
|
|
||||||
string const LyXColorNames[13] =
|
|
||||||
{ "none", "black", "white", "red", "green", "blue", "cyan", "magenta",
|
|
||||||
"yellow", "matherror", "inseterror", "default", "error" };
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Strings used to write LaTeX files
|
// Strings used to write LaTeX files
|
||||||
//
|
//
|
||||||
@ -115,22 +99,12 @@ string const LaTeXSizeNames[14] =
|
|||||||
{ "tiny", "scriptsize", "footnotesize", "small", "normalsize", "large",
|
{ "tiny", "scriptsize", "footnotesize", "small", "normalsize", "large",
|
||||||
"Large", "LARGE", "huge", "Huge", "error8", "error9", "error10", "error11" };
|
"Large", "LARGE", "huge", "Huge", "error8", "error9", "error10", "error11" };
|
||||||
|
|
||||||
#ifndef USE_PAINTER
|
|
||||||
string const LaTeXColorNames[13] =
|
|
||||||
{ "none", "black", "white", "red", "green", "blue", "cyan", "magenta",
|
|
||||||
"yellow", "error12", "error13", "error14", "error15" };
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef NEW_BITS
|
#ifdef NEW_BITS
|
||||||
LyXFont::FontBits LyXFont::sane = { ROMAN_FAMILY,
|
LyXFont::FontBits LyXFont::sane = { ROMAN_FAMILY,
|
||||||
MEDIUM_SERIES,
|
MEDIUM_SERIES,
|
||||||
UP_SHAPE,
|
UP_SHAPE,
|
||||||
SIZE_NORMAL,
|
SIZE_NORMAL,
|
||||||
#ifdef USE_PAINTER
|
|
||||||
LColor::none,
|
LColor::none,
|
||||||
#else
|
|
||||||
NONE,
|
|
||||||
#endif
|
|
||||||
OFF,
|
OFF,
|
||||||
OFF,
|
OFF,
|
||||||
OFF,
|
OFF,
|
||||||
@ -141,11 +115,7 @@ LyXFont::FontBits LyXFont::inherit = { INHERIT_FAMILY,
|
|||||||
INHERIT_SERIES,
|
INHERIT_SERIES,
|
||||||
INHERIT_SHAPE,
|
INHERIT_SHAPE,
|
||||||
INHERIT_SIZE,
|
INHERIT_SIZE,
|
||||||
#ifdef USE_PAINTER
|
|
||||||
LColor::inherit,
|
LColor::inherit,
|
||||||
#else
|
|
||||||
INHERIT_COLOR,
|
|
||||||
#endif
|
|
||||||
INHERIT,
|
INHERIT,
|
||||||
INHERIT,
|
INHERIT,
|
||||||
INHERIT,
|
INHERIT,
|
||||||
@ -156,11 +126,7 @@ LyXFont::FontBits LyXFont::ignore = { IGNORE_FAMILY,
|
|||||||
IGNORE_SERIES,
|
IGNORE_SERIES,
|
||||||
IGNORE_SHAPE,
|
IGNORE_SHAPE,
|
||||||
IGNORE_SIZE,
|
IGNORE_SIZE,
|
||||||
#ifdef USE_PAINTER
|
|
||||||
LColor::ignore,
|
LColor::ignore,
|
||||||
#else
|
|
||||||
IGNORE_COLOR,
|
|
||||||
#endif
|
|
||||||
IGNORE,
|
IGNORE,
|
||||||
IGNORE,
|
IGNORE,
|
||||||
IGNORE,
|
IGNORE,
|
||||||
@ -312,17 +278,10 @@ void LyXFont::update(LyXFont const & newfont, bool toggleall)
|
|||||||
setDirection(newfont.direction());
|
setDirection(newfont.direction());
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_PAINTER
|
|
||||||
if(newfont.color() == color() && toggleall)
|
if(newfont.color() == color() && toggleall)
|
||||||
setColor(LColor::inherit); // toggle 'back'
|
setColor(LColor::inherit); // toggle 'back'
|
||||||
else if (newfont.color() != LColor::ignore)
|
else if (newfont.color() != LColor::ignore)
|
||||||
setColor(newfont.color());
|
setColor(newfont.color());
|
||||||
#else
|
|
||||||
if(newfont.color() == color() && toggleall)
|
|
||||||
setColor(LyXFont::INHERIT_COLOR); // toggle 'back'
|
|
||||||
else if (newfont.color() != LyXFont::IGNORE_COLOR)
|
|
||||||
setColor(newfont.color());
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -345,13 +304,8 @@ void LyXFont::reduce(LyXFont const & tmplt)
|
|||||||
setNoun(INHERIT);
|
setNoun(INHERIT);
|
||||||
if (latex() == tmplt.latex())
|
if (latex() == tmplt.latex())
|
||||||
setLatex(INHERIT);
|
setLatex(INHERIT);
|
||||||
#ifdef USE_PAINTER
|
|
||||||
if (color() == tmplt.color())
|
if (color() == tmplt.color())
|
||||||
setColor(LColor::inherit);
|
setColor(LColor::inherit);
|
||||||
#else
|
|
||||||
if (color() == tmplt.color())
|
|
||||||
setColor(LyXFont::INHERIT_COLOR);
|
|
||||||
#endif
|
|
||||||
if (direction() == tmplt.direction())
|
if (direction() == tmplt.direction())
|
||||||
setDirection(INHERIT_DIR);
|
setDirection(INHERIT_DIR);
|
||||||
}
|
}
|
||||||
@ -391,15 +345,9 @@ LyXFont & LyXFont::realize(LyXFont const & tmplt)
|
|||||||
if (bits.latex == INHERIT) {
|
if (bits.latex == INHERIT) {
|
||||||
bits.latex = tmplt.bits.latex;
|
bits.latex = tmplt.bits.latex;
|
||||||
}
|
}
|
||||||
#ifdef USE_PAINTER
|
|
||||||
if (bits.color == LColor::inherit) {
|
if (bits.color == LColor::inherit) {
|
||||||
bits.color = tmplt.bits.color;
|
bits.color = tmplt.bits.color;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
if (bits.color == INHERIT_COLOR) {
|
|
||||||
bits.color = tmplt.bits.color;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
if (bits.direction == INHERIT_DIR) {
|
if (bits.direction == INHERIT_DIR) {
|
||||||
bits.direction = tmplt.bits.direction;
|
bits.direction = tmplt.bits.direction;
|
||||||
}
|
}
|
||||||
@ -454,19 +402,11 @@ LyXFont & LyXFont::realize(LyXFont const & tmplt)
|
|||||||
bits &= ~(Misc_Mask << Lat_Pos);
|
bits &= ~(Misc_Mask << Lat_Pos);
|
||||||
bits |= (tmplt.bits & Misc_Mask << Lat_Pos);
|
bits |= (tmplt.bits & Misc_Mask << Lat_Pos);
|
||||||
}
|
}
|
||||||
#ifdef USE_PAINTER
|
|
||||||
if ((bits & (Col_Mask << Col_Pos)) == ui32(LColor::inherit) << Col_Pos)
|
if ((bits & (Col_Mask << Col_Pos)) == ui32(LColor::inherit) << Col_Pos)
|
||||||
{
|
{
|
||||||
bits &= ~(Col_Mask << Col_Pos);
|
bits &= ~(Col_Mask << Col_Pos);
|
||||||
bits |= (tmplt.bits & Col_Mask << Col_Pos);
|
bits |= (tmplt.bits & Col_Mask << Col_Pos);
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
if ((bits & (Col_Mask << Col_Pos)) == ui32(INHERIT_COLOR) << Col_Pos)
|
|
||||||
{
|
|
||||||
bits &= ~(Col_Mask << Col_Pos);
|
|
||||||
bits |= (tmplt.bits & Col_Mask << Col_Pos);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
if ((bits & (Dir_Mask << Dir_Pos)) == ui32(INHERIT_DIR) << Dir_Pos)
|
if ((bits & (Dir_Mask << Dir_Pos)) == ui32(INHERIT_DIR) << Dir_Pos)
|
||||||
{
|
{
|
||||||
bits &= ~(Dir_Mask << Dir_Pos);
|
bits &= ~(Dir_Mask << Dir_Pos);
|
||||||
@ -479,7 +419,6 @@ LyXFont & LyXFont::realize(LyXFont const & tmplt)
|
|||||||
|
|
||||||
|
|
||||||
/// Is font resolved?
|
/// Is font resolved?
|
||||||
#ifdef USE_PAINTER
|
|
||||||
bool LyXFont::resolved() const
|
bool LyXFont::resolved() const
|
||||||
{
|
{
|
||||||
return (family() != INHERIT_FAMILY && series() != INHERIT_SERIES &&
|
return (family() != INHERIT_FAMILY && series() != INHERIT_SERIES &&
|
||||||
@ -489,17 +428,6 @@ bool LyXFont::resolved() const
|
|||||||
color() != LColor::inherit &&
|
color() != LColor::inherit &&
|
||||||
direction() != INHERIT_DIR);
|
direction() != INHERIT_DIR);
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
bool LyXFont::resolved() const
|
|
||||||
{
|
|
||||||
return (family() != INHERIT_FAMILY && series() != INHERIT_SERIES &&
|
|
||||||
shape() != INHERIT_SHAPE && size() != INHERIT_SIZE &&
|
|
||||||
emph() != INHERIT && underbar() != INHERIT &&
|
|
||||||
noun() != INHERIT && latex() != INHERIT &&
|
|
||||||
color() != INHERIT_COLOR &&
|
|
||||||
direction() != INHERIT_DIR);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/// Build GUI description of font state
|
/// Build GUI description of font state
|
||||||
@ -514,13 +442,8 @@ string LyXFont::stateText() const
|
|||||||
buf += string(_(GUIShapeNames[shape()].c_str())) + ", ";
|
buf += string(_(GUIShapeNames[shape()].c_str())) + ", ";
|
||||||
if (size() != INHERIT_SIZE)
|
if (size() != INHERIT_SIZE)
|
||||||
buf += string(_(GUISizeNames[size()].c_str())) + ", ";
|
buf += string(_(GUISizeNames[size()].c_str())) + ", ";
|
||||||
#ifdef USE_PAINTER
|
|
||||||
if (color() != LColor::inherit)
|
if (color() != LColor::inherit)
|
||||||
buf += lcolor.getGUIName(color()) + ", ";
|
buf += lcolor.getGUIName(color()) + ", ";
|
||||||
#else
|
|
||||||
if (color() != INHERIT_COLOR)
|
|
||||||
buf += string(_(GUIColorNames[color()].c_str())) + ", ";
|
|
||||||
#endif
|
|
||||||
if (emph() != INHERIT)
|
if (emph() != INHERIT)
|
||||||
buf += string(_("Emphasis ")) + _(GUIMiscNames[emph()].c_str()) + ", ";
|
buf += string(_("Emphasis ")) + _(GUIMiscNames[emph()].c_str()) + ", ";
|
||||||
if (underbar() != INHERIT)
|
if (underbar() != INHERIT)
|
||||||
@ -617,18 +540,7 @@ LyXFont::FONT_MISC_STATE LyXFont::setLyXMisc(string const & siz)
|
|||||||
/// Sets color after LyX text format
|
/// Sets color after LyX text format
|
||||||
LyXFont & LyXFont::setLyXColor(string const & col)
|
LyXFont & LyXFont::setLyXColor(string const & col)
|
||||||
{
|
{
|
||||||
#ifdef USE_PAINTER
|
|
||||||
setColor(lcolor.getFromLyXName(col));
|
setColor(lcolor.getFromLyXName(col));
|
||||||
#else
|
|
||||||
string s = lowercase(col);
|
|
||||||
int i= 0;
|
|
||||||
while (s != LyXColorNames[i] && LyXColorNames[i] != "error") ++i;
|
|
||||||
if (s == LyXColorNames[i]) {
|
|
||||||
setColor(LyXFont::FONT_COLOR(i));
|
|
||||||
} else
|
|
||||||
lyxerr << "LyXFont::setLyXColor: Unknown Color `"
|
|
||||||
<< s << '\'' << endl;
|
|
||||||
#endif
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -636,23 +548,11 @@ LyXFont & LyXFont::setLyXColor(string const & col)
|
|||||||
/// Sets size after GUI name
|
/// Sets size after GUI name
|
||||||
LyXFont & LyXFont::setGUISize(string const & siz)
|
LyXFont & LyXFont::setGUISize(string const & siz)
|
||||||
{
|
{
|
||||||
#ifdef USE_PAINTER
|
#warning this might be wrong.
|
||||||
/// ??????
|
/// ??????
|
||||||
// this is how it was how it was done in the lyx repository...
|
// this is how it was how it was done in the lyx repository...
|
||||||
// but this does not make sense.
|
// but this does not make sense.
|
||||||
setColor(lcolor.getFromGUIName(siz));
|
setColor(lcolor.getFromGUIName(siz));
|
||||||
#else
|
|
||||||
string s = lowercase(siz);
|
|
||||||
int i = 0;
|
|
||||||
while (!lGUISizeNames[i].empty() &&
|
|
||||||
s != _(lGUISizeNames[i].c_str()))
|
|
||||||
++i;
|
|
||||||
if (s == _(lGUISizeNames[i].c_str())) {
|
|
||||||
setSize(LyXFont::FONT_SIZE(i));
|
|
||||||
} else
|
|
||||||
lyxerr << "LyXFont::setGUISize: Unknown Size `"
|
|
||||||
<< s << '\'' << endl;
|
|
||||||
#endif
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -802,15 +702,9 @@ void LyXFont::lyxWriteChanges(LyXFont const & orgfont, ostream & os) const
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef USE_PAINTER
|
|
||||||
if (orgfont.color() != color()) {
|
if (orgfont.color() != color()) {
|
||||||
os << "\\color " << lcolor.getLyXName(color()) << "\n";
|
os << "\\color " << lcolor.getLyXName(color()) << "\n";
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
if (orgfont.color() != color()) {
|
|
||||||
os << "\\color " << LyXColorNames[color()] << "\n";
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
if (orgfont.direction() != direction()) {
|
if (orgfont.direction() != direction()) {
|
||||||
switch (direction()) {
|
switch (direction()) {
|
||||||
case RTL_DIR: os << "\\direction rtl \n"; break;
|
case RTL_DIR: os << "\\direction rtl \n"; break;
|
||||||
@ -877,7 +771,6 @@ int LyXFont::latexWriteStartChanges(string & file, LyXFont const & base,
|
|||||||
count += LaTeXShapeNames[f.shape()].length() + 2;
|
count += LaTeXShapeNames[f.shape()].length() + 2;
|
||||||
env = true; //We have opened a new environment
|
env = true; //We have opened a new environment
|
||||||
}
|
}
|
||||||
#ifdef USE_PAINTER
|
|
||||||
if (f.color() != LColor::inherit) {
|
if (f.color() != LColor::inherit) {
|
||||||
file += "\\textcolor{";
|
file += "\\textcolor{";
|
||||||
file += lcolor.getLaTeXName(f.color());
|
file += lcolor.getLaTeXName(f.color());
|
||||||
@ -885,15 +778,6 @@ int LyXFont::latexWriteStartChanges(string & file, LyXFont const & base,
|
|||||||
count += lcolor.getLaTeXName(f.color()).length() + 13;
|
count += lcolor.getLaTeXName(f.color()).length() + 13;
|
||||||
env = true; //We have opened a new environment
|
env = true; //We have opened a new environment
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
if (f.color() != INHERIT_COLOR) {
|
|
||||||
file += "\\textcolor{";
|
|
||||||
file += LaTeXColorNames[f.color()];
|
|
||||||
file += "}{";
|
|
||||||
count += LaTeXColorNames[f.color()].length() + 13;
|
|
||||||
env = true; //We have opened a new environment
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
if (f.emph() == ON) {
|
if (f.emph() == ON) {
|
||||||
file += "\\emph{";
|
file += "\\emph{";
|
||||||
count += 6;
|
count += 6;
|
||||||
@ -966,19 +850,11 @@ int LyXFont::latexWriteEndChanges(string & file, LyXFont const & base,
|
|||||||
++count;
|
++count;
|
||||||
env = true; // Size change need not bother about closing env.
|
env = true; // Size change need not bother about closing env.
|
||||||
}
|
}
|
||||||
#ifdef USE_PAINTER
|
|
||||||
if (f.color() != LColor::inherit) {
|
if (f.color() != LColor::inherit) {
|
||||||
file += '}';
|
file += '}';
|
||||||
++count;
|
++count;
|
||||||
env = true; // Size change need not bother about closing env.
|
env = true; // Size change need not bother about closing env.
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
if (f.color() != INHERIT_COLOR) {
|
|
||||||
file += '}';
|
|
||||||
++count;
|
|
||||||
env = true; // Size change need not bother about closing env.
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
if (f.emph() == ON) {
|
if (f.emph() == ON) {
|
||||||
file += '}';
|
file += '}';
|
||||||
++count;
|
++count;
|
||||||
@ -1006,7 +882,6 @@ int LyXFont::latexWriteEndChanges(string & file, LyXFont const & base,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_PAINTER
|
|
||||||
LColor::color LyXFont::realColor() const
|
LColor::color LyXFont::realColor() const
|
||||||
{
|
{
|
||||||
if (latex() == ON)
|
if (latex() == ON)
|
||||||
@ -1015,7 +890,6 @@ LColor::color LyXFont::realColor() const
|
|||||||
return LColor::foreground;
|
return LColor::foreground;
|
||||||
return color();
|
return color();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
// Convert logical attributes to concrete shape attribute
|
// Convert logical attributes to concrete shape attribute
|
||||||
@ -1035,29 +909,6 @@ LyXFont::FONT_SHAPE LyXFont::realShape() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifndef USE_PAINTER
|
|
||||||
GC LyXFont::getGC() const
|
|
||||||
{
|
|
||||||
GC gc;
|
|
||||||
if (latex() == ON)
|
|
||||||
gc = ::getGC(gc_latex);
|
|
||||||
else {
|
|
||||||
if (color() == NONE)
|
|
||||||
gc = ::getGC(gc_copy);
|
|
||||||
else if (color() == MATH)
|
|
||||||
gc = ::getGC(gc_math);
|
|
||||||
else if (color() == INSET)
|
|
||||||
gc = ::getGC(gc_foot);
|
|
||||||
else
|
|
||||||
gc = ::GetColorGC(color());
|
|
||||||
}
|
|
||||||
|
|
||||||
XSetFont(fl_display, gc, getXFontstruct()->fid);
|
|
||||||
return gc;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
XFontStruct * LyXFont::getXFontstruct() const
|
XFontStruct * LyXFont::getXFontstruct() const
|
||||||
{
|
{
|
||||||
return fontloader.load(family(), series(), realShape(), size());
|
return fontloader.load(family(), series(), realShape(), size());
|
||||||
@ -1183,7 +1034,6 @@ int LyXFont::signedStringWidth(string const & s) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_PAINTER
|
|
||||||
int LyXFont::drawText(char const * s, int n, Pixmap,
|
int LyXFont::drawText(char const * s, int n, Pixmap,
|
||||||
int, int x) const
|
int, int x) const
|
||||||
{
|
{
|
||||||
@ -1229,53 +1079,6 @@ int LyXFont::drawText(char const * s, int n, Pixmap,
|
|||||||
return x - sx;
|
return x - sx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
int LyXFont::drawText(char const * s, int n, Pixmap pm,
|
|
||||||
int baseline, int x) const
|
|
||||||
{
|
|
||||||
if (realShape() != LyXFont::SMALLCAPS_SHAPE) {
|
|
||||||
XDrawString(fl_display,
|
|
||||||
pm,
|
|
||||||
getGC(),
|
|
||||||
x, baseline,
|
|
||||||
s, n);
|
|
||||||
XFlush(fl_display);
|
|
||||||
return XTextWidth(getXFontstruct(), s, n);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
// emulate smallcaps since X doesn't support this
|
|
||||||
char c;
|
|
||||||
int sx = x;
|
|
||||||
LyXFont smallfont = *this;
|
|
||||||
smallfont.decSize();
|
|
||||||
smallfont.decSize();
|
|
||||||
smallfont.setShape(LyXFont::UP_SHAPE);
|
|
||||||
for (int i = 0; i < n; ++i) {
|
|
||||||
c = s[i];
|
|
||||||
if (islower(static_cast<unsigned char>(c))){
|
|
||||||
c = toupper(c);
|
|
||||||
XDrawString(fl_display,
|
|
||||||
pm,
|
|
||||||
smallfont.getGC(),
|
|
||||||
x, baseline,
|
|
||||||
&c, 1);
|
|
||||||
x += XTextWidth(smallfont.getXFontstruct(),
|
|
||||||
&c, 1);
|
|
||||||
XFlush(fl_display);
|
|
||||||
} else {
|
|
||||||
XDrawString(fl_display,
|
|
||||||
pm,
|
|
||||||
getGC(),
|
|
||||||
x, baseline,
|
|
||||||
&c, 1);
|
|
||||||
x += XTextWidth(getXFontstruct(), &c, 1);
|
|
||||||
XFlush(fl_display);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return x - sx;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
int LyXFont::drawString(string const & s, Pixmap pm, int baseline, int x) const
|
int LyXFont::drawString(string const & s, Pixmap pm, int baseline, int x) const
|
||||||
|
102
src/lyxfont.h
102
src/lyxfont.h
@ -5,6 +5,7 @@
|
|||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
* Copyright 1995 Matthias Ettrich
|
* Copyright 1995 Matthias Ettrich
|
||||||
|
* Copyright 1995-2000 The LyX Team.
|
||||||
*
|
*
|
||||||
* ====================================================== */
|
* ====================================================== */
|
||||||
|
|
||||||
@ -15,8 +16,6 @@
|
|||||||
#pragma interface
|
#pragma interface
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define USE_PAINTER 1
|
|
||||||
|
|
||||||
#include FORMS_H_LOCATION
|
#include FORMS_H_LOCATION
|
||||||
#include "LString.h"
|
#include "LString.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
@ -151,38 +150,6 @@ public:
|
|||||||
IGNORE
|
IGNORE
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifndef USE_PAINTER
|
|
||||||
///
|
|
||||||
enum FONT_COLOR {
|
|
||||||
///
|
|
||||||
NONE,
|
|
||||||
///
|
|
||||||
BLACK,
|
|
||||||
///
|
|
||||||
WHITE,
|
|
||||||
///
|
|
||||||
RED,
|
|
||||||
///
|
|
||||||
GREEN,
|
|
||||||
///
|
|
||||||
BLUE,
|
|
||||||
///
|
|
||||||
CYAN,
|
|
||||||
///
|
|
||||||
MAGENTA,
|
|
||||||
///
|
|
||||||
YELLOW,
|
|
||||||
///
|
|
||||||
MATH,
|
|
||||||
///
|
|
||||||
INSET,
|
|
||||||
///
|
|
||||||
INHERIT_COLOR,
|
|
||||||
///
|
|
||||||
IGNORE_COLOR
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/// Trick to overload constructor and make it megafast
|
/// Trick to overload constructor and make it megafast
|
||||||
enum FONT_INIT1 {
|
enum FONT_INIT1 {
|
||||||
///
|
///
|
||||||
@ -245,13 +212,8 @@ public:
|
|||||||
///
|
///
|
||||||
FONT_MISC_STATE latex() const;
|
FONT_MISC_STATE latex() const;
|
||||||
|
|
||||||
#ifdef USE_PAINTER
|
|
||||||
///
|
///
|
||||||
LColor::color color() const;
|
LColor::color color() const;
|
||||||
#else
|
|
||||||
///
|
|
||||||
FONT_COLOR color() const;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
///
|
///
|
||||||
FONT_DIRECTION direction() const;
|
FONT_DIRECTION direction() const;
|
||||||
@ -275,13 +237,8 @@ public:
|
|||||||
LyXFont & setNoun(LyXFont::FONT_MISC_STATE n);
|
LyXFont & setNoun(LyXFont::FONT_MISC_STATE n);
|
||||||
///
|
///
|
||||||
LyXFont & setLatex(LyXFont::FONT_MISC_STATE l);
|
LyXFont & setLatex(LyXFont::FONT_MISC_STATE l);
|
||||||
#ifdef USE_PAINTER
|
|
||||||
///
|
///
|
||||||
LyXFont & setColor(LColor::color c);
|
LyXFont & setColor(LColor::color c);
|
||||||
#else
|
|
||||||
///
|
|
||||||
LyXFont & setColor(LyXFont::FONT_COLOR c);
|
|
||||||
#endif
|
|
||||||
///
|
///
|
||||||
LyXFont & setDirection(LyXFont::FONT_DIRECTION d);
|
LyXFont & setDirection(LyXFont::FONT_DIRECTION d);
|
||||||
|
|
||||||
@ -391,20 +348,14 @@ public:
|
|||||||
///
|
///
|
||||||
int drawString(string const &, Pixmap pm, int baseline, int x) const;
|
int drawString(string const &, Pixmap pm, int baseline, int x) const;
|
||||||
|
|
||||||
#ifdef USE_PAINTER
|
|
||||||
///
|
///
|
||||||
LColor::color realColor() const;
|
LColor::color realColor() const;
|
||||||
#endif
|
|
||||||
|
|
||||||
///
|
///
|
||||||
XID getFontID() const {
|
XID getFontID() const {
|
||||||
return getXFontstruct()->fid;
|
return getXFontstruct()->fid;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef USE_PAINTER
|
|
||||||
///
|
|
||||||
GC getGC() const;
|
|
||||||
#endif
|
|
||||||
///
|
///
|
||||||
friend inline
|
friend inline
|
||||||
bool operator==(LyXFont const & font1, LyXFont const & font2) {
|
bool operator==(LyXFont const & font1, LyXFont const & font2) {
|
||||||
@ -444,11 +395,7 @@ private:
|
|||||||
FONT_SERIES series;
|
FONT_SERIES series;
|
||||||
FONT_SHAPE shape;
|
FONT_SHAPE shape;
|
||||||
FONT_SIZE size;
|
FONT_SIZE size;
|
||||||
#ifdef USE_PAINTER
|
|
||||||
LColor::color color;
|
LColor::color color;
|
||||||
#else
|
|
||||||
FONT_COLOR color;
|
|
||||||
#endif
|
|
||||||
FONT_MISC_STATE emph;
|
FONT_MISC_STATE emph;
|
||||||
FONT_MISC_STATE underbar;
|
FONT_MISC_STATE underbar;
|
||||||
FONT_MISC_STATE noun;
|
FONT_MISC_STATE noun;
|
||||||
@ -553,11 +500,7 @@ private:
|
|||||||
| ui32(MEDIUM_SERIES) << Ser_Pos
|
| ui32(MEDIUM_SERIES) << Ser_Pos
|
||||||
| ui32(UP_SHAPE) << Sha_Pos
|
| ui32(UP_SHAPE) << Sha_Pos
|
||||||
| ui32(SIZE_NORMAL) << Siz_Pos
|
| ui32(SIZE_NORMAL) << Siz_Pos
|
||||||
#ifdef USE_PAINTER
|
|
||||||
| ui32(LColor::none) << Col_Pos
|
| ui32(LColor::none) << Col_Pos
|
||||||
#else
|
|
||||||
| ui32(NONE) << Col_Pos
|
|
||||||
#endif
|
|
||||||
| ui32(OFF) << Emp_Pos
|
| ui32(OFF) << Emp_Pos
|
||||||
| ui32(OFF) << Und_Pos
|
| ui32(OFF) << Und_Pos
|
||||||
| ui32(OFF) << Nou_Pos
|
| ui32(OFF) << Nou_Pos
|
||||||
@ -569,11 +512,7 @@ private:
|
|||||||
| ui32(INHERIT_SERIES) << Ser_Pos
|
| ui32(INHERIT_SERIES) << Ser_Pos
|
||||||
| ui32(INHERIT_SHAPE) << Sha_Pos
|
| ui32(INHERIT_SHAPE) << Sha_Pos
|
||||||
| ui32(INHERIT_SIZE) << Siz_Pos
|
| ui32(INHERIT_SIZE) << Siz_Pos
|
||||||
#ifdef USE_PAINTER
|
|
||||||
| ui32(LColor::inherit) << Col_Pos
|
| ui32(LColor::inherit) << Col_Pos
|
||||||
#else
|
|
||||||
| ui32(INHERIT_COLOR) << Col_Pos
|
|
||||||
#endif
|
|
||||||
| ui32(INHERIT) << Emp_Pos
|
| ui32(INHERIT) << Emp_Pos
|
||||||
| ui32(INHERIT) << Und_Pos
|
| ui32(INHERIT) << Und_Pos
|
||||||
| ui32(INHERIT) << Nou_Pos
|
| ui32(INHERIT) << Nou_Pos
|
||||||
@ -585,11 +524,7 @@ private:
|
|||||||
| ui32(IGNORE_SERIES) << Ser_Pos
|
| ui32(IGNORE_SERIES) << Ser_Pos
|
||||||
| ui32(IGNORE_SHAPE) << Sha_Pos
|
| ui32(IGNORE_SHAPE) << Sha_Pos
|
||||||
| ui32(IGNORE_SIZE) << Siz_Pos
|
| ui32(IGNORE_SIZE) << Siz_Pos
|
||||||
#ifdef USE_PAINTER
|
|
||||||
| ui32(LColor::ignore) << Col_Pos
|
| ui32(LColor::ignore) << Col_Pos
|
||||||
#else
|
|
||||||
| ui32(IGNORE_COLOR) << Col_Pos
|
|
||||||
#endif
|
|
||||||
| ui32(IGNORE) << Emp_Pos
|
| ui32(IGNORE) << Emp_Pos
|
||||||
| ui32(IGNORE) << Und_Pos
|
| ui32(IGNORE) << Und_Pos
|
||||||
| ui32(IGNORE) << Nou_Pos
|
| ui32(IGNORE) << Nou_Pos
|
||||||
@ -707,19 +642,11 @@ LyXFont::FONT_MISC_STATE LyXFont::latex() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_PAINTER
|
|
||||||
inline
|
inline
|
||||||
LColor::color LyXFont::color() const
|
LColor::color LyXFont::color() const
|
||||||
{
|
{
|
||||||
return bits.color;
|
return bits.color;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
inline
|
|
||||||
LyXFont::FONT_COLOR LyXFont::color() const
|
|
||||||
{
|
|
||||||
return bits.color;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
inline
|
inline
|
||||||
@ -791,21 +718,13 @@ LyXFont & LyXFont::setLatex(LyXFont::FONT_MISC_STATE l)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_PAINTER
|
|
||||||
inline
|
inline
|
||||||
LyXFont & LyXFont::setColor(LColor::color c)
|
LyXFont & LyXFont::setColor(LColor::color c)
|
||||||
{
|
{
|
||||||
bits.color = c;
|
bits.color = c;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
inline
|
|
||||||
LyXFont & LyXFont::setColor(LyXFont::FONT_COLOR c)
|
|
||||||
{
|
|
||||||
bits.color = c;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
inline
|
inline
|
||||||
LyXFont & LyXFont::setDirection(LyXFont::FONT_DIRECTION d)
|
LyXFont & LyXFont::setDirection(LyXFont::FONT_DIRECTION d)
|
||||||
@ -866,17 +785,10 @@ inline LyXFont::FONT_MISC_STATE LyXFont::latex() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_PAINTER
|
|
||||||
inline LColor::color LyXFont::color() const
|
inline LColor::color LyXFont::color() const
|
||||||
{
|
{
|
||||||
return LColor::color((bits >> Col_Pos) & Col_Mask);
|
return LColor::color((bits >> Col_Pos) & Col_Mask);
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
inline LyXFont::FONT_COLOR LyXFont::color() const
|
|
||||||
{
|
|
||||||
return FONT_COLOR((bits >> Col_Pos) & Col_Mask);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
inline LyXFont::FONT_DIRECTION LyXFont::direction() const
|
inline LyXFont::FONT_DIRECTION LyXFont::direction() const
|
||||||
@ -947,21 +859,13 @@ inline LyXFont & LyXFont::setLatex(LyXFont::FONT_MISC_STATE l)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_PAINTER
|
|
||||||
inline LyXFont & LyXFont::setColor(LColor::color c)
|
inline LyXFont & LyXFont::setColor(LColor::color c)
|
||||||
{
|
{
|
||||||
bits &= ~(Col_Mask << Col_Pos);
|
bits &= ~(Col_Mask << Col_Pos);
|
||||||
bits |= ui32(c) << Col_Pos;
|
bits |= ui32(c) << Col_Pos;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
inline LyXFont & LyXFont::setColor(LyXFont::FONT_COLOR c)
|
|
||||||
{
|
|
||||||
bits &= ~(Col_Mask << Col_Pos);
|
|
||||||
bits |= ui32(c) << Col_Pos;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
inline LyXFont & LyXFont::setDirection(LyXFont::FONT_DIRECTION d)
|
inline LyXFont & LyXFont::setDirection(LyXFont::FONT_DIRECTION d)
|
||||||
{
|
{
|
||||||
|
@ -25,7 +25,6 @@
|
|||||||
#include "lyxfr0.h"
|
#include "lyxfr0.h"
|
||||||
#include "lyxfr1.h"
|
#include "lyxfr1.h"
|
||||||
#include "lyxfunc.h"
|
#include "lyxfunc.h"
|
||||||
#include "lyxscreen.h"
|
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "lyxtext.h"
|
#include "lyxtext.h"
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
|
23
src/lyxfr1.C
23
src/lyxfr1.C
@ -25,7 +25,6 @@
|
|||||||
#include "lyxfr0.h"
|
#include "lyxfr0.h"
|
||||||
#include "lyxfr1.h"
|
#include "lyxfr1.h"
|
||||||
#include "lyxfunc.h"
|
#include "lyxfunc.h"
|
||||||
#include "lyxscreen.h"
|
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "lyxtext.h"
|
#include "lyxtext.h"
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
@ -138,7 +137,7 @@ void LyXFindReplace1::StartSearch()
|
|||||||
// routine (1999-01-11, dnaber)
|
// routine (1999-01-11, dnaber)
|
||||||
void LyXFindReplace1::SearchReplaceCB()
|
void LyXFindReplace1::SearchReplaceCB()
|
||||||
{
|
{
|
||||||
if (!current_view->getScreen()) return;
|
if (!current_view->available()) return;
|
||||||
if (current_view->buffer()->isReadonly()) return;
|
if (current_view->buffer()->isReadonly()) return;
|
||||||
|
|
||||||
// CutSelection cannot cut a single space, so we have to stop
|
// CutSelection cannot cut a single space, so we have to stop
|
||||||
@ -153,13 +152,13 @@ void LyXFindReplace1::SearchReplaceCB()
|
|||||||
|
|
||||||
string const replacestring = ReplaceString();
|
string const replacestring = ReplaceString();
|
||||||
|
|
||||||
current_view->getScreen()->HideCursor();
|
current_view->hideCursor();
|
||||||
current_view->update(-2);
|
current_view->update(-2);
|
||||||
|
|
||||||
LyXText * ltCur = current_view->text;
|
LyXText * ltCur = current_view->text;
|
||||||
if (ltCur->selection) {
|
if (ltCur->selection) {
|
||||||
// clear the selection (if there is any)
|
// clear the selection (if there is any)
|
||||||
current_view->getScreen()->ToggleSelection(false);
|
current_view->toggleSelection(false);
|
||||||
current_view->text->
|
current_view->text->
|
||||||
ReplaceSelectionWithString(replacestring.c_str());
|
ReplaceSelectionWithString(replacestring.c_str());
|
||||||
current_view->text->
|
current_view->text->
|
||||||
@ -175,7 +174,7 @@ void LyXFindReplace1::SearchReplaceCB()
|
|||||||
// replaces all occurences of a string (1999-01-15, dnaber@mini.gt.owl.de)
|
// replaces all occurences of a string (1999-01-15, dnaber@mini.gt.owl.de)
|
||||||
void LyXFindReplace1::SearchReplaceAllCB()
|
void LyXFindReplace1::SearchReplaceAllCB()
|
||||||
{
|
{
|
||||||
if (!current_view->getScreen()) return;
|
if (!current_view->available()) return;
|
||||||
if (current_view->buffer()->isReadonly()) return;
|
if (current_view->buffer()->isReadonly()) return;
|
||||||
|
|
||||||
// CutSelection cannot cut a single space, so we have to stop
|
// CutSelection cannot cut a single space, so we have to stop
|
||||||
@ -190,7 +189,7 @@ void LyXFindReplace1::SearchReplaceAllCB()
|
|||||||
|
|
||||||
string const replacestring = ReplaceString();
|
string const replacestring = ReplaceString();
|
||||||
|
|
||||||
current_view->getScreen()->HideCursor();
|
current_view->hideCursor();
|
||||||
|
|
||||||
// start at top
|
// start at top
|
||||||
current_view->text->ClearSelection();
|
current_view->text->ClearSelection();
|
||||||
@ -202,7 +201,7 @@ void LyXFindReplace1::SearchReplaceAllCB()
|
|||||||
ltCur = current_view->text;
|
ltCur = current_view->text;
|
||||||
if (ltCur->selection) {
|
if (ltCur->selection) {
|
||||||
current_view->update(-2);
|
current_view->update(-2);
|
||||||
current_view->getScreen()->ToggleSelection(false);
|
current_view->toggleSelection(false);
|
||||||
current_view->text->
|
current_view->text->
|
||||||
ReplaceSelectionWithString(replacestring.c_str());
|
ReplaceSelectionWithString(replacestring.c_str());
|
||||||
current_view->text->
|
current_view->text->
|
||||||
@ -233,10 +232,10 @@ bool LyXFindReplace1::SearchCB(bool fForward)
|
|||||||
// store search direction
|
// store search direction
|
||||||
searchForward = fForward;
|
searchForward = fForward;
|
||||||
|
|
||||||
if (!current_view->getScreen())
|
if (!current_view->available())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
current_view->getScreen()->HideCursor();
|
current_view->hideCursor();
|
||||||
current_view->update(-2);
|
current_view->update(-2);
|
||||||
LyXText * ltCur = current_view->text;
|
LyXText * ltCur = current_view->text;
|
||||||
if (ltCur->selection)
|
if (ltCur->selection)
|
||||||
@ -252,12 +251,12 @@ bool LyXFindReplace1::SearchCB(bool fForward)
|
|||||||
current_view->update(-2);
|
current_view->update(-2);
|
||||||
|
|
||||||
// clear the selection (if there is any)
|
// clear the selection (if there is any)
|
||||||
current_view->getScreen()->ToggleSelection();
|
current_view->toggleSelection();
|
||||||
current_view->text->ClearSelection();
|
current_view->text->ClearSelection();
|
||||||
|
|
||||||
// set the new selection
|
// set the new selection
|
||||||
SetSelectionOverLenChars(current_view->text, iLenSelected);
|
SetSelectionOverLenChars(current_view->text, iLenSelected);
|
||||||
current_view->getScreen()->ToggleSelection(false);
|
current_view->toggleSelection(false);
|
||||||
current_view->owner()->getMiniBuffer()->Set(_("Found."));
|
current_view->owner()->getMiniBuffer()->Set(_("Found."));
|
||||||
result = true;
|
result = true;
|
||||||
} else {
|
} else {
|
||||||
@ -267,7 +266,7 @@ bool LyXFindReplace1::SearchCB(bool fForward)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (current_view->focus())
|
if (current_view->focus())
|
||||||
current_view->getScreen()->ShowCursor();
|
current_view->showCursor();
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,6 @@
|
|||||||
#include "support/syscall.h"
|
#include "support/syscall.h"
|
||||||
#include "support/lstrings.h"
|
#include "support/lstrings.h"
|
||||||
#include "support/path.h"
|
#include "support/path.h"
|
||||||
#include "lyxscreen.h"
|
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "lyxrc.h"
|
#include "lyxrc.h"
|
||||||
#include "lyxtext.h"
|
#include "lyxtext.h"
|
||||||
@ -148,19 +147,19 @@ void LyXFunc::moveCursorUpdate(bool selecting)
|
|||||||
{
|
{
|
||||||
if (selecting || owner->view()->text->mark_set) {
|
if (selecting || owner->view()->text->mark_set) {
|
||||||
owner->view()->text->SetSelection();
|
owner->view()->text->SetSelection();
|
||||||
owner->view()->getScreen()->ToggleToggle();
|
owner->view()->toggleToggle();
|
||||||
owner->view()->update(0);
|
owner->view()->update(0);
|
||||||
} else {
|
} else {
|
||||||
owner->view()->update(-2); // this IS necessary
|
owner->view()->update(-2); // this IS necessary
|
||||||
// (Matthias)
|
// (Matthias)
|
||||||
}
|
}
|
||||||
|
|
||||||
owner->view()->getScreen()->ShowCursor();
|
owner->view()->showCursor();
|
||||||
|
|
||||||
/* ---> Everytime the cursor is moved, show the current font state. */
|
/* ---> Everytime the cursor is moved, show the current font state. */
|
||||||
// should this too me moved out of this func?
|
// should this too me moved out of this func?
|
||||||
//owner->getMiniBuffer()->Set(CurrentState());
|
//owner->getMiniBuffer()->Set(CurrentState());
|
||||||
owner->view()->SetState();
|
owner->view()->setState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -453,9 +452,8 @@ string LyXFunc::Dispatch(int ac,
|
|||||||
|
|
||||||
selection_possible = false;
|
selection_possible = false;
|
||||||
|
|
||||||
if (owner->view()->available()
|
if (owner->view()->available())
|
||||||
&& owner->view()->getScreen())
|
owner->view()->hideCursor();
|
||||||
owner->view()->getScreen()->HideCursor();
|
|
||||||
|
|
||||||
// We cannot use this function here
|
// We cannot use this function here
|
||||||
if (getStatus(action) & Disabled)
|
if (getStatus(action) & Disabled)
|
||||||
@ -594,7 +592,7 @@ string LyXFunc::Dispatch(int ac,
|
|||||||
|
|
||||||
// ??? Needed ???
|
// ??? Needed ???
|
||||||
// clear the selection (if there is any)
|
// clear the selection (if there is any)
|
||||||
owner->view()->getScreen()->ToggleSelection();
|
owner->view()->toggleSelection();
|
||||||
owner->view()->text->ClearSelection();
|
owner->view()->text->ClearSelection();
|
||||||
|
|
||||||
// Move cursor so that successive C-s 's will not stand in place.
|
// Move cursor so that successive C-s 's will not stand in place.
|
||||||
@ -606,19 +604,18 @@ string LyXFunc::Dispatch(int ac,
|
|||||||
// ??? Needed ???
|
// ??? Needed ???
|
||||||
// set the new selection
|
// set the new selection
|
||||||
// SetSelectionOverLenChars(owner->view()->currentBuffer()->text, iLenSelected);
|
// SetSelectionOverLenChars(owner->view()->currentBuffer()->text, iLenSelected);
|
||||||
owner->view()->getScreen()->ToggleSelection(false);
|
owner->view()->toggleSelection(false);
|
||||||
} else
|
} else
|
||||||
LyXBell();
|
LyXBell();
|
||||||
|
|
||||||
// REMOVED : if (owner->view()->getWorkArea()->focus)
|
// REMOVED : if (owner->view()->getWorkArea()->focus)
|
||||||
owner->view()->getScreen()->ShowCursor();
|
owner->view()->showCursor();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_PREFIX:
|
case LFUN_PREFIX:
|
||||||
{
|
{
|
||||||
if (owner->view()->available()
|
if (owner->view()->available()) {
|
||||||
&& owner->view()->getScreen()) {
|
|
||||||
owner->view()->update(-2);
|
owner->view()->update(-2);
|
||||||
}
|
}
|
||||||
string buf;
|
string buf;
|
||||||
@ -661,6 +658,8 @@ string LyXFunc::Dispatch(int ac,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_CENTER: // this is center and redraw.
|
case LFUN_CENTER: // this is center and redraw.
|
||||||
|
owner->view()->center();
|
||||||
|
#if 0
|
||||||
owner->view()->beforeChange();
|
owner->view()->beforeChange();
|
||||||
if (owner->view()->text->cursor.y >
|
if (owner->view()->text->cursor.y >
|
||||||
owner->view()->getWorkArea()->height() / 2)
|
owner->view()->getWorkArea()->height() / 2)
|
||||||
@ -675,6 +674,7 @@ string LyXFunc::Dispatch(int ac,
|
|||||||
}
|
}
|
||||||
owner->view()->update(0);
|
owner->view()->update(0);
|
||||||
owner->view()->redraw();
|
owner->view()->redraw();
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_APPENDIX:
|
case LFUN_APPENDIX:
|
||||||
@ -933,7 +933,7 @@ string LyXFunc::Dispatch(int ac,
|
|||||||
|
|
||||||
case LFUN_TEX:
|
case LFUN_TEX:
|
||||||
Tex();
|
Tex();
|
||||||
owner->view()->SetState();
|
owner->view()->setState();
|
||||||
owner->getMiniBuffer()->Set(CurrentState());
|
owner->getMiniBuffer()->Set(CurrentState());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -956,7 +956,7 @@ string LyXFunc::Dispatch(int ac,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
Foot(owner->view());
|
Foot(owner->view());
|
||||||
owner->view()->SetState();
|
owner->view()->setState();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_MARGINMELT:
|
case LFUN_MARGINMELT:
|
||||||
@ -969,7 +969,7 @@ string LyXFunc::Dispatch(int ac,
|
|||||||
Melt(owner->view());
|
Melt(owner->view());
|
||||||
} else
|
} else
|
||||||
Margin(owner->view());
|
Margin(owner->view());
|
||||||
owner->view()->SetState();
|
owner->view()->setState();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// --- version control -------------------------------
|
// --- version control -------------------------------
|
||||||
@ -1096,7 +1096,7 @@ string LyXFunc::Dispatch(int ac,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (current_layout != layout.second) {
|
if (current_layout != layout.second) {
|
||||||
owner->view()->getScreen()->HideCursor();
|
owner->view()->hideCursor();
|
||||||
current_layout = layout.second;
|
current_layout = layout.second;
|
||||||
owner->view()->update(-2);
|
owner->view()->update(-2);
|
||||||
owner->view()->text->
|
owner->view()->text->
|
||||||
@ -1153,7 +1153,7 @@ string LyXFunc::Dispatch(int ac,
|
|||||||
case LFUN_RTL:
|
case LFUN_RTL:
|
||||||
{
|
{
|
||||||
RTLCB();
|
RTLCB();
|
||||||
owner->view()->SetState();
|
owner->view()->setState();
|
||||||
owner->getMiniBuffer()->Set(CurrentState());
|
owner->getMiniBuffer()->Set(CurrentState());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -1309,7 +1309,6 @@ string LyXFunc::Dispatch(int ac,
|
|||||||
|
|
||||||
case LFUN_LEFT:
|
case LFUN_LEFT:
|
||||||
{
|
{
|
||||||
#ifdef USE_PAINTER
|
|
||||||
// This is soooo ugly. Isn`t it possible to make
|
// This is soooo ugly. Isn`t it possible to make
|
||||||
// it simpler? (Lgb)
|
// it simpler? (Lgb)
|
||||||
LyXText * txt = owner->view()->text;
|
LyXText * txt = owner->view()->text;
|
||||||
@ -1336,33 +1335,6 @@ string LyXFunc::Dispatch(int ac,
|
|||||||
owner->view()->text->FinishUndo();
|
owner->view()->text->FinishUndo();
|
||||||
moveCursorUpdate(false);
|
moveCursorUpdate(false);
|
||||||
owner->getMiniBuffer()->Set(CurrentState());
|
owner->getMiniBuffer()->Set(CurrentState());
|
||||||
#else
|
|
||||||
// This is soooo ugly. Isn`t it possible to make
|
|
||||||
// it simpler? (Lgb)
|
|
||||||
LyXText * txt = owner->view()->text;
|
|
||||||
LyXDirection direction = txt->cursor.par->getParDirection();
|
|
||||||
if(!txt->mark_set) owner->view()->beforeChange();
|
|
||||||
owner->view()->update(-2);
|
|
||||||
if (direction == LYX_DIR_LEFT_TO_RIGHT)
|
|
||||||
txt->CursorLeft();
|
|
||||||
if (txt->cursor.pos < txt->cursor.par->Last()
|
|
||||||
&& txt->cursor.par->GetChar(txt->cursor.pos)
|
|
||||||
== LyXParagraph::META_INSET
|
|
||||||
&& txt->cursor.par->GetInset(txt->cursor.pos)
|
|
||||||
&& txt->cursor.par->GetInset(txt->cursor.pos)->Editable() == 2) {
|
|
||||||
Inset * tmpinset = txt->cursor.par->GetInset(txt->cursor.pos);
|
|
||||||
setMessage(tmpinset->EditMessage());
|
|
||||||
tmpinset->Edit(tmpinset->Width(txt->GetFont(txt->cursor.par,
|
|
||||||
txt->cursor.pos)), 0);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (direction == LYX_DIR_RIGHT_TO_LEFT)
|
|
||||||
txt->CursorRight();
|
|
||||||
|
|
||||||
owner->view()->text->FinishUndo();
|
|
||||||
moveCursorUpdate(false);
|
|
||||||
owner->getMiniBuffer()->Set(CurrentState());
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1675,14 +1647,14 @@ string LyXFunc::Dispatch(int ac,
|
|||||||
owner->view()->smallUpdate(1);
|
owner->view()->smallUpdate(1);
|
||||||
// It is possible to make it a lot faster still
|
// It is possible to make it a lot faster still
|
||||||
// just comment out the lone below...
|
// just comment out the lone below...
|
||||||
owner->view()->getScreen()->ShowCursor();
|
owner->view()->showCursor();
|
||||||
} else {
|
} else {
|
||||||
owner->view()->cut();
|
owner->view()->cut();
|
||||||
}
|
}
|
||||||
SetUpdateTimer();
|
SetUpdateTimer();
|
||||||
moveCursorUpdate(false);
|
moveCursorUpdate(false);
|
||||||
owner->getMiniBuffer()->Set(CurrentState());
|
owner->getMiniBuffer()->Set(CurrentState());
|
||||||
owner->view()->SetState();
|
owner->view()->setState();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_DELETE_SKIP:
|
case LFUN_DELETE_SKIP:
|
||||||
@ -1792,14 +1764,14 @@ string LyXFunc::Dispatch(int ac,
|
|||||||
owner->view()->smallUpdate(1);
|
owner->view()->smallUpdate(1);
|
||||||
// It is possible to make it a lot faster still
|
// It is possible to make it a lot faster still
|
||||||
// just comment out the lone below...
|
// just comment out the lone below...
|
||||||
owner->view()->getScreen()->ShowCursor();
|
owner->view()->showCursor();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
owner->view()->cut();
|
owner->view()->cut();
|
||||||
}
|
}
|
||||||
SetUpdateTimer();
|
SetUpdateTimer();
|
||||||
owner->getMiniBuffer()->Set(CurrentState());
|
owner->getMiniBuffer()->Set(CurrentState());
|
||||||
owner->view()->SetState();
|
owner->view()->setState();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1843,7 +1815,7 @@ string LyXFunc::Dispatch(int ac,
|
|||||||
SetUpdateTimer(0.01);
|
SetUpdateTimer(0.01);
|
||||||
owner->view()->text->sel_cursor =
|
owner->view()->text->sel_cursor =
|
||||||
owner->view()->text->cursor;
|
owner->view()->text->cursor;
|
||||||
owner->view()->SetState();
|
owner->view()->setState();
|
||||||
owner->getMiniBuffer()->Set(CurrentState());
|
owner->getMiniBuffer()->Set(CurrentState());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1856,7 +1828,7 @@ string LyXFunc::Dispatch(int ac,
|
|||||||
SetUpdateTimer(0.01);
|
SetUpdateTimer(0.01);
|
||||||
owner->view()->text->sel_cursor =
|
owner->view()->text->sel_cursor =
|
||||||
owner->view()->text->cursor;
|
owner->view()->text->cursor;
|
||||||
owner->view()->SetState();
|
owner->view()->setState();
|
||||||
owner->getMiniBuffer()->Set(CurrentState());
|
owner->getMiniBuffer()->Set(CurrentState());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1889,7 +1861,7 @@ string LyXFunc::Dispatch(int ac,
|
|||||||
}
|
}
|
||||||
SetUpdateTimer(0.01);
|
SetUpdateTimer(0.01);
|
||||||
owner->view()->text->sel_cursor = cursor;
|
owner->view()->text->sel_cursor = cursor;
|
||||||
owner->view()->SetState();
|
owner->view()->setState();
|
||||||
owner->getMiniBuffer()->Set(CurrentState());
|
owner->getMiniBuffer()->Set(CurrentState());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -2007,6 +1979,8 @@ string LyXFunc::Dispatch(int ac,
|
|||||||
owner->view()->setCursorFromRow(row);
|
owner->view()->setCursorFromRow(row);
|
||||||
|
|
||||||
// Recenter screen
|
// Recenter screen
|
||||||
|
owner->view()->center();
|
||||||
|
#if 0
|
||||||
owner->view()->beforeChange();
|
owner->view()->beforeChange();
|
||||||
if (owner->view()->text->cursor.y >
|
if (owner->view()->text->cursor.y >
|
||||||
owner->view()->getWorkArea()->height() / 2
|
owner->view()->getWorkArea()->height() / 2
|
||||||
@ -2021,6 +1995,7 @@ string LyXFunc::Dispatch(int ac,
|
|||||||
}
|
}
|
||||||
owner->view()->update(0);
|
owner->view()->update(0);
|
||||||
owner->view()->redraw();
|
owner->view()->redraw();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -2386,7 +2361,7 @@ string LyXFunc::Dispatch(int ac,
|
|||||||
}
|
}
|
||||||
owner->view()->text->InsertFootnoteEnvironment(kind);
|
owner->view()->text->InsertFootnoteEnvironment(kind);
|
||||||
owner->view()->update(1);
|
owner->view()->update(1);
|
||||||
owner->view()->SetState();
|
owner->view()->setState();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
21
src/lyxrc.C
21
src/lyxrc.C
@ -36,9 +36,6 @@ using std::ios;
|
|||||||
// this is crappy... why are those colors command line arguments and
|
// this is crappy... why are those colors command line arguments and
|
||||||
// not in lyxrc?? (Matthias)
|
// not in lyxrc?? (Matthias)
|
||||||
// Because nobody put them there. (Asger)
|
// Because nobody put them there. (Asger)
|
||||||
#ifdef MONO
|
|
||||||
extern int fast_selection;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extern string background_color;
|
extern string background_color;
|
||||||
extern char selection_color[];
|
extern char selection_color[];
|
||||||
@ -100,9 +97,6 @@ enum LyXRCTags {
|
|||||||
RC_KBMAP,
|
RC_KBMAP,
|
||||||
RC_KBMAP_PRIMARY,
|
RC_KBMAP_PRIMARY,
|
||||||
RC_KBMAP_SECONDARY,
|
RC_KBMAP_SECONDARY,
|
||||||
#ifdef MONO
|
|
||||||
RC_FAST_SELECTION,
|
|
||||||
#endif
|
|
||||||
RC_SELECTION_COLOR,
|
RC_SELECTION_COLOR,
|
||||||
RC_BACKGROUND_COLOR,
|
RC_BACKGROUND_COLOR,
|
||||||
RC_FAX_COMMAND,
|
RC_FAX_COMMAND,
|
||||||
@ -171,9 +165,6 @@ static keyword_item lyxrcTags[] = {
|
|||||||
{ "\\dvi_to_ps_command", RC_DVI_TO_PS_COMMAND },
|
{ "\\dvi_to_ps_command", RC_DVI_TO_PS_COMMAND },
|
||||||
{ "\\escape_chars", RC_ESC_CHARS },
|
{ "\\escape_chars", RC_ESC_CHARS },
|
||||||
{ "\\exit_confirmation", RC_EXIT_CONFIRMATION },
|
{ "\\exit_confirmation", RC_EXIT_CONFIRMATION },
|
||||||
#ifdef MONO
|
|
||||||
{ "\\fast_selection", RC_FAST_SELECTION },
|
|
||||||
#endif
|
|
||||||
{ "\\fax_command", RC_FAX_COMMAND },
|
{ "\\fax_command", RC_FAX_COMMAND },
|
||||||
{ "\\fax_program", RC_FAXPROGRAM },
|
{ "\\fax_program", RC_FAXPROGRAM },
|
||||||
{ "\\font_encoding", RC_FONT_ENCODING },
|
{ "\\font_encoding", RC_FONT_ENCODING },
|
||||||
@ -848,13 +839,6 @@ int LyXRC::read(string const & filename)
|
|||||||
cursor_follows_scrollbar = lexrc.GetBool();
|
cursor_follows_scrollbar = lexrc.GetBool();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef MONO
|
|
||||||
case RC_FAST_SELECTION:
|
|
||||||
if (lexrc.next())
|
|
||||||
fast_selection = lexrc.GetBool();
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
case RC_BACKGROUND_COLOR:
|
case RC_BACKGROUND_COLOR:
|
||||||
if (lexrc.next())
|
if (lexrc.next())
|
||||||
background_color = lexrc.GetString();
|
background_color = lexrc.GetString();
|
||||||
@ -1188,11 +1172,6 @@ void LyXRC::output(ostream & os) const
|
|||||||
case RC_CURSOR_FOLLOWS_SCROLLBAR:
|
case RC_CURSOR_FOLLOWS_SCROLLBAR:
|
||||||
os << "\\cursor_follows_scrollbar "
|
os << "\\cursor_follows_scrollbar "
|
||||||
<< tostr(cursor_follows_scrollbar) << "\n";
|
<< tostr(cursor_follows_scrollbar) << "\n";
|
||||||
#ifdef MONO
|
|
||||||
case RC_FAST_SELECTION:
|
|
||||||
os << "\\fast_selection "
|
|
||||||
<< tostr(static_cast<bool>(fast_selection)) << "\n";
|
|
||||||
#endif
|
|
||||||
case RC_BACKGROUND_COLOR:
|
case RC_BACKGROUND_COLOR:
|
||||||
os << "\\background_color \"" << background_color << "\"\n";
|
os << "\\background_color \"" << background_color << "\"\n";
|
||||||
case RC_SELECTION_COLOR:
|
case RC_SELECTION_COLOR:
|
||||||
|
205
src/lyxscreen.h
205
src/lyxscreen.h
@ -19,12 +19,6 @@
|
|||||||
#include FORMS_H_LOCATION
|
#include FORMS_H_LOCATION
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
|
|
||||||
#define USE_PAINTER 1
|
|
||||||
|
|
||||||
#ifndef USE_PAINTER
|
|
||||||
#include "lyxdraw.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
class LyXText;
|
class LyXText;
|
||||||
struct Row;
|
struct Row;
|
||||||
typedef unsigned short Dimension;
|
typedef unsigned short Dimension;
|
||||||
@ -49,14 +43,6 @@ public:
|
|||||||
///
|
///
|
||||||
~LyXScreen();
|
~LyXScreen();
|
||||||
|
|
||||||
#ifndef USE_PAINTER
|
|
||||||
/** Return the forground pixmap. This function is a _hack_,
|
|
||||||
we should be rid of it as soon as possible. But to do that
|
|
||||||
a lot in the mathcode and the figinset has to be rewritten.
|
|
||||||
Tasks for 0.13. */
|
|
||||||
Pixmap getForeground() { return foreground; };
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/** Draws the screen form textposition y. Uses as much of
|
/** Draws the screen form textposition y. Uses as much of
|
||||||
the already printed pixmap as possible */
|
the already printed pixmap as possible */
|
||||||
void Draw(long y );
|
void Draw(long y );
|
||||||
@ -77,7 +63,7 @@ public:
|
|||||||
///
|
///
|
||||||
void ShowManualCursor(long x, long y, int asc, int desc);
|
void ShowManualCursor(long x, long y, int asc, int desc);
|
||||||
///
|
///
|
||||||
void HideManualCursor(long x, long y, int asc, int desc);
|
void HideManualCursor();
|
||||||
/// returns 1 if first has changed, otherwise 0
|
/// returns 1 if first has changed, otherwise 0
|
||||||
int FitManualCursor(long, long, int, int);
|
int FitManualCursor(long, long, int, int);
|
||||||
///
|
///
|
||||||
@ -96,54 +82,6 @@ public:
|
|||||||
or only current row */
|
or only current row */
|
||||||
void SmallUpdate();
|
void SmallUpdate();
|
||||||
|
|
||||||
#ifndef USE_PAINTER
|
|
||||||
/** Functions for drawing into the LyXScreen. The number of
|
|
||||||
drawing functions should be minimized, now there
|
|
||||||
is too many. And also there is mixed X and XForms drawing
|
|
||||||
functions called. Not good. */
|
|
||||||
void drawPoint(GC gc, int x, int y);
|
|
||||||
///
|
|
||||||
void drawLine(gc_type t, int baseline, int x, int length);
|
|
||||||
///
|
|
||||||
void drawLine(GC gc, int a, int b, int c, int d);
|
|
||||||
///
|
|
||||||
void drawLines(GC gc, XPoint * p, int np);
|
|
||||||
///
|
|
||||||
void drawVerticalLine(gc_type t, int x, int y1, int y2);
|
|
||||||
///
|
|
||||||
void drawOnOffLine(int baseline, int x, int length);
|
|
||||||
///
|
|
||||||
void drawThickLine(int baseline, int x, int length);
|
|
||||||
///
|
|
||||||
void drawTableLine(int baseline, int x, int length, bool on_off);
|
|
||||||
///
|
|
||||||
void drawVerticalTableLine(int x, int y1, int y2, bool on_off);
|
|
||||||
///
|
|
||||||
void drawVerticalOnOffLine(int x, int y1, int y2);
|
|
||||||
///
|
|
||||||
void fillArc(GC gc, int x, int y,
|
|
||||||
unsigned int w, unsigned int h,
|
|
||||||
int a1, int a2);
|
|
||||||
///
|
|
||||||
void drawArc(GC gc, int x, int y,
|
|
||||||
unsigned int w, unsigned int h,
|
|
||||||
int a1, int a2);
|
|
||||||
///
|
|
||||||
void drawSegments(GC gc, XSegment * s, int ns);
|
|
||||||
///
|
|
||||||
void fillRectangle(gc_type t, int, int, int, int);
|
|
||||||
///
|
|
||||||
void drawRectangle(gc_type t, int x, int y, int width, int height);
|
|
||||||
///
|
|
||||||
void drawFrame(int ft, int x, int y, int w, int h,
|
|
||||||
FL_COLOR col, int b);
|
|
||||||
///
|
|
||||||
int drawText(LyXFont const & font, char const *,
|
|
||||||
int n, int baseline, int x);
|
|
||||||
///
|
|
||||||
int drawString(LyXFont const & font, string const & str,
|
|
||||||
int baseline, int x);
|
|
||||||
#endif
|
|
||||||
/// first visible pixel-row
|
/// first visible pixel-row
|
||||||
long first;
|
long first;
|
||||||
|
|
||||||
@ -191,148 +129,9 @@ private:
|
|||||||
long screen_refresh_y;
|
long screen_refresh_y;
|
||||||
///
|
///
|
||||||
Row * screen_refresh_row;
|
Row * screen_refresh_row;
|
||||||
///
|
|
||||||
//friend class InsetFormula;
|
|
||||||
#ifdef USE_PAINTER
|
|
||||||
///
|
///
|
||||||
GC gc_copy;
|
GC gc_copy;
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Some of the easy to inline draw methods:
|
|
||||||
#ifndef USE_PAINTER
|
|
||||||
inline
|
|
||||||
void LyXScreen::drawPoint(GC gc, int x, int y)
|
|
||||||
{
|
|
||||||
XDrawPoint(fl_display, foreground, gc,
|
|
||||||
x, y);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
inline
|
|
||||||
void LyXScreen::drawLine(GC gc, int a, int b, int c, int d)
|
|
||||||
{
|
|
||||||
XDrawLine(fl_display, foreground, gc, a, b, c, d);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
inline
|
|
||||||
void LyXScreen::drawLine(gc_type t, int baseline, int x, int length)
|
|
||||||
{
|
|
||||||
drawLine(getGC(t), x, baseline, x + length, baseline);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
inline
|
|
||||||
void LyXScreen::drawLines(GC gc, XPoint * p, int np)
|
|
||||||
{
|
|
||||||
XDrawLines(fl_display, foreground, gc, p, np, CoordModeOrigin);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
inline
|
|
||||||
void LyXScreen::drawVerticalLine(gc_type t, int x, int y1, int y2)
|
|
||||||
{
|
|
||||||
drawLine(getGC(t),
|
|
||||||
x,
|
|
||||||
y1,
|
|
||||||
x,
|
|
||||||
y2);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
inline
|
|
||||||
void LyXScreen::drawOnOffLine(int baseline, int x, int length)
|
|
||||||
{
|
|
||||||
drawLine(getGC(gc_on_off_line),
|
|
||||||
x,
|
|
||||||
baseline,
|
|
||||||
x + length,
|
|
||||||
baseline);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
inline
|
|
||||||
void LyXScreen::drawThickLine(int baseline, int x, int length)
|
|
||||||
{
|
|
||||||
drawLine(getGC(gc_thick_line),
|
|
||||||
x,
|
|
||||||
baseline,
|
|
||||||
x + length,
|
|
||||||
baseline);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
inline
|
|
||||||
void LyXScreen::drawVerticalOnOffLine(int x, int y1, int y2)
|
|
||||||
{
|
|
||||||
drawLine(getGC(gc_fill),
|
|
||||||
x,
|
|
||||||
y1,
|
|
||||||
x,
|
|
||||||
y2);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
inline
|
|
||||||
void LyXScreen::fillArc(GC gc, int x, int y,
|
|
||||||
unsigned int w, unsigned int h,
|
|
||||||
int a1, int a2)
|
|
||||||
{
|
|
||||||
XFillArc(fl_display, foreground, gc,
|
|
||||||
x, y,
|
|
||||||
w, h, a1, a2);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
inline
|
|
||||||
void LyXScreen::drawArc(GC gc, int x, int y,
|
|
||||||
unsigned int w, unsigned int h,
|
|
||||||
int a1, int a2)
|
|
||||||
{
|
|
||||||
XDrawArc(fl_display, foreground, gc,
|
|
||||||
x, y,
|
|
||||||
w, h, a1, a2);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
inline
|
|
||||||
void LyXScreen::drawSegments(GC gc, XSegment * s, int ns)
|
|
||||||
{
|
|
||||||
XDrawSegments(fl_display, foreground, gc, s, ns);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
inline
|
|
||||||
void LyXScreen::fillRectangle(gc_type t, int a, int b, int c, int d)
|
|
||||||
{
|
|
||||||
XFillRectangle(fl_display, foreground, getGC(t),
|
|
||||||
a, b, c, d);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
inline
|
|
||||||
void LyXScreen::drawRectangle(gc_type t, int x, int y, int width, int height)
|
|
||||||
{
|
|
||||||
XDrawRectangle(fl_display, foreground, getGC(t),
|
|
||||||
x, y, width, height);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
inline
|
|
||||||
int LyXScreen::drawText(LyXFont const & font, char const * fs,
|
|
||||||
int n, int baseline, int x)
|
|
||||||
{
|
|
||||||
return font.drawText(fs, n, foreground, baseline, x);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
inline
|
|
||||||
int LyXScreen::drawString(LyXFont const & font, string const & str,
|
|
||||||
int baseline, int x)
|
|
||||||
{
|
|
||||||
return font.drawString(str, foreground, baseline, x);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
class Buffer;
|
class Buffer;
|
||||||
class BufferParams;
|
class BufferParams;
|
||||||
class LyXScreen;
|
//class LyXScreen;
|
||||||
class Row;
|
class Row;
|
||||||
class BufferView;
|
class BufferView;
|
||||||
|
|
||||||
@ -290,13 +290,8 @@ public:
|
|||||||
decide, wether it is selected text or not. This is a strange
|
decide, wether it is selected text or not. This is a strange
|
||||||
solution but faster.
|
solution but faster.
|
||||||
*/
|
*/
|
||||||
#ifdef USE_PAINTER
|
|
||||||
void GetVisibleRow(int offset,
|
void GetVisibleRow(int offset,
|
||||||
Row * row_ptr, long y);
|
Row * row_ptr, long y);
|
||||||
#else
|
|
||||||
void GetVisibleRow(LyXScreen & scr, int offset,
|
|
||||||
Row * row_ptr, long y);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* footnotes: */
|
/* footnotes: */
|
||||||
///
|
///
|
||||||
@ -555,17 +550,11 @@ private:
|
|||||||
///
|
///
|
||||||
int SingleWidth(LyXParagraph * par,
|
int SingleWidth(LyXParagraph * par,
|
||||||
LyXParagraph::size_type pos, char c) const;
|
LyXParagraph::size_type pos, char c) const;
|
||||||
#ifdef USE_PAINTER
|
|
||||||
///
|
///
|
||||||
void draw(Row const * row,
|
void draw(Row const * row,
|
||||||
LyXParagraph::size_type & pos,
|
LyXParagraph::size_type & pos,
|
||||||
int offset, float & x);
|
int offset, float & x);
|
||||||
#else
|
|
||||||
///
|
|
||||||
void Draw(Row const * row, LyXParagraph::size_type & pos,
|
|
||||||
LyXScreen & scr,
|
|
||||||
int offset, float & x);
|
|
||||||
#endif
|
|
||||||
/// get the next breakpoint in a given paragraph
|
/// get the next breakpoint in a given paragraph
|
||||||
LyXParagraph::size_type NextBreakPoint(Row const * row,
|
LyXParagraph::size_type NextBreakPoint(Row const * row,
|
||||||
int width) const;
|
int width) const;
|
||||||
|
@ -30,10 +30,6 @@
|
|||||||
#include "lyx_cb.h"
|
#include "lyx_cb.h"
|
||||||
#include "minibuffer.h"
|
#include "minibuffer.h"
|
||||||
#include "BufferView.h"
|
#include "BufferView.h"
|
||||||
#include "lyxscreen.h"
|
|
||||||
#ifndef USE_PAINTER
|
|
||||||
#include "lyxdraw.h"
|
|
||||||
#endif
|
|
||||||
#include "lyxtext.h"
|
#include "lyxtext.h"
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
#include "LaTeXFeatures.h"
|
#include "LaTeXFeatures.h"
|
||||||
@ -45,17 +41,8 @@
|
|||||||
|
|
||||||
extern void UpdateInset(BufferView *, Inset * inset, bool mark_dirty = true);
|
extern void UpdateInset(BufferView *, Inset * inset, bool mark_dirty = true);
|
||||||
|
|
||||||
#ifndef USE_PAINTER
|
|
||||||
extern GC canvasGC, mathGC, mathLineGC, latexGC, cursorGC, mathFrameGC;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extern char * mathed_label;
|
extern char * mathed_label;
|
||||||
|
|
||||||
#ifdef MONO
|
|
||||||
extern int mono_video;
|
|
||||||
extern int fast_selection;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extern BufferView * current_view;
|
extern BufferView * current_view;
|
||||||
extern char const * latex_special_chars;
|
extern char const * latex_special_chars;
|
||||||
|
|
||||||
@ -150,13 +137,8 @@ LyXFont WhichFont(short type, int size)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_PAINTER
|
|
||||||
if (type != LM_TC_TEXTRM)
|
if (type != LM_TC_TEXTRM)
|
||||||
f.setColor(LColor::math);
|
f.setColor(LColor::math);
|
||||||
#else
|
|
||||||
if (type != LM_TC_TEXTRM)
|
|
||||||
f.setColor(LyXFont::MATH);
|
|
||||||
#endif
|
|
||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -170,7 +152,7 @@ void mathed_init_fonts() //removed 'static' because DEC cxx does not
|
|||||||
Math_Fonts = new LyXFont[8]; //DEC cxx cannot initialize all fonts
|
Math_Fonts = new LyXFont[8]; //DEC cxx cannot initialize all fonts
|
||||||
//at once (JMarc) rc
|
//at once (JMarc) rc
|
||||||
for (int i = 0 ; i < 8 ; ++i){
|
for (int i = 0 ; i < 8 ; ++i){
|
||||||
Math_Fonts[i] = LyXFont::ALL_SANE;
|
Math_Fonts[i] = LyXFont(LyXFont::ALL_SANE);
|
||||||
}
|
}
|
||||||
Math_Fonts[0].setShape(LyXFont::ITALIC_SHAPE);
|
Math_Fonts[0].setShape(LyXFont::ITALIC_SHAPE);
|
||||||
|
|
||||||
@ -196,7 +178,7 @@ void mathed_init_fonts() //removed 'static' because DEC cxx does not
|
|||||||
MathedInset::df_width = f.width('I');
|
MathedInset::df_width = f.width('I');
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_PAINTER
|
|
||||||
LyXFont mathed_get_font(short type, int size)
|
LyXFont mathed_get_font(short type, int size)
|
||||||
{
|
{
|
||||||
LyXFont f = WhichFont(type, size);
|
LyXFont f = WhichFont(type, size);
|
||||||
@ -205,24 +187,6 @@ LyXFont mathed_get_font(short type, int size)
|
|||||||
}
|
}
|
||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
void mathed_set_font(short type, int size)
|
|
||||||
{
|
|
||||||
if (!canvasGC) {
|
|
||||||
cursorGC = getGC(gc_thin_on_off_line);
|
|
||||||
canvasGC = getGC(gc_lighted);
|
|
||||||
latexGC = getGC(gc_latex);
|
|
||||||
mathLineGC = getGC(gc_math);
|
|
||||||
mathFrameGC = getGC(gc_math_frame);
|
|
||||||
}
|
|
||||||
LyXFont f = WhichFont(type, size);
|
|
||||||
if (type == LM_TC_TEX) {
|
|
||||||
f.setLatex(LyXFont::ON);
|
|
||||||
latexGC = f.getGC();
|
|
||||||
} else
|
|
||||||
mathGC = f.getGC();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
int mathed_string_width(short type, int size, byte const * s, int ls)
|
int mathed_string_width(short type, int size, byte const * s, int ls)
|
||||||
@ -279,14 +243,12 @@ int mathed_char_height(short type, int size, byte c, int & asc, int & des)
|
|||||||
|
|
||||||
|
|
||||||
// In a near future maybe we use a better fonts renderer
|
// In a near future maybe we use a better fonts renderer
|
||||||
#ifdef USE_PAINTER
|
|
||||||
void MathedInset::drawStr(Painter & pain, short type, int size,
|
void MathedInset::drawStr(Painter & pain, short type, int size,
|
||||||
int x, int y, byte * s, int ls)
|
int x, int y, byte * s, int ls)
|
||||||
{
|
{
|
||||||
string st;
|
string st;
|
||||||
if (MathIsBinary(type)) {
|
if (MathIsBinary(type)) {
|
||||||
for (int i = 0; i < ls; ++i) {
|
for (int i = 0; i < ls; ++i) {
|
||||||
#warning What conversion should be done for s[i] here?
|
|
||||||
st += string(" ") + char(s[i]) + ' ';
|
st += string(" ") + char(s[i]) + ' ';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -295,27 +257,6 @@ void MathedInset::drawStr(Painter & pain, short type, int size,
|
|||||||
LyXFont mf = mathed_get_font(type, size);
|
LyXFont mf = mathed_get_font(type, size);
|
||||||
pain.text(x, y, st, mf);
|
pain.text(x, y, st, mf);
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
void MathedInset::drawStr(short type, int siz, int x, int y, byte * s, int ls)
|
|
||||||
{
|
|
||||||
mathed_set_font(type, siz);
|
|
||||||
byte sx[80];
|
|
||||||
if (MathIsBinary(type)) {
|
|
||||||
byte * ps = &sx[0];
|
|
||||||
for (int i = 0; i < ls && i < 75; ++i) {
|
|
||||||
*(ps++) = ' ';
|
|
||||||
*(ps++) = s[i];
|
|
||||||
*(ps++) = ' ';
|
|
||||||
}
|
|
||||||
// *ps = ' ';
|
|
||||||
ls *= 3;
|
|
||||||
s = &sx[0];
|
|
||||||
}
|
|
||||||
GC gc = (type == LM_TC_TEX) ? latexGC: mathGC;
|
|
||||||
XDrawString(fl_display, pm, gc, x, y, reinterpret_cast<char*>(s), ls);
|
|
||||||
XFlush(fl_display);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
InsetFormula::InsetFormula(bool display)
|
InsetFormula::InsetFormula(bool display)
|
||||||
@ -436,50 +377,26 @@ void InsetFormula::Read(LyXLex & lex)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_PAINTER
|
|
||||||
int InsetFormula::ascent(Painter &, LyXFont const &) const
|
int InsetFormula::ascent(Painter &, LyXFont const &) const
|
||||||
{
|
{
|
||||||
return par->Ascent() + ((disp_flag) ? 8 : 1);
|
return par->Ascent() + ((disp_flag) ? 8 : 1);
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
int InsetFormula::Ascent(LyXFont const &) const
|
|
||||||
{
|
|
||||||
return par->Ascent() + ((disp_flag) ? 8 : 1);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_PAINTER
|
|
||||||
int InsetFormula::descent(Painter &, LyXFont const &) const
|
int InsetFormula::descent(Painter &, LyXFont const &) const
|
||||||
{
|
{
|
||||||
return par->Descent() + ((disp_flag) ? 8 : 1);
|
return par->Descent() + ((disp_flag) ? 8 : 1);
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
int InsetFormula::Descent(LyXFont const &) const
|
|
||||||
{
|
|
||||||
return par->Descent() + ((disp_flag) ? 8 : 1);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_PAINTER
|
|
||||||
int InsetFormula::width(Painter &, LyXFont const & f) const
|
int InsetFormula::width(Painter &, LyXFont const & f) const
|
||||||
{
|
{
|
||||||
lfont_size = f.size();
|
lfont_size = f.size();
|
||||||
par->Metrics();
|
par->Metrics();
|
||||||
return par->Width(); //+2;
|
return par->Width(); //+2;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
int InsetFormula::Width(LyXFont const & f) const
|
|
||||||
{
|
|
||||||
lfont_size = f.size();
|
|
||||||
par->Metrics();
|
|
||||||
return par->Width(); //+2;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_PAINTER
|
|
||||||
void InsetFormula::draw(Painter & pain, LyXFont const &,
|
void InsetFormula::draw(Painter & pain, LyXFont const &,
|
||||||
int baseline, float & x) const
|
int baseline, float & x) const
|
||||||
{
|
{
|
||||||
@ -537,62 +454,6 @@ void InsetFormula::draw(Painter & pain, LyXFont const &,
|
|||||||
}
|
}
|
||||||
cursor_visible = false;
|
cursor_visible = false;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
void InsetFormula::Draw(LyXFont f, LyXScreen & scr, int baseline, float & x)
|
|
||||||
{
|
|
||||||
// This is Alejandros domain so I'll use this
|
|
||||||
unsigned long pm = scr.getForeground();
|
|
||||||
|
|
||||||
lfont_size = f.size();
|
|
||||||
mathed_set_font(LM_TC_TEXTRM, LM_ST_TEXT); // otherwise a segfault could occur
|
|
||||||
// in some XDrawRectangles (i.e. matrix) (Matthias)
|
|
||||||
if (mathcursor && mathcursor->GetPar() == par) {
|
|
||||||
if (mathcursor->Selection()) {
|
|
||||||
int n;
|
|
||||||
XPoint * p = mathcursor->SelGetArea(n);
|
|
||||||
XFillPolygon(fl_display, pm, getGC(gc_selection),
|
|
||||||
p, n, Nonconvex, CoordModeOrigin);
|
|
||||||
}
|
|
||||||
mathcursor->Draw(pm, int(x), baseline);
|
|
||||||
} else {
|
|
||||||
// par->Metrics();
|
|
||||||
par->setDrawable(pm);
|
|
||||||
par->Draw(int(x), baseline);
|
|
||||||
}
|
|
||||||
x += float(Width(f));
|
|
||||||
|
|
||||||
if (par->GetType() == LM_OT_PARN || par->GetType() == LM_OT_MPARN) {
|
|
||||||
char s[80];
|
|
||||||
LyXFont font = WhichFont(LM_TC_BF, par->size);
|
|
||||||
font.setLatex(LyXFont::OFF);
|
|
||||||
|
|
||||||
if (par->GetType() == LM_OT_PARN) {
|
|
||||||
if (!label.empty())
|
|
||||||
sprintf(s, "(%s)", label.c_str());
|
|
||||||
else
|
|
||||||
sprintf(s, "(#)");
|
|
||||||
font.drawString(s, pm, baseline, int(x+20));
|
|
||||||
} else
|
|
||||||
if (par->GetType() == LM_OT_MPARN) {
|
|
||||||
MathMatrixInset * mt = static_cast<MathMatrixInset*>(par);
|
|
||||||
int y;
|
|
||||||
MathedRowSt const* crow = mt->getRowSt();
|
|
||||||
while (crow) {
|
|
||||||
y = baseline + crow->getBaseline();
|
|
||||||
if (crow->isNumbered()) {
|
|
||||||
if (crow->getLabel())
|
|
||||||
sprintf(s, "(%s)", crow->getLabel());
|
|
||||||
else
|
|
||||||
sprintf(s, "(#)");
|
|
||||||
font.drawString(s, pm, y, int(x+20));
|
|
||||||
}
|
|
||||||
crow = crow->getNext();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
cursor_visible = false;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
void InsetFormula::Edit(int x, int y)
|
void InsetFormula::Edit(int x, int y)
|
||||||
@ -644,16 +505,16 @@ void InsetFormula::ToggleInsetCursor()
|
|||||||
if (!mathcursor)
|
if (!mathcursor)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int x, y, asc, desc;
|
int x, y;
|
||||||
mathcursor->GetPos(x, y);
|
mathcursor->GetPos(x, y);
|
||||||
// x -= par->xo;
|
// x -= par->xo;
|
||||||
y -= par->yo;
|
y -= par->yo;
|
||||||
LyXFont font = WhichFont(LM_TC_TEXTRM, LM_ST_TEXT);
|
LyXFont font = WhichFont(LM_TC_TEXTRM, LM_ST_TEXT);
|
||||||
asc = font.maxAscent();
|
int asc = font.maxAscent();
|
||||||
desc = font.maxDescent();
|
int desc = font.maxDescent();
|
||||||
|
|
||||||
if (cursor_visible)
|
if (cursor_visible)
|
||||||
current_view->hideLockedInsetCursor(x, y, asc, desc);
|
current_view->hideLockedInsetCursor();
|
||||||
else
|
else
|
||||||
current_view->showLockedInsetCursor(x, y, asc, desc);
|
current_view->showLockedInsetCursor(x, y, asc, desc);
|
||||||
cursor_visible = !cursor_visible;
|
cursor_visible = !cursor_visible;
|
||||||
@ -864,10 +725,6 @@ bool InsetFormula::LocalDispatch(int action, char const * arg)
|
|||||||
static MathSpaceInset * sp= 0;
|
static MathSpaceInset * sp= 0;
|
||||||
|
|
||||||
HideInsetCursor();
|
HideInsetCursor();
|
||||||
#ifdef MONO
|
|
||||||
if (mathcursor->Selection() && (fast_selection || mono_video))
|
|
||||||
ToggleInsetSelection();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (mathcursor->getLastCode() == LM_TC_TEX) {
|
if (mathcursor->getLastCode() == LM_TC_TEX) {
|
||||||
varcode = LM_TC_TEX;
|
varcode = LM_TC_TEX;
|
||||||
@ -1325,11 +1182,7 @@ bool InsetFormula::LocalDispatch(int action, char const * arg)
|
|||||||
&& action != LFUN_BACKSPACE)
|
&& action != LFUN_BACKSPACE)
|
||||||
UpdateLocal();
|
UpdateLocal();
|
||||||
if (sp && !space_on) sp = 0;
|
if (sp && !space_on) sp = 0;
|
||||||
if (mathcursor->Selection() || (was_selection
|
if (mathcursor->Selection() || was_selection)
|
||||||
#ifdef MONO
|
|
||||||
&& !(fast_selection || mono_video)
|
|
||||||
#endif
|
|
||||||
))
|
|
||||||
ToggleInsetSelection();
|
ToggleInsetSelection();
|
||||||
|
|
||||||
if (result)
|
if (result)
|
||||||
@ -1341,7 +1194,6 @@ bool InsetFormula::LocalDispatch(int action, char const * arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_PAINTER
|
|
||||||
void
|
void
|
||||||
MathFuncInset::draw(Painter & pain, int x, int y)
|
MathFuncInset::draw(Painter & pain, int x, int y)
|
||||||
{
|
{
|
||||||
@ -1349,35 +1201,10 @@ MathFuncInset::draw(Painter & pain, int x, int y)
|
|||||||
LyXFont font = WhichFont(LM_TC_TEXTRM, size);
|
LyXFont font = WhichFont(LM_TC_TEXTRM, size);
|
||||||
font.setLatex(LyXFont::ON);
|
font.setLatex(LyXFont::ON);
|
||||||
x += (font.textWidth("I", 1) + 3) / 4;
|
x += (font.textWidth("I", 1) + 3) / 4;
|
||||||
#ifdef MONO
|
|
||||||
if (mono_video) {
|
|
||||||
int a = font.maxAscent();
|
|
||||||
int d = font.maxDescent();
|
|
||||||
pain.fillRectangle(x, y - a, font.textWidth(name, strlen(name)), a + d);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
pain.text(x, y, name, font);
|
pain.text(x, y, name, font);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
void
|
|
||||||
MathFuncInset::Draw(int x, int y)
|
|
||||||
{
|
|
||||||
if (name && name[0] > ' ') {
|
|
||||||
LyXFont font = WhichFont(LM_TC_TEXTRM, size);
|
|
||||||
font.setLatex(LyXFont::ON);
|
|
||||||
x += (font.textWidth("I", 1)+3)/4;
|
|
||||||
if (mono_video) {
|
|
||||||
int a = font.maxAscent(), d = font.maxDescent();
|
|
||||||
XFillRectangle (fl_display, pm, getGC(gc_copy),
|
|
||||||
x, y-a,
|
|
||||||
font.textWidth(name, strlen(name)), a+d);
|
|
||||||
XFlush(fl_display);
|
|
||||||
}
|
|
||||||
font.drawString(name, pm, y, x);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void MathFuncInset::Metrics()
|
void MathFuncInset::Metrics()
|
||||||
{
|
{
|
||||||
|
@ -36,7 +36,6 @@ public:
|
|||||||
InsetFormula(MathParInset *);
|
InsetFormula(MathParInset *);
|
||||||
///
|
///
|
||||||
~InsetFormula();
|
~InsetFormula();
|
||||||
#ifdef USE_PAINTER
|
|
||||||
///
|
///
|
||||||
int ascent(Painter &, LyXFont const &) const;
|
int ascent(Painter &, LyXFont const &) const;
|
||||||
///
|
///
|
||||||
@ -45,16 +44,6 @@ public:
|
|||||||
int width(Painter &, LyXFont const &) const;
|
int width(Painter &, LyXFont const &) const;
|
||||||
///
|
///
|
||||||
void draw(Painter &, LyXFont const &, int baseline, float & x) const;
|
void draw(Painter &, LyXFont const &, int baseline, float & x) const;
|
||||||
#else
|
|
||||||
///
|
|
||||||
int Ascent(LyXFont const & font) const;
|
|
||||||
///
|
|
||||||
int Descent(LyXFont const & font) const;
|
|
||||||
///
|
|
||||||
int Width(LyXFont const & font) const;
|
|
||||||
///
|
|
||||||
void Draw(LyXFont font, LyXScreen & scr, int baseline, float & x);
|
|
||||||
#endif
|
|
||||||
///
|
///
|
||||||
void Write(ostream &);
|
void Write(ostream &);
|
||||||
///
|
///
|
||||||
|
@ -28,10 +28,6 @@
|
|||||||
#include "lyx_main.h"
|
#include "lyx_main.h"
|
||||||
#include "lyx_cb.h"
|
#include "lyx_cb.h"
|
||||||
#include "BufferView.h"
|
#include "BufferView.h"
|
||||||
#include "lyxscreen.h"
|
|
||||||
#ifndef USE_PAINTER
|
|
||||||
#include "lyxdraw.h"
|
|
||||||
#endif
|
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
#include "Painter.h"
|
#include "Painter.h"
|
||||||
|
|
||||||
@ -118,7 +114,6 @@ void InsetFormulaMacro::Read(LyXLex & lex)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_PAINTER
|
|
||||||
int InsetFormulaMacro::ascent(Painter & pain, LyXFont const & f) const
|
int InsetFormulaMacro::ascent(Painter & pain, LyXFont const & f) const
|
||||||
{
|
{
|
||||||
if (opened) {
|
if (opened) {
|
||||||
@ -127,19 +122,8 @@ int InsetFormulaMacro::ascent(Painter & pain, LyXFont const & f) const
|
|||||||
}
|
}
|
||||||
return f.maxAscent()+3;
|
return f.maxAscent()+3;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
int InsetFormulaMacro::Ascent(LyXFont const & f) const
|
|
||||||
{
|
|
||||||
if (opened) {
|
|
||||||
tmacro->update();
|
|
||||||
return InsetFormula::Ascent(f);
|
|
||||||
}
|
|
||||||
return f.maxAscent()+3;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_PAINTER
|
|
||||||
int InsetFormulaMacro::descent(Painter & pain, LyXFont const & f) const
|
int InsetFormulaMacro::descent(Painter & pain, LyXFont const & f) const
|
||||||
{
|
{
|
||||||
if (opened) {
|
if (opened) {
|
||||||
@ -148,19 +132,8 @@ int InsetFormulaMacro::descent(Painter & pain, LyXFont const & f) const
|
|||||||
}
|
}
|
||||||
return f.maxDescent()+1;
|
return f.maxDescent()+1;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
int InsetFormulaMacro::Descent(LyXFont const & f) const
|
|
||||||
{
|
|
||||||
if (opened) {
|
|
||||||
tmacro->update();
|
|
||||||
return InsetFormula::Descent(f);
|
|
||||||
}
|
|
||||||
return f.maxDescent()+1;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_PAINTER
|
|
||||||
int InsetFormulaMacro::width(Painter & pain, LyXFont const & f) const
|
int InsetFormulaMacro::width(Painter & pain, LyXFont const & f) const
|
||||||
{
|
{
|
||||||
if (opened) {
|
if (opened) {
|
||||||
@ -171,21 +144,8 @@ int InsetFormulaMacro::width(Painter & pain, LyXFont const & f) const
|
|||||||
ilabel += name;
|
ilabel += name;
|
||||||
return 6 + f.stringWidth(ilabel);
|
return 6 + f.stringWidth(ilabel);
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
int InsetFormulaMacro::Width(LyXFont const & f) const
|
|
||||||
{
|
|
||||||
if (opened) {
|
|
||||||
tmacro->update();
|
|
||||||
return InsetFormula::Width(f);
|
|
||||||
}
|
|
||||||
string ilabel(_("Macro: "));
|
|
||||||
ilabel += name;
|
|
||||||
return 6 + f.stringWidth(ilabel);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_PAINTER
|
|
||||||
void InsetFormulaMacro::draw(Painter & pain, LyXFont const & f,
|
void InsetFormulaMacro::draw(Painter & pain, LyXFont const & f,
|
||||||
int baseline, float & x) const
|
int baseline, float & x) const
|
||||||
{
|
{
|
||||||
@ -212,32 +172,6 @@ void InsetFormulaMacro::draw(Painter & pain, LyXFont const & f,
|
|||||||
x += width(pain, font) - 1;
|
x += width(pain, font) - 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
void InsetFormulaMacro::Draw(LyXFont font, LyXScreen & scr,
|
|
||||||
int baseline, float & x)
|
|
||||||
{
|
|
||||||
tmacro->update();
|
|
||||||
if (opened) {
|
|
||||||
tmacro->setEditMode(true);
|
|
||||||
InsetFormula::Draw(font, scr, baseline, x);
|
|
||||||
tmacro->setEditMode(false);
|
|
||||||
} else {
|
|
||||||
font.setColor(LyXFont::MATH);
|
|
||||||
|
|
||||||
int y = baseline - Ascent(font) + 1;
|
|
||||||
int w = Width(font) - 2, h = (Ascent(font) + Descent(font) - 2);
|
|
||||||
|
|
||||||
|
|
||||||
scr.fillRectangle(gc_lighted, int(x), y, w, h);
|
|
||||||
scr.drawFrame(FL_UP_FRAME, int(x), y, w, h, FL_BLACK, -1);
|
|
||||||
|
|
||||||
string s(_("Macro: "));
|
|
||||||
s += name;
|
|
||||||
scr.drawString(font, s, baseline, int(x +2));
|
|
||||||
x += Width(font) - 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
void InsetFormulaMacro::Edit(int x, int y)
|
void InsetFormulaMacro::Edit(int x, int y)
|
||||||
|
@ -35,7 +35,6 @@ public:
|
|||||||
InsetFormulaMacro(string name, int na = 0, bool env = false);
|
InsetFormulaMacro(string name, int na = 0, bool env = false);
|
||||||
///
|
///
|
||||||
~InsetFormulaMacro();
|
~InsetFormulaMacro();
|
||||||
#ifdef USE_PAINTER
|
|
||||||
///
|
///
|
||||||
int ascent(Painter &, LyXFont const &) const;
|
int ascent(Painter &, LyXFont const &) const;
|
||||||
///
|
///
|
||||||
@ -44,16 +43,6 @@ public:
|
|||||||
int width(Painter &, LyXFont const &) const;
|
int width(Painter &, LyXFont const &) const;
|
||||||
///
|
///
|
||||||
void draw(Painter &, LyXFont const &, int baseline, float & x) const;
|
void draw(Painter &, LyXFont const &, int baseline, float & x) const;
|
||||||
#else
|
|
||||||
///
|
|
||||||
int Ascent(LyXFont const & font) const;
|
|
||||||
///
|
|
||||||
int Descent(LyXFont const & font) const;
|
|
||||||
///
|
|
||||||
int Width(LyXFont const & font) const;
|
|
||||||
///
|
|
||||||
void Draw(LyXFont font, LyXScreen & scr, int baseline, float & x);
|
|
||||||
#endif
|
|
||||||
///
|
///
|
||||||
void Read(LyXLex & lex);
|
void Read(LyXLex & lex);
|
||||||
///
|
///
|
||||||
|
@ -31,14 +31,6 @@
|
|||||||
#include "LColor.h"
|
#include "LColor.h"
|
||||||
#include "Painter.h"
|
#include "Painter.h"
|
||||||
|
|
||||||
#ifndef USE_PAINTER
|
|
||||||
extern void mathed_set_font(short type, int style);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef USE_PAINTER
|
|
||||||
extern GC canvasGC, mathGC, latexGC, cursorGC, mathFrameGC;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static LyxArrayBase * selarray = 0;
|
static LyxArrayBase * selarray = 0;
|
||||||
|
|
||||||
inline bool IsAlpha(char c)
|
inline bool IsAlpha(char c)
|
||||||
@ -155,7 +147,6 @@ void MathedCursor::SetPar(MathParInset * p)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_PAINTER
|
|
||||||
void MathedCursor::draw(Painter & pain, int x, int y)
|
void MathedCursor::draw(Painter & pain, int x, int y)
|
||||||
{
|
{
|
||||||
// lyxerr << "Cursor[" << x << " " << y << "] ";
|
// lyxerr << "Cursor[" << x << " " << y << "] ";
|
||||||
@ -171,27 +162,8 @@ void MathedCursor::draw(Painter & pain, int x, int y)
|
|||||||
par->draw(pain, x, y);
|
par->draw(pain, x, y);
|
||||||
cursor->Adjust();
|
cursor->Adjust();
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
void MathedCursor::Draw(long unsigned pm, int x, int y)
|
|
||||||
{
|
|
||||||
// lyxerr << "Cursor[" << x << " " << y << "] ";
|
|
||||||
win = pm; // win = (mathedCanvas) ? mathedCanvas: pm;
|
|
||||||
par->Metrics();
|
|
||||||
int w = par->Width()+2, a = par->Ascent()+1, h = par->Height()+1;
|
|
||||||
if (par->GetType() > LM_OT_PAR) { a += 4; h += 8; }
|
|
||||||
|
|
||||||
if (!canvasGC) mathed_set_font(LM_TC_VAR, 1);
|
|
||||||
// XFillRectangle(fl_display, pm, canvasGC, x, y-a, w, h);
|
|
||||||
XDrawRectangle(fl_display, pm, mathFrameGC, x - 1, y - a, w, h);
|
|
||||||
XFlush(fl_display);
|
|
||||||
MathParInset::pm = pm;
|
|
||||||
par->Draw(x, y);
|
|
||||||
cursor->Adjust();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_PAINTER
|
|
||||||
void MathedCursor::Redraw(Painter & pain)
|
void MathedCursor::Redraw(Painter & pain)
|
||||||
{
|
{
|
||||||
lyxerr[Debug::MATHED] << "Mathed: Redrawing!" << endl;
|
lyxerr[Debug::MATHED] << "Mathed: Redrawing!" << endl;
|
||||||
@ -205,21 +177,6 @@ void MathedCursor::Redraw(Painter & pain)
|
|||||||
LColor::mathbg);
|
LColor::mathbg);
|
||||||
par->draw(pain, x, y);
|
par->draw(pain, x, y);
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
void MathedCursor::Redraw()
|
|
||||||
{
|
|
||||||
lyxerr[Debug::MATHED] << "Mathed: Redrawing!" << endl;
|
|
||||||
par->Metrics();
|
|
||||||
int w = par->Width(), h = par->Height();
|
|
||||||
int x, y;
|
|
||||||
par->GetXY(x, y);
|
|
||||||
mathed_set_font(LM_TC_VAR, 1);
|
|
||||||
XFillRectangle(fl_display, win, canvasGC, x, y-par->Ascent(), w, h);
|
|
||||||
XFlush(fl_display);
|
|
||||||
MathParInset::pm = win;
|
|
||||||
par->Draw(x, y);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
bool MathedCursor::Left(bool sel)
|
bool MathedCursor::Left(bool sel)
|
||||||
@ -960,7 +917,6 @@ void MathedCursor::SelBalance()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_PAINTER
|
|
||||||
void MathedCursor::SelGetArea(int ** xp, int ** yp, int & np)
|
void MathedCursor::SelGetArea(int ** xp, int ** yp, int & np)
|
||||||
{
|
{
|
||||||
static int xpoint[10];
|
static int xpoint[10];
|
||||||
@ -1028,67 +984,6 @@ void MathedCursor::SelGetArea(int ** xp, int ** yp, int & np)
|
|||||||
// lyxerr << "XY[" << point[i].x << " " << point[i].y << "] ";
|
// lyxerr << "XY[" << point[i].x << " " << point[i].y << "] ";
|
||||||
|
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
XPoint * MathedCursor::SelGetArea(int & np)
|
|
||||||
{
|
|
||||||
if (!selection) {
|
|
||||||
np = 0;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static XPoint point[10];
|
|
||||||
|
|
||||||
// single row selection
|
|
||||||
int i = 0, x, y, a, d, xo, yo, x1, y1, a1, d1; //, p1, p2;
|
|
||||||
|
|
||||||
// Balance anchor and cursor
|
|
||||||
SelBalance();
|
|
||||||
|
|
||||||
cursor->p->GetXY(xo, yo);
|
|
||||||
int w = cursor->p->Width();
|
|
||||||
cursor->GetPos(x1, y1);
|
|
||||||
cursor->getAD(a1, d1);
|
|
||||||
anchor->GetPos(x, y);
|
|
||||||
anchor->getAD(a, d);
|
|
||||||
|
|
||||||
point[i].x = x;
|
|
||||||
point[i++].y = y+d;
|
|
||||||
point[i].x = x;
|
|
||||||
point[i++].y = y-a;
|
|
||||||
|
|
||||||
if (y != y1) {
|
|
||||||
point[i].x = xo + w;
|
|
||||||
point[i++].y = y - a;
|
|
||||||
if (x1 < xo + w) {
|
|
||||||
point[i].x = xo + w;
|
|
||||||
point[i++].y = y1 - a;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
point[i].x = x1;
|
|
||||||
point[i++].y = y1 - a;
|
|
||||||
point[i].x = x1;
|
|
||||||
point[i++].y = y1 + d;
|
|
||||||
|
|
||||||
if (y != y1) {
|
|
||||||
point[i].x = xo;
|
|
||||||
point[i++].y = y1 + d;
|
|
||||||
if (x > xo) {
|
|
||||||
point[i].x = xo;
|
|
||||||
point[i++].y = y + d;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
point[i].x = point[0].x;
|
|
||||||
point[i++].y = point[0].y;
|
|
||||||
np = i;
|
|
||||||
// lyxerr << "AN[" << x << " " << y << " " << x1 << " " << y1 << "] ";
|
|
||||||
// lyxerr << "MT[" << a << " " << d << " " << a1 << " " << d1 << "] ";
|
|
||||||
// for (i = 0; i < np; ++i)
|
|
||||||
// lyxerr << "XY[" << point[i].x << " " << point[i].y << "] ";
|
|
||||||
|
|
||||||
return &point[0];
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
void MathedCursor::setAccent(int ac)
|
void MathedCursor::setAccent(int ac)
|
||||||
|
@ -56,17 +56,10 @@ class MathedCursor {
|
|||||||
bool Push();
|
bool Push();
|
||||||
/// Pull out an argument from its container inset
|
/// Pull out an argument from its container inset
|
||||||
bool pullArg();
|
bool pullArg();
|
||||||
#ifdef USE_PAINTER
|
|
||||||
///
|
///
|
||||||
void draw(Painter &, int x, int y);
|
void draw(Painter &, int x, int y);
|
||||||
///
|
///
|
||||||
void Redraw(Painter &);
|
void Redraw(Painter &);
|
||||||
#else
|
|
||||||
///
|
|
||||||
void Draw(long unsigned pm, int x, int y);
|
|
||||||
///
|
|
||||||
void Redraw();
|
|
||||||
#endif
|
|
||||||
///
|
///
|
||||||
void Delete();
|
void Delete();
|
||||||
///
|
///
|
||||||
@ -123,12 +116,8 @@ class MathedCursor {
|
|||||||
void SelClear();
|
void SelClear();
|
||||||
///
|
///
|
||||||
void SelBalance();
|
void SelBalance();
|
||||||
#ifdef USE_PAINTER
|
|
||||||
void SelGetArea(int ** xp, int ** yp, int & n);
|
|
||||||
#else
|
|
||||||
///
|
///
|
||||||
XPoint * SelGetArea(int &);
|
void SelGetArea(int ** xp, int ** yp, int & n);
|
||||||
#endif
|
|
||||||
///
|
///
|
||||||
void clearLastCode() { lastcode = LM_TC_MIN; }
|
void clearLastCode() { lastcode = LM_TC_MIN; }
|
||||||
///
|
///
|
||||||
|
@ -24,8 +24,6 @@
|
|||||||
#pragma interface
|
#pragma interface
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define USE_PAINTER 1
|
|
||||||
|
|
||||||
#include "support/LIstream.h"
|
#include "support/LIstream.h"
|
||||||
|
|
||||||
#include "LString.h"
|
#include "LString.h"
|
||||||
@ -229,13 +227,8 @@ class MathedInset {
|
|||||||
///
|
///
|
||||||
virtual ~MathedInset() {}
|
virtual ~MathedInset() {}
|
||||||
|
|
||||||
#ifdef USE_PAINTER
|
|
||||||
/// Draw the object
|
/// Draw the object
|
||||||
virtual void draw(Painter &, int x, int baseline) = 0;
|
virtual void draw(Painter &, int x, int baseline) = 0;
|
||||||
#else
|
|
||||||
/// Draw the object
|
|
||||||
virtual void Draw(int x, int baseline) = 0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/// Write LaTeX and Lyx code
|
/// Write LaTeX and Lyx code
|
||||||
virtual void Write(ostream &) = 0;
|
virtual void Write(ostream &) = 0;
|
||||||
@ -276,11 +269,6 @@ class MathedInset {
|
|||||||
virtual void SetStyle(short st) { size = st; } // Metrics();
|
virtual void SetStyle(short st) { size = st; } // Metrics();
|
||||||
///
|
///
|
||||||
virtual void SetName(char const * n) { name = n; }
|
virtual void SetName(char const * n) { name = n; }
|
||||||
#ifndef USE_PAINTER
|
|
||||||
///
|
|
||||||
void setDrawable(long unsigned int d) { pm = d; }
|
|
||||||
#endif
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
///
|
///
|
||||||
char const * name;
|
char const * name;
|
||||||
@ -294,20 +282,11 @@ class MathedInset {
|
|||||||
int descent;
|
int descent;
|
||||||
///
|
///
|
||||||
short size;
|
short size;
|
||||||
#ifndef USE_PAINTER
|
|
||||||
/// This works while only one process can draw unless
|
|
||||||
/// the process have their own data
|
|
||||||
static unsigned long pm;
|
|
||||||
#endif
|
|
||||||
/// Default metrics
|
/// Default metrics
|
||||||
static int df_asc, df_des, df_width;
|
static int df_asc, df_des, df_width;
|
||||||
|
|
||||||
/// In a near future maybe we use a better fonts renderer than X
|
/// In a near future maybe we use a better fonts renderer than X
|
||||||
#ifdef USE_PAINTER
|
|
||||||
void drawStr(Painter &, short, int, int, int, byte *, int);
|
void drawStr(Painter &, short, int, int, int, byte *, int);
|
||||||
#else
|
|
||||||
void drawStr(short, int, int, int, byte *, int);
|
|
||||||
#endif
|
|
||||||
///
|
///
|
||||||
friend class MathedCursor;
|
friend class MathedCursor;
|
||||||
///
|
///
|
||||||
@ -349,11 +328,7 @@ class MathParInset: public MathedInset {
|
|||||||
virtual MathedInset * Clone();
|
virtual MathedInset * Clone();
|
||||||
|
|
||||||
/// Draw the object on a drawable
|
/// Draw the object on a drawable
|
||||||
#ifdef USE_PAINTER
|
|
||||||
virtual void draw(Painter &, int x, int baseline);
|
virtual void draw(Painter &, int x, int baseline);
|
||||||
#else
|
|
||||||
virtual void Draw(int x, int baseline);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/// Write LaTeX code
|
/// Write LaTeX code
|
||||||
virtual void Write(ostream &);
|
virtual void Write(ostream &);
|
||||||
@ -511,13 +486,8 @@ class MathMatrixInset: public MathParInset {
|
|||||||
MathedInset * Clone();
|
MathedInset * Clone();
|
||||||
///
|
///
|
||||||
virtual ~MathMatrixInset();
|
virtual ~MathMatrixInset();
|
||||||
#ifdef USE_PAINTER
|
|
||||||
///
|
///
|
||||||
void draw(Painter &, int, int);
|
void draw(Painter &, int, int);
|
||||||
#else
|
|
||||||
///
|
|
||||||
void Draw(int, int);
|
|
||||||
#endif
|
|
||||||
///
|
///
|
||||||
void Write(ostream &);
|
void Write(ostream &);
|
||||||
///
|
///
|
||||||
|
@ -231,9 +231,6 @@ typedef float matriz_data[2][2];
|
|||||||
|
|
||||||
const matriz_data MATIDEN= { {1, 0}, {0, 1}};
|
const matriz_data MATIDEN= { {1, 0}, {0, 1}};
|
||||||
|
|
||||||
#ifndef USE_PAINTER
|
|
||||||
extern void mathed_set_font(short type, int style);
|
|
||||||
#endif
|
|
||||||
extern int mathed_char_width(short type, int style, byte c);
|
extern int mathed_char_width(short type, int style, byte c);
|
||||||
extern int mathed_char_height(short, int, byte, int&, int&);
|
extern int mathed_char_height(short, int, byte, int&, int&);
|
||||||
|
|
||||||
@ -290,13 +287,11 @@ void Matriz::transf(float xp, float yp, float &x, float &y)
|
|||||||
y = m[1][0]*xp + m[1][1]*yp;
|
y = m[1][0]*xp + m[1][1]*yp;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef USE_PAINTER
|
|
||||||
extern GC latexGC, mathGC, mathLineGC, cursorGC;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static int search_deco(int code)
|
static
|
||||||
|
int search_deco(int code)
|
||||||
{
|
{
|
||||||
int i= 0;
|
int i = 0;
|
||||||
|
|
||||||
while (math_deco_table[i].code && math_deco_table[i].code!= code) ++i;
|
while (math_deco_table[i].code && math_deco_table[i].code!= code) ++i;
|
||||||
if (!math_deco_table[i].code) i = -1;
|
if (!math_deco_table[i].code) i = -1;
|
||||||
@ -304,7 +299,6 @@ static int search_deco(int code)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_PAINTER
|
|
||||||
void mathed_draw_deco(Painter & pain, int x, int y, int w, int h, int code)
|
void mathed_draw_deco(Painter & pain, int x, int y, int w, int h, int code)
|
||||||
{
|
{
|
||||||
Matriz mt, sqmt;
|
Matriz mt, sqmt;
|
||||||
@ -368,75 +362,8 @@ void mathed_draw_deco(Painter & pain, int x, int y, int w, int h, int code)
|
|||||||
}
|
}
|
||||||
} while (code);
|
} while (code);
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
void mathed_draw_deco(Window win, int x, int y, int w, int h, int code)
|
|
||||||
{
|
|
||||||
Matriz mt, sqmt;
|
|
||||||
XPoint p[32];
|
|
||||||
float xx, yy, x2, y2;
|
|
||||||
int i= 0, j, n;
|
|
||||||
|
|
||||||
j = search_deco(code);
|
|
||||||
if (j < 0) return;
|
|
||||||
|
|
||||||
int r = math_deco_table[j].angle;
|
|
||||||
float * d = math_deco_table[j].data;
|
|
||||||
|
|
||||||
if (h > 70 && (math_deco_table[j].code == int('(') || math_deco_table[j].code == int(')')))
|
|
||||||
d = parenthHigh;
|
|
||||||
|
|
||||||
mt.rota(r);
|
|
||||||
mt.escala(w, h);
|
|
||||||
|
|
||||||
n = (w < h) ? w: h;
|
|
||||||
sqmt.rota(r);
|
|
||||||
sqmt.escala(n, n);
|
|
||||||
if (r> 0 && r< 3) y += h;
|
|
||||||
if (r>= 2) x += w;
|
|
||||||
do {
|
|
||||||
code = int(d[i++]);
|
|
||||||
switch (code) {
|
|
||||||
case 0: break;
|
|
||||||
case 1:
|
|
||||||
case 3:
|
|
||||||
{
|
|
||||||
xx = d[i++]; yy = d[i++];
|
|
||||||
x2 = d[i++]; y2 = d[i++];
|
|
||||||
if (code == 3)
|
|
||||||
sqmt.transf(xx, yy, xx, yy);
|
|
||||||
else
|
|
||||||
mt.transf(xx, yy, xx, yy);
|
|
||||||
mt.transf(x2, y2, x2, y2);
|
|
||||||
XDrawLine(fl_display, win, mathGC, x + int(xx), y + int(yy),
|
|
||||||
x + int(x2), y + int(y2));
|
|
||||||
XFlush(fl_display);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 2:
|
|
||||||
case 4:
|
|
||||||
{
|
|
||||||
n = int(d[i++]);
|
|
||||||
for (j = 0; j < n; ++j) {
|
|
||||||
xx = d[i++]; yy = d[i++];
|
|
||||||
// lyxerr << " " << xx << " " << yy << " ";
|
|
||||||
if (code == 4)
|
|
||||||
sqmt.transf(xx, yy, xx, yy);
|
|
||||||
else
|
|
||||||
mt.transf(xx, yy, xx, yy);
|
|
||||||
p[j].x = x + int(xx);
|
|
||||||
p[j].y = y + int(yy);
|
|
||||||
// lyxerr << "P[" << j " " << xx << " " << yy << " " << x << " " << y << "]";
|
|
||||||
}
|
|
||||||
XDrawLines(fl_display, win, mathLineGC, p, n, CoordModeOrigin);
|
|
||||||
XFlush(fl_display);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} while (code);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_PAINTER
|
|
||||||
void
|
void
|
||||||
MathDelimInset::draw(Painter & pain, int x, int y)
|
MathDelimInset::draw(Painter & pain, int x, int y)
|
||||||
{
|
{
|
||||||
@ -457,29 +384,6 @@ MathDelimInset::draw(Painter & pain, int x, int y)
|
|||||||
} else
|
} else
|
||||||
mathed_draw_deco(pain, x, y-ascent, dw, Height(), right);
|
mathed_draw_deco(pain, x, y-ascent, dw, Height(), right);
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
void
|
|
||||||
MathDelimInset::Draw(int x, int y)
|
|
||||||
{
|
|
||||||
xo = x; yo = y;
|
|
||||||
MathParInset::Draw(x+dw+2, y-dh);
|
|
||||||
//int h= Height(), hg= descent-1;
|
|
||||||
|
|
||||||
if (left == '.') {
|
|
||||||
XDrawLine(fl_display, pm, cursorGC, x+4, yo-ascent, x+4, yo+descent);
|
|
||||||
XFlush(fl_display);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
mathed_draw_deco(pm, x, y-ascent, dw, Height(), left);
|
|
||||||
x += Width()-dw-2;
|
|
||||||
if (right == '.') {
|
|
||||||
XDrawLine(fl_display, pm, cursorGC, x+4, yo-ascent, x+4, yo+descent);
|
|
||||||
XFlush(fl_display);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
mathed_draw_deco(pm, x, y-ascent, dw, Height(), right);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -499,21 +403,12 @@ MathDelimInset::Metrics()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_PAINTER
|
|
||||||
void
|
void
|
||||||
MathDecorationInset::draw(Painter & pain, int x, int y)
|
MathDecorationInset::draw(Painter & pain, int x, int y)
|
||||||
{
|
{
|
||||||
MathParInset::draw(pain, x + (width - dw) / 2, y);
|
MathParInset::draw(pain, x + (width - dw) / 2, y);
|
||||||
mathed_draw_deco(pain, x, y + dy, width, dh, deco);
|
mathed_draw_deco(pain, x, y + dy, width, dh, deco);
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
void
|
|
||||||
MathDecorationInset::Draw(int x, int y)
|
|
||||||
{
|
|
||||||
MathParInset::Draw(x+(width-dw)/2, y);
|
|
||||||
mathed_draw_deco(pm, x, y+dy, width, dh, deco);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -538,7 +433,6 @@ MathDecorationInset::Metrics()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_PAINTER
|
|
||||||
void
|
void
|
||||||
MathAccentInset::draw(Painter & pain, int x, int y)
|
MathAccentInset::draw(Painter & pain, int x, int y)
|
||||||
{
|
{
|
||||||
@ -552,31 +446,6 @@ MathAccentInset::draw(Painter & pain, int x, int y)
|
|||||||
x += (code == LM_not) ? (width-dw) / 2 : 2;
|
x += (code == LM_not) ? (width-dw) / 2 : 2;
|
||||||
mathed_draw_deco(pain, x, y - dy, dw, dh, code);
|
mathed_draw_deco(pain, x, y - dy, dw, dh, code);
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
void
|
|
||||||
MathAccentInset::Draw(int x, int y)
|
|
||||||
{
|
|
||||||
int dw = width-2;
|
|
||||||
/* char s[8];
|
|
||||||
mathed_set_font(fn, size);
|
|
||||||
if (MathIsBinary(fn)) {
|
|
||||||
s[0] = s[2] = ' ';
|
|
||||||
s[1] = (char)c;
|
|
||||||
ns = 3;
|
|
||||||
dw = mathed_char_width(fn, size, c);
|
|
||||||
} else
|
|
||||||
s[0] = (char)c;
|
|
||||||
*/
|
|
||||||
if (inset) {
|
|
||||||
inset->Draw(x, y);
|
|
||||||
} else {
|
|
||||||
drawStr(fn, size, x, y, &c, 1);
|
|
||||||
XFlush(fl_display);
|
|
||||||
}
|
|
||||||
x += (code == LM_not) ? (width-dw)/2: 2;
|
|
||||||
mathed_draw_deco(pm, x, y-dy, dw, dh, code);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -607,7 +476,6 @@ MathAccentInset::Metrics()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_PAINTER
|
|
||||||
void
|
void
|
||||||
MathDotsInset::draw(Painter & pain, int x, int y)
|
MathDotsInset::draw(Painter & pain, int x, int y)
|
||||||
{
|
{
|
||||||
@ -616,16 +484,6 @@ MathDotsInset::draw(Painter & pain, int x, int y)
|
|||||||
if (code != LM_vdots) --y;
|
if (code != LM_vdots) --y;
|
||||||
mathed_draw_deco(pain, x + 2, y - dh, width - 2, ascent, code);
|
mathed_draw_deco(pain, x + 2, y - dh, width - 2, ascent, code);
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
void
|
|
||||||
MathDotsInset::Draw(int x, int y)
|
|
||||||
{
|
|
||||||
mathed_draw_deco(pm, x + 2, y - dh, width - 2, ascent, code);
|
|
||||||
if (code == LM_vdots || code == LM_ddots) ++x;
|
|
||||||
if (code!= LM_vdots) --y;
|
|
||||||
mathed_draw_deco(pm, x + 2, y - dh, width - 2, ascent, code);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -23,26 +23,12 @@
|
|||||||
#include "lyxfont.h"
|
#include "lyxfont.h"
|
||||||
#include "Painter.h"
|
#include "Painter.h"
|
||||||
|
|
||||||
#ifdef USE_PAINTER
|
|
||||||
extern LyXFont mathed_get_font(short type, int size);
|
extern LyXFont mathed_get_font(short type, int size);
|
||||||
#else
|
|
||||||
extern void mathed_set_font(short type, int style);
|
|
||||||
#endif
|
|
||||||
extern int mathed_char_width(short type, int style, byte c);
|
extern int mathed_char_width(short type, int style, byte c);
|
||||||
extern int mathed_string_width(short type, int style, byte const* s, int ls);
|
extern int mathed_string_width(short type, int style, byte const* s, int ls);
|
||||||
extern int mathed_string_height(short, int, byte const*, int, int&, int&);
|
extern int mathed_string_height(short, int, byte const*, int, int&, int&);
|
||||||
extern int mathed_char_height(short, int, byte, int&, int&);
|
extern int mathed_char_height(short, int, byte, int&, int&);
|
||||||
|
|
||||||
#ifndef USE_PAINTER
|
|
||||||
GC canvasGC= 0, mathGC= 0, mathLineGC= 0, latexGC= 0, cursorGC= 0, mathFrameGC= 0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef USE_PAINTER
|
|
||||||
unsigned long MathedInset::pm;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef USE_PAINTER
|
|
||||||
void
|
void
|
||||||
MathSpaceInset::draw(Painter & pain, int x, int y)
|
MathSpaceInset::draw(Painter & pain, int x, int y)
|
||||||
{
|
{
|
||||||
@ -61,28 +47,8 @@ MathSpaceInset::draw(Painter & pain, int x, int y)
|
|||||||
|
|
||||||
pain.lines(xp, yp, 4, (space) ? LColor::latex : LColor::math);
|
pain.lines(xp, yp, 4, (space) ? LColor::latex : LColor::math);
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
void
|
|
||||||
MathSpaceInset::Draw(int x, int y)
|
|
||||||
{
|
|
||||||
|
|
||||||
// XPoint p[4] = {{++x, y-3}, {x, y}, {x+width-2, y}, {x+width-2, y-3}};
|
|
||||||
|
|
||||||
// Sadly, HP-UX CC can't handle that kind of initialization.
|
|
||||||
|
|
||||||
XPoint p[4];
|
|
||||||
p[0].x = ++x; p[0].y = y-3;
|
|
||||||
p[1].x = x; p[1].y = y;
|
|
||||||
p[2].x = x+width-2; p[2].y = y;
|
|
||||||
p[3].x = x+width-2; p[3].y = y-3;
|
|
||||||
|
|
||||||
XDrawLines(fl_display, pm,(space) ? latexGC: mathGC, p, 4, CoordModeOrigin);
|
|
||||||
XFlush(fl_display);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_PAINTER
|
|
||||||
void
|
void
|
||||||
MathParInset::draw(Painter & pain, int x, int y)
|
MathParInset::draw(Painter & pain, int x, int y)
|
||||||
{
|
{
|
||||||
@ -168,97 +134,6 @@ MathParInset::draw(Painter & pain, int x, int y)
|
|||||||
pain.rectangle(x, y - df_asc, df_width, df_asc, LColor::mathline);
|
pain.rectangle(x, y - df_asc, df_width, df_asc, LColor::mathline);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
void
|
|
||||||
MathParInset::Draw(int x, int y)
|
|
||||||
{
|
|
||||||
byte cx, cxp= 0;
|
|
||||||
int xp= 0, ls;
|
|
||||||
int asc= df_asc, des= 0;
|
|
||||||
bool limits = false;
|
|
||||||
|
|
||||||
xo = x; yo = y;
|
|
||||||
if (!array || array->empty()) {
|
|
||||||
mathed_set_font(LM_TC_VAR, 1);
|
|
||||||
if (array) {
|
|
||||||
MathedXIter data(this);
|
|
||||||
data.GetPos(x, y);
|
|
||||||
}
|
|
||||||
XDrawRectangle(fl_display, pm, mathLineGC, x, y-df_asc, df_width, df_asc);
|
|
||||||
XFlush(fl_display);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
MathedXIter data(this);
|
|
||||||
data.GoBegin();
|
|
||||||
while (data.OK()) {
|
|
||||||
data.GetPos(x, y);
|
|
||||||
cx = data.GetChar();
|
|
||||||
if (cx >= ' ') {
|
|
||||||
byte *s = data.GetString(ls);
|
|
||||||
drawStr(data.FCode(), size, x, y, s, ls);
|
|
||||||
mathed_char_height(LM_TC_CONST, size, 'y', asc, des);
|
|
||||||
limits = false;
|
|
||||||
} else {
|
|
||||||
if (cx == 0) break;
|
|
||||||
if (MathIsInset(cx)) {
|
|
||||||
int yy = y;
|
|
||||||
MathedInset *p = data.GetInset();
|
|
||||||
if (cx == LM_TC_UP) {
|
|
||||||
if (limits) {
|
|
||||||
x -= (xp>p->Width()) ? p->Width()+(xp-p->Width())/2: xp;
|
|
||||||
yy -= (asc + p->Descent()+4);
|
|
||||||
} else
|
|
||||||
yy -= (p->Descent()>asc) ? p->Descent()+4: asc;
|
|
||||||
} else
|
|
||||||
if (cx == LM_TC_DOWN) {
|
|
||||||
if (limits) {
|
|
||||||
x -= (xp>p->Width()) ? p->Width()+(xp-p->Width())/2: xp;
|
|
||||||
yy += des + p->Ascent() + 2;
|
|
||||||
} else
|
|
||||||
yy += des + p->Ascent()/2;
|
|
||||||
} else {
|
|
||||||
asc = p->Ascent();
|
|
||||||
des = p->Descent();
|
|
||||||
}
|
|
||||||
p->Draw(x, yy);
|
|
||||||
if (cx!= LM_TC_UP && cx!= LM_TC_DOWN) {
|
|
||||||
limits = p->GetLimits();
|
|
||||||
if (limits) xp = p->Width();
|
|
||||||
}
|
|
||||||
data.Next();
|
|
||||||
} else
|
|
||||||
if (cx == LM_TC_TAB) {
|
|
||||||
if ((cxp == cx || cxp == LM_TC_CR || data.IsFirst())) { // && objtype == L
|
|
||||||
XDrawRectangle(fl_display, pm, mathLineGC,
|
|
||||||
x, y-df_asc, df_width, df_asc);
|
|
||||||
}
|
|
||||||
|
|
||||||
XFlush(fl_display);
|
|
||||||
data.Next();
|
|
||||||
limits = false;
|
|
||||||
} else
|
|
||||||
if (cx == LM_TC_CR) {
|
|
||||||
if (cxp == LM_TC_TAB || cxp == LM_TC_CR || data.IsFirst()) { // && objtype == LM_OT_MATRIX) {
|
|
||||||
XDrawRectangle(fl_display, pm, mathLineGC, x, y-df_asc, df_width, df_asc);
|
|
||||||
}
|
|
||||||
data.Next();
|
|
||||||
limits = false;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
lyxerr << "GMathed Error: Unrecognized code[" << cx
|
|
||||||
<< "]" << endl;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
cxp = cx;
|
|
||||||
}
|
|
||||||
if (cxp == LM_TC_TAB || cxp == LM_TC_CR) { // && objtype == LM_OT_MATRIX) {
|
|
||||||
data.GetPos(x, y);
|
|
||||||
XDrawRectangle(fl_display, pm, mathLineGC, x, y-df_asc, df_width, df_asc);
|
|
||||||
XFlush(fl_display);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -368,7 +243,6 @@ MathParInset::Metrics()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_PAINTER
|
|
||||||
void
|
void
|
||||||
MathSqrtInset::draw(Painter & pain, int x, int y)
|
MathSqrtInset::draw(Painter & pain, int x, int y)
|
||||||
{
|
{
|
||||||
@ -384,24 +258,6 @@ MathSqrtInset::draw(Painter & pain, int x, int y)
|
|||||||
xp[3] = x; yp[3] = y + d - h2;
|
xp[3] = x; yp[3] = y + d - h2;
|
||||||
pain.lines(xp, yp, 4, LColor::mathline);
|
pain.lines(xp, yp, 4, LColor::mathline);
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
void
|
|
||||||
MathSqrtInset::Draw(int x, int y)
|
|
||||||
{
|
|
||||||
MathParInset::Draw(x+hmax+2, y);
|
|
||||||
int h = ascent;
|
|
||||||
int d = descent;
|
|
||||||
int h2 = Height() / 2;
|
|
||||||
int w2 = (Height() > 4 * hmax) ? hmax : hmax / 2;
|
|
||||||
XPoint p[4];
|
|
||||||
p[0].x = x + hmax + wbody; p[0].y = y - h;
|
|
||||||
p[1].x = x + hmax; p[1].y = y - h;
|
|
||||||
p[2].x = x + w2; p[2].y = y + d;
|
|
||||||
p[3].x = x; p[3].y = y + d - h2;
|
|
||||||
XDrawLines(fl_display, pm, mathLineGC, p, 4, CoordModeOrigin);
|
|
||||||
XFlush(fl_display);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -418,7 +274,6 @@ MathSqrtInset::Metrics()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_PAINTER
|
|
||||||
void
|
void
|
||||||
MathFracInset::draw(Painter & pain, int x, int y)
|
MathFracInset::draw(Painter & pain, int x, int y)
|
||||||
{
|
{
|
||||||
@ -434,25 +289,6 @@ MathFracInset::draw(Painter & pain, int x, int y)
|
|||||||
pain.line(x + 2, y - dh, x + width - 4, y - dh, LColor::mathline);
|
pain.line(x + 2, y - dh, x + width - 4, y - dh, LColor::mathline);
|
||||||
idx = idxp;
|
idx = idxp;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
void
|
|
||||||
MathFracInset::Draw(int x, int y)
|
|
||||||
{
|
|
||||||
short idxp = idx;
|
|
||||||
short sizex = size;
|
|
||||||
|
|
||||||
idx = 0;
|
|
||||||
if (size == LM_ST_DISPLAY) ++size;
|
|
||||||
MathParInset::Draw(x + (width - w0) / 2, y - des0);
|
|
||||||
den->Draw(x + (width - w1) / 2, y + den->Ascent() + 2 - dh);
|
|
||||||
size = sizex;
|
|
||||||
if (objtype == LM_OT_FRAC)
|
|
||||||
XDrawLine(fl_display, pm, mathLineGC,
|
|
||||||
x + 2, y - dh, x + width - 4, y - dh);
|
|
||||||
XFlush(fl_display);
|
|
||||||
idx = idxp;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -480,7 +316,6 @@ MathFracInset::Metrics()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_PAINTER
|
|
||||||
void
|
void
|
||||||
MathBigopInset::draw(Painter & pain, int x, int y)
|
MathBigopInset::draw(Painter & pain, int x, int y)
|
||||||
{
|
{
|
||||||
@ -506,38 +341,8 @@ MathBigopInset::draw(Painter & pain, int x, int y)
|
|||||||
}
|
}
|
||||||
pain.text(x, y, s, ls, mathed_get_font(t, size));
|
pain.text(x, y, s, ls, mathed_get_font(t, size));
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
void
|
|
||||||
MathBigopInset::Draw(int x, int y)
|
|
||||||
{
|
|
||||||
int ls;
|
|
||||||
char c;
|
|
||||||
char const *s;
|
|
||||||
short t;
|
|
||||||
|
|
||||||
if (sym<256 || sym == LM_oint) {
|
|
||||||
ls = 1;
|
|
||||||
c = (sym == LM_oint) ? LM_int: sym;
|
|
||||||
s = &c;
|
|
||||||
t = LM_TC_BSYM;
|
|
||||||
} else {
|
|
||||||
s = name;
|
|
||||||
ls = strlen(name);
|
|
||||||
t = LM_TC_TEXTRM;
|
|
||||||
}
|
|
||||||
mathed_set_font(t, size);
|
|
||||||
if (sym == LM_oint) {
|
|
||||||
XDrawArc(fl_display, pm, mathLineGC, x, y-5*width/4, width, width, 0, 23040);
|
|
||||||
XFlush(fl_display);
|
|
||||||
++x;
|
|
||||||
}
|
|
||||||
XDrawString(fl_display, pm, mathGC, x, y, s, ls);
|
|
||||||
XFlush(fl_display);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_PAINTER
|
|
||||||
void
|
void
|
||||||
MathBigopInset::Metrics()
|
MathBigopInset::Metrics()
|
||||||
{
|
{
|
||||||
@ -564,29 +369,3 @@ MathBigopInset::Metrics()
|
|||||||
ls);
|
ls);
|
||||||
if (sym == LM_oint) width += 2;
|
if (sym == LM_oint) width += 2;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
void
|
|
||||||
MathBigopInset::Metrics()
|
|
||||||
{
|
|
||||||
int ls;
|
|
||||||
char c;
|
|
||||||
char const *s;
|
|
||||||
short t;
|
|
||||||
|
|
||||||
if (sym<256 || sym == LM_oint) {
|
|
||||||
ls = 1;
|
|
||||||
c = (sym == LM_oint) ? LM_int: sym;
|
|
||||||
s = &c;
|
|
||||||
t = LM_TC_BSYM;
|
|
||||||
} else {
|
|
||||||
s = name;
|
|
||||||
ls = strlen(name);
|
|
||||||
t = LM_TC_TEXTRM;
|
|
||||||
}
|
|
||||||
mathed_set_font(t, size);
|
|
||||||
mathed_string_height(t, size, reinterpret_cast<const unsigned char*>(s), ls, ascent, descent);
|
|
||||||
width = mathed_string_width(t, size, reinterpret_cast<const unsigned char*>(s), ls);
|
|
||||||
if (sym == LM_oint) width += 2;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
@ -416,23 +416,16 @@ void MathMatrixInset::SetData(LyxArrayBase * a)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_PAINTER
|
|
||||||
void MathMatrixInset::draw(Painter & pain, int x, int baseline)
|
void MathMatrixInset::draw(Painter & pain, int x, int baseline)
|
||||||
{
|
{
|
||||||
MathParInset::draw(pain, x, baseline);
|
MathParInset::draw(pain, x, baseline);
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
void MathMatrixInset::Draw(int x, int baseline)
|
|
||||||
{
|
|
||||||
MathParInset::Draw(x, baseline);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
void MathMatrixInset::Metrics()
|
void MathMatrixInset::Metrics()
|
||||||
{
|
{
|
||||||
int i, hl, h= 0;
|
int i, hl, h = 0;
|
||||||
MathedRowSt * cprow= 0, * cxrow;
|
MathedRowSt * cprow= 0;
|
||||||
|
|
||||||
if (!row) {
|
if (!row) {
|
||||||
// lyxerr << " MIDA ";
|
// lyxerr << " MIDA ";
|
||||||
@ -441,7 +434,7 @@ void MathMatrixInset::Metrics()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Clean the arrays
|
// Clean the arrays
|
||||||
cxrow = row;
|
MathedRowSt * cxrow = row;
|
||||||
while (cxrow) {
|
while (cxrow) {
|
||||||
for (i = 0; i <= nc; ++i) cxrow->w[i] = 0;
|
for (i = 0; i <= nc; ++i) cxrow->w[i] = 0;
|
||||||
cxrow = cxrow->next;
|
cxrow = cxrow->next;
|
||||||
|
@ -43,13 +43,8 @@ public:
|
|||||||
~MathFuncInset();
|
~MathFuncInset();
|
||||||
///
|
///
|
||||||
MathedInset * Clone();
|
MathedInset * Clone();
|
||||||
#ifdef USE_PAINTER
|
|
||||||
///
|
///
|
||||||
void draw(Painter &, int, int);
|
void draw(Painter &, int, int);
|
||||||
#else
|
|
||||||
///
|
|
||||||
void Draw(int, int);
|
|
||||||
#endif
|
|
||||||
///
|
///
|
||||||
void Write(ostream &);
|
void Write(ostream &);
|
||||||
///
|
///
|
||||||
@ -79,13 +74,8 @@ public:
|
|||||||
~MathAccentInset();
|
~MathAccentInset();
|
||||||
///
|
///
|
||||||
MathedInset * Clone();
|
MathedInset * Clone();
|
||||||
#ifdef USE_PAINTER
|
|
||||||
///
|
///
|
||||||
void draw(Painter &, int, int);
|
void draw(Painter &, int, int);
|
||||||
#else
|
|
||||||
///
|
|
||||||
void Draw(int, int);
|
|
||||||
#endif
|
|
||||||
///
|
///
|
||||||
void Write(ostream &);
|
void Write(ostream &);
|
||||||
///
|
///
|
||||||
@ -116,13 +106,8 @@ public:
|
|||||||
MathDotsInset(char const *, int, short st = LM_ST_TEXT);
|
MathDotsInset(char const *, int, short st = LM_ST_TEXT);
|
||||||
///
|
///
|
||||||
MathedInset * Clone();
|
MathedInset * Clone();
|
||||||
#ifdef USE_PAINTER
|
|
||||||
///
|
///
|
||||||
void draw(Painter &, int, int);
|
void draw(Painter &, int, int);
|
||||||
#else
|
|
||||||
///
|
|
||||||
void Draw(int, int);
|
|
||||||
#endif
|
|
||||||
///
|
///
|
||||||
void Write(ostream &);
|
void Write(ostream &);
|
||||||
///
|
///
|
||||||
@ -142,13 +127,8 @@ public:
|
|||||||
MathSpaceInset(int sp, short ot = LM_OT_SPACE, short st = LM_ST_TEXT);
|
MathSpaceInset(int sp, short ot = LM_OT_SPACE, short st = LM_ST_TEXT);
|
||||||
///
|
///
|
||||||
MathedInset * Clone();
|
MathedInset * Clone();
|
||||||
#ifdef USE_PAINTER
|
|
||||||
///
|
///
|
||||||
void draw(Painter &, int, int);
|
void draw(Painter &, int, int);
|
||||||
#else
|
|
||||||
///
|
|
||||||
void Draw(int, int);
|
|
||||||
#endif
|
|
||||||
///
|
///
|
||||||
void Write(ostream &);
|
void Write(ostream &);
|
||||||
///
|
///
|
||||||
@ -172,13 +152,8 @@ public:
|
|||||||
MathBigopInset(char const *, int, short st = LM_ST_TEXT);
|
MathBigopInset(char const *, int, short st = LM_ST_TEXT);
|
||||||
///
|
///
|
||||||
MathedInset * Clone();
|
MathedInset * Clone();
|
||||||
#ifdef USE_PAINTER
|
|
||||||
///
|
///
|
||||||
void draw(Painter &, int, int);
|
void draw(Painter &, int, int);
|
||||||
#else
|
|
||||||
///
|
|
||||||
void Draw(int, int);
|
|
||||||
#endif
|
|
||||||
///
|
///
|
||||||
void Write(ostream &);
|
void Write(ostream &);
|
||||||
///
|
///
|
||||||
@ -206,12 +181,8 @@ public:
|
|||||||
MathSqrtInset(short st = LM_ST_TEXT);
|
MathSqrtInset(short st = LM_ST_TEXT);
|
||||||
///
|
///
|
||||||
MathedInset * Clone();
|
MathedInset * Clone();
|
||||||
#ifdef USE_PAINTER
|
|
||||||
void draw(Painter &, int x, int baseline);
|
|
||||||
#else
|
|
||||||
///
|
///
|
||||||
void Draw(int x, int baseline);
|
void draw(Painter &, int x, int baseline);
|
||||||
#endif
|
|
||||||
///
|
///
|
||||||
void Write(ostream &);
|
void Write(ostream &);
|
||||||
///
|
///
|
||||||
@ -235,13 +206,8 @@ public:
|
|||||||
~MathFracInset();
|
~MathFracInset();
|
||||||
///
|
///
|
||||||
MathedInset * Clone();
|
MathedInset * Clone();
|
||||||
#ifdef USE_PAINTER
|
|
||||||
///
|
///
|
||||||
void draw(Painter &, int x, int baseline);
|
void draw(Painter &, int x, int baseline);
|
||||||
#else
|
|
||||||
///
|
|
||||||
void Draw(int x, int baseline);
|
|
||||||
#endif
|
|
||||||
///
|
///
|
||||||
void Write(ostream &);
|
void Write(ostream &);
|
||||||
///
|
///
|
||||||
@ -288,13 +254,8 @@ public:
|
|||||||
MathDelimInset(int, int, short st = LM_ST_TEXT);
|
MathDelimInset(int, int, short st = LM_ST_TEXT);
|
||||||
///
|
///
|
||||||
MathedInset * Clone();
|
MathedInset * Clone();
|
||||||
#ifdef USE_PAINTER
|
|
||||||
///
|
///
|
||||||
void draw(Painter &, int, int);
|
void draw(Painter &, int, int);
|
||||||
#else
|
|
||||||
///
|
|
||||||
void Draw(int, int);
|
|
||||||
#endif
|
|
||||||
///
|
///
|
||||||
void Write(ostream &);
|
void Write(ostream &);
|
||||||
///
|
///
|
||||||
@ -316,13 +277,8 @@ public:
|
|||||||
MathDecorationInset(int, short st = LM_ST_TEXT);
|
MathDecorationInset(int, short st = LM_ST_TEXT);
|
||||||
///
|
///
|
||||||
MathedInset * Clone();
|
MathedInset * Clone();
|
||||||
#ifdef USE_PAINTER
|
|
||||||
///
|
///
|
||||||
void draw(Painter &, int, int);
|
void draw(Painter &, int, int);
|
||||||
#else
|
|
||||||
///
|
|
||||||
void Draw(int, int);
|
|
||||||
#endif
|
|
||||||
///
|
///
|
||||||
void Write(ostream &);
|
void Write(ostream &);
|
||||||
///
|
///
|
||||||
|
@ -47,9 +47,6 @@ ostream & operator<<(ostream & o, MathedMacroFlag mmf)
|
|||||||
return o << int(mmf);
|
return o << int(mmf);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef USE_PAINTER
|
|
||||||
extern GC mathGC, mathFrameGC, latexGC;
|
|
||||||
#endif
|
|
||||||
extern int mathed_string_width(short type, int style, byte const* s, int ls);
|
extern int mathed_string_width(short type, int style, byte const* s, int ls);
|
||||||
extern int mathed_string_height(short, int, byte const*, int, int&, int&);
|
extern int mathed_string_height(short, int, byte const*, int, int&, int&);
|
||||||
|
|
||||||
@ -121,31 +118,16 @@ void MathMacro::Metrics()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_PAINTER
|
|
||||||
void MathMacro::draw(Painter & pain, int x, int y)
|
void MathMacro::draw(Painter & pain, int x, int y)
|
||||||
{
|
{
|
||||||
xo = x; yo = y;
|
xo = x; yo = y;
|
||||||
Metrics();
|
Metrics();
|
||||||
tmplate->update(this);
|
tmplate->update(this);
|
||||||
tmplate->SetStyle(size);
|
tmplate->SetStyle(size);
|
||||||
//mathGC = latexGC;
|
|
||||||
tmplate->draw(pain, x, y);
|
tmplate->draw(pain, x, y);
|
||||||
for (int i = 0; i < nargs; ++i)
|
for (int i = 0; i < nargs; ++i)
|
||||||
tmplate->GetMacroXY(i, args[i].x, args[i].y);
|
tmplate->GetMacroXY(i, args[i].x, args[i].y);
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
void MathMacro::Draw(int x, int y)
|
|
||||||
{
|
|
||||||
xo = x; yo = y;
|
|
||||||
Metrics();
|
|
||||||
tmplate->update(this);
|
|
||||||
tmplate->SetStyle(size);
|
|
||||||
mathGC = latexGC;
|
|
||||||
tmplate->Draw(x, y);
|
|
||||||
for (int i = 0; i < nargs; ++i)
|
|
||||||
tmplate->GetMacroXY(i, args[i].x, args[i].y);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
int MathMacro::GetColumns()
|
int MathMacro::GetColumns()
|
||||||
@ -238,7 +220,6 @@ MathMacroArgument::MathMacroArgument(int n)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_PAINTER
|
|
||||||
void MathMacroArgument::draw(Painter & pain, int x, int baseline)
|
void MathMacroArgument::draw(Painter & pain, int x, int baseline)
|
||||||
{
|
{
|
||||||
if (expnd_mode) {
|
if (expnd_mode) {
|
||||||
@ -249,18 +230,6 @@ void MathMacroArgument::draw(Painter & pain, int x, int baseline)
|
|||||||
drawStr(pain, LM_TC_TEX, size, x, baseline, &s[0], 2);
|
drawStr(pain, LM_TC_TEX, size, x, baseline, &s[0], 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
void MathMacroArgument::Draw(int x, int baseline)
|
|
||||||
{
|
|
||||||
if (expnd_mode) {
|
|
||||||
MathParInset::Draw(x, baseline);
|
|
||||||
} else {
|
|
||||||
unsigned char s[3];
|
|
||||||
sprintf(reinterpret_cast<char*>(s), "#%d", number);
|
|
||||||
drawStr(LM_TC_TEX, size, x, baseline, &s[0], 2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
void MathMacroArgument::Metrics()
|
void MathMacroArgument::Metrics()
|
||||||
@ -339,7 +308,6 @@ void MathMacroTemplate::setEditMode(bool ed)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_PAINTER
|
|
||||||
void MathMacroTemplate::draw(Painter & pain, int x, int y)
|
void MathMacroTemplate::draw(Painter & pain, int x, int y)
|
||||||
{
|
{
|
||||||
int x2, y2;
|
int x2, y2;
|
||||||
@ -362,30 +330,6 @@ void MathMacroTemplate::draw(Painter & pain, int x, int y)
|
|||||||
args[i].setExpand(expnd);
|
args[i].setExpand(expnd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
void MathMacroTemplate::Draw(int x, int y)
|
|
||||||
{
|
|
||||||
int x2, y2;
|
|
||||||
bool expnd = (nargs>0) ? args[0].getExpand(): false;
|
|
||||||
if (flags & MMF_Edit) {
|
|
||||||
for (int i = 0; i < nargs; ++i) {
|
|
||||||
args[i].setExpand(false);
|
|
||||||
}
|
|
||||||
x2 = x; y2 = y;
|
|
||||||
} else {
|
|
||||||
for (int i = 0; i < nargs; ++i) {
|
|
||||||
args[i].setExpand(true);
|
|
||||||
}
|
|
||||||
x2 = xo; y2 = yo;
|
|
||||||
}
|
|
||||||
MathParInset::Draw(x, y);
|
|
||||||
xo = x2; yo = y2;
|
|
||||||
|
|
||||||
for (int i = 0; i < nargs; ++i) {
|
|
||||||
args[i].setExpand(expnd);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
void MathMacroTemplate::Metrics()
|
void MathMacroTemplate::Metrics()
|
||||||
|
@ -42,13 +42,8 @@ class MathMacro : public MathParInset
|
|||||||
MathMacro(MathMacro *);
|
MathMacro(MathMacro *);
|
||||||
///
|
///
|
||||||
~MathMacro();
|
~MathMacro();
|
||||||
#ifdef USE_PAINTER
|
|
||||||
///
|
///
|
||||||
void draw(Painter &, int, int);
|
void draw(Painter &, int, int);
|
||||||
#else
|
|
||||||
///
|
|
||||||
void Draw(int, int);
|
|
||||||
#endif
|
|
||||||
///
|
///
|
||||||
void Metrics();
|
void Metrics();
|
||||||
///
|
///
|
||||||
@ -120,13 +115,8 @@ class MathMacroArgument: public MathParInset
|
|||||||
MathedInset * Clone() { return this; }
|
MathedInset * Clone() { return this; }
|
||||||
///
|
///
|
||||||
void Metrics();
|
void Metrics();
|
||||||
#ifdef USE_PAINTER
|
|
||||||
///
|
///
|
||||||
void draw(Painter &, int x, int baseline);
|
void draw(Painter &, int x, int baseline);
|
||||||
#else
|
|
||||||
///
|
|
||||||
void Draw(int x, int baseline);
|
|
||||||
#endif
|
|
||||||
///
|
///
|
||||||
void Write(ostream &);
|
void Write(ostream &);
|
||||||
///
|
///
|
||||||
@ -154,13 +144,8 @@ class MathMacroTemplate: public MathParInset
|
|||||||
MathMacroTemplate(char const *, int na = 0, int f = 0);
|
MathMacroTemplate(char const *, int na = 0, int f = 0);
|
||||||
///
|
///
|
||||||
~MathMacroTemplate();
|
~MathMacroTemplate();
|
||||||
#ifdef USE_PAINTER
|
|
||||||
///
|
///
|
||||||
void draw(Painter &, int, int);
|
void draw(Painter &, int, int);
|
||||||
#else
|
|
||||||
///
|
|
||||||
void Draw(int, int);
|
|
||||||
#endif
|
|
||||||
///
|
///
|
||||||
void Metrics();
|
void Metrics();
|
||||||
///
|
///
|
||||||
|
@ -109,7 +109,6 @@ void MathRootInset::Metrics()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_PAINTER
|
|
||||||
void MathRootInset::draw(Painter & pain, int x, int y)
|
void MathRootInset::draw(Painter & pain, int x, int y)
|
||||||
{
|
{
|
||||||
int idxp = idx;
|
int idxp = idx;
|
||||||
@ -119,18 +118,6 @@ void MathRootInset::draw(Painter & pain, int x, int y)
|
|||||||
MathSqrtInset::draw(pain, x + wroot, y);
|
MathSqrtInset::draw(pain, x + wroot, y);
|
||||||
idx = idxp;
|
idx = idxp;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
void MathRootInset::Draw(int x, int y)
|
|
||||||
{
|
|
||||||
int idxp = idx;
|
|
||||||
|
|
||||||
idx = 1;
|
|
||||||
uroot->Draw(x, y - dh);
|
|
||||||
MathSqrtInset::Draw(x+wroot, y);
|
|
||||||
XFlush(fl_display);
|
|
||||||
idx = idxp;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
void MathRootInset::SetStyle(short st)
|
void MathRootInset::SetStyle(short st)
|
||||||
|
@ -36,13 +36,8 @@ class MathRootInset: public MathSqrtInset {
|
|||||||
~MathRootInset();
|
~MathRootInset();
|
||||||
///
|
///
|
||||||
MathedInset * Clone();
|
MathedInset * Clone();
|
||||||
#ifdef USE_PAINTER
|
|
||||||
///
|
///
|
||||||
void draw(Painter &, int x, int baseline);
|
void draw(Painter &, int x, int baseline);
|
||||||
#else
|
|
||||||
///
|
|
||||||
void Draw(int x, int baseline);
|
|
||||||
#endif
|
|
||||||
///
|
///
|
||||||
void Write(ostream &);
|
void Write(ostream &);
|
||||||
///
|
///
|
||||||
|
@ -39,7 +39,6 @@
|
|||||||
#include "bufferlist.h"
|
#include "bufferlist.h"
|
||||||
#include "lyx_gui_misc.h"
|
#include "lyx_gui_misc.h"
|
||||||
#include "minibuffer.h"
|
#include "minibuffer.h"
|
||||||
#include "lyxscreen.h"
|
|
||||||
#include "intl.h"
|
#include "intl.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "lyxrc.h"
|
#include "lyxrc.h"
|
||||||
@ -1080,8 +1079,8 @@ void Menus::ShowEditMenu(FL_OBJECT * ob, long)
|
|||||||
case 38: case 39: case 40:
|
case 38: case 39: case 40:
|
||||||
case 41: case 42: case 43:
|
case 41: case 42: case 43:
|
||||||
case 44:
|
case 44:
|
||||||
if (men->currentView()->available()){
|
if (men->currentView()->available()) {
|
||||||
men->currentView()->getScreen()->HideCursor();
|
men->currentView()->hideCursor();
|
||||||
if (!men->currentView()->text->selection){
|
if (!men->currentView()->text->selection){
|
||||||
men->currentView()->beforeChange();
|
men->currentView()->beforeChange();
|
||||||
men->currentView()->update(-2);
|
men->currentView()->update(-2);
|
||||||
@ -1342,7 +1341,7 @@ void Menus::ShowInsertMenu(FL_OBJECT * ob, long)
|
|||||||
fl_redraw_object(ob);
|
fl_redraw_object(ob);
|
||||||
|
|
||||||
if (men->currentView()->available()){
|
if (men->currentView()->available()){
|
||||||
men->currentView()->getScreen()->HideCursor();
|
men->currentView()->hideCursor();
|
||||||
switch (choice) {
|
switch (choice) {
|
||||||
case 1: tmpfunc->Dispatch(LFUN_FIGURE); break;
|
case 1: tmpfunc->Dispatch(LFUN_FIGURE); break;
|
||||||
case 2: tmpfunc->Dispatch(LFUN_TABLE); break;
|
case 2: tmpfunc->Dispatch(LFUN_TABLE); break;
|
||||||
|
@ -43,11 +43,7 @@ extern LyXRC * lyxrc;
|
|||||||
|
|
||||||
|
|
||||||
// ale970405
|
// ale970405
|
||||||
#ifdef USE_PAINTER
|
|
||||||
extern string bibitemWidthest(Painter &);
|
extern string bibitemWidthest(Painter &);
|
||||||
#else
|
|
||||||
extern string bibitemWidthest();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// this is a minibuffer
|
// this is a minibuffer
|
||||||
static char minibuffer_char;
|
static char minibuffer_char;
|
||||||
@ -348,17 +344,10 @@ void LyXParagraph::validate(LaTeXFeatures & features) const
|
|||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
switch ((*cit).font.color()) {
|
switch ((*cit).font.color()) {
|
||||||
#ifdef USE_PAINTER
|
|
||||||
case LColor::none:
|
case LColor::none:
|
||||||
case LColor::inherit:
|
case LColor::inherit:
|
||||||
case LColor::ignore:
|
case LColor::ignore:
|
||||||
break;
|
break;
|
||||||
#else
|
|
||||||
case LyXFont::NONE:
|
|
||||||
case LyXFont::INHERIT_COLOR:
|
|
||||||
case LyXFont::IGNORE_COLOR:
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
default:
|
default:
|
||||||
features.color = true;
|
features.color = true;
|
||||||
lyxerr[Debug::LATEX] << "Color enabled. Font: "
|
lyxerr[Debug::LATEX] << "Color enabled. Font: "
|
||||||
@ -3185,7 +3174,7 @@ bool LyXParagraph::RoffContTableRows(ostream & os,
|
|||||||
if (!table)
|
if (!table)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
LyXFont font1 = LyXFont(LyXFont::ALL_INHERIT);
|
LyXFont font1(LyXFont::ALL_INHERIT);
|
||||||
LyXFont font2;
|
LyXFont font2;
|
||||||
Inset * inset;
|
Inset * inset;
|
||||||
char c;
|
char c;
|
||||||
@ -3414,12 +3403,8 @@ LyXParagraph * LyXParagraph::TeXEnvironment(string & file, TexRow & texrow,
|
|||||||
} else if (style.labeltype == LABEL_BIBLIO) {
|
} else if (style.labeltype == LABEL_BIBLIO) {
|
||||||
// ale970405
|
// ale970405
|
||||||
file += "\\begin{" + style.latexname() + "}{"
|
file += "\\begin{" + style.latexname() + "}{"
|
||||||
#ifdef USE_PAINTER
|
|
||||||
+ bibitemWidthest(current_view->painter())
|
+ bibitemWidthest(current_view->painter())
|
||||||
+ "}\n";
|
+ "}\n";
|
||||||
#else
|
|
||||||
+ bibitemWidthest() + "}\n";
|
|
||||||
#endif
|
|
||||||
} else if (style.latextype == LATEX_ITEM_ENVIRONMENT) {
|
} else if (style.latextype == LATEX_ITEM_ENVIRONMENT) {
|
||||||
#ifdef FANCY_FOOTNOTE_CODE
|
#ifdef FANCY_FOOTNOTE_CODE
|
||||||
if (foot_count < 0) {
|
if (foot_count < 0) {
|
||||||
|
522
src/screen.C
522
src/screen.C
@ -19,16 +19,8 @@
|
|||||||
#include "lyxrow.h"
|
#include "lyxrow.h"
|
||||||
#include "BufferView.h"
|
#include "BufferView.h"
|
||||||
#include "Painter.h"
|
#include "Painter.h"
|
||||||
#ifndef USE_PAINTER
|
|
||||||
#include "lyxdraw.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef MONO
|
|
||||||
extern int mono_video;
|
|
||||||
extern int fast_selection;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef USE_PAINTER
|
|
||||||
static
|
static
|
||||||
GC createGC()
|
GC createGC()
|
||||||
{
|
{
|
||||||
@ -44,7 +36,6 @@ GC createGC()
|
|||||||
GCForeground | GCFunction | GCGraphicsExposures
|
GCForeground | GCFunction | GCGraphicsExposures
|
||||||
| GCLineWidth | GCLineStyle , &val);
|
| GCLineWidth | GCLineStyle , &val);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
@ -74,10 +65,8 @@ LyXScreen::LyXScreen(BufferView * o, Window window,
|
|||||||
cursor_pixmap_w = 0;
|
cursor_pixmap_w = 0;
|
||||||
cursor_pixmap_h = 0;
|
cursor_pixmap_h = 0;
|
||||||
|
|
||||||
#ifdef USE_PAINTER
|
|
||||||
// We need this GC
|
// We need this GC
|
||||||
gc_copy = createGC();
|
gc_copy = createGC();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -97,7 +86,6 @@ void LyXScreen::Redraw()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_PAINTER
|
|
||||||
void LyXScreen::expose(int x, int y, int exp_width, int exp_height)
|
void LyXScreen::expose(int x, int y, int exp_width, int exp_height)
|
||||||
{
|
{
|
||||||
XCopyArea(fl_display,
|
XCopyArea(fl_display,
|
||||||
@ -108,21 +96,8 @@ void LyXScreen::expose(int x, int y, int exp_width, int exp_height)
|
|||||||
exp_width, exp_height,
|
exp_width, exp_height,
|
||||||
x+_offset_x, y+_offset_y);
|
x+_offset_x, y+_offset_y);
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
void LyXScreen::expose(int x, int y, int exp_width, int exp_height)
|
|
||||||
{
|
|
||||||
XCopyArea(fl_display,
|
|
||||||
foreground,
|
|
||||||
_window,
|
|
||||||
getGC(gc_copy),
|
|
||||||
x, y,
|
|
||||||
exp_width, exp_height,
|
|
||||||
x+_offset_x, y+_offset_y);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_PAINTER
|
|
||||||
void LyXScreen::DrawFromTo(int y1, int y2)
|
void LyXScreen::DrawFromTo(int y1, int y2)
|
||||||
{
|
{
|
||||||
long y_text = first + y1;
|
long y_text = first + y1;
|
||||||
@ -148,36 +123,6 @@ void LyXScreen::DrawFromTo(int y1, int y2)
|
|||||||
LColor::bottomarea);
|
LColor::bottomarea);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
void LyXScreen::DrawFromTo(int y1, int y2)
|
|
||||||
{
|
|
||||||
long y_text = first + y1;
|
|
||||||
|
|
||||||
/* get the first needed row */
|
|
||||||
Row * row = text->GetRowNearY(y_text);
|
|
||||||
/* y_text is now the real beginning of the row */
|
|
||||||
|
|
||||||
long y = y_text - first;
|
|
||||||
/* y1 is now the real beginning of row on the screen */
|
|
||||||
|
|
||||||
while (row != 0 && y < y2) {
|
|
||||||
|
|
||||||
text->GetVisibleRow(*this, y, row, y + first);
|
|
||||||
y += row->height;
|
|
||||||
row = row -> next;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/* maybe we have to clear the screen at the bottom */
|
|
||||||
if (y < y2) {
|
|
||||||
fillRectangle(gc_lighted,
|
|
||||||
0,
|
|
||||||
y,
|
|
||||||
_width,
|
|
||||||
y2 - y);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
void LyXScreen::DrawOneRow(Row * row, long & y_text)
|
void LyXScreen::DrawOneRow(Row * row, long & y_text)
|
||||||
@ -186,11 +131,7 @@ void LyXScreen::DrawOneRow(Row * row, long & y_text)
|
|||||||
|
|
||||||
if (y + row->height > 0 && y - row->height <= _height) {
|
if (y + row->height > 0 && y - row->height <= _height) {
|
||||||
/* ok there is something visible */
|
/* ok there is something visible */
|
||||||
#ifdef USE_PAINTER
|
|
||||||
text->GetVisibleRow(y, row, y + first);
|
text->GetVisibleRow(y, row, y + first);
|
||||||
#else
|
|
||||||
text->GetVisibleRow(*this, y, row, y + first);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
y_text+= row->height;
|
y_text+= row->height;
|
||||||
}
|
}
|
||||||
@ -198,7 +139,6 @@ void LyXScreen::DrawOneRow(Row * row, long & y_text)
|
|||||||
|
|
||||||
/* draws the screen, starting with textposition y. uses as much already
|
/* draws the screen, starting with textposition y. uses as much already
|
||||||
* printed pixels as possible */
|
* printed pixels as possible */
|
||||||
#ifdef USE_PAINTER
|
|
||||||
void LyXScreen::Draw(long y)
|
void LyXScreen::Draw(long y)
|
||||||
{
|
{
|
||||||
if (cursor_visible) HideCursor();
|
if (cursor_visible) HideCursor();
|
||||||
@ -240,49 +180,6 @@ void LyXScreen::Draw(long y)
|
|||||||
expose(0, 0, _width, _height);
|
expose(0, 0, _width, _height);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
void LyXScreen::Draw(long y)
|
|
||||||
{
|
|
||||||
if (cursor_visible) HideCursor();
|
|
||||||
|
|
||||||
if (y < 0) y = 0;
|
|
||||||
long old_first = first;
|
|
||||||
first = y;
|
|
||||||
|
|
||||||
/* is any optimiziation possible? */
|
|
||||||
if ((y - old_first) < _height
|
|
||||||
&& (old_first - y) < _height) {
|
|
||||||
if (first < old_first) {
|
|
||||||
DrawFromTo(0, old_first - first);
|
|
||||||
XCopyArea (fl_display,
|
|
||||||
_window,
|
|
||||||
_window,
|
|
||||||
getGC(gc_copy),
|
|
||||||
_offset_x, _offset_y,
|
|
||||||
_width , _height - old_first + first,
|
|
||||||
_offset_x, _offset_y + old_first - first);
|
|
||||||
// expose the area drawn
|
|
||||||
expose(0, 0, _width, old_first - first);
|
|
||||||
} else {
|
|
||||||
DrawFromTo(_height + old_first - first, _height);
|
|
||||||
XCopyArea (fl_display,
|
|
||||||
_window,
|
|
||||||
_window,
|
|
||||||
getGC(gc_copy),
|
|
||||||
_offset_x, _offset_y + first - old_first,
|
|
||||||
_width , _height + old_first - first,
|
|
||||||
_offset_x, _offset_y);
|
|
||||||
// expose the area drawn
|
|
||||||
expose(0, _height + old_first - first,
|
|
||||||
_width, first - old_first);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
/* make a dumb new-draw */
|
|
||||||
DrawFromTo(0, _height);
|
|
||||||
expose(0, 0, _width, _height);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
void LyXScreen::ShowCursor()
|
void LyXScreen::ShowCursor()
|
||||||
@ -304,19 +201,6 @@ void LyXScreen::ShowCursor()
|
|||||||
// Secure against very strange situations
|
// Secure against very strange situations
|
||||||
if (y2 < y1) y2 = y1;
|
if (y2 < y1) y2 = y1;
|
||||||
|
|
||||||
#ifndef USE_PAINTER
|
|
||||||
if (fast_selection || mono_video) {
|
|
||||||
if (y2 > 0 && y1 < _height) {
|
|
||||||
XDrawLine(fl_display,
|
|
||||||
_window, getGC(gc_select),
|
|
||||||
x + _offset_x,
|
|
||||||
y1 + _offset_y,
|
|
||||||
x + _offset_x,
|
|
||||||
y2 + _offset_y);
|
|
||||||
cursor_visible = true;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
#endif
|
|
||||||
if (cursor_pixmap){
|
if (cursor_pixmap){
|
||||||
XFreePixmap(fl_display, cursor_pixmap);
|
XFreePixmap(fl_display, cursor_pixmap);
|
||||||
cursor_pixmap = 0;
|
cursor_pixmap = 0;
|
||||||
@ -333,7 +217,6 @@ void LyXScreen::ShowCursor()
|
|||||||
cursor_pixmap_w,
|
cursor_pixmap_w,
|
||||||
cursor_pixmap_h,
|
cursor_pixmap_h,
|
||||||
fl_get_visual_depth());
|
fl_get_visual_depth());
|
||||||
#ifdef USE_PAINTER
|
|
||||||
XCopyArea(fl_display,
|
XCopyArea(fl_display,
|
||||||
_window,
|
_window,
|
||||||
cursor_pixmap,
|
cursor_pixmap,
|
||||||
@ -348,28 +231,8 @@ void LyXScreen::ShowCursor()
|
|||||||
y1 + _offset_y,
|
y1 + _offset_y,
|
||||||
x + _offset_x,
|
x + _offset_x,
|
||||||
y2 + _offset_y);
|
y2 + _offset_y);
|
||||||
#else
|
|
||||||
XCopyArea(fl_display,
|
|
||||||
_window,
|
|
||||||
cursor_pixmap,
|
|
||||||
getGC(gc_copy),
|
|
||||||
_offset_x + cursor_pixmap_x,
|
|
||||||
_offset_y + cursor_pixmap_y,
|
|
||||||
cursor_pixmap_w, cursor_pixmap_h,
|
|
||||||
0, 0);
|
|
||||||
XDrawLine(fl_display,
|
|
||||||
_window,
|
|
||||||
getGC(gc_copy),
|
|
||||||
x + _offset_x,
|
|
||||||
y1 + _offset_y,
|
|
||||||
x + _offset_x,
|
|
||||||
y2 + _offset_y);
|
|
||||||
#endif
|
|
||||||
cursor_visible = true;
|
cursor_visible = true;
|
||||||
}
|
}
|
||||||
#ifndef USE_PAINTER
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -396,13 +259,8 @@ int LyXScreen::FitManualCursor(long /*x*/, long y, int asc, int desc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LyXScreen::HideManualCursor(long x, long y, int asc, int desc)
|
void LyXScreen::HideManualCursor()
|
||||||
{
|
{
|
||||||
#ifdef MONO
|
|
||||||
if (fast_selection || mono_video)
|
|
||||||
ShowManualCursor(x, y, asc, desc);
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
HideCursor();
|
HideCursor();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -419,18 +277,6 @@ void LyXScreen::ShowManualCursor(long x, long y, int asc, int desc)
|
|||||||
if (y2 > _height)
|
if (y2 > _height)
|
||||||
y2 = _height;
|
y2 = _height;
|
||||||
|
|
||||||
#ifndef USE_PAINTER
|
|
||||||
if (fast_selection || mono_video) {
|
|
||||||
if (y2 > 0 && y1 < _height) {
|
|
||||||
XDrawLine(fl_display,
|
|
||||||
_window, getGC(gc_select),
|
|
||||||
x+_offset_x,
|
|
||||||
y1+_offset_y,
|
|
||||||
x+_offset_x,
|
|
||||||
y2+_offset_y);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
#endif
|
|
||||||
if (cursor_pixmap){
|
if (cursor_pixmap){
|
||||||
XFreePixmap(fl_display, cursor_pixmap);
|
XFreePixmap(fl_display, cursor_pixmap);
|
||||||
cursor_pixmap = 0;
|
cursor_pixmap = 0;
|
||||||
@ -447,7 +293,6 @@ void LyXScreen::ShowManualCursor(long x, long y, int asc, int desc)
|
|||||||
cursor_pixmap_w,
|
cursor_pixmap_w,
|
||||||
cursor_pixmap_h,
|
cursor_pixmap_h,
|
||||||
fl_get_visual_depth());
|
fl_get_visual_depth());
|
||||||
#ifdef USE_PAINTER
|
|
||||||
XCopyArea (fl_display,
|
XCopyArea (fl_display,
|
||||||
_window,
|
_window,
|
||||||
cursor_pixmap,
|
cursor_pixmap,
|
||||||
@ -463,29 +308,8 @@ void LyXScreen::ShowManualCursor(long x, long y, int asc, int desc)
|
|||||||
y1+_offset_y,
|
y1+_offset_y,
|
||||||
x+_offset_x,
|
x+_offset_x,
|
||||||
y2+_offset_y);
|
y2+_offset_y);
|
||||||
#else
|
|
||||||
XCopyArea (fl_display,
|
|
||||||
_window,
|
|
||||||
cursor_pixmap,
|
|
||||||
getGC(gc_copy),
|
|
||||||
_offset_x + cursor_pixmap_x,
|
|
||||||
_offset_y + cursor_pixmap_y,
|
|
||||||
cursor_pixmap_w,
|
|
||||||
cursor_pixmap_h,
|
|
||||||
0, 0);
|
|
||||||
XDrawLine(fl_display,
|
|
||||||
_window,
|
|
||||||
getGC(gc_copy),
|
|
||||||
x+_offset_x,
|
|
||||||
y1+_offset_y,
|
|
||||||
x+_offset_x,
|
|
||||||
y2+_offset_y);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
cursor_visible = true;
|
cursor_visible = true;
|
||||||
#ifndef USE_PAINTER
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -493,15 +317,7 @@ void LyXScreen::HideCursor()
|
|||||||
{
|
{
|
||||||
if (!cursor_visible) return;
|
if (!cursor_visible) return;
|
||||||
|
|
||||||
#ifndef USE_PAINTER
|
|
||||||
if (fast_selection || mono_video) {
|
|
||||||
cursor_visible = false;
|
|
||||||
ShowCursor();
|
|
||||||
cursor_visible = false;
|
|
||||||
} else {
|
|
||||||
#endif
|
|
||||||
if (cursor_pixmap){
|
if (cursor_pixmap){
|
||||||
#ifdef USE_PAINTER
|
|
||||||
XCopyArea (fl_display,
|
XCopyArea (fl_display,
|
||||||
cursor_pixmap,
|
cursor_pixmap,
|
||||||
_window,
|
_window,
|
||||||
@ -510,21 +326,8 @@ void LyXScreen::HideCursor()
|
|||||||
cursor_pixmap_w, cursor_pixmap_h,
|
cursor_pixmap_w, cursor_pixmap_h,
|
||||||
cursor_pixmap_x + _offset_x,
|
cursor_pixmap_x + _offset_x,
|
||||||
cursor_pixmap_y + _offset_y);
|
cursor_pixmap_y + _offset_y);
|
||||||
#else
|
|
||||||
XCopyArea (fl_display,
|
|
||||||
cursor_pixmap,
|
|
||||||
_window,
|
|
||||||
getGC(gc_copy),
|
|
||||||
0, 0,
|
|
||||||
cursor_pixmap_w, cursor_pixmap_h,
|
|
||||||
cursor_pixmap_x + _offset_x,
|
|
||||||
cursor_pixmap_y + _offset_y);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
cursor_visible = false;
|
cursor_visible = false;
|
||||||
#ifndef USE_PAINTER
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -661,128 +464,9 @@ void LyXScreen::ToggleSelection(bool kill_selection)
|
|||||||
if (!text->selection)
|
if (!text->selection)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
long top = 0;
|
long top = text->sel_start_cursor.y
|
||||||
long bottom = 0;
|
|
||||||
|
|
||||||
#ifndef USE_PAINTER
|
|
||||||
if (fast_selection || mono_video) {
|
|
||||||
|
|
||||||
/* selection only in one row ?*/
|
|
||||||
if (text->sel_start_cursor.y == text->sel_end_cursor.y) {
|
|
||||||
|
|
||||||
/* only if something is visible */
|
|
||||||
if (text->sel_start_cursor.y
|
|
||||||
- text->sel_start_cursor.row->baseline
|
|
||||||
- first < _height
|
|
||||||
&& text->sel_start_cursor.y
|
|
||||||
- text->sel_start_cursor.row->baseline +
|
|
||||||
text->sel_start_cursor.row->height - first > 0) {
|
|
||||||
top = text->sel_start_cursor.y
|
|
||||||
- text->sel_start_cursor.row->baseline
|
|
||||||
- first;
|
|
||||||
bottom = top
|
|
||||||
+ text->sel_start_cursor.row->height;
|
|
||||||
if (top<0)
|
|
||||||
top = 0;
|
|
||||||
if (bottom > _height)
|
|
||||||
bottom = _height;
|
|
||||||
XFillRectangle(fl_display, _window,
|
|
||||||
getGC(gc_select),
|
|
||||||
text->sel_start_cursor.x
|
|
||||||
+_offset_x,
|
|
||||||
top+_offset_y,
|
|
||||||
text->sel_end_cursor.x
|
|
||||||
- text->sel_start_cursor.x,
|
|
||||||
bottom - top);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
/* the sel_start_cursor row first */
|
|
||||||
/* only if anything is visible */
|
|
||||||
if (text->sel_start_cursor.y
|
|
||||||
- text->sel_start_cursor.row->baseline
|
|
||||||
- first < _height
|
|
||||||
&& text->sel_start_cursor.y
|
|
||||||
- text->sel_start_cursor.row->baseline +
|
|
||||||
text->sel_start_cursor.row->height - first > 0) {
|
|
||||||
top = text->sel_start_cursor.y
|
|
||||||
- text->sel_start_cursor.row->baseline
|
|
||||||
- first;
|
|
||||||
bottom = top
|
|
||||||
+ text->sel_start_cursor.row->height;
|
|
||||||
if (top<0)
|
|
||||||
top = 0;
|
|
||||||
if (bottom > _height)
|
|
||||||
bottom = _height;
|
|
||||||
XFillRectangle(fl_display, _window,
|
|
||||||
getGC(gc_select),
|
|
||||||
text->sel_start_cursor.x
|
|
||||||
+_offset_x,
|
|
||||||
top+_offset_y,
|
|
||||||
_width
|
|
||||||
- text->sel_start_cursor.x,
|
|
||||||
bottom - top);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* the main body */
|
|
||||||
|
|
||||||
if (text->sel_start_cursor.row->next !=
|
|
||||||
text->sel_end_cursor.row) {
|
|
||||||
top = text->sel_start_cursor.y
|
|
||||||
- text->sel_start_cursor.row->baseline
|
|
||||||
+ text->sel_start_cursor.row->height;
|
|
||||||
bottom = text->sel_end_cursor.y
|
|
||||||
- text->sel_end_cursor.row->baseline;
|
|
||||||
|
|
||||||
if (top - first < 0)
|
|
||||||
top = first;
|
|
||||||
if (bottom - first < 0)
|
|
||||||
bottom = first;
|
|
||||||
|
|
||||||
if (bottom - first > _height)
|
|
||||||
bottom = first + _height;
|
|
||||||
if (top - first > _height)
|
|
||||||
top = first + _height;
|
|
||||||
|
|
||||||
if (top != bottom) {
|
|
||||||
XFillRectangle(fl_display,
|
|
||||||
_window,
|
|
||||||
getGC(gc_select),
|
|
||||||
0+_offset_x,
|
|
||||||
top - first+_offset_y,
|
|
||||||
_width,
|
|
||||||
bottom - top);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* the sel_end_cursor row last */
|
|
||||||
if (text->sel_end_cursor.y
|
|
||||||
- text->sel_end_cursor.row->baseline
|
|
||||||
- first < _height
|
|
||||||
&& text->sel_end_cursor.y
|
|
||||||
- text->sel_end_cursor.row->baseline +
|
|
||||||
text->sel_end_cursor.row->height - first > 0) {
|
|
||||||
top = text->sel_end_cursor.y
|
|
||||||
- text->sel_end_cursor.row->baseline
|
|
||||||
- first;
|
|
||||||
bottom = top
|
|
||||||
+ text->sel_end_cursor.row->height;
|
|
||||||
if (top<0)
|
|
||||||
top = 0;
|
|
||||||
if (bottom > _height)
|
|
||||||
bottom = _height;
|
|
||||||
XFillRectangle(fl_display, _window,
|
|
||||||
getGC(gc_select),
|
|
||||||
0+_offset_x,
|
|
||||||
top+_offset_y,
|
|
||||||
text->sel_end_cursor.x,
|
|
||||||
bottom - top);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
#endif
|
|
||||||
top = text->sel_start_cursor.y
|
|
||||||
- text->sel_start_cursor.row->baseline;
|
- text->sel_start_cursor.row->baseline;
|
||||||
bottom = text->sel_end_cursor.y
|
long bottom = text->sel_end_cursor.y
|
||||||
- text->sel_end_cursor.row->baseline
|
- text->sel_end_cursor.row->baseline
|
||||||
+ text->sel_end_cursor.row->height;
|
+ text->sel_end_cursor.row->height;
|
||||||
|
|
||||||
@ -800,119 +484,18 @@ void LyXScreen::ToggleSelection(bool kill_selection)
|
|||||||
text->selection = 0;
|
text->selection = 0;
|
||||||
DrawFromTo(top - first, bottom - first);
|
DrawFromTo(top - first, bottom - first);
|
||||||
expose(0, top - first, _width, bottom - first - (top - first));
|
expose(0, top - first, _width, bottom - first - (top - first));
|
||||||
#ifndef USE_PAINTER
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LyXScreen::ToggleToggle()
|
void LyXScreen::ToggleToggle()
|
||||||
{
|
{
|
||||||
long top = 0;
|
|
||||||
long bottom = 0;
|
|
||||||
|
|
||||||
if (text->toggle_cursor.par == text->toggle_end_cursor.par
|
if (text->toggle_cursor.par == text->toggle_end_cursor.par
|
||||||
&& text->toggle_cursor.pos == text->toggle_end_cursor.pos)
|
&& text->toggle_cursor.pos == text->toggle_end_cursor.pos)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#ifndef USE_PAINTER
|
long top = text->toggle_cursor.y
|
||||||
if (fast_selection || mono_video) {
|
|
||||||
|
|
||||||
/* selection only in one row ?*/
|
|
||||||
if (text->toggle_cursor.y == text->toggle_end_cursor.y) {
|
|
||||||
|
|
||||||
/* only if anything is visible */
|
|
||||||
if (text->toggle_cursor.y - text->toggle_cursor.row->baseline - first < _height
|
|
||||||
&& text->toggle_cursor.y - text->toggle_cursor.row->baseline +
|
|
||||||
text->toggle_cursor.row->height - first > 0) {
|
|
||||||
top = text->toggle_cursor.y - text->toggle_cursor.row->baseline - first;
|
|
||||||
bottom = top + text->toggle_cursor.row->height;
|
|
||||||
if (top < 0) top = 0;
|
|
||||||
if (bottom > _height) bottom = _height;
|
|
||||||
XFillRectangle(fl_display, _window,
|
|
||||||
getGC(gc_select),
|
|
||||||
text->toggle_cursor.x+_offset_x,
|
|
||||||
top+_offset_y,
|
|
||||||
text->toggle_end_cursor.x -
|
|
||||||
text->toggle_cursor.x,
|
|
||||||
bottom - top);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
/* the toggle_cursor row first */
|
|
||||||
/* only if anything is visible */
|
|
||||||
if (text->toggle_cursor.y - text->toggle_cursor.row->baseline - first < _height
|
|
||||||
&& text->toggle_cursor.y - text->toggle_cursor.row->baseline +
|
|
||||||
text->toggle_cursor.row->height - first > 0) {
|
|
||||||
top = text->toggle_cursor.y - text->toggle_cursor.row->baseline - first;
|
|
||||||
bottom = top + text->toggle_cursor.row->height;
|
|
||||||
if (top<0)
|
|
||||||
top = 0;
|
|
||||||
if (bottom > _height)
|
|
||||||
bottom = _height;
|
|
||||||
XFillRectangle(fl_display, _window,
|
|
||||||
getGC(gc_select),
|
|
||||||
text->toggle_cursor.x+_offset_x,
|
|
||||||
top+_offset_y,
|
|
||||||
_width - text->toggle_cursor.x,
|
|
||||||
bottom - top);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* the main body */
|
|
||||||
|
|
||||||
if (text->toggle_cursor.row->next !=
|
|
||||||
text->toggle_end_cursor.row) {
|
|
||||||
top = text->toggle_cursor.y
|
|
||||||
- text->toggle_cursor.row->baseline
|
|
||||||
+ text->toggle_cursor.row->height;
|
|
||||||
bottom = text->toggle_end_cursor.y
|
|
||||||
- text->toggle_end_cursor.row->baseline;
|
|
||||||
|
|
||||||
if (top - first < 0)
|
|
||||||
top = first;
|
|
||||||
if (bottom - first < 0)
|
|
||||||
bottom = first;
|
|
||||||
|
|
||||||
if (bottom - first > _height)
|
|
||||||
bottom = first + _height;
|
|
||||||
if (top - first > _height)
|
|
||||||
top = first + _height;
|
|
||||||
|
|
||||||
if (top != bottom) {
|
|
||||||
XFillRectangle(fl_display, _window,
|
|
||||||
getGC(gc_select),
|
|
||||||
0+_offset_x,
|
|
||||||
top - first+_offset_y,
|
|
||||||
_width,
|
|
||||||
bottom - top);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* the toggle_end_cursor row last */
|
|
||||||
if (text->toggle_end_cursor.y - text->toggle_end_cursor.row->baseline - first < _height
|
|
||||||
&& text->toggle_end_cursor.y - text->toggle_end_cursor.row->baseline +
|
|
||||||
text->toggle_end_cursor.row->height - first > 0) {
|
|
||||||
top = text->toggle_end_cursor.y
|
|
||||||
- text->toggle_end_cursor.row->baseline
|
|
||||||
- first;
|
|
||||||
bottom = top
|
|
||||||
+ text->toggle_end_cursor.row->height;
|
|
||||||
if (top<0)
|
|
||||||
top = 0;
|
|
||||||
if (bottom > _height)
|
|
||||||
bottom = _height;
|
|
||||||
XFillRectangle(fl_display, _window,
|
|
||||||
getGC(gc_select),
|
|
||||||
0+_offset_x,
|
|
||||||
top+_offset_y,
|
|
||||||
text->toggle_end_cursor.x,
|
|
||||||
bottom - top);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
#endif
|
|
||||||
top = text->toggle_cursor.y
|
|
||||||
- text->toggle_cursor.row->baseline;
|
- text->toggle_cursor.row->baseline;
|
||||||
bottom = text->toggle_end_cursor.y
|
long bottom = text->toggle_end_cursor.y
|
||||||
- text->toggle_end_cursor.row->baseline
|
- text->toggle_end_cursor.row->baseline
|
||||||
+ text->toggle_end_cursor.row->height;
|
+ text->toggle_end_cursor.row->height;
|
||||||
|
|
||||||
@ -928,99 +511,4 @@ void LyXScreen::ToggleToggle()
|
|||||||
|
|
||||||
DrawFromTo(top - first, bottom - first);
|
DrawFromTo(top - first, bottom - first);
|
||||||
expose(0, top - first, _width, bottom - first - (top - first));
|
expose(0, top - first, _width, bottom - first - (top - first));
|
||||||
#ifndef USE_PAINTER
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifndef USE_PAINTER
|
|
||||||
void LyXScreen::drawTableLine(int baseline, int x, int length, bool on_off)
|
|
||||||
{
|
|
||||||
GC gc;
|
|
||||||
if (on_off)
|
|
||||||
gc = getGC(gc_thin_on_off_line);
|
|
||||||
else
|
|
||||||
gc = getGC(gc_copy);
|
|
||||||
drawLine(gc,
|
|
||||||
x,
|
|
||||||
baseline,
|
|
||||||
x + length,
|
|
||||||
baseline);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef USE_PAINTER
|
|
||||||
void LyXScreen::drawVerticalTableLine(int x, int y1, int y2, bool on_off)
|
|
||||||
{
|
|
||||||
GC gc;
|
|
||||||
if (on_off)
|
|
||||||
gc = getGC(gc_thin_on_off_line);
|
|
||||||
else
|
|
||||||
gc = getGC(gc_copy);
|
|
||||||
drawLine(gc,
|
|
||||||
x,
|
|
||||||
y1,
|
|
||||||
x,
|
|
||||||
y2);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef USE_PAINTER
|
|
||||||
void LyXScreen::drawFrame(int /*ft*/, int x, int y, int w, int h,
|
|
||||||
FL_COLOR /*col*/, int /*b*/)
|
|
||||||
{
|
|
||||||
// Implement this using X11 calls, and the repaint problems are gone!
|
|
||||||
// At least, I think that should do it since we only have them after
|
|
||||||
// one of these buttons are displayed now! Lars, it seems you've hit the
|
|
||||||
// nail :-) (Asger)
|
|
||||||
// fl_winset(foreground);
|
|
||||||
// fl_drw_frame(ft, x, y, w, h, col, b);
|
|
||||||
// This should be changed to draw a button like frame, in the
|
|
||||||
// mean time we'll just use a regular rectangle
|
|
||||||
|
|
||||||
// I want the buttons back before 0.12. OK, this is very simple,
|
|
||||||
// like what is done in xforms sources. (Ale)
|
|
||||||
|
|
||||||
// This one is too dirty. Get rid of it.
|
|
||||||
extern GC fl_gc;
|
|
||||||
|
|
||||||
// Please comment this annonymous variable.
|
|
||||||
int d = 2;
|
|
||||||
|
|
||||||
// I think these calls to fl_color might make xforms sometimes
|
|
||||||
// draw the wrong color on other objects.
|
|
||||||
fl_color(FL_TOP_BCOL);
|
|
||||||
XFillRectangle(fl_display, foreground, fl_gc,
|
|
||||||
x - d, y - d, w + 2 * d, d);
|
|
||||||
fl_color(FL_BOTTOM_BCOL);
|
|
||||||
XFillRectangle(fl_display, foreground, fl_gc,
|
|
||||||
x - d, y + h, w + 2 * d, d);
|
|
||||||
|
|
||||||
// Now a couple of trapezoids
|
|
||||||
XPoint pl[4], pr[4];
|
|
||||||
|
|
||||||
pl[0].x = x - d; pl[0].y = y - d;
|
|
||||||
pl[1].x = x - d; pl[1].y = y + h + d;
|
|
||||||
pl[2].x = x; pl[2].y = y + h;
|
|
||||||
pl[3].x = x; pl[3].y = y;
|
|
||||||
|
|
||||||
pr[0].x = x + w + d; pr[0].y = y - d;
|
|
||||||
pr[1].x = x + w + d; pr[1].y = y + h + d;
|
|
||||||
pr[2].x = x + w; pr[2].y = y + h;
|
|
||||||
pr[3].x = x + w; pr[3].y = y;
|
|
||||||
|
|
||||||
fl_color(FL_LEFT_BCOL);
|
|
||||||
XFillPolygon(fl_display,
|
|
||||||
foreground,
|
|
||||||
fl_gc, pl, 4,
|
|
||||||
Convex, CoordModeOrigin);
|
|
||||||
fl_color(FL_RIGHT_BCOL);
|
|
||||||
XFillPolygon(fl_display,
|
|
||||||
foreground,
|
|
||||||
fl_gc, pr, 4,
|
|
||||||
Convex, CoordModeOrigin);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
@ -526,7 +526,7 @@ void ShowSpellChecker()
|
|||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
// Exit if we don't have a document open
|
// Exit if we don't have a document open
|
||||||
if (!current_view->getScreen())
|
if (!current_view->available())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (fd_form_spell_check == 0) {
|
if (fd_form_spell_check == 0) {
|
||||||
|
1250
src/text.C
1250
src/text.C
File diff suppressed because it is too large
Load Diff
@ -1068,7 +1068,7 @@ Row * LyXText::GetRowNearY(long & y) const
|
|||||||
void LyXText::ToggleFree(LyXFont const & font, bool toggleall)
|
void LyXText::ToggleFree(LyXFont const & font, bool toggleall)
|
||||||
{
|
{
|
||||||
// If the mask is completely neutral, tell user
|
// If the mask is completely neutral, tell user
|
||||||
if (font == LyXFont(LyXFont::ALL_IGNORE)){
|
if (font == LyXFont(LyXFont::ALL_IGNORE)) {
|
||||||
// Could only happen with user style
|
// Could only happen with user style
|
||||||
current_view->owner()->getMiniBuffer()
|
current_view->owner()->getMiniBuffer()
|
||||||
->Set(_("No font change defined. Use Character under"
|
->Set(_("No font change defined. Use Character under"
|
||||||
|
Loading…
Reference in New Issue
Block a user