mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 21:21:32 +00:00
have a real runTime method for all frontends
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@975 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
5da9e207fa
commit
0ed115d608
19
ChangeLog
19
ChangeLog
@ -1,3 +1,22 @@
|
||||
2000-08-17 Lars Gullik Bjønnes <larsbj@lyx.org>
|
||||
|
||||
* src/frontends/xforms/GUIRunTime_pimpl.C: constructor and
|
||||
destructor. Don't definde if you don't need it
|
||||
(processEvents): made static, non-blocking events processing for
|
||||
xforms.
|
||||
(runTime): static method. event loop for xforms
|
||||
* similar as above for kde and gnome.
|
||||
|
||||
* src/frontends/GUIRunTime.C (GUIRunTime): new Pimpl() is wrong
|
||||
new Pimpl is correct
|
||||
(runTime): new method calss the real frontends runtime func.
|
||||
|
||||
* src/lyx_gui.C (runTime): change to use the GUIRunTime::runTime
|
||||
|
||||
2000-08-16 Lars Gullik Bjønnes <larsbj@lyx.org>
|
||||
|
||||
* src/lyx_gui.C (create_forms): fix the "No change" gettext missing
|
||||
|
||||
2000-08-16 Juergen Vigna <jug@sad.it>
|
||||
|
||||
* src/lyx_gui.C (runTime): added GUII RunTime support.
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
GUIRunTime::GUIRunTime()
|
||||
{
|
||||
pimpl_ = new Pimpl();
|
||||
pimpl_ = new Pimpl;
|
||||
}
|
||||
|
||||
|
||||
@ -35,3 +35,9 @@ void GUIRunTime::processEvents()
|
||||
{
|
||||
pimpl_->processEvents();
|
||||
}
|
||||
|
||||
|
||||
void GUIRunTime::runTime()
|
||||
{
|
||||
pimpl_->runTime();
|
||||
}
|
||||
|
@ -30,11 +30,14 @@ public:
|
||||
~GUIRunTime();
|
||||
///
|
||||
void processEvents();
|
||||
///
|
||||
void runTime();
|
||||
|
||||
struct Pimpl;
|
||||
friend struct Pimpl;
|
||||
|
||||
private:
|
||||
///
|
||||
Pimpl * pimpl_;
|
||||
};
|
||||
#endif
|
||||
|
@ -20,16 +20,23 @@
|
||||
|
||||
using std::endl;
|
||||
|
||||
GUIRunTime::Pimpl::Pimpl()
|
||||
{
|
||||
}
|
||||
|
||||
GUIRunTime::Pimpl::~Pimpl()
|
||||
{
|
||||
}
|
||||
extern bool finised;
|
||||
|
||||
void GUIRunTime::Pimpl::processEvents()
|
||||
{
|
||||
while(Gnome::Main::instance()->events_pending())
|
||||
Gnome::Main::instance()->iteration(FALSE);
|
||||
}
|
||||
|
||||
|
||||
void GUIRunTime::Pimpl::runTime()
|
||||
{
|
||||
XEvent ev;
|
||||
while (!finished) {
|
||||
Pimpl::processEvents();
|
||||
if (fl_check_forms() == FL_EVENT) {
|
||||
lyxerr << "LyX: This shouldn't happen..." << endl;
|
||||
fl_XNextEvent(&ev);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -25,12 +25,8 @@
|
||||
struct GUIRunTime::Pimpl {
|
||||
public:
|
||||
///
|
||||
Pimpl();
|
||||
static void processEvents();
|
||||
///
|
||||
~Pimpl();
|
||||
///
|
||||
void processEvents();
|
||||
|
||||
private:
|
||||
static void runTime();
|
||||
};
|
||||
#endif
|
||||
|
@ -20,15 +20,25 @@
|
||||
|
||||
using std::endl;
|
||||
|
||||
GUIRunTime::Pimpl::Pimpl()
|
||||
{
|
||||
}
|
||||
extern bool finished;
|
||||
|
||||
GUIRunTime::Pimpl::~Pimpl()
|
||||
{
|
||||
}
|
||||
|
||||
void GUIRunTime::Pimpl::processEvents()
|
||||
{
|
||||
kapp->processEvents();
|
||||
}
|
||||
|
||||
|
||||
void GUIRunTime::Pimpl::runTime()
|
||||
{
|
||||
// We still use xforms event handler as te main one...
|
||||
XEvent ev;
|
||||
while (!finished) {
|
||||
Pimpl::processEvents();
|
||||
if (fl_check_forms() == FL_EVENT) {
|
||||
lyxerr << "LyX: This shouldn't happen..." << endl;
|
||||
fl_XNextEvent(&ev);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -19,18 +19,14 @@
|
||||
|
||||
#include "frontends/GUIRunTime.h"
|
||||
|
||||
/*
|
||||
* The GUI interface for runtime GUI stuff.
|
||||
*/
|
||||
/**
|
||||
The GUI interface for runtime GUI stuff.
|
||||
*/
|
||||
struct GUIRunTime::Pimpl {
|
||||
public:
|
||||
///
|
||||
Pimpl();
|
||||
static void processEvents();
|
||||
///
|
||||
~Pimpl();
|
||||
///
|
||||
void processEvents();
|
||||
|
||||
private:
|
||||
static void runTime();
|
||||
};
|
||||
#endif
|
||||
|
@ -19,25 +19,30 @@
|
||||
#include "GUIRunTime_pimpl.h"
|
||||
#include "debug.h"
|
||||
|
||||
GUIRunTime::Pimpl::Pimpl()
|
||||
{
|
||||
}
|
||||
using std::endl;
|
||||
|
||||
extern bool finished;
|
||||
|
||||
GUIRunTime::Pimpl::~Pimpl()
|
||||
{
|
||||
}
|
||||
|
||||
void GUIRunTime::Pimpl::processEvents()
|
||||
{
|
||||
// this is disabled for now as we still need this ALWAYS in lyx_gui
|
||||
// and if we enable this here we would do it 2 times well why not it
|
||||
// doesn't really matter, does it? (Jug)
|
||||
#if 1
|
||||
XEvent ev;
|
||||
|
||||
if (fl_check_forms() == FL_EVENT) {
|
||||
if (fl_do_forms() == FL_EVENT) {
|
||||
lyxerr << "LyX: This shouldn't happen..." << endl;
|
||||
fl_XNextEvent(&ev);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void GUIRunTime::Pimpl::runTime()
|
||||
{
|
||||
XEvent ev;
|
||||
while (!finished) {
|
||||
if (fl_check_forms() == FL_EVENT) {
|
||||
lyxerr << "LyX: This shouldn't appen..." << endl;
|
||||
fl_XNextEvent(&ev);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -19,18 +19,14 @@
|
||||
|
||||
#include "frontends/GUIRunTime.h"
|
||||
|
||||
/*
|
||||
* The GUI interface for runtime GUI stuff.
|
||||
*/
|
||||
/**
|
||||
The GUI interface for runtime GUI stuff.
|
||||
*/
|
||||
struct GUIRunTime::Pimpl {
|
||||
public:
|
||||
///
|
||||
Pimpl();
|
||||
static void processEvents();
|
||||
///
|
||||
~Pimpl();
|
||||
///
|
||||
void processEvents();
|
||||
|
||||
private:
|
||||
static void runTime();
|
||||
};
|
||||
#endif
|
||||
|
@ -83,7 +83,8 @@ FL_resource res[] =
|
||||
};
|
||||
|
||||
|
||||
extern "C" int LyX_XErrHandler(Display * display, XErrorEvent * xeev)
|
||||
extern "C"
|
||||
int LyX_XErrHandler(Display * display, XErrorEvent * xeev)
|
||||
{
|
||||
//#warning Please see if you can trigger this!
|
||||
// emergency save
|
||||
@ -402,7 +403,7 @@ void LyXGUI::create_forms()
|
||||
combo_language->addto((*cit).second.lang().c_str());
|
||||
combo_language2->addto((*cit).second.lang().c_str());
|
||||
}
|
||||
combo_language2->select_text("No change");
|
||||
combo_language2->select_text(_("No change"));
|
||||
|
||||
// not really necessary, but we can do it anyway.
|
||||
fl_addto_choice(fd_form_document->choice_fontsize, "default|10|11|12");
|
||||
@ -526,7 +527,7 @@ void LyXGUI::create_forms()
|
||||
int main_placement = FL_PLACE_CENTER | FL_FREE_SIZE;
|
||||
int title_placement = FL_PLACE_CENTER;
|
||||
// Did we get a valid position?
|
||||
if (xpos>= 0 && ypos>= 0) {
|
||||
if (xpos >= 0 && ypos >= 0) {
|
||||
lyxViews->setPosition(xpos, ypos);
|
||||
if (lyxrc.show_banner) {
|
||||
// show the title form in the middle of the main form
|
||||
@ -554,26 +555,11 @@ void LyXGUI::create_forms()
|
||||
|
||||
|
||||
void LyXGUI::runTime()
|
||||
/* This will usually be toolkit (GUI) specific. This is
|
||||
* also usually the XEvent dispatcher of the GUI. */
|
||||
{
|
||||
if (!gui)
|
||||
return;
|
||||
if (!gui) return;
|
||||
|
||||
GUIRunTime grt;
|
||||
|
||||
// XForms specific
|
||||
XEvent ev;
|
||||
|
||||
while (!finished) {
|
||||
grt.processEvents();
|
||||
// for now we have to leave this here then if the GUII is
|
||||
// completed this obviously has to be removed! (Jug)
|
||||
if (fl_check_forms() == FL_EVENT) {
|
||||
lyxerr << "LyX: This shouldn't happen..." << endl;
|
||||
fl_XNextEvent(&ev);
|
||||
}
|
||||
}
|
||||
grt.runTime();
|
||||
}
|
||||
|
||||
|
||||
@ -582,6 +568,7 @@ void LyXGUI::regBuf(Buffer * b)
|
||||
lyxViews->view()->buffer(b);
|
||||
}
|
||||
|
||||
|
||||
LyXView * LyXGUI::getLyXView() const
|
||||
{
|
||||
return lyxViews;
|
||||
|
43
src/text.C
43
src/text.C
@ -3899,9 +3899,10 @@ void LyXText::GetVisibleRow(BufferView * bview, int y_offset, int x_offset,
|
||||
LyXParagraph::size_type last = RowLastPrintable(row_ptr);
|
||||
|
||||
LyXParagraph::size_type vpos, pos;
|
||||
float x, tmpx;
|
||||
int y_top, y_bottom;
|
||||
float fill_separator, fill_hfill, fill_label_hfill;
|
||||
float x;
|
||||
float tmpx;
|
||||
int y_top;
|
||||
int y_bottom;
|
||||
|
||||
LyXFont font(LyXFont::ALL_SANE);
|
||||
int maxdesc;
|
||||
@ -3910,6 +3911,10 @@ void LyXText::GetVisibleRow(BufferView * bview, int y_offset, int x_offset,
|
||||
<< row_ptr->height() << endl;
|
||||
return;
|
||||
}
|
||||
|
||||
float fill_separator;
|
||||
float fill_hfill;
|
||||
float fill_label_hfill;
|
||||
PrepareToPrint(bview, row_ptr, x, fill_separator,
|
||||
fill_hfill, fill_label_hfill);
|
||||
|
||||
@ -3918,44 +3923,32 @@ void LyXText::GetVisibleRow(BufferView * bview, int y_offset, int x_offset,
|
||||
x += x_offset;
|
||||
|
||||
// clear the area where we want to paint/print
|
||||
int ww;
|
||||
ww = bview->workWidth();
|
||||
int ww = bview->workWidth();
|
||||
|
||||
bool clear_area = true;
|
||||
Inset * inset = 0;
|
||||
|
||||
if ((last == row_ptr->pos()) &&
|
||||
(row_ptr->par()->GetChar(row_ptr->pos()) == LyXParagraph::META_INSET) &&
|
||||
(inset=row_ptr->par()->GetInset(row_ptr->pos())))
|
||||
{
|
||||
(inset = row_ptr->par()->GetInset(row_ptr->pos()))) {
|
||||
clear_area = inset->doClearArea();
|
||||
}
|
||||
if (cleared) { // we don't need to clear it's already done!!!
|
||||
clear_area = true;
|
||||
} else if (clear_area) {
|
||||
int w;
|
||||
if (inset_owner)
|
||||
w = inset_owner->width(bview, font);
|
||||
else
|
||||
w = ww;
|
||||
int w = (inset_owner ? inset_owner->width(bview, font) : ww);
|
||||
pain.fillRectangle(x_offset, y_offset, w, row_ptr->height());
|
||||
} else if (inset != 0) {
|
||||
int h = row_ptr->baseline() - inset->ascent(bview, font);
|
||||
if (h > 0) {
|
||||
int w;
|
||||
if (inset_owner)
|
||||
w = inset_owner->width(bview, font);
|
||||
else
|
||||
w = ww;
|
||||
int w = (inset_owner ?
|
||||
inset_owner->width(bview, font) : ww);
|
||||
pain.fillRectangle(x_offset, y_offset, w, h);
|
||||
}
|
||||
h += inset->ascent(bview, font) + inset->descent(bview, font);
|
||||
if ((row_ptr->height() - h) > 0) {
|
||||
int w;
|
||||
if (inset_owner)
|
||||
w = inset_owner->width(bview, font);
|
||||
else
|
||||
w = ww;
|
||||
int w = (inset_owner ?
|
||||
inset_owner->width(bview, font) : ww);
|
||||
pain.fillRectangle(x_offset,y_offset+h, w, row_ptr->height()-h);
|
||||
}
|
||||
if (!inset_owner && !inset->display() && !inset->needFullRow())
|
||||
@ -3966,11 +3959,7 @@ void LyXText::GetVisibleRow(BufferView * bview, int y_offset, int x_offset,
|
||||
}
|
||||
|
||||
if (selection) {
|
||||
int w;
|
||||
if (inset_owner)
|
||||
w = inset_owner->width(bview, font);
|
||||
else
|
||||
w = ww;
|
||||
int w = (inset_owner ? inset_owner->width(bview, font) : ww);
|
||||
/* selection code */
|
||||
if (bidi_same_direction) {
|
||||
if (sel_start_cursor.row() == row_ptr &&
|
||||
|
Loading…
Reference in New Issue
Block a user