}
-void BufferView::setState()
+void BufferView::switchKeyMap()
{
- pimpl_->setState();
+ pimpl_->switchKeyMap();
}
void scrollDocView(int);
///
- void setState();
+ void switchKeyMap();
///
bool ChangeInsets(Inset::Code code, string const & from,
owner()->message(_("No further undo information"));
else
update(text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
- setState();
+ switchKeyMap();
}
}
owner()->message(_("No further redo information"));
else
update(text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
- setState();
+ switchKeyMap();
}
}
bv_->text->first_y = screen().topCursorVisible(bv_->text->cursor, bv_->text->first_y);
- setState();
+ switchKeyMap();
owner_->allowInput();
/// clear the "Formatting Document" message
workarea().haveSelection(bv_->getLyXText()->selection.set());
}
- setState();
- owner_->showState();
+ switchKeyMap();
+ owner_->view_state_changed();
owner_->updateMenubar();
owner_->updateToolbar();
}
-void BufferView::Pimpl::setState()
+void BufferView::Pimpl::switchKeyMap()
{
if (!lyxrc.rtl_support)
return;
if (!lt->selection.set())
workarea().haveSelection(false);
- /* ---> Everytime the cursor is moved, show the current font state. */
- // should this too me moved out of this func?
- //owner->showState();
- setState();
+ switchKeyMap();
}
case LFUN_PASTE:
bv_->paste();
- setState();
+ switchKeyMap();
break;
case LFUN_PASTESELECTION:
case LFUN_LAYOUT_PASTE:
bv_->pasteEnvironment();
- setState();
+ switchKeyMap();
break;
case LFUN_GOTOERROR:
BufferView::SELECT
| BufferView::FITCUR
| BufferView::CHANGE);
- setState();
+ switchKeyMap();
}
}
break;
case LFUN_LANGUAGE:
lang(bv_, argument);
- setState();
- owner_->showState();
+ switchKeyMap();
+ owner_->view_state_changed();
break;
case LFUN_EMPH:
emph(bv_);
- owner_->showState();
+ owner_->view_state_changed();
break;
case LFUN_BOLD:
bold(bv_);
- owner_->showState();
+ owner_->view_state_changed();
break;
case LFUN_NOUN:
noun(bv_);
- owner_->showState();
+ owner_->view_state_changed();
break;
case LFUN_CODE:
code(bv_);
- owner_->showState();
+ owner_->view_state_changed();
break;
case LFUN_SANS:
sans(bv_);
- owner_->showState();
+ owner_->view_state_changed();
break;
case LFUN_ROMAN:
roman(bv_);
- owner_->showState();
+ owner_->view_state_changed();
break;
case LFUN_DEFAULT:
styleReset(bv_);
- owner_->showState();
+ owner_->view_state_changed();
break;
case LFUN_UNDERLINE:
underline(bv_);
- owner_->showState();
+ owner_->view_state_changed();
break;
case LFUN_FONT_SIZE:
fontSize(bv_, argument);
- owner_->showState();
+ owner_->view_state_changed();
break;
case LFUN_FONT_STATE:
lt->cursorRight(bv_, false);
finishUndo();
moveCursorUpdate(false);
- owner_->showState();
+ owner_->view_state_changed();
}
break;
finishUndo();
moveCursorUpdate(false);
- owner_->showState();
+ owner_->view_state_changed();
}
break;
lt->cursorUp(bv_);
finishUndo();
moveCursorUpdate(false);
- owner_->showState();
+ owner_->view_state_changed();
}
break;
lt->cursorDown(bv_);
finishUndo();
moveCursorUpdate(false);
- owner_->showState();
+ owner_->view_state_changed();
}
break;
lt->cursorUpParagraph(bv_);
finishUndo();
moveCursorUpdate(false);
- owner_->showState();
+ owner_->view_state_changed();
}
break;
lt->cursorDownParagraph(bv_);
finishUndo();
moveCursorUpdate(false);
- owner_->showState();
+ owner_->view_state_changed();
}
break;
cursorPrevious(lt);
finishUndo();
moveCursorUpdate(false, false);
- owner_->showState();
+ owner_->view_state_changed();
}
break;
cursorNext(lt);
finishUndo();
moveCursorUpdate(false, false);
- owner_->showState();
+ owner_->view_state_changed();
}
break;
lt->cursorHome(bv_);
finishUndo();
moveCursorUpdate(false);
- owner_->showState();
+ owner_->view_state_changed();
}
break;
lt->cursorEnd(bv_);
finishUndo();
moveCursorUpdate(false);
- owner_->showState();
+ owner_->view_state_changed();
}
break;
lt->cursorTab(bv_);
finishUndo();
moveCursorUpdate(false);
- owner_->showState();
+ owner_->view_state_changed();
}
break;
lt->cursorRightOneWord(bv_);
finishUndo();
moveCursorUpdate(false);
- owner_->showState();
+ owner_->view_state_changed();
}
break;
lt->cursorLeftOneWord(bv_);
finishUndo();
moveCursorUpdate(false);
- owner_->showState();
+ owner_->view_state_changed();
}
break;
lt->cursorTop(bv_);
finishUndo();
moveCursorUpdate(false);
- owner_->showState();
+ owner_->view_state_changed();
}
break;
lt->cursorBottom(bv_);
finishUndo();
moveCursorUpdate(false);
- owner_->showState();
+ owner_->view_state_changed();
}
break;
lt->cursorRight(bv_);
finishUndo();
moveCursorUpdate(true);
- owner_->showState();
+ owner_->view_state_changed();
}
break;
lt->cursorLeft(bv_);
finishUndo();
moveCursorUpdate(true);
- owner_->showState();
+ owner_->view_state_changed();
}
break;
lt->cursorUp(bv_, true);
finishUndo();
moveCursorUpdate(true);
- owner_->showState();
+ owner_->view_state_changed();
}
break;
lt->cursorDown(bv_, true);
finishUndo();
moveCursorUpdate(true);
- owner_->showState();
+ owner_->view_state_changed();
}
break;
lt->cursorUpParagraph(bv_);
finishUndo();
moveCursorUpdate(true);
- owner_->showState();
+ owner_->view_state_changed();
}
break;
lt->cursorDownParagraph(bv_);
finishUndo();
moveCursorUpdate(true);
- owner_->showState();
+ owner_->view_state_changed();
}
break;
cursorPrevious(lt);
finishUndo();
moveCursorUpdate(true);
- owner_->showState();
+ owner_->view_state_changed();
}
break;
cursorNext(lt);
finishUndo();
moveCursorUpdate(true);
- owner_->showState();
+ owner_->view_state_changed();
}
break;
lt->cursorHome(bv_);
finishUndo();
moveCursorUpdate(true);
- owner_->showState();
+ owner_->view_state_changed();
}
break;
lt->cursorEnd(bv_);
finishUndo();
moveCursorUpdate(true);
- owner_->showState();
+ owner_->view_state_changed();
}
break;
lt->cursorRightOneWord(bv_);
finishUndo();
moveCursorUpdate(true);
- owner_->showState();
+ owner_->view_state_changed();
}
break;
lt->cursorLeftOneWord(bv_);
finishUndo();
moveCursorUpdate(true);
- owner_->showState();
+ owner_->view_state_changed();
}
break;
lt->cursorTop(bv_);
finishUndo();
moveCursorUpdate(true);
- owner_->showState();
+ owner_->view_state_changed();
}
break;
lt->cursorBottom(bv_);
finishUndo();
moveCursorUpdate(true);
- owner_->showState();
+ owner_->view_state_changed();
}
break;
bv_->cut(false);
}
moveCursorUpdate(false);
- owner_->showState();
- setState();
+ owner_->view_state_changed();
+ switchKeyMap();
}
break;
bv_->getLyXText()->deleteWordForward(bv_);
update(bv_->getLyXText(), BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
moveCursorUpdate(false);
- owner_->showState();
+ owner_->view_state_changed();
break;
/* -------> Delete word backward. */
| BufferView::FITCUR
| BufferView::CHANGE);
moveCursorUpdate(false);
- owner_->showState();
+ owner_->view_state_changed();
}
break;
} else {
bv_->cut(false);
}
- owner_->showState();
- setState();
+ owner_->view_state_changed();
+ switchKeyMap();
}
break;
| BufferView::FITCUR
| BufferView::CHANGE);
lt->selection.cursor = lt->cursor;
- setState();
- owner_->showState();
+ switchKeyMap();
+ owner_->view_state_changed();
break;
}
| BufferView::FITCUR
| BufferView::CHANGE);
lt->selection.cursor = lt->cursor;
- setState();
- owner_->showState();
+ switchKeyMap();
+ owner_->view_state_changed();
break;
}
| BufferView::FITCUR
| BufferView::CHANGE);
lt->selection.cursor = cursor;
- setState();
- owner_->showState();
+ switchKeyMap();
+ owner_->view_state_changed();
}
break;
update(lt, BufferView::SELECT|BufferView::FITCUR);
lt->toggleInset(bv_);
update(lt, BufferView::SELECT|BufferView::FITCUR);
- setState();
+ switchKeyMap();
}
break;
// real_current_font.number can change so we need to
// update the minibuffer
if (old_font != lt->real_current_font)
- owner_->showState();
+ owner_->view_state_changed();
//return string();
}
break;
///
bool isSavedPosition(unsigned int i);
///
- void setState();
+ void switchKeyMap();
///
void insetUnlock();
///
+2002-07-17 John Levon <moz@compsoc.man.ac.uk>
+
+ * BufferView.h:
+ * BufferView.C:
+ * BufferView2.C:
+ * BufferView_pimpl.h:
+ * BufferView_pimpl.C:
+ * lyxfunc.C: s/setState/switchKeyMap/, s/showState/view_state_changed/
+
2002-07-16 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
* MenuBackend.C (expand): add numeric shortcuts to document menu
+2002-07-17 John Levon <moz@compsoc.man.ac.uk>
+
+ * LyXView.h:
+ * LyXView.C: change showState to view_state_changed signal
+
2002-07-14 John Levon <moz@compsoc.man.ac.uk>
* lyx_gui.h: add set_read_callback()
last_title = title;
}
}
-
-
-void LyXView::showState()
-{
- message(currentState(view()));
-}
#include <boost/utility.hpp>
#include <boost/scoped_ptr.hpp>
#include <boost/signals/trackable.hpp>
+#include <boost/signals/signal0.hpp>
class Buffer;
class Toolbar;
/// update the menubar
void updateMenubar();
+ /// view state string changed
+ boost::signal0<void> view_state_changed;
+
/// display a message in the view
void message(string const &);
/// push a message onto the history, and show it
void messagePush(string const & str);
/// pop the last message pushed
void messagePop();
- /// show state (font etc.) in minibuffer
- void showState();
/// updates the title of the window
void updateWindowTitle();
+2002-07-17 John Levon <moz@compsoc.man.ac.uk>
+
+ * ControlCharacter.C: use view_state_changed not setState
+
2002-07-15 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
* biblio.C (parseBibTeX): use ascii_lowercase instead of lowercase
view().apply();
toggleAndShow(lv_.view(), *(font_.get()), toggleall_);
- lv_.view()->setState();
+ lv_.view_state_changed();
lv_.buffer()->markDirty();
setMinibuffer(&lv_, _("Character set"));
}
+2002-07-17 John Levon <moz@compsoc.man.ac.uk>
+
+ * QtView.C: basic statusbar show
+
2002-07-17 John Levon <moz@compsoc.man.ac.uk>
* QLImage.C: add using std
#include "LString.h"
-#include "MiniBuffer.h"
+#include "frontends/MiniBuffer.h"
#ifdef __GNUG__
#pragma interface
#include "QMiniBuffer.h"
#include "ToolbarDefaults.h"
#include "lyxfunc.h"
+#include "bufferview_funcs.h"
#include "BufferView.h"
#include "frontends/Toolbar.h"
#include <qmenubar.h>
#include <qstatusbar.h>
+#include <boost/bind.hpp>
+
using std::endl;
// FIXME: this has to go away
bufferview_.reset(new BufferView(this, 0, 0, width, height));
::current_view = bufferview_.get();
+ view_state_changed.connect(boost::bind(&QtView::update_view_state, this));
+
// FIXME: move
// FIXME autosave_timeout_->timeout.connect(SigC::slot(this, &QtView::autoSave));
}
+void QtView::update_view_state()
+{
+ statusBar()->message(currentState(view()).c_str());
+}
+
+
void QtView::activated(int id)
{
getLyXFunc()->verboseDispatch(id, true);
virtual void closeEvent(QCloseEvent * e);
private:
+ /// update status bar
+ void update_view_state();
+
/**
* setWindowTitle - set title of window
* @param t main window title
view.getLyXFunc()->verboseDispatch(batch, false);
}
+ // FIXME: something somewhere is EATING CPU
while (!finished) {
qApp->processEvents();
}
+2002-07-17 John Levon <moz@compsoc.man.ac.uk>
+
+ * XFormsView.h:
+ * XFormsView.C: hook up view_state_changed
+
2002-07-16 Angus Leeming <leeming@lyx.org>
* XPainter.C: add some #ifdef ugliness to enable the home grown image
minibuffer_->inputReady.connect(boost::bind(&LyXFunc::miniDispatch, getLyXFunc(), _1));
minibuffer_->timeout.connect(boost::bind(&LyXFunc::initMiniBuffer, getLyXFunc()));
+ view_state_changed.connect(boost::bind(&XFormsView::update_view_state, this));
+
// Make sure the buttons are disabled if needed.
updateToolbar();
getDialogs()->redrawGUI.connect(boost::bind(&XFormsView::redraw, this));
}
+void XFormsView::update_view_state()
+{
+ minibuffer_->message(currentState(view()));
+}
+
+
// How should this actually work? Should it prohibit input in all BufferViews,
// or just in the current one? If "just the current one", then it should be
// placed in BufferView. If "all BufferViews" then LyXGUI (I think) should
*/
virtual void setWindowTitle(string const & t, string const & it);
+ /// update the minibuffer state message
+ void update_view_state();
+
/// makes the main form.
void create_form_form_main(Dialogs & d, int width, int height);
/// the main form.
+2002-07-17 John Levon <moz@compsoc.man.ac.uk>
+
+ * insettext.C: use view_state_changed, switchKeyMap
+
2002-07-17 Herbert Voss <voss@perce.de>
* insetgraphics.C (prepareFile): keep the extension when
if (need_update == CURSOR)
need_update = NONE;
- bv->owner()->showState();
+ bv->owner()->view_state_changed();
bv->owner()->updateMenubar();
bv->owner()->updateToolbar();
if (old_par != cpar(bv)) {
setUndo(bv, Undo::INSERT,
lt->cursor.par(), lt->cursor.par()->next());
- bv->setState();
+ bv->switchKeyMap();
if (lyxrc.auto_region_delete) {
if (lt->selection.set()) {
lt->cutSelection(bv, false);
}
-// I changed this func slightly. I commented out the ...FinishUndo(),
-// this means that all places that used to have a moveCursorUpdate, now
-// have a ...FinishUndo() as the preceeding statement. I have also added
-// a moveCursorUpdate to some of the functions that updated the cursor, but
-// that did not show its new position.
inline
void LyXFunc::moveCursorUpdate(bool flag, bool selecting)
{
owner->view()->update(TEXT(flag), BufferView::SELECT|BufferView::FITCUR);
owner->view()->showCursor();
- /* ---> Everytime the cursor is moved, show the current font state. */
- // should this too me moved out of this func?
- owner->view()->setState();
+ owner->view()->switchKeyMap();
}
} else if (result == UpdatableInset::FINISHED_RIGHT) {
TEXT()->cursorRight(owner->view());
moveCursorUpdate(true, false);
- owner->showState();
+ owner->view_state_changed();
goto exit_with_message;
} else if (result == UpdatableInset::FINISHED_UP) {
if (TEXT()->cursor.irow()->previous()) {
TEXT()->cursorUp(owner->view());
#endif
moveCursorUpdate(true, false);
- owner->showState();
+ owner->view_state_changed();
} else {
owner->view()->update(TEXT(), BufferView::SELECT|BufferView::FITCUR);
}
TEXT()->cursorRight(owner->view());
}
moveCursorUpdate(true, false);
- owner->showState();
+ owner->view_state_changed();
goto exit_with_message;
}
#warning I am not sure this is still right, please have a look! (Jug 20020417)
case LFUN_BREAKPARAGRAPH:
case LFUN_BREAKLINE:
TEXT()->cursorRight(owner->view());
- owner->view()->setState();
- owner->showState();
+ owner->view()->switchKeyMap();
+ owner->view_state_changed();
break;
case LFUN_RIGHT:
if (!TEXT()->cursor.par()->isRightToLeftPar(owner->buffer()->params)) {
TEXT()->cursorRight(owner->view());
moveCursorUpdate(true, false);
- owner->showState();
+ owner->view_state_changed();
}
goto exit_with_message;
case LFUN_LEFT:
if (TEXT()->cursor.par()->isRightToLeftPar(owner->buffer()->params)) {
TEXT()->cursorRight(owner->view());
moveCursorUpdate(true, false);
- owner->showState();
+ owner->view_state_changed();
}
goto exit_with_message;
case LFUN_DOWN:
else
TEXT()->cursorRight(owner->view());
moveCursorUpdate(true, false);
- owner->showState();
+ owner->view_state_changed();
goto exit_with_message;
default:
break;
owner->view()->unlockInset(tli);
TEXT()->cursorRight(owner->view());
moveCursorUpdate(true, false);
- owner->showState();
+ owner->view_state_changed();
} else {
tli->unlockInsetInInset(owner->view(),
lock,
}
// Set the cursor
owner->view()->getLyXText()->setCursor(owner->view(), par, 0);
- owner->view()->setState();
- owner->showState();
+ owner->view()->switchKeyMap();
+ owner->view_state_changed();
owner->view()->center();
// see BufferView_pimpl::center()