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>
29 BufferView * current_view;
31 GView * GView::view_ = 0;
37 vbox_.reset(new Gtk::VBox);
39 menubar_.reset(new GMenubar(this, menubackend));
40 toolbar_.reset(new GToolbar(this, 0, 0));
42 bufferview_.reset(new BufferView(this, 0, 0, 300, 300));
43 ::current_view = bufferview_.get();
44 minibuffer_.reset(new GMiniBuffer(this, *controlcommand_));
46 focus_command_buffer.connect(
47 boost::bind(&GMiniBuffer::editMode, minibuffer_.get()));
48 view_state_changed.connect(boost::bind(&GView::showViewState, this));
49 signal_focus_in_event().connect(SigC::slot(*this, &GView::onFocusIn));
50 set_default_size(500, 550);
51 // Make sure the buttons are disabled if needed.
53 string const iconName =
54 lyx::support::LibFileSearch("images", "lyx", "xpm");
55 if (!iconName.empty())
56 set_icon_from_file(iconName);
65 bool GView::on_delete_event(GdkEventAny * /*event*/)
72 bool GView::onFocusIn(GdkEventFocus * /*event*/)
74 workArea_->grab_focus();
79 void GView::prohibitInput() const
82 const_cast<GView*>(this)->set_sensitive(false);
86 void GView::allowInput() const
88 const_cast<GView*>(this)->set_sensitive(true);
92 void GView::message(string const & msg)
94 minibuffer_->message(msg);
98 void GView::showViewState()
100 message(getLyXFunc().view_status_message());
104 void GView::setWindowTitle(string const & t, string const & /*it*/)
106 set_title(Glib::locale_to_utf8(t));
110 void GView::busy(bool yes) const
113 view()->hideCursor();
114 Gdk::Cursor cursor(Gdk::WATCH);
115 const_cast<GView*>(this)->get_window()->set_cursor(cursor);
116 const_cast<GView*>(this)->set_sensitive(false);
118 const_cast<GView*>(this)->get_window()->set_cursor();
119 const_cast<GView*>(this)->set_sensitive(true);
124 void GView::clearMessage()
126 message(getLyXFunc().view_status_message());