mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-27 03:36:39 +00:00
Fix bug #6263: Order of Tabs in Menu and used in Ctrl+PgUp/PgDwn is not the same as in the workarea.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36625 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
42fe3fdbc3
commit
1f8b9bf9b0
@ -1177,6 +1177,15 @@ void GuiView::setBusy(bool busy)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
GuiWorkArea * GuiView::workArea(int index)
|
||||||
|
{
|
||||||
|
if (TabWorkArea * twa = d.currentTabWorkArea())
|
||||||
|
if (index < twa->count())
|
||||||
|
return dynamic_cast<GuiWorkArea *>(twa->widget(index));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
GuiWorkArea * GuiView::workArea(Buffer & buffer)
|
GuiWorkArea * GuiView::workArea(Buffer & buffer)
|
||||||
{
|
{
|
||||||
if (currentWorkArea()
|
if (currentWorkArea()
|
||||||
@ -2581,24 +2590,24 @@ bool GuiView::inMultiViews(GuiWorkArea * wa)
|
|||||||
|
|
||||||
void GuiView::gotoNextOrPreviousBuffer(NextOrPrevious np)
|
void GuiView::gotoNextOrPreviousBuffer(NextOrPrevious np)
|
||||||
{
|
{
|
||||||
Buffer * const curbuf = documentBufferView()
|
if (!documentBufferView())
|
||||||
? &documentBufferView()->buffer() : 0;
|
return;
|
||||||
Buffer * nextbuf = curbuf;
|
|
||||||
while (true) {
|
if (TabWorkArea * twa = d.currentTabWorkArea()) {
|
||||||
if (np == NEXTBUFFER)
|
Buffer * const curbuf = &documentBufferView()->buffer();
|
||||||
nextbuf = theBufferList().next(nextbuf);
|
int nwa = twa->count();
|
||||||
else
|
for (int i = 0; i < nwa; ++i) {
|
||||||
nextbuf = theBufferList().previous(nextbuf);
|
if (&workArea(i)->bufferView().buffer() == curbuf) {
|
||||||
if (nextbuf == curbuf)
|
int next_index;
|
||||||
break;
|
if (np == NEXTBUFFER)
|
||||||
if (nextbuf == 0) {
|
next_index = (i == nwa - 1 ? 0 : i + 1);
|
||||||
nextbuf = curbuf;
|
else
|
||||||
break;
|
next_index = (i == 0 ? nwa - 1 : i - 1);
|
||||||
|
setBuffer(&workArea(next_index)->bufferView().buffer());
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (workArea(*nextbuf))
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
setBuffer(nextbuf);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -184,6 +184,8 @@ public:
|
|||||||
/// \return the \c Workarea associated to \p Buffer
|
/// \return the \c Workarea associated to \p Buffer
|
||||||
/// \retval 0 if no \c WorkArea is found.
|
/// \retval 0 if no \c WorkArea is found.
|
||||||
GuiWorkArea * workArea(Buffer & buffer);
|
GuiWorkArea * workArea(Buffer & buffer);
|
||||||
|
/// \return the \c Workarea at index \c index
|
||||||
|
GuiWorkArea * workArea(int index);
|
||||||
|
|
||||||
/// Add a \c WorkArea
|
/// Add a \c WorkArea
|
||||||
/// \return the \c Workarea associated to \p Buffer
|
/// \return the \c Workarea associated to \p Buffer
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#include "Action.h"
|
#include "Action.h"
|
||||||
#include "GuiApplication.h"
|
#include "GuiApplication.h"
|
||||||
#include "GuiView.h"
|
#include "GuiView.h"
|
||||||
|
#include "GuiWorkArea.h"
|
||||||
#include "qt_helpers.h"
|
#include "qt_helpers.h"
|
||||||
|
|
||||||
#include "BiblioInfo.h"
|
#include "BiblioInfo.h"
|
||||||
@ -894,36 +895,49 @@ void MenuDefinition::expandDocuments()
|
|||||||
item.setSubmenu(MenuDefinition(qt_("Hidden|H")));
|
item.setSubmenu(MenuDefinition(qt_("Hidden|H")));
|
||||||
|
|
||||||
Buffer * first = theBufferList().first();
|
Buffer * first = theBufferList().first();
|
||||||
if (first) {
|
if (!first) {
|
||||||
Buffer * b = first;
|
add(MenuItem(MenuItem::Info, qt_("<No Documents Open>")));
|
||||||
int vis = 1;
|
return;
|
||||||
int invis = 1;
|
}
|
||||||
|
|
||||||
// We cannot use a for loop as the buffer list cycles.
|
int i = 0;
|
||||||
do {
|
while (true) {
|
||||||
|
GuiWorkArea * wa = guiApp->currentView()->workArea(i);
|
||||||
|
if (!wa)
|
||||||
|
break;
|
||||||
|
Buffer const & b = wa->bufferView().buffer();
|
||||||
|
QString label = toqstr(b.fileName().displayName(20));
|
||||||
|
if (!b.isClean())
|
||||||
|
label += "*";
|
||||||
|
if (i < 10)
|
||||||
|
label = QString::number(i) + ". " + label + '|' + QString::number(i);
|
||||||
|
add(MenuItem(MenuItem::Command, label,
|
||||||
|
FuncRequest(LFUN_BUFFER_SWITCH, b.absFileName())));
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
i = 0;
|
||||||
|
Buffer * b = first;
|
||||||
|
// We cannot use a for loop as the buffer list cycles.
|
||||||
|
do {
|
||||||
|
bool const shown = guiApp->currentView()
|
||||||
|
? guiApp->currentView()->workArea(*b) : false;
|
||||||
|
if (!shown) {
|
||||||
QString label = toqstr(b->fileName().displayName(20));
|
QString label = toqstr(b->fileName().displayName(20));
|
||||||
if (!b->isClean())
|
if (!b->isClean())
|
||||||
label += "*";
|
label += "*";
|
||||||
bool const shown = guiApp->currentView()
|
if (i < 10)
|
||||||
? guiApp->currentView()->workArea(*b) : false;
|
label = QString::number(i) + ". " + label + '|' + QString::number(i);
|
||||||
int ii = shown ? vis : invis;
|
item.submenu().add(MenuItem(MenuItem::Command, label,
|
||||||
if (ii < 10)
|
FuncRequest(LFUN_BUFFER_SWITCH, b->absFileName())));
|
||||||
label = QString::number(ii) + ". " + label + '|' + QString::number(ii);
|
++i;
|
||||||
if (shown) {
|
}
|
||||||
add(MenuItem(MenuItem::Command, label,
|
b = theBufferList().next(b);
|
||||||
FuncRequest(LFUN_BUFFER_SWITCH, b->absFileName())));
|
} while (b != first);
|
||||||
++vis;
|
|
||||||
} else {
|
if (!item.submenu().empty())
|
||||||
item.submenu().add(MenuItem(MenuItem::Command, label,
|
add(item);
|
||||||
FuncRequest(LFUN_BUFFER_SWITCH, b->absFileName())));
|
|
||||||
++invis;
|
|
||||||
}
|
|
||||||
b = theBufferList().next(b);
|
|
||||||
} while (b != first);
|
|
||||||
if (!item.submenu().empty())
|
|
||||||
add(item);
|
|
||||||
} else
|
|
||||||
add(MenuItem(MenuItem::Info, qt_("<No Documents Open>")));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user