mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-23 10:18:50 +00:00
Present to Mac users: Session handling per document instead of per window when "open document in tabs" is disabled.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@25320 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
ab9a074f20
commit
26dbfbcf89
@ -104,6 +104,7 @@
|
||||
#endif // Q_WS_WIN
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/crc.hpp>
|
||||
|
||||
#include <exception>
|
||||
#include <vector>
|
||||
@ -840,8 +841,13 @@ bool GuiApplication::dispatch(FuncRequest const & cmd)
|
||||
case LFUN_FILE_OPEN:
|
||||
if (d->views_.empty()
|
||||
|| (!lyxrc.open_buffers_in_tabs && current_view_->buffer() != 0)) {
|
||||
createView();
|
||||
current_view_->openDocument(to_utf8(cmd.argument()));
|
||||
string const fname = to_utf8(cmd.argument());
|
||||
// We want the ui session to be saved per document and not per
|
||||
// window number. The filename crc is a good enough identifier.
|
||||
boost::crc_32_type crc;
|
||||
crc = for_each(fname.begin(), fname.end(), crc);
|
||||
createView(crc.checksum());
|
||||
current_view_->openDocument(fname);
|
||||
if (!current_view_->buffer())
|
||||
current_view_->close();
|
||||
} else
|
||||
@ -900,7 +906,14 @@ void GuiApplication::resetGui()
|
||||
}
|
||||
|
||||
|
||||
void GuiApplication::createView(QString const & geometry_arg, bool autoShow)
|
||||
void GuiApplication::createView(int view_id)
|
||||
{
|
||||
createView(QString(), true, view_id);
|
||||
}
|
||||
|
||||
|
||||
void GuiApplication::createView(QString const & geometry_arg, bool autoShow,
|
||||
int view_id)
|
||||
{
|
||||
// release the keyboard which might have been grabed by the global
|
||||
// menubar on Mac to catch shortcuts even without any GuiView.
|
||||
@ -908,9 +921,11 @@ void GuiApplication::createView(QString const & geometry_arg, bool autoShow)
|
||||
d->global_menubar_->releaseKeyboard();
|
||||
|
||||
// create new view
|
||||
int id = 0;
|
||||
while (d->views_.find(id) != d->views_.end())
|
||||
id++;
|
||||
int id = view_id > 0 ? view_id : 0;
|
||||
if (id == 0) {
|
||||
while (d->views_.find(id) != d->views_.end())
|
||||
id++;
|
||||
}
|
||||
GuiView * view = new GuiView(id);
|
||||
|
||||
// register view
|
||||
|
@ -89,8 +89,11 @@ public:
|
||||
|
||||
/// Create the main window with given geometry settings.
|
||||
/// \param geometry_arg: only for Windows platform.
|
||||
/// \param optional id identifier.
|
||||
void createView(QString const & geometry_arg = QString(),
|
||||
bool autoShow = true);
|
||||
bool autoShow = true, int id = 0);
|
||||
/// FIXME: this method and the one above are quite ugly.
|
||||
void createView(int id);
|
||||
///
|
||||
GuiView const * currentView() const { return current_view_; }
|
||||
///
|
||||
|
Loading…
Reference in New Issue
Block a user