break;
}
case LFUN_WINDOW_CLOSE: {
- enable = (theApp()->viewIds().size() > 1);
+ enable = theApp()->viewCount() > 0;
break;
}
case LFUN_CALL: {
FuncRequest func;
- std::string name(to_utf8(cmd.argument()));
+ std::string name = to_utf8(cmd.argument());
if (LyX::ref().topLevelCmdDef().lock(name, func)) {
func.origin = cmd.origin;
flag = getStatus(func);
#include <boost/function.hpp>
-#include <vector>
-
namespace lyx {
///
virtual LyXView & view(int id) const = 0;
///
- std::vector<int> const & viewIds() { return view_ids_; }
+ virtual size_t viewCount() const = 0;
///
virtual void hideDialogs(std::string const & name, Inset * inset) const = 0;
/// This LyXView is the one receiving Clipboard and Selection
/// events
LyXView * current_view_;
- ///
- std::vector<int> view_ids_;
};
} // namespace frontend
#include <QTranslator>
#include <map>
+#include <vector>
class QSessionManager;
void commitData(QSessionManager & sm);
//@}
+ virtual size_t viewCount() const { return view_ids_.size(); }
+ std::vector<int> const & viewIds() { return view_ids_; }
+
///
ColorCache & colorCache() { return color_cache_; }
///
* \sa Qt::WA_DeleteOnClose attribute.
*/
std::map<int, GuiView *> views_;
+ ///
+ std::vector<int> view_ids_;
}; // GuiApplication
extern GuiApplication * guiApp;
{
// we may have been called through the close window button
// which bypasses the LFUN machinery.
- if (!quitting_by_menu_ && theApp()->viewIds().size() == 1) {
+ if (!quitting_by_menu_ && theApp()->viewCount() == 1) {
if (!theBufferList().quitWriteAll()) {
close_event->ignore();
return;
}
theApp()->unregisterView(id());
- if (!theApp()->viewIds().empty()) {
+ if (theApp()->viewCount() > 0) {
// Just close the window and do nothing else if this is not the
// last window.
close_event->accept();