2006-03-05 17:24:44 +00:00
|
|
|
/**
|
|
|
|
* \file QtView.C
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
*
|
|
|
|
* \author Lars Gullik Bjønnes
|
|
|
|
* \author John Levon
|
|
|
|
* \author Abdelrazak Younes
|
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
*/
|
|
|
|
|
2006-06-04 20:49:09 +00:00
|
|
|
#undef QT3_SUPPORT
|
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
#include "BufferView.h"
|
|
|
|
#include "lyx_cb.h"
|
2006-04-07 12:01:11 +00:00
|
|
|
#include "lyxrc.h"
|
2006-04-05 22:56:18 +00:00
|
|
|
#include "lyx_main.h"
|
|
|
|
#include "session.h"
|
2006-03-05 17:24:44 +00:00
|
|
|
#include "lyxfunc.h"
|
|
|
|
#include "MenuBackend.h"
|
2006-04-05 22:56:18 +00:00
|
|
|
#include "funcrequest.h"
|
|
|
|
#include "funcrequest.h"
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
#include "debug.h"
|
|
|
|
|
|
|
|
#include "frontends/Toolbars.h"
|
|
|
|
|
|
|
|
#include "support/filetools.h"
|
|
|
|
|
2006-04-05 22:56:18 +00:00
|
|
|
#include "support/convert.h"
|
2006-03-05 17:24:44 +00:00
|
|
|
#include <boost/bind.hpp>
|
|
|
|
|
|
|
|
#include "QtView.h"
|
|
|
|
#include "QLMenubar.h"
|
|
|
|
#include "qfont_loader.h"
|
|
|
|
#include "QCommandBuffer.h"
|
|
|
|
#include "qt_helpers.h"
|
|
|
|
|
|
|
|
#include <QApplication>
|
|
|
|
#include <QPixmap>
|
|
|
|
#include <QStatusBar>
|
|
|
|
#include <QToolBar>
|
|
|
|
#include <QCloseEvent>
|
|
|
|
#include <QAction>
|
2006-06-04 20:49:09 +00:00
|
|
|
//#include <QMenu>
|
|
|
|
//#include <QMenuBar>
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
#include "support/lstrings.h"
|
|
|
|
|
|
|
|
|
|
|
|
using std::string;
|
|
|
|
using std::endl;
|
|
|
|
|
|
|
|
FontLoader fontloader;
|
|
|
|
|
|
|
|
namespace lyx {
|
|
|
|
|
|
|
|
using support::subst;
|
2006-04-09 08:42:58 +00:00
|
|
|
using support::libFileSearch;
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
namespace frontend {
|
|
|
|
|
|
|
|
namespace {
|
|
|
|
|
|
|
|
int const statusbar_timer_value = 3000;
|
|
|
|
|
|
|
|
} // namespace anon
|
|
|
|
|
|
|
|
|
coding style and readability corrections
Index: frontends/qt3/lyx_gui.C
===================================================================
--- frontends/qt3/lyx_gui.C (revision 14088)
+++ frontends/qt3/lyx_gui.C (working copy)
@@ -222,12 +222,12 @@
void start(string const & batch, vector<string> const & files,
- unsigned int width, unsigned int height, int posx, int posy, bool isMax)
+ unsigned int width, unsigned int height, int posx, int posy, bool maximize)
{
// this can't be done before because it needs the Languages object
initEncodings();
- boost::shared_ptr<QtView> view_ptr(new QtView(width, height, isMax));
+ boost::shared_ptr<QtView> view_ptr(new QtView(width, height, maximize));
LyX::ref().addLyXView(view_ptr);
QtView & view = *view_ptr.get();
Index: frontends/qt3/QtView.C
===================================================================
--- frontends/qt3/QtView.C (revision 14088)
+++ frontends/qt3/QtView.C (working copy)
@@ -55,12 +55,12 @@
-QtView::QtView(unsigned int width, unsigned int height, bool isMax)
+QtView::QtView(unsigned int width, unsigned int height, bool maximize)
: QMainWindow(), LyXView(), commandbuffer_(0)
{
resize(width, height);
- if(isMax)
+ if (maximize)
this->setWindowState(WindowMaximized);
qApp->setMainWidget(this);
@@ -164,7 +164,7 @@
void QtView::closeEvent(QCloseEvent *)
{
LyX::ref().session().saveSessionInfo("WindowIsMaximized", (this->isMaximized() ? "yes" : "no"));
- //don't save maximized values
+ // don't save maximized values
this->showNormal();
// save windows size and position
LyX::ref().session().saveSessionInfo("WindowWidth", convert<string>(width()));
Index: frontends/qt3/QtView.h
===================================================================
--- frontends/qt3/QtView.h (revision 14088)
+++ frontends/qt3/QtView.h (working copy)
@@ -37,7 +37,7 @@
Q_OBJECT
public:
/// create a main window of the given dimensions
- QtView(unsigned int w, unsigned int h, bool isMax);
+ QtView(unsigned int w, unsigned int h, bool maximize);
~QtView();
Index: frontends/qt4/lyx_gui.C
===================================================================
--- frontends/qt4/lyx_gui.C (revision 14088)
+++ frontends/qt4/lyx_gui.C (working copy)
@@ -228,12 +228,12 @@
void start(string const & batch, vector<string> const & files,
- unsigned int width, unsigned int height, int posx, int posy, bool isMax)
+ unsigned int width, unsigned int height, int posx, int posy, bool maximize)
{
// this can't be done before because it needs the Languages object
initEncodings();
- boost::shared_ptr<QtView> view_ptr(new QtView(width, height, isMax));
+ boost::shared_ptr<QtView> view_ptr(new QtView(width, height, maximize));
LyX::ref().addLyXView(view_ptr);
QtView & view = *view_ptr.get();
Index: frontends/qt4/QtView.C
===================================================================
--- frontends/qt4/QtView.C (revision 14088)
+++ frontends/qt4/QtView.C (working copy)
@@ -70,12 +70,12 @@
} // namespace anon
-QtView::QtView(unsigned int width, unsigned int height, bool isMax)
+QtView::QtView(unsigned int width, unsigned int height, bool maximize)
: QMainWindow(), LyXView(), commandbuffer_(0)
{
resize(width, height);
- if(isMax)
+ if (maximize)
this->setWindowState(Qt::WindowMaximized);
mainWidget_ = this;
Index: frontends/qt4/QtView.h
===================================================================
--- frontends/qt4/QtView.h (revision 14088)
+++ frontends/qt4/QtView.h (working copy)
@@ -47,7 +47,7 @@
Q_OBJECT
public:
/// create a main window of the given dimensions
- QtView(unsigned int w, unsigned int h, bool isMax);
+ QtView(unsigned int w, unsigned int h, bool maximize);
~QtView();
Index: frontends/lyx_gui.h
===================================================================
--- frontends/lyx_gui.h (revision 14088)
+++ frontends/lyx_gui.h (working copy)
@@ -57,7 +57,7 @@
* batch commands, and loading the given documents
*/
void start(std::string const & batch, std::vector<std::string> const & files,
- unsigned int width, unsigned int height, int posx, int posy, bool isMax);
+ unsigned int width, unsigned int height, int posx, int posy, bool maximize);
/**
* Enter the main event loop (\sa LyX::exec2)
Index: lyx_main.C
===================================================================
--- lyx_main.C (revision 14088)
+++ lyx_main.C (working copy)
@@ -307,7 +307,7 @@
// initial geometry
unsigned int width = 690;
unsigned int height = 510;
- bool isMax = false;
+ bool maximize = false;
// first try lyxrc
if (lyxrc.geometry_width != 0 && lyxrc.geometry_height != 0 ) {
width = lyxrc.geometry_width;
@@ -322,7 +322,7 @@
if (!val.empty())
height = convert<unsigned int>(val);
if (session().loadSessionInfo("WindowIsMaximized") == "yes")
- isMax = true;
+ maximize = true;
}
// if user wants to restore window position
int posx = -1;
@@ -335,7 +335,7 @@
if (!val.empty())
posy = convert<int>(val);
}
- lyx_gui::start(batch_command, files, width, height, posx, posy, isMax);
+ lyx_gui::start(batch_command, files, width, height, posx, posy, maximize);
} else {
// Something went wrong above
quitLyX(false);
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14089 a592a061-630c-0410-9148-cb99ea01b6c8
2006-06-13 08:24:43 +00:00
|
|
|
QtView::QtView(unsigned int width, unsigned int height, bool maximize)
|
2006-03-05 17:24:44 +00:00
|
|
|
: QMainWindow(), LyXView(), commandbuffer_(0)
|
|
|
|
{
|
|
|
|
resize(width, height);
|
|
|
|
|
coding style and readability corrections
Index: frontends/qt3/lyx_gui.C
===================================================================
--- frontends/qt3/lyx_gui.C (revision 14088)
+++ frontends/qt3/lyx_gui.C (working copy)
@@ -222,12 +222,12 @@
void start(string const & batch, vector<string> const & files,
- unsigned int width, unsigned int height, int posx, int posy, bool isMax)
+ unsigned int width, unsigned int height, int posx, int posy, bool maximize)
{
// this can't be done before because it needs the Languages object
initEncodings();
- boost::shared_ptr<QtView> view_ptr(new QtView(width, height, isMax));
+ boost::shared_ptr<QtView> view_ptr(new QtView(width, height, maximize));
LyX::ref().addLyXView(view_ptr);
QtView & view = *view_ptr.get();
Index: frontends/qt3/QtView.C
===================================================================
--- frontends/qt3/QtView.C (revision 14088)
+++ frontends/qt3/QtView.C (working copy)
@@ -55,12 +55,12 @@
-QtView::QtView(unsigned int width, unsigned int height, bool isMax)
+QtView::QtView(unsigned int width, unsigned int height, bool maximize)
: QMainWindow(), LyXView(), commandbuffer_(0)
{
resize(width, height);
- if(isMax)
+ if (maximize)
this->setWindowState(WindowMaximized);
qApp->setMainWidget(this);
@@ -164,7 +164,7 @@
void QtView::closeEvent(QCloseEvent *)
{
LyX::ref().session().saveSessionInfo("WindowIsMaximized", (this->isMaximized() ? "yes" : "no"));
- //don't save maximized values
+ // don't save maximized values
this->showNormal();
// save windows size and position
LyX::ref().session().saveSessionInfo("WindowWidth", convert<string>(width()));
Index: frontends/qt3/QtView.h
===================================================================
--- frontends/qt3/QtView.h (revision 14088)
+++ frontends/qt3/QtView.h (working copy)
@@ -37,7 +37,7 @@
Q_OBJECT
public:
/// create a main window of the given dimensions
- QtView(unsigned int w, unsigned int h, bool isMax);
+ QtView(unsigned int w, unsigned int h, bool maximize);
~QtView();
Index: frontends/qt4/lyx_gui.C
===================================================================
--- frontends/qt4/lyx_gui.C (revision 14088)
+++ frontends/qt4/lyx_gui.C (working copy)
@@ -228,12 +228,12 @@
void start(string const & batch, vector<string> const & files,
- unsigned int width, unsigned int height, int posx, int posy, bool isMax)
+ unsigned int width, unsigned int height, int posx, int posy, bool maximize)
{
// this can't be done before because it needs the Languages object
initEncodings();
- boost::shared_ptr<QtView> view_ptr(new QtView(width, height, isMax));
+ boost::shared_ptr<QtView> view_ptr(new QtView(width, height, maximize));
LyX::ref().addLyXView(view_ptr);
QtView & view = *view_ptr.get();
Index: frontends/qt4/QtView.C
===================================================================
--- frontends/qt4/QtView.C (revision 14088)
+++ frontends/qt4/QtView.C (working copy)
@@ -70,12 +70,12 @@
} // namespace anon
-QtView::QtView(unsigned int width, unsigned int height, bool isMax)
+QtView::QtView(unsigned int width, unsigned int height, bool maximize)
: QMainWindow(), LyXView(), commandbuffer_(0)
{
resize(width, height);
- if(isMax)
+ if (maximize)
this->setWindowState(Qt::WindowMaximized);
mainWidget_ = this;
Index: frontends/qt4/QtView.h
===================================================================
--- frontends/qt4/QtView.h (revision 14088)
+++ frontends/qt4/QtView.h (working copy)
@@ -47,7 +47,7 @@
Q_OBJECT
public:
/// create a main window of the given dimensions
- QtView(unsigned int w, unsigned int h, bool isMax);
+ QtView(unsigned int w, unsigned int h, bool maximize);
~QtView();
Index: frontends/lyx_gui.h
===================================================================
--- frontends/lyx_gui.h (revision 14088)
+++ frontends/lyx_gui.h (working copy)
@@ -57,7 +57,7 @@
* batch commands, and loading the given documents
*/
void start(std::string const & batch, std::vector<std::string> const & files,
- unsigned int width, unsigned int height, int posx, int posy, bool isMax);
+ unsigned int width, unsigned int height, int posx, int posy, bool maximize);
/**
* Enter the main event loop (\sa LyX::exec2)
Index: lyx_main.C
===================================================================
--- lyx_main.C (revision 14088)
+++ lyx_main.C (working copy)
@@ -307,7 +307,7 @@
// initial geometry
unsigned int width = 690;
unsigned int height = 510;
- bool isMax = false;
+ bool maximize = false;
// first try lyxrc
if (lyxrc.geometry_width != 0 && lyxrc.geometry_height != 0 ) {
width = lyxrc.geometry_width;
@@ -322,7 +322,7 @@
if (!val.empty())
height = convert<unsigned int>(val);
if (session().loadSessionInfo("WindowIsMaximized") == "yes")
- isMax = true;
+ maximize = true;
}
// if user wants to restore window position
int posx = -1;
@@ -335,7 +335,7 @@
if (!val.empty())
posy = convert<int>(val);
}
- lyx_gui::start(batch_command, files, width, height, posx, posy, isMax);
+ lyx_gui::start(batch_command, files, width, height, posx, posy, maximize);
} else {
// Something went wrong above
quitLyX(false);
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14089 a592a061-630c-0410-9148-cb99ea01b6c8
2006-06-13 08:24:43 +00:00
|
|
|
if (maximize)
|
Qt3/Qt4:
- don't save geometry values of the maximized lyx window
- save/restore the maximized property of the lyx window
- fix changed lyx_gui::start interface for xform and gtk
Index: frontends/gtk/lyx_gui.C
===================================================================
--- frontends/gtk/lyx_gui.C (revision 14083)
+++ frontends/gtk/lyx_gui.C (working copy)
@@ -123,7 +123,7 @@
void lyx_gui::start(string const & batch, std::vector<string> const & files,
- unsigned int width, unsigned int height, int posx, int posy)
+ unsigned int width, unsigned int height, int posx, int posy, bool)
{
boost::shared_ptr<GView> view_ptr(new GView);
LyX::ref().addLyXView(view_ptr);
Index: frontends/qt3/lyx_gui.C
===================================================================
--- frontends/qt3/lyx_gui.C (revision 14083)
+++ frontends/qt3/lyx_gui.C (working copy)
@@ -222,12 +222,12 @@
void start(string const & batch, vector<string> const & files,
- unsigned int width, unsigned int height, int posx, int posy)
+ unsigned int width, unsigned int height, int posx, int posy, bool isMax)
{
// this can't be done before because it needs the Languages object
initEncodings();
- boost::shared_ptr<QtView> view_ptr(new QtView(width, height));
+ boost::shared_ptr<QtView> view_ptr(new QtView(width, height, isMax));
LyX::ref().addLyXView(view_ptr);
QtView & view = *view_ptr.get();
Index: frontends/qt3/QtView.C
===================================================================
--- frontends/qt3/QtView.C (revision 14083)
+++ frontends/qt3/QtView.C (working copy)
@@ -55,10 +55,13 @@
-QtView::QtView(unsigned int width, unsigned int height)
+QtView::QtView(unsigned int width, unsigned int height, bool isMax)
: QMainWindow(), LyXView(), commandbuffer_(0)
{
resize(width, height);
+
+ if(isMax)
+ this->setWindowState(WindowMaximized);
qApp->setMainWidget(this);
@@ -160,6 +163,9 @@
void QtView::closeEvent(QCloseEvent *)
{
+ LyX::ref().session().saveSessionInfo("WindowIsMaximized", (this->isMaximized() ? "yes" : "no"));
+ //don't save maximized values
+ this->showNormal();
// save windows size and position
LyX::ref().session().saveSessionInfo("WindowWidth", convert<string>(width()));
LyX::ref().session().saveSessionInfo("WindowHeight", convert<string>(height()));
Index: frontends/qt3/QtView.h
===================================================================
--- frontends/qt3/QtView.h (revision 14083)
+++ frontends/qt3/QtView.h (working copy)
@@ -37,7 +37,7 @@
Q_OBJECT
public:
/// create a main window of the given dimensions
- QtView(unsigned int w, unsigned int h);
+ QtView(unsigned int w, unsigned int h, bool isMax);
~QtView();
Index: frontends/qt4/lyx_gui.C
===================================================================
--- frontends/qt4/lyx_gui.C (revision 14083)
+++ frontends/qt4/lyx_gui.C (working copy)
@@ -228,12 +228,12 @@
void start(string const & batch, vector<string> const & files,
- unsigned int width, unsigned int height, int posx, int posy)
+ unsigned int width, unsigned int height, int posx, int posy, bool isMax)
{
// this can't be done before because it needs the Languages object
initEncodings();
- boost::shared_ptr<QtView> view_ptr(new QtView(width, height));
+ boost::shared_ptr<QtView> view_ptr(new QtView(width, height, isMax));
LyX::ref().addLyXView(view_ptr);
QtView & view = *view_ptr.get();
Index: frontends/qt4/QtView.C
===================================================================
--- frontends/qt4/QtView.C (revision 14083)
+++ frontends/qt4/QtView.C (working copy)
@@ -70,11 +70,14 @@
} // namespace anon
-QtView::QtView(unsigned int width, unsigned int height)
+QtView::QtView(unsigned int width, unsigned int height, bool isMax)
: QMainWindow(), LyXView(), commandbuffer_(0)
{
resize(width, height);
+ if(isMax)
+ this->setWindowState(Qt::WindowMaximized);
+
mainWidget_ = this;
// setToolButtonStyle(Qt::ToolButtonIconOnly);
@@ -182,11 +185,12 @@
void QtView::closeEvent(QCloseEvent *)
{
// save windows size and position
- LyX::ref().session().saveSessionInfo("WindowWidth", convert<string>(width()));
- LyX::ref().session().saveSessionInfo("WindowHeight", convert<string>(height()));
+ LyX::ref().session().saveSessionInfo("WindowWidth", convert<string>(this->normalGeometry().width()));
+ LyX::ref().session().saveSessionInfo("WindowHeight", convert<string>(this->normalGeometry().height()));
+ LyX::ref().session().saveSessionInfo("WindowIsMaximized", (this->isMaximized() ? "yes" : "no"));
if (lyxrc.geometry_xysaved) {
- LyX::ref().session().saveSessionInfo("WindowPosX", convert<string>(x()));
- LyX::ref().session().saveSessionInfo("WindowPosY", convert<string>(y()));
+ LyX::ref().session().saveSessionInfo("WindowPosX", convert<string>(this->normalGeometry().x()));
+ LyX::ref().session().saveSessionInfo("WindowPosY", convert<string>(this->normalGeometry().y()));
}
// trigger LFUN_LYX_QUIT instead of quit directly
// since LFUN_LYX_QUIT may have more cleanup stuff
Index: frontends/qt4/QtView.h
===================================================================
--- frontends/qt4/QtView.h (revision 14083)
+++ frontends/qt4/QtView.h (working copy)
@@ -47,7 +47,7 @@
Q_OBJECT
public:
/// create a main window of the given dimensions
- QtView(unsigned int w, unsigned int h);
+ QtView(unsigned int w, unsigned int h, bool isMax);
~QtView();
Index: frontends/xforms/lyx_gui.C
===================================================================
--- frontends/xforms/lyx_gui.C (revision 14083)
+++ frontends/xforms/lyx_gui.C (working copy)
@@ -256,7 +256,7 @@
void start(string const & batch, vector<string> const & files,
- unsigned int width, unsigned int height, int posx, int posy)
+ unsigned int width, unsigned int height, int posx, int posy, bool)
{
int const geometryBitmask =
XParseGeometry(geometry, &posx, &posy, &width, &height);
Index: frontends/lyx_gui.h
===================================================================
--- frontends/lyx_gui.h (revision 14083)
+++ frontends/lyx_gui.h (working copy)
@@ -57,7 +57,7 @@
* batch commands, and loading the given documents
*/
void start(std::string const & batch, std::vector<std::string> const & files,
- unsigned int width, unsigned int height, int posx, int posy);
+ unsigned int width, unsigned int height, int posx, int posy, bool isMax);
/**
* Enter the main event loop (\sa LyX::exec2)
Index: lyx_main.C
===================================================================
--- lyx_main.C (revision 14083)
+++ lyx_main.C (working copy)
@@ -307,6 +307,7 @@
// initial geometry
unsigned int width = 690;
unsigned int height = 510;
+ bool isMax = false;
// first try lyxrc
if (lyxrc.geometry_width != 0 && lyxrc.geometry_height != 0 ) {
width = lyxrc.geometry_width;
@@ -320,6 +321,8 @@
val = session().loadSessionInfo("WindowHeight");
if (!val.empty())
height = convert<unsigned int>(val);
+ if (session().loadSessionInfo("WindowIsMaximized") == "yes")
+ isMax = true;
}
// if user wants to restore window position
int posx = -1;
@@ -332,7 +335,7 @@
if (!val.empty())
posy = convert<int>(val);
}
- lyx_gui::start(batch_command, files, width, height, posx, posy);
+ lyx_gui::start(batch_command, files, width, height, posx, posy, isMax);
} else {
// Something went wrong above
quitLyX(false);
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14088 a592a061-630c-0410-9148-cb99ea01b6c8
2006-06-13 08:05:00 +00:00
|
|
|
this->setWindowState(Qt::WindowMaximized);
|
|
|
|
|
2006-06-04 20:49:09 +00:00
|
|
|
mainWidget_ = this;
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
// setToolButtonStyle(Qt::ToolButtonIconOnly);
|
|
|
|
// setIconSize(QSize(12,12));
|
|
|
|
|
|
|
|
bufferview_.reset(new BufferView(this, width, height));
|
|
|
|
|
|
|
|
menubar_.reset(new QLMenubar(this, menubackend));
|
|
|
|
connect(menuBar(), SIGNAL(triggered(QAction *)), this, SLOT(updateMenu(QAction *)));
|
|
|
|
|
|
|
|
getToolbars().init();
|
|
|
|
|
|
|
|
statusBar()->setSizeGripEnabled(false);
|
|
|
|
|
|
|
|
view_state_changed.connect(boost::bind(&QtView::update_view_state, this));
|
|
|
|
connect(&statusbar_timer_, SIGNAL(timeout()), this, SLOT(update_view_state_qt()));
|
|
|
|
|
|
|
|
#ifndef Q_WS_MACX
|
|
|
|
// assign an icon to main form. We do not do it under Qt/Mac,
|
|
|
|
// since the icon is provided in the application bundle.
|
2006-04-09 08:42:58 +00:00
|
|
|
string const iconname = libFileSearch("images", "lyx", "xpm");
|
2006-03-05 17:24:44 +00:00
|
|
|
if (!iconname.empty())
|
2006-06-04 20:49:09 +00:00
|
|
|
setWindowIcon(QPixmap(toqstr(iconname)));
|
2006-03-05 17:24:44 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
// make sure the buttons are disabled if needed
|
|
|
|
updateToolbars();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
QtView::~QtView()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void QtView::updateMenu(QAction *action)
|
|
|
|
{
|
|
|
|
menubar_->update();
|
|
|
|
}
|
|
|
|
|
|
|
|
void QtView::setWindowTitle(string const & t, string const & it)
|
|
|
|
{
|
|
|
|
QMainWindow::setWindowTitle(toqstr(t));
|
|
|
|
QMainWindow::setWindowIconText(toqstr(it));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QtView::addCommandBuffer(QToolBar * toolbar)
|
|
|
|
{
|
|
|
|
commandbuffer_ = new QCommandBuffer(this, *controlcommand_);
|
|
|
|
focus_command_buffer.connect(boost::bind(&QtView::focus_command_widget, this));
|
|
|
|
toolbar->addWidget(commandbuffer_);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QtView::message(string const & str)
|
|
|
|
{
|
2006-06-04 20:49:09 +00:00
|
|
|
statusBar()->showMessage(toqstr(str));
|
2006-03-05 17:24:44 +00:00
|
|
|
statusbar_timer_.stop();
|
|
|
|
statusbar_timer_.start(statusbar_timer_value);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QtView::clearMessage()
|
|
|
|
{
|
|
|
|
update_view_state_qt();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QtView::focus_command_widget()
|
|
|
|
{
|
|
|
|
if (commandbuffer_)
|
|
|
|
commandbuffer_->focus_command();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QtView::update_view_state_qt()
|
|
|
|
{
|
2006-06-04 20:49:09 +00:00
|
|
|
statusBar()->showMessage(toqstr(getLyXFunc().viewStatusMessage()));
|
2006-03-05 17:24:44 +00:00
|
|
|
statusbar_timer_.stop();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QtView::update_view_state()
|
|
|
|
{
|
|
|
|
// let the user see the explicit message
|
|
|
|
if (statusbar_timer_.isActive())
|
|
|
|
return;
|
|
|
|
|
2006-06-04 20:49:09 +00:00
|
|
|
statusBar()->showMessage(toqstr(getLyXFunc().viewStatusMessage()));
|
2006-03-05 17:24:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QtView::activated(FuncRequest const & func)
|
|
|
|
{
|
|
|
|
getLyXFunc().dispatch(func);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool QtView::hasFocus() const
|
|
|
|
{
|
|
|
|
return qApp->activeWindow() == this;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QtView::closeEvent(QCloseEvent *)
|
|
|
|
{
|
2006-04-05 22:56:18 +00:00
|
|
|
// save windows size and position
|
Qt3/Qt4:
- don't save geometry values of the maximized lyx window
- save/restore the maximized property of the lyx window
- fix changed lyx_gui::start interface for xform and gtk
Index: frontends/gtk/lyx_gui.C
===================================================================
--- frontends/gtk/lyx_gui.C (revision 14083)
+++ frontends/gtk/lyx_gui.C (working copy)
@@ -123,7 +123,7 @@
void lyx_gui::start(string const & batch, std::vector<string> const & files,
- unsigned int width, unsigned int height, int posx, int posy)
+ unsigned int width, unsigned int height, int posx, int posy, bool)
{
boost::shared_ptr<GView> view_ptr(new GView);
LyX::ref().addLyXView(view_ptr);
Index: frontends/qt3/lyx_gui.C
===================================================================
--- frontends/qt3/lyx_gui.C (revision 14083)
+++ frontends/qt3/lyx_gui.C (working copy)
@@ -222,12 +222,12 @@
void start(string const & batch, vector<string> const & files,
- unsigned int width, unsigned int height, int posx, int posy)
+ unsigned int width, unsigned int height, int posx, int posy, bool isMax)
{
// this can't be done before because it needs the Languages object
initEncodings();
- boost::shared_ptr<QtView> view_ptr(new QtView(width, height));
+ boost::shared_ptr<QtView> view_ptr(new QtView(width, height, isMax));
LyX::ref().addLyXView(view_ptr);
QtView & view = *view_ptr.get();
Index: frontends/qt3/QtView.C
===================================================================
--- frontends/qt3/QtView.C (revision 14083)
+++ frontends/qt3/QtView.C (working copy)
@@ -55,10 +55,13 @@
-QtView::QtView(unsigned int width, unsigned int height)
+QtView::QtView(unsigned int width, unsigned int height, bool isMax)
: QMainWindow(), LyXView(), commandbuffer_(0)
{
resize(width, height);
+
+ if(isMax)
+ this->setWindowState(WindowMaximized);
qApp->setMainWidget(this);
@@ -160,6 +163,9 @@
void QtView::closeEvent(QCloseEvent *)
{
+ LyX::ref().session().saveSessionInfo("WindowIsMaximized", (this->isMaximized() ? "yes" : "no"));
+ //don't save maximized values
+ this->showNormal();
// save windows size and position
LyX::ref().session().saveSessionInfo("WindowWidth", convert<string>(width()));
LyX::ref().session().saveSessionInfo("WindowHeight", convert<string>(height()));
Index: frontends/qt3/QtView.h
===================================================================
--- frontends/qt3/QtView.h (revision 14083)
+++ frontends/qt3/QtView.h (working copy)
@@ -37,7 +37,7 @@
Q_OBJECT
public:
/// create a main window of the given dimensions
- QtView(unsigned int w, unsigned int h);
+ QtView(unsigned int w, unsigned int h, bool isMax);
~QtView();
Index: frontends/qt4/lyx_gui.C
===================================================================
--- frontends/qt4/lyx_gui.C (revision 14083)
+++ frontends/qt4/lyx_gui.C (working copy)
@@ -228,12 +228,12 @@
void start(string const & batch, vector<string> const & files,
- unsigned int width, unsigned int height, int posx, int posy)
+ unsigned int width, unsigned int height, int posx, int posy, bool isMax)
{
// this can't be done before because it needs the Languages object
initEncodings();
- boost::shared_ptr<QtView> view_ptr(new QtView(width, height));
+ boost::shared_ptr<QtView> view_ptr(new QtView(width, height, isMax));
LyX::ref().addLyXView(view_ptr);
QtView & view = *view_ptr.get();
Index: frontends/qt4/QtView.C
===================================================================
--- frontends/qt4/QtView.C (revision 14083)
+++ frontends/qt4/QtView.C (working copy)
@@ -70,11 +70,14 @@
} // namespace anon
-QtView::QtView(unsigned int width, unsigned int height)
+QtView::QtView(unsigned int width, unsigned int height, bool isMax)
: QMainWindow(), LyXView(), commandbuffer_(0)
{
resize(width, height);
+ if(isMax)
+ this->setWindowState(Qt::WindowMaximized);
+
mainWidget_ = this;
// setToolButtonStyle(Qt::ToolButtonIconOnly);
@@ -182,11 +185,12 @@
void QtView::closeEvent(QCloseEvent *)
{
// save windows size and position
- LyX::ref().session().saveSessionInfo("WindowWidth", convert<string>(width()));
- LyX::ref().session().saveSessionInfo("WindowHeight", convert<string>(height()));
+ LyX::ref().session().saveSessionInfo("WindowWidth", convert<string>(this->normalGeometry().width()));
+ LyX::ref().session().saveSessionInfo("WindowHeight", convert<string>(this->normalGeometry().height()));
+ LyX::ref().session().saveSessionInfo("WindowIsMaximized", (this->isMaximized() ? "yes" : "no"));
if (lyxrc.geometry_xysaved) {
- LyX::ref().session().saveSessionInfo("WindowPosX", convert<string>(x()));
- LyX::ref().session().saveSessionInfo("WindowPosY", convert<string>(y()));
+ LyX::ref().session().saveSessionInfo("WindowPosX", convert<string>(this->normalGeometry().x()));
+ LyX::ref().session().saveSessionInfo("WindowPosY", convert<string>(this->normalGeometry().y()));
}
// trigger LFUN_LYX_QUIT instead of quit directly
// since LFUN_LYX_QUIT may have more cleanup stuff
Index: frontends/qt4/QtView.h
===================================================================
--- frontends/qt4/QtView.h (revision 14083)
+++ frontends/qt4/QtView.h (working copy)
@@ -47,7 +47,7 @@
Q_OBJECT
public:
/// create a main window of the given dimensions
- QtView(unsigned int w, unsigned int h);
+ QtView(unsigned int w, unsigned int h, bool isMax);
~QtView();
Index: frontends/xforms/lyx_gui.C
===================================================================
--- frontends/xforms/lyx_gui.C (revision 14083)
+++ frontends/xforms/lyx_gui.C (working copy)
@@ -256,7 +256,7 @@
void start(string const & batch, vector<string> const & files,
- unsigned int width, unsigned int height, int posx, int posy)
+ unsigned int width, unsigned int height, int posx, int posy, bool)
{
int const geometryBitmask =
XParseGeometry(geometry, &posx, &posy, &width, &height);
Index: frontends/lyx_gui.h
===================================================================
--- frontends/lyx_gui.h (revision 14083)
+++ frontends/lyx_gui.h (working copy)
@@ -57,7 +57,7 @@
* batch commands, and loading the given documents
*/
void start(std::string const & batch, std::vector<std::string> const & files,
- unsigned int width, unsigned int height, int posx, int posy);
+ unsigned int width, unsigned int height, int posx, int posy, bool isMax);
/**
* Enter the main event loop (\sa LyX::exec2)
Index: lyx_main.C
===================================================================
--- lyx_main.C (revision 14083)
+++ lyx_main.C (working copy)
@@ -307,6 +307,7 @@
// initial geometry
unsigned int width = 690;
unsigned int height = 510;
+ bool isMax = false;
// first try lyxrc
if (lyxrc.geometry_width != 0 && lyxrc.geometry_height != 0 ) {
width = lyxrc.geometry_width;
@@ -320,6 +321,8 @@
val = session().loadSessionInfo("WindowHeight");
if (!val.empty())
height = convert<unsigned int>(val);
+ if (session().loadSessionInfo("WindowIsMaximized") == "yes")
+ isMax = true;
}
// if user wants to restore window position
int posx = -1;
@@ -332,7 +335,7 @@
if (!val.empty())
posy = convert<int>(val);
}
- lyx_gui::start(batch_command, files, width, height, posx, posy);
+ lyx_gui::start(batch_command, files, width, height, posx, posy, isMax);
} else {
// Something went wrong above
quitLyX(false);
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14088 a592a061-630c-0410-9148-cb99ea01b6c8
2006-06-13 08:05:00 +00:00
|
|
|
LyX::ref().session().saveSessionInfo("WindowWidth", convert<string>(this->normalGeometry().width()));
|
|
|
|
LyX::ref().session().saveSessionInfo("WindowHeight", convert<string>(this->normalGeometry().height()));
|
|
|
|
LyX::ref().session().saveSessionInfo("WindowIsMaximized", (this->isMaximized() ? "yes" : "no"));
|
2006-04-05 22:56:18 +00:00
|
|
|
if (lyxrc.geometry_xysaved) {
|
Qt3/Qt4:
- don't save geometry values of the maximized lyx window
- save/restore the maximized property of the lyx window
- fix changed lyx_gui::start interface for xform and gtk
Index: frontends/gtk/lyx_gui.C
===================================================================
--- frontends/gtk/lyx_gui.C (revision 14083)
+++ frontends/gtk/lyx_gui.C (working copy)
@@ -123,7 +123,7 @@
void lyx_gui::start(string const & batch, std::vector<string> const & files,
- unsigned int width, unsigned int height, int posx, int posy)
+ unsigned int width, unsigned int height, int posx, int posy, bool)
{
boost::shared_ptr<GView> view_ptr(new GView);
LyX::ref().addLyXView(view_ptr);
Index: frontends/qt3/lyx_gui.C
===================================================================
--- frontends/qt3/lyx_gui.C (revision 14083)
+++ frontends/qt3/lyx_gui.C (working copy)
@@ -222,12 +222,12 @@
void start(string const & batch, vector<string> const & files,
- unsigned int width, unsigned int height, int posx, int posy)
+ unsigned int width, unsigned int height, int posx, int posy, bool isMax)
{
// this can't be done before because it needs the Languages object
initEncodings();
- boost::shared_ptr<QtView> view_ptr(new QtView(width, height));
+ boost::shared_ptr<QtView> view_ptr(new QtView(width, height, isMax));
LyX::ref().addLyXView(view_ptr);
QtView & view = *view_ptr.get();
Index: frontends/qt3/QtView.C
===================================================================
--- frontends/qt3/QtView.C (revision 14083)
+++ frontends/qt3/QtView.C (working copy)
@@ -55,10 +55,13 @@
-QtView::QtView(unsigned int width, unsigned int height)
+QtView::QtView(unsigned int width, unsigned int height, bool isMax)
: QMainWindow(), LyXView(), commandbuffer_(0)
{
resize(width, height);
+
+ if(isMax)
+ this->setWindowState(WindowMaximized);
qApp->setMainWidget(this);
@@ -160,6 +163,9 @@
void QtView::closeEvent(QCloseEvent *)
{
+ LyX::ref().session().saveSessionInfo("WindowIsMaximized", (this->isMaximized() ? "yes" : "no"));
+ //don't save maximized values
+ this->showNormal();
// save windows size and position
LyX::ref().session().saveSessionInfo("WindowWidth", convert<string>(width()));
LyX::ref().session().saveSessionInfo("WindowHeight", convert<string>(height()));
Index: frontends/qt3/QtView.h
===================================================================
--- frontends/qt3/QtView.h (revision 14083)
+++ frontends/qt3/QtView.h (working copy)
@@ -37,7 +37,7 @@
Q_OBJECT
public:
/// create a main window of the given dimensions
- QtView(unsigned int w, unsigned int h);
+ QtView(unsigned int w, unsigned int h, bool isMax);
~QtView();
Index: frontends/qt4/lyx_gui.C
===================================================================
--- frontends/qt4/lyx_gui.C (revision 14083)
+++ frontends/qt4/lyx_gui.C (working copy)
@@ -228,12 +228,12 @@
void start(string const & batch, vector<string> const & files,
- unsigned int width, unsigned int height, int posx, int posy)
+ unsigned int width, unsigned int height, int posx, int posy, bool isMax)
{
// this can't be done before because it needs the Languages object
initEncodings();
- boost::shared_ptr<QtView> view_ptr(new QtView(width, height));
+ boost::shared_ptr<QtView> view_ptr(new QtView(width, height, isMax));
LyX::ref().addLyXView(view_ptr);
QtView & view = *view_ptr.get();
Index: frontends/qt4/QtView.C
===================================================================
--- frontends/qt4/QtView.C (revision 14083)
+++ frontends/qt4/QtView.C (working copy)
@@ -70,11 +70,14 @@
} // namespace anon
-QtView::QtView(unsigned int width, unsigned int height)
+QtView::QtView(unsigned int width, unsigned int height, bool isMax)
: QMainWindow(), LyXView(), commandbuffer_(0)
{
resize(width, height);
+ if(isMax)
+ this->setWindowState(Qt::WindowMaximized);
+
mainWidget_ = this;
// setToolButtonStyle(Qt::ToolButtonIconOnly);
@@ -182,11 +185,12 @@
void QtView::closeEvent(QCloseEvent *)
{
// save windows size and position
- LyX::ref().session().saveSessionInfo("WindowWidth", convert<string>(width()));
- LyX::ref().session().saveSessionInfo("WindowHeight", convert<string>(height()));
+ LyX::ref().session().saveSessionInfo("WindowWidth", convert<string>(this->normalGeometry().width()));
+ LyX::ref().session().saveSessionInfo("WindowHeight", convert<string>(this->normalGeometry().height()));
+ LyX::ref().session().saveSessionInfo("WindowIsMaximized", (this->isMaximized() ? "yes" : "no"));
if (lyxrc.geometry_xysaved) {
- LyX::ref().session().saveSessionInfo("WindowPosX", convert<string>(x()));
- LyX::ref().session().saveSessionInfo("WindowPosY", convert<string>(y()));
+ LyX::ref().session().saveSessionInfo("WindowPosX", convert<string>(this->normalGeometry().x()));
+ LyX::ref().session().saveSessionInfo("WindowPosY", convert<string>(this->normalGeometry().y()));
}
// trigger LFUN_LYX_QUIT instead of quit directly
// since LFUN_LYX_QUIT may have more cleanup stuff
Index: frontends/qt4/QtView.h
===================================================================
--- frontends/qt4/QtView.h (revision 14083)
+++ frontends/qt4/QtView.h (working copy)
@@ -47,7 +47,7 @@
Q_OBJECT
public:
/// create a main window of the given dimensions
- QtView(unsigned int w, unsigned int h);
+ QtView(unsigned int w, unsigned int h, bool isMax);
~QtView();
Index: frontends/xforms/lyx_gui.C
===================================================================
--- frontends/xforms/lyx_gui.C (revision 14083)
+++ frontends/xforms/lyx_gui.C (working copy)
@@ -256,7 +256,7 @@
void start(string const & batch, vector<string> const & files,
- unsigned int width, unsigned int height, int posx, int posy)
+ unsigned int width, unsigned int height, int posx, int posy, bool)
{
int const geometryBitmask =
XParseGeometry(geometry, &posx, &posy, &width, &height);
Index: frontends/lyx_gui.h
===================================================================
--- frontends/lyx_gui.h (revision 14083)
+++ frontends/lyx_gui.h (working copy)
@@ -57,7 +57,7 @@
* batch commands, and loading the given documents
*/
void start(std::string const & batch, std::vector<std::string> const & files,
- unsigned int width, unsigned int height, int posx, int posy);
+ unsigned int width, unsigned int height, int posx, int posy, bool isMax);
/**
* Enter the main event loop (\sa LyX::exec2)
Index: lyx_main.C
===================================================================
--- lyx_main.C (revision 14083)
+++ lyx_main.C (working copy)
@@ -307,6 +307,7 @@
// initial geometry
unsigned int width = 690;
unsigned int height = 510;
+ bool isMax = false;
// first try lyxrc
if (lyxrc.geometry_width != 0 && lyxrc.geometry_height != 0 ) {
width = lyxrc.geometry_width;
@@ -320,6 +321,8 @@
val = session().loadSessionInfo("WindowHeight");
if (!val.empty())
height = convert<unsigned int>(val);
+ if (session().loadSessionInfo("WindowIsMaximized") == "yes")
+ isMax = true;
}
// if user wants to restore window position
int posx = -1;
@@ -332,7 +335,7 @@
if (!val.empty())
posy = convert<int>(val);
}
- lyx_gui::start(batch_command, files, width, height, posx, posy);
+ lyx_gui::start(batch_command, files, width, height, posx, posy, isMax);
} else {
// Something went wrong above
quitLyX(false);
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14088 a592a061-630c-0410-9148-cb99ea01b6c8
2006-06-13 08:05:00 +00:00
|
|
|
LyX::ref().session().saveSessionInfo("WindowPosX", convert<string>(this->normalGeometry().x()));
|
|
|
|
LyX::ref().session().saveSessionInfo("WindowPosY", convert<string>(this->normalGeometry().y()));
|
2006-04-05 22:56:18 +00:00
|
|
|
}
|
2006-05-05 20:23:12 +00:00
|
|
|
// trigger LFUN_LYX_QUIT instead of quit directly
|
|
|
|
// since LFUN_LYX_QUIT may have more cleanup stuff
|
|
|
|
getLyXFunc().dispatch(FuncRequest(LFUN_LYX_QUIT));
|
2006-03-05 17:24:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QtView::show()
|
|
|
|
{
|
2006-06-04 20:49:09 +00:00
|
|
|
QMainWindow::setWindowTitle(qt_("LyX"));
|
2006-03-05 17:24:44 +00:00
|
|
|
QMainWindow::show();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QtView::busy(bool yes) const
|
|
|
|
{
|
|
|
|
if (yes)
|
2006-06-04 20:49:09 +00:00
|
|
|
QApplication::setOverrideCursor(Qt::WaitCursor);
|
2006-03-05 17:24:44 +00:00
|
|
|
else
|
|
|
|
QApplication::restoreOverrideCursor();
|
|
|
|
}
|
|
|
|
|
2006-06-04 20:49:09 +00:00
|
|
|
QMainWindow* QtView::mainWidget()
|
|
|
|
{
|
|
|
|
return mainWidget_;
|
|
|
|
}
|
|
|
|
|
|
|
|
QMainWindow* QtView::mainWidget_ = 0;
|
|
|
|
|
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
} // namespace frontend
|
|
|
|
} // namespace lyx
|
2006-05-18 08:51:12 +00:00
|
|
|
|
|
|
|
#include "QtView_moc.cpp"
|