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:
Lars Gullik Bjønnes 2000-02-17 19:59:08 +00:00
parent 17818a9141
commit a0cf758d5a
89 changed files with 19482 additions and 18167 deletions

View File

@ -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>
* src/mathed/math_cursor.[Ch] (SelGetArea): Changed form int * to

View File

@ -6,37 +6,38 @@
# Any takers to complete the stuff?
#
161 "!`" # mirrored !
#162 Cent sign?
160 "\nobreakspace"
161 "\textexclamdown"
#162 "\textcent"
163 "\pounds{}" # pound sign
#164 String sign?
#165 Yen sign?
#166 What's this?
#164 "\textcurrency"
#165 "\textyen"
#166 "\textbrokenbar"
167 "\S{}" # paragraph
168 "\"{}" # umlaut
169 "\copyright{}"
170 "\b{a}" # a macron
170 "\textordfeminine"
171 "\guillemotleft{}"
#172 What's this?
#173 horiz. line?
#174 Registered?
#175 horiz. line at the top?
176 "\b{}" # circle
#177 Plusminus?
#178 ^2?
#179 ^3?
172 "$\lnot$"
173 "\-{}"
174 "\textregistered"
175 "\={}"
176 "\textdegree" # circle
177 "$\pm$"
178 "$\mathtwosuperios$"
179 "$\maththreesuperior$"
180 "\'{}" # acute
181 "$\mu$" # micro
#182 Paragraph?
182 "\P{}"
183 "$\cdot$"
184 "\c{}" # cedilla
185 "${^1}$"
186 "\b{o}" # o macron
185 "$\mathonesuperior$"
186 "\textordmasculine"
187 "\guillemotright{}"
188 "\ensuremath{\frac14}"
189 "\ensuremath{\frac12}"
190 "\ensuremath{\frac34}" # "0BE
191 "?`" # mirrored ?
188 "\textonequarter"
189 "\textonehalf"
190 "\textthreequarters" # "0BE
191 "\textquestiondown" # mirrored ?
192 "\`{A}"
193 "\'{A}"
194 "\^{A}"

View File

@ -75,7 +75,6 @@ src/mathed/math_panel.C
src/menus.C
src/minibuffer.C
src/minibuffer.h
src/newinsets/newinset.h
src/Painter.C
src/PaperLayout.C
src/paragraph.C

1632
po/ca.po

File diff suppressed because it is too large Load Diff

1592
po/cs.po

File diff suppressed because it is too large Load Diff

1592
po/da.po

File diff suppressed because it is too large Load Diff

1590
po/de.po

File diff suppressed because it is too large Load Diff

1590
po/es.po

File diff suppressed because it is too large Load Diff

1591
po/fi.po

File diff suppressed because it is too large Load Diff

1630
po/fr.po

File diff suppressed because it is too large Load Diff

1612
po/he.po

File diff suppressed because it is too large Load Diff

1620
po/hu.po

File diff suppressed because it is too large Load Diff

1592
po/it.po

File diff suppressed because it is too large Load Diff

1595
po/nl.po

File diff suppressed because it is too large Load Diff

1560
po/no.po

File diff suppressed because it is too large Load Diff

1594
po/pl.po

File diff suppressed because it is too large Load Diff

1592
po/pt.po

File diff suppressed because it is too large Load Diff

1595
po/ro.po

File diff suppressed because it is too large Load Diff

1594
po/ru.po

File diff suppressed because it is too large Load Diff

1592
po/sl.po

File diff suppressed because it is too large Load Diff

1630
po/sv.po

File diff suppressed because it is too large Load Diff

1592
po/tr.po

File diff suppressed because it is too large Load Diff

1593
po/wa.po

File diff suppressed because it is too large Load Diff

View File

