]> git.lyx.org Git - features.git/commitdiff
(Alfredo) strip BufferView out of the graphics code.
authorAngus Leeming <leeming@lyx.org>
Tue, 25 Feb 2003 19:09:00 +0000 (19:09 +0000)
committerAngus Leeming <leeming@lyx.org>
Tue, 25 Feb 2003 19:09:00 +0000 (19:09 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6268 a592a061-630c-0410-9148-cb99ea01b6c8

12 files changed:
src/frontends/xforms/XWorkArea.C
src/graphics/ChangeLog
src/graphics/GraphicsLoader.C
src/graphics/GraphicsLoader.h
src/graphics/PreviewImage.C
src/graphics/PreviewImage.h
src/graphics/PreviewedInset.C
src/insets/ChangeLog
src/insets/insetgraphics.C
src/insets/insetinclude.C
src/mathed/formula.C
src/mathed/formulabase.C

index 561d90b5b56456ebc0ca3714179128319e747e9b..3bf532b96031f38568914f5c5d6e7f80ac072c00 100644 (file)
@@ -368,55 +368,20 @@ int XWorkArea::work_area_handler(FL_OBJECT * ob, int event,
        case FL_KEYPRESS:
        {
                lyxerr[Debug::WORKAREA] << "Workarea event: KEYPRESS" << endl;
-
-               KeySym keysym = 0;
-               char dummy[1];
                XKeyEvent * xke = reinterpret_cast<XKeyEvent *>(ev);
-               XLookupString(xke, dummy, 1, &keysym, 0);
 
                if (lyxerr.debugging(Debug::KEY)) {
                        char const * const tmp  = XKeysymToString(key);
-                       char const * const tmp2 = XKeysymToString(keysym);
-                       string const stm  = (tmp ? tmp : string());
-                       string const stm2 = (tmp2 ? tmp2 : string());
-
-                       lyxerr << "XWorkArea: Key is `" << stm
-                              << "' [" << key << "]\n"
-                              << "XWorkArea: Keysym is `" << stm2
-                              << "' [" << keysym << ']' << endl;
+                       lyxerr << "XWorkArea: Key is `" << tmp
+                              << "' [" << key << "]" << 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) {
-                       // We might have to add more keysyms here also,
-                       // 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;
-               } 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;
-                               //}
+                       lyxerr << "Probably composing" << endl;
+                       break;
                }
 
+               KeySym ret_key = key;
                unsigned int const ret_state = xke->state;
 
                // If you have a better way to handle "wild-output" of
index 3c2ba3e9d8ed575c520d5e2c9a662fc73a14638c..c7605830e7726967fd14c041f5e1b78dfbfcbfda 100644 (file)
@@ -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>
 
        * LoaderQueue.[Ch]: a simplification of the code, eliminated
index 5bfa5ac6ccee6b24948e89cf62019ce220bfcb25..02f99da7498c13dcb4eb34bcf107e36d57f522e4 100644 (file)
@@ -12,8 +12,6 @@
 
 #include "GraphicsLoader.h"
 
-#include "BufferView.h"
-
 #include "GraphicsCache.h"
 #include "GraphicsCacheItem.h"
 #include "GraphicsImage.h"
@@ -21,9 +19,7 @@
 #include "LoaderQueue.h"
 
 #include "frontends/LyXView.h"
-#include "frontends/Timeout.h"
 
-#include <boost/weak_ptr.hpp>
 #include <boost/bind.hpp>
 #include <boost/signals/trackable.hpp>
 
@@ -44,7 +40,7 @@ struct Loader::Impl : boost::signals::trackable {
        void createPixmap();
 
        ///
-       void startLoading(Inset const &, BufferView const &);
+       void startLoading(Inset const &);
 
        /// The loading status of the image.
        ImageStatus status_;
@@ -70,8 +66,6 @@ private:
        typedef std::list<Inset const *> InsetList;
        ///
        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())
                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)
                return;
@@ -297,7 +291,6 @@ void Loader::Impl::startLoading(Inset const & inset, BufferView const & bv)
        it = std::find(it, end, &inset);
        if (it == end)
                insets.push_back(&inset);
-       view = bv.owner()->view();
 
        LoaderQueue::get().touch(cached_item_);
 }
index ddd43e3b871f6e3f4193eaf2b1ef7ff0062a7ae7..2fcd23a2622afd46c35eb8c4b32579185e07577d 100644 (file)
@@ -66,10 +66,10 @@ public:
        /// We are explicit about when we begin the loading process.
        void startLoading() const;
 
