mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-23 10:18:50 +00:00
That commit replaces the Buffer::message() signal emissions from within "BufferView_pimpl.C" and "lyxfind.C" with BufferView::message() signal emission.
* BufferView.h: new message boost signal. * BufferView_pimpl.C: replace Buffer::message() with BufferView::message() signal emission. * lyxfind.C: ditto. * WorkArea: - displayMessage(): new private method that calls LyXView::message(). - messageConnection_: new signal connection. - setBufferView(): handle BufferView connection/disconnection. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14831 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
07864bd9f8
commit
c70f77354a
@ -22,6 +22,7 @@
|
||||
#include "support/types.h"
|
||||
|
||||
#include <boost/utility.hpp>
|
||||
#include <boost/signal.hpp>
|
||||
|
||||
#include <string>
|
||||
|
||||
@ -218,6 +219,9 @@ public:
|
||||
///
|
||||
void updateMetrics(bool singlepar = false);
|
||||
|
||||
/// This signal is emitted when some message shows up.
|
||||
boost::signal<void(std::string)> message;
|
||||
|
||||
private:
|
||||
///
|
||||
class Pimpl;
|
||||
|
@ -631,7 +631,7 @@ void BufferView::Pimpl::savePosition(unsigned int i)
|
||||
cursor_.pos());
|
||||
if (i > 0)
|
||||
// emit message signal.
|
||||
buffer_->message(bformat(_("Saved bookmark %1$d"), i));
|
||||
bv_->message(bformat(_("Saved bookmark %1$d"), i));
|
||||
}
|
||||
|
||||
|
||||
@ -665,7 +665,7 @@ void BufferView::Pimpl::restorePosition(unsigned int i)
|
||||
|
||||
if (i > 0)
|
||||
// emit message signal.
|
||||
buffer_->message(bformat(_("Moved to bookmark %1$d"), i));
|
||||
bv_->message(bformat(_("Moved to bookmark %1$d"), i));
|
||||
}
|
||||
|
||||
|
||||
@ -755,7 +755,7 @@ void BufferView::Pimpl::menuInsertLyXFile(string const & filenm)
|
||||
// check selected filename
|
||||
if (filename.empty()) {
|
||||
// emit message signal.
|
||||
buffer_->message(_("Canceled."));
|
||||
bv_->message(_("Canceled."));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -766,7 +766,7 @@ void BufferView::Pimpl::menuInsertLyXFile(string const & filenm)
|
||||
|
||||
string const disp_fn = makeDisplayPath(filename);
|
||||
// emit message signal.
|
||||
buffer_->message(bformat(_("Inserting document %1$s..."), disp_fn));
|
||||
bv_->message(bformat(_("Inserting document %1$s..."), disp_fn));
|
||||
|
||||
string res;
|
||||
Buffer buf("", false);
|
||||
@ -781,7 +781,7 @@ void BufferView::Pimpl::menuInsertLyXFile(string const & filenm)
|
||||
res = _("Could not insert document %1$s");
|
||||
|
||||
// emit message signal.
|
||||
buffer_->message(bformat(res, disp_fn));
|
||||
bv_->message(bformat(res, disp_fn));
|
||||
buffer_->errors("Parse");
|
||||
resizeCurrentBuffer();
|
||||
}
|
||||
|
@ -49,7 +49,6 @@
|
||||
#include <boost/utility.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/current_function.hpp>
|
||||
#include <boost/signals/trackable.hpp>
|
||||
|
||||
using lyx::support::libFileSearch;
|
||||
using lyx::support::ForkedcallsController;
|
||||
@ -160,9 +159,15 @@ WorkArea::WorkArea(LyXView & lyx_view)
|
||||
|
||||
void WorkArea::setBufferView(BufferView * buffer_view)
|
||||
{
|
||||
if (buffer_view_)
|
||||
message_connection_.disconnect();
|
||||
|
||||
hideCursor();
|
||||
buffer_view_ = buffer_view;
|
||||
toggleCursor();
|
||||
|
||||
message_connection_ = buffer_view_->message.connect(
|
||||
boost::bind(&WorkArea::displayMessage, this, _1));
|
||||
}
|
||||
|
||||
|
||||
@ -406,5 +411,11 @@ void WorkArea::toggleCursor()
|
||||
cursor_timeout_.restart();
|
||||
}
|
||||
|
||||
|
||||
void WorkArea::displayMessage(std::string const & message)
|
||||
{
|
||||
lyx_view_.message(message);
|
||||
}
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
@ -34,6 +34,7 @@ int const CursorShape = CursorShape;
|
||||
#include "frontends/LyXKeySym.h"
|
||||
#include "frontends/Timeout.h"
|
||||
|
||||
#include <boost/signals/trackable.hpp>
|
||||
|
||||
class BufferView;
|
||||
class FuncRequest;
|
||||
@ -61,7 +62,7 @@ enum CursorShape {
|
||||
* It works in concert with the BaseScreen class to update the
|
||||
* widget view of a document.
|
||||
*/
|
||||
class WorkArea {
|
||||
class WorkArea : public boost::signals::trackable {
|
||||
public:
|
||||
WorkArea(LyXView & lyx_view);
|
||||
|
||||
@ -143,6 +144,10 @@ private:
|
||||
void updateScrollbar();
|
||||
///
|
||||
void checkAndGreyOut();
|
||||
///
|
||||
void displayMessage(std::string const &);
|
||||
/// buffer messages signal connection
|
||||
boost::signals::connection message_connection_;
|
||||
|
||||
///
|
||||
bool greyed_out_;
|
||||
|
@ -289,7 +289,7 @@ void find(BufferView * bv, FuncRequest const & ev)
|
||||
|
||||
if (!found)
|
||||
// emit message signal.
|
||||
bv->buffer()->message(_("String not found!"));
|
||||
bv->message(_("String not found!"));
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user