@ -47,9 +47,6 @@ using std::for_each;
#include "lyxrc.h"
#include "lyxrow.h"
#include "WorkArea.h"
#ifndef USE_PAINTER
#include "lyxdraw.h"
#endif
using std::find_if;
@ -94,12 +91,10 @@ BufferView::~BufferView()
}
#ifdef USE_PAINTER
Painter & BufferView::painter()
{
return workarea->getPainter();
}
#endif
void BufferView::buffer(Buffer * b)
@ -364,7 +359,7 @@ int BufferView::resizeCurrentBuffer()
updateScrollbar();
redraw();
owner_->getMiniBuffer()->Init();
SetState();
setState();
AllowInput();
// Now if the title form still exist kill it
@ -409,7 +404,7 @@ void BufferView::gotoError()
extern "C" {
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
void BufferView::UpCB(long time, int button)
void BufferView::upCB(long time, int button)
{
if (buffer_ == 0) return;
switch (button) {
case 3:
ScrollUpOnePage();
scrollUpOnePage();
break;
case 2:
ScrollDownOnePage();
scrollDownOnePage();
break;
default:
ScrollUp(time);
scrollUp(time);
break;
}
}
@ -457,7 +452,7 @@ void waitForX()
// Callback for scrollbar slider
void BufferView::ScrollCB(double value)
void BufferView::scrollCB(double value)
{
extern bool cursor_follows_scrollbar;
@ -493,25 +488,25 @@ void BufferView::ScrollCB(double value)
// Callback for scrollbar down button
void BufferView::DownCB(long time, int button)
void BufferView::downCB(long time, int button)
{
if (buffer_ == 0) return;
switch (button) {
case 2:
ScrollUpOnePage();
scrollUpOnePage();
break;
case 3:
ScrollDownOnePage();
scrollDownOnePage();
break;
default:
ScrollDown(time);
scrollDown(time);
break;
}
}
int BufferView::ScrollUp(long time)
int BufferView::scrollUp(long time)
{
if (buffer_ == 0) return 0;
if (!screen) return 0;
@ -534,12 +529,12 @@ int BufferView::ScrollUp(long time)
workarea->setScrollbarValue(value);
ScrollCB(value);
scrollCB(value);
return 0;
}
int BufferView::ScrollDown(long time)
int BufferView::scrollDown(long time)
{
if (buffer_ == 0) return 0;
if (!screen) return 0;
@ -564,12 +559,12 @@ int BufferView::ScrollDown(long time)
workarea->setScrollbarValue(value);
ScrollCB(value);
scrollCB(value);
return 0;
}
void BufferView::ScrollUpOnePage()
void BufferView::scrollUpOnePage()
{
if (buffer_ == 0) return;
if (!screen) return;
@ -584,11 +579,11 @@ void BufferView::ScrollUpOnePage()
workarea->setScrollbarValue(y);
ScrollCB(y);
scrollCB(y);
}
void BufferView::ScrollDownOnePage()
void BufferView::scrollDownOnePage()
{
if (buffer_ == 0) return;
if (!screen) return;
@ -603,11 +598,11 @@ void BufferView::ScrollDownOnePage()
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;
@ -645,14 +640,11 @@ void BufferView::WorkAreaMotionNotify(int x, int y, unsigned int state)
}
#ifdef USE_PAINTER
extern int bibitemMaxWidth(Painter &, LyXFont const &);
#else
extern int bibitemMaxWidth(LyXFont const &);
#endif
// 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_y = -1;
@ -665,10 +657,10 @@ void BufferView::WorkAreaButtonPress(int xpos, int ypos, unsigned int button)
if (button == 4 || button == 5) {
switch (button) {
case 4:
ScrollUp(100); // This number is only temporary
scrollUp(100); // This number is only temporary
break;
case 5:
ScrollDown(100);
scrollDown(100);
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;
@ -821,7 +813,7 @@ void BufferView::WorkAreaButtonRelease(int x, int y, unsigned int button)
if (button >= 2) return;
SetState();
setState();
owner_->getMiniBuffer()->Set(CurrentState());
// 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->par->
footnoteflag != LyXParagraph::OPEN_FOOTNOTE){
LyXFont font (LyXFont::ALL_SANE);
LyXFont font(LyXFont::ALL_SANE);
font.setSize(LyXFont::SIZE_FOOTNOTE);
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
#ifdef USE_PAINTER
if (text->cursor.par->bibkey && x < 20 +
bibitemMaxWidth(painter(),
textclasslist
@ -928,14 +919,6 @@ void BufferView::WorkAreaButtonRelease(int x, int y, unsigned int button)
params.textclass).defaultfont())) {
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;
}
@ -946,13 +929,12 @@ void BufferView::WorkAreaButtonRelease(int x, int y, unsigned int button)
* If hit, the coordinates are changed relative to the inset.
* Otherwise coordinates are not changed, and false is returned.
*/
#ifdef USE_PAINTER
Inset * BufferView::checkInsetHit(int & x, int & y)
{
if (!getScreen())
if (!screen)
return 0;
int y_tmp = y + getScreen()->first;
int y_tmp = y + screen->first;
LyXCursor & cursor = text->cursor;
LyXDirection direction = text->real_current_font.getFontDirection();
@ -1013,74 +995,6 @@ Inset * BufferView::checkInsetHit(int & x, int & y)
}
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()
@ -1141,7 +1055,7 @@ void BufferView::workAreaExpose()
// 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);
@ -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;
@ -1325,7 +1239,7 @@ void BufferView::cursorPrevious()
{
if (!text->cursor.row->previous) return;
long y = getScreen()->first;
long y = screen->first;
Row * cursorrow = text->cursor.row;
text->SetCursorFromCoordinates(text->cursor.x_fix, y);
text->FinishUndo();
@ -1334,7 +1248,7 @@ void BufferView::cursorPrevious()
text->CursorUp();
if (text->cursor.row->height < workarea->height())
getScreen()->Draw(text->cursor.y
screen->Draw(text->cursor.y
- text->cursor.row->baseline
+ text->cursor.row->height
- workarea->height() + 1 );
@ -1345,7 +1259,7 @@ void BufferView::cursorNext()
{
if (!text->cursor.row->next) return;
long y = getScreen()->first;
long y = screen->first;
text->GetRowNearY(y);
Row * cursorrow = text->cursor.row;
text->SetCursorFromCoordinates(text->cursor.x_fix, y
@ -1356,7 +1270,7 @@ void BufferView::cursorNext()
text->CursorDown();
if (text->cursor.row->height < workarea->height())
getScreen()->Draw(text->cursor.y
screen->Draw(text->cursor.y
- text->cursor.row->baseline);
}
@ -1370,7 +1284,7 @@ bool BufferView::available() const
void BufferView::beforeChange()
{
getScreen()->ToggleSelection();
toggleSelection();
text->ClearSelection();
FreeUpdateTimer();
}
@ -1431,9 +1345,9 @@ void BufferView::update(signed char f)
void BufferView::smallUpdate(signed char f)
{
getScreen()->SmallUpdate();
if (getScreen()->TopCursorVisible()
!= getScreen()->first) {
screen->SmallUpdate();
if (screen->TopCursorVisible()
!= screen->first) {
update(f);
return;
}
@ -1455,7 +1369,7 @@ void BufferView::smallUpdate(signed char f)
}
void BufferView::SetState()
void BufferView::setState()
{
if (!lyxrc->rtl_support)
return;
@ -1517,3 +1431,44 @@ bool BufferView::active() const
{
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();
}

View File

@ -37,12 +37,8 @@ public:
~BufferView();
///
Buffer * buffer() const { return buffer_; }
#ifdef USE_PAINTER
///
Painter & painter();
#endif
///
WorkArea * getWorkArea() { return workarea; }
///
void buffer(Buffer * b);
///
@ -76,11 +72,6 @@ public:
///
LyXView * owner() const { return owner_; }
///
LyXScreen * getScreen() {
fl_set_timer(timer_cursor, 0.4);
return screen;
}
///
void beforeChange();
///
void savePosition();
@ -174,13 +165,24 @@ public:
///
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);
///
int unlockInset(UpdatableInset * inset);
///
void lockedInsetStoreUndo(Undo::undo_kind kind);
///
void showCursor();
///
void hideCursor();
///
void toggleSelection(bool = true);
///
void toggleToggle();
///
void center();
private:
friend class WorkArea;
@ -189,17 +191,17 @@ private:
///
void workAreaExpose();
///
void ScrollUpOnePage();
void scrollUpOnePage();
///
void ScrollDownOnePage();
void scrollDownOnePage();
///
void create_view();
///
Inset * checkInsetHit(int & x, int & y);
///
int ScrollUp(long time);
int scrollUp(long time);
///
int ScrollDown(long time);
int scrollDown(long time);
public:
///
@ -209,33 +211,27 @@ public:
///
bool active() const;
/// 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.
void ScrollCB(double);
void scrollCB(double);
/// 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);
#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
static void cursorToggleCB(FL_OBJECT * ob, long);
///
void SetState();
void setState();
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_;
///

View File

@ -22,6 +22,7 @@
#include "minibuffer.h"
#include "bufferlist.h"
#include "support/FileInfo.h"
#include "lyxscreen.h"
extern BufferList bufferlist;
@ -367,12 +368,12 @@ void BufferView::openStuff()
{
if (available()) {
owner()->getMiniBuffer()->Set(_("Open/Close..."));
getScreen()->HideCursor();
hideCursor();
beforeChange();
update(-2);
text->OpenStuff();
update(0);
SetState();
setState();
}
}
@ -381,12 +382,12 @@ void BufferView::toggleFloat()
{
if (available()) {
owner()->getMiniBuffer()->Set(_("Open/Close..."));
getScreen()->HideCursor();
hideCursor();
beforeChange();
update(-2);
text->ToggleFootnote();
update(0);
SetState();
setState();
}
}
@ -394,14 +395,14 @@ void BufferView::menuUndo()
{
if (available()) {
owner()->getMiniBuffer()->Set(_("Undo"));
getScreen()->HideCursor();
hideCursor();
beforeChange();
update(-2);
if (!text->TextUndo())
owner()->getMiniBuffer()->Set(_("No further undo information"));
else
update(-1);
SetState();
setState();
}
}
@ -415,14 +416,14 @@ void BufferView::menuRedo()
if (available()) {
owner()->getMiniBuffer()->Set(_("Redo"));
getScreen()->HideCursor();
hideCursor();
beforeChange();
update(-2);
if (!text->TextRedo())
owner()->getMiniBuffer()->Set(_("No further redo information"));
else
update(-1);
SetState();
setState();
}
}
@ -430,7 +431,7 @@ void BufferView::menuRedo()
void BufferView::hyphenationPoint()
{
if (available()) {
getScreen()->HideCursor();
hideCursor();
update(-2);
InsetSpecialChar * new_inset =
new InsetSpecialChar(InsetSpecialChar::HYPHENATION);
@ -442,7 +443,7 @@ void BufferView::hyphenationPoint()
void BufferView::ldots()
{
if (available()) {
getScreen()->HideCursor();
hideCursor();
update(-2);
InsetSpecialChar * new_inset =
new InsetSpecialChar(InsetSpecialChar::LDOTS);
@ -454,7 +455,7 @@ void BufferView::ldots()
void BufferView::endOfSentenceDot()
{
if (available()) {
getScreen()->HideCursor();
hideCursor();
update(-2);
InsetSpecialChar * new_inset =
new InsetSpecialChar(InsetSpecialChar::END_OF_SENTENCE);
@ -466,7 +467,7 @@ void BufferView::endOfSentenceDot()
void BufferView::menuSeparator()
{
if (available()) {
getScreen()->HideCursor();
hideCursor();
update(-2);
InsetSpecialChar * new_inset =
new InsetSpecialChar(InsetSpecialChar::MENU_SEPARATOR);
@ -478,7 +479,7 @@ void BufferView::menuSeparator()
void BufferView::newline()
{
if (available()) {
getScreen()->HideCursor();
hideCursor();
update(-2);
text->InsertChar(LyXParagraph::META_NEWLINE);
update(-1);
@ -489,7 +490,7 @@ void BufferView::newline()
void BufferView::protectedBlank()
{
if (available()) {
getScreen()->HideCursor();
hideCursor();
update(-2);
text->InsertChar(LyXParagraph::META_PROTECTED_SEPARATOR);
update(-1);
@ -500,7 +501,7 @@ void BufferView::protectedBlank()
void BufferView::hfill()
{
if (available()) {
getScreen()->HideCursor();
hideCursor();
update(-2);
text->InsertChar(LyXParagraph::META_HFILL);
update(-1);
@ -512,7 +513,7 @@ void BufferView::copyEnvironment()
if (available()) {
text->copyEnvironmentType();
// clear the selection, even if mark_set
getScreen()->ToggleSelection();
toggleSelection();
text->ClearSelection();
update(-2);
owner()->getMiniBuffer()->Set(_("Paragraph environment type copied"));
@ -535,7 +536,7 @@ void BufferView::copy()
if (available()) {
text->CopySelection();
// clear the selection, even if mark_set
getScreen()->ToggleSelection();
toggleSelection();
text->ClearSelection();
update(-2);
owner()->getMiniBuffer()->Set(_("Copy"));
@ -545,7 +546,7 @@ void BufferView::copy()
void BufferView::cut()
{
if (available()) {
getScreen()->HideCursor();
hideCursor();
update(-2);
text->CutSelection();
update(1);
@ -559,9 +560,9 @@ void BufferView::paste()
if (!available()) return;
owner()->getMiniBuffer()->Set(_("Paste"));
getScreen()->HideCursor();
hideCursor();
// clear the selection
getScreen()->ToggleSelection();
toggleSelection();
text->ClearSelection();
update(-2);
@ -570,7 +571,7 @@ void BufferView::paste()
update(1);
// clear the selection
getScreen()->ToggleSelection();
toggleSelection();
text->ClearSelection();
update(-2);
}
@ -578,9 +579,9 @@ void BufferView::paste()
void BufferView::gotoNote()
{
if (!getScreen()) return;
if (!available()) return;
getScreen()->HideCursor();
hideCursor();
beforeChange();
update(-2);
LyXCursor tmp;
@ -637,10 +638,10 @@ void BufferView::selectLastWord()
{
if (!available()) return;
getScreen()->HideCursor();
hideCursor();
beforeChange();
text->SelectSelectedWord();
getScreen()->ToggleSelection(false);
toggleSelection(false);
update(0);
}
@ -649,25 +650,27 @@ void BufferView::endOfSpellCheck()
{
if (!available()) return;
getScreen()->HideCursor();
hideCursor();
beforeChange();
text->SelectSelectedWord();
text->ClearSelection();
update(0);
}
void BufferView::replaceWord(string const & replacestring)
{
if (!getScreen()) return;
if (!available()) return;
getScreen()->HideCursor();
hideCursor();
update(-2);
/* clear the selection (if there is any) */
getScreen()->ToggleSelection(false);
toggleSelection(false);
update(-2);
/* clear the selection (if there is any) */
getScreen()->ToggleSelection(false);
toggleSelection(false);
text->ReplaceSelectionWithString(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)
{
if (the_locking_inset && getScreen()) {
if (the_locking_inset && available()) {
y += text->cursor.y;
getScreen()->ShowManualCursor(x, y,
screen->ShowManualCursor(x, y,
asc, desc);
}
}
void BufferView::hideLockedInsetCursor(long x, long y, int asc, int desc)
void BufferView::hideLockedInsetCursor()
{
if (the_locking_inset && getScreen()) {
y += text->cursor.y;
getScreen()->HideManualCursor(x, y,
asc, desc);
if (the_locking_inset && available()) {
screen->HideManualCursor();
}
}
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;
if (getScreen()->FitManualCursor(x, y, asc, desc))
if (screen->FitManualCursor(x, y, asc, desc))
updateScrollbar();
}
}

View File

@ -227,28 +227,23 @@ XFontStruct * FontLoader::doLoad(LyXFont::FONT_FAMILY family,
lyxerr << "Could not get font. Using 'fixed'." << endl;
fs = XLoadQueryFont(fl_display, "fixed");
}
} else {
if (lyxerr.debugging(Debug::FONT)) {
// Tell user the font matching
LyXFont f;
f.setFamily(family);
f.setSeries(series);
f.setShape(shape);
f.setSize(size);
// The rest of the attributes are not interesting
f.setEmph(LyXFont::INHERIT);
f.setUnderbar(LyXFont::INHERIT);
f.setNoun(LyXFont::INHERIT);
f.setLatex(LyXFont::INHERIT);
#ifdef USE_PAINTER
f.setColor(LColor::inherit);
#else
f.setColor(LyXFont::INHERIT_COLOR);
#endif
lyxerr << "Font '" << f.stateText()
<< "' matched by\n" << font << endl;
}
} else if (lyxerr.debugging(Debug::FONT)) {
// Tell user the font matching
LyXFont f;
f.setFamily(family);
f.setSeries(series);
f.setShape(shape);
f.setSize(size);
// The rest of the attributes are not interesting
f.setEmph(LyXFont::INHERIT);
f.setUnderbar(LyXFont::INHERIT);
f.setNoun(LyXFont::INHERIT);
f.setLatex(LyXFont::INHERIT);
f.setColor(LColor::inherit);
lyxerr << "Font '" << f.stateText()
<< "' matched by\n" << font << endl;
}
current_view->owner()->getMiniBuffer()->Reset();
fontstruct[family][series][shape][size] = fs;

View File

@ -16,8 +16,6 @@
#pragma interface
#endif
#define USE_PAINTER 1
#include FORMS_H_LOCATION
#include "lyxfont.h"

View File

@ -29,7 +29,6 @@
#include "layout_forms.h"
#include "intl.h"
#include "lyxrc.h"
#include "lyxscreen.h"
#include "support/filetools.h" // OnlyFilename()
#include "layout.h"
#include "lyxtext.h"
@ -81,10 +80,10 @@ void LyXView::UpdateTimerCB(FL_OBJECT * ob, long)
LyXView * view = static_cast<LyXView*>(ob->u_vdata);
if (!view->view()->available())
return;
if (!view->view()->getScreen() || !updatetimer)
if (!updatetimer)
return;
view->view()->getScreen()->HideCursor();
view->view()->hideCursor();
view->view()->update(-2);
/* This update can happen, even when the work area has lost

View File

@ -82,6 +82,7 @@ lyx_SOURCES = \
credits_form.h \
debug.C \
debug.h \
direction.h \
figure.h \
filedlg.C \
filedlg.h \

View File

@ -8,8 +8,6 @@
*
* ======================================================*/
#define USE_PAINTER 1
#ifndef PAINTER_H
#define PAINTER_H

View File

@ -22,31 +22,31 @@ int PainterBase::dummy1 = 0;
int PainterBase::dummy2 = 0;
int PainterBase::dummy3 = 0;
int PainterBase::paperMargin()
int PainterBase::paperMargin() const
{
return 20;
}
int PainterBase::paperWidth()
int PainterBase::paperWidth() const
{
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);
}
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);
}
int PainterBase::width(char c, LyXFont const & f)
int PainterBase::width(char c, LyXFont const & f) const
{
return f.width(c);
}

View File

@ -20,7 +20,7 @@
class WorkArea;
class LyXFont;
class LyXScreen;
//class LyXScreen;
/** A painter class to encapsulate all graphics parameters and operations
@ -64,9 +64,9 @@ public:
/** Screen geometry */
///
int paperMargin();
int paperMargin() const;
///
int paperWidth();
int paperWidth() const;
/**@Basic drawing routines */
/// 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;
/// 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
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
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
the size of the rectangle. If draw is false, we only calculate
@ -192,9 +192,6 @@ public:
int & width = PainterBase::dummy1,
int & ascent = PainterBase::dummy2,
int & descent = PainterBase::dummy3);
/// This is preliminary
//BufferView const * getOwner() const { return &owner; }
private:
WorkArea & owner;
};

View File

@ -70,10 +70,11 @@ inline void EnableParagraphExtra ()
fl_activate_object(fd_form_paragraph_extra->radio_pextra_startmp);
}
bool UpdateParagraphExtra()
{
bool update = false;
if (current_view->getScreen() && current_view->available()) {
if (current_view->available()) {
update = true;
LyXParagraph * par = current_view->text->cursor.par;
@ -166,7 +167,7 @@ void ParagraphExtraOpen(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;
char const * width = fl_get_input(fd->input_pextra_width);
char const * widthp = fl_get_input(fd->input_pextra_widthp);

View File

@ -12,7 +12,6 @@
#include "vspace.h"
#include "lyx_gui_misc.h"
#include "BufferView.h"
#include "lyxscreen.h"
#include "gettext.h"
#include "lyxtext.h"
#include "layout.h"
@ -40,7 +39,7 @@ static int extra_multicol_cursor_x;
bool UpdateLayoutTable(int flag)
{
bool update = true;
if (!current_view->getScreen() || !current_view->available())
if (!current_view->available())
update = false;
if (update && current_view->text->cursor.par->table) {
@ -420,7 +419,7 @@ void TableOptionsCB(FL_OBJECT * ob, long)
} else
return;
if (current_view->available()) {
current_view->getScreen()->HideCursor();
current_view->hideCursor();
if (!current_view->text->selection){
current_view->beforeChange();
current_view->update(-2);
@ -471,7 +470,7 @@ void SetPWidthCB(FL_OBJECT * ob, long)
return;
}
if (current_view->available()){
current_view->getScreen()->HideCursor();
current_view->hideCursor();
if (!current_view->text->selection) {
current_view->beforeChange();
current_view->update(-2);

View File

@ -59,10 +59,7 @@ extern "C" {
WorkArea::WorkArea(BufferView * o, int xpos, int ypos, int width, int height)
: owner(o), workareapixmap(0)
#ifdef USE_PAINTER
, painter_(*this)
#endif
: owner(o), workareapixmap(0), painter_(*this)
{
fl_freeze_all_forms();
@ -164,11 +161,10 @@ WorkArea::WorkArea(BufferView * o, int xpos, int ypos, int width, int height)
// Create the workarea pixmap
createPixmap(width - 15 - 2 * bw, height - 2 * bw);
#ifdef USE_PAINTER
// setup the painter
painter_.setDisplay(fl_display);
painter_.setDrawable(workareapixmap);
#endif
// We add this object as late as possible to avoit problems
// with drawing.
@ -227,10 +223,8 @@ void WorkArea::resize(int xpos, int ypos, int width, int height)
// Create the workarea pixmap
createPixmap(width - 15 - 2 * bw, height - 2 * bw);
#ifdef USE_PAINTER
// reset the painter
painter_.setDrawable(workareapixmap);
#endif
// the free object
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)
time = 0;
//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)
time = 0;
//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);
//area->scroll(fl_get_slider_value(ob));
area->owner->ScrollCB(fl_get_slider_value(ob));
area->owner->scrollCB(fl_get_slider_value(ob));
waitForX();
}
@ -358,7 +352,6 @@ int WorkArea::work_area_handler(FL_OBJECT * ob, int event,
lyxerr.debug() << "Workarea event: DRAW" << endl;
area->createPixmap(area->workWidth(), area->height());
Lgb_bug_find_hack = true;
//area->expose();
area->owner->workAreaExpose();
Lgb_bug_find_hack = false;
break;
@ -366,10 +359,7 @@ int WorkArea::work_area_handler(FL_OBJECT * ob, int event,
if (!ev) break;
// Should really have used xbutton.state
lyxerr.debug() << "Workarea event: PUSH" << endl;
//area->buttonPress(ev->xbutton.x - ob->x,
// ev->xbutton.y - ob->y,
// ev->xbutton.button);
area->owner->WorkAreaButtonPress(ev->xbutton.x - ob->x,
area->owner->workAreaButtonPress(ev->xbutton.x - ob->x,
ev->xbutton.y - ob->y,
ev->xbutton.button);
break;
@ -377,10 +367,7 @@ int WorkArea::work_area_handler(FL_OBJECT * ob, int event,
if (!ev) break;
// Should really have used xbutton.state
lyxerr.debug() << "Workarea event: RELEASE" << endl;
//area->buttonRelease(ev->xbutton.x - ob->x,
// ev->xbutton.y - ob->y,
// ev->xbutton.button);
area->owner->WorkAreaButtonRelease(ev->xbutton.x - ob->x,
area->owner->workAreaButtonRelease(ev->xbutton.x - ob->x,
ev->xbutton.y - ob->y,
ev->xbutton.button);
break;
@ -390,10 +377,7 @@ int WorkArea::work_area_handler(FL_OBJECT * ob, int event,
ev->xmotion.y != y_old ||
fl_get_slider_value(area->scrollbar) != scrollbar_value_old) {
lyxerr.debug() << "Workarea event: MOUSE" << endl;
//area->motion(ev->xmotion.x - ob->x,
// ev->xmotion.y - ob->y,
// ev->xbutton.state);
area->owner->WorkAreaMotionNotify(ev->xmotion.x - ob->x,
area->owner->workAreaMotionNotify(ev->xmotion.x - ob->x,
ev->xmotion.y - ob->y,
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_FOCUS:
lyxerr.debug() << "Workarea event: FOCUS" << endl;
//area->focus();
break;
case FL_UNFOCUS:
lyxerr.debug() << "Workarea event: UNFOCUS" << endl;
//area->unfocus();
break;
case FL_ENTER:
lyxerr.debug() << "Workarea event: ENTER" << endl;
//area->enter();
break;
case FL_LEAVE:
lyxerr.debug() << "Workarea event: LEAVE" << endl;
//area->leave();
break;
case FL_DBLCLICK:
if (!ev) break;
lyxerr.debug() << "Workarea event: DBLCLICK" << endl;;
//area->doubleclick(ev->xbutton.x,
// ev->xbutton.y,
// ev->xbutton.button);
break;
case FL_TRPLCLICK:
if (!ev) break;
lyxerr.debug() << "Workarea event: TRPLCLICK" << endl;
//area->trippleclick(ev->xbutton.x,
// ev->xbutton.y,
// ev->xbutton.button);
break;
case FL_OTHER:
if (!ev) break;
if (ev->type == SelectionNotify) {
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
lyxerr.debug() << "Workarea event: OTHER" << endl;

View File

@ -30,10 +30,8 @@ public:
WorkArea(BufferView *, int xpos, int ypos, int width, int height);
///
~WorkArea();
#ifdef USE_PAINTER
///
Painter & getPainter() { return painter_; }
#endif
///
int workWidth() const { return work_area->w; }
///
@ -112,10 +110,8 @@ private:
BufferView * owner;
/// The pixmap overlay on the workarea
Pixmap workareapixmap;
#ifdef USE_PAINTER
///
Painter painter_;
#endif
///
FL_OBJECT * figinset_canvas;
};

View File

@ -217,7 +217,7 @@ bool Buffer::readLyXformat2(LyXLex & lex, LyXParagraph * par)
bool the_end_read = false;
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
bool has_token = false;
@ -3183,7 +3183,7 @@ int Buffer::runChktex()
void Buffer::RoffAsciiTable(ostream & os, LyXParagraph * par)
{
LyXFont font1 = LyXFont(LyXFont::ALL_INHERIT);
LyXFont font1(LyXFont::ALL_INHERIT);
LyXFont font2;
Inset * inset;
LyXParagraph::size_type i;

View File

@ -33,7 +33,6 @@
#include "lastfiles.h"
#include "debug.h"
#include "lyxrc.h"
#include "lyxscreen.h"
#include "lyxtext.h"
#include "lyx_cb.h"
#include "gettext.h"

View File

@ -11,10 +11,6 @@
#include "bmtable.h"
#include "support/filetools.h"
#ifdef MONO
extern int mono_video;
#endif
FD_form_bullet *create_form_form_bullet(void)
{
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_lcol(obj, FL_BLUE);
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,
LibFileSearch("images",
"standard.xpm").c_str());
#ifdef MONO
}
#endif
fl_set_bmtable_pixmap_file(obj, 6, 6,
LibFileSearch("images",
"standard.xpm").c_str());
fl_set_border_width(-1);
obj = fl_add_frame(FL_ENGRAVED_FRAME, 95, 20, 255, 70, "");

View File

@ -11,10 +11,6 @@
#include "gettext.h"
#include "lyx_gui_misc.h" // CancelCloseBoxCB + WriteAlert
#ifdef MONO
extern int mono_video;
#endif
extern BufferView * current_view;
FD_form_bullet * fd_form_bullet;
@ -26,15 +22,11 @@ static int current_bullet_depth;
void bulletForm()
{
if (!fd_form_bullet) {
if (
#ifdef MONO
!mono_video &&
#endif
(XpmVersion < 4
|| (XpmVersion == 4 && XpmRevision < 7))) {
if ((XpmVersion < 4
|| (XpmVersion == 4 && XpmRevision < 7))) {
WriteAlert(_("Sorry, your libXpm is too old."),
_("This feature requires xpm-4.7 (a.k.a 3.4g) or newer."),
_("Try running LyX in mono mode (lyx -Mono)."));
"");
return;
}
fd_form_bullet = create_form_form_bullet();
@ -226,19 +218,9 @@ void BulletPanelCB(FL_OBJECT * /*ob*/, long data)
new_panel = "standard";
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";
fl_set_bmtable_pixmap_file(fd_form_bullet->bmtable_bullet_panel, 6, 6,
LibFileSearch("images", new_panel.c_str()).c_str());
#ifdef MONO
}
#endif
new_panel += ".xpm";
fl_set_bmtable_pixmap_file(fd_form_bullet->bmtable_bullet_panel, 6, 6,
LibFileSearch("images", new_panel.c_str()).c_str());
fl_redraw_object(fd_form_bullet->bmtable_bullet_panel);
fl_unfreeze_form(fd_form_bullet->form_bullet);
}

View File

@ -2,9 +2,6 @@
* figinset.C - part of LyX project
*/
#ifdef MONO
extern int reverse_video;
#endif
extern long int background_pixels;
/* Rework of path-handling (Matthias 04.07.1996 )
@ -60,9 +57,6 @@ using std::flush;
#include "support/filetools.h"
#include "LyXView.h" // just because of form_main
#include "debug.h"
#ifndef USE_PAINTER
#include "lyxdraw.h"
#endif
#include "LaTeXFeatures.h"
#include "lyxrc.h"
#include "gettext.h"
@ -647,31 +641,9 @@ static void runqueue()
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(
DefaultScreenOfDisplay(fl_display)),
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
sprintf(tbuf+1, " %ld %ld", BlackPixelOfScreen(
DefaultScreenOfDisplay(fl_display)),
fl_get_pixel(FL_WHITE));
XChangeProperty(tempdisp,
fl_get_canvas_id(figinset_canvas),
@ -1058,46 +1030,24 @@ InsetFig::~InsetFig()
}
#ifdef USE_PAINTER
int InsetFig::ascent(Painter &, LyXFont const &) const
{
return hgh + 3;
}
#else
int InsetFig::Ascent(LyXFont const &) const
{
return hgh + 3;
}
#endif
#ifdef USE_PAINTER
int InsetFig::descent(Painter &, LyXFont const &) const
{
return 1;
}
#else
int InsetFig::Descent(LyXFont const &) const
{
return 1;
}
#endif
#ifdef USE_PAINTER
int InsetFig::width(Painter &, LyXFont const &) const
{
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,
int baseline, float & x) const
{
@ -1145,56 +1095,6 @@ void InsetFig::draw(Painter & pain, LyXFont const & f,
}
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)

View File

@ -24,7 +24,6 @@ public:
InsetFig(int tmpx, int tmpy, Buffer *);
///
~InsetFig();
#ifdef USE_PAINTER
///
int ascent(Painter &, LyXFont const & font) const;
///
@ -34,16 +33,6 @@ public:
///
void draw(Painter &, LyXFont const & font,
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 &);
///

View File

@ -472,7 +472,6 @@ void BibitemUpdate(Combox * combox)
// 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 w = 0;
@ -488,27 +487,9 @@ int bibitemMaxWidth(Painter & pain, LyXFont const & font)
}
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
#ifdef USE_PAINTER
string bibitemWidthest(Painter & pain)
{
int w = 0;
@ -533,29 +514,3 @@ string bibitemWidthest(Painter & pain)
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

View File

@ -15,9 +15,6 @@
#endif
#include "insetcommand.h"
#ifndef USE_PAINTER
#include "lyxdraw.h"
#endif
#include "debug.h"
#include "Painter.h"
@ -33,64 +30,107 @@ InsetCommand::InsetCommand(string const & cmd, string const & arg,
}
#ifdef USE_PAINTER
int InsetCommand::ascent(Painter &, LyXFont const & font) const
int InsetCommand::ascent(Painter & pain, LyXFont const &) 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;
f.decSize();
return f.maxAscent() + 3;
}
#else
int InsetCommand::Ascent(LyXFont const & font) const
{
LyXFont f = font;
f.decSize();
return f.maxAscent() + 3;
}
#endif
}
#ifdef USE_PAINTER
int InsetCommand::descent(Painter &, LyXFont const & font) const
int InsetCommand::descent(Painter & pain, LyXFont const &) 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;
f.decSize();
return f.maxDescent() + 3;
}
#else
int InsetCommand::Descent(LyXFont const & font) const
{
LyXFont f = font;
f.decSize();
return f.maxDescent() + 3;
}
#endif
}
#ifdef USE_PAINTER
int InsetCommand::width(Painter &, LyXFont const & font) const
int InsetCommand::width(Painter & pain, LyXFont const &) 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;
f.decSize();
string s = getScreenLabel();
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
}
#ifdef USE_PAINTER
void InsetCommand::draw(Painter & pain, LyXFont const & font,
void InsetCommand::draw(Painter & pain, LyXFont const &,
int baseline, float & x) const
{
// 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;
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);
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
}
// In lyxf3 this will be just LaTeX

View File

@ -32,7 +32,6 @@ public:
///
InsetCommand(string const & name, string const & arg = string(),
string const & opt = string());
#ifdef USE_PAINTER
///
int ascent(Painter &, LyXFont const &) const;
///
@ -41,16 +40,6 @@ public:
int width(Painter &, LyXFont const &) 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 &);
/// Parse the command.

View File

@ -15,9 +15,6 @@
#endif
#include "inseterror.h"
#ifndef USE_PAINTER
#include "lyxdraw.h"
#endif
#include "gettext.h"
#include "lyx_gui_misc.h" // CancelCloseBoxCB
#include "Painter.h"
@ -47,58 +44,30 @@ InsetError::~InsetError()
}
#ifdef USE_PAINTER
int InsetError::ascent(Painter &, LyXFont const & font) const
{
LyXFont efont;
efont.setSize(font.size()).decSize();
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
{
LyXFont efont;
efont.setSize(font.size()).decSize();
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
{
LyXFont efont;
efont.setSize(font.size()).decSize();
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,
int baseline, float & x) const
{
@ -120,27 +89,7 @@ void InsetError::draw(Painter & pain, LyXFont const & font,
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 &)
{

View File

@ -34,7 +34,6 @@ public:
InsetError();
///
~InsetError();
#ifdef USE_PAINTER
///
int ascent(Painter &, LyXFont const & font) const;
///
@ -44,16 +43,6 @@ public:
///
void draw(Painter &, LyXFont const & font,
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 &);
///

View File

@ -24,9 +24,6 @@
#include "buffer.h"
#include "support/lstrings.h"
#include "Painter.h"
#ifndef USE_PAINTER
#include "lyxdraw.h"
#endif
/* Info, used for the Info boxes */
@ -56,46 +53,24 @@ InsetInfo::~InsetInfo()
}
#ifdef USE_PAINTER
int InsetInfo::ascent(Painter &, LyXFont const & font) const
{
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
{
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
{
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,
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);
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)

View File

@ -36,7 +36,6 @@ public:
InsetInfo(string const & string);
///
~InsetInfo();
#ifdef USE_PAINTER
///
int ascent(Painter &, LyXFont const &) const;
///
@ -45,16 +44,6 @@ public:
int width(Painter &, LyXFont const &) 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 &);
///

View File

@ -17,9 +17,6 @@
#include "insetlatexaccent.h"
#include "debug.h"
#include "lyxrc.h"
#ifndef USE_PAINTER
#include "lyxdraw.h"
#endif
#include "support/lstrings.h"
#include "Painter.h"
@ -255,7 +252,6 @@ void InsetLatexAccent::checkContents()
}
#ifdef USE_PAINTER
int InsetLatexAccent::ascent(Painter &, LyXFont const & font) const
{
// 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;
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 max;
@ -311,25 +286,8 @@ int InsetLatexAccent::descent(Painter &, LyXFont const & font) const
max = font.maxDescent() + 4;
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
{
if (candisp)
@ -337,15 +295,6 @@ int InsetLatexAccent::width(Painter &, LyXFont const & font) const
else
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
@ -360,7 +309,6 @@ int InsetLatexAccent::Rbearing(LyXFont const & font) const
}
#ifdef USE_PAINTER
bool InsetLatexAccent::DisplayISO8859_9(Painter & pain, LyXFont const & font,
int baseline,
float & x) const
@ -402,53 +350,8 @@ bool InsetLatexAccent::DisplayISO8859_9(Painter & pain, LyXFont const & font,
else
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,
int baseline, float & x) const
{
@ -487,10 +390,6 @@ void InsetLatexAccent::draw(Painter & pain, LyXFont const & font,
// first the letter
pain.text(int(x), baseline, ic, font);
#if 0
GC pgc = GetAccentGC(font, int((hg + 3.0) / 5.0));
#endif
if (remdot) {
int tmpvar = baseline - font.ascent('i');
float tmpx = 0;
@ -520,7 +419,8 @@ void InsetLatexAccent::draw(Painter & pain, LyXFont const & font,
pain.line(int(x2), int(y + hg),
int(x2 + hg35), y + hg35);
#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);
#endif
break;
@ -531,7 +431,8 @@ void InsetLatexAccent::draw(Painter & pain, LyXFont const & font,
pain.line(int(x2), int(y + hg),
int(x2 - hg35), y + hg35);
#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);
#endif
break;
@ -544,7 +445,8 @@ void InsetLatexAccent::draw(Painter & pain, LyXFont const & font,
int(x2 + wid * 0.4),
int(y + hg));
#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);
#endif
break;
@ -570,8 +472,8 @@ void InsetLatexAccent::draw(Painter & pain, LyXFont const & font,
pain.lines(xp, yp, 4);
#else
pain.text(x2 - font.width('~') / 2,
baseline - font.ascent('~'),
pain.text(x2 - (font.rbearing('~') - font.lbearing('~')) / 2,
baseline - font.ascent(ic) - font.descent('~') - (font.ascent('~') + font.descent('~')) / 2,
'~', font);
#endif
break;
@ -584,7 +486,7 @@ void InsetLatexAccent::draw(Painter & pain, LyXFont const & font,
int(x2 + wid * 0.4),
y + hg / 2.0);
#else
pain.text(x2 - font.width(0x5F) / 2, baseline,
pain.text(x2 - (font.rbearing(0x5F) - font.lbearing(0x5F)) / 2, baseline,
char(0x5F), font);
#endif
break;
@ -608,7 +510,7 @@ void InsetLatexAccent::draw(Painter & pain, LyXFont const & font,
pain.lines(xp, yp, 4);
#else
pain.text(x2 - font.width(0xB8) / 2, baseline,
pain.text(x2 - (font.rbearing(0xB8) - font.lbearing(0xB8)) / 2, baseline,
char(0xB8), font);
#endif
@ -616,17 +518,29 @@ void InsetLatexAccent::draw(Painter & pain, LyXFont const & font,
}
case UNDERDOT: // underdot
{
#if 0
pain.arc(int(x2), y + hg35,
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;
}
case DOT: // dot
{
#if 0
pain.arc(int(x2), y + hg * 0.5,
(hg + 3.0)/5.0,
(hg + 3.0)/5.0,
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;
}
@ -637,8 +551,11 @@ void InsetLatexAccent::draw(Painter & pain, LyXFont const & font,
y + (hg / 2.0), hg, hg , 0,
360 * 64);
#else
pain.text(x2 - font.width(0xB0) / 2, baseline,
char(0xB0), font);
LyXFont tmpf(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
break;
}
@ -685,6 +602,7 @@ void InsetLatexAccent::draw(Painter & pain, LyXFont const & font,
}
case HUNGARIAN_UMLAUT: // hung. umlaut
{
#if 0
int xs1[2], xs2[2], ys1[2], ys2[2];
xs1[0] = int(x2 - (hg / 2.0));
@ -700,6 +618,14 @@ void InsetLatexAccent::draw(Painter & pain, LyXFont const & font,
ys2[1] = int(y + hg35);
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;
}
case UMLAUT: // umlaut
@ -724,7 +650,8 @@ void InsetLatexAccent::draw(Painter & pain, LyXFont const & font,
rad, rad, 0, 360*64);
}
#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);
#endif
break;
@ -739,8 +666,11 @@ void InsetLatexAccent::draw(Painter & pain, LyXFont const & font,
xp[2] = int(x2 + hg35); yp[2] = y + int(hg);
pain.lines(xp, yp, 3);
#else
pain.text(x2 - font.width(0x5E) / 2, baseline,
char(0x5E), font);
LyXFont tmpf(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
break;
}
@ -799,278 +729,6 @@ void InsetLatexAccent::draw(Painter & pain, LyXFont const & 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)

View File

@ -33,7 +33,6 @@ public:
InsetLatexAccent();
///
InsetLatexAccent(string const & string);
#ifdef USE_PAINTER
///
int ascent(Painter &, LyXFont const &) const;
///
@ -42,29 +41,13 @@ public:
int width(Painter &, LyXFont const &) 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 Rbearing(LyXFont const & font) const;
#ifdef USE_PAINTER
///
bool DisplayISO8859_9(Painter &, LyXFont const & font,
int baseline, float & x) const;
#else
///
bool DisplayISO8859_9(LyXFont font, LyXScreen & scr,
int baseline, float & x);
#endif
///
void Write(ostream &);
///

View File

@ -156,33 +156,18 @@ string InsetQuotes::DispString() const
}
#ifdef USE_PAINTER
int InsetQuotes::ascent(Painter &, LyXFont const & font) const
{
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
{
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
{
string text = DispString();
@ -199,24 +184,6 @@ int InsetQuotes::width(Painter &, LyXFont const & font) const
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)
@ -227,7 +194,6 @@ LyXFont InsetQuotes::ConvertFont(LyXFont font)
}
#ifdef USE_PAINTER
void InsetQuotes::draw(Painter & pain, LyXFont const & font,
int baseline, float & x) const
{
@ -236,16 +202,6 @@ void InsetQuotes::draw(Painter & pain, LyXFont const & font,
pain.text(int(x), baseline, text, 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)

View File

@ -70,7 +70,6 @@ public:
/// Create the right quote inset after character c
InsetQuotes(char c, BufferParams const & params);
#ifdef USE_PAINTER
///
int ascent(Painter &, LyXFont const &) const;
///
@ -79,16 +78,6 @@ public:
int width(Painter &, LyXFont const &) 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);
///

View File

@ -17,42 +17,25 @@
#include "debug.h"
#include "LaTeXFeatures.h"
#include "Painter.h"
#ifndef USE_PAINTER
#include "lyxdraw.h"
#endif
InsetSpecialChar::InsetSpecialChar(Kind k)
: kind(k)
{}
#ifdef USE_PAINTER
int InsetSpecialChar::ascent(Painter &, LyXFont const & font) const
{
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
{
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
{
LyXFont f(font);
@ -78,36 +61,8 @@ int InsetSpecialChar::width(Painter &, LyXFont const & font) const
}
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,
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

View File

@ -40,7 +40,6 @@ public:
InsetSpecialChar() {}
///
InsetSpecialChar(Kind k);
#ifdef USE_PAINTER
///
int ascent(Painter &, LyXFont const &) const;
///
@ -49,16 +48,6 @@ public:
int width(Painter &, LyXFont const &) 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 &);
/// Will not be used when lyxf3

View File

@ -16,19 +16,11 @@
#pragma interface
#endif
#define USE_PAINTER 1
#include "gettext.h"
#include "lyxfont.h"
#include "lyxlex.h"
#include "lyxscreen.h"
//#define USE_PAINTER 1
#ifdef USE_PAINTER
class Painter;
#endif
class Buffer;
struct LaTeXFeatures;
@ -87,7 +79,6 @@ public:
///
virtual ~Inset() {}
#ifdef USE_PAINTER
///
virtual int ascent(Painter &, LyXFont const &) const = 0;
///
@ -97,17 +88,6 @@ public:
///
virtual void draw(Painter &, LyXFont const &,
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);
/// what appears in the minibuffer when opening

View File

@ -49,7 +49,6 @@ using std::ifstream;
#include "LyXView.h"
#include "lastfiles.h"
#include "support/FileInfo.h"
#include "lyxscreen.h"
#include "debug.h"
#include "support/syscall.h"
#include "support/lyxlib.h"
@ -187,8 +186,7 @@ void MenuLayoutSave();
void ProhibitInput()
{
input_prohibited = true;
if (current_view->getScreen())
current_view->getScreen()->HideCursor();
current_view->hideCursor();
static Cursor cursor;
static bool cursor_undefined = true;
@ -1034,7 +1032,7 @@ void AutoSave()
// should probably be moved into BufferList (Lgb)
// Perfect target for a thread...
{
if (!current_view->getScreen() || !current_view->available())
if (!current_view->available())
return;
if (current_view->buffer()->isBakClean()
@ -1136,7 +1134,7 @@ void InsertAsciiFile(string const & f, bool asParagraph)
string fname = f;
LyXFileDlg fileDlg;
if (!current_view->getScreen()) return;
if (!current_view->available()) return;
if (fname.empty()) {
ProhibitInput();
@ -1172,7 +1170,7 @@ void InsertAsciiFile(string const & f, bool asParagraph)
tmppar->InsertChar(tmppar->text.size() - 1, '\0');
// insert the string
current_view->getScreen()->HideCursor();
current_view->hideCursor();
// clear the selection
current_view->beforeChange();
@ -1247,7 +1245,7 @@ void MenuInsertRef()
void MenuPasteSelection(char at)
{
if (!current_view->getScreen())
if (!current_view->available())
return;
ascii_type = at;
@ -1272,7 +1270,7 @@ void Foot(BufferView * bv)
bv->owner()->getMiniBuffer()
->Set(_("Inserting Footnote..."));
bv->getScreen()->HideCursor();
bv->hideCursor();
bv->update(-2);
bv->text->InsertFootnoteEnvironment(LyXParagraph::FOOTNOTE);
bv->update(1);
@ -1508,7 +1506,7 @@ inline void EnableParagraphLayout ()
bool UpdateLayoutParagraph()
{
if (!current_view->getScreen() || !current_view->available()) {
if (!current_view->available()) {
if (fd_form_paragraph->form_paragraph->visible)
fl_hide_form(fd_form_paragraph->form_paragraph);
return false;
@ -1732,7 +1730,7 @@ void EnableDocumentLayout ()
bool UpdateLayoutDocument(BufferParams * params)
{
if (!current_view->getScreen() || !current_view->available()) {
if (!current_view->available()) {
if (fd_form_document->form_document->visible)
fl_hide_form(fd_form_document->form_document);
return false;
@ -1906,8 +1904,7 @@ void MenuLayoutDocument()
bool UpdateLayoutQuotes()
{
bool update = true;
if (!current_view->getScreen()
|| !current_view->available()
if (!current_view->available()
|| current_view->buffer()->isReadonly())
update = false;
@ -1945,7 +1942,7 @@ void MenuLayoutQuotes()
bool UpdateLayoutPreamble()
{
bool update = true;
if (!current_view->getScreen() || ! current_view->available())
if (!current_view->available())
update = false;
if (update) {
@ -1998,7 +1995,7 @@ void MenuLayoutPreamble()
void MenuLayoutSave()
{
if (!current_view->getScreen() || ! current_view->available())
if (!current_view->available())
return;
if (AskQuestion(_("Do you want to save the current settings"),
@ -2134,7 +2131,7 @@ static
void ToggleAndShow(BufferView * bv, LyXFont const & font)
{
if (bv->available()) {
bv->getScreen()->HideCursor();
bv->hideCursor();
bv->update(-2);
bv->text->ToggleFree(font, toggleall);
bv->update(1);
@ -2147,7 +2144,7 @@ void Margin(BufferView * bv)
{
if (bv->available()) {
bv->owner()->getMiniBuffer()->Set(_("Inserting margin note..."));
bv->getScreen()->HideCursor();
bv->hideCursor();
bv->update(-2);
bv->text->InsertFootnoteEnvironment(LyXParagraph::MARGIN);
bv->update(1);
@ -2185,7 +2182,7 @@ void Melt(BufferView * bv)
if (!bv->available()) return;
bv->owner()->getMiniBuffer()->Set(_("Melt"));
bv->getScreen()->HideCursor();
bv->hideCursor();
bv->beforeChange();
bv->update(-2);
bv->text->MeltFootnoteEnvironment();
@ -2201,7 +2198,7 @@ void changeDepth(BufferView * bv, int decInc)
{
if (!bv->available()) return;
bv->getScreen()->HideCursor();
bv->hideCursor();
bv->update(-2);
if (decInc >= 0)
bv->text->IncDepth();
@ -2284,7 +2281,6 @@ LyXFont UserFreeFont()
}
pos = fl_get_choice(fd_form_character->choice_color);
#ifdef USE_PAINTER
switch(pos) {
case 1: font.setColor(LColor::ignore); break;
case 2: font.setColor(LColor::none); break;
@ -2298,21 +2294,7 @@ LyXFont UserFreeFont()
case 10: font.setColor(LColor::yellow); 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;
}
@ -2643,7 +2625,7 @@ extern "C" void DocumentApplyCB(FL_OBJECT *, long)
if (lyxrc->rtl_support) {
current_view->text->SetCursor(current_view->text->cursor.par,
current_view->text->cursor.pos);
current_view->SetState();
current_view->setState();
}
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)
{
if (!current_view->getScreen())
if (!current_view->available())
return;
// 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);
current_view->getScreen()->HideCursor();
current_view->hideCursor();
current_view->beforeChange();
current_view->update(-2);
@ -2944,7 +2926,7 @@ extern "C" void TableApplyCB(FL_OBJECT *, long)
current_view->update(1);
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;
}
current_view->getScreen()->HideCursor();
current_view->hideCursor();
current_view->update(-2);
current_view->beforeChange();
@ -3213,7 +3195,7 @@ extern "C" void FigureApplyCB(FL_OBJECT *, long)
current_view->update(0);
current_view->owner()->getMiniBuffer()->Set(_("Figure inserted"));
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 */
if (bv->available()) {
bv->getScreen()->HideCursor();
bv->hideCursor();
bv->update(-3);
if (bv->text->UpdateInset(inset)){
if (mark_dirty)

View File

@ -31,9 +31,6 @@
#include "LyXView.h"
#include "buffer.h"
#include "lyxserver.h"
#ifndef USE_PAINTER
#include "lyxdraw.h"
#endif
#include "lyxrc.h"
#include "gettext.h"
#include "lyx_gui_misc.h"
@ -79,11 +76,6 @@ FL_CMD_OPT cmdopt[] =
{"-height", "*.height", XrmoptionSepArg, "510"},
{"-xpos", "*.xpos", 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"},
{"-MathFrameColor", "*.MathFrameColor", XrmoptionSepArg, "magenta"},
{"-FootColor", "*.FootColor", XrmoptionSepArg, "red"},
@ -103,11 +95,6 @@ static int width;
static int height;
static int xpos;
static int ypos;
#ifdef MONO
int reverse_video;
int mono_video;
int fast_selection;
#endif
bool cursor_follows_scrollbar;
char math_color[32];
char math_frame_color[32];
@ -131,11 +118,6 @@ FL_resource res[] =
{"height", "heightClass", FL_INT, &height, "510", 0},
{"xpos", "xposClass", FL_INT, &xpos, "-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},
{"MathFrameColor", "colorClass", FL_STRING, math_frame_color, "magenta", 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
// 0.13 it should be moved again...
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
}

View File

@ -462,9 +462,6 @@ void commandLineHelp()
"\t-dbg feature[,feature]...\n"
" select the features to debug.\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;
}

View File

@ -22,9 +22,6 @@
#include "debug.h"
#include "lyxrc.h"
#include "lyxlex.h"
#ifndef USE_PAINTER
#include "lyxdraw.h"
#endif
#include "FontLoader.h"
#include "support/lstrings.h"
@ -65,13 +62,6 @@ string const GUIDirectionNames[5] =
{ 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
//
@ -92,12 +82,6 @@ string const LyXSizeNames[14] =
string const LyXMiscNames[12] =
{ "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
//
@ -115,22 +99,12 @@ string const LaTeXSizeNames[14] =
{ "tiny", "scriptsize", "footnotesize", "small", "normalsize", "large",
"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
LyXFont::FontBits LyXFont::sane = { ROMAN_FAMILY,
MEDIUM_SERIES,
UP_SHAPE,
SIZE_NORMAL,
#ifdef USE_PAINTER
LColor::none,
#else
NONE,
#endif
OFF,
OFF,
OFF,
@ -141,11 +115,7 @@ LyXFont::FontBits LyXFont::inherit = { INHERIT_FAMILY,
INHERIT_SERIES,
INHERIT_SHAPE,
INHERIT_SIZE,
#ifdef USE_PAINTER
LColor::inherit,
#else
INHERIT_COLOR,
#endif
INHERIT,
INHERIT,
INHERIT,
@ -156,11 +126,7 @@ LyXFont::FontBits LyXFont::ignore = { IGNORE_FAMILY,
IGNORE_SERIES,
IGNORE_SHAPE,
IGNORE_SIZE,
#ifdef USE_PAINTER
LColor::ignore,
#else
IGNORE_COLOR,
#endif
IGNORE,
IGNORE,
IGNORE,
@ -312,17 +278,10 @@ void LyXFont::update(LyXFont const & newfont, bool toggleall)
setDirection(newfont.direction());
}
#ifdef USE_PAINTER
if(newfont.color() == color() && toggleall)
setColor(LColor::inherit); // toggle 'back'
else if (newfont.color() != LColor::ignore)
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);
if (latex() == tmplt.latex())
setLatex(INHERIT);
#ifdef USE_PAINTER
if (color() == tmplt.color())
setColor(LColor::inherit);
#else
if (color() == tmplt.color())
setColor(LyXFont::INHERIT_COLOR);
#endif
if (direction() == tmplt.direction())
setDirection(INHERIT_DIR);
}
@ -391,15 +345,9 @@ LyXFont & LyXFont::realize(LyXFont const & tmplt)
if (bits.latex == INHERIT) {
bits.latex = tmplt.bits.latex;
}
#ifdef USE_PAINTER
if (bits.color == LColor::inherit) {
bits.color = tmplt.bits.color;
}
#else
if (bits.color == INHERIT_COLOR) {
bits.color = tmplt.bits.color;
}
#endif
if (bits.direction == INHERIT_DIR) {
bits.direction = tmplt.bits.direction;
}
@ -454,19 +402,11 @@ LyXFont & LyXFont::realize(LyXFont const & 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)
{
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)
{
bits &= ~(Dir_Mask << Dir_Pos);
@ -479,7 +419,6 @@ LyXFont & LyXFont::realize(LyXFont const & tmplt)
/// Is font resolved?
#ifdef USE_PAINTER
bool LyXFont::resolved() const
{
return (family() != INHERIT_FAMILY && series() != INHERIT_SERIES &&
@ -489,17 +428,6 @@ bool LyXFont::resolved() const
color() != LColor::inherit &&
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
@ -514,13 +442,8 @@ string LyXFont::stateText() const
buf += string(_(GUIShapeNames[shape()].c_str())) + ", ";
if (size() != INHERIT_SIZE)
buf += string(_(GUISizeNames[size()].c_str())) + ", ";
#ifdef USE_PAINTER
if (color() != LColor::inherit)
buf += lcolor.getGUIName(color()) + ", ";
#else
if (color() != INHERIT_COLOR)
buf += string(_(GUIColorNames[color()].c_str())) + ", ";
#endif
if (emph() != INHERIT)
buf += string(_("Emphasis ")) + _(GUIMiscNames[emph()].c_str()) + ", ";
if (underbar() != INHERIT)
@ -617,18 +540,7 @@ LyXFont::FONT_MISC_STATE LyXFont::setLyXMisc(string const & siz)
/// Sets color after LyX text format
LyXFont & LyXFont::setLyXColor(string const & col)
{
#ifdef USE_PAINTER
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;
}
@ -636,23 +548,11 @@ LyXFont & LyXFont::setLyXColor(string const & col)
/// Sets size after GUI name
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...
// but this does not make sense.
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;
}
@ -802,15 +702,9 @@ void LyXFont::lyxWriteChanges(LyXFont const & orgfont, ostream & os) const
break;
}
}
#ifdef USE_PAINTER
if (orgfont.color() != color()) {
os << "\\color " << lcolor.getLyXName(color()) << "\n";
}
#else
if (orgfont.color() != color()) {
os << "\\color " << LyXColorNames[color()] << "\n";
}
#endif
if (orgfont.direction() != direction()) {
switch (direction()) {
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;
env = true; //We have opened a new environment
}
#ifdef USE_PAINTER
if (f.color() != LColor::inherit) {
file += "\\textcolor{";
file += lcolor.getLaTeXName(f.color());
@ -885,15 +778,6 @@ int LyXFont::latexWriteStartChanges(string & file, LyXFont const & base,
count += lcolor.getLaTeXName(f.color()).length() + 13;
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) {
file += "\\emph{";
count += 6;
@ -966,19 +850,11 @@ int LyXFont::latexWriteEndChanges(string & file, LyXFont const & base,
++count;
env = true; // Size change need not bother about closing env.
}
#ifdef USE_PAINTER
if (f.color() != LColor::inherit) {
file += '}';
++count;
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) {
file += '}';
++count;
@ -1006,7 +882,6 @@ int LyXFont::latexWriteEndChanges(string & file, LyXFont const & base,
}
#ifdef USE_PAINTER
LColor::color LyXFont::realColor() const
{
if (latex() == ON)
@ -1015,7 +890,6 @@ LColor::color LyXFont::realColor() const
return LColor::foreground;
return color();
}
#endif
// 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
{
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, int x) const
{
@ -1229,53 +1079,6 @@ int LyXFont::drawText(char const * s, int n, Pixmap,
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

View File

@ -4,7 +4,8 @@
*
* LyX, The Document Processor
*
* Copyright 1995 Matthias Ettrich
* Copyright 1995 Matthias Ettrich
* Copyright 1995-2000 The LyX Team.
*
* ====================================================== */
@ -15,8 +16,6 @@
#pragma interface
#endif
#define USE_PAINTER 1
#include FORMS_H_LOCATION
#include "LString.h"
#include "debug.h"
@ -151,38 +150,6 @@ public:
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
enum FONT_INIT1 {
///
@ -245,13 +212,8 @@ public:
///
FONT_MISC_STATE latex() const;
#ifdef USE_PAINTER
///
LColor::color color() const;
#else
///
FONT_COLOR color() const;
#endif
///
FONT_DIRECTION direction() const;
@ -275,13 +237,8 @@ public:
LyXFont & setNoun(LyXFont::FONT_MISC_STATE n);
///
LyXFont & setLatex(LyXFont::FONT_MISC_STATE l);
#ifdef USE_PAINTER
///
LyXFont & setColor(LColor::color c);
#else
///
LyXFont & setColor(LyXFont::FONT_COLOR c);
#endif
///
LyXFont & setDirection(LyXFont::FONT_DIRECTION d);
@ -391,20 +348,14 @@ public:
///
int drawString(string const &, Pixmap pm, int baseline, int x) const;
#ifdef USE_PAINTER
///
LColor::color realColor() const;
#endif
///
XID getFontID() const {
return getXFontstruct()->fid;
}
#ifndef USE_PAINTER
///
GC getGC() const;
#endif
///
friend inline
bool operator==(LyXFont const & font1, LyXFont const & font2) {
@ -444,11 +395,7 @@ private:
FONT_SERIES series;
FONT_SHAPE shape;
FONT_SIZE size;
#ifdef USE_PAINTER
LColor::color color;
#else
FONT_COLOR color;
#endif
FONT_MISC_STATE emph;
FONT_MISC_STATE underbar;
FONT_MISC_STATE noun;
@ -553,11 +500,7 @@ private:
| ui32(MEDIUM_SERIES) << Ser_Pos
| ui32(UP_SHAPE) << Sha_Pos
| ui32(SIZE_NORMAL) << Siz_Pos
#ifdef USE_PAINTER
| ui32(LColor::none) << Col_Pos
#else
| ui32(NONE) << Col_Pos
#endif
| ui32(OFF) << Emp_Pos
| ui32(OFF) << Und_Pos
| ui32(OFF) << Nou_Pos
@ -569,11 +512,7 @@ private:
| ui32(INHERIT_SERIES) << Ser_Pos
| ui32(INHERIT_SHAPE) << Sha_Pos
| ui32(INHERIT_SIZE) << Siz_Pos
#ifdef USE_PAINTER
| ui32(LColor::inherit) << Col_Pos
#else
| ui32(INHERIT_COLOR) << Col_Pos
#endif
| ui32(INHERIT) << Emp_Pos
| ui32(INHERIT) << Und_Pos
| ui32(INHERIT) << Nou_Pos
@ -585,11 +524,7 @@ private:
| ui32(IGNORE_SERIES) << Ser_Pos
| ui32(IGNORE_SHAPE) << Sha_Pos
| ui32(IGNORE_SIZE) << Siz_Pos
#ifdef USE_PAINTER
| ui32(LColor::ignore) << Col_Pos
#else
| ui32(IGNORE_COLOR) << Col_Pos
#endif
| ui32(IGNORE) << Emp_Pos
| ui32(IGNORE) << Und_Pos
| ui32(IGNORE) << Nou_Pos
@ -707,19 +642,11 @@ LyXFont::FONT_MISC_STATE LyXFont::latex() const
}
#ifdef USE_PAINTER
inline
LColor::color LyXFont::color() const
{
return bits.color;
}
#else
inline
LyXFont::FONT_COLOR LyXFont::color() const
{
return bits.color;
}
#endif
inline
@ -791,21 +718,13 @@ LyXFont & LyXFont::setLatex(LyXFont::FONT_MISC_STATE l)
}
#ifdef USE_PAINTER
inline
LyXFont & LyXFont::setColor(LColor::color c)
{
bits.color = c;
return *this;
}
#else
inline
LyXFont & LyXFont::setColor(LyXFont::FONT_COLOR c)
{
bits.color = c;
return *this;
}
#endif
inline
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
{
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
@ -947,21 +859,13 @@ inline LyXFont & LyXFont::setLatex(LyXFont::FONT_MISC_STATE l)
}
#ifdef USE_PAINTER
inline LyXFont & LyXFont::setColor(LColor::color c)
{
bits &= ~(Col_Mask << Col_Pos);
bits |= ui32(c) << Col_Pos;
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)
{

View File

@ -25,7 +25,6 @@
#include "lyxfr0.h"
#include "lyxfr1.h"
#include "lyxfunc.h"
#include "lyxscreen.h"
#include "debug.h"
#include "lyxtext.h"
#include "gettext.h"

View File

@ -25,7 +25,6 @@
#include "lyxfr0.h"
#include "lyxfr1.h"
#include "lyxfunc.h"
#include "lyxscreen.h"
#include "debug.h"
#include "lyxtext.h"
#include "gettext.h"
@ -138,7 +137,7 @@ void LyXFindReplace1::StartSearch()
// routine (1999-01-11, dnaber)
void LyXFindReplace1::SearchReplaceCB()
{
if (!current_view->getScreen()) return;
if (!current_view->available()) return;
if (current_view->buffer()->isReadonly()) return;
// CutSelection cannot cut a single space, so we have to stop
@ -153,13 +152,13 @@ void LyXFindReplace1::SearchReplaceCB()
string const replacestring = ReplaceString();
current_view->getScreen()->HideCursor();
current_view->hideCursor();
current_view->update(-2);
LyXText * ltCur = current_view->text;
if (ltCur->selection) {
// clear the selection (if there is any)
current_view->getScreen()->ToggleSelection(false);
current_view->toggleSelection(false);
current_view->text->
ReplaceSelectionWithString(replacestring.c_str());
current_view->text->
@ -175,7 +174,7 @@ void LyXFindReplace1::SearchReplaceCB()
// replaces all occurences of a string (1999-01-15, dnaber@mini.gt.owl.de)
void LyXFindReplace1::SearchReplaceAllCB()
{
if (!current_view->getScreen()) return;
if (!current_view->available()) return;
if (current_view->buffer()->isReadonly()) return;
// CutSelection cannot cut a single space, so we have to stop
@ -190,7 +189,7 @@ void LyXFindReplace1::SearchReplaceAllCB()
string const replacestring = ReplaceString();
current_view->getScreen()->HideCursor();
current_view->hideCursor();
// start at top
current_view->text->ClearSelection();
@ -202,7 +201,7 @@ void LyXFindReplace1::SearchReplaceAllCB()
ltCur = current_view->text;
if (ltCur->selection) {
current_view->update(-2);
current_view->getScreen()->ToggleSelection(false);
current_view->toggleSelection(false);
current_view->text->
ReplaceSelectionWithString(replacestring.c_str());
current_view->text->
@ -233,10 +232,10 @@ bool LyXFindReplace1::SearchCB(bool fForward)
// store search direction
searchForward = fForward;
if (!current_view->getScreen())
if (!current_view->available())
return false;
current_view->getScreen()->HideCursor();
current_view->hideCursor();
current_view->update(-2);
LyXText * ltCur = current_view->text;
if (ltCur->selection)
@ -252,12 +251,12 @@ bool LyXFindReplace1::SearchCB(bool fForward)
current_view->update(-2);
// clear the selection (if there is any)
current_view->getScreen()->ToggleSelection();
current_view->toggleSelection();
current_view->text->ClearSelection();
// set the new selection
SetSelectionOverLenChars(current_view->text, iLenSelected);
current_view->getScreen()->ToggleSelection(false);
current_view->toggleSelection(false);
current_view->owner()->getMiniBuffer()->Set(_("Found."));
result = true;
} else {
@ -267,7 +266,7 @@ bool LyXFindReplace1::SearchCB(bool fForward)
}
if (current_view->focus())
current_view->getScreen()->ShowCursor();
current_view->showCursor();
return result;
}

View File

@ -54,7 +54,6 @@
#include "support/syscall.h"
#include "support/lstrings.h"
#include "support/path.h"
#include "lyxscreen.h"
#include "debug.h"
#include "lyxrc.h"
#include "lyxtext.h"
@ -148,19 +147,19 @@ void LyXFunc::moveCursorUpdate(bool selecting)
{
if (selecting || owner->view()->text->mark_set) {
owner->view()->text->SetSelection();
owner->view()->getScreen()->ToggleToggle();
owner->view()->toggleToggle();
owner->view()->update(0);
} else {
owner->view()->update(-2); // this IS necessary
// (Matthias)
}
owner->view()->getScreen()->ShowCursor();
owner->view()->showCursor();
/* ---> Everytime the cursor is moved, show the current font state. */
// should this too me moved out of this func?
//owner->getMiniBuffer()->Set(CurrentState());
owner->view()->SetState();
owner->view()->setState();
}
@ -453,9 +452,8 @@ string LyXFunc::Dispatch(int ac,
selection_possible = false;
if (owner->view()->available()
&& owner->view()->getScreen())
owner->view()->getScreen()->HideCursor();
if (owner->view()->available())
owner->view()->hideCursor();
// We cannot use this function here
if (getStatus(action) & Disabled)
@ -594,7 +592,7 @@ string LyXFunc::Dispatch(int ac,
// ??? Needed ???
// clear the selection (if there is any)
owner->view()->getScreen()->ToggleSelection();
owner->view()->toggleSelection();
owner->view()->text->ClearSelection();
// Move cursor so that successive C-s 's will not stand in place.
@ -606,19 +604,18 @@ string LyXFunc::Dispatch(int ac,
// ??? Needed ???
// set the new selection
// SetSelectionOverLenChars(owner->view()->currentBuffer()->text, iLenSelected);
owner->view()->getScreen()->ToggleSelection(false);
owner->view()->toggleSelection(false);
} else
LyXBell();
// REMOVED : if (owner->view()->getWorkArea()->focus)
owner->view()->getScreen()->ShowCursor();
owner->view()->showCursor();
}
break;
case LFUN_PREFIX:
{
if (owner->view()->available()
&& owner->view()->getScreen()) {
if (owner->view()->available()) {
owner->view()->update(-2);
}
string buf;
@ -661,6 +658,8 @@ string LyXFunc::Dispatch(int ac,
break;
case LFUN_CENTER: // this is center and redraw.
owner->view()->center();
#if 0
owner->view()->beforeChange();
if (owner->view()->text->cursor.y >
owner->view()->getWorkArea()->height() / 2)
@ -675,6 +674,7 @@ string LyXFunc::Dispatch(int ac,
}
owner->view()->update(0);
owner->view()->redraw();
#endif
break;
case LFUN_APPENDIX:
@ -933,7 +933,7 @@ string LyXFunc::Dispatch(int ac,
case LFUN_TEX:
Tex();
owner->view()->SetState();
owner->view()->setState();
owner->getMiniBuffer()->Set(CurrentState());
break;
@ -956,7 +956,7 @@ string LyXFunc::Dispatch(int ac,
}
else
Foot(owner->view());
owner->view()->SetState();
owner->view()->setState();
break;
case LFUN_MARGINMELT:
@ -969,7 +969,7 @@ string LyXFunc::Dispatch(int ac,
Melt(owner->view());
} else
Margin(owner->view());
owner->view()->SetState();
owner->view()->setState();
break;
// --- version control -------------------------------
@ -1096,7 +1096,7 @@ string LyXFunc::Dispatch(int ac,
}
if (current_layout != layout.second) {
owner->view()->getScreen()->HideCursor();
owner->view()->hideCursor();
current_layout = layout.second;
owner->view()->update(-2);
owner->view()->text->
@ -1153,7 +1153,7 @@ string LyXFunc::Dispatch(int ac,
case LFUN_RTL:
{
RTLCB();
owner->view()->SetState();
owner->view()->setState();
owner->getMiniBuffer()->Set(CurrentState());
}
break;
@ -1309,7 +1309,6 @@ string LyXFunc::Dispatch(int ac,
case LFUN_LEFT:
{
#ifdef USE_PAINTER
// This is soooo ugly. Isn`t it possible to make
// it simpler? (Lgb)
LyXText * txt = owner->view()->text;
@ -1336,33 +1335,6 @@ string LyXFunc::Dispatch(int ac,
owner->view()->text->FinishUndo();
moveCursorUpdate(false);
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;
@ -1675,14 +1647,14 @@ string LyXFunc::Dispatch(int ac,
owner->view()->smallUpdate(1);
// It is possible to make it a lot faster still
// just comment out the lone below...
owner->view()->getScreen()->ShowCursor();
owner->view()->showCursor();
} else {
owner->view()->cut();
}
SetUpdateTimer();
moveCursorUpdate(false);
owner->getMiniBuffer()->Set(CurrentState());
owner->view()->SetState();
owner->view()->setState();
break;
case LFUN_DELETE_SKIP:
@ -1792,14 +1764,14 @@ string LyXFunc::Dispatch(int ac,
owner->view()->smallUpdate(1);
// It is possible to make it a lot faster still
// just comment out the lone below...
owner->view()->getScreen()->ShowCursor();
owner->view()->showCursor();
}
} else {
owner->view()->cut();
}
SetUpdateTimer();
owner->getMiniBuffer()->Set(CurrentState());
owner->view()->SetState();
owner->view()->setState();
}
break;
@ -1843,7 +1815,7 @@ string LyXFunc::Dispatch(int ac,
SetUpdateTimer(0.01);
owner->view()->text->sel_cursor =
owner->view()->text->cursor;
owner->view()->SetState();
owner->view()->setState();
owner->getMiniBuffer()->Set(CurrentState());
break;
}
@ -1856,7 +1828,7 @@ string LyXFunc::Dispatch(int ac,
SetUpdateTimer(0.01);
owner->view()->text->sel_cursor =
owner->view()->text->cursor;
owner->view()->SetState();
owner->view()->setState();
owner->getMiniBuffer()->Set(CurrentState());
break;
}
@ -1889,7 +1861,7 @@ string LyXFunc::Dispatch(int ac,
}
SetUpdateTimer(0.01);
owner->view()->text->sel_cursor = cursor;
owner->view()->SetState();
owner->view()->setState();
owner->getMiniBuffer()->Set(CurrentState());
}
break;
@ -2007,6 +1979,8 @@ string LyXFunc::Dispatch(int ac,
owner->view()->setCursorFromRow(row);
// Recenter screen
owner->view()->center();
#if 0
owner->view()->beforeChange();
if (owner->view()->text->cursor.y >
owner->view()->getWorkArea()->height() / 2
@ -2021,6 +1995,7 @@ string LyXFunc::Dispatch(int ac,
}
owner->view()->update(0);
owner->view()->redraw();
#endif
}
break;
@ -2386,7 +2361,7 @@ string LyXFunc::Dispatch(int ac,
}
owner->view()->text->InsertFootnoteEnvironment(kind);
owner->view()->update(1);
owner->view()->SetState();
owner->view()->setState();
}
break;

View File

@ -36,9 +36,6 @@ using std::ios;
// this is crappy... why are those colors command line arguments and
// not in lyxrc?? (Matthias)
// Because nobody put them there. (Asger)
#ifdef MONO
extern int fast_selection;
#endif
extern string background_color;
extern char selection_color[];
@ -100,9 +97,6 @@ enum LyXRCTags {
RC_KBMAP,
RC_KBMAP_PRIMARY,
RC_KBMAP_SECONDARY,
#ifdef MONO
RC_FAST_SELECTION,
#endif
RC_SELECTION_COLOR,
RC_BACKGROUND_COLOR,
RC_FAX_COMMAND,
@ -171,9 +165,6 @@ static keyword_item lyxrcTags[] = {
{ "\\dvi_to_ps_command", RC_DVI_TO_PS_COMMAND },
{ "\\escape_chars", RC_ESC_CHARS },
{ "\\exit_confirmation", RC_EXIT_CONFIRMATION },
#ifdef MONO
{ "\\fast_selection", RC_FAST_SELECTION },
#endif
{ "\\fax_command", RC_FAX_COMMAND },
{ "\\fax_program", RC_FAXPROGRAM },
{ "\\font_encoding", RC_FONT_ENCODING },
@ -848,13 +839,6 @@ int LyXRC::read(string const & filename)
cursor_follows_scrollbar = lexrc.GetBool();
break;
#ifdef MONO
case RC_FAST_SELECTION:
if (lexrc.next())
fast_selection = lexrc.GetBool();
break;
#endif
case RC_BACKGROUND_COLOR:
if (lexrc.next())
background_color = lexrc.GetString();
@ -1188,11 +1172,6 @@ void LyXRC::output(ostream & os) const
case RC_CURSOR_FOLLOWS_SCROLLBAR:
os << "\\cursor_follows_scrollbar "
<< 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:
os << "\\background_color \"" << background_color << "\"\n";
case RC_SELECTION_COLOR:

View File

@ -19,12 +19,6 @@
#include FORMS_H_LOCATION
#include <X11/Xlib.h>
#define USE_PAINTER 1
#ifndef USE_PAINTER
#include "lyxdraw.h"
#endif
class LyXText;
struct Row;
typedef unsigned short Dimension;
@ -49,14 +43,6 @@ public:
///
~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
the already printed pixmap as possible */
void Draw(long y );
@ -77,7 +63,7 @@ public:
///
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
int FitManualCursor(long, long, int, int);
///
@ -96,54 +82,6 @@ public:
or only current row */
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
long first;
@ -191,148 +129,9 @@ private:
long screen_refresh_y;
///
Row * screen_refresh_row;
///
//friend class InsetFormula;
#ifdef USE_PAINTER
///
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

View File

@ -24,7 +24,7 @@
class Buffer;
class BufferParams;
class LyXScreen;
//class LyXScreen;
class Row;
class BufferView;
@ -290,13 +290,8 @@ public:
decide, wether it is selected text or not. This is a strange
solution but faster.
*/
#ifdef USE_PAINTER
void GetVisibleRow(int offset,
Row * row_ptr, long y);
#else
void GetVisibleRow(LyXScreen & scr, int offset,
Row * row_ptr, long y);
#endif
/* footnotes: */
///
@ -555,17 +550,11 @@ private:
///
int SingleWidth(LyXParagraph * par,
LyXParagraph::size_type pos, char c) const;
#ifdef USE_PAINTER
///
void draw(Row const * row,
LyXParagraph::size_type & pos,
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
LyXParagraph::size_type NextBreakPoint(Row const * row,
int width) const;

View File

@ -30,10 +30,6 @@
#include "lyx_cb.h"
#include "minibuffer.h"
#include "BufferView.h"
#include "lyxscreen.h"
#ifndef USE_PAINTER
#include "lyxdraw.h"
#endif
#include "lyxtext.h"
#include "gettext.h"
#include "LaTeXFeatures.h"
@ -45,17 +41,8 @@
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;
#ifdef MONO
extern int mono_video;
extern int fast_selection;
#endif
extern BufferView * current_view;
extern char const * latex_special_chars;
@ -150,13 +137,8 @@ LyXFont WhichFont(short type, int size)
break;
}
#ifdef USE_PAINTER
if (type != LM_TC_TEXTRM)
f.setColor(LColor::math);
#else
if (type != LM_TC_TEXTRM)
f.setColor(LyXFont::MATH);
#endif
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
//at once (JMarc) rc
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);
@ -196,7 +178,7 @@ void mathed_init_fonts() //removed 'static' because DEC cxx does not
MathedInset::df_width = f.width('I');
}
#ifdef USE_PAINTER
LyXFont mathed_get_font(short type, int size)
{
LyXFont f = WhichFont(type, size);
@ -205,24 +187,6 @@ LyXFont mathed_get_font(short type, int size)
}
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)
@ -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
#ifdef USE_PAINTER
void MathedInset::drawStr(Painter & pain, short type, int size,
int x, int y, byte * s, int ls)
{
string st;
if (MathIsBinary(type)) {
for (int i = 0; i < ls; ++i) {
#warning What conversion should be done for s[i] here?
st += string(" ") + char(s[i]) + ' ';
}
} else {
@ -295,27 +257,6 @@ void MathedInset::drawStr(Painter & pain, short type, int size,
LyXFont mf = mathed_get_font(type, size);
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)
@ -436,50 +377,26 @@ void InsetFormula::Read(LyXLex & lex)
}
#ifdef USE_PAINTER
int InsetFormula::ascent(Painter &, LyXFont const &) const
{
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
{
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
{
lfont_size = f.size();
par->Metrics();
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 &,
int baseline, float & x) const
{
@ -537,62 +454,6 @@ void InsetFormula::draw(Painter & pain, LyXFont const &,
}
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)
@ -644,16 +505,16 @@ void InsetFormula::ToggleInsetCursor()
if (!mathcursor)
return;
int x, y, asc, desc;
int x, y;
mathcursor->GetPos(x, y);
// x -= par->xo;
y -= par->yo;
LyXFont font = WhichFont(LM_TC_TEXTRM, LM_ST_TEXT);
asc = font.maxAscent();
desc = font.maxDescent();
int asc = font.maxAscent();
int desc = font.maxDescent();
if (cursor_visible)
current_view->hideLockedInsetCursor(x, y, asc, desc);
current_view->hideLockedInsetCursor();
else
current_view->showLockedInsetCursor(x, y, asc, desc);
cursor_visible = !cursor_visible;
@ -864,10 +725,6 @@ bool InsetFormula::LocalDispatch(int action, char const * arg)
static MathSpaceInset * sp= 0;
HideInsetCursor();
#ifdef MONO
if (mathcursor->Selection() && (fast_selection || mono_video))
ToggleInsetSelection();
#endif
if (mathcursor->getLastCode() == LM_TC_TEX) {
varcode = LM_TC_TEX;
@ -1325,11 +1182,7 @@ bool InsetFormula::LocalDispatch(int action, char const * arg)
&& action != LFUN_BACKSPACE)
UpdateLocal();
if (sp && !space_on) sp = 0;
if (mathcursor->Selection() || (was_selection
#ifdef MONO
&& !(fast_selection || mono_video)
#endif
))
if (mathcursor->Selection() || was_selection)
ToggleInsetSelection();
if (result)
@ -1341,7 +1194,6 @@ bool InsetFormula::LocalDispatch(int action, char const * arg)
}
#ifdef USE_PAINTER
void
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);
font.setLatex(LyXFont::ON);
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);
}
}
#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()
{

View File

@ -36,7 +36,6 @@ public:
InsetFormula(MathParInset *);
///
~InsetFormula();
#ifdef USE_PAINTER
///
int ascent(Painter &, LyXFont const &) const;
///
@ -45,16 +44,6 @@ public:
int width(Painter &, LyXFont const &) 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 &);
///

View File

@ -28,10 +28,6 @@
#include "lyx_main.h"
#include "lyx_cb.h"
#include "BufferView.h"
#include "lyxscreen.h"
#ifndef USE_PAINTER
#include "lyxdraw.h"
#endif
#include "gettext.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
{
if (opened) {
@ -127,19 +122,8 @@ int InsetFormulaMacro::ascent(Painter & pain, LyXFont const & f) const
}
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
{
if (opened) {
@ -148,19 +132,8 @@ int InsetFormulaMacro::descent(Painter & pain, LyXFont const & f) const
}
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
{
if (opened) {
@ -171,21 +144,8 @@ int InsetFormulaMacro::width(Painter & pain, LyXFont const & f) const
ilabel += name;
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,
int baseline, float & x) const
{
@ -212,32 +172,6 @@ void InsetFormulaMacro::draw(Painter & pain, LyXFont const & f,
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)

View File

@ -35,7 +35,6 @@ public:
InsetFormulaMacro(string name, int na = 0, bool env = false);
///
~InsetFormulaMacro();
#ifdef USE_PAINTER
///
int ascent(Painter &, LyXFont const &) const;
///
@ -44,16 +43,6 @@ public:
int width(Painter &, LyXFont const &) 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);
///

View File

@ -31,14 +31,6 @@
#include "LColor.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;
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)
{
// lyxerr << "Cursor[" << x << " " << y << "] ";
@ -171,27 +162,8 @@ void MathedCursor::draw(Painter & pain, int x, int y)
par->draw(pain, x, y);
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)
{
lyxerr[Debug::MATHED] << "Mathed: Redrawing!" << endl;
@ -205,21 +177,6 @@ void MathedCursor::Redraw(Painter & pain)
LColor::mathbg);
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)
@ -960,7 +917,6 @@ void MathedCursor::SelBalance()
}
#ifdef USE_PAINTER
void MathedCursor::SelGetArea(int ** xp, int ** yp, int & np)
{
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 << "] ";
}
#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)

View File

@ -56,17 +56,10 @@ class MathedCursor {
bool Push();
/// Pull out an argument from its container inset
bool pullArg();
#ifdef USE_PAINTER
///
void draw(Painter &, int x, int y);
///
void Redraw(Painter &);
#else
///
void Draw(long unsigned pm, int x, int y);
///
void Redraw();
#endif
///
void Delete();
///
@ -123,12 +116,8 @@ class MathedCursor {
void SelClear();
///
void SelBalance();
#ifdef USE_PAINTER
void SelGetArea(int ** xp, int ** yp, int & n);
#else
///
XPoint * SelGetArea(int &);
#endif
void SelGetArea(int ** xp, int ** yp, int & n);
///
void clearLastCode() { lastcode = LM_TC_MIN; }
///

View File

@ -24,8 +24,6 @@
#pragma interface
#endif
#define USE_PAINTER 1
#include "support/LIstream.h"
#include "LString.h"
@ -229,13 +227,8 @@ class MathedInset {
///
virtual ~MathedInset() {}
#ifdef USE_PAINTER
/// Draw the object
virtual void draw(Painter &, int x, int baseline) = 0;
#else
/// Draw the object
virtual void Draw(int x, int baseline) = 0;
#endif
virtual void draw(Painter &, int x, int baseline) = 0;
/// Write LaTeX and Lyx code
virtual void Write(ostream &) = 0;
@ -276,11 +269,6 @@ class MathedInset {
virtual void SetStyle(short st) { size = st; } // Metrics();
///
virtual void SetName(char const * n) { name = n; }
#ifndef USE_PAINTER
///
void setDrawable(long unsigned int d) { pm = d; }
#endif
protected:
///
char const * name;
@ -294,20 +282,11 @@ class MathedInset {
int descent;
///
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
static int df_asc, df_des, df_width;
/// 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);
#else
void drawStr(short, int, int, int, byte *, int);
#endif
///
friend class MathedCursor;
///
@ -349,11 +328,7 @@ class MathParInset: public MathedInset {
virtual MathedInset * Clone();
/// Draw the object on a drawable
#ifdef USE_PAINTER
virtual void draw(Painter &, int x, int baseline);
#else
virtual void Draw(int x, int baseline);
#endif
/// Write LaTeX code
virtual void Write(ostream &);
@ -511,13 +486,8 @@ class MathMatrixInset: public MathParInset {
MathedInset * Clone();
///
virtual ~MathMatrixInset();
#ifdef USE_PAINTER
///
void draw(Painter &, int, int);
#else
///
void Draw(int, int);
#endif
void draw(Painter &, int, int);
///
void Write(ostream &);
///

View File

@ -231,9 +231,6 @@ typedef float matriz_data[2][2];
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_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;
}
#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;
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)
{
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);
}
#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
MathDelimInset::draw(Painter & pain, int x, int y)
{
@ -457,29 +384,6 @@ MathDelimInset::draw(Painter & pain, int x, int y)
} else
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
@ -499,21 +403,12 @@ MathDelimInset::Metrics()
}
#ifdef USE_PAINTER
void
MathDecorationInset::draw(Painter & pain, int x, int y)
{
MathParInset::draw(pain, x + (width - dw) / 2, y);
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
@ -538,7 +433,6 @@ MathDecorationInset::Metrics()
}
#ifdef USE_PAINTER
void
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;
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
@ -607,7 +476,6 @@ MathAccentInset::Metrics()
}
#ifdef USE_PAINTER
void
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;
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

View File

@ -23,26 +23,12 @@
#include "lyxfont.h"
#include "Painter.h"
#ifdef USE_PAINTER
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_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_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
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);
}
#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
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);
}
}
#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
@ -368,7 +243,6 @@ MathParInset::Metrics()
}
#ifdef USE_PAINTER
void
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;
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
@ -418,7 +274,6 @@ MathSqrtInset::Metrics()
}
#ifdef USE_PAINTER
void
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);
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
@ -480,7 +316,6 @@ MathFracInset::Metrics()
}
#ifdef USE_PAINTER
void
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));
}
#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
MathBigopInset::Metrics()
{
@ -564,29 +369,3 @@ MathBigopInset::Metrics()
ls);
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

View File

@ -416,23 +416,16 @@ void MathMatrixInset::SetData(LyxArrayBase * a)
}
#ifdef USE_PAINTER
void MathMatrixInset::draw(Painter & pain, int x, int baseline)
{
MathParInset::draw(pain, x, baseline);
}
#else
void MathMatrixInset::Draw(int x, int baseline)
{
MathParInset::Draw(x, baseline);
}
#endif
void MathMatrixInset::Metrics()
{
int i, hl, h= 0;
MathedRowSt * cprow= 0, * cxrow;
int i, hl, h = 0;
MathedRowSt * cprow= 0;
if (!row) {
// lyxerr << " MIDA ";
@ -441,7 +434,7 @@ void MathMatrixInset::Metrics()
}
// Clean the arrays
cxrow = row;
MathedRowSt * cxrow = row;
while (cxrow) {
for (i = 0; i <= nc; ++i) cxrow->w[i] = 0;
cxrow = cxrow->next;

View File

@ -43,13 +43,8 @@ public:
~MathFuncInset();
///
MathedInset * Clone();
#ifdef USE_PAINTER
///
void draw(Painter &, int, int);
#else
///
void Draw(int, int);
#endif
///
void Write(ostream &);
///
@ -79,13 +74,8 @@ public:
~MathAccentInset();
///
MathedInset * Clone();
#ifdef USE_PAINTER
///
void draw(Painter &, int, int);
#else
///
void Draw(int, int);
#endif
///
void Write(ostream &);
///
@ -116,13 +106,8 @@ public:
MathDotsInset(char const *, int, short st = LM_ST_TEXT);
///
MathedInset * Clone();
#ifdef USE_PAINTER
///
void draw(Painter &, int, int);
#else
///
void Draw(int, int);
#endif
///
void Write(ostream &);
///
@ -142,13 +127,8 @@ public:
MathSpaceInset(int sp, short ot = LM_OT_SPACE, short st = LM_ST_TEXT);
///
MathedInset * Clone();
#ifdef USE_PAINTER
///
void draw(Painter &, int, int);
#else
///
void Draw(int, int);
#endif
///
void Write(ostream &);
///
@ -172,13 +152,8 @@ public:
MathBigopInset(char const *, int, short st = LM_ST_TEXT);
///
MathedInset * Clone();
#ifdef USE_PAINTER
///
void draw(Painter &, int, int);
#else
///
void Draw(int, int);
#endif
///
void Write(ostream &);
///
@ -206,12 +181,8 @@ public:
MathSqrtInset(short st = LM_ST_TEXT);
///
MathedInset * Clone();
#ifdef USE_PAINTER
void draw(Painter &, int x, int baseline);
#else
///
void Draw(int x, int baseline);
#endif
void draw(Painter &, int x, int baseline);
///
void Write(ostream &);
///
@ -235,13 +206,8 @@ public:
~MathFracInset();
///
MathedInset * Clone();
#ifdef USE_PAINTER
///
void draw(Painter &, int x, int baseline);
#else
///
void Draw(int x, int baseline);
#endif
///
void Write(ostream &);
///
@ -288,13 +254,8 @@ public:
MathDelimInset(int, int, short st = LM_ST_TEXT);
///
MathedInset * Clone();
#ifdef USE_PAINTER
///
void draw(Painter &, int, int);
#else
///
void Draw(int, int);
#endif
///
void Write(ostream &);
///
@ -316,13 +277,8 @@ public:
MathDecorationInset(int, short st = LM_ST_TEXT);
///
MathedInset * Clone();
#ifdef USE_PAINTER
///
void draw(Painter &, int, int);
#else
///
void Draw(int, int);
#endif
///
void Write(ostream &);
///

View File

@ -47,9 +47,6 @@ ostream & operator<<(ostream & o, MathedMacroFlag 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_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)
{
xo = x; yo = y;
Metrics();
tmplate->update(this);
tmplate->SetStyle(size);
//mathGC = latexGC;
tmplate->draw(pain, x, y);
for (int i = 0; i < nargs; ++i)
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()
@ -238,7 +220,6 @@ MathMacroArgument::MathMacroArgument(int n)
}
#ifdef USE_PAINTER
void MathMacroArgument::draw(Painter & pain, int x, int baseline)
{
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);
}
}
#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()
@ -339,7 +308,6 @@ void MathMacroTemplate::setEditMode(bool ed)
}
#ifdef USE_PAINTER
void MathMacroTemplate::draw(Painter & pain, int x, int y)
{
int x2, y2;
@ -362,30 +330,6 @@ void MathMacroTemplate::draw(Painter & pain, int x, int y)
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()

View File

@ -42,14 +42,9 @@ class MathMacro : public MathParInset
MathMacro(MathMacro *);
///
~MathMacro();
#ifdef USE_PAINTER
///
void draw(Painter &, int, int);
#else
///
void Draw(int, int);
#endif
///
///
void draw(Painter &, int, int);
///
void Metrics();
///
MathedInset * Clone();
@ -120,13 +115,8 @@ class MathMacroArgument: public MathParInset
MathedInset * Clone() { return this; }
///
void Metrics();
#ifdef USE_PAINTER
///
void draw(Painter &, int x, int baseline);
#else
///
void Draw(int x, int baseline);
#endif
void draw(Painter &, int x, int baseline);
///
void Write(ostream &);
///
@ -154,13 +144,8 @@ class MathMacroTemplate: public MathParInset
MathMacroTemplate(char const *, int na = 0, int f = 0);
///
~MathMacroTemplate();
#ifdef USE_PAINTER
///
void draw(Painter &, int, int);
#else
///
void Draw(int, int);
#endif
void draw(Painter &, int, int);
///
void Metrics();
///

View File

@ -109,7 +109,6 @@ void MathRootInset::Metrics()
}
#ifdef USE_PAINTER
void MathRootInset::draw(Painter & pain, int x, int y)
{
int idxp = idx;
@ -119,18 +118,6 @@ void MathRootInset::draw(Painter & pain, int x, int y)
MathSqrtInset::draw(pain, x + wroot, y);
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)

View File

@ -36,13 +36,8 @@ class MathRootInset: public MathSqrtInset {
~MathRootInset();
///
MathedInset * Clone();
#ifdef USE_PAINTER
///
void draw(Painter &, int x, int baseline);
#else
///
void Draw(int x, int baseline);
#endif
void draw(Painter &, int x, int baseline);
///
void Write(ostream &);
///

View File

@ -39,7 +39,6 @@
#include "bufferlist.h"
#include "lyx_gui_misc.h"
#include "minibuffer.h"
#include "lyxscreen.h"
#include "intl.h"
#include "debug.h"
#include "lyxrc.h"
@ -1080,8 +1079,8 @@ void Menus::ShowEditMenu(FL_OBJECT * ob, long)
case 38: case 39: case 40:
case 41: case 42: case 43:
case 44:
if (men->currentView()->available()){
men->currentView()->getScreen()->HideCursor();
if (men->currentView()->available()) {
men->currentView()->hideCursor();
if (!men->currentView()->text->selection){
men->currentView()->beforeChange();
men->currentView()->update(-2);
@ -1342,7 +1341,7 @@ void Menus::ShowInsertMenu(FL_OBJECT * ob, long)
fl_redraw_object(ob);
if (men->currentView()->available()){
men->currentView()->getScreen()->HideCursor();
men->currentView()->hideCursor();
switch (choice) {
case 1: tmpfunc->Dispatch(LFUN_FIGURE); break;
case 2: tmpfunc->Dispatch(LFUN_TABLE); break;

View File

@ -43,11 +43,7 @@ extern LyXRC * lyxrc;
// ale970405
#ifdef USE_PAINTER
extern string bibitemWidthest(Painter &);
#else
extern string bibitemWidthest();
#endif
// this is a minibuffer
static char minibuffer_char;
@ -348,17 +344,10 @@ void LyXParagraph::validate(LaTeXFeatures & features) const
<< endl;
}
switch ((*cit).font.color()) {
#ifdef USE_PAINTER
case LColor::none:
case LColor::inherit:
case LColor::ignore:
break;
#else
case LyXFont::NONE:
case LyXFont::INHERIT_COLOR:
case LyXFont::IGNORE_COLOR:
break;
#endif
default:
features.color = true;
lyxerr[Debug::LATEX] << "Color enabled. Font: "
@ -3185,7 +3174,7 @@ bool LyXParagraph::RoffContTableRows(ostream & os,
if (!table)
return false;
LyXFont font1 = LyXFont(LyXFont::ALL_INHERIT);
LyXFont font1(LyXFont::ALL_INHERIT);
LyXFont font2;
Inset * inset;
char c;
@ -3414,12 +3403,8 @@ LyXParagraph * LyXParagraph::TeXEnvironment(string & file, TexRow & texrow,
} else if (style.labeltype == LABEL_BIBLIO) {
// ale970405
file += "\\begin{" + style.latexname() + "}{"
#ifdef USE_PAINTER
+ bibitemWidthest(current_view->painter())
+ "}\n";
#else
+ bibitemWidthest() + "}\n";
#endif
} else if (style.latextype == LATEX_ITEM_ENVIRONMENT) {
#ifdef FANCY_FOOTNOTE_CODE
if (foot_count < 0) {

View File

@ -19,16 +19,8 @@
#include "lyxrow.h"
#include "BufferView.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
GC createGC()
{
@ -44,7 +36,6 @@ GC createGC()
GCForeground | GCFunction | GCGraphicsExposures
| GCLineWidth | GCLineStyle , &val);
}
#endif
// Constructor
@ -74,10 +65,8 @@ LyXScreen::LyXScreen(BufferView * o, Window window,
cursor_pixmap_w = 0;
cursor_pixmap_h = 0;
#ifdef USE_PAINTER
// We need this GC
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)
{
XCopyArea(fl_display,
@ -108,21 +96,8 @@ void LyXScreen::expose(int x, int y, int exp_width, int exp_height)
exp_width, exp_height,
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)
{
long y_text = first + y1;
@ -148,36 +123,6 @@ void LyXScreen::DrawFromTo(int y1, int y2)
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)
@ -186,11 +131,7 @@ void LyXScreen::DrawOneRow(Row * row, long & y_text)
if (y + row->height > 0 && y - row->height <= _height) {
/* ok there is something visible */
#ifdef USE_PAINTER
text->GetVisibleRow(y, row, y + first);
#else
text->GetVisibleRow(*this, y, row, y + first);
#endif
}
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
* printed pixels as possible */
#ifdef USE_PAINTER
void LyXScreen::Draw(long y)
{
if (cursor_visible) HideCursor();
@ -240,49 +180,6 @@ void LyXScreen::Draw(long y)
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()
@ -304,72 +201,38 @@ void LyXScreen::ShowCursor()
// Secure against very strange situations
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){
XFreePixmap(fl_display, cursor_pixmap);
cursor_pixmap = 0;
}
if (y2 > 0 && y1 < _height) {
cursor_pixmap_w = 1;
cursor_pixmap_h = y2 - y1 + 1;
cursor_pixmap_x = x;
cursor_pixmap_y = y1;
cursor_pixmap =
XCreatePixmap(fl_display,
fl_root,
cursor_pixmap_w,
cursor_pixmap_h,
fl_get_visual_depth());
#ifdef USE_PAINTER
XCopyArea(fl_display,
_window,
cursor_pixmap,
gc_copy,
_offset_x + cursor_pixmap_x,
_offset_y + cursor_pixmap_y,
cursor_pixmap_w, cursor_pixmap_h,
0, 0);
XDrawLine(fl_display,
_window, gc_copy,
x + _offset_x,
y1 + _offset_y,
x + _offset_x,
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;
}
#ifndef USE_PAINTER
if (cursor_pixmap){
XFreePixmap(fl_display, cursor_pixmap);
cursor_pixmap = 0;
}
if (y2 > 0 && y1 < _height) {
cursor_pixmap_w = 1;
cursor_pixmap_h = y2 - y1 + 1;
cursor_pixmap_x = x;
cursor_pixmap_y = y1;
cursor_pixmap =
XCreatePixmap(fl_display,
fl_root,
cursor_pixmap_w,
cursor_pixmap_h,
fl_get_visual_depth());
XCopyArea(fl_display,
_window,
cursor_pixmap,
gc_copy,
_offset_x + cursor_pixmap_x,
_offset_y + cursor_pixmap_y,
cursor_pixmap_w, cursor_pixmap_h,
0, 0);
XDrawLine(fl_display,
_window, gc_copy,
x + _offset_x,
y1 + _offset_y,
x + _offset_x,
y2 + _offset_y);
cursor_visible = true;
}
#endif
}
@ -396,14 +259,9 @@ 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,73 +277,39 @@ void LyXScreen::ShowManualCursor(long x, long y, int asc, int desc)
if (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){
XFreePixmap(fl_display, cursor_pixmap);
cursor_pixmap = 0;
}
if (y2 > 0 && y1 < _height) {
cursor_pixmap_w = 1;
cursor_pixmap_h = y2 - y1 + 1;
cursor_pixmap_x = x,
cursor_pixmap_y = y1;
cursor_pixmap =
XCreatePixmap (fl_display,
fl_root,
cursor_pixmap_w,
cursor_pixmap_h,
fl_get_visual_depth());
#ifdef USE_PAINTER
XCopyArea (fl_display,
_window,
cursor_pixmap,
gc_copy,
_offset_x + cursor_pixmap_x,
_offset_y + cursor_pixmap_y,
cursor_pixmap_w,
cursor_pixmap_h,
0, 0);
XDrawLine(fl_display,
_window, gc_copy,
x+_offset_x,
y1+_offset_y,
x+_offset_x,
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;
#ifndef USE_PAINTER
if (cursor_pixmap){
XFreePixmap(fl_display, cursor_pixmap);
cursor_pixmap = 0;
}
#endif
if (y2 > 0 && y1 < _height) {
cursor_pixmap_w = 1;
cursor_pixmap_h = y2 - y1 + 1;
cursor_pixmap_x = x,
cursor_pixmap_y = y1;
cursor_pixmap =
XCreatePixmap (fl_display,
fl_root,
cursor_pixmap_w,
cursor_pixmap_h,
fl_get_visual_depth());
XCopyArea (fl_display,
_window,
cursor_pixmap,
gc_copy,
_offset_x + cursor_pixmap_x,
_offset_y + cursor_pixmap_y,
cursor_pixmap_w,
cursor_pixmap_h,
0, 0);
XDrawLine(fl_display,
_window, gc_copy,
x+_offset_x,
y1+_offset_y,
x+_offset_x,
y2+_offset_y);
}
cursor_visible = true;
}
@ -493,38 +317,17 @@ void LyXScreen::HideCursor()
{
if (!cursor_visible) return;
#ifndef USE_PAINTER
if (fast_selection || mono_video) {
cursor_visible = false;
ShowCursor();
cursor_visible = false;
} else {
#endif
if (cursor_pixmap){
#ifdef USE_PAINTER
XCopyArea (fl_display,
cursor_pixmap,
_window,
gc_copy,
0, 0,
cursor_pixmap_w, cursor_pixmap_h,
cursor_pixmap_x + _offset_x,
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;
#ifndef USE_PAINTER
if (cursor_pixmap){
XCopyArea (fl_display,
cursor_pixmap,
_window,
gc_copy,
0, 0,
cursor_pixmap_w, cursor_pixmap_h,
cursor_pixmap_x + _offset_x,
cursor_pixmap_y + _offset_y);
}
#endif
cursor_visible = false;
}
@ -661,366 +464,51 @@ void LyXScreen::ToggleSelection(bool kill_selection)
if (!text->selection)
return;
long top = 0;
long bottom = 0;
long top = text->sel_start_cursor.y
- text->sel_start_cursor.row->baseline;
long bottom = text->sel_end_cursor.y
- text->sel_end_cursor.row->baseline
+ text->sel_end_cursor.row->height;
#ifndef USE_PAINTER
if (fast_selection || mono_video) {
if (top - first < 0)
top = first;
if (bottom - first < 0)
bottom = first;
/* selection only in one row ?*/
if (text->sel_start_cursor.y == text->sel_end_cursor.y) {
if (bottom - first > _height)
bottom = first + _height;
if (top - first > _height)
top = first + _height;
/* 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;
bottom = text->sel_end_cursor.y
- text->sel_end_cursor.row->baseline
+ text->sel_end_cursor.row->height;
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 (kill_selection)
text->selection = 0;
DrawFromTo(top - first, bottom - first);
expose(0, top - first, _width, bottom - first - (top - first));
#ifndef USE_PAINTER
}
#endif
if (kill_selection)
text->selection = 0;
DrawFromTo(top - first, bottom - first);
expose(0, top - first, _width, bottom - first - (top - first));
}
void LyXScreen::ToggleToggle()
{
long top = 0;
long bottom = 0;
if (text->toggle_cursor.par == text->toggle_end_cursor.par
&& text->toggle_cursor.pos == text->toggle_end_cursor.pos)
return;
#ifndef USE_PAINTER
if (fast_selection || mono_video) {
long top = text->toggle_cursor.y
- text->toggle_cursor.row->baseline;
long bottom = text->toggle_end_cursor.y
- text->toggle_end_cursor.row->baseline
+ text->toggle_end_cursor.row->height;
/* selection only in one row ?*/
if (text->toggle_cursor.y == text->toggle_end_cursor.y) {
if (top - first < 0)
top = first;
if (bottom - first < 0)
bottom = 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,
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);
}
if (bottom - first > _height)
bottom = first + _height;
if (top - first > _height)
top = first + _height;
/* 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;
bottom = text->toggle_end_cursor.y
- text->toggle_end_cursor.row->baseline
+ text->toggle_end_cursor.row->height;
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;
DrawFromTo(top - first, bottom - first);
expose(0, top - first, _width, bottom - first - (top - first));
#ifndef USE_PAINTER
}
#endif
DrawFromTo(top - first, bottom - first);
expose(0, top - first, _width, bottom - first - (top - first));
}
#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

View File

@ -526,7 +526,7 @@ void ShowSpellChecker()
int ret;
// Exit if we don't have a document open
if (!current_view->getScreen())
if (!current_view->available())
return;
if (fd_form_spell_check == 0) {

1506
src/text.C

File diff suppressed because it is too large Load Diff

View File

@ -1068,7 +1068,7 @@ Row * LyXText::GetRowNearY(long & y) const
void LyXText::ToggleFree(LyXFont const & font, bool toggleall)
{
// 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
current_view->owner()->getMiniBuffer()
->Set(_("No font change defined. Use Character under"