mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 13:18:28 +00:00
(Alfredo) strip BufferView out of the graphics code.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6268 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
3ac369b71c
commit
5a6c9536f6
@ -368,55 +368,20 @@ int XWorkArea::work_area_handler(FL_OBJECT * ob, int event,
|
|||||||
case FL_KEYPRESS:
|
case FL_KEYPRESS:
|
||||||
{
|
{
|
||||||
lyxerr[Debug::WORKAREA] << "Workarea event: KEYPRESS" << endl;
|
lyxerr[Debug::WORKAREA] << "Workarea event: KEYPRESS" << endl;
|
||||||
|
|
||||||
KeySym keysym = 0;
|
|
||||||
char dummy[1];
|
|
||||||
XKeyEvent * xke = reinterpret_cast<XKeyEvent *>(ev);
|
XKeyEvent * xke = reinterpret_cast<XKeyEvent *>(ev);
|
||||||
XLookupString(xke, dummy, 1, &keysym, 0);
|
|
||||||
|
|
||||||
if (lyxerr.debugging(Debug::KEY)) {
|
if (lyxerr.debugging(Debug::KEY)) {
|
||||||
char const * const tmp = XKeysymToString(key);
|
char const * const tmp = XKeysymToString(key);
|
||||||
char const * const tmp2 = XKeysymToString(keysym);
|
lyxerr << "XWorkArea: Key is `" << tmp
|
||||||
string const stm = (tmp ? tmp : string());
|
<< "' [" << key << "]" << endl;
|
||||||
string const stm2 = (tmp2 ? tmp2 : string());
|
|
||||||
|
|
||||||
lyxerr << "XWorkArea: Key is `" << stm
|
|
||||||
<< "' [" << key << "]\n"
|
|
||||||
<< "XWorkArea: Keysym is `" << stm2
|
|
||||||
<< "' [" << keysym << ']' << endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Note that we need this handling because of a bug
|
|
||||||
// in XForms 0.89, if this bug is resolved in the way I hope
|
|
||||||
// we can just use the keysym directly without looking
|
|
||||||
// at key at all. (Lgb)
|
|
||||||
KeySym ret_key = 0;
|
|
||||||
if (!key) {
|
if (!key) {
|
||||||
// We might have to add more keysyms here also,
|
lyxerr << "Probably composing" << endl;
|
||||||
// we will do that as the issues arise. (Lgb)
|
|
||||||
if (keysym == XK_space) {
|
|
||||||
ret_key = keysym;
|
|
||||||
lyxerr[Debug::KEY] << "Using keysym [A]"
|
|
||||||
<< endl;
|
|
||||||
} else
|
|
||||||
break;
|
break;
|
||||||
} else {
|
|
||||||
// It seems that this was a bit optimistic...
|
|
||||||
// With this hacking things seems to be better (Lgb)
|
|
||||||
//if (!iscntrl(key)) {
|
|
||||||
// ret_key = key;
|
|
||||||
// lyxerr[Debug::KEY]
|
|
||||||
// << "Using key [B]\n"
|
|
||||||
// << "Uchar["
|
|
||||||
// << static_cast<unsigned char>(key)
|
|
||||||
// << endl;
|
|
||||||
//} else {
|
|
||||||
ret_key = (keysym ? keysym : key);
|
|
||||||
lyxerr[Debug::KEY] << "Using keysym [B]"
|
|
||||||
<< endl;
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
KeySym ret_key = key;
|
||||||
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
|
||||||
|
@ -1,3 +1,12 @@
|
|||||||
|
2003-02-25 Alfredo Braunstein <abraunst@libero.it>
|
||||||
|
|
||||||
|
* GraphicsConverter (startConversion): add the call to
|
||||||
|
ForkedCallQueue::add
|
||||||
|
|
||||||
|
* GraphicsLoader.[Ch],
|
||||||
|
* PreviewImage.[Ch],
|
||||||
|
* PreviewedInset.C: Removed unneeded BufferView
|
||||||
|
|
||||||
2003-02-25 Alfredo Braunstein <abraunst@libero.it>
|
2003-02-25 Alfredo Braunstein <abraunst@libero.it>
|
||||||
|
|
||||||
* LoaderQueue.[Ch]: a simplification of the code, eliminated
|
* LoaderQueue.[Ch]: a simplification of the code, eliminated
|
||||||
|
@ -12,8 +12,6 @@
|
|||||||
|
|
||||||
#include "GraphicsLoader.h"
|
#include "GraphicsLoader.h"
|
||||||
|
|
||||||
#include "BufferView.h"
|
|
||||||
|
|
||||||
#include "GraphicsCache.h"
|
#include "GraphicsCache.h"
|
||||||
#include "GraphicsCacheItem.h"
|
#include "GraphicsCacheItem.h"
|
||||||
#include "GraphicsImage.h"
|
#include "GraphicsImage.h"
|
||||||
@ -21,9 +19,7 @@
|
|||||||
#include "LoaderQueue.h"
|
#include "LoaderQueue.h"
|
||||||
|
|
||||||
#include "frontends/LyXView.h"
|
#include "frontends/LyXView.h"
|
||||||
#include "frontends/Timeout.h"
|
|
||||||
|
|
||||||
#include <boost/weak_ptr.hpp>
|
|
||||||
#include <boost/bind.hpp>
|
#include <boost/bind.hpp>
|
||||||
#include <boost/signals/trackable.hpp>
|
#include <boost/signals/trackable.hpp>
|
||||||
|
|
||||||
@ -44,7 +40,7 @@ struct Loader::Impl : boost::signals::trackable {
|
|||||||
void createPixmap();
|
void createPixmap();
|
||||||
|
|
||||||
///
|
///
|
||||||
void startLoading(Inset const &, BufferView const &);
|
void startLoading(Inset const &);
|
||||||
|
|
||||||
/// The loading status of the image.
|
/// The loading status of the image.
|
||||||
ImageStatus status_;
|
ImageStatus status_;
|
||||||
@ -70,8 +66,6 @@ private:
|
|||||||
typedef std::list<Inset const *> InsetList;
|
typedef std::list<Inset const *> InsetList;
|
||||||
///
|
///
|
||||||
InsetList insets;
|
InsetList insets;
|
||||||
///
|
|
||||||
boost::weak_ptr<BufferView const> view;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -132,11 +126,11 @@ void Loader::startLoading() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Loader::startLoading(Inset const & inset, BufferView const & bv) const
|
void Loader::startLoading(Inset const & inset) const
|
||||||
{
|
{
|
||||||
if (pimpl_->status_ != WaitingToLoad || !pimpl_->cached_item_.get())
|
if (pimpl_->status_ != WaitingToLoad || !pimpl_->cached_item_.get())
|
||||||
return;
|
return;
|
||||||
pimpl_->startLoading(inset, bv);
|
pimpl_->startLoading(inset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -287,7 +281,7 @@ void Loader::Impl::createPixmap()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Loader::Impl::startLoading(Inset const & inset, BufferView const & bv)
|
void Loader::Impl::startLoading(Inset const & inset)
|
||||||
{
|
{
|
||||||
if (status_ != WaitingToLoad)
|
if (status_ != WaitingToLoad)
|
||||||
return;
|
return;
|
||||||
@ -297,7 +291,6 @@ void Loader::Impl::startLoading(Inset const & inset, BufferView const & bv)
|
|||||||
it = std::find(it, end, &inset);
|
it = std::find(it, end, &inset);
|
||||||
if (it == end)
|
if (it == end)
|
||||||
insets.push_back(&inset);
|
insets.push_back(&inset);
|
||||||
view = bv.owner()->view();
|
|
||||||
|
|
||||||
LoaderQueue::get().touch(cached_item_);
|
LoaderQueue::get().touch(cached_item_);
|
||||||
}
|
}
|
||||||
|
@ -66,10 +66,10 @@ public:
|
|||||||
/// We are explicit about when we begin the loading process.
|
/// We are explicit about when we begin the loading process.
|
||||||
void startLoading() const;
|
void startLoading() const;
|
||||||
|
|
||||||
/** starting loading of the image is conditional upon the
|
/** starting loading of the image is done by a urgency-based
|
||||||
* inset being visible or not.
|
* decision. Here we only call LoaderQueue::touch to request it.
|
||||||
*/
|
*/
|
||||||
void startLoading(Inset const &, BufferView const &) const;
|
void startLoading(Inset const &) const;
|
||||||
|
|
||||||
/** Monitor any changes to the file.
|
/** Monitor any changes to the file.
|
||||||
* There is no point monitoring the file before startLoading() is
|
* There is no point monitoring the file before startLoading() is
|
||||||
|
@ -30,7 +30,7 @@ struct PreviewImage::Impl : public boost::signals::trackable {
|
|||||||
///
|
///
|
||||||
~Impl();
|
~Impl();
|
||||||
///
|
///
|
||||||
Image const * image(Inset const &, BufferView const &);
|
Image const * image(Inset const &);
|
||||||
///
|
///
|
||||||
void statusChanged();
|
void statusChanged();
|
||||||
|
|
||||||
@ -93,10 +93,9 @@ int PreviewImage::width() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Image const * PreviewImage::image(Inset const & inset,
|
Image const * PreviewImage::image(Inset const & inset) const
|
||||||
BufferView const & bv) const
|
|
||||||
{
|
{
|
||||||
return pimpl_->image(inset, bv);
|
return pimpl_->image(inset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -117,11 +116,10 @@ PreviewImage::Impl::~Impl()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Image const * PreviewImage::Impl::image(Inset const & inset,
|
Image const * PreviewImage::Impl::image(Inset const & inset)
|
||||||
BufferView const & bv)
|
|
||||||
{
|
{
|
||||||
if (iloader_.status() == WaitingToLoad)
|
if (iloader_.status() == WaitingToLoad)
|
||||||
iloader_.startLoading(inset, bv);
|
iloader_.startLoading(inset);
|
||||||
|
|
||||||
return iloader_.image();
|
return iloader_.image();
|
||||||
}
|
}
|
||||||
|
@ -46,10 +46,8 @@ public:
|
|||||||
|
|
||||||
/** If the image is not yet loaded (WaitingToLoad), then this method
|
/** If the image is not yet loaded (WaitingToLoad), then this method
|
||||||
* triggers that.
|
* triggers that.
|
||||||
* inset and bv are passed so we can choose to load only
|
|
||||||
* those insets that are visible.
|
|
||||||
*/
|
*/
|
||||||
Image const * image(Inset const & inset, BufferView const & bv) const;
|
Image const * image(Inset const & inset) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// Use the Pimpl idiom to hide the internals.
|
/// Use the Pimpl idiom to hide the internals.
|
||||||
|
@ -105,7 +105,7 @@ bool PreviewedInset::previewReady() const
|
|||||||
if (!pimage_)
|
if (!pimage_)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return pimage_->image(inset_, *view());
|
return pimage_->image(inset_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
2003-02-25 Alfredo Braunstein <abraunst@libero.it>
|
||||||
|
|
||||||
|
* insetgraphics.C (draw)
|
||||||
|
* insetinclude.C (draw): Eliminate Buferview argument in call to
|
||||||
|
PreviewImage::image
|
||||||
|
|
||||||
2003-02-25 John Levon <levon@movementarian.org>
|
2003-02-25 John Levon <levon@movementarian.org>
|
||||||
|
|
||||||
* insetgraphicsParams.h:
|
* insetgraphicsParams.h:
|
||||||
|
@ -348,7 +348,7 @@ void InsetGraphics::draw(BufferView * bv, LyXFont const & font,
|
|||||||
|
|
||||||
if (gparams.display != grfx::NoDisplay
|
if (gparams.display != grfx::NoDisplay
|
||||||
&& cache_->loader.status() == grfx::WaitingToLoad)
|
&& cache_->loader.status() == grfx::WaitingToLoad)
|
||||||
cache_->loader.startLoading(*this, *bv);
|
cache_->loader.startLoading(*this);
|
||||||
|
|
||||||
if (!cache_->loader.monitoring())
|
if (!cache_->loader.monitoring())
|
||||||
cache_->loader.startMonitoring();
|
cache_->loader.startMonitoring();
|
||||||
|
@ -534,7 +534,7 @@ void InsetInclude::draw(BufferView * bv, LyXFont const & font, int y,
|
|||||||
int const h = a + d;
|
int const h = a + d;
|
||||||
|
|
||||||
bv->painter().image(x, y - a, w, h,
|
bv->painter().image(x, y - a, w, h,
|
||||||
*(preview_->pimage()->image(*this, *bv)));
|
*(preview_->pimage()->image(*this)));
|
||||||
|
|
||||||
xx += w;
|
xx += w;
|
||||||
}
|
}
|
||||||
|
@ -211,7 +211,7 @@ void InsetFormula::draw(BufferView * bv, LyXFont const & font,
|
|||||||
|
|
||||||
if (use_preview) {
|
if (use_preview) {
|
||||||
pi.pain.image(x + 1, y - a, w, h, // one pixel gap in front
|
pi.pain.image(x + 1, y - a, w, h, // one pixel gap in front
|
||||||
*(preview_->pimage()->image(*this, *bv)));
|
*(preview_->pimage()->image(*this)));
|
||||||
} else {
|
} else {
|
||||||
pi.base.style = LM_ST_TEXT;
|
pi.base.style = LM_ST_TEXT;
|
||||||
pi.base.font = font;
|
pi.base.font = font;
|
||||||
|
@ -51,7 +51,6 @@
|
|||||||
#include "textpainter.h"
|
#include "textpainter.h"
|
||||||
#include "frontends/Dialogs.h"
|
#include "frontends/Dialogs.h"
|
||||||
#include "intl.h"
|
#include "intl.h"
|
||||||
#include "insets/insetcommand.h"
|
|
||||||
#include "ref_inset.h"
|
#include "ref_inset.h"
|
||||||
|
|
||||||
using std::endl;
|
using std::endl;
|
||||||
@ -798,8 +797,7 @@ dispatch_result InsetFormulaBase::localDispatch(FuncRequest const & cmd)
|
|||||||
case LFUN_DIALOG_SHOW_NEW_INSET: {
|
case LFUN_DIALOG_SHOW_NEW_INSET: {
|
||||||
string const & name = argument;
|
string const & name = argument;
|
||||||
if (name == "ref") {
|
if (name == "ref") {
|
||||||
InsetCommandParams p(name);
|
string data = "LatexCommand \\ref{}\n\\end_inset\n\n";
|
||||||
string data = InsetCommandMailer::params2string(p);
|
|
||||||
bv->owner()->getDialogs().show(name, data, 0);
|
bv->owner()->getDialogs().show(name, data, 0);
|
||||||
} else
|
} else
|
||||||
result = UNDISPATCHED;
|
result = UNDISPATCHED;
|
||||||
@ -807,13 +805,24 @@ dispatch_result InsetFormulaBase::localDispatch(FuncRequest const & cmd)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_REF_APPLY: {
|
case LFUN_REF_APPLY: {
|
||||||
InsetCommandParams params;
|
// argument comes with a head "LatexCommand " and a
|
||||||
InsetCommandMailer::string2params(argument, params);
|
// tail "\nend_inset\n\n". Strip them off.
|
||||||
|
string trimmed;
|
||||||
|
string body = split(argument, trimmed, ' ');
|
||||||
|
split(body, trimmed, '\n');
|
||||||
|
lyxerr << "passing '" << trimmed << "' to the math parser\n";
|
||||||
|
|
||||||
// It would be nice if RefInset could handle an
|
MathAtom at;
|
||||||
// InsetCommandParams arg, but for now we convert it to
|
if (!mathed_parse_normal(at, trimmed)) {
|
||||||
// 'foo|++|bar|++|nonsense'.
|
result = UNDISPATCHED;
|
||||||
string const tmp = params.getAsString();
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
RefInset * tmp = at.nucleus()->asRefInset();
|
||||||
|
if (!tmp) {
|
||||||
|
result = UNDISPATCHED;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
InsetBase * base =
|
InsetBase * base =
|
||||||
bv->owner()->getDialogs().getOpenInset("ref");
|
bv->owner()->getDialogs().getOpenInset("ref");
|
||||||
@ -824,9 +833,9 @@ dispatch_result InsetFormulaBase::localDispatch(FuncRequest const & cmd)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
*inset = RefInset(tmp);
|
*inset = *tmp;
|
||||||
} else {
|
} else {
|
||||||
mathcursor->insert(MathAtom(new RefInset(tmp)));
|
mathcursor->insert(at);
|
||||||
}
|
}
|
||||||
updateLocal(bv, true);
|
updateLocal(bv, true);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user