3 * Copyright 1995-2002 the LyX Team
4 * Read the file COPYING
6 * \author Lars Gullik Bjornes <larsbj@lyx.org>
7 * \author John Levon <moz@compsoc.man.ac.uk>
13 #pragma implementation
19 #include "support/filetools.h"
20 #include "MenuBackend.h"
21 #include "QMiniBuffer.h"
22 #include "ToolbarDefaults.h"
24 #include "bufferview_funcs.h"
25 #include "BufferView.h"
27 #include "frontends/Toolbar.h"
28 #include "frontends/Menubar.h"
29 #include "frontends/Dialogs.h"
30 #include "frontends/Timeout.h"
33 #include "qfont_loader.h"
35 #include <qapplication.h>
38 #include <qstatusbar.h>
40 #include <boost/bind.hpp>
44 // FIXME: this has to go away
45 BufferView * current_view;
47 qfont_loader fontloader;
49 QtView::QtView(unsigned int width, unsigned int height)
50 : QMainWindow(), LyXView()
52 resize(width, height);
54 qApp->setMainWidget(this);
56 menubar_.reset(new Menubar(this, menubackend));
58 connect(menuBar(), SIGNAL(activated(int)),
59 this, SLOT(activated(int)));
61 toolbar_.reset(new Toolbar(this, *getDialogs(), 0, 0, toolbardefaults));
64 statusBar()->setSizeGripEnabled(false);
66 minibuffer_.reset(new QMiniBuffer(this));
68 bufferview_.reset(new BufferView(this, 0, 0, width, height));
69 ::current_view = bufferview_.get();
71 view_state_changed.connect(boost::bind(&QtView::update_view_state, this));
74 // FIXME autosave_timeout_->timeout.connect(SigC::slot(this, &QtView::autoSave));
76 // assign an icon to main form
77 string const iconname = LibFileSearch("images", "lyx", "xpm");
79 if (!iconname.empty())
80 setIcon(QPixmap(iconname.c_str()));
82 // make sure the buttons are disabled if needed
92 void QtView::update_view_state()
94 statusBar()->message(currentState(view()).c_str());
98 void QtView::activated(int id)
100 getLyXFunc()->verboseDispatch(id, true);
104 void QtView::closeEvent(QCloseEvent *)
110 void QtView::show(int x, int y, string const & title)
113 setCaption(title.c_str());
118 void QtView::prohibitInput() const
121 //setFocusPolicy(QWidget::NoFocus);
125 void QtView::allowInput() const
128 //setFocusPolicy(QWidget::strongFocus);