-       /** starting loading of the image is conditional upon the
-        *  inset being visible or not.
+       /** starting loading of the image is done by a urgency-based
+        *  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.
         *  There is no point monitoring the file before startLoading() is
index 2ec2e846d2fab81079738ef2d88600247a700e1a..2dde30b979ed855e5298c1adb30cd9ddc9e9ca92 100644 (file)
@@ -30,7 +30,7 @@ struct PreviewImage::Impl : public boost::signals::trackable {
        ///
        ~Impl();
        ///
-       Image const * image(Inset const &, BufferView const &);
+       Image const * image(Inset const &);
        ///
        void statusChanged();
 
@@ -93,10 +93,9 @@ int PreviewImage::width() const
 }
 
 
-Image const * PreviewImage::image(Inset const & inset,
-                                 BufferView const & bv) const
+Image const * PreviewImage::image(Inset const & inset) 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,
-                                       BufferView const & bv)
+Image const * PreviewImage::Impl::image(Inset const & inset)
 {
        if (iloader_.status() == WaitingToLoad)
-               iloader_.startLoading(inset, bv);
+               iloader_.startLoading(inset);
 
        return iloader_.image();
 }
index f4909d45386fb9a2354eb9758af98a496eff96a7..bc12bfb81ba9acc74fddf50bcffcdc6c8a363a1f 100644 (file)
@@ -46,10 +46,8 @@ public:
 
        /** If the image is not yet loaded (WaitingToLoad), then this method
         *  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:
        /// Use the Pimpl idiom to hide the internals.
index 6cb33c976948c78378b59bde2a57fd737dd06c7e..89604d6747c010a908b8dc992c6013ed4cf960c3 100644 (file)
@@ -105,7 +105,7 @@ bool PreviewedInset::previewReady() const
        if (!pimage_)
                return false;
 
-       return pimage_->image(inset_, *view());
+       return pimage_->image(inset_);
 }
 
 
index 7217ea5f1063be65132aa602c7bc6a76c152c79e..92953044f3a786e9f42d7872f0a6472c202a172e 100644 (file)
@@ -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>
 
        * insetgraphicsParams.h:
index 604bcc37e3755c660b5500cb42f262b8d4be4c06..f344ead2a4ff1a0405e252781da07d3f537af54b 100644 (file)
@@ -348,7 +348,7 @@ void InsetGraphics::draw(BufferView * bv, LyXFont const & font,
 
        if (gparams.display != grfx::NoDisplay
                && cache_->loader.status() == grfx::WaitingToLoad)
-               cache_->loader.startLoading(*this, *bv);
+               cache_->loader.startLoading(*this);
 
        if (!cache_->loader.monitoring())
                cache_->loader.startMonitoring();
index 54b53c508ec80cf79eafb23fb68c5191f594ba5e..93efb6d10f405d910212e8262339dca42adc53fb 100644 (file)
@@ -534,7 +534,7 @@ void InsetInclude::draw(BufferView * bv, LyXFont const & font, int y,
        int const h = a + d;
 
        bv->painter().image(x, y - a, w, h,
-                           *(preview_->pimage()->image(*this, *bv)));
+                           *(preview_->pimage()->image(*this)));
 
        xx += w;
 }
index f903814baa299bad278763d0f7d3299fe342c93b..be88b35c58c96c17b0a772f794bcfe1d3efc2116 100644 (file)
@@ -211,7 +211,7 @@ void InsetFormula::draw(BufferView * bv, LyXFont const & font,
 
        if (use_preview) {
                pi.pain.image(x + 1, y - a, w, h,   // one pixel gap in front
-                             *(preview_->pimage()->image(*this, *bv)));
+                             *(preview_->pimage()->image(*this)));
        } else {
                pi.base.style = LM_ST_TEXT;
                pi.base.font  = font;
index f1b50471c0d15802d5cd021e4301bde53b831428..98474106e1785135c3c324532ae2c8720f9b7f65 100644 (file)
@@ -51,7 +51,6 @@
 #include "textpainter.h"
 #include "frontends/Dialogs.h"
 #include "intl.h"
-#include "insets/insetcommand.h"
 #include "ref_inset.h"
 
 using std::endl;
@@ -798,8 +797,7 @@ dispatch_result InsetFormulaBase::localDispatch(FuncRequest const & cmd)
        case LFUN_DIALOG_SHOW_NEW_INSET: {
                string const & name = argument;
                if (name == "ref") {
-                       InsetCommandParams p(name);
-                       string data = InsetCommandMailer::params2string(p);
+                       string data = "LatexCommand \\ref{}\n\\end_inset\n\n";
                        bv->owner()->getDialogs().show(name, data, 0);
                } else
                        result = UNDISPATCHED;
@@ -807,13 +805,24 @@ dispatch_result InsetFormulaBase::localDispatch(FuncRequest const & cmd)
        break;
 
        case LFUN_REF_APPLY: {
-               InsetCommandParams params;
-               InsetCommandMailer::string2params(argument, params);
+               // argument comes with a head "LatexCommand " and a
+               // 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";
+
+               MathAtom at;
+               if (!mathed_parse_normal(at, trimmed)) {
+                       result = UNDISPATCHED;
+                       break;
+               }
 
-               // It would be nice if RefInset could handle an
-               // InsetCommandParams arg, but for now we convert it to
-               // 'foo|++|bar|++|nonsense'.
-               string const tmp = params.getAsString();
+               RefInset * tmp = at.nucleus()->asRefInset();
+               if (!tmp) {
+                       result = UNDISPATCHED;
+                       break;
+               }
 
                InsetBase * base =
                        bv->owner()->getDialogs().getOpenInset("ref");
@@ -824,9 +833,9 @@ dispatch_result InsetFormulaBase::localDispatch(FuncRequest const & cmd)
                                break;
                        }
 
-                       *inset = RefInset(tmp);
+                       *inset = *tmp;
                } else {
-                       mathcursor->insert(MathAtom(new RefInset(tmp)));
+                       mathcursor->insert(at);
                }
                updateLocal(bv, true);
        }