-/* This file is part of
- * ======================================================
+/**
+ * \file XFormsView.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
*
- * LyX, The Document Processor
+ * \author unknown
*
- * Copyright 1995 Matthias Ettrich
- * Copyright 1995-2001 The LyX Team.
- *
- * ====================================================== */
+ * Full author contact details are available in file CREDITS
+ */
#include <config.h>
#if FL_VERSION < 1 && (FL_REVISION < 89 || (FL_REVISION == 89 && FL_FIXLEVEL < 5))
#include "frontends/xforms/lyxlookup.h"
#endif
-#include "frontends/MiniBuffer.h"
#include "frontends/xforms/XMiniBuffer.h"
#include "debug.h"
#include "intl.h"
#include "BufferView.h"
#include <boost/bind.hpp>
-
+#include <boost/signals/connection.hpp>
using std::abs;
using std::endl;
XFormsView::XFormsView(int width, int height)
: LyXView()
{
- create_form_form_main(*getDialogs(), width, height);
+ create_form_form_main(width, height);
fl_set_form_atclose(getForm(), C_XFormsView_atCloseMainFormCB, 0);
- // Connect the minibuffer signals
- minibuffer_->inputReady.connect(boost::bind(&LyXFunc::miniDispatch, getLyXFunc(), _1));
- minibuffer_->timeout.connect(boost::bind(&LyXFunc::initMiniBuffer, getLyXFunc()));
+ view_state_con = view_state_changed.connect(boost::bind(&XFormsView::show_view_state, this));
+ focus_con = focus_command_buffer.connect(boost::bind(&XMiniBuffer::focus, minibuffer_.get()));
- 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));
+ redraw_con = getDialogs().redrawGUI().connect(boost::bind(&XFormsView::redraw, this));
}
XFormsView::~XFormsView()
{
+ minibuffer_->freeze();
fl_hide_form(form_);
fl_free_form(form_);
}
{
lyxerr[Debug::INFO] << "XFormsView::redraw()" << endl;
fl_redraw_form(getForm());
- // This is dangerous, but we know it is safe
- XMiniBuffer * m = static_cast<XMiniBuffer *>(getMiniBuffer());
- m->redraw();
+ minibuffer_->redraw();
}
fl_show_form(form, placement, FL_FULLBORDER, title.c_str());
- getLyXFunc()->initMiniBuffer();
+ show_view_state();
#if FL_VERSION < 1 && (FL_REVISION < 89 || (FL_REVISION == 89 && FL_FIXLEVEL < 5))
InitLyXLookup(fl_get_display(), form_->window);
#endif
}
-void XFormsView::create_form_form_main(Dialogs & dia, int width, int height)
+void XFormsView::create_form_form_main(int width, int height)
/* to make this work as it should, .lyxrc should have been
* read first; OR maybe this one should be made dynamic.
* Hmmmm. Lgb.
menubar_.reset(new Menubar(this, menubackend));
- toolbar_.reset(new Toolbar(this, dia,
- air, 30 + air + bw, toolbardefaults));
- toolbar_->set(true);
+ toolbar_.reset(new Toolbar(this, air, 30 + air + bw, toolbardefaults));
int const ywork = 60 + 2 * air + bw;
int const workheight = height - ywork - (25 + 2 * air);
width - 3 * air, workheight));
::current_view = bufferview_.get();
- minibuffer_.reset(new XMiniBuffer(this, air, height - (25 + air),
- width - (2 * air), 25));
-
- // FIXME: why do this in xforms/ ?
- autosave_timeout_->timeout.connect(boost::bind(&XFormsView::autoSave, this));
+ minibuffer_.reset(new XMiniBuffer(this, *controlcommand_,
+ air, height - (25 + air), width - (2 * air), 25));
// assign an icon to main form
string iconname = LibFileSearch("images", "lyx", "xpm");
fl_end_form();
- // This is dangerous, but we know it is safe in this situation
- static_cast<XMiniBuffer *>(minibuffer_.get())->dd_init();
+ minibuffer_->dd_init();
}
}
-void XFormsView::update_view_state()
+void XFormsView::message(string const & str)
{
- minibuffer_->message(currentState(view()));
+ minibuffer_->message(str);
}
-
-
+
+
+void XFormsView::show_view_state()
+{
+ message(getLyXFunc().view_status_message());
+}
+
+
// 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
// run "prohibitInput" on all LyXViews which will run prohibitInput on all
// BufferViews. Or is it perhaps just the (input in) BufferViews in the
-// current LyxView that should be prohibited (Lgb) (This applies to
+// current LyXView that should be prohibited (Lgb) (This applies to
// "allowInput" as well.)
void XFormsView::prohibitInput() const
{