+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>
* src/frontends/kde/Dialogs.C (Dialogs): added missing dialogs.
Gnome implementation
* src/frontends/gnome/Dialogs.C
- * src/frontends/gnome/Makefile.am: added Print, Insert Url and all other
- dialogs. Copy all unimplemented dialogs from Xforms frontend
+ * src/frontends/gnome/Makefile.am: added Print, Insert Url and
+ all other dialogs. Copy all unimplemented dialogs from Xforms
+ frontend
* src/frontends/gnome/support.c
* src/frontends/gnome/support.h: support files generated by Glade
* config/lyxinclude.m4: cleanup: frontend renamed from gtk to gnome in
configure --help message
- * src/lyx_gui.C: Gnome/Gtk releases control in LyXGUI::runTime() only if
- there are no events pendling in Gnome/Gtk. This enhances the performance of
- menus.
+ * src/lyx_gui.C: Gnome/Gtk releases control in LyXGUI::runTime()
+ only if there are no events pendling in Gnome/Gtk. This enhances
+ the performance of menus.
2000-08-14 Allan Rae <rae@lyx.org>
* src/lyx_gui.C: ditto
* src/menus.[Ch]: ditto
* src/lyx.[Ch]: ditto
- * src/lyx_cb.C: ditto + code from here moved to make screen-font-update.
- And people wonder why progress on GUII is slow. Look at how scattered
- this stuff was! It takes forever just find it all.
+ * src/lyx_cb.C: ditto + code from here moved to make
+ screen-font-update. And people wonder why progress on GUII is
+ slow. Look at how scattered this stuff was! It takes forever
+ just find it all.
* forms/fdfix.sh: Fixup the spacing after commas.
* forms/makefile: Remove date from generated files. Fewer clashes now.
src/frontends/xforms/form_print.C
src/frontends/xforms/FormRef.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/form_tabular.C
src/frontends/xforms/FormToc.C
{
buffer_ = 0;
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;
cursor_timeout.timeout.connect(slot(this,
}
+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)
{
// Only use motion with button 1
///
int scrollDown(long time);
///
+ void workAreaKeyPress(KeySym, unsigned int state);
+ ///
void workAreaMotionNotify(int x, int y, unsigned int state);
///
void workAreaButtonPress(int x, int y, unsigned int button);
}
+#if FL_REVISION < 89
extern "C"
int C_LyXView_KeyPressMask_raw_callback(FL_FORM * fl, void * xev);
+#endif
+
void LyXView::init()
{
autosave_timeout.setTimeout(lyxrc.autosave * 1000);
autosave_timeout.start();
}
-
+
+#if FL_REVISION < 89
// Install the raw callback for keyboard events
fl_register_raw_callback(form_,
KeyPressMask,
C_LyXView_KeyPressMask_raw_callback);
+#endif
intl->InitKeyMapper(lyxrc.use_kbmap);
}
}
+#if FL_REVISION < 89
// This is necessary, since FL_FREE-Objects doesn't get all keypress events
// as FL_KEYBOARD events :-( Matthias 280596
int LyXView::KeyPressMask_raw_callback(FL_FORM * fl, void * xev)
// last_time_pressed is 0, that sinifies an autoreapeat
// at least on my system. It like some feedback from
// 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);
// This purge make f.ex. scrolling stop imidiatly when
// releaseing the PageDown button. The question is if this
{
return LyXView::KeyPressMask_raw_callback(fl, xev);
}
+#endif
// Updates the title of the window with the filename of the current document
///
void UpdateDocumentClassChoice();
public:
+#if FL_REVISION < 89
///
static int KeyPressMask_raw_callback(FL_FORM *, void * xev);
+#endif
/** This callback is run when a close event is sent from the
window manager. */
static int atCloseMainFormCB(FL_FORM *, void *);
PainterBase & Painter::point(int x, int y, LColor::color c)
{
- if (lyxerr.debugging()) {
+ if (lyxerr.debugging(Debug::GUI)) {
if (!Lgb_bug_find_hack)
lyxerr << "point not called from "
"workarea::workhandler\n";
enum line_style ls,
enum line_width lw)
{
- if (lyxerr.debugging()) {
+ if (lyxerr.debugging(Debug::GUI)) {
if (!Lgb_bug_find_hack)
lyxerr << "line not called from "
"workarea::workhandler\n";
enum line_style ls,
enum line_width lw)
{
- if (lyxerr.debugging()) {
+ if (lyxerr.debugging(Debug::GUI)) {
if (!Lgb_bug_find_hack)
lyxerr << "lines not called from "
"workarea::workhandler\n";
enum line_style ls,
enum line_width lw)
{
- if (lyxerr.debugging()) {
+ if (lyxerr.debugging(Debug::GUI)) {
if (!Lgb_bug_find_hack)
lyxerr << "rectangle not called from "
"workarea::workhandler\n";
PainterBase & Painter::fillRectangle(int x, int y, int w, int h,
LColor::color col)
{
- if (lyxerr.debugging()) {
+ if (lyxerr.debugging(Debug::GUI)) {
if (!Lgb_bug_find_hack)
lyxerr << "fillrectangle not called from "
"workarea::workhandler\n";
PainterBase & Painter::fillPolygon(int const * xp, int const * yp, int np,
LColor::color col)
{
- if (lyxerr.debugging()) {
+ if (lyxerr.debugging(Debug::GUI)) {
if (!Lgb_bug_find_hack)
lyxerr <<"fillpolygon not called from "
"workarea::workhandler\n";
unsigned int w, unsigned int h,
int a1, int a2, LColor::color col)
{
- if (lyxerr.debugging()) {
+ if (lyxerr.debugging(Debug::GUI)) {
if (!Lgb_bug_find_hack)
lyxerr << "arc not called from "
"workarea::workhandler\n";
LColor::color col,
enum line_style ls, enum line_width lw)
{
- if (lyxerr.debugging()) {
+ if (lyxerr.debugging(Debug::GUI)) {
if (!Lgb_bug_find_hack)
lyxerr << "segments not called from "
"workarea::workhandler\n";
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)
lyxerr << "workAreaExpose not called from "
"workarea::workhandler\n";
return *this;
}
- if (lyxerr.debugging()) {
+ if (lyxerr.debugging(Debug::GUI)) {
if (!Lgb_bug_find_hack)
lyxerr << "text not called from "
"workarea::workhandler\n";
XDrawString(display, owner.getPixmap(),
gc, tmpx, y, &c, 1);
tmpx += lyxfont::XTextWidth(smallfont, &c, 1);
- //tmpx += lyxfont::width(c, f);
} else {
lyxfont::XSetFont(display, gc, f);
XDrawString(display, owner.getPixmap(),
gc, tmpx, y, &c, 1);
tmpx += lyxfont::XTextWidth(f, &c, 1);
- //tmpx += lyxfont::width(c, f);
}
}
}
PainterBase & Painter::text(int x, int y, XChar2b const * s, int ls,
LyXFont const & f)
{
- if (lyxerr.debugging()) {
+ if (lyxerr.debugging(Debug::GUI)) {
if (!Lgb_bug_find_hack)
lyxerr << "text not called from "
"workarea::workhandler\n";
#pragma interface
#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
using SigC::Signal0;
#endif
#include "debug.h"
#include "support/lstrings.h"
#include "BufferView.h"
+#include "LyXView.h"
+#include "lyxfunc.h"
using std::endl;
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++.
using std::abs;
figinset_canvas = 0;
- if (lyxerr.debugging())
+ if (lyxerr.debugging(Debug::GUI))
lyxerr << "Creating work area: +"
<< xpos << '+' << ypos << ' '
<< width << 'x' << height << endl;
fl_set_object_gravity(obj, NorthWestGravity, NorthWestGravity);
// a box
- if (lyxerr.debugging())
+ if (lyxerr.debugging(Debug::GUI))
lyxerr << "\tbackground box: +"
<< xpos << '+' << ypos << ' '
<< width - 15 << 'x' << height << endl;
// We add this object as late as possible to avoit problems
// with drawing.
- if (lyxerr.debugging())
+ if (lyxerr.debugging(Debug::GUI))
lyxerr << "\tfree object: +"
<< xpos + bw << '+' << ypos + bw << ' '
<< width - 15 - 2 * bw << 'x'
width - 15 - 2 * bw, // scrollbarwidth
height - 2 * bw, "",
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
to the work_area_handler. */
fl_set_object_boxtype(obj,FL_DOWN_BOX);
if (workareapixmap)
XFreePixmap(fl_display, workareapixmap);
- if (lyxerr.debugging())
+ if (lyxerr.debugging(Debug::GUI))
lyxerr << "Creating pixmap ("
<< width << 'x' << height << ")" << endl;
width,
height,
fl_get_visual_depth());
- if (lyxerr.debugging())
+ if (lyxerr.debugging(Debug::GUI))
lyxerr << "\tpixmap=" << workareapixmap << endl;
}
int WorkArea::work_area_handler(FL_OBJECT * ob, int event,
FL_Coord, FL_Coord ,
- int /*key*/, void * xev)
+ int key, void * xev)
{
static int x_old = -1;
static int y_old = -1;
if (!area->work_area ||
!area->work_area->form->visible)
return 1;
- lyxerr.debug() << "Workarea event: DRAW" << endl;
+ lyxerr[Debug::GUI] << "Workarea event: DRAW" << endl;
area->createPixmap(area->workWidth(), area->height());
Lgb_bug_find_hack = true;
- //workAreaExpose();
- area->owner_->workAreaExpose();
+ area->workAreaExpose();
Lgb_bug_find_hack = false;
break;
case FL_PUSH:
if (!ev) break;
// Should really have used xbutton.state
- lyxerr.debug() << "Workarea event: PUSH" << endl;
- //workAreaButtonPress(ev->xbutton.x - ob->x,
- // ev->xbutton.y - ob->y,
- // ev->xbutton.button);
-
- area->owner_->workAreaButtonPress(ev->xbutton.x - ob->x,
- ev->xbutton.y - ob->y,
- ev->xbutton.button);
+ lyxerr[Debug::GUI] << "Workarea event: PUSH" << endl;
+ area->workAreaButtonPress(ev->xbutton.x - ob->x,
+ ev->xbutton.y - ob->y,
+ ev->xbutton.button);
+ //area->workAreaKeyPress(XK_Pointer_Button1, ev->xbutton.state);
break;
case FL_RELEASE:
if (!ev) break;
// Should really have used xbutton.state
- lyxerr.debug() << "Workarea event: RELEASE" << endl;
- //workAreaButtonRelease(ev->xbutton.x - ob->x,
- // ev->xbutton.y - ob->y,
- // ev->xbutton.button);
- area->owner_->workAreaButtonRelease(ev->xbutton.x - ob->x,
- ev->xbutton.y - ob->y,
- ev->xbutton.button);
+ lyxerr[Debug::GUI] << "Workarea event: RELEASE" << endl;
+ area->workAreaButtonRelease(ev->xbutton.x - ob->x,
+ ev->xbutton.y - ob->y,
+ ev->xbutton.button);
break;
case FL_MOUSE:
if (!ev || ! area->scrollbar) break;
ev->xmotion.y != y_old ||
fl_get_scrollbar_value(area->scrollbar) != scrollbar_value_old
) {
- lyxerr.debug() << "Workarea event: MOUSE" << endl;
- //workAreaMotionNotify(ev->xmotion.x - ob->x,
- // ev->xmotion.y - ob->y,
- // ev->xbutton.state);
-
- area->owner_->workAreaMotionNotify(ev->xmotion.x - ob->x,
- ev->xmotion.y - ob->y,
- ev->xbutton.state);
+ lyxerr[Debug::GUI] << "Workarea event: MOUSE" << endl;
+ area->workAreaMotionNotify(ev->xmotion.x - ob->x,
+ ev->xmotion.y - ob->y,
+ ev->xbutton.state);
}
break;
- // Done by the raw callback:
- // case FL_KEYBOARD: WorkAreaKeyPress(ob, 0,0,0,ev,0); break;
+ case FL_KEYBOARD:
+ {
+ 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:
- lyxerr.debug() << "Workarea event: FOCUS" << endl;
- //workAreaFocus();
+ lyxerr[Debug::GUI] << "Workarea event: FOCUS" << endl;
+ area->workAreaFocus();
break;
case FL_UNFOCUS:
- lyxerr.debug() << "Workarea event: UNFOCUS" << endl;
- //workAreaUnfocus();
+ lyxerr[Debug::GUI] << "Workarea event: UNFOCUS" << endl;
+ area->workAreaUnfocus();
break;
case FL_ENTER:
- lyxerr.debug() << "Workarea event: ENTER" << endl;
- //workAreaEnter();
- area->owner_->enterView();
+ lyxerr[Debug::GUI] << "Workarea event: ENTER" << endl;
+ area->workAreaEnter();
break;
case FL_LEAVE:
- lyxerr.debug() << "Workarea event: LEAVE" << endl;
- //workAreaLeave();
- area->owner_->leaveView();
+ lyxerr[Debug::GUI] << "Workarea event: LEAVE" << endl;
+ area->workAreaLeave();
break;
case FL_DBLCLICK:
if (!ev) break;
- lyxerr.debug() << "Workarea event: DBLCLICK" << endl;
- //workAreaDoubleClick(ev->xbutton.x - ob->x,
- // ev->xbutton.y - ob->y,
- // ev->xbutton.button);
- area->owner_->doubleClick(ev->xbutton.x - ob->x,
- ev->xbutton.y - ob->y,
- ev->xbutton.button);
+ lyxerr[Debug::GUI] << "Workarea event: DBLCLICK" << endl;
+ area->workAreaDoubleClick(ev->xbutton.x - ob->x,
+ ev->xbutton.y - ob->y,
+ ev->xbutton.button);
break;
case FL_TRPLCLICK:
if (!ev) break;
- lyxerr.debug() << "Workarea event: TRPLCLICK" << endl;
- //workAreaTripleClick(ev->xbutton.x - ob->x,
- // ev->xbutton.y - ob->y,
- // ev->xbutton.button);
- area->owner_->tripleClick(ev->xbutton.x - ob->x,
- ev->xbutton.y - ob->y,
- ev->xbutton.button);
+ lyxerr[Debug::GUI] << "Workarea event: TRPLCLICK" << endl;
+ area->workAreaTripleClick(ev->xbutton.x - ob->x,
+ ev->xbutton.y - ob->y,
+ ev->xbutton.button);
break;
case FL_OTHER:
if (!ev) break;
- lyxerr.debug() << "Workarea event: OTHER" << endl;
+ lyxerr[Debug::GUI] << "Workarea event: OTHER" << endl;
break;
}
#include <utility>
-//#include <sigc++/signal_system.h>
+#include <sigc++/signal_system.h>
#include FORMS_H_LOCATION
#include "Painter.h"
-//#ifdef SIGC_CXX_NAMESPACES
-//using SigC::Signal0;
-//using SigC::Signal3;
-//#endif
+#ifdef SIGC_CXX_NAMESPACES
+using SigC::Signal0;
+using SigC::Signal2;
+using SigC::Signal3;
+#endif
class BufferView;
BufferView * owner() const { return owner_; }
// Signals
- //
- // Signal0<void> workAreaExpose;
- //
- // Signal3<void, int, int, unsigned int> workAreaButtonPress;
- //
- // Signal3<void, int, int, unsigned int> workAreaButtonRelease;
- //
- // Signal3<void, int, int, unsigned int> workAreaMotionNotify;
- //
- // Signal0<void> workAreaFocus;
- //
- // Signal0<void> workAreaUnfocus;
- //
- // Signal0<void> workAreaEnter;
- //
- // Signal0<void> workAreaLeave;
- //
- // Signal3<void, int, int, unsigned int> workAreaDoubleClick;
- //
- // Signal3<void, int, int, unsigned int> workAreaTripleClick;
+ ///
+ Signal0<void> workAreaExpose;
+ ///
+ Signal2<void, KeySym, unsigned int> workAreaKeyPress;
+ ///
+ Signal3<void, int, int, unsigned int> workAreaButtonPress;
+ ///
+ Signal3<void, int, int, unsigned int> workAreaButtonRelease;
+ ///
+ Signal3<void, int, int, unsigned int> workAreaMotionNotify;
+ ///
+ Signal0<void> workAreaFocus;
+ ///
+ Signal0<void> workAreaUnfocus;
+ ///
+ Signal0<void> workAreaEnter;
+ ///
+ Signal0<void> workAreaLeave;
+ ///
+ Signal3<void, int, int, unsigned int> workAreaDoubleClick;
+ ///
+ Signal3<void, int, int, unsigned int> workAreaTripleClick;
private:
///
void createPixmap(int, int);
*/
class FormCitation : public FormCommand {
public:
- /**@name Constructors and Destructors */
- //@{
///
FormCitation(LyXView *, Dialogs *);
///
~FormCitation();
- //@}
-
private:
///
enum State {
+ ///
DOWN,
+ ///
UP,
+ ///
DELETE,
+ ///
ADD,
+ ///
BIBBRSR,
+ ///
CITEBRSR,
+ ///
ON,
+ ///
OFF
};
/// Build the dialog
public:
/// Constructor
FormCommand(LyXView *, Dialogs *, string const & );
-
///
static int WMHideCB(FL_FORM *, void *);
///
*/
class FormDocument : public DialogBase, public noncopyable {
public:
- /**@name Constructors and Destructors */
- //@{
/// #FormDocument x(Communicator ..., Popups ...);#
FormDocument(LyXView *, Dialogs *);
///
~FormDocument();
+ ///
void SetDocumentClassChoice(vector<string> const & choices);
- //@}
-
- /**@name Real per-instance Callback Methods */
- //@{
+ ///
static int WMHideCB(FL_FORM *, void *);
+ ///
static void OKCB(FL_OBJECT *, long);
+ ///
static void CancelCB(FL_OBJECT *, long);
+ ///
static void ApplyCB(FL_OBJECT *, long);
+ ///
static void InputCB(FL_OBJECT *, long);
- //@}
-
+ ///
enum EnumPopupStatus {
+ ///
POPUP_UNMODIFIED,
+ ///
POPUP_MODIFIED,
+ ///
POPUP_READONLY
};
private:
+ ///
void DeactivateDocumentButtons();
+ ///
void ActivateDocumentButtons();
+ ///
void EnableDocumentLayout();
+ ///
void DisableDocumentLayout();
+ ///
void CheckDocumentInput(FL_OBJECT * ob, long);
+ ///
void ChoiceBulletSize(FL_OBJECT * ob, long);
+ ///
void InputBulletLaTeX(FL_OBJECT * ob, long);
+ ///
void BulletDepth(FL_OBJECT * ob, long);
+ ///
void BulletPanel(FL_OBJECT * ob, long);
+ ///
void BulletBMTable(FL_OBJECT * ob, long);
+ ///
void checkMarginValues();
-
- /**@name Real per-instance Callback Methods */
- //@{
+ ///
static void DocumentInputCB(FL_OBJECT * ob, long);
+ ///
static void ChoiceBulletSizeCB(FL_OBJECT * ob, long);
+ ///
static void InputBulletLaTeXCB(FL_OBJECT * ob, long);
+ ///
static void BulletDepthCB(FL_OBJECT * ob, long);
+ ///
static void BulletPanelCB(FL_OBJECT * ob, long);
+ ///
static void BulletBMTableCB(FL_OBJECT * ob, long);
- //@}
-
- /**@name Slot Methods */
- //@{
+
/// Create the popup if necessary, update it and display it.
void show();
/// Hide the popup.
void hide();
/// Update the popup.
void update();
+ ///
void paper_update();
+ ///
void class_update();
+ ///
void language_update();
+ ///
void options_update();
+ ///
void bullets_update();
/// Apply from popup
void apply();
+ ///
void paper_apply();
+ ///
bool class_apply();
+ ///
bool language_apply();
+ ///
bool options_apply();
+ ///
void bullets_apply();
/// Cancel from popup
void cancel();
- //@}
/// Build the popup
void build();
- ///
/// Explicitly free the popup.
void free();
/// Typedefinitions from the fdesign produced Header file
FD_form_tabbed_document * build_tabbed_document();
+ ///
FD_form_doc_paper * build_doc_paper();
+ ///
FD_form_doc_class * build_doc_class();
+ ///
FD_form_doc_language * build_doc_language();
+ ///
FD_form_doc_options * build_doc_options();
+ ///
FD_form_doc_bullet * build_doc_bullet();
- /**@name Private Data */
- //@{
/// Real GUI implementation.
FD_form_tabbed_document * dialog_;
+ ///
FD_form_doc_paper * paper_;
+ ///
FD_form_doc_class * class_;
+ ///
FD_form_doc_language * language_;
+ ///
FD_form_doc_options * options_;
+ ///
FD_form_doc_bullet * bullets_;
/// Which LyXView do we belong to?
LyXView * lv_;
+ ///
Dialogs * d_;
/// Update connection.
Connection u_;
Connection h_;
/// has form contents changed? Used to control OK/Apply
EnumPopupStatus status;
- //@}
- int
- ActCell, Confirmed,
- current_bullet_panel, current_bullet_depth;
+ ///
+ int ActCell;
+ ///
+ int Confirmed;
+ ///
+ int current_bullet_panel;
+ ///
+ int current_bullet_depth;
///
FL_OBJECT * fbullet;
///
#include "LString.h"
#include "frontends/DialogBase.h"
-//#include "form_graphics.h"
#include "RadioButtonGroup.h"
+#include "support/utility.hpp"
#ifdef __GNUG__
#pragma interface
/** This class provides an XForms implementation of the FormGraphics Dialog.
*/
-class FormGraphics: public DialogBase
-{
+class FormGraphics: public DialogBase, public noncopyable {
public:
/// #FormGraphics x(LyXFunc ..., Dialogs ...);#
FormGraphics(LyXView *, Dialogs *);
static void InputCB(FL_OBJECT *, long);
private:
- ///
- FormGraphics()
-: widthButtons(5), heightButtons(4), displayButtons(4) {}
- //
-FormGraphics(FormGraphics const &) : DialogBase() {}
-
/// The maximum digits for the image width (cm, inch, percent)
enum {
///
FILENAME_MAXCHARS = 1024
};
- /**@name Slot Methods */
- //@{
/// Save the active inset and show the dialog.
void showDialog(InsetGraphics * inset);
/// Create the dialog if necessary, update it and display it.
void hide();
/// Update the dialog
void update();
- //@}
- /**@name Callback methods */
- //@{
/// Apply the changes to the inset.
void apply();
/// Verify that the input is correct. If not disable ok/apply buttons.
void input();
/// Open the file browse dialog to select an image file.
void browse();
- //@}
/// Build the dialog
void build();
/// Display a file browser dialog and return the file chosen.
string browseFile(string const & filename);
- /**@name Data */
- //@{
/// Real GUI implementation.
FD_form_graphics * dialog_;
/** Which LyXFunc do we use?
Connection u_;
/// Last used figure path
string last_image_path;
- //@}
-
-}
-;
+};
#endif
*/
class FormIndex : public FormCommand {
public:
- /**@name Constructors and Destructors */
- //@{
///
FormIndex(LyXView *, Dialogs *);
///
~FormIndex();
- //@}
-
private:
/// Build the dialog
virtual void build();
virtual FL_FORM * const form() const;
///
FD_form_index * build_index();
-
-
///
- int minh, minw;
+ int minh;
+ ///
+ int minw;
/// Real GUI implementation.
FD_form_index * dialog_;
};
*/
class FormPreferences : public DialogBase, public noncopyable {
public:
- /**@name Constructors and Destructors */
- //@{
/// #FormPreferences x(LyXFunc ..., Dialogs ...);#
FormPreferences(LyXView *, Dialogs *);
///
~FormPreferences();
- //@}
- /**@name Real per-instance Callback Methods */
- //@{
+ ///
static int WMHideCB(FL_FORM *, void *);
+ ///
static void OKCB(FL_OBJECT *, long);
+ ///
static void ApplyCB(FL_OBJECT *, long);
+ ///
static void CancelCB(FL_OBJECT *, long);
+ ///
static void InputCB(FL_OBJECT *, long);
+ ///
static void RestoreCB(FL_OBJECT *, long);
- //@}
-
private:
- /**@name Slot Methods */
- //@{
/// Create the dialog if necessary, update it and display it.
void show();
/// Hide the dialog.
void hide();
/// Update the dialog.
void update();
- //@}
- /**@name Dialog internal methods */
- //@{
/// Apply from dialog
void apply();
/// Filter the inputs -- return true if entries are valid
FD_form_printer * build_printer();
///
FD_form_paths * build_paths();
- //@}
- /**@name Private Data */
- //@{
/// Real GUI implementation.
FD_form_preferences * dialog_;
///
/// Hide connection.
Connection h_;
/// Overcome a dumb xforms sizing bug
- int minw_, minh_;
+ int minw_;
+ ///
+ int minh_;
///
ButtonController<PreferencesPolicy> * bc_;
- //@}
};
#endif
*/
class FormPrint : public DialogBase, public noncopyable {
public:
- /**@name Constructors and Destructors */
- //@{
/// #FormPrint x(LyXFunc ..., Dialogs ...);#
FormPrint(LyXView *, Dialogs *);
///
~FormPrint();
- //@}
- /**@name Real per-instance Callback Methods */
- //@{
+ ///
static int WMHideCB(FL_FORM *, void *);
+ ///
static void OKCB(FL_OBJECT *, long);
+ ///
static void ApplyCB(FL_OBJECT *, long);
+ ///
static void CancelCB(FL_OBJECT *, long);
+ ///
static void InputCB(FL_OBJECT *, long);
- //@}
-
private:
- /**@name Slot Methods */
- //@{
/// Create the dialog if necessary, update it and display it.
void show();
/// Hide the dialog.
void hide();
/// Update the dialog.
void update();
- //@}
- /**@name Dialog internal methods */
- //@{
/// Apply from dialog
void apply();
/// Filter the inputs
void build();
///
FD_form_print * build_print();
- //@}
- /**@name Private Data */
- //@{
/// Real GUI implementation.
FD_form_print * dialog_;
/// Which LyXView do we belong to?
Connection u_;
/// Hide connection.
Connection h_;
- //@}
};
#endif
*/
class FormRef : public FormCommand {
public:
- /**@name Constructors and Destructors */
- //@{
///
FormRef(LyXView *, Dialogs *);
///
~FormRef();
- //@}
-
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
virtual void build();
*/
class FormTabular : public DialogBase, public noncopyable {
public:
- /**@name Constructors and Destructors */
- //@{
/// #FormTabular x(LyXFunc ..., Dialogs ...);#
FormTabular(LyXView *, Dialogs *);
///
~FormTabular();
- //@}
-
- /**@name Real per-instance Callback Methods */
- //@{
+ ///
static int WMHideCB(FL_FORM *, void *);
+ ///
static void CloseCB(FL_OBJECT *, long);
+ ///
static void OKCB(FL_OBJECT *, long);
+ ///
static void CancelCB(FL_OBJECT *, long);
+ ///
static void ApplyCB(FL_OBJECT *, long);
+ ///
static void InputCB(FL_OBJECT *, long);
- //@}
private:
- /**@name Slot Methods */
- //@{
/// Create the dialog if necessary, update it and display it.
void show();
+ ///
void show_create();
+ ///
void showInset(InsetTabular *);
/// Hide the dialog.
void hide();
+ ///
void hide_create();
+ ///
void hideInset(InsetTabular *);
/// Update the dialog.
void update();
+ ///
void updateInset(InsetTabular *);
+ ///
bool local_update(bool);
- //@}
- /**@name Dialog internal methods */
- //@{
/// Apply from dialog
void apply_create();
/// Build the dialog
FD_form_longtable_options * build_longtable_options();
///
FD_form_create_tabular * build_create_tabular();
- //@}
- /**@name Private Data */
- //@{
/// Real GUI implementation.
FD_form_tabular * dialog_;
///
FD_form_longtable_options * longtable_options_;
///
FD_form_create_tabular * create_tabular_;
- //
+
/// Which LyXView do we belong to?
LyXView * lv_;
///
InsetTabular * inset_;
///
int actCell_;
- //@}
};
#endif
*/
class FormToc : public FormCommand {
public:
- /**@name Constructors and Destructors */
- //@{
///
FormToc(LyXView *, Dialogs *);
///
~FormToc();
-
private:
/// Build the dialog
virtual void build();
*/
class FormUrl : public FormCommand {
public:
- /**@name Constructors and Destructors */
- //@{
///
FormUrl(LyXView *, Dialogs *);
///
~FormUrl();
- //@}
-
private:
/// Build the dialog
virtual void build();
virtual FL_FORM * const form() const;
///
FD_form_url * build_url();
-
///
- int minh, minw;
+ int minh;
+ ///
+ int minw;
/// Real GUI implementation.
FD_form_url * dialog_;
};
///
static void MenuCallback(FL_OBJECT *, long);
- /// Add to "menu" the list of last opened files
- /// (add "extra_label" to the last entry)
+ /** Add to "menu" the list of last opened files
+ (add "extra_label" to the last entry)
+ */
void add_lastfiles(int menu, string const & extra_label,
std::vector<int> & smn, StrPool & strpool);
- /// Add to "menu" the list of opened documents
- /// (add "extra_label" to the last entry)
+ /** Add to "menu" the list of opened documents
+ (add "extra_label" to the last entry)
+ */
void add_documents(int menu, string const & extra_label,
std::vector<int> & smn, StrPool & strpool);
///
std::vector<int> & smn, StrPool & strpool);
/// update the state of the menuitems
- void update() { }
+ void update() {}
private:
///
#pragma interface
#endif
-#include <vector>
-#include <utility>
+#include <vector>
+#include <utility>
+
using std::vector;
using std::pair;
#include FORMS_H_LOCATION
-class RadioButtonGroup
-{
+///
+class RadioButtonGroup {
public:
/// Constructor. Allocate space for 'n' items in the group.
RadioButtonGroup(unsigned n = 5) : map(n) {};
- /// Destructor. Cleans up.
- ~RadioButtonGroup() {};
/// Register a radio button with it's corresponding value.
void registerRadioButton(FL_OBJECT *button, int value);
int getButton();
private:
- typedef pair < FL_OBJECT *, int > ButtonValuePair;
- typedef vector < ButtonValuePair > ButtonValueMap;
+ ///
+ typedef pair<FL_OBJECT *, int> ButtonValuePair;
+ ///
+ typedef vector<ButtonValuePair> ButtonValueMap;
+ ///
ButtonValueMap map;
};
void set(bool doingmain = false);
/** 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();
/// add a new button to the toolbar.
void add(int , bool doclean = true);
///
Combox * combox;
/// Starting position
- int sxpos, sypos;
+ int sxpos;
+ ///
+ int sypos;
///
int xpos;
///
/// removes all toolbar buttons from the toolbar.
void clean();
- /** more...
- */
+ /// more...
void reset();
- /** more...
- */
+ /// more...
void lightReset();
};
#endif
#include "graphics/Renderer.h"
+///
class EPS_Renderer : public Renderer {
public:
/// c-tor.
#include "GraphicsCacheItem.h"
#include "support/utility.hpp"
-/** GraphicsCache is the manager of the image cache, it is responsible to
- create the GraphicsCacheItem's and maintain them.
+/** GraphicsCache is the manager of the image cache.
+ It is responsible of create the GraphicsCacheItem's and maintain them.
GraphicsCache is a singleton class, there should be only one instance of
it at any moment.
/// Return a pixmap that can be displayed on X server.
Pixmap getImage() const;
-
+ ///
enum ImageStatus {
+ ///
Loading = 1,
+ ///
ErrorConverting,
+ ///
ErrorReading,
+ ///
Loaded
};
/// Is the pixmap ready for display?
ImageStatus getImageStatus() const;
- /// Get a notification when the image conversion is done.
- /// used by an internal callback mechanism.
+ /** Get a notification when the image conversion is done.
+ used by an internal callback mechanism.
+ */
void imageConverted(int retval);
-
private:
- /// Private c-tor so that only GraphicsCache can create an instance.
- GraphicsCacheItem();
+ /// Private c-tor so that only GraphicsCache can create an instance.
+ GraphicsCacheItem();
/// internal copy mechanism.
void copy(GraphicsCacheItem const &);
/// Set the filename this item will be pointing too.
bool setFilename(string const & filename);
- ///
- friend class GraphicsCache;
+ ///
+ friend class GraphicsCache;
+ ///
GraphicsCacheItem_pimpl * pimpl;
- /// The filename we refer too, this is used when removing ourselves
- /// from the cache.
+ /** The filename we refer too.
+ This is used when removing ourselves from the cache.
+ */
string filename_;
};
#include "X11/Xlib.h"
#include "support/utility.hpp"
-/** Renderer is a base class that is used to take an image format, and render
- * it into a Pixmap in order to be able to display it later on in LyX.
- * Essentially it's job is to load an image format and create a Pixmap from it.
- * It also needs to do various transforms on the image, like Rotation,
- * Resize and color reduction.
+/** Renderer is a base class that is used to take an image format, and
+ render it into a Pixmap in order to be able to display it later on
+ in LyX. Essentially it's job is to load an image format and create
+ a Pixmap from it. It also needs to do various transforms on the
+ image, like Rotation, Resize and color reduction.
*/
class Renderer : public noncopyable {
public:
/// Set the pixmap.
void setPixmap(Pixmap pixmap, unsigned int width, unsigned int height);
-
+ ///
string const & getFilename() const;
private:
using std::endl;
using std::ios;
+
XPM_Renderer::XPM_Renderer()
: Renderer()
{}
-XPM_Renderer::~XPM_Renderer()
-{}
bool XPM_Renderer::renderImage()
{
return true;
}
+
bool XPM_Renderer::isImageFormatOK(string const & filename) const
{
std::ifstream is(filename.c_str(), ios::in);
#include "graphics/Renderer.h"
+///
class XPM_Renderer : public Renderer {
public:
/// c-tor.
XPM_Renderer();
- /// d-tor.
- virtual ~XPM_Renderer();
/// Load the XPM image and create a pixmap out of it.
virtual bool renderImage();
if (idx + 1 == seq->length) {
string buf;
seq->print(buf, true);
- lyxerr[Debug::KEY]
+ lyxerr[Debug::KBMAP]
<< "Warning: New binding for '"
<< buf
<< "' is overriding old binding..."
}
+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)
{
char s_r[10];
+ KeySym keysym_return = 0;
string argument;
XKeyEvent * keyevent = &ev->xkey;
- KeySym keysym_return = 0;
-
int num_bytes = LyXLookupString(ev, s_r, 10, &keysym_return);
s_r[num_bytes] = '\0';
<< " and num_bytes is "
<< num_bytes
<< " the string returned is \""
- << s_r << '\"' << endl;
+ << s_r << '\"'
+ << endl;
}
// Do nothing if we have nothing (JMarc)
if (num_bytes == 0 && keysym_return == NoSymbol) {
keyseq.print(buf);
lyxerr << "Key ["
<< action << "]["
- << buf << "]["
- << num_bytes << "]" << endl;
+ << buf << "]"
+ << "["
+ << num_bytes << "]"
+ << endl;
}
// already here we know if it any point in going further
// so we`ll skip the dispatch.
return 0;
}
- } else
+ }
+ else
if (action == LFUN_SELFINSERT) {
argument = s_r[0];
}
-
+
bool tmp_sc = show_sc;
show_sc = false;
Dispatch(action, argument.c_str());
return 0;
}
+#endif
LyXFunc::func_status LyXFunc::getStatus(int ac) const
#pragma interface
#endif
+#include FORMS_H_LOCATION
#include "commandtags.h"
#include "kbsequence.h"
#include "insets/lyxinset.h"
/// Same again but for xtl buffers. Still looking for better idea.
bool Dispatch(int action, auto_mem_buffer &);
+#if FL_REVISION < 89
/// A keyboard event is processed to execute a lyx action.
int processKeyEvent(XEvent * ev);
-
+#else
+ ///
+ int processKeySym(KeySym k, unsigned int state);
+#endif
///
func_status getStatus(int ac) const;
<< "LyXLookupString: found DeadEvent" << endl;
return 0;
}
+#if 1
if (XFilterEvent (event, None)) {
- //lyxerr <<"XFilterEvent");
+ lyxerr[Debug::KEY] <<"XFilterEvent" << endl;
*keysym_return = NoSymbol;
return 0;
}
+#endif
if (event->type != KeyPress)
lyxerr << "LyXLookupString: wrong event type"
<< event->type << endl;
bytes_buffer, keysym_return,
&status_return);
switch(status_return) {
+ case XBufferOverflow:
+ lyxerr[Debug::KEY] << "XBufferOverflow" << endl;
+ break;
case XLookupBoth:
- //lyxerr <<"XLookupBoth");
+ lyxerr[Debug::KEY] << "XLookupBoth"
+ << string(buffer_return, result)
+ << endl;
break;
case XLookupChars:
- //lyxerr <<"XLookupChars");
+ lyxerr[Debug::KEY] << "XLookupChars "
+ << string(buffer_return, result)
+ << endl;
+
*keysym_return = NoSymbol;
break;
case XLookupKeySym:
- //lyxerr <<"XLookupKeySym");
+ lyxerr[Debug::KEY] << "XLookupKeySym" << endl;
result = 0;
break;
- default:
- //lyxerr <<"default");
+ case XLookupNone:
+ lyxerr[Debug::KEY] << "XLookupNone" << endl;
*keysym_return = NoSymbol;
result = 0;
break;
+ default:
+ lyxerr << "Unknown status_return from"
+ " XmbLookupString" << endl;
+ break;
}
} else {
result = XLookupString(&event->xkey, buffer_return,
return result;
}
+
// This is called after the main window has been destroyed
void CloseLyXLookup()
{
}
if ((action = lyxaction.LookupFunc(cmd.c_str()))>= 0) {
- if (lyxerr.debugging(Debug::KEY)) {
+ if (lyxerr.debugging(Debug::KBMAP)) {
lyxerr << "RC_BIND: Sequence `"
<< seq << "' Command `"
<< cmd << "' Action `"