mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-29 21:05:12 +00:00
Remove work-arounds for xforms < 0.89.5.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5817 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
d1ba21bfea
commit
3e8298b9a4
@ -1,3 +1,19 @@
|
|||||||
|
2002-12-13 Angus Leeming <leeming@lyx.org>
|
||||||
|
|
||||||
|
* FormBase.C:
|
||||||
|
* Menubar_pimpl.C:
|
||||||
|
* Tooltips.[Ch]:
|
||||||
|
* XFormsView.C:
|
||||||
|
* XWorkArea.C:
|
||||||
|
* lyx_gui.C:
|
||||||
|
* xforms_resize.C: remove work-arounds for xforms < 0.89.5.
|
||||||
|
|
||||||
|
* lyxlookup.[Ch]: removed.
|
||||||
|
|
||||||
|
* Makefile.am: associated change.
|
||||||
|
|
||||||
|
* combox.C: add block #ifdef FL_VERSION < 1
|
||||||
|
|
||||||
2002-12-16 Michael Schmitt <Michael.Schmitt@teststep.org>
|
2002-12-16 Michael Schmitt <Michael.Schmitt@teststep.org>
|
||||||
|
|
||||||
* FormGraphics.C (build): correct string for boost::format.
|
* FormGraphics.C (build): correct string for boost::format.
|
||||||
|
@ -32,15 +32,11 @@
|
|||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
||||||
#if FL_VERSION > 0 || FL_REVISION >= 89
|
|
||||||
|
|
||||||
// These should be in forms.h but aren't
|
// These should be in forms.h but aren't
|
||||||
void fl_show_tooltip(const char *, int, int);
|
void fl_show_tooltip(const char *, int, int);
|
||||||
|
|
||||||
void fl_hide_tooltip();
|
void fl_hide_tooltip();
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Callback function invoked by xforms when the dialog is closed by the
|
// Callback function invoked by xforms when the dialog is closed by the
|
||||||
// window manager.
|
// window manager.
|
||||||
static int C_WMHideCB(FL_FORM * form, void *);
|
static int C_WMHideCB(FL_FORM * form, void *);
|
||||||
@ -170,7 +166,7 @@ void FormBase::show()
|
|||||||
|
|
||||||
void FormBase::hide()
|
void FormBase::hide()
|
||||||
{
|
{
|
||||||
#if FL_VERSION > 0 || FL_REVISION >= 89
|
#if FL_VERSION < 1
|
||||||
// Does no harm if none is visible and ensures that the tooltip form
|
// Does no harm if none is visible and ensures that the tooltip form
|
||||||
// is hidden should the dialog be closed from the keyboard.
|
// is hidden should the dialog be closed from the keyboard.
|
||||||
fl_hide_tooltip();
|
fl_hide_tooltip();
|
||||||
@ -259,14 +255,20 @@ void FormBase::PrehandlerCB(FL_OBJECT * ob, int event, int key)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
switch (event) {
|
||||||
|
case FL_ENTER:
|
||||||
|
case FL_LEAVE:
|
||||||
|
if (message_widget_) {
|
||||||
|
// Post feedback as the mouse enters the object,
|
||||||
|
// remove it as the mouse leaves.
|
||||||
|
MessageCB(ob, event);
|
||||||
|
}
|
||||||
|
|
||||||
if (event != FL_ENTER && event != FL_LEAVE)
|
#if FL_VERSION < 1
|
||||||
return;
|
|
||||||
|
|
||||||
if (ob->objclass == FL_TABFOLDER) {
|
if (ob->objclass == FL_TABFOLDER) {
|
||||||
// This prehandler is used to work-around an xforms bug and
|
// This prehandler is used to work-around an xforms
|
||||||
// ensures that the form->x, form->y coords of the active
|
// bug and ensures that the form->x, form->y coords of
|
||||||
// tabfolder are up to date.
|
// the active tabfolder are up to date.
|
||||||
|
|
||||||
// The tabfolder itself can be very narrow, being just
|
// The tabfolder itself can be very narrow, being just
|
||||||
// the visible border to the tabs.
|
// the visible border to the tabs.
|
||||||
@ -278,27 +280,30 @@ void FormBase::PrehandlerCB(FL_OBJECT * ob, int event, int key)
|
|||||||
fl_get_winorigin(folder->window,
|
fl_get_winorigin(folder->window,
|
||||||
&(folder->x), &(folder->y));
|
&(folder->x), &(folder->y));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if (message_widget_) {
|
|
||||||
// Post feedback as the mouse enters the object,
|
|
||||||
// remove it as the mouse leaves.
|
|
||||||
MessageCB(ob, event);
|
|
||||||
}
|
|
||||||
|
|
||||||
#if FL_VERSION > 0 || FL_REVISION >= 89
|
|
||||||
// Tooltips are not displayed on browser widgets due to an xforms' bug.
|
|
||||||
// This is a work-around:
|
|
||||||
if (ob->objclass == FL_BROWSER) {
|
|
||||||
if (event == FL_ENTER && ob->tooltip && *(ob->tooltip)) {
|
|
||||||
fl_show_tooltip(ob->tooltip, ob->form->x + ob->x,
|
|
||||||
ob->form->y + ob->y + ob->h + 1);
|
|
||||||
} else if (event == FL_LEAVE) {
|
|
||||||
fl_hide_tooltip();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Tooltips are not displayed on browser widgets due to an xforms' bug.
|
||||||
|
// I have a fix, but it's not yet in the xforms sources.
|
||||||
|
// This is a work-around:
|
||||||
|
switch (event) {
|
||||||
|
case FL_ENTER:
|
||||||
|
if (ob->objclass == FL_BROWSER &&
|
||||||
|
ob->tooltip && *(ob->tooltip)) {
|
||||||
|
int const x = ob->form->x + ob->x;
|
||||||
|
int const y = ob->form->y + ob->y + ob->h + 1;
|
||||||
|
fl_show_tooltip(ob->tooltip, x, y);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case FL_LEAVE:
|
||||||
|
case FL_PUSH:
|
||||||
|
case FL_KEYPRESS:
|
||||||
|
if (ob->objclass == FL_BROWSER)
|
||||||
|
fl_hide_tooltip();
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -11,11 +11,6 @@ SUBDIRS = forms
|
|||||||
|
|
||||||
EXTRA_DIST = xformsImage.C xformsImage.h
|
EXTRA_DIST = xformsImage.C xformsImage.h
|
||||||
|
|
||||||
if USE_BASIC_IMAGE_LOADER
|
|
||||||
else
|
|
||||||
XFORMSIMAGE = xformsImage.C xformsImage.h
|
|
||||||
endif
|
|
||||||
|
|
||||||
# Alphabetical order please. It makes it easier to figure out what's missing.
|
# Alphabetical order please. It makes it easier to figure out what's missing.
|
||||||
libxforms_la_SOURCES = \
|
libxforms_la_SOURCES = \
|
||||||
forms_fwd.h \
|
forms_fwd.h \
|
||||||
@ -32,8 +27,6 @@ libxforms_la_SOURCES = \
|
|||||||
input_validators.C \
|
input_validators.C \
|
||||||
input_validators.h \
|
input_validators.h \
|
||||||
lyx_gui.C \
|
lyx_gui.C \
|
||||||
lyxlookup.C \
|
|
||||||
lyxlookup.h \
|
|
||||||
xfont_loader.C \
|
xfont_loader.C \
|
||||||
xfont_loader.h \
|
xfont_loader.h \
|
||||||
xfont_metrics.C \
|
xfont_metrics.C \
|
||||||
@ -42,7 +35,9 @@ libxforms_la_SOURCES = \
|
|||||||
xforms_helpers.h \
|
xforms_helpers.h \
|
||||||
xforms_resize.C \
|
xforms_resize.C \
|
||||||
xforms_resize.h \
|
xforms_resize.h \
|
||||||
$(XFORMSIMAGE) xformsBC.C \
|
xformsImage.C \
|
||||||
|
xformsImage.h \
|
||||||
|
xformsBC.C \
|
||||||
xformsBC.h \
|
xformsBC.h \
|
||||||
xscreen.C \
|
xscreen.C \
|
||||||
xscreen.h \
|
xscreen.h \
|
||||||
@ -169,10 +164,6 @@ libxforms_la_SOURCES = \
|
|||||||
|
|
||||||
libxforms.la: $(libxforms_la_OBJECTS) $(libxforms_la_DEPENDENCIES)
|
libxforms.la: $(libxforms_la_OBJECTS) $(libxforms_la_DEPENDENCIES)
|
||||||
|
|
||||||
# for convenience only
|
|
||||||
updatesrc:
|
|
||||||
$(MAKE) -C forms updatesrc
|
|
||||||
|
|
||||||
# just copied from old lyx repository
|
# just copied from old lyx repository
|
||||||
#dist-hook:
|
#dist-hook:
|
||||||
# for subdir in $(LYXDATADIRS) ; do \
|
# for subdir in $(LYXDATADIRS) ; do \
|
||||||
|
@ -189,11 +189,7 @@ int get_new_submenu(vector<int> & smn, Window win)
|
|||||||
|
|
||||||
string const fixlabel(string const & str)
|
string const fixlabel(string const & str)
|
||||||
{
|
{
|
||||||
#if FL_VERSION < 1 && FL_REVISION < 89
|
|
||||||
return subst(str, '%', '?');
|
|
||||||
#else
|
|
||||||
return subst(str, "%", "%%");
|
return subst(str, "%", "%%");
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -34,8 +34,6 @@ bool Tooltips::enabled_ = true;
|
|||||||
boost::signal0<void> Tooltips::toggled;
|
boost::signal0<void> Tooltips::toggled;
|
||||||
|
|
||||||
|
|
||||||
#if FL_VERSION > 0 || FL_REVISION >= 89
|
|
||||||
|
|
||||||
Tooltips::Tooltips()
|
Tooltips::Tooltips()
|
||||||
{
|
{
|
||||||
toggled.connect(boost::bind(&Tooltips::set, this));
|
toggled.connect(boost::bind(&Tooltips::set, this));
|
||||||
@ -76,140 +74,3 @@ void Tooltips::init(FL_OBJECT * ob, string const & tip)
|
|||||||
char const * const c_str = enabled_ ? str.c_str() : 0;
|
char const * const c_str = enabled_ ? str.c_str() : 0;
|
||||||
fl_set_object_helper(ob, c_str);
|
fl_set_object_helper(ob, c_str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#else // if FL_REVISION < 89
|
|
||||||
|
|
||||||
namespace {
|
|
||||||
|
|
||||||
int TooltipHandler(FL_OBJECT *ob, int event);
|
|
||||||
|
|
||||||
void TooltipTimerCB(FL_OBJECT * timer, long data);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
extern "C" {
|
|
||||||
|
|
||||||
static int C_TooltipHandler(FL_OBJECT * ob, int event,
|
|
||||||
FL_Coord, FL_Coord, int, void *)
|
|
||||||
{
|
|
||||||
return TooltipHandler(ob, event);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void C_TooltipTimerCB(FL_OBJECT * ob, long data)
|
|
||||||
{
|
|
||||||
TooltipTimerCB(ob, data);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Tooltips::Tooltips()
|
|
||||||
: tooltip_timer_(0)
|
|
||||||
{
|
|
||||||
toggled.connect(boost::bind(&Tooltips::set, this));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Tooltips::toggleEnabled()
|
|
||||||
{
|
|
||||||
enabled_ = !enabled_;
|
|
||||||
toggled();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Tooltips::set()
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
void Tooltips::init(FL_OBJECT * ob, string const & tip)
|
|
||||||
{
|
|
||||||
lyx::Assert(ob && ob->form);
|
|
||||||
|
|
||||||
// Paranoia check!
|
|
||||||
TooltipsMap::const_iterator it = tooltipsMap.find(ob);
|
|
||||||
if (it != tooltipsMap.end())
|
|
||||||
return;
|
|
||||||
|
|
||||||
string const str = trim(tip);
|
|
||||||
if (str.empty())
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Store the tooltip string
|
|
||||||
tooltipsMap[ob] = formatted(str, 400);
|
|
||||||
|
|
||||||
if (!tooltip_timer_) {
|
|
||||||
if (fl_current_form && ob->form != fl_current_form)
|
|
||||||
fl_end_form();
|
|
||||||
|
|
||||||
bool const open_form = !fl_current_form;
|
|
||||||
if (open_form)
|
|
||||||
fl_addto_form(ob->form);
|
|
||||||
|
|
||||||
tooltip_timer_ = fl_add_timer(FL_HIDDEN_TIMER, 0, 0, 0, 0, "");
|
|
||||||
|
|
||||||
if (open_form)
|
|
||||||
fl_end_form();
|
|
||||||
}
|
|
||||||
|
|
||||||
fl_set_object_posthandler(ob, C_TooltipHandler);
|
|
||||||
ob->u_cdata = reinterpret_cast<char *>(tooltip_timer_);
|
|
||||||
tooltip_timer_->u_vdata = this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
string const Tooltips::get(FL_OBJECT * ob) const
|
|
||||||
{
|
|
||||||
TooltipsMap::const_iterator it = tooltipsMap.find(ob);
|
|
||||||
if (it == tooltipsMap.end())
|
|
||||||
return string();
|
|
||||||
return it->second;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
namespace {
|
|
||||||
|
|
||||||
void TooltipTimerCB(FL_OBJECT * timer, long data)
|
|
||||||
{
|
|
||||||
FL_OBJECT * ob = reinterpret_cast<FL_OBJECT*>(data);
|
|
||||||
lyx::Assert(ob && ob->form && timer && timer->u_vdata);
|
|
||||||
FL_FORM * form = ob->form;
|
|
||||||
Tooltips * tooltip = static_cast<Tooltips *>(timer->u_vdata);
|
|
||||||
|
|
||||||
string const help = tooltip->get(ob);
|
|
||||||
if (help.empty())
|
|
||||||
return;
|
|
||||||
|
|
||||||
fl_show_oneliner(help.c_str(),
|
|
||||||
form->x + ob->x, form->y + ob->y + ob->h);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// post_handler for tooltip help
|
|
||||||
int TooltipHandler(FL_OBJECT * ob, int event)
|
|
||||||
{
|
|
||||||
if (!Tooltips::enabled())
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
lyx::Assert(ob);
|
|
||||||
FL_OBJECT * timer = reinterpret_cast<FL_OBJECT *>(ob->u_cdata);
|
|
||||||
lyx::Assert(timer);
|
|
||||||
|
|
||||||
// We do not test for empty help here, since this can never happen
|
|
||||||
if (event == FL_ENTER) {
|
|
||||||
fl_set_object_callback(timer,
|
|
||||||
C_TooltipTimerCB,
|
|
||||||
reinterpret_cast<long>(ob));
|
|
||||||
fl_set_timer(timer, 1);
|
|
||||||
}
|
|
||||||
else if (event != FL_MOTION) {
|
|
||||||
fl_set_timer(timer, 0);
|
|
||||||
fl_hide_oneliner();
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace anon
|
|
||||||
|
|
||||||
#endif // FL_REVISION >= 89
|
|
||||||
|
@ -18,6 +18,10 @@
|
|||||||
#ifndef TOOLTIPS_H
|
#ifndef TOOLTIPS_H
|
||||||
#define TOOLTIPS_H
|
#define TOOLTIPS_H
|
||||||
|
|
||||||
|
#ifdef __GNUG__
|
||||||
|
#pragma interface
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "LString.h"
|
#include "LString.h"
|
||||||
|
|
||||||
#include <boost/utility.hpp>
|
#include <boost/utility.hpp>
|
||||||
@ -28,10 +32,6 @@
|
|||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
#ifdef __GNUG__
|
|
||||||
#pragma interface
|
|
||||||
#endif
|
|
||||||
|
|
||||||
class Tooltips : boost::noncopyable, public boost::signals::trackable {
|
class Tooltips : boost::noncopyable, public boost::signals::trackable {
|
||||||
public:
|
public:
|
||||||
///
|
///
|
||||||
@ -43,15 +43,6 @@ public:
|
|||||||
/// Are the tooltips on or off?
|
/// Are the tooltips on or off?
|
||||||
static bool enabled() { return enabled_; }
|
static bool enabled() { return enabled_; }
|
||||||
|
|
||||||
#if FL_VERSION < 1 && FL_REVISION < 89
|
|
||||||
|
|
||||||
/** Return the tooltip associated with this object.
|
|
||||||
* Required by an xforms callback routine.
|
|
||||||
*/
|
|
||||||
string const get(FL_OBJECT *) const;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/** This method is connected to Dialogs::toggleTooltips and toggles
|
/** This method is connected to Dialogs::toggleTooltips and toggles
|
||||||
* the state of enabled_.
|
* the state of enabled_.
|
||||||
*/
|
*/
|
||||||
@ -74,15 +65,6 @@ private:
|
|||||||
typedef std::map<FL_OBJECT *, string> TooltipsMap;
|
typedef std::map<FL_OBJECT *, string> TooltipsMap;
|
||||||
|
|
||||||
TooltipsMap tooltipsMap;
|
TooltipsMap tooltipsMap;
|
||||||
|
|
||||||
#if FL_VERSION < 1 && FL_REVISION < 89
|
|
||||||
|
|
||||||
/** A timer is started once the mouse enters an object, so that the
|
|
||||||
* tip appears a short delay afterwards.
|
|
||||||
*/
|
|
||||||
FL_OBJECT * tooltip_timer_;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // TOOLTIPS_H
|
#endif // TOOLTIPS_H
|
||||||
|
@ -16,10 +16,8 @@
|
|||||||
|
|
||||||
#include "XFormsView.h"
|
#include "XFormsView.h"
|
||||||
#include FORMS_H_LOCATION
|
#include FORMS_H_LOCATION
|
||||||
#if FL_VERSION < 1 && (FL_REVISION < 89 || (FL_REVISION == 89 && FL_FIXLEVEL < 5))
|
|
||||||
#include "frontends/xforms/lyxlookup.h"
|
#include "XMiniBuffer.h"
|
||||||
#endif
|
|
||||||
#include "frontends/xforms/XMiniBuffer.h"
|
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "intl.h"
|
#include "intl.h"
|
||||||
#include "lyxrc.h"
|
#include "lyxrc.h"
|
||||||
@ -123,9 +121,6 @@ void XFormsView::show(int x, int y, string const & title)
|
|||||||
fl_show_form(form, placement, FL_FULLBORDER, title.c_str());
|
fl_show_form(form, placement, FL_FULLBORDER, title.c_str());
|
||||||
|
|
||||||
show_view_state();
|
show_view_state();
|
||||||
#if FL_VERSION < 1 && (FL_REVISION < 89 || (FL_REVISION == 89 && FL_FIXLEVEL < 5))
|
|
||||||
InitLyXLookup(fl_get_display(), form_->window);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -21,10 +21,6 @@
|
|||||||
#include "funcrequest.h"
|
#include "funcrequest.h"
|
||||||
#include "Timeout.h"
|
#include "Timeout.h"
|
||||||
|
|
||||||
#if FL_VERSION < 1 && (FL_REVISION < 89 || (FL_REVISION == 89 && FL_FIXLEVEL < 5))
|
|
||||||
#include "lyxlookup.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
using std::endl;
|
using std::endl;
|
||||||
using std::abs;
|
using std::abs;
|
||||||
using std::hex;
|
using std::hex;
|
||||||
@ -306,11 +302,7 @@ int XWorkArea::work_area_handler(FL_OBJECT * ob, int event,
|
|||||||
ev->xbutton.y - ob->y,
|
ev->xbutton.y - ob->y,
|
||||||
x_button_state(key)));
|
x_button_state(key)));
|
||||||
break;
|
break;
|
||||||
#if FL_VERSION < 1 && FL_REVISION < 89
|
|
||||||
case FL_MOUSE:
|
|
||||||
#else
|
|
||||||
case FL_DRAG:
|
case FL_DRAG:
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
if (!ev || !area->scrollbar)
|
if (!ev || !area->scrollbar)
|
||||||
break;
|
break;
|
||||||
@ -376,24 +368,14 @@ int XWorkArea::work_area_handler(FL_OBJECT * ob, int event,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if FL_VERSION < 1 && FL_REVISION < 89
|
|
||||||
case FL_KEYBOARD:
|
|
||||||
#else
|
|
||||||
case FL_KEYPRESS:
|
case FL_KEYPRESS:
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
lyxerr[Debug::WORKAREA] << "Workarea event: KEYPRESS" << endl;
|
lyxerr[Debug::WORKAREA] << "Workarea event: KEYPRESS" << endl;
|
||||||
|
|
||||||
KeySym keysym = 0;
|
KeySym keysym = 0;
|
||||||
char dummy[1];
|
char dummy[1];
|
||||||
XKeyEvent * xke = reinterpret_cast<XKeyEvent *>(ev);
|
XKeyEvent * xke = reinterpret_cast<XKeyEvent *>(ev);
|
||||||
#if FL_VERSION < 1 && (FL_REVISION < 89 || (FL_REVISION == 89 && FL_FIXLEVEL < 5))
|
|
||||||
// XForms < 0.89.5 does not have compose support
|
|
||||||
// so we are using our own compose support
|
|
||||||
LyXLookupString(ev, dummy, 1, &keysym);
|
|
||||||
#else
|
|
||||||
XLookupString(xke, dummy, 1, &keysym, 0);
|
XLookupString(xke, dummy, 1, &keysym, 0);
|
||||||
#endif
|
|
||||||
|
|
||||||
if (lyxerr.debugging(Debug::KEY)) {
|
if (lyxerr.debugging(Debug::KEY)) {
|
||||||
char const * const tmp = XKeysymToString(key);
|
char const * const tmp = XKeysymToString(key);
|
||||||
@ -407,15 +389,6 @@ int XWorkArea::work_area_handler(FL_OBJECT * ob, int event,
|
|||||||
<< "' [" << keysym << ']' << endl;
|
<< "' [" << keysym << ']' << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if FL_VERSION < 1 && (FL_REVISION < 89 || (FL_REVISION == 89 && FL_FIXLEVEL < 5))
|
|
||||||
if (keysym == NoSymbol) {
|
|
||||||
lyxerr[Debug::KEY]
|
|
||||||
<< "Empty kdb action (probably composing)"
|
|
||||||
<< endl;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
KeySym ret_key = keysym;
|
|
||||||
#else
|
|
||||||
// Note that we need this handling because of a bug
|
// Note that we need this handling because of a bug
|
||||||
// in XForms 0.89, if this bug is resolved in the way I hope
|
// in XForms 0.89, if this bug is resolved in the way I hope
|
||||||
// we can just use the keysym directly without looking
|
// we can just use the keysym directly without looking
|
||||||
@ -447,7 +420,6 @@ int XWorkArea::work_area_handler(FL_OBJECT * ob, int event,
|
|||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
unsigned int const ret_state = xke->state;
|
unsigned int const ret_state = xke->state;
|
||||||
|
|
||||||
// If you have a better way to handle "wild-output" of
|
// If you have a better way to handle "wild-output" of
|
||||||
@ -488,11 +460,9 @@ int XWorkArea::work_area_handler(FL_OBJECT * ob, int event,
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#if FL_VERSION > 0 || FL_REVISION >= 89
|
|
||||||
case FL_KEYRELEASE:
|
case FL_KEYRELEASE:
|
||||||
lyxerr[Debug::WORKAREA] << "Workarea event: KEYRELEASE" << endl;
|
lyxerr[Debug::WORKAREA] << "Workarea event: KEYRELEASE" << endl;
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
|
|
||||||
case FL_ENTER:
|
case FL_ENTER:
|
||||||
lyxerr[Debug::WORKAREA] << "Workarea event: ENTER" << endl;
|
lyxerr[Debug::WORKAREA] << "Workarea event: ENTER" << endl;
|
||||||
|
@ -282,6 +282,7 @@ void Combox::show()
|
|||||||
fl_redraw_object(button);
|
fl_redraw_object(button);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if FL_VERSION < 1
|
||||||
// This fix ensures that, even if label lies on a tabfolder,
|
// This fix ensures that, even if label lies on a tabfolder,
|
||||||
// the x,y coords of the underlying form are up to date.
|
// the x,y coords of the underlying form are up to date.
|
||||||
// It should be rendered redundant by a similar fix in the
|
// It should be rendered redundant by a similar fix in the
|
||||||
@ -292,6 +293,7 @@ void Combox::show()
|
|||||||
FL_FORM * lf = label->form;
|
FL_FORM * lf = label->form;
|
||||||
fl_get_winorigin(lf->window, &(lf->x), &(lf->y));
|
fl_get_winorigin(lf->window, &(lf->x), &(lf->y));
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
int const x = label->form->x + label->x;
|
int const x = label->form->x + label->x;
|
||||||
int const y = label->form->y + label->y + label->h;
|
int const y = label->form->y + label->y + label->h;
|
||||||
|
@ -35,11 +35,7 @@
|
|||||||
#include "ColorHandler.h"
|
#include "ColorHandler.h"
|
||||||
#include "xforms_helpers.h"
|
#include "xforms_helpers.h"
|
||||||
#include "xfont_loader.h"
|
#include "xfont_loader.h"
|
||||||
#ifdef USE_XFORMS_IMAGE_LOADER
|
|
||||||
#include "xformsImage.h"
|
#include "xformsImage.h"
|
||||||
#else
|
|
||||||
#include "graphics/GraphicsImageXPM.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "Lsstream.h"
|
#include "Lsstream.h"
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
@ -169,15 +165,9 @@ void lyx_gui::parse_init(int & argc, char * argv[])
|
|||||||
|
|
||||||
using namespace grfx;
|
using namespace grfx;
|
||||||
|
|
||||||
#ifdef USE_XFORMS_IMAGE_LOADER
|
|
||||||
// connect the image loader based on the xforms library
|
// connect the image loader based on the xforms library
|
||||||
Image::newImage = boost::bind(&xformsImage::newImage);
|
Image::newImage = boost::bind(&xformsImage::newImage);
|
||||||
Image::loadableFormats = boost::bind(&xformsImage::loadableFormats);
|
Image::loadableFormats = boost::bind(&xformsImage::loadableFormats);
|
||||||
#else
|
|
||||||
// connect the image loader based on the XPM library
|
|
||||||
Image::newImage = boost::bind(&ImageXPM::newImage);
|
|
||||||
Image::loadableFormats = boost::bind(&ImageXPM::loadableFormats);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// must do this /before/ lyxrc gets read
|
// must do this /before/ lyxrc gets read
|
||||||
lyxrc.dpi = getDPI();
|
lyxrc.dpi = getDPI();
|
||||||
@ -231,11 +221,7 @@ void lyx_gui::parse_lyxrc()
|
|||||||
fl_setpup_fontsize(FL_NORMAL_SIZE);
|
fl_setpup_fontsize(FL_NORMAL_SIZE);
|
||||||
fl_setpup_color(FL_MCOL, FL_BLACK);
|
fl_setpup_color(FL_MCOL, FL_BLACK);
|
||||||
fl_set_goodies_font(FL_NORMAL_STYLE, FL_NORMAL_SIZE);
|
fl_set_goodies_font(FL_NORMAL_STYLE, FL_NORMAL_SIZE);
|
||||||
#if FL_REVISION < 89
|
|
||||||
fl_set_oneliner_font(FL_NORMAL_STYLE, FL_NORMAL_SIZE);
|
|
||||||
#else
|
|
||||||
fl_set_tooltip_font(FL_NORMAL_STYLE, FL_NORMAL_SIZE);
|
fl_set_tooltip_font(FL_NORMAL_STYLE, FL_NORMAL_SIZE);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,284 +0,0 @@
|
|||||||
/**
|
|
||||||
* \file lyxlookup.C
|
|
||||||
* This file is part of LyX, the document processor.
|
|
||||||
* Licence details can be found in the file COPYING.
|
|
||||||
*
|
|
||||||
* \author unknown
|
|
||||||
*
|
|
||||||
* Full author contact details are available in file CREDITS
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef __GNUG__
|
|
||||||
#pragma implementation
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <config.h>
|
|
||||||
|
|
||||||
#ifdef HAVE_XOPENIM
|
|
||||||
// This part is the full blown Input Method manager for X11R5 and up.
|
|
||||||
// For the plain-and-old-X11R4 version, see later.
|
|
||||||
#include <X11/Xlib.h>
|
|
||||||
#include <X11/Xutil.h>
|
|
||||||
#include <X11/keysym.h>
|
|
||||||
#ifdef HAVE_LOCALE_H
|
|
||||||
#include <locale.h>
|
|
||||||
#endif
|
|
||||||
#include <clocale>
|
|
||||||
|
|
||||||
#include "lyxlookup.h"
|
|
||||||
#include "debug.h"
|
|
||||||
#include "lyxrc.h"
|
|
||||||
|
|
||||||
using std::endl;
|
|
||||||
|
|
||||||
namespace {
|
|
||||||
|
|
||||||
XIM xim;
|
|
||||||
XIC xic;
|
|
||||||
XComposeStatus compose_status= {0, 0};
|
|
||||||
|
|
||||||
} // namespace anon
|
|
||||||
|
|
||||||
|
|
||||||
// This is called after the main LyX window has been created
|
|
||||||
void InitLyXLookup(Display * display, Window window)
|
|
||||||
{
|
|
||||||
xic = 0;
|
|
||||||
|
|
||||||
lyxerr[Debug::KEY]
|
|
||||||
<< "InitLyXLookup: creating an input context."
|
|
||||||
<< endl;
|
|
||||||
|
|
||||||
// This part could be done before opening display
|
|
||||||
string oldlocale = setlocale(LC_CTYPE, 0);
|
|
||||||
setlocale(LC_CTYPE, "");
|
|
||||||
if (!XSupportsLocale()) {
|
|
||||||
lyxerr[Debug::KEY]
|
|
||||||
<< "InitLyXLookup: X does not support this locale."
|
|
||||||
<< endl;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// reset the LC_CTYPE locale to previous value.
|
|
||||||
setlocale(LC_CTYPE, oldlocale.c_str());
|
|
||||||
|
|
||||||
char const * locmod;
|
|
||||||
if (!(locmod = XSetLocaleModifiers(""))) {
|
|
||||||
lyxerr[Debug::KEY] << "InitLyXLookup: Could not set modifiers "
|
|
||||||
"for this locale." << endl;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
lyxerr[Debug::KEY] << "InitLyXLookup: X locale modifiers are `"
|
|
||||||
<< locmod << '\'' << endl;
|
|
||||||
|
|
||||||
// This part will have to be done for each frame
|
|
||||||
xim = XOpenIM (display, 0, 0, 0);
|
|
||||||
if (xim) {
|
|
||||||
xic = XCreateIC(xim,
|
|
||||||
XNInputStyle,
|
|
||||||
XIMPreeditNothing|XIMStatusNothing,
|
|
||||||
XNClientWindow, window,
|
|
||||||
XNFocusWindow, window,
|
|
||||||
0);
|
|
||||||
|
|
||||||
if (!xic) {
|
|
||||||
lyxerr[Debug::KEY] << "InitLyXLookup: "
|
|
||||||
"could not create an input context" << endl;
|
|
||||||
XCloseIM (xim);
|
|
||||||
xim = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
lyxerr[Debug::KEY] << "InitLyXLookup: could not open "
|
|
||||||
"an input method." << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
namespace {
|
|
||||||
|
|
||||||
bool isDeadEvent(KeySym keysym)
|
|
||||||
{
|
|
||||||
// Can this be done safely in any other way?
|
|
||||||
// This is all the dead keys I know of in X11R6.1
|
|
||||||
switch (keysym) {
|
|
||||||
#ifdef XK_dead_grave
|
|
||||||
case XK_dead_grave:
|
|
||||||
#endif
|
|
||||||
#ifdef XK_dead_acute
|
|
||||||
case XK_dead_acute:
|
|
||||||
#endif
|
|
||||||
#ifdef XK_dead_circumflex
|
|
||||||
case XK_dead_circumflex:
|
|
||||||
#endif
|
|
||||||
#ifdef XK_dead_tilde
|
|
||||||
case XK_dead_tilde:
|
|
||||||
#endif
|
|
||||||
#ifdef XK_dead_macron
|
|
||||||
case XK_dead_macron:
|
|
||||||
#endif
|
|
||||||
#ifdef XK_dead_breve
|
|
||||||
case XK_dead_breve:
|
|
||||||
#endif
|
|
||||||
#ifdef XK_dead_abovedot
|
|
||||||
case XK_dead_abovedot:
|
|
||||||
#endif
|
|
||||||
#ifdef XK_dead_diaeresis
|
|
||||||
case XK_dead_diaeresis:
|
|
||||||
#endif
|
|
||||||
#ifdef XK_dead_abovering
|
|
||||||
case XK_dead_abovering:
|
|
||||||
#endif
|
|
||||||
#ifdef XK_dead_doubleacute
|
|
||||||
case XK_dead_doubleacute:
|
|
||||||
#endif
|
|
||||||
#ifdef XK_dead_caron
|
|
||||||
case XK_dead_caron:
|
|
||||||
#endif
|
|
||||||
#ifdef XK_dead_cedilla
|
|
||||||
case XK_dead_cedilla:
|
|
||||||
#endif
|
|
||||||
#ifdef XK_dead_ogonek
|
|
||||||
case XK_dead_ogonek:
|
|
||||||
#endif
|
|
||||||
#ifdef XK_dead_iota
|
|
||||||
case XK_dead_iota:
|
|
||||||
#endif
|
|
||||||
#ifdef XK_dead_voiced_sound
|
|
||||||
case XK_dead_voiced_sound:
|
|
||||||
#endif
|
|
||||||
#ifdef XK_dead_semivoiced_sound
|
|
||||||
case XK_dead_semivoiced_sound:
|
|
||||||
#endif
|
|
||||||
#ifdef XK_dead_belowdot
|
|
||||||
case XK_dead_belowdot:
|
|
||||||
#endif
|
|
||||||
return true;
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace anon
|
|
||||||
|
|
||||||
|
|
||||||
// This is called instead of XLookupString()
|
|
||||||
int LyXLookupString(XEvent * event,
|
|
||||||
char * buffer_return, int bytes_buffer,
|
|
||||||
KeySym * keysym_return)
|
|
||||||
{
|
|
||||||
if (event->type != KeyPress) {
|
|
||||||
lyxerr << "LyXLookupString: wrong event type: "
|
|
||||||
<< event->type << endl;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int result = 0;
|
|
||||||
if (xic) {
|
|
||||||
#if 1
|
|
||||||
// somehow it is necessary to do the lookup. Why? (JMarc)
|
|
||||||
XLookupString(&event->xkey, buffer_return,
|
|
||||||
bytes_buffer, keysym_return,
|
|
||||||
0);
|
|
||||||
|
|
||||||
if (lyxrc.override_x_deadkeys &&
|
|
||||||
isDeadEvent(*keysym_return)) {
|
|
||||||
lyxerr[Debug::KEY]
|
|
||||||
<< "LyXLookupString: found DeadEvent" << endl;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#if 1
|
|
||||||
if (XFilterEvent (event, None)) {
|
|
||||||
lyxerr[Debug::KEY] <<"XFilterEvent" << endl;
|
|
||||||
*keysym_return = NoSymbol;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
Status status_return = 0;
|
|
||||||
|
|
||||||
result = XmbLookupString(xic, &event->xkey, buffer_return,
|
|
||||||
bytes_buffer, keysym_return,
|
|
||||||
&status_return);
|
|
||||||
switch (status_return) {
|
|
||||||
case XBufferOverflow:
|
|
||||||
lyxerr[Debug::KEY] << "XBufferOverflow" << endl;
|
|
||||||
break;
|
|
||||||
case XLookupBoth:
|
|
||||||
lyxerr[Debug::KEY] << "XLookupBoth "
|
|
||||||
<< string(buffer_return, result)
|
|
||||||
<< endl;
|
|
||||||
break;
|
|
||||||
case XLookupChars:
|
|
||||||
lyxerr[Debug::KEY] << "XLookupChars "
|
|
||||||
<< string(buffer_return, result)
|
|
||||||
<< endl;
|
|
||||||
|
|
||||||
*keysym_return = NoSymbol;
|
|
||||||
break;
|
|
||||||
case XLookupKeySym:
|
|
||||||
lyxerr[Debug::KEY] << "XLookupKeySym" << endl;
|
|
||||||
result = 0;
|
|
||||||
break;
|
|
||||||
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,
|
|
||||||
bytes_buffer, keysym_return,
|
|
||||||
&compose_status);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// This is called after the main window has been destroyed
|
|
||||||
void CloseLyXLookup()
|
|
||||||
{
|
|
||||||
if (xic) {
|
|
||||||
lyxerr[Debug::KEY] << "CloseLyXLookup: destroying input context"
|
|
||||||
<< endl;
|
|
||||||
XDestroyIC(xic);
|
|
||||||
xic = 0;
|
|
||||||
XCloseIM(xim);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#else // We do not have XOpenIM, so we stick with normal XLookupString
|
|
||||||
|
|
||||||
#include <X11/Xlib.h>
|
|
||||||
#include <X11/Xutil.h>
|
|
||||||
|
|
||||||
XComposeStatus compose_status= {0, 0};
|
|
||||||
|
|
||||||
// This is called after the main LyX window has been created
|
|
||||||
void InitLyXLookup(Display *, Window)
|
|
||||||
{
|
|
||||||
//Nothing to do.
|
|
||||||
}
|
|
||||||
|
|
||||||
// This is called instead of XLookupString(). I this particular case,
|
|
||||||
// this *is* XLookupString...
|
|
||||||
int LyXLookupString(XEvent * event,
|
|
||||||
char * buffer_return, int bytes_buffer,
|
|
||||||
KeySym * keysym_return)
|
|
||||||
{
|
|
||||||
return XLookupString(&event->xkey, buffer_return,
|
|
||||||
bytes_buffer, keysym_return,
|
|
||||||
&compose_status);
|
|
||||||
}
|
|
||||||
|
|
||||||
// This is called after the main window has been destroyed
|
|
||||||
void CloseLyXLookup()
|
|
||||||
{
|
|
||||||
// Nothing to do
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // HAVE_XOPENIM
|
|
@ -1,31 +0,0 @@
|
|||||||
/**
|
|
||||||
* \file lyxlookup.h
|
|
||||||
* This file is part of LyX, the document processor.
|
|
||||||
* Licence details can be found in the file COPYING.
|
|
||||||
*
|
|
||||||
* \author unknown
|
|
||||||
*
|
|
||||||
* Full author contact details are available in file CREDITS
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* This header file defines wrappers around the X input method related
|
|
||||||
functions. This should probably be moved into LyXView (to have
|
|
||||||
different input methods for different frames, but for now we can
|
|
||||||
keep it as it is. */
|
|
||||||
#ifndef LYXLOOKUP_H
|
|
||||||
#define LYXLOOKUP_H
|
|
||||||
|
|
||||||
#include <X11/Xlib.h>
|
|
||||||
|
|
||||||
/// Initialize the compose key handling
|
|
||||||
extern void InitLyXLookup(Display *, Window);
|
|
||||||
|
|
||||||
/// Read a keysym and/or a string (like XLookupString)
|
|
||||||
extern int LyXLookupString(XEvent * event,
|
|
||||||
char * buffer_return, int bytes_buffer,
|
|
||||||
KeySym * keysym_return);
|
|
||||||
|
|
||||||
/// Call this when you destroy your window
|
|
||||||
extern void CloseLyXLookup();
|
|
||||||
|
|
||||||
#endif
|
|
@ -94,40 +94,6 @@ double get_scaling_factor(FL_FORM * form)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// A nasty hack for older xforms versions
|
|
||||||
int get_tabfolder_numfolders(FL_OBJECT * folder)
|
|
||||||
{
|
|
||||||
#if FL_VERSION > 0 || FL_REVISION > 88
|
|
||||||
return fl_get_tabfolder_numfolders(folder);
|
|
||||||
#else
|
|
||||||
if (folder->objclass != FL_TABFOLDER)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
fl_freeze_form(folder->form);
|
|
||||||
int const saved_folder_id = fl_get_folder_number(folder);
|
|
||||||
|
|
||||||
int num_folders = 0;
|
|
||||||
FL_FORM const * old_leaf = 0;
|
|
||||||
for (;;) {
|
|
||||||
int const id = num_folders + 1;
|
|
||||||
fl_set_folder_bynumber(folder, id);
|
|
||||||
FL_FORM const * const leaf = fl_get_folder(folder);
|
|
||||||
if (!leaf || leaf == old_leaf) {
|
|
||||||
// unable to increment succesfully.
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
old_leaf = leaf;
|
|
||||||
++num_folders;
|
|
||||||
}
|
|
||||||
|
|
||||||
fl_set_folder_bynumber(folder, saved_folder_id);
|
|
||||||
fl_unfreeze_form(folder->form);
|
|
||||||
|
|
||||||
return num_folders;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
double get_tabfolder_scale_to_fit(FL_OBJECT * folder)
|
double get_tabfolder_scale_to_fit(FL_OBJECT * folder)
|
||||||
{
|
{
|
||||||
lyx::Assert(folder && folder->objclass == FL_TABFOLDER);
|
lyx::Assert(folder && folder->objclass == FL_TABFOLDER);
|
||||||
@ -136,7 +102,7 @@ double get_tabfolder_scale_to_fit(FL_OBJECT * folder)
|
|||||||
int const saved_folder_id = fl_get_folder_number(folder);
|
int const saved_folder_id = fl_get_folder_number(folder);
|
||||||
|
|
||||||
double factor = 1.0;
|
double factor = 1.0;
|
||||||
int const size = get_tabfolder_numfolders(folder);
|
int const size = fl_get_tabfolder_numfolders(folder);
|
||||||
for (int i = 0; i < size; ++i) {
|
for (int i = 0; i < size; ++i) {
|
||||||
fl_set_folder_bynumber(folder, i+1);
|
fl_set_folder_bynumber(folder, i+1);
|
||||||
FL_FORM * leaf = fl_get_folder(folder);
|
FL_FORM * leaf = fl_get_folder(folder);
|
||||||
@ -157,7 +123,7 @@ void scale_tabfolder_horizontally(FL_OBJECT * folder, double factor)
|
|||||||
fl_freeze_form(folder->form);
|
fl_freeze_form(folder->form);
|
||||||
int const saved_folder_id = fl_get_folder_number(folder);
|
int const saved_folder_id = fl_get_folder_number(folder);
|
||||||
|
|
||||||
int const size = get_tabfolder_numfolders(folder);
|
int const size = fl_get_tabfolder_numfolders(folder);
|
||||||
for (int i = 0; i < size; ++i) {
|
for (int i = 0; i < size; ++i) {
|
||||||
fl_set_folder_bynumber(folder, i+1);
|
fl_set_folder_bynumber(folder, i+1);
|
||||||
FL_FORM * leaf = fl_get_folder(folder);
|
FL_FORM * leaf = fl_get_folder(folder);
|
||||||
|
Loading…
Reference in New Issue
Block a user