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
16 //#include "minibuffer.h"
20 #include "support/filetools.h"
21 #include "MenuBackend.h"
22 #include "ToolbarDefaults.h"
24 #include "BufferView.h"
26 #include "frontends/Toolbar.h"
27 #include "frontends/Menubar.h"
28 #include "frontends/Dialogs.h"
29 #include "frontends/Timeout.h"
32 #include "qfont_loader.h"
34 #include <qapplication.h>
40 // FIXME: this has to go away
41 BufferView * current_view;
43 qfont_loader fontloader;
45 QtView::QtView(unsigned int width, unsigned int height)
46 : QMainWindow(), LyXView()
48 resize(width, height);
50 qApp->setMainWidget(this);
52 menubar_.reset(new Menubar(this, menubackend));
54 connect(menuBar(), SIGNAL(activated(int)),
55 this, SLOT(activated(int)));
57 toolbar_.reset(new Toolbar(this, 0, 0, toolbardefaults));
60 // FIXME minibuffer_.reset(new MiniBuffer(this, 0, 0, 30, 30));
62 bufferview_.reset(new BufferView(this, 0, 0, width, height));
63 ::current_view = bufferview_.get();
66 // FIXME autosave_timeout_->timeout.connect(SigC::slot(this, &QtView::autoSave));
68 // assign an icon to main form
69 string const iconname = LibFileSearch("images", "lyx", "xpm");
71 if (!iconname.empty())
72 setIcon(QPixmap(iconname.c_str()));
75 minibuffer_.reset(new MiniBuffer(this, air, height - (25 + air),
76 width - (2 * air), 25));
78 // connect the minibuffer signals
79 minibuffer_->stringReady.connect(SigC::slot(getLyXFunc(),
80 &LyXFunc::miniDispatch));
81 minibuffer_->timeout.connect(SigC::slot(getLyXFunc(),
82 &LyXFunc::initMiniBuffer));
83 minibuffer_->dd_init();
87 // make sure the buttons are disabled if needed
97 void QtView::activated(int id)
99 getLyXFunc()->verboseDispatch(id, true);
103 void QtView::closeEvent(QCloseEvent *)
109 void QtView::redraw()
111 // FIXME: does this make any sense for us ?
116 void QtView::setPosition(unsigned int x, unsigned int y)
122 void QtView::show(int, int, string const & title)
124 setCaption(title.c_str());
129 void QtView::prohibitInput() const
132 //setFocusPolicy(QWidget::NoFocus);
136 void QtView::allowInput() const
139 //setFocusPolicy(QWidget::strongFocus);