mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-08 10:51:03 +00:00
move view_ids from Application to GuiApplication
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21658 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
d837643c95
commit
12f435035a
@ -701,7 +701,7 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
|
||||
break;
|
||||
}
|
||||
case LFUN_WINDOW_CLOSE: {
|
||||
enable = (theApp()->viewIds().size() > 1);
|
||||
enable = theApp()->viewCount() > 0;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -718,7 +718,7 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
|
||||
|
||||
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);
|
||||
|
@ -17,8 +17,6 @@
|
||||
|
||||
#include <boost/function.hpp>
|
||||
|
||||
#include <vector>
|
||||
|
||||
|
||||
namespace lyx {
|
||||
|
||||
@ -163,7 +161,7 @@ public:
|
||||
///
|
||||
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;
|
||||
@ -243,8 +241,6 @@ protected:
|
||||
/// This LyXView is the one receiving Clipboard and Selection
|
||||
/// events
|
||||
LyXView * current_view_;
|
||||
///
|
||||
std::vector<int> view_ids_;
|
||||
};
|
||||
|
||||
} // namespace frontend
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include <QTranslator>
|
||||
|
||||
#include <map>
|
||||
#include <vector>
|
||||
|
||||
class QSessionManager;
|
||||
|
||||
@ -79,6 +80,9 @@ public:
|
||||
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_; }
|
||||
///
|
||||
@ -130,6 +134,8 @@ public:
|
||||
* \sa Qt::WA_DeleteOnClose attribute.
|
||||
*/
|
||||
std::map<int, GuiView *> views_;
|
||||
///
|
||||
std::vector<int> view_ids_;
|
||||
}; // GuiApplication
|
||||
|
||||
extern GuiApplication * guiApp;
|
||||
|
@ -403,7 +403,7 @@ void GuiView::closeEvent(QCloseEvent * close_event)
|
||||
{
|
||||
// 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;
|
||||
@ -429,7 +429,7 @@ void GuiView::closeEvent(QCloseEvent * close_event)
|
||||
}
|
||||
|
||||
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();
|
||||
|
Loading…
Reference in New Issue
Block a user