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.
13 // Too hard to make concept checks work with this file
14 #ifdef _GLIBCXX_CONCEPT_CHECKS
15 #undef _GLIBCXX_CONCEPT_CHECKS
17 #ifdef _GLIBCPP_CONCEPT_CHECKS
18 #undef _GLIBCPP_CONCEPT_CHECKS
23 #include "GMiniBuffer.h"
25 #include "BufferView.h"
28 #include "MenuBackend.h"
30 #include "frontends/Toolbars.h"
32 #include "support/filetools.h"
34 #include <boost/bind.hpp>
45 void add_el(Gtk::Box::BoxList & list, Gtk::Box & box, bool shrink)
47 Gtk::PackOptions const packing =
48 shrink ? Gtk::PACK_SHRINK : Gtk::PACK_EXPAND_WIDGET;
49 list.push_back(Gtk::Box_Helpers::Element(box, packing));
57 // The physical store for the boxes making up the layout.
58 box_store_.push_back(BoxPtr(new Gtk::VBox));
59 box_store_.push_back(BoxPtr(new Gtk::HBox));
60 box_store_.push_back(BoxPtr(new Gtk::VBox));
61 box_store_.push_back(BoxPtr(new Gtk::HBox));
62 box_store_.push_back(BoxPtr(new Gtk::HBox));
63 box_store_.push_back(BoxPtr(new Gtk::HBox));
65 // Lay them out correctly.
68 Gtk::Box::BoxList & layout1 = top_box_.children();
69 add_el(layout1, *box_store_[0], true);
70 add_el(layout1, *box_store_[1], false);
71 add_el(layout1, *box_store_[2], true);
73 Gtk::Box::BoxList & layout2 = box_store_[1]->children();
74 add_el(layout2, *box_store_[3], true);
75 add_el(layout2, *box_store_[4], false);
76 add_el(layout2, *box_store_[5], true);
78 // Define accessors to the various Boxes.
79 box_map_[Top] = box_store_[0];
80 box_map_[Bottom] = box_store_[2];
81 box_map_[Left] = box_store_[3];
82 box_map_[Center] = box_store_[4];
83 box_map_[Right] = box_store_[5];
85 // Make all Boxes visible.
88 // Define the components making up the window.
89 menubar_.reset(new GMenubar(this, menubackend));
91 bufferview_.reset(new BufferView(this, 300, 300));
92 minibuffer_.reset(new GMiniBuffer(this, *controlcommand_));
94 focus_command_buffer.connect(
95 boost::bind(&GMiniBuffer::editMode, minibuffer_.get()));
96 view_state_changed.connect(boost::bind(&GView::showViewState, this));
97 signal_focus_in_event().connect(sigc::mem_fun(*this, &GView::onFocusIn));
98 set_default_size(620, 550);
99 // Make sure the buttons are disabled if needed.
101 string const iconName =
102 support::LibFileSearch("images", "lyx", "xpm");
103 if (!iconName.empty())
104 set_icon_from_file(iconName);
112 Gtk::Box & GView::getBox(Position pos)
114 return *box_map_[pos];
118 bool GView::on_delete_event(GdkEventAny * /*event*/)
125 bool GView::onFocusIn(GdkEventFocus * /*event*/)
127 workArea_->grab_focus();
132 void GView::prohibitInput() const
134 view()->hideCursor();
135 const_cast<GView*>(this)->set_sensitive(false);
139 void GView::allowInput() const
141 const_cast<GView*>(this)->set_sensitive(true);
145 void GView::message(string const & msg)
147 minibuffer_->message(msg);
151 void GView::showViewState()
153 message(getLyXFunc().viewStatusMessage());
157 void GView::setWindowTitle(string const & t, string const & /*it*/)
159 set_title(Glib::locale_to_utf8(t));
163 void GView::busy(bool yes) const
166 view()->hideCursor();
167 Gdk::Cursor cursor(Gdk::WATCH);
168 const_cast<GView *>(this)->get_window()->set_cursor(cursor);
169 const_cast<GView *>(this)->set_sensitive(false);
171 const_cast<GView *>(this)->get_window()->set_cursor();
172 const_cast<GView *>(this)->set_sensitive(true);
177 void GView::clearMessage()
179 message(getLyXFunc().viewStatusMessage());
183 bool GView::hasFocus() const
185 // No real implementation needed for now
190 } // namespace frontend