mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-21 23:09:40 +00:00
Transfer createView() from Application to GuiApplication and get rid of LyXView::setGeometry() pure virtual interface. The goal is to switch to Qt session handling for geometry instead of our own house made one.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21585 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
dd02a377a6
commit
12ecafd76e
@ -711,13 +711,16 @@ LyXView * LyX::newLyXView()
|
||||
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;
|
||||
@ -758,7 +761,8 @@ LyXView * LyX::newLyXView()
|
||||
}
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
@ -40,28 +40,6 @@ Application::Application(int &, char **)
|
||||
}
|
||||
|
||||
|
||||
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_;
|
||||
|
@ -214,9 +214,9 @@ public:
|
||||
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;
|
||||
|
@ -38,7 +38,7 @@ public:
|
||||
virtual ~Gui() {}
|
||||
|
||||
///
|
||||
virtual LyXView& createRegisteredView() = 0;
|
||||
virtual int createRegisteredView() = 0;
|
||||
///
|
||||
virtual bool unregisterView(int id) = 0;
|
||||
///
|
||||
|
@ -64,22 +64,6 @@ public:
|
||||
*/
|
||||
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;
|
||||
|
||||
|
@ -14,11 +14,11 @@
|
||||
|
||||
#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"
|
||||
|
||||
@ -194,6 +194,31 @@ GuiApplication::~GuiApplication()
|
||||
}
|
||||
|
||||
|
||||
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_;
|
||||
|
@ -70,6 +70,10 @@ public:
|
||||
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
|
||||
|
@ -42,7 +42,7 @@ GuiImplementation::GuiImplementation()
|
||||
}
|
||||
|
||||
|
||||
LyXView& GuiImplementation::createRegisteredView()
|
||||
int GuiImplementation::createRegisteredView()
|
||||
{
|
||||
updateIds(views_, view_ids_);
|
||||
int id = 0;
|
||||
@ -50,7 +50,7 @@ LyXView& GuiImplementation::createRegisteredView()
|
||||
id++;
|
||||
views_.insert(std::pair<int, GuiView *>(id, new GuiView(id)));
|
||||
updateIds(views_, view_ids_);
|
||||
return *views_[id];
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
|
@ -36,7 +36,7 @@ public:
|
||||
GuiImplementation();
|
||||
virtual ~GuiImplementation() {}
|
||||
|
||||
virtual LyXView& createRegisteredView();
|
||||
virtual int createRegisteredView();
|
||||
virtual bool closeAllViews();
|
||||
virtual bool unregisterView(int id);
|
||||
|
||||
|
@ -497,7 +497,7 @@ void GuiView::saveGeometry()
|
||||
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)
|
||||
{
|
||||
|
@ -59,6 +59,14 @@ public:
|
||||
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,
|
||||
@ -198,9 +206,6 @@ private:
|
||||
///
|
||||
void setIconSize(unsigned int size);
|
||||
|
||||
/// toggle toolbar state
|
||||
void toggleToolbarState(std::string const & name, bool allowauto);
|
||||
|
||||
///
|
||||
struct GuiViewPrivate;
|
||||
GuiViewPrivate & d;
|
||||
|
Loading…
x
Reference in New Issue
Block a user