/**
- * \file qt2/lyx_gui.C
+ * \file qt4/lyx_gui.C
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
// FIXME: move this stuff out again
#include "bufferlist.h"
#include "BufferView.h"
+#include "Color.h"
#include "funcrequest.h"
#include "LColor.h"
#include "lyx_main.h"
#include "lyxrc.h"
#include "lyxserver.h"
#include "lyxsocket.h"
+#include "session.h"
#include "graphics/LoaderQueue.h"
#include "support/lstrings.h"
+#include "support/convert.h"
#include "support/os.h"
#include "support/package.h"
#include "debug.h"
static LQApplication app(argc, argv);
-#if QT_VERSION >= 0x030200
// install translation file for Qt built-in dialogs
// These are only installed since Qt 3.2.x
static QTranslator qt_trans(0);
lyxerr[Debug::GUI]
<< "Could not find Qt translations for locale "
<< QTextCodec::locale() << std::endl;
-#endif
-#ifdef Q_WS_MACX
+/*#ifdef Q_WS_MACX
// These translations are meant to break Qt/Mac menu merging
// algorithm on some entries. It lists the menu names that
// should not be moved to the LyX menu
app.installTranslator(&aqua_trans);
#endif
-
+*/
using namespace lyx::graphics;
Image::newImage = boost::bind(&QLImage::newImage);
// initial geometry
unsigned int width = 690;
unsigned int height = 510;
+ // first try lyxrc
+ if (lyxrc.geometry_width != 0 && lyxrc.geometry_height != 0 ) {
+ width = lyxrc.geometry_width;
+ height = lyxrc.geometry_height;
+ }
+ // if lyxrc returns (0,0), then use session info
+ else {
+ string val = LyX::ref().session().loadSessionInfo("WindowWidth");
+ if (val != "")
+ width = convert<unsigned int>(val);
+ val = LyX::ref().session().loadSessionInfo("WindowHeight");
+ if (val != "")
+ height = convert<unsigned int>(val);
+ }
boost::shared_ptr<QtView> view_ptr(new QtView(width, height));
LyX::ref().addLyXView(view_ptr);
QtView & view = *view_ptr.get();
+
+ // if user wants to restore window position
+ if (lyxrc.geometry_xysaved) {
+ QPoint p = view.pos();
+ string val = LyX::ref().session().loadSessionInfo("WindowPosX");
+ if (val != "")
+ p.setX(convert<unsigned int>(val));
+ val = LyX::ref().session().loadSessionInfo("WindowPosY");
+ if (val != "")
+ p.setY(convert<unsigned int>(val));
+ view.move(p);
+ }
view.show();
view.init();
if (ev.argument == "preamble")
flag.unknown(true);
break;
- case LFUN_TOOLTIPS_TOGGLE:
+ case LFUN_TOGGLE_TOOLTIPS:
flag.unknown(true);
break;
default:
}
+bool getRGBColor(LColor_color col, lyx::RGBColor & rgbcol)
+{
+ QColor const & qcol = lcolorcache.get(col);
+ if (!qcol.isValid()) {
+ rgbcol.r = 0;
+ rgbcol.g = 0;
+ rgbcol.b = 0;
+ return false;
+ }
+ rgbcol.r = qcol.red();
+ rgbcol.g = qcol.green();
+ rgbcol.b = qcol.blue();
+ return true;
+}
+
+
string const hexname(LColor_color col)
{
return ltrim(fromqstr(lcolorcache.get(col).name()), "#");