#include "funcrequest.h"
#include "FuncStatus.h"
-#include "lyx_main.h"
+#include "lyx_main.h" // for lyx::use_gui
#include "lyxfont.h"
#include "lyxfunc.h"
#include "lyxrc.h"
Application::Application(int &, char **)
+ : current_view_(0)
{
// FIXME: please confirm: with unicode, I think initEncoding()
// is not needed anymore!
LyXView & Application::createView(unsigned int width,
- unsigned int height,
- int posx, int posy,
- bool maximize,
- unsigned int iconSizeXY,
- const std::string & geometryArg)
+ unsigned int height,
+ int posx, int posy,
+ bool maximize,
+ unsigned int iconSizeXY,
+ const std::string & geometryArg)
{
- int view_id = gui().newView();
- LyXView & view = gui().view(view_id);
-
+ LyXView & view = gui().createRegisteredView();
+ int view_id = view.id();
+
theLyXFunc().setLyXView(&view);
/*int workArea_id_ =*/ gui().newWorkArea(width, height, view_id);
view.init();
view.setGeometry(width, height, posx, posy, maximize, iconSizeXY, geometryArg);
+ view.setFocus();
setCurrentView(view);
}
-LyXView const & Application::currentView() const
+LyXView const * Application::currentView() const
{
- return *current_view_;
+ return current_view_;
}
-LyXView & Application::currentView()
+LyXView * Application::currentView()
{
- return *current_view_;
+ return current_view_;
}
if (!use_gui)
return no_gui_font_loader;
- BOOST_ASSERT(theApp);
- return theApp->fontLoader();
+ BOOST_ASSERT(theApp());
+ return theApp()->fontLoader();
}
if (!use_gui)
return no_gui_font_metrics;
- BOOST_ASSERT(theApp);
- return theApp->fontLoader().metrics(f);
+ BOOST_ASSERT(theApp());
+ return theApp()->fontLoader().metrics(f);
}
frontend::Clipboard & theClipboard()
{
- BOOST_ASSERT(theApp);
- return theApp->clipboard();
+ BOOST_ASSERT(theApp());
+ return theApp()->clipboard();
}
frontend::Selection & theSelection()
{
- BOOST_ASSERT(theApp);
- return theApp->selection();
+ BOOST_ASSERT(theApp());
+ return theApp()->selection();
}