if (!lyx::use_gui)
return 0;
+ // FIXME: transfer all this geometry stuff to the frontend.
+
// determine windows size and position, from lyxrc and/or session
// initial geometry
unsigned int width = 690;
unsigned int height = 510;
// default icon size, will be overwritten by stored session value
unsigned int iconSizeXY = 0;
- int maximized = LyXView::NotMaximized;
+ // FIXME: 0 means GuiView::NotMaximized by default!
+ int maximized = 0;
// first try lyxrc
if (lyxrc.geometry_width != 0 && lyxrc.geometry_height != 0 ) {
width = lyxrc.geometry_width;
}
// create the main window
- LyXView * view = &pimpl_->application_->createView(width, height, posx, posy, maximized, iconSizeXY, geometryArg);
+ LyXView * view = &pimpl_->application_->createView(width, height,
+ posx, posy, maximized, iconSizeXY, geometryArg);
return view;
}
}
-LyXView & Application::createView(unsigned int width,
- unsigned int height,
- int posx, int posy,
- int maximized,
- unsigned int iconSizeXY,
- const std::string & geometryArg)
-{
- LyXView & view = gui().createRegisteredView();
- theLyXFunc().setLyXView(&view);
-
- view.init();
- view.setGeometry(width, height, posx, posy, LyXView::Maximized(maximized),
- iconSizeXY, geometryArg);
-
- view.setFocus();
-
- setCurrentView(view);
-
- return view;
-}
-
-
LyXView const * Application::currentView() const
{
return current_view_;
virtual void unregisterSocketCallback(int fd) = 0;
/// Create the main window with given geometry settings.
- LyXView & createView(unsigned int width, unsigned int height,
+ virtual LyXView & createView(unsigned int width, unsigned int height,
int posx, int posy, int maximized,
- unsigned int iconSizeXY, const std::string & geometryArg);
+ unsigned int iconSizeXY, const std::string & geometryArg) = 0;
///
LyXView const * currentView() const;
virtual ~Gui() {}
///
- virtual LyXView& createRegisteredView() = 0;
+ virtual int createRegisteredView() = 0;
///
virtual bool unregisterView(int id) = 0;
///
*/
virtual void init() = 0;
- enum Maximized {
- NotMaximized,
- VerticallyMaximized,
- HorizontallyMaximized,
- CompletelyMaximized
- };
-
- ///
- virtual void setGeometry(
- unsigned int width,
- unsigned int height,
- int posx, int posy,
- Maximized maximize,
- unsigned int iconSizeXY,
- const std::string & geometryArg) = 0;
-
/// show busy cursor
virtual void setBusy(bool) = 0;
#include "GuiApplication.h"
+#include "GuiView.h"
#include "qt_helpers.h"
#include "GuiImage.h"
#include "frontends/alert.h"
-#include "frontends/LyXView.h"
#include "graphics/LoaderQueue.h"
}
+LyXView & GuiApplication::createView(unsigned int width,
+ unsigned int height,
+ int posx, int posy,
+ int maximized,
+ unsigned int iconSizeXY,
+ const std::string & geometryArg)
+{
+ int const id = gui_.createRegisteredView();
+ GuiView & view = static_cast<GuiView &>(gui_.view(id));
+ theLyXFunc().setLyXView(&view);
+
+ view.init();
+ view.setGeometry(width, height, posx, posy, GuiView::Maximized(maximized),
+ iconSizeXY, geometryArg);
+
+ view.setFocus();
+
+ setCurrentView(view);
+
+ return view;
+}
+
+
+
+
Clipboard & GuiApplication::clipboard()
{
return clipboard_;
virtual void updateColor(ColorCode col);
virtual void registerSocketCallback(int fd, SocketCallback func);
void unregisterSocketCallback(int fd);
+ /// Create the main window with given geometry settings.
+ LyXView & createView(unsigned int width, unsigned int height,
+ int posx, int posy, int maximized,
+ unsigned int iconSizeXY, const std::string & geometryArg);
//@}
/// Methods inherited from \c QApplication class
}
-LyXView& GuiImplementation::createRegisteredView()
+int GuiImplementation::createRegisteredView()
{
updateIds(views_, view_ids_);
int id = 0;
id++;
views_.insert(std::pair<int, GuiView *>(id, new GuiView(id)));
updateIds(views_, view_ids_);
- return *views_[id];
+ return id;
}
GuiImplementation();
virtual ~GuiImplementation() {}
- virtual LyXView& createRegisteredView();
+ virtual int createRegisteredView();
virtual bool closeAllViews();
virtual bool unregisterView(int id);
void GuiView::setGeometry(unsigned int width,
unsigned int height,
int posx, int posy,
- LyXView::Maximized maximized,
+ GuiView::Maximized maximized,
unsigned int iconSizeXY,
const string & geometryArg)
{
virtual void init();
virtual void close();
virtual void setFocus();
+
+ enum Maximized {
+ NotMaximized = 0, // LyX::newLyXView() relies on this to be zero!
+ VerticallyMaximized,
+ HorizontallyMaximized,
+ CompletelyMaximized
+ };
+ ///
virtual void setGeometry(
unsigned int width,
unsigned int height,
///
void setIconSize(unsigned int size);
- /// toggle toolbar state
- void toggleToolbarState(std::string const & name, bool allowauto);
-
///
struct GuiViewPrivate;
GuiViewPrivate & d;