mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-03 08:28:25 +00:00
LyXView::view() now returns boost::shared_ptr<BufferView> const &.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4836 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
d47e8c38e3
commit
eed7fcfdf4
@ -1,3 +1,9 @@
|
||||
2002-08-02 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* importer.C (Import):
|
||||
* lyxfunc.C (moveCursorUpdate, dispatch, view_status_message):
|
||||
changes due to LyXView::view() now returning a boost::shared_ptr.
|
||||
|
||||
2002-08-02 John Levon <levon@movementarian.org>
|
||||
|
||||
* text2.C (status): small cleanup, no logic change
|
||||
|
@ -1,3 +1,12 @@
|
||||
2002-08-02 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* LyXView.[Ch] (view): now returns shared_ptr<BufferView> const &
|
||||
so that anything wanting to cache the buffer view can do so safely
|
||||
using a boost::weak_ptr.
|
||||
|
||||
* LyXView.h: store bufferview_ as a shared_ptr, not as a scoped_ptr.
|
||||
Spell Bjønnes correctly.
|
||||
|
||||
2002-08-01 John Levon <levon@movementarian.org>
|
||||
|
||||
* Dialogs.h:
|
||||
|
@ -86,9 +86,9 @@ Buffer * LyXView::buffer() const
|
||||
}
|
||||
|
||||
|
||||
BufferView * LyXView::view() const
|
||||
boost::shared_ptr<BufferView> const & LyXView::view() const
|
||||
{
|
||||
return bufferview_.get();
|
||||
return bufferview_;
|
||||
}
|
||||
|
||||
|
||||
@ -139,7 +139,7 @@ void LyXView::autoSave()
|
||||
lyxerr[Debug::INFO] << "Running autoSave()" << endl;
|
||||
|
||||
if (view()->available()) {
|
||||
::AutoSave(view());
|
||||
::AutoSave(view().get());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Copyright 1995-2002 the LyX Team
|
||||
* Read the file COPYING
|
||||
*
|
||||
* \author Lars Gullik Bjornes <larsbj@lyx.org>
|
||||
* \author Lars Gullik Bjønnes <larsbj@lyx.org>
|
||||
* \author John Levon <moz@compsoc.man.ac.uk>
|
||||
*/
|
||||
|
||||
@ -21,6 +21,7 @@
|
||||
|
||||
#include <boost/utility.hpp>
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/signals/trackable.hpp>
|
||||
#include <boost/signals/signal0.hpp>
|
||||
|
||||
@ -70,8 +71,11 @@ public:
|
||||
|
||||
//@{ generic accessor functions
|
||||
|
||||
/// return the current buffer view
|
||||
BufferView * view() const;
|
||||
/** return the current buffer view
|
||||
Returned as a shared_ptr so that anything wanting to cache the
|
||||
buffer view can do so safely using a boost::weak_ptr.
|
||||
*/
|
||||
boost::shared_ptr<BufferView> const & view() const;
|
||||
|
||||
/// return the LyX function handler for this view
|
||||
LyXFunc * getLyXFunc() const;
|
||||
@ -120,7 +124,7 @@ public:
|
||||
|
||||
protected:
|
||||
/// view of a buffer. Eventually there will be several.
|
||||
boost::scoped_ptr<BufferView> bufferview_;
|
||||
boost::shared_ptr<BufferView> bufferview_;
|
||||
|
||||
/// view's menubar
|
||||
boost::scoped_ptr<Menubar> menubar_;
|
||||
|
@ -1,3 +1,12 @@
|
||||
2002-08-02 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* ControlCharacter.C (apply):
|
||||
* ControlERT.C (applyParamsToInset):
|
||||
* ControlParagraph.C (apply):
|
||||
* ControlSearch.C (find, replace):
|
||||
* ControlThesaurus.C (replace): changes due to LyXView::view() now
|
||||
returning a boost::shared_ptr.
|
||||
|
||||
2002-08-01 John Levon <levon@movementarian.org>
|
||||
|
||||
* ControlSendto.C: writeFile() change
|
||||
|
@ -62,7 +62,7 @@ void ControlCharacter::apply()
|
||||
if (lv_.view()->available())
|
||||
view().apply();
|
||||
|
||||
toggleAndShow(lv_.view(), *(font_.get()), toggleall_);
|
||||
toggleAndShow(lv_.view().get(), *(font_.get()), toggleall_);
|
||||
lv_.view_state_changed();
|
||||
lv_.buffer()->markDirty();
|
||||
setMinibuffer(&lv_, _("Character set"));
|
||||
|
@ -30,7 +30,7 @@ ControlERT::ControlERT(LyXView & lv, Dialogs & d)
|
||||
|
||||
void ControlERT::applyParamsToInset()
|
||||
{
|
||||
inset()->status(lv_.view(), params().status);
|
||||
inset()->status(lv_.view().get(), params().status);
|
||||
}
|
||||
|
||||
|
||||
|
@ -63,7 +63,7 @@ void ControlParagraph::apply()
|
||||
view().apply();
|
||||
|
||||
LyXText * text(lv_.view()->getLyXText());
|
||||
text->setParagraph(lv_.view(),
|
||||
text->setParagraph(lv_.view().get(),
|
||||
pp_->lineTop(),
|
||||
pp_->lineBottom(),
|
||||
pp_->pagebreakTop(),
|
||||
|
@ -39,7 +39,7 @@ ControlSearch::ControlSearch(LyXView & lv, Dialogs & d)
|
||||
void ControlSearch::find(string const & search,
|
||||
bool casesensitive, bool matchword, bool forward) const
|
||||
{
|
||||
bool const found = lyxfind::LyXFind(lv_.view(), search,
|
||||
bool const found = lyxfind::LyXFind(lv_.view().get(), search,
|
||||
forward, casesensitive,
|
||||
matchword);
|
||||
|
||||
@ -56,7 +56,7 @@ void ControlSearch::replace(string const & search, string const & replace,
|
||||
// changed
|
||||
bool const once = !all;
|
||||
int const replace_count =
|
||||
lyxfind::LyXReplace(lv_.view(),
|
||||
lyxfind::LyXReplace(lv_.view().get(),
|
||||
search, replace, true, casesensitive,
|
||||
matchword, all, once);
|
||||
|
||||
|
@ -43,7 +43,7 @@ void ControlThesaurus::replace(string const & newstr)
|
||||
* deletion/change !
|
||||
*/
|
||||
int const replace_count =
|
||||
lyxfind::LyXReplace(lv_.view(), oldstr_, newstr,
|
||||
lyxfind::LyXReplace(lv_.view().get(), oldstr_, newstr,
|
||||
true, true, true, false, true);
|
||||
|
||||
oldstr_ = newstr;
|
||||
|
@ -1,3 +1,9 @@
|
||||
2002-08-02 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* FormTabular.C (input):
|
||||
* XMiniBuffer.C (show_info): changes due to LyXView::view() now
|
||||
returning a boost::shared_ptr.
|
||||
|
||||
2002-08-01 John Levon <levon@movementarian.org>
|
||||
|
||||
* FormDocument.C: writeFile() change
|
||||
|
@ -558,7 +558,7 @@ bool FormTabular::input(FL_OBJECT * ob, long)
|
||||
string const str =
|
||||
getLengthFromWidgets(column_options_->input_column_width,
|
||||
column_options_->choice_value_column_width);
|
||||
inset_->tabularFeatures(lv_->view(), LyXTabular::SET_PWIDTH, str);
|
||||
inset_->tabularFeatures(lv_->view().get(), LyXTabular::SET_PWIDTH, str);
|
||||
|
||||
//check if the input is valid
|
||||
string const input =
|
||||
@ -577,7 +577,7 @@ bool FormTabular::input(FL_OBJECT * ob, long)
|
||||
string const str =
|
||||
getLengthFromWidgets(cell_options_->input_mcolumn_width,
|
||||
cell_options_->choice_value_mcolumn_width);
|
||||
inset_->tabularFeatures(lv_->view(), LyXTabular::SET_MPWIDTH, str);
|
||||
inset_->tabularFeatures(lv_->view().get(), LyXTabular::SET_MPWIDTH, str);
|
||||
|
||||
//check if the input is valid
|
||||
string const input =
|
||||
@ -690,7 +690,7 @@ bool FormTabular::input(FL_OBJECT * ob, long)
|
||||
else
|
||||
return false;
|
||||
|
||||
inset_->tabularFeatures(lv_->view(), num, special);
|
||||
inset_->tabularFeatures(lv_->view().get(), num, special);
|
||||
update();
|
||||
|
||||
return true;
|
||||
|
@ -230,7 +230,7 @@ void XMiniBuffer::show_info(string const & info, string const & input, bool appe
|
||||
|
||||
void XMiniBuffer::idle_timeout()
|
||||
{
|
||||
set_input(currentState(view_->view()));
|
||||
set_input(currentState(view_->view().get()));
|
||||
}
|
||||
|
||||
|
||||
|
@ -77,7 +77,7 @@ bool Importer::Import(LyXView * lv, string const & filename,
|
||||
string filename2 = (loader_format == format) ? filename
|
||||
: ChangeExtension(filename,
|
||||
formats.extension(loader_format));
|
||||
InsertAsciiFile(lv->view(), filename2, as_paragraphs);
|
||||
InsertAsciiFile(lv->view().get(), filename2, as_paragraphs);
|
||||
lv->getLyXFunc()->dispatch(LFUN_MARK_OFF);
|
||||
}
|
||||
|
||||
|
@ -148,7 +148,7 @@ inline
|
||||
void LyXFunc::moveCursorUpdate(bool flag, bool selecting)
|
||||
{
|
||||
if (selecting || TEXT(flag)->selection.mark()) {
|
||||
TEXT(flag)->setSelection(owner->view());
|
||||
TEXT(flag)->setSelection(owner->view().get());
|
||||
if (TEXT(flag)->bv_owner)
|
||||
owner->view()->toggleToggle();
|
||||
}
|
||||
@ -760,7 +760,7 @@ void LyXFunc::dispatch(kb_action action, string argument, bool verbose)
|
||||
#if 1
|
||||
int inset_x;
|
||||
int dummy_y;
|
||||
inset->getCursorPos(owner->view(), inset_x, dummy_y);
|
||||
inset->getCursorPos(owner->view().get(), inset_x, dummy_y);
|
||||
#endif
|
||||
if ((action == LFUN_UNKNOWN_ACTION)
|
||||
&& argument.empty()) {
|
||||
@ -775,7 +775,7 @@ void LyXFunc::dispatch(kb_action action, string argument, bool verbose)
|
||||
goto exit_with_message;
|
||||
} else if (((result=inset->
|
||||
// Hand-over to inset's own dispatch:
|
||||
localDispatch(owner->view(), action, argument)) ==
|
||||
localDispatch(owner->view().get(), action, argument)) ==
|
||||
UpdatableInset::DISPATCHED) ||
|
||||
(result == UpdatableInset::DISPATCHED_NOUPDATE))
|
||||
goto exit_with_message;
|
||||
@ -786,7 +786,7 @@ void LyXFunc::dispatch(kb_action action, string argument, bool verbose)
|
||||
// FINISHED means that the cursor should be
|
||||
// one position after the inset.
|
||||
} else if (result == UpdatableInset::FINISHED_RIGHT) {
|
||||
TEXT()->cursorRight(owner->view());
|
||||
TEXT()->cursorRight(owner->view().get());
|
||||
moveCursorUpdate(true, false);
|
||||
owner->view_state_changed();
|
||||
goto exit_with_message;
|
||||
@ -794,12 +794,12 @@ void LyXFunc::dispatch(kb_action action, string argument, bool verbose)
|
||||
if (TEXT()->cursor.irow()->previous()) {
|
||||
#if 1
|
||||
TEXT()->setCursorFromCoordinates(
|
||||
owner->view(), TEXT()->cursor.ix() + inset_x,
|
||||
owner->view().get(), TEXT()->cursor.ix() + inset_x,
|
||||
TEXT()->cursor.iy() -
|
||||
TEXT()->cursor.irow()->baseline() - 1);
|
||||
TEXT()->cursor.x_fix(TEXT()->cursor.x());
|
||||
#else
|
||||
TEXT()->cursorUp(owner->view());
|
||||
TEXT()->cursorUp(owner->view().get());
|
||||
#endif
|
||||
moveCursorUpdate(true, false);
|
||||
owner->view_state_changed();
|
||||
@ -811,16 +811,16 @@ void LyXFunc::dispatch(kb_action action, string argument, bool verbose)
|
||||
if (TEXT()->cursor.irow()->next()) {
|
||||
#if 1
|
||||
TEXT()->setCursorFromCoordinates(
|
||||
owner->view(), TEXT()->cursor.ix() + inset_x,
|
||||
owner->view().get(), TEXT()->cursor.ix() + inset_x,
|
||||
TEXT()->cursor.iy() -
|
||||
TEXT()->cursor.irow()->baseline() +
|
||||
TEXT()->cursor.irow()->height() + 1);
|
||||
TEXT()->cursor.x_fix(TEXT()->cursor.x());
|
||||
#else
|
||||
TEXT()->cursorDown(owner->view());
|
||||
TEXT()->cursorDown(owner->view().get());
|
||||
#endif
|
||||
} else {
|
||||
TEXT()->cursorRight(owner->view());
|
||||
TEXT()->cursorRight(owner->view().get());
|
||||
}
|
||||
moveCursorUpdate(true, false);
|
||||
owner->view_state_changed();
|
||||
@ -833,29 +833,29 @@ void LyXFunc::dispatch(kb_action action, string argument, bool verbose)
|
||||
case LFUN_UNKNOWN_ACTION:
|
||||
case LFUN_BREAKPARAGRAPH:
|
||||
case LFUN_BREAKLINE:
|
||||
TEXT()->cursorRight(owner->view());
|
||||
TEXT()->cursorRight(owner->view().get());
|
||||
owner->view()->switchKeyMap();
|
||||
owner->view_state_changed();
|
||||
break;
|
||||
case LFUN_RIGHT:
|
||||
if (!TEXT()->cursor.par()->isRightToLeftPar(owner->buffer()->params)) {
|
||||
TEXT()->cursorRight(owner->view());
|
||||
TEXT()->cursorRight(owner->view().get());
|
||||
moveCursorUpdate(true, false);
|
||||
owner->view_state_changed();
|
||||
}
|
||||
goto exit_with_message;
|
||||
case LFUN_LEFT:
|
||||
if (TEXT()->cursor.par()->isRightToLeftPar(owner->buffer()->params)) {
|
||||
TEXT()->cursorRight(owner->view());
|
||||
TEXT()->cursorRight(owner->view().get());
|
||||
moveCursorUpdate(true, false);
|
||||
owner->view_state_changed();
|
||||
}
|
||||
goto exit_with_message;
|
||||
case LFUN_DOWN:
|
||||
if (TEXT()->cursor.row()->next())
|
||||
TEXT()->cursorDown(owner->view());
|
||||
TEXT()->cursorDown(owner->view().get());
|
||||
else
|
||||
TEXT()->cursorRight(owner->view());
|
||||
TEXT()->cursorRight(owner->view().get());
|
||||
moveCursorUpdate(true, false);
|
||||
owner->view_state_changed();
|
||||
goto exit_with_message;
|
||||
@ -879,11 +879,11 @@ void LyXFunc::dispatch(kb_action action, string argument, bool verbose)
|
||||
|
||||
if (tli == lock) {
|
||||
owner->view()->unlockInset(tli);
|
||||
TEXT()->cursorRight(owner->view());
|
||||
TEXT()->cursorRight(owner->view().get());
|
||||
moveCursorUpdate(true, false);
|
||||
owner->view_state_changed();
|
||||
} else {
|
||||
tli->unlockInsetInInset(owner->view(),
|
||||
tli->unlockInsetInInset(owner->view().get(),
|
||||
lock,
|
||||
true);
|
||||
}
|
||||
@ -908,7 +908,7 @@ void LyXFunc::dispatch(kb_action action, string argument, bool verbose)
|
||||
}
|
||||
bool fw = (action == LFUN_WORDFINDBACKWARD);
|
||||
if (!searched_string.empty()) {
|
||||
lyxfind::LyXFind(owner->view(), searched_string, fw);
|
||||
lyxfind::LyXFind(owner->view().get(), searched_string, fw);
|
||||
}
|
||||
// owner->view()->showCursor();
|
||||
}
|
||||
@ -977,15 +977,15 @@ void LyXFunc::dispatch(kb_action action, string argument, bool verbose)
|
||||
s1 << _("Saving document") << ' '
|
||||
<< MakeDisplayPath(owner->buffer()->fileName() + "...");
|
||||
owner->message(s1.str().c_str());
|
||||
MenuWrite(owner->view(), owner->buffer());
|
||||
MenuWrite(owner->view().get(), owner->buffer());
|
||||
s1 << _(" done.");
|
||||
owner->message(s1.str().c_str());
|
||||
} else
|
||||
WriteAs(owner->view(), owner->buffer());
|
||||
WriteAs(owner->view().get(), owner->buffer());
|
||||
break;
|
||||
|
||||
case LFUN_WRITEAS:
|
||||
WriteAs(owner->view(), owner->buffer(), argument);
|
||||
WriteAs(owner->view().get(), owner->buffer(), argument);
|
||||
break;
|
||||
|
||||
case LFUN_MENURELOAD:
|
||||
@ -1057,7 +1057,7 @@ void LyXFunc::dispatch(kb_action action, string argument, bool verbose)
|
||||
break;
|
||||
|
||||
case LFUN_AUTOSAVE:
|
||||
AutoSave(owner->view());
|
||||
AutoSave(owner->view().get());
|
||||
break;
|
||||
|
||||
case LFUN_UNDO:
|
||||
@ -1081,11 +1081,11 @@ void LyXFunc::dispatch(kb_action action, string argument, bool verbose)
|
||||
break;
|
||||
|
||||
case LFUN_DEPTH_MIN:
|
||||
changeDepth(owner->view(), TEXT(false), -1);
|
||||
changeDepth(owner->view().get(), TEXT(false), -1);
|
||||
break;
|
||||
|
||||
case LFUN_DEPTH_PLUS:
|
||||
changeDepth(owner->view(), TEXT(false), 1);
|
||||
changeDepth(owner->view().get(), TEXT(false), 1);
|
||||
break;
|
||||
|
||||
case LFUN_FREE:
|
||||
@ -1093,7 +1093,7 @@ void LyXFunc::dispatch(kb_action action, string argument, bool verbose)
|
||||
break;
|
||||
|
||||
case LFUN_RECONFIGURE:
|
||||
Reconfigure(owner->view());
|
||||
Reconfigure(owner->view().get());
|
||||
break;
|
||||
|
||||
#if 0
|
||||
@ -1226,12 +1226,12 @@ void LyXFunc::dispatch(kb_action action, string argument, bool verbose)
|
||||
if (owner->view()->theLockingInset()->lyxCode()==Inset::TABULAR_CODE) {
|
||||
InsetTabular * inset = static_cast<InsetTabular *>
|
||||
(owner->view()->theLockingInset());
|
||||
inset->openLayoutDialog(owner->view());
|
||||
inset->openLayoutDialog(owner->view().get());
|
||||
} else if (owner->view()->theLockingInset()->
|
||||
getFirstLockingInsetOfType(Inset::TABULAR_CODE)!=0) {
|
||||
InsetTabular * inset = static_cast<InsetTabular *>(
|
||||
owner->view()->theLockingInset()->getFirstLockingInsetOfType(Inset::TABULAR_CODE));
|
||||
inset->openLayoutDialog(owner->view());
|
||||
inset->openLayoutDialog(owner->view().get());
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -1313,10 +1313,10 @@ void LyXFunc::dispatch(kb_action action, string argument, bool verbose)
|
||||
if (owner->view()->theLockingInset())
|
||||
owner->view()->unlockInset(owner->view()->theLockingInset());
|
||||
if (par->inInset()) {
|
||||
par->inInset()->edit(owner->view());
|
||||
par->inInset()->edit(owner->view().get());
|
||||
}
|
||||
// Set the cursor
|
||||
owner->view()->getLyXText()->setCursor(owner->view(), par, 0);
|
||||
owner->view()->getLyXText()->setCursor(owner->view().get(), par, 0);
|
||||
owner->view()->switchKeyMap();
|
||||
owner->view_state_changed();
|
||||
|
||||
@ -1879,5 +1879,5 @@ string const LyXFunc::view_status_message()
|
||||
if (!owner->view()->available())
|
||||
return _("Welcome to LyX!");
|
||||
|
||||
return currentState(owner->view());
|
||||
return currentState(owner->view().get());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user