different low-level key handling for xforms 0.89, use signals in workarea, changes to allow docxx to compile

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@969 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2000-08-14 15:31:16 +00:00
parent d6e574e17b
commit 9062ce972e
35 changed files with 551 additions and 308 deletions

View File

@ -1,3 +1,26 @@
2000-08-14 Lars Gullik Bjønnes <larsbj@lyx.org>
* src/Timeout.h: remove Qt::emit hack.
* several files: changes to allo doc++ compilation
* src/lyxfunc.C (processKeySym): new method
(processKeyEvent): comment out if FL_REVISION < 89
* src/WorkArea.C: change some debugging levels.
(WorkArea): set wantkey to FL_KEY_ALL
(work_area_handler): enable the FL_KEYBOARD clause, this enables
clearer code and the use of compose with XForms 0.89. Change to
use signals instead of calling methods in bufferview directly.
* src/Painter.C: change some debugging levels.
* src/LyXView.C: don't setup of use the KeyPressMask_raw_callback
if FL_REVISION < 89
* src/BufferView_pimpl.C (Pimpl): Connect to the WorkArea signals.
(workAreaKeyPress): new method
2000-08-14 Juergen Vigna <jug@sad.it> 2000-08-14 Juergen Vigna <jug@sad.it>
* src/frontends/kde/Dialogs.C (Dialogs): added missing dialogs. * src/frontends/kde/Dialogs.C (Dialogs): added missing dialogs.
@ -55,8 +78,9 @@
Gnome implementation Gnome implementation
* src/frontends/gnome/Dialogs.C * src/frontends/gnome/Dialogs.C
* src/frontends/gnome/Makefile.am: added Print, Insert Url and all other * src/frontends/gnome/Makefile.am: added Print, Insert Url and
dialogs. Copy all unimplemented dialogs from Xforms frontend all other dialogs. Copy all unimplemented dialogs from Xforms
frontend
* src/frontends/gnome/support.c * src/frontends/gnome/support.c
* src/frontends/gnome/support.h: support files generated by Glade * src/frontends/gnome/support.h: support files generated by Glade
@ -68,9 +92,9 @@
* config/lyxinclude.m4: cleanup: frontend renamed from gtk to gnome in * config/lyxinclude.m4: cleanup: frontend renamed from gtk to gnome in
configure --help message configure --help message
* src/lyx_gui.C: Gnome/Gtk releases control in LyXGUI::runTime() only if * src/lyx_gui.C: Gnome/Gtk releases control in LyXGUI::runTime()
there are no events pendling in Gnome/Gtk. This enhances the performance of only if there are no events pendling in Gnome/Gtk. This enhances
menus. the performance of menus.
2000-08-14 Allan Rae <rae@lyx.org> 2000-08-14 Allan Rae <rae@lyx.org>
@ -120,9 +144,10 @@
* src/lyx_gui.C: ditto * src/lyx_gui.C: ditto
* src/menus.[Ch]: ditto * src/menus.[Ch]: ditto
* src/lyx.[Ch]: ditto * src/lyx.[Ch]: ditto
* src/lyx_cb.C: ditto + code from here moved to make screen-font-update. * src/lyx_cb.C: ditto + code from here moved to make
And people wonder why progress on GUII is slow. Look at how scattered screen-font-update. And people wonder why progress on GUII is
this stuff was! It takes forever just find it all. slow. Look at how scattered this stuff was! It takes forever
just find it all.
* forms/fdfix.sh: Fixup the spacing after commas. * forms/fdfix.sh: Fixup the spacing after commas.
* forms/makefile: Remove date from generated files. Fewer clashes now. * forms/makefile: Remove date from generated files. Fewer clashes now.

View File

@ -44,17 +44,6 @@ src/frontends/xforms/FormPrint.C
src/frontends/xforms/form_print.C src/frontends/xforms/form_print.C
src/frontends/xforms/FormRef.C src/frontends/xforms/FormRef.C
src/frontends/xforms/form_ref.C src/frontends/xforms/form_ref.C
src/frontends/xforms/forms/form_citation.C
src/frontends/xforms/forms/form_copyright.C
src/frontends/xforms/forms/form_document.C
src/frontends/xforms/forms/form_graphics.C
src/frontends/xforms/forms/form_index.C
src/frontends/xforms/forms/form_preferences.C
src/frontends/xforms/forms/form_print.C
src/frontends/xforms/forms/form_ref.C
src/frontends/xforms/forms/form_tabular.C
src/frontends/xforms/forms/form_toc.C
src/frontends/xforms/forms/form_url.C
src/frontends/xforms/FormTabular.C src/frontends/xforms/FormTabular.C
src/frontends/xforms/form_tabular.C src/frontends/xforms/form_tabular.C
src/frontends/xforms/FormToc.C src/frontends/xforms/FormToc.C

View File

