3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
8 * Full author contact details are available in file CREDITS.
15 #include "MenuBackend.h"
16 #include "support/filetools.h"
19 #include "BufferView.h"
20 #include "XWorkArea.h"
22 #include "GMiniBuffer.h"
24 #include <boost/bind.hpp>
26 BufferView * current_view;
28 GView * GView::view_ = 0;
34 vbox_.reset(new Gtk::VBox());
36 menubar_.reset(new GMenubar(this, menubackend));
37 toolbar_.reset(new GToolbar(this, 0, 0));
39 bufferview_.reset(new BufferView(this, 0, 0, 300, 300));
40 ::current_view = bufferview_.get();
41 minibuffer_.reset(new GMiniBuffer(this, *controlcommand_));
43 focus_command_buffer.connect(
44 boost::bind(&GMiniBuffer::editMode, minibuffer_.get()));
45 view_state_changed.connect(boost::bind(&GView::showViewState, this));
46 signal_focus_in_event().connect(SigC::slot(*this, &GView::onFocusIn));
47 set_default_size(500, 550);
48 // Make sure the buttons are disabled if needed.
50 string const iconName =
51 lyx::support::LibFileSearch("images", "lyx", "xpm");
52 if (!iconName.empty())
53 set_icon_from_file(iconName);
62 bool GView::on_delete_event(GdkEventAny * /*event*/)
69 bool GView::onFocusIn(GdkEventFocus * /*event*/)
71 workArea_->grab_focus();
76 void GView::prohibitInput() const
79 const_cast<GView*>(this)->set_sensitive(false);
83 void GView::allowInput() const
85 const_cast<GView*>(this)->set_sensitive(true);
89 void GView::message(string const & msg)
91 minibuffer_->message(msg);
95 void GView::showViewState()
97 message(getLyXFunc().view_status_message());
101 void GView::setWindowTitle(string const & t, string const & /*it*/)
103 set_title(Glib::locale_to_utf8(t));
107 void GView::busy(bool yes) const
110 view()->hideCursor();
111 Gdk::Cursor cursor(Gdk::WATCH);
112 const_cast<GView*>(this)->get_window()->set_cursor(cursor);
113 const_cast<GView*>(this)->set_sensitive(false);
115 const_cast<GView*>(this)->get_window()->set_cursor();
116 const_cast<GView*>(this)->set_sensitive(true);
121 void GView::clearMessage()
123 message(getLyXFunc().view_status_message());