2002-06-19 03:38:44 +00:00
|
|
|
/**
|
|
|
|
* \file QtView.C
|
|
|
|
* Copyright 1995-2002 the LyX Team
|
|
|
|
* Read the file COPYING
|
|
|
|
*
|
|
|
|
* \author Lars Gullik Bjornes <larsbj@lyx.org>
|
|
|
|
* \author John Levon <moz@compsoc.man.ac.uk>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma implementation
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "debug.h"
|
|
|
|
#include "intl.h"
|
|
|
|
#include "lyx_cb.h"
|
|
|
|
#include "support/filetools.h"
|
|
|
|
#include "MenuBackend.h"
|
2002-07-11 01:01:38 +00:00
|
|
|
#include "QMiniBuffer.h"
|
2002-06-19 03:38:44 +00:00
|
|
|
#include "ToolbarDefaults.h"
|
|
|
|
#include "lyxfunc.h"
|
|
|
|
#include "BufferView.h"
|
|
|
|
|
|
|
|
#include "frontends/Toolbar.h"
|
|
|
|
#include "frontends/Menubar.h"
|
|
|
|
#include "frontends/Dialogs.h"
|
|
|
|
#include "frontends/Timeout.h"
|
|
|
|
|
|
|
|
#include "QtView.h"
|
|
|
|
#include "qfont_loader.h"
|
|
|
|
|
|
|
|
#include <qapplication.h>
|
|
|
|
#include <qpixmap.h>
|
|
|
|
#include <qmenubar.h>
|
2002-07-13 01:42:15 +00:00
|
|
|
#include <qstatusbar.h>
|
2002-06-19 03:38:44 +00:00
|
|
|
|
|
|
|
using std::endl;
|
|
|
|
|
|
|
|
// FIXME: this has to go away
|
|
|
|
BufferView * current_view;
|
|
|
|
|
|
|
|
qfont_loader fontloader;
|
|
|
|
|
|
|
|
QtView::QtView(unsigned int width, unsigned int height)
|
|
|
|
: QMainWindow(), LyXView()
|
|
|
|
{
|
|
|
|
resize(width, height);
|
|
|
|
|
|
|
|
qApp->setMainWidget(this);
|
|
|
|
|
|
|
|
menubar_.reset(new Menubar(this, menubackend));
|
|
|
|
|
|
|
|
connect(menuBar(), SIGNAL(activated(int)),
|
|
|
|
this, SLOT(activated(int)));
|
|
|
|
|
2002-07-11 01:01:38 +00:00
|
|
|
toolbar_.reset(new Toolbar(this, *getDialogs(), 0, 0, toolbardefaults));
|
2002-06-19 03:38:44 +00:00
|
|
|
toolbar_->set(true);
|
|
|
|
|
2002-07-13 01:42:15 +00:00
|
|
|
statusBar()->setSizeGripEnabled(false);
|
|
|
|
|
2002-07-11 01:01:38 +00:00
|
|
|
minibuffer_.reset(new QMiniBuffer(this));
|
2002-06-19 03:38:44 +00:00
|
|
|
|
|
|
|
bufferview_.reset(new BufferView(this, 0, 0, width, height));
|
|
|
|
::current_view = bufferview_.get();
|
|
|
|
|
|
|
|
// FIXME: move
|
|
|
|
// FIXME autosave_timeout_->timeout.connect(SigC::slot(this, &QtView::autoSave));
|
|
|
|
|
|
|
|
// assign an icon to main form
|
|
|
|
string const iconname = LibFileSearch("images", "lyx", "xpm");
|
|
|
|
|
|
|
|
if (!iconname.empty())
|
|
|
|
setIcon(QPixmap(iconname.c_str()));
|
|
|
|
|
|
|
|
// make sure the buttons are disabled if needed
|
|
|
|
updateToolbar();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
QtView::~QtView()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QtView::activated(int id)
|
|
|
|
{
|
|
|
|
getLyXFunc()->verboseDispatch(id, true);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QtView::closeEvent(QCloseEvent *)
|
|
|
|
{
|
|
|
|
QuitLyX();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-07-12 01:59:01 +00:00
|
|
|
void QtView::show(int x, int y, string const & title)
|
2002-06-19 03:38:44 +00:00
|
|
|
{
|
|
|
|
move(x, y);
|
|
|
|
setCaption(title.c_str());
|
|
|
|
QMainWindow::show();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QtView::prohibitInput() const
|
|
|
|
{
|
|
|
|
// FIXME
|
|
|
|
//setFocusPolicy(QWidget::NoFocus);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QtView::allowInput() const
|
|
|
|
{
|
|
|
|
// FIXME
|
|
|
|
//setFocusPolicy(QWidget::strongFocus);
|
|
|
|
}
|