@ -79,6 +79,27 @@ BufferView::Pimpl::Pimpl(BufferView * b, LyXView * o,
{ {
buffer_ = 0; buffer_ = 0;
workarea_ = new WorkArea(bv_, xpos, ypos, width, height); workarea_ = new WorkArea(bv_, xpos, ypos, width, height);
// Setup the signals
workarea_->workAreaExpose
.connect(slot(this, &BufferView::Pimpl::workAreaExpose));
workarea_->workAreaEnter
.connect(slot(this, &BufferView::Pimpl::enterView));
workarea_->workAreaLeave
.connect(slot(this, &BufferView::Pimpl::leaveView));
workarea_->workAreaButtonPress
.connect(slot(this, &BufferView::Pimpl::workAreaButtonPress));
workarea_->workAreaButtonRelease
.connect(slot(this,
&BufferView::Pimpl::workAreaButtonRelease));
workarea_->workAreaMotionNotify
.connect(slot(this, &BufferView::Pimpl::workAreaMotionNotify));
workarea_->workAreaDoubleClick
.connect(slot(this, &BufferView::Pimpl::doubleClick));
workarea_->workAreaTripleClick
.connect(slot(this, &BufferView::Pimpl::tripleClick));
workarea_->workAreaKeyPress
.connect(slot(this, &BufferView::Pimpl::workAreaKeyPress));
screen_ = 0; screen_ = 0;
cursor_timeout.timeout.connect(slot(this, cursor_timeout.timeout.connect(slot(this,
@ -493,6 +514,12 @@ int BufferView::Pimpl::scrollDown(long time)
} }
void BufferView::Pimpl::workAreaKeyPress(KeySym keysym, unsigned int state)
{
bv_->owner()->getLyXFunc()->processKeySym(keysym, state);
}
void BufferView::Pimpl::workAreaMotionNotify(int x, int y, unsigned int state) void BufferView::Pimpl::workAreaMotionNotify(int x, int y, unsigned int state)
{ {
// Only use motion with button 1 // Only use motion with button 1

View File

@ -63,6 +63,8 @@ struct BufferView::Pimpl : public Object {
/// ///
int scrollDown(long time); int scrollDown(long time);
/// ///
void workAreaKeyPress(KeySym, unsigned int state);
///
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);

View File

@ -319,8 +319,11 @@ void LyXView::create_form_form_main(int width, int height)
} }
#if FL_REVISION < 89
extern "C" extern "C"
int C_LyXView_KeyPressMask_raw_callback(FL_FORM * fl, void * xev); int C_LyXView_KeyPressMask_raw_callback(FL_FORM * fl, void * xev);
#endif
void LyXView::init() void LyXView::init()
{ {
@ -337,11 +340,13 @@ void LyXView::init()
autosave_timeout.setTimeout(lyxrc.autosave * 1000); autosave_timeout.setTimeout(lyxrc.autosave * 1000);
autosave_timeout.start(); autosave_timeout.start();
} }
#if FL_REVISION < 89
// Install the raw callback for keyboard events // Install the raw callback for keyboard events
fl_register_raw_callback(form_, fl_register_raw_callback(form_,
KeyPressMask, KeyPressMask,
C_LyXView_KeyPressMask_raw_callback); C_LyXView_KeyPressMask_raw_callback);
#endif
intl->InitKeyMapper(lyxrc.use_kbmap); intl->InitKeyMapper(lyxrc.use_kbmap);
} }
@ -395,6 +400,7 @@ void LyXView::UpdateDocumentClassChoice()
} }
#if FL_REVISION < 89
// This is necessary, since FL_FREE-Objects doesn't get all keypress events // This is necessary, since FL_FREE-Objects doesn't get all keypress events
// as FL_KEYBOARD events :-( Matthias 280596 // as FL_KEYBOARD events :-( Matthias 280596
int LyXView::KeyPressMask_raw_callback(FL_FORM * fl, void * xev) int LyXView::KeyPressMask_raw_callback(FL_FORM * fl, void * xev)
@ -439,7 +445,7 @@ int LyXView::KeyPressMask_raw_callback(FL_FORM * fl, void * xev)
// last_time_pressed is 0, that sinifies an autoreapeat // last_time_pressed is 0, that sinifies an autoreapeat
// at least on my system. It like some feedback from // at least on my system. It like some feedback from
// others, especially from user running LyX remote. // others, especially from user running LyX remote.
//lyxerr << "Syncing - purging X events." << endl; lyxerr[Debug::KEY] << "Syncing - purging X events." << endl;
XSync(fl_get_display(), 1); XSync(fl_get_display(), 1);
// This purge make f.ex. scrolling stop imidiatly when // This purge make f.ex. scrolling stop imidiatly when
// releaseing the PageDown button. The question is if this // releaseing the PageDown button. The question is if this
@ -456,6 +462,7 @@ int C_LyXView_KeyPressMask_raw_callback(FL_FORM * fl, void * xev)
{ {
return LyXView::KeyPressMask_raw_callback(fl, xev); return LyXView::KeyPressMask_raw_callback(fl, xev);
} }
#endif
// Updates the title of the window with the filename of the current document // Updates the title of the window with the filename of the current document

View File

@ -148,8 +148,10 @@ private:
/// ///
void UpdateDocumentClassChoice(); void UpdateDocumentClassChoice();
public: public:
#if FL_REVISION < 89
/// ///
static int KeyPressMask_raw_callback(FL_FORM *, void * xev); static int KeyPressMask_raw_callback(FL_FORM *, void * xev);
#endif
/** This callback is run when a close event is sent from the /** This callback is run when a close event is sent from the
window manager. */ window manager. */
static int atCloseMainFormCB(FL_FORM *, void *); static int atCloseMainFormCB(FL_FORM *, void *);

View File

@ -49,7 +49,7 @@ extern bool Lgb_bug_find_hack;
PainterBase & Painter::point(int x, int y, LColor::color c) PainterBase & Painter::point(int x, int y, LColor::color c)
{ {
if (lyxerr.debugging()) { if (lyxerr.debugging(Debug::GUI)) {
if (!Lgb_bug_find_hack) if (!Lgb_bug_find_hack)
lyxerr << "point not called from " lyxerr << "point not called from "
"workarea::workhandler\n"; "workarea::workhandler\n";
@ -68,7 +68,7 @@ PainterBase & Painter::line(int x1, int y1, int x2, int y2,
enum line_style ls, enum line_style ls,
enum line_width lw) enum line_width lw)
{ {
if (lyxerr.debugging()) { if (lyxerr.debugging(Debug::GUI)) {
if (!Lgb_bug_find_hack) if (!Lgb_bug_find_hack)
lyxerr << "line not called from " lyxerr << "line not called from "
"workarea::workhandler\n"; "workarea::workhandler\n";
@ -88,7 +88,7 @@ PainterBase & Painter::lines(int const * xp, int const * yp, int np,
enum line_style ls, enum line_style ls,
enum line_width lw) enum line_width lw)
{ {
if (lyxerr.debugging()) { if (lyxerr.debugging(Debug::GUI)) {
if (!Lgb_bug_find_hack) if (!Lgb_bug_find_hack)
lyxerr << "lines not called from " lyxerr << "lines not called from "
"workarea::workhandler\n"; "workarea::workhandler\n";
@ -122,7 +122,7 @@ PainterBase & Painter::rectangle(int x, int y, int w, int h,
enum line_style ls, enum line_style ls,
enum line_width lw) enum line_width lw)
{ {
if (lyxerr.debugging()) { if (lyxerr.debugging(Debug::GUI)) {
if (!Lgb_bug_find_hack) if (!Lgb_bug_find_hack)
lyxerr << "rectangle not called from " lyxerr << "rectangle not called from "
"workarea::workhandler\n"; "workarea::workhandler\n";
@ -140,7 +140,7 @@ PainterBase & Painter::rectangle(int x, int y, int w, int h,
PainterBase & Painter::fillRectangle(int x, int y, int w, int h, PainterBase & Painter::fillRectangle(int x, int y, int w, int h,
LColor::color col) LColor::color col)
{ {
if (lyxerr.debugging()) { if (lyxerr.debugging(Debug::GUI)) {
if (!Lgb_bug_find_hack) if (!Lgb_bug_find_hack)
lyxerr << "fillrectangle not called from " lyxerr << "fillrectangle not called from "
"workarea::workhandler\n"; "workarea::workhandler\n";
@ -157,7 +157,7 @@ PainterBase & Painter::fillRectangle(int x, int y, int w, int h,
PainterBase & Painter::fillPolygon(int const * xp, int const * yp, int np, PainterBase & Painter::fillPolygon(int const * xp, int const * yp, int np,
LColor::color col) LColor::color col)
{ {
if (lyxerr.debugging()) { if (lyxerr.debugging(Debug::GUI)) {
if (!Lgb_bug_find_hack) if (!Lgb_bug_find_hack)
lyxerr <<"fillpolygon not called from " lyxerr <<"fillpolygon not called from "
"workarea::workhandler\n"; "workarea::workhandler\n";
@ -188,7 +188,7 @@ PainterBase & Painter::arc(int x, int y,
unsigned int w, unsigned int h, unsigned int w, unsigned int h,
int a1, int a2, LColor::color col) int a1, int a2, LColor::color col)
{ {
if (lyxerr.debugging()) { if (lyxerr.debugging(Debug::GUI)) {
if (!Lgb_bug_find_hack) if (!Lgb_bug_find_hack)
lyxerr << "arc not called from " lyxerr << "arc not called from "
"workarea::workhandler\n"; "workarea::workhandler\n";
@ -208,7 +208,7 @@ PainterBase & Painter::segments(int const * x1, int const * y1,
LColor::color col, LColor::color col,
enum line_style ls, enum line_width lw) enum line_style ls, enum line_width lw)
{ {
if (lyxerr.debugging()) { if (lyxerr.debugging(Debug::GUI)) {
if (!Lgb_bug_find_hack) if (!Lgb_bug_find_hack)
lyxerr << "segments not called from " lyxerr << "segments not called from "
"workarea::workhandler\n"; "workarea::workhandler\n";
@ -238,7 +238,7 @@ PainterBase & Painter::segments(int const * x1, int const * y1,
PainterBase & Painter::pixmap(int x, int y, int w, int h, Pixmap bitmap) PainterBase & Painter::pixmap(int x, int y, int w, int h, Pixmap bitmap)
{ {
if (lyxerr.debugging()) { if (lyxerr.debugging(Debug::GUI)) {
if (!Lgb_bug_find_hack) if (!Lgb_bug_find_hack)
lyxerr << "workAreaExpose not called from " lyxerr << "workAreaExpose not called from "
"workarea::workhandler\n"; "workarea::workhandler\n";
@ -295,7 +295,7 @@ PainterBase & Painter::text(int x, int y, char const * s, int ls,
return *this; return *this;
} }
if (lyxerr.debugging()) { if (lyxerr.debugging(Debug::GUI)) {
if (!Lgb_bug_find_hack) if (!Lgb_bug_find_hack)
lyxerr << "text not called from " lyxerr << "text not called from "
"workarea::workhandler\n"; "workarea::workhandler\n";
@ -318,13 +318,11 @@ PainterBase & Painter::text(int x, int y, char const * s, int ls,
XDrawString(display, owner.getPixmap(), XDrawString(display, owner.getPixmap(),
gc, tmpx, y, &c, 1); gc, tmpx, y, &c, 1);
tmpx += lyxfont::XTextWidth(smallfont, &c, 1); tmpx += lyxfont::XTextWidth(smallfont, &c, 1);
//tmpx += lyxfont::width(c, f);
} else { } else {
lyxfont::XSetFont(display, gc, f); lyxfont::XSetFont(display, gc, f);
XDrawString(display, owner.getPixmap(), XDrawString(display, owner.getPixmap(),
gc, tmpx, y, &c, 1); gc, tmpx, y, &c, 1);
tmpx += lyxfont::XTextWidth(f, &c, 1); tmpx += lyxfont::XTextWidth(f, &c, 1);
//tmpx += lyxfont::width(c, f);
} }
} }
} }
@ -337,7 +335,7 @@ PainterBase & Painter::text(int x, int y, char const * s, int ls,
PainterBase & Painter::text(int x, int y, XChar2b const * s, int ls, PainterBase & Painter::text(int x, int y, XChar2b const * s, int ls,
LyXFont const & f) LyXFont const & f)
{ {
if (lyxerr.debugging()) { if (lyxerr.debugging(Debug::GUI)) {
if (!Lgb_bug_find_hack) if (!Lgb_bug_find_hack)
lyxerr << "text not called from " lyxerr << "text not called from "
"workarea::workhandler\n"; "workarea::workhandler\n";

View File

@ -18,15 +18,6 @@
#pragma interface #pragma interface
#endif #endif
#include <sigc++/signal_system.h>
/* ugly hack to prevent Qt's '#define emit ...' from
* screwing us up below - jbl 2000/8/10
*/
#ifdef KDEGUI
#undef emit
#endif
#ifdef SIGC_CXX_NAMESPACES #ifdef SIGC_CXX_NAMESPACES
using SigC::Signal0; using SigC::Signal0;
#endif #endif

View File

@ -19,12 +19,14 @@
#include "debug.h" #include "debug.h"
#include "support/lstrings.h" #include "support/lstrings.h"
#include "BufferView.h" #include "BufferView.h"
#include "LyXView.h"
#include "lyxfunc.h"
using std::endl; using std::endl;
FL_OBJECT * figinset_canvas; FL_OBJECT * figinset_canvas;
// need to make the c++ compiler find the correct version of abs. // needed to make the c++ compiler find the correct version of abs.
// This is at least true for g++. // This is at least true for g++.
using std::abs; using std::abs;
@ -59,7 +61,7 @@ WorkArea::WorkArea(BufferView * o, int xpos, int ypos, int width, int height)
figinset_canvas = 0; figinset_canvas = 0;
if (lyxerr.debugging()) if (lyxerr.debugging(Debug::GUI))
lyxerr << "Creating work area: +" lyxerr << "Creating work area: +"
<< xpos << '+' << ypos << ' ' << xpos << '+' << ypos << ' '
<< width << 'x' << height << endl; << width << 'x' << height << endl;
@ -76,7 +78,7 @@ WorkArea::WorkArea(BufferView * o, int xpos, int ypos, int width, int height)
fl_set_object_gravity(obj, NorthWestGravity, NorthWestGravity); fl_set_object_gravity(obj, NorthWestGravity, NorthWestGravity);
// a box // a box
if (lyxerr.debugging()) if (lyxerr.debugging(Debug::GUI))
lyxerr << "\tbackground box: +" lyxerr << "\tbackground box: +"
<< xpos << '+' << ypos << ' ' << xpos << '+' << ypos << ' '
<< width - 15 << 'x' << height << endl; << width - 15 << 'x' << height << endl;
@ -108,7 +110,7 @@ WorkArea::WorkArea(BufferView * o, int xpos, int ypos, int width, int height)
// We add this object as late as possible to avoit problems // We add this object as late as possible to avoit problems
// with drawing. // with drawing.
if (lyxerr.debugging()) if (lyxerr.debugging(Debug::GUI))
lyxerr << "\tfree object: +" lyxerr << "\tfree object: +"
<< xpos + bw << '+' << ypos + bw << ' ' << xpos + bw << '+' << ypos + bw << ' '
<< width - 15 - 2 * bw << 'x' << width - 15 - 2 * bw << 'x'
@ -119,7 +121,8 @@ WorkArea::WorkArea(BufferView * o, int xpos, int ypos, int width, int height)
width - 15 - 2 * bw, // scrollbarwidth width - 15 - 2 * bw, // scrollbarwidth
height - 2 * bw, "", height - 2 * bw, "",
C_WorkArea_work_area_handler); C_WorkArea_work_area_handler);
obj->wantkey = FL_KEY_TAB; //obj->wantkey = FL_KEY_TAB;
obj->wantkey = FL_KEY_ALL;
obj->u_vdata = this; /* This is how we pass the WorkArea obj->u_vdata = this; /* This is how we pass the WorkArea
to the work_area_handler. */ to the work_area_handler. */
fl_set_object_boxtype(obj,FL_DOWN_BOX); fl_set_object_boxtype(obj,FL_DOWN_BOX);
@ -200,7 +203,7 @@ void WorkArea::createPixmap(int width, int height)
if (workareapixmap) if (workareapixmap)
XFreePixmap(fl_display, workareapixmap); XFreePixmap(fl_display, workareapixmap);
if (lyxerr.debugging()) if (lyxerr.debugging(Debug::GUI))
lyxerr << "Creating pixmap (" lyxerr << "Creating pixmap ("
<< width << 'x' << height << ")" << endl; << width << 'x' << height << ")" << endl;
@ -209,7 +212,7 @@ void WorkArea::createPixmap(int width, int height)
width, width,
height, height,
fl_get_visual_depth()); fl_get_visual_depth());
if (lyxerr.debugging()) if (lyxerr.debugging(Debug::GUI))
lyxerr << "\tpixmap=" << workareapixmap << endl; lyxerr << "\tpixmap=" << workareapixmap << endl;
} }
@ -262,7 +265,7 @@ bool Lgb_bug_find_hack = false;
int WorkArea::work_area_handler(FL_OBJECT * ob, int event, int WorkArea::work_area_handler(FL_OBJECT * ob, int event,
FL_Coord, FL_Coord , FL_Coord, FL_Coord ,
int /*key*/, void * xev) int key, void * xev)
{ {
static int x_old = -1; static int x_old = -1;
static int y_old = -1; static int y_old = -1;
@ -278,35 +281,28 @@ int WorkArea::work_area_handler(FL_OBJECT * ob, int event,
if (!area->work_area || if (!area->work_area ||
!area->work_area->form->visible) !area->work_area->form->visible)
return 1; return 1;
lyxerr.debug() << "Workarea event: DRAW" << endl; lyxerr[Debug::GUI] << "Workarea event: DRAW" << endl;
area->createPixmap(area->workWidth(), area->height()); area->createPixmap(area->workWidth(), area->height());
Lgb_bug_find_hack = true; Lgb_bug_find_hack = true;
//workAreaExpose(); area->workAreaExpose();
area->owner_->workAreaExpose();
Lgb_bug_find_hack = false; Lgb_bug_find_hack = false;
break; break;
case FL_PUSH: case FL_PUSH:
if (!ev) break; if (!ev) break;
// Should really have used xbutton.state // Should really have used xbutton.state
lyxerr.debug() << "Workarea event: PUSH" << endl; lyxerr[Debug::GUI] << "Workarea event: PUSH" << endl;
//workAreaButtonPress(ev->xbutton.x - ob->x, area->workAreaButtonPress(ev->xbutton.x - ob->x,
// ev->xbutton.y - ob->y, ev->xbutton.y - ob->y,
// ev->xbutton.button); ev->xbutton.button);
//area->workAreaKeyPress(XK_Pointer_Button1, ev->xbutton.state);
area->owner_->workAreaButtonPress(ev->xbutton.x - ob->x,
ev->xbutton.y - ob->y,
ev->xbutton.button);
break; break;
case FL_RELEASE: case FL_RELEASE:
if (!ev) break; if (!ev) break;
// Should really have used xbutton.state // Should really have used xbutton.state
lyxerr.debug() << "Workarea event: RELEASE" << endl; lyxerr[Debug::GUI] << "Workarea event: RELEASE" << endl;
//workAreaButtonRelease(ev->xbutton.x - ob->x, area->workAreaButtonRelease(ev->xbutton.x - ob->x,
// ev->xbutton.y - ob->y, ev->xbutton.y - ob->y,
// ev->xbutton.button); ev->xbutton.button);
area->owner_->workAreaButtonRelease(ev->xbutton.x - ob->x,
ev->xbutton.y - ob->y,
ev->xbutton.button);
break; break;
case FL_MOUSE: case FL_MOUSE:
if (!ev || ! area->scrollbar) break; if (!ev || ! area->scrollbar) break;
@ -314,59 +310,97 @@ int WorkArea::work_area_handler(FL_OBJECT * ob, int event,
ev->xmotion.y != y_old || ev->xmotion.y != y_old ||
fl_get_scrollbar_value(area->scrollbar) != scrollbar_value_old fl_get_scrollbar_value(area->scrollbar) != scrollbar_value_old
) { ) {
lyxerr.debug() << "Workarea event: MOUSE" << endl; lyxerr[Debug::GUI] << "Workarea event: MOUSE" << endl;
//workAreaMotionNotify(ev->xmotion.x - ob->x, area->workAreaMotionNotify(ev->xmotion.x - ob->x,
// ev->xmotion.y - ob->y, ev->xmotion.y - ob->y,
// ev->xbutton.state); ev->xbutton.state);
area->owner_->workAreaMotionNotify(ev->xmotion.x - ob->x,
ev->xmotion.y - ob->y,
ev->xbutton.state);
} }
break; break;
// Done by the raw callback: case FL_KEYBOARD:
// case FL_KEYBOARD: WorkAreaKeyPress(ob, 0,0,0,ev,0); break; {
lyxerr[Debug::KEY] << "Workarea event: KEYBOARD";
if (static_cast<XEvent*>(ev)->type == KeyPress)
lyxerr << "KeyPress" << endl;
else
lyxerr << "KeyRelease" << endl;
KeySym keysym = 0;
char s_r[10];
XKeyEvent * xke = reinterpret_cast<XKeyEvent *>(ev);
XLookupString(xke, s_r, 10, &keysym, 0);
if (lyxerr.debugging(Debug::KEY)) {
char const * tmp = XKeysymToString(key);
char const * tmp2 = XKeysymToString(keysym);
string stm = (tmp ? tmp : "");
string stm2 = (tmp2 ? tmp2 : "");
lyxerr << "WorkArea: Key is `" << stm << "' ["
<< key << "]" << endl;
lyxerr << "WorkArea: Keysym is `" << stm2 << "' ["
<< keysym << "]" << endl;
}
if (!key) break;
KeySym ret_key = (keysym ? keysym : key);
unsigned int ret_state = xke->state;
static Time last_time_pressed = 0;
static unsigned int last_key_pressed = 0;
static unsigned int last_state_pressed = 0;
if (xke->time - last_time_pressed < 50 // should perhaps be tunable
&& xke->state == last_state_pressed
&& xke->keycode == last_key_pressed) {
lyxerr[Debug::KEY]
<< "Workarea: Purging X events." << endl;
XSync(fl_get_display(), 1);
// This purge make f.ex. scrolling stop immidiatly when
// releasing the PageDown button. The question is if
// this purging of XEvents can cause any harm...
// after some testing I can see no problems, but
// I'd like other reports too.
break;
}
last_time_pressed = xke->time;
last_key_pressed = xke->keycode;
last_state_pressed = xke->state;
area->workAreaKeyPress(ret_key, ret_state);
}
break;
case FL_FOCUS: case FL_FOCUS:
lyxerr.debug() << "Workarea event: FOCUS" << endl; lyxerr[Debug::GUI] << "Workarea event: FOCUS" << endl;
//workAreaFocus(); area->workAreaFocus();
break; break;
case FL_UNFOCUS: case FL_UNFOCUS:
lyxerr.debug() << "Workarea event: UNFOCUS" << endl; lyxerr[Debug::GUI] << "Workarea event: UNFOCUS" << endl;
//workAreaUnfocus(); area->workAreaUnfocus();
break; break;
case FL_ENTER: case FL_ENTER:
lyxerr.debug() << "Workarea event: ENTER" << endl; lyxerr[Debug::GUI] << "Workarea event: ENTER" << endl;
//workAreaEnter(); area->workAreaEnter();
area->owner_->enterView();
break; break;
case FL_LEAVE: case FL_LEAVE:
lyxerr.debug() << "Workarea event: LEAVE" << endl; lyxerr[Debug::GUI] << "Workarea event: LEAVE" << endl;
//workAreaLeave(); area->workAreaLeave();
area->owner_->leaveView();
break; break;
case FL_DBLCLICK: case FL_DBLCLICK:
if (!ev) break; if (!ev) break;
lyxerr.debug() << "Workarea event: DBLCLICK" << endl; lyxerr[Debug::GUI] << "Workarea event: DBLCLICK" << endl;
//workAreaDoubleClick(ev->xbutton.x - ob->x, area->workAreaDoubleClick(ev->xbutton.x - ob->x,
// ev->xbutton.y - ob->y, ev->xbutton.y - ob->y,
// ev->xbutton.button); ev->xbutton.button);
area->owner_->doubleClick(ev->xbutton.x - ob->x,
ev->xbutton.y - ob->y,
ev->xbutton.button);
break; break;
case FL_TRPLCLICK: case FL_TRPLCLICK:
if (!ev) break; if (!ev) break;
lyxerr.debug() << "Workarea event: TRPLCLICK" << endl; lyxerr[Debug::GUI] << "Workarea event: TRPLCLICK" << endl;
//workAreaTripleClick(ev->xbutton.x - ob->x, area->workAreaTripleClick(ev->xbutton.x - ob->x,
// ev->xbutton.y - ob->y, ev->xbutton.y - ob->y,
// ev->xbutton.button); ev->xbutton.button);
area->owner_->tripleClick(ev->xbutton.x - ob->x,
ev->xbutton.y - ob->y,
ev->xbutton.button);
break; break;
case FL_OTHER: case FL_OTHER:
if (!ev) break; if (!ev) break;
lyxerr.debug() << "Workarea event: OTHER" << endl; lyxerr[Debug::GUI] << "Workarea event: OTHER" << endl;
break; break;
} }

View File

@ -18,15 +18,16 @@
#include <utility> #include <utility>
//#include <sigc++/signal_system.h> #include <sigc++/signal_system.h>
#include FORMS_H_LOCATION #include FORMS_H_LOCATION
#include "Painter.h" #include "Painter.h"
//#ifdef SIGC_CXX_NAMESPACES #ifdef SIGC_CXX_NAMESPACES
//using SigC::Signal0; using SigC::Signal0;
//using SigC::Signal3; using SigC::Signal2;
//#endif using SigC::Signal3;
#endif
class BufferView; class BufferView;
@ -106,26 +107,28 @@ public:
BufferView * owner() const { return owner_; } BufferView * owner() const { return owner_; }
// Signals // Signals
// ///
// Signal0<void> workAreaExpose; Signal0<void> workAreaExpose;
// ///
// Signal3<void, int, int, unsigned int> workAreaButtonPress; Signal2<void, KeySym, unsigned int> workAreaKeyPress;
// ///
// Signal3<void, int, int, unsigned int> workAreaButtonRelease; Signal3<void, int, int, unsigned int> workAreaButtonPress;
// ///
// Signal3<void, int, int, unsigned int> workAreaMotionNotify; Signal3<void, int, int, unsigned int> workAreaButtonRelease;
// ///
// Signal0<void> workAreaFocus; Signal3<void, int, int, unsigned int> workAreaMotionNotify;
// ///
// Signal0<void> workAreaUnfocus; Signal0<void> workAreaFocus;
// ///
// Signal0<void> workAreaEnter; Signal0<void> workAreaUnfocus;
// ///
// Signal0<void> workAreaLeave; Signal0<void> workAreaEnter;
// ///
// Signal3<void, int, int, unsigned int> workAreaDoubleClick; Signal0<void> workAreaLeave;
// ///
// Signal3<void, int, int, unsigned int> workAreaTripleClick; Signal3<void, int, int, unsigned int> workAreaDoubleClick;
///
Signal3<void, int, int, unsigned int> workAreaTripleClick;
private: private:
/// ///
void createPixmap(int, int); void createPixmap(int, int);

View File

@ -23,24 +23,28 @@ struct FD_form_citation;
*/ */
class FormCitation : public FormCommand { class FormCitation : public FormCommand {
public: public:
/**@name Constructors and Destructors */
//@{
/// ///
FormCitation(LyXView *, Dialogs *); FormCitation(LyXView *, Dialogs *);
/// ///
~FormCitation(); ~FormCitation();
//@}
private: private:
/// ///
enum State { enum State {
///
DOWN, DOWN,
///
UP, UP,
///
DELETE, DELETE,
///
ADD, ADD,
///
BIBBRSR, BIBBRSR,
///
CITEBRSR, CITEBRSR,
///
ON, ON,
///
OFF OFF
}; };
/// Build the dialog /// Build the dialog

View File

@ -31,7 +31,6 @@ class FormCommand : public DialogBase, public noncopyable {
public: public:
/// Constructor /// Constructor
FormCommand(LyXView *, Dialogs *, string const & ); FormCommand(LyXView *, Dialogs *, string const & );
/// ///
static int WMHideCB(FL_FORM *, void *); static int WMHideCB(FL_FORM *, void *);
/// ///

View File

@ -34,101 +34,131 @@ using SigC::Connection;
*/ */
class FormDocument : public DialogBase, public noncopyable { class FormDocument : public DialogBase, public noncopyable {
public: public:
/**@name Constructors and Destructors */
//@{
/// #FormDocument x(Communicator ..., Popups ...);# /// #FormDocument x(Communicator ..., Popups ...);#
FormDocument(LyXView *, Dialogs *); FormDocument(LyXView *, Dialogs *);
/// ///
~FormDocument(); ~FormDocument();
///
void SetDocumentClassChoice(vector<string> const & choices); void SetDocumentClassChoice(vector<string> const & choices);
//@} ///
/**@name Real per-instance Callback Methods */
//@{
static int WMHideCB(FL_FORM *, void *); static int WMHideCB(FL_FORM *, void *);
///
static void OKCB(FL_OBJECT *, long); static void OKCB(FL_OBJECT *, long);
///
static void CancelCB(FL_OBJECT *, long); static void CancelCB(FL_OBJECT *, long);
///
static void ApplyCB(FL_OBJECT *, long); static void ApplyCB(FL_OBJECT *, long);
///
static void InputCB(FL_OBJECT *, long); static void InputCB(FL_OBJECT *, long);
//@} ///
enum EnumPopupStatus { enum EnumPopupStatus {
///
POPUP_UNMODIFIED, POPUP_UNMODIFIED,
///
POPUP_MODIFIED, POPUP_MODIFIED,
///
POPUP_READONLY POPUP_READONLY
}; };
private: private:
///
void DeactivateDocumentButtons(); void DeactivateDocumentButtons();
///
void ActivateDocumentButtons(); void ActivateDocumentButtons();
///
void EnableDocumentLayout(); void EnableDocumentLayout();
///
void DisableDocumentLayout(); void DisableDocumentLayout();
///
void CheckDocumentInput(FL_OBJECT * ob, long); void CheckDocumentInput(FL_OBJECT * ob, long);
///
void ChoiceBulletSize(FL_OBJECT * ob, long); void ChoiceBulletSize(FL_OBJECT * ob, long);
///
void InputBulletLaTeX(FL_OBJECT * ob, long); void InputBulletLaTeX(FL_OBJECT * ob, long);
///
void BulletDepth(FL_OBJECT * ob, long); void BulletDepth(FL_OBJECT * ob, long);
///
void BulletPanel(FL_OBJECT * ob, long); void BulletPanel(FL_OBJECT * ob, long);
///
void BulletBMTable(FL_OBJECT * ob, long); void BulletBMTable(FL_OBJECT * ob, long);
///
void checkMarginValues(); void checkMarginValues();
///
/**@name Real per-instance Callback Methods */
//@{
static void DocumentInputCB(FL_OBJECT * ob, long); static void DocumentInputCB(FL_OBJECT * ob, long);
///
static void ChoiceBulletSizeCB(FL_OBJECT * ob, long); static void ChoiceBulletSizeCB(FL_OBJECT * ob, long);
///
static void InputBulletLaTeXCB(FL_OBJECT * ob, long); static void InputBulletLaTeXCB(FL_OBJECT * ob, long);
///
static void BulletDepthCB(FL_OBJECT * ob, long); static void BulletDepthCB(FL_OBJECT * ob, long);
///
static void BulletPanelCB(FL_OBJECT * ob, long); static void BulletPanelCB(FL_OBJECT * ob, long);
///
static void BulletBMTableCB(FL_OBJECT * ob, long); static void BulletBMTableCB(FL_OBJECT * ob, long);
//@}
/**@name Slot Methods */
//@{
/// Create the popup if necessary, update it and display it. /// Create the popup if necessary, update it and display it.
void show(); void show();
/// Hide the popup. /// Hide the popup.
void hide(); void hide();
/// Update the popup. /// Update the popup.
void update(); void update();
///
void paper_update(); void paper_update();
///
void class_update(); void class_update();
///
void language_update(); void language_update();
///
void options_update(); void options_update();
///
void bullets_update(); void bullets_update();
/// Apply from popup /// Apply from popup
void apply(); void apply();
///
void paper_apply(); void paper_apply();
///
bool class_apply(); bool class_apply();
///
bool language_apply(); bool language_apply();
///
bool options_apply(); bool options_apply();
///
void bullets_apply(); void bullets_apply();
/// Cancel from popup /// Cancel from popup
void cancel(); void cancel();
//@}
/// Build the popup /// Build the popup
void build(); void build();
///
/// Explicitly free the popup. /// Explicitly free the popup.
void free(); void free();
/// Typedefinitions from the fdesign produced Header file /// Typedefinitions from the fdesign produced Header file
FD_form_tabbed_document * build_tabbed_document(); FD_form_tabbed_document * build_tabbed_document();
///
FD_form_doc_paper * build_doc_paper(); FD_form_doc_paper * build_doc_paper();
///
FD_form_doc_class * build_doc_class(); FD_form_doc_class * build_doc_class();
///
FD_form_doc_language * build_doc_language(); FD_form_doc_language * build_doc_language();
///
FD_form_doc_options * build_doc_options(); FD_form_doc_options * build_doc_options();
///
FD_form_doc_bullet * build_doc_bullet(); FD_form_doc_bullet * build_doc_bullet();
/**@name Private Data */
//@{
/// Real GUI implementation. /// Real GUI implementation.
FD_form_tabbed_document * dialog_; FD_form_tabbed_document * dialog_;
///
FD_form_doc_paper * paper_; FD_form_doc_paper * paper_;
///
FD_form_doc_class * class_; FD_form_doc_class * class_;
///
FD_form_doc_language * language_; FD_form_doc_language * language_;
///
FD_form_doc_options * options_; FD_form_doc_options * options_;
///
FD_form_doc_bullet * bullets_; FD_form_doc_bullet * bullets_;
/// Which LyXView do we belong to? /// Which LyXView do we belong to?
LyXView * lv_; LyXView * lv_;
///
Dialogs * d_; Dialogs * d_;
/// Update connection. /// Update connection.
Connection u_; Connection u_;
@ -136,10 +166,14 @@ private:
Connection h_; Connection h_;
/// has form contents changed? Used to control OK/Apply /// has form contents changed? Used to control OK/Apply
EnumPopupStatus status; EnumPopupStatus status;
//@} ///
int int ActCell;
ActCell, Confirmed, ///
current_bullet_panel, current_bullet_depth; int Confirmed;
///
int current_bullet_panel;
///
int current_bullet_depth;
/// ///
FL_OBJECT * fbullet; FL_OBJECT * fbullet;
/// ///

View File

@ -20,8 +20,8 @@
#include "LString.h" #include "LString.h"
#include "frontends/DialogBase.h" #include "frontends/DialogBase.h"
//#include "form_graphics.h"
#include "RadioButtonGroup.h" #include "RadioButtonGroup.h"
#include "support/utility.hpp"
#ifdef __GNUG__ #ifdef __GNUG__
#pragma interface #pragma interface
@ -36,8 +36,7 @@ struct FD_form_graphics;
/** This class provides an XForms implementation of the FormGraphics Dialog. /** This class provides an XForms implementation of the FormGraphics Dialog.
*/ */
class FormGraphics: public DialogBase class FormGraphics: public DialogBase, public noncopyable {
{
public: public:
/// #FormGraphics x(LyXFunc ..., Dialogs ...);# /// #FormGraphics x(LyXFunc ..., Dialogs ...);#
FormGraphics(LyXView *, Dialogs *); FormGraphics(LyXView *, Dialogs *);
@ -59,12 +58,6 @@ public:
static void InputCB(FL_OBJECT *, long); static void InputCB(FL_OBJECT *, long);
private: private:
///
FormGraphics()
: widthButtons(5), heightButtons(4), displayButtons(4) {}
//
FormGraphics(FormGraphics const &) : DialogBase() {}
/// The maximum digits for the image width (cm, inch, percent) /// The maximum digits for the image width (cm, inch, percent)
enum { enum {
/// ///
@ -86,8 +79,6 @@ FormGraphics(FormGraphics const &) : DialogBase() {}
FILENAME_MAXCHARS = 1024 FILENAME_MAXCHARS = 1024
}; };
/**@name Slot Methods */
//@{
/// Save the active inset and show the dialog. /// Save the active inset and show the dialog.
void showDialog(InsetGraphics * inset); void showDialog(InsetGraphics * inset);
/// Create the dialog if necessary, update it and display it. /// Create the dialog if necessary, update it and display it.
@ -96,17 +87,13 @@ FormGraphics(FormGraphics const &) : DialogBase() {}
void hide(); void hide();
/// Update the dialog /// Update the dialog
void update(); void update();
//@}
/**@name Callback methods */
//@{
/// Apply the changes to the inset. /// Apply the changes to the inset.
void apply(); void apply();
/// Verify that the input is correct. If not disable ok/apply buttons. /// Verify that the input is correct. If not disable ok/apply buttons.
void input(); void input();
/// Open the file browse dialog to select an image file. /// Open the file browse dialog to select an image file.
void browse(); void browse();
//@}
/// Build the dialog /// Build the dialog
void build(); void build();
@ -117,8 +104,6 @@ FormGraphics(FormGraphics const &) : DialogBase() {}
/// Display a file browser dialog and return the file chosen. /// Display a file browser dialog and return the file chosen.
string browseFile(string const & filename); string browseFile(string const & filename);
/**@name Data */
//@{
/// Real GUI implementation. /// Real GUI implementation.
FD_form_graphics * dialog_; FD_form_graphics * dialog_;
/** Which LyXFunc do we use? /** Which LyXFunc do we use?
@ -149,9 +134,6 @@ FormGraphics(FormGraphics const &) : DialogBase() {}
Connection u_; Connection u_;
/// Last used figure path /// Last used figure path
string last_image_path; string last_image_path;
//@} };
}
;
#endif #endif

View File

@ -23,14 +23,10 @@ struct FD_form_index;
*/ */
class FormIndex : public FormCommand { class FormIndex : public FormCommand {
public: public:
/**@name Constructors and Destructors */
//@{
/// ///
FormIndex(LyXView *, Dialogs *); FormIndex(LyXView *, Dialogs *);
/// ///
~FormIndex(); ~FormIndex();
//@}
private: private:
/// Build the dialog /// Build the dialog
virtual void build(); virtual void build();
@ -44,10 +40,10 @@ private:
virtual FL_FORM * const form() const; virtual FL_FORM * const form() const;
/// ///
FD_form_index * build_index(); FD_form_index * build_index();
/// ///
int minh, minw; int minh;
///
int minw;
/// Real GUI implementation. /// Real GUI implementation.
FD_form_index * dialog_; FD_form_index * dialog_;
}; };

View File

@ -46,37 +46,31 @@ using SigC::Connection;
*/ */
class FormPreferences : public DialogBase, public noncopyable { class FormPreferences : public DialogBase, public noncopyable {
public: public:
/**@name Constructors and Destructors */
//@{
/// #FormPreferences x(LyXFunc ..., Dialogs ...);# /// #FormPreferences x(LyXFunc ..., Dialogs ...);#
FormPreferences(LyXView *, Dialogs *); FormPreferences(LyXView *, Dialogs *);
/// ///
~FormPreferences(); ~FormPreferences();
//@}
/**@name Real per-instance Callback Methods */ ///
//@{
static int WMHideCB(FL_FORM *, void *); static int WMHideCB(FL_FORM *, void *);
///
static void OKCB(FL_OBJECT *, long); static void OKCB(FL_OBJECT *, long);
///
static void ApplyCB(FL_OBJECT *, long); static void ApplyCB(FL_OBJECT *, long);
///
static void CancelCB(FL_OBJECT *, long); static void CancelCB(FL_OBJECT *, long);
///
static void InputCB(FL_OBJECT *, long); static void InputCB(FL_OBJECT *, long);
///
static void RestoreCB(FL_OBJECT *, long); static void RestoreCB(FL_OBJECT *, long);
//@}
private: private:
/**@name Slot Methods */
//@{
/// Create the dialog if necessary, update it and display it. /// Create the dialog if necessary, update it and display it.
void show(); void show();
/// Hide the dialog. /// Hide the dialog.
void hide(); void hide();
/// Update the dialog. /// Update the dialog.
void update(); void update();
//@}
/**@name Dialog internal methods */
//@{
/// Apply from dialog /// Apply from dialog
void apply(); void apply();
/// Filter the inputs -- return true if entries are valid /// Filter the inputs -- return true if entries are valid
@ -97,10 +91,7 @@ private:
FD_form_printer * build_printer(); FD_form_printer * build_printer();
/// ///
FD_form_paths * build_paths(); FD_form_paths * build_paths();
//@}
/**@name Private Data */
//@{
/// Real GUI implementation. /// Real GUI implementation.
FD_form_preferences * dialog_; FD_form_preferences * dialog_;
/// ///
@ -124,10 +115,11 @@ private:
/// Hide connection. /// Hide connection.
Connection h_; Connection h_;
/// Overcome a dumb xforms sizing bug /// Overcome a dumb xforms sizing bug
int minw_, minh_; int minw_;
///
int minh_;
/// ///
ButtonController<PreferencesPolicy> * bc_; ButtonController<PreferencesPolicy> * bc_;
//@}
}; };
#endif #endif

View File

@ -37,36 +37,29 @@ using SigC::Connection;
*/ */
class FormPrint : public DialogBase, public noncopyable { class FormPrint : public DialogBase, public noncopyable {
public: public:
/**@name Constructors and Destructors */
//@{
/// #FormPrint x(LyXFunc ..., Dialogs ...);# /// #FormPrint x(LyXFunc ..., Dialogs ...);#
FormPrint(LyXView *, Dialogs *); FormPrint(LyXView *, Dialogs *);
/// ///
~FormPrint(); ~FormPrint();
//@}
/**@name Real per-instance Callback Methods */ ///
//@{
static int WMHideCB(FL_FORM *, void *); static int WMHideCB(FL_FORM *, void *);
///
static void OKCB(FL_OBJECT *, long); static void OKCB(FL_OBJECT *, long);
///
static void ApplyCB(FL_OBJECT *, long); static void ApplyCB(FL_OBJECT *, long);
///
static void CancelCB(FL_OBJECT *, long); static void CancelCB(FL_OBJECT *, long);
///
static void InputCB(FL_OBJECT *, long); static void InputCB(FL_OBJECT *, long);
//@}
private: private:
/**@name Slot Methods */
//@{
/// Create the dialog if necessary, update it and display it. /// Create the dialog if necessary, update it and display it.
void show(); void show();
/// Hide the dialog. /// Hide the dialog.
void hide(); void hide();
/// Update the dialog. /// Update the dialog.
void update(); void update();
//@}
/**@name Dialog internal methods */
//@{
/// Apply from dialog /// Apply from dialog
void apply(); void apply();
/// Filter the inputs /// Filter the inputs
@ -75,10 +68,7 @@ private:
void build(); void build();
/// ///
FD_form_print * build_print(); FD_form_print * build_print();
//@}
/**@name Private Data */
//@{
/// Real GUI implementation. /// Real GUI implementation.
FD_form_print * dialog_; FD_form_print * dialog_;
/// Which LyXView do we belong to? /// Which LyXView do we belong to?
@ -89,7 +79,6 @@ private:
Connection u_; Connection u_;
/// Hide connection. /// Hide connection.
Connection h_; Connection h_;
//@}
}; };
#endif #endif

View File

@ -23,19 +23,33 @@ struct FD_form_ref;
*/ */
class FormRef : public FormCommand { class FormRef : public FormCommand {
public: public:
/**@name Constructors and Destructors */
//@{
/// ///
FormRef(LyXView *, Dialogs *); FormRef(LyXView *, Dialogs *);
/// ///
~FormRef(); ~FormRef();
//@}
private: private:
/// ///
enum Type{ REF=0, PAGEREF, VREF, VPAGEREF, PRETTYREF }; enum Type{
///
REF,
///
PAGEREF,
///
VREF,
///
VPAGEREF,
///
PRETTYREF
};
/// ///
enum Goto{ GOREF=0, GOBACK, GOFIRST }; enum Goto{
///
GOREF,
///
GOBACK,
///
GOFIRST
};
/// Build the dialog /// Build the dialog
virtual void build(); virtual void build();

View File

@ -39,43 +39,43 @@ struct FD_form_create_tabular;
*/ */
class FormTabular : public DialogBase, public noncopyable { class FormTabular : public DialogBase, public noncopyable {
public: public:
/**@name Constructors and Destructors */
//@{
/// #FormTabular x(LyXFunc ..., Dialogs ...);# /// #FormTabular x(LyXFunc ..., Dialogs ...);#
FormTabular(LyXView *, Dialogs *); FormTabular(LyXView *, Dialogs *);
/// ///
~FormTabular(); ~FormTabular();
//@} ///
/**@name Real per-instance Callback Methods */
//@{
static int WMHideCB(FL_FORM *, void *); static int WMHideCB(FL_FORM *, void *);
///
static void CloseCB(FL_OBJECT *, long); static void CloseCB(FL_OBJECT *, long);
///
static void OKCB(FL_OBJECT *, long); static void OKCB(FL_OBJECT *, long);
///
static void CancelCB(FL_OBJECT *, long); static void CancelCB(FL_OBJECT *, long);
///
static void ApplyCB(FL_OBJECT *, long); static void ApplyCB(FL_OBJECT *, long);
///
static void InputCB(FL_OBJECT *, long); static void InputCB(FL_OBJECT *, long);
//@}
private: private:
/**@name Slot Methods */
//@{
/// Create the dialog if necessary, update it and display it. /// Create the dialog if necessary, update it and display it.
void show(); void show();
///
void show_create(); void show_create();
///
void showInset(InsetTabular *); void showInset(InsetTabular *);
/// Hide the dialog. /// Hide the dialog.
void hide(); void hide();
///
void hide_create(); void hide_create();
///
void hideInset(InsetTabular *); void hideInset(InsetTabular *);
/// Update the dialog. /// Update the dialog.
void update(); void update();
///
void updateInset(InsetTabular *); void updateInset(InsetTabular *);
///
bool local_update(bool); bool local_update(bool);
//@}
/**@name Dialog internal methods */
//@{
/// Apply from dialog /// Apply from dialog
void apply_create(); void apply_create();
/// Build the dialog /// Build the dialog
@ -94,10 +94,7 @@ private:
FD_form_longtable_options * build_longtable_options(); FD_form_longtable_options * build_longtable_options();
/// ///
FD_form_create_tabular * build_create_tabular(); FD_form_create_tabular * build_create_tabular();
//@}
/**@name Private Data */
//@{
/// Real GUI implementation. /// Real GUI implementation.
FD_form_tabular * dialog_; FD_form_tabular * dialog_;
/// ///
@ -110,7 +107,7 @@ private:
FD_form_longtable_options * longtable_options_; FD_form_longtable_options * longtable_options_;
/// ///
FD_form_create_tabular * create_tabular_; FD_form_create_tabular * create_tabular_;
//
/// Which LyXView do we belong to? /// Which LyXView do we belong to?
LyXView * lv_; LyXView * lv_;
/// ///
@ -123,7 +120,6 @@ private:
InsetTabular * inset_; InsetTabular * inset_;
/// ///
int actCell_; int actCell_;
//@}
}; };
#endif #endif

View File

@ -24,13 +24,10 @@ struct FD_form_toc;
*/ */
class FormToc : public FormCommand { class FormToc : public FormCommand {
public: public:
/**@name Constructors and Destructors */
//@{
/// ///
FormToc(LyXView *, Dialogs *); FormToc(LyXView *, Dialogs *);
/// ///
~FormToc(); ~FormToc();
private: private:
/// Build the dialog /// Build the dialog
virtual void build(); virtual void build();

View File

@ -23,14 +23,10 @@ struct FD_form_url;
*/ */
class FormUrl : public FormCommand { class FormUrl : public FormCommand {
public: public:
/**@name Constructors and Destructors */
//@{
/// ///
FormUrl(LyXView *, Dialogs *); FormUrl(LyXView *, Dialogs *);
/// ///
~FormUrl(); ~FormUrl();
//@}
private: private:
/// Build the dialog /// Build the dialog
virtual void build(); virtual void build();
@ -44,9 +40,10 @@ private:
virtual FL_FORM * const form() const; virtual FL_FORM * const form() const;
/// ///
FD_form_url * build_url(); FD_form_url * build_url();
/// ///
int minh, minw; int minh;
///
int minw;
/// Real GUI implementation. /// Real GUI implementation.
FD_form_url * dialog_; FD_form_url * dialog_;
}; };

View File

@ -46,12 +46,14 @@ public:
/// ///
static void MenuCallback(FL_OBJECT *, long); static void MenuCallback(FL_OBJECT *, long);
/// Add to "menu" the list of last opened files /** Add to "menu" the list of last opened files
/// (add "extra_label" to the last entry) (add "extra_label" to the last entry)
*/
void add_lastfiles(int menu, string const & extra_label, void add_lastfiles(int menu, string const & extra_label,
std::vector<int> & smn, StrPool & strpool); std::vector<int> & smn, StrPool & strpool);
/// Add to "menu" the list of opened documents /** Add to "menu" the list of opened documents
/// (add "extra_label" to the last entry) (add "extra_label" to the last entry)
*/
void add_documents(int menu, string const & extra_label, void add_documents(int menu, string const & extra_label,
std::vector<int> & smn, StrPool & strpool); std::vector<int> & smn, StrPool & strpool);
/// ///
@ -60,7 +62,7 @@ public:
std::vector<int> & smn, StrPool & strpool); std::vector<int> & smn, StrPool & strpool);
/// update the state of the menuitems /// update the state of the menuitems
void update() { } void update() {}
private: private:
/// ///

View File

@ -23,20 +23,19 @@
#pragma interface #pragma interface
#endif #endif
#include <vector> #include <vector>
#include <utility> #include <utility>
using std::vector; using std::vector;
using std::pair; using std::pair;
#include FORMS_H_LOCATION #include FORMS_H_LOCATION
class RadioButtonGroup ///
{ class RadioButtonGroup {
public: public:
/// Constructor. Allocate space for 'n' items in the group. /// Constructor. Allocate space for 'n' items in the group.
RadioButtonGroup(unsigned n = 5) : map(n) {}; RadioButtonGroup(unsigned n = 5) : map(n) {};
/// Destructor. Cleans up.
~RadioButtonGroup() {};
/// Register a radio button with it's corresponding value. /// Register a radio button with it's corresponding value.
void registerRadioButton(FL_OBJECT *button, int value); void registerRadioButton(FL_OBJECT *button, int value);
@ -50,8 +49,11 @@ public:
int getButton(); int getButton();
private: private:
typedef pair < FL_OBJECT *, int > ButtonValuePair; ///
typedef vector < ButtonValuePair > ButtonValueMap; typedef pair<FL_OBJECT *, int> ButtonValuePair;
///
typedef vector<ButtonValuePair> ButtonValueMap;
///
ButtonValueMap map; ButtonValueMap map;
}; };

View File

@ -47,7 +47,8 @@ public:
void set(bool doingmain = false); void set(bool doingmain = false);
/** this is to be the entry point to the toolbar /** this is to be the entry point to the toolbar
frame, where you can change the toolbar realtime. */ frame, where you can change the toolbar realtime.
*/
void edit(); void edit();
/// add a new button to the toolbar. /// add a new button to the toolbar.
void add(int , bool doclean = true); void add(int , bool doclean = true);
@ -99,7 +100,9 @@ public:
/// ///
Combox * combox; Combox * combox;
/// Starting position /// Starting position
int sxpos, sypos; int sxpos;
///
int sypos;
/// ///
int xpos; int xpos;
/// ///
@ -110,12 +113,10 @@ public:
/// removes all toolbar buttons from the toolbar. /// removes all toolbar buttons from the toolbar.
void clean(); void clean();
/** more... /// more...
*/
void reset(); void reset();
/** more... /// more...
*/
void lightReset(); void lightReset();
}; };
#endif #endif

View File

@ -18,6 +18,7 @@
#include "graphics/Renderer.h" #include "graphics/Renderer.h"
///
class EPS_Renderer : public Renderer { class EPS_Renderer : public Renderer {
public: public:
/// c-tor. /// c-tor.

View File

@ -22,8 +22,8 @@
#include "GraphicsCacheItem.h" #include "GraphicsCacheItem.h"
#include "support/utility.hpp" #include "support/utility.hpp"
/** GraphicsCache is the manager of the image cache, it is responsible to /** GraphicsCache is the manager of the image cache.
create the GraphicsCacheItem's and maintain them. It is responsible of create the GraphicsCacheItem's and maintain them.
GraphicsCache is a singleton class, there should be only one instance of GraphicsCache is a singleton class, there should be only one instance of
it at any moment. it at any moment.

View File

@ -57,25 +57,29 @@ public:
/// Return a pixmap that can be displayed on X server. /// Return a pixmap that can be displayed on X server.
Pixmap getImage() const; Pixmap getImage() const;
///
enum ImageStatus { enum ImageStatus {
///
Loading = 1, Loading = 1,
///
ErrorConverting, ErrorConverting,
///
ErrorReading, ErrorReading,
///
Loaded Loaded
}; };
/// Is the pixmap ready for display? /// Is the pixmap ready for display?
ImageStatus getImageStatus() const; ImageStatus getImageStatus() const;
/// Get a notification when the image conversion is done. /** Get a notification when the image conversion is done.
/// used by an internal callback mechanism. used by an internal callback mechanism.
*/
void imageConverted(int retval); void imageConverted(int retval);
private: private:
/// Private c-tor so that only GraphicsCache can create an instance. /// Private c-tor so that only GraphicsCache can create an instance.
GraphicsCacheItem(); GraphicsCacheItem();
/// internal copy mechanism. /// internal copy mechanism.
void copy(GraphicsCacheItem const &); void copy(GraphicsCacheItem const &);
@ -85,13 +89,15 @@ private:
/// Set the filename this item will be pointing too. /// Set the filename this item will be pointing too.
bool setFilename(string const & filename); bool setFilename(string const & filename);
/// ///
friend class GraphicsCache; friend class GraphicsCache;
///
GraphicsCacheItem_pimpl * pimpl; GraphicsCacheItem_pimpl * pimpl;
/// The filename we refer too, this is used when removing ourselves /** The filename we refer too.
/// from the cache. This is used when removing ourselves from the cache.
*/
string filename_; string filename_;
}; };

View File

@ -22,11 +22,11 @@
#include "X11/Xlib.h" #include "X11/Xlib.h"
#include "support/utility.hpp" #include "support/utility.hpp"
/** Renderer is a base class that is used to take an image format, and render /** Renderer is a base class that is used to take an image format, and
* it into a Pixmap in order to be able to display it later on in LyX. render it into a Pixmap in order to be able to display it later on
* Essentially it's job is to load an image format and create a Pixmap from it. in LyX. Essentially it's job is to load an image format and create
* It also needs to do various transforms on the image, like Rotation, a Pixmap from it. It also needs to do various transforms on the
* Resize and color reduction. image, like Rotation, Resize and color reduction.
*/ */
class Renderer : public noncopyable { class Renderer : public noncopyable {
public: public:
@ -56,7 +56,7 @@ protected:
/// Set the pixmap. /// Set the pixmap.
void setPixmap(Pixmap pixmap, unsigned int width, unsigned int height); void setPixmap(Pixmap pixmap, unsigned int width, unsigned int height);
///
string const & getFilename() const; string const & getFilename() const;
private: private:

View File

@ -27,12 +27,11 @@
using std::endl; using std::endl;
using std::ios; using std::ios;
XPM_Renderer::XPM_Renderer() XPM_Renderer::XPM_Renderer()
: Renderer() : Renderer()
{} {}
XPM_Renderer::~XPM_Renderer()
{}
bool XPM_Renderer::renderImage() bool XPM_Renderer::renderImage()
{ {
@ -70,6 +69,7 @@ bool XPM_Renderer::renderImage()
return true; return true;
} }
bool XPM_Renderer::isImageFormatOK(string const & filename) const bool XPM_Renderer::isImageFormatOK(string const & filename) const
{ {
std::ifstream is(filename.c_str(), ios::in); std::ifstream is(filename.c_str(), ios::in);

View File

@ -18,12 +18,11 @@
#include "graphics/Renderer.h" #include "graphics/Renderer.h"
///
class XPM_Renderer : public Renderer { class XPM_Renderer : public Renderer {
public: public:
/// c-tor. /// c-tor.
XPM_Renderer(); XPM_Renderer();
/// d-tor.
virtual ~XPM_Renderer();
/// Load the XPM image and create a pixmap out of it. /// Load the XPM image and create a pixmap out of it.
virtual bool renderImage(); virtual bool renderImage();

View File

@ -180,7 +180,7 @@ int kb_keymap::defkey(kb_sequence * seq, int action, int idx /*= 0*/)
if (idx + 1 == seq->length) { if (idx + 1 == seq->length) {
string buf; string buf;
seq->print(buf, true); seq->print(buf, true);
lyxerr[Debug::KEY] lyxerr[Debug::KBMAP]
<< "Warning: New binding for '" << "Warning: New binding for '"
<< buf << buf
<< "' is overriding old binding..." << "' is overriding old binding..."

View File

@ -187,13 +187,142 @@ void LyXFunc::moveCursorUpdate(bool selecting)
} }
int LyXFunc::processKeySym(KeySym keysym, unsigned int state)
{
string argument;
if (lyxerr.debugging(Debug::KEY)) {
char * tmp = XKeysymToString(keysym);
string stm = (tmp ? tmp : "");
lyxerr << "KeySym is "
<< stm
<< "["
<< keysym << "]"
<< endl;
}
// Do nothing if we have nothing (JMarc)
if (keysym == NoSymbol) {
lyxerr[Debug::KEY] << "Empty kbd action (probably composing)"
<< endl;
//return 0;
return FL_PREEMPT;
}
// this function should be used always [asierra060396]
UpdatableInset * tli = owner->view()->the_locking_inset;
if (owner->view()->available() && tli && (keysym == XK_Escape)) {
if (tli == tli->GetLockingInset()) {
owner->view()->unlockInset(tli);
owner->view()->text->CursorRight(owner->view());
moveCursorUpdate(false);
owner->showState();
} else {
tli->UnlockInsetInInset(owner->view(),
tli->GetLockingInset(),true);
}
//return 0;
return FL_PREEMPT;
}
// Can we be sure that this will work for all X-Windows
// implementations? (Lgb)
// This code snippet makes lyx ignore some keys. Perhaps
// all of them should be explictly mentioned?
if((keysym >= XK_Shift_L && keysym <= XK_Hyper_R)
|| keysym == XK_Mode_switch || keysym == 0x0)
return 0;
// Do a one-deep top-level lookup for
// cancel and meta-fake keys. RVDK_PATCH_5
cancel_meta_seq.reset();
int action = cancel_meta_seq.addkey(keysym, state
&(ShiftMask|ControlMask
|Mod1Mask));
// When not cancel or meta-fake, do the normal lookup.
// Note how the meta_fake Mod1 bit is OR-ed in and reset afterwards.
// Mostly, meta_fake_bit = 0. RVDK_PATCH_5.
if ( (action != LFUN_CANCEL) && (action != LFUN_META_FAKE) ) {
// remove Caps Lock and Mod2 as a modifiers
action = keyseq.addkey(keysym,
(state | meta_fake_bit)
&(ShiftMask|ControlMask
|Mod1Mask));
}
// Dont remove this unless you know what you are doing.
meta_fake_bit = 0;
if (action == 0) action = LFUN_PREFIX;
if (lyxerr.debugging(Debug::KEY)) {
string buf;
keyseq.print(buf);
lyxerr << "Key ["
<< action << "]["
<< buf << "]"
#if 0
<< "["
<< num_bytes << "]"
#endif
<< endl;
}
// already here we know if it any point in going further
// why not return already here if action == -1 and
// num_bytes == 0? (Lgb)
if(keyseq.length > 1 || keyseq.length < -1) {
string buf;
keyseq.print(buf);
owner->getMiniBuffer()->Set(buf);
}
if (action == -1) {
if (keyseq.length < -1) { // unknown key sequence...
string buf;
LyXBell();
keyseq.print(buf);
owner->getMiniBuffer()->Set(_("Unknown sequence:"), buf);
return 0;
}
char isochar = keyseq.getiso();
if (!(state & ControlMask) &&
!(state & Mod1Mask) &&
(isochar && keysym < 0xF000)) {
argument += isochar;
}
if (argument.empty()) {
lyxerr.debug() << "Empty argument!" << endl;
// This can`t possibly be of any use
// so we`ll skip the dispatch.
return 0;
}
}
#if 0
else
if (action == LFUN_SELFINSERT) {
argument = s_r[0];
}
#endif
bool tmp_sc = show_sc;
show_sc = false;
Dispatch(action, argument.c_str());
show_sc = tmp_sc;
return 0;
}
#if FL_REVISION < 89
int LyXFunc::processKeyEvent(XEvent * ev) int LyXFunc::processKeyEvent(XEvent * ev)
{ {
char s_r[10]; char s_r[10];
KeySym keysym_return = 0;
string argument; string argument;
XKeyEvent * keyevent = &ev->xkey; XKeyEvent * keyevent = &ev->xkey;
KeySym keysym_return = 0;
int num_bytes = LyXLookupString(ev, s_r, 10, &keysym_return); int num_bytes = LyXLookupString(ev, s_r, 10, &keysym_return);
s_r[num_bytes] = '\0'; s_r[num_bytes] = '\0';
@ -207,7 +336,8 @@ int LyXFunc::processKeyEvent(XEvent * ev)
<< " and num_bytes is " << " and num_bytes is "
<< num_bytes << num_bytes
<< " the string returned is \"" << " the string returned is \""
<< s_r << '\"' << endl; << s_r << '\"'
<< endl;
} }
// Do nothing if we have nothing (JMarc) // Do nothing if we have nothing (JMarc)
if (num_bytes == 0 && keysym_return == NoSymbol) { if (num_bytes == 0 && keysym_return == NoSymbol) {
@ -268,8 +398,10 @@ int LyXFunc::processKeyEvent(XEvent * ev)
keyseq.print(buf); keyseq.print(buf);
lyxerr << "Key [" lyxerr << "Key ["
<< action << "][" << action << "]["
<< buf << "][" << buf << "]"
<< num_bytes << "]" << endl; << "["
<< num_bytes << "]"
<< endl;
} }
// already here we know if it any point in going further // already here we know if it any point in going further
@ -303,11 +435,12 @@ int LyXFunc::processKeyEvent(XEvent * ev)
// so we`ll skip the dispatch. // so we`ll skip the dispatch.
return 0; return 0;
} }
} else }
else
if (action == LFUN_SELFINSERT) { if (action == LFUN_SELFINSERT) {
argument = s_r[0]; argument = s_r[0];
} }
bool tmp_sc = show_sc; bool tmp_sc = show_sc;
show_sc = false; show_sc = false;
Dispatch(action, argument.c_str()); Dispatch(action, argument.c_str());
@ -315,6 +448,7 @@ int LyXFunc::processKeyEvent(XEvent * ev)
return 0; return 0;
} }
#endif
LyXFunc::func_status LyXFunc::getStatus(int ac) const LyXFunc::func_status LyXFunc::getStatus(int ac) const

View File

@ -6,6 +6,7 @@
#pragma interface #pragma interface
#endif #endif
#include FORMS_H_LOCATION
#include "commandtags.h" #include "commandtags.h"
#include "kbsequence.h" #include "kbsequence.h"
#include "insets/lyxinset.h" #include "insets/lyxinset.h"
@ -48,9 +49,13 @@ public:
/// Same again but for xtl buffers. Still looking for better idea. /// Same again but for xtl buffers. Still looking for better idea.
bool Dispatch(int action, auto_mem_buffer &); bool Dispatch(int action, auto_mem_buffer &);
#if FL_REVISION < 89
/// A keyboard event is processed to execute a lyx action. /// A keyboard event is processed to execute a lyx action.
int processKeyEvent(XEvent * ev); int processKeyEvent(XEvent * ev);
#else
///
int processKeySym(KeySym k, unsigned int state);
#endif
/// ///
func_status getStatus(int ac) const; func_status getStatus(int ac) const;

View File

@ -164,11 +164,13 @@ int LyXLookupString(XEvent * event,
<< "LyXLookupString: found DeadEvent" << endl; << "LyXLookupString: found DeadEvent" << endl;
return 0; return 0;
} }
#if 1
if (XFilterEvent (event, None)) { if (XFilterEvent (event, None)) {
//lyxerr <<"XFilterEvent"); lyxerr[Debug::KEY] <<"XFilterEvent" << endl;
*keysym_return = NoSymbol; *keysym_return = NoSymbol;
return 0; return 0;
} }
#endif
if (event->type != KeyPress) if (event->type != KeyPress)
lyxerr << "LyXLookupString: wrong event type" lyxerr << "LyXLookupString: wrong event type"
<< event->type << endl; << event->type << endl;
@ -178,21 +180,33 @@ int LyXLookupString(XEvent * event,
bytes_buffer, keysym_return, bytes_buffer, keysym_return,
&status_return); &status_return);
switch(status_return) { switch(status_return) {
case XBufferOverflow:
lyxerr[Debug::KEY] << "XBufferOverflow" << endl;
break;
case XLookupBoth: case XLookupBoth:
//lyxerr <<"XLookupBoth"); lyxerr[Debug::KEY] << "XLookupBoth"
<< string(buffer_return, result)
<< endl;
break; break;
case XLookupChars: case XLookupChars:
//lyxerr <<"XLookupChars"); lyxerr[Debug::KEY] << "XLookupChars "
<< string(buffer_return, result)
<< endl;
*keysym_return = NoSymbol; *keysym_return = NoSymbol;
break; break;
case XLookupKeySym: case XLookupKeySym:
//lyxerr <<"XLookupKeySym"); lyxerr[Debug::KEY] << "XLookupKeySym" << endl;
result = 0;
break;
case XLookupNone:
lyxerr[Debug::KEY] << "XLookupNone" << endl;
*keysym_return = NoSymbol;
result = 0; result = 0;
break; break;
default: default:
//lyxerr <<"default"); lyxerr << "Unknown status_return from"
*keysym_return = NoSymbol; " XmbLookupString" << endl;
result = 0;
break; break;
} }
} else { } else {
@ -203,6 +217,7 @@ int LyXLookupString(XEvent * event,
return result; return result;
} }
// This is called after the main window has been destroyed // This is called after the main window has been destroyed
void CloseLyXLookup() void CloseLyXLookup()
{ {

View File

@ -929,7 +929,7 @@ int LyXRC::read(string const & filename)
} }
if ((action = lyxaction.LookupFunc(cmd.c_str()))>= 0) { if ((action = lyxaction.LookupFunc(cmd.c_str()))>= 0) {
if (lyxerr.debugging(Debug::KEY)) { if (lyxerr.debugging(Debug::KBMAP)) {
lyxerr << "RC_BIND: Sequence `" lyxerr << "RC_BIND: Sequence `"
<< seq << "' Command `" << seq << "' Command `"
<< cmd << "' Action `" << cmd << "' Action `"