mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
Fix bug #5977 - Make Close button on tabs configurable
http://www.mail-archive.com/lyx-devel@lists.lyx.org/msg154950.html git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31535 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
8661b320ce
commit
3f170ec08c
@ -170,6 +170,7 @@ LexerKeyword lyxrcTags[] = {
|
|||||||
{ "\\serverpipe", LyXRC::RC_SERVERPIPE },
|
{ "\\serverpipe", LyXRC::RC_SERVERPIPE },
|
||||||
{ "\\set_color", LyXRC::RC_SET_COLOR },
|
{ "\\set_color", LyXRC::RC_SET_COLOR },
|
||||||
{ "\\show_banner", LyXRC::RC_SHOW_BANNER },
|
{ "\\show_banner", LyXRC::RC_SHOW_BANNER },
|
||||||
|
{ "\\single_close_tab_button", LyXRC::RC_SINGLE_CLOSE_TAB_BUTTON },
|
||||||
{ "\\sort_layouts", LyXRC::RC_SORT_LAYOUTS },
|
{ "\\sort_layouts", LyXRC::RC_SORT_LAYOUTS },
|
||||||
{ "\\spell_command", LyXRC::RC_SPELL_COMMAND },
|
{ "\\spell_command", LyXRC::RC_SPELL_COMMAND },
|
||||||
{ "\\spellcheck_continuously", LyXRC::RC_SPELLCHECK_CONTINUOUSLY },
|
{ "\\spellcheck_continuously", LyXRC::RC_SPELLCHECK_CONTINUOUSLY },
|
||||||
@ -316,6 +317,7 @@ void LyXRC::setDefaults()
|
|||||||
user_name = to_utf8(support::user_name());
|
user_name = to_utf8(support::user_name());
|
||||||
user_email = to_utf8(support::user_email());
|
user_email = to_utf8(support::user_email());
|
||||||
open_buffers_in_tabs = true;
|
open_buffers_in_tabs = true;
|
||||||
|
single_close_tab_button = false;
|
||||||
|
|
||||||
// Fullscreen settings
|
// Fullscreen settings
|
||||||
full_screen_limit = false;
|
full_screen_limit = false;
|
||||||
@ -1141,6 +1143,9 @@ int LyXRC::read(Lexer & lexrc)
|
|||||||
case RC_OPEN_BUFFERS_IN_TABS:
|
case RC_OPEN_BUFFERS_IN_TABS:
|
||||||
lexrc >> open_buffers_in_tabs;
|
lexrc >> open_buffers_in_tabs;
|
||||||
break;
|
break;
|
||||||
|
case RC_SINGLE_CLOSE_TAB_BUTTON:
|
||||||
|
lexrc >> single_close_tab_button;
|
||||||
|
break;
|
||||||
|
|
||||||
// Obsoteted in 1.4.0
|
// Obsoteted in 1.4.0
|
||||||
case RC_USETEMPDIR:
|
case RC_USETEMPDIR:
|
||||||
@ -1833,6 +1838,13 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c
|
|||||||
<< convert<string>(open_buffers_in_tabs)
|
<< convert<string>(open_buffers_in_tabs)
|
||||||
<< '\n';
|
<< '\n';
|
||||||
}
|
}
|
||||||
|
case RC_SINGLE_CLOSE_TAB_BUTTON:
|
||||||
|
if (ignore_system_lyxrc ||
|
||||||
|
single_close_tab_button != system_lyxrc.single_close_tab_button) {
|
||||||
|
os << "\\single_close_tab_button "
|
||||||
|
<< convert<string>(single_close_tab_button)
|
||||||
|
<< '\n';
|
||||||
|
}
|
||||||
if (tag != RC_LAST)
|
if (tag != RC_LAST)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -113,6 +113,7 @@ public:
|
|||||||
RC_NOMENCL_COMMAND,
|
RC_NOMENCL_COMMAND,
|
||||||
RC_NUMLASTFILES,
|
RC_NUMLASTFILES,
|
||||||
RC_OPEN_BUFFERS_IN_TABS,
|
RC_OPEN_BUFFERS_IN_TABS,
|
||||||
|
RC_SINGLE_CLOSE_TAB_BUTTON,
|
||||||
RC_PARAGRAPH_MARKERS,
|
RC_PARAGRAPH_MARKERS,
|
||||||
RC_PATH_PREFIX,
|
RC_PATH_PREFIX,
|
||||||
RC_PERS_DICT,
|
RC_PERS_DICT,
|
||||||
@ -478,6 +479,8 @@ public:
|
|||||||
bool completion_popup_after_complete;
|
bool completion_popup_after_complete;
|
||||||
///
|
///
|
||||||
bool open_buffers_in_tabs;
|
bool open_buffers_in_tabs;
|
||||||
|
///
|
||||||
|
bool single_close_tab_button;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -2154,6 +2154,11 @@ PrefUserInterface::PrefUserInterface(GuiPreferences * form)
|
|||||||
TextLabel1, SLOT(setEnabled(bool)));
|
TextLabel1, SLOT(setEnabled(bool)));
|
||||||
connect(openDocumentsInTabsCB, SIGNAL(clicked()),
|
connect(openDocumentsInTabsCB, SIGNAL(clicked()),
|
||||||
this, SIGNAL(changed()));
|
this, SIGNAL(changed()));
|
||||||
|
#if QT_VERSION < 0x040500
|
||||||
|
openDocumentsInTabsCB.setEnabled(false);
|
||||||
|
#endif
|
||||||
|
connect(singleCloseTabButtonCB, SIGNAL(clicked()),
|
||||||
|
this, SIGNAL(changed()));
|
||||||
connect(uiFilePB, SIGNAL(clicked()),
|
connect(uiFilePB, SIGNAL(clicked()),
|
||||||
this, SLOT(selectUi()));
|
this, SLOT(selectUi()));
|
||||||
connect(uiFileED, SIGNAL(textChanged(QString)),
|
connect(uiFileED, SIGNAL(textChanged(QString)),
|
||||||
@ -2189,6 +2194,10 @@ void PrefUserInterface::apply(LyXRC & rc) const
|
|||||||
rc.num_lastfiles = lastfilesSB->value();
|
rc.num_lastfiles = lastfilesSB->value();
|
||||||
rc.use_tooltip = tooltipCB->isChecked();
|
rc.use_tooltip = tooltipCB->isChecked();
|
||||||
rc.open_buffers_in_tabs = openDocumentsInTabsCB->isChecked();
|
rc.open_buffers_in_tabs = openDocumentsInTabsCB->isChecked();
|
||||||
|
rc.single_close_tab_button = singleCloseTabButtonCB->isChecked();
|
||||||
|
#if QT_VERSION < 0x040500
|
||||||
|
rc.single_close_tab_button = true;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2210,6 +2219,7 @@ void PrefUserInterface::update(LyXRC const & rc)
|
|||||||
lastfilesSB->setValue(rc.num_lastfiles);
|
lastfilesSB->setValue(rc.num_lastfiles);
|
||||||
tooltipCB->setChecked(rc.use_tooltip);
|
tooltipCB->setChecked(rc.use_tooltip);
|
||||||
openDocumentsInTabsCB->setChecked(rc.open_buffers_in_tabs);
|
openDocumentsInTabsCB->setChecked(rc.open_buffers_in_tabs);
|
||||||
|
singleCloseTabButtonCB->setChecked(rc.single_close_tab_button);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1319,6 +1319,9 @@ TabWorkArea::TabWorkArea(QWidget * parent)
|
|||||||
#ifdef Q_WS_MACX
|
#ifdef Q_WS_MACX
|
||||||
setStyle(&noTabFrameMacStyle);
|
setStyle(&noTabFrameMacStyle);
|
||||||
#endif
|
#endif
|
||||||
|
#if QT_VERSION < 0x040500
|
||||||
|
lyxrc.single_close_tab_button = true;
|
||||||
|
#endif
|
||||||
|
|
||||||
QPalette pal = palette();
|
QPalette pal = palette();
|
||||||
pal.setColor(QPalette::Active, QPalette::Button,
|
pal.setColor(QPalette::Active, QPalette::Button,
|
||||||
@ -1331,7 +1334,6 @@ TabWorkArea::TabWorkArea(QWidget * parent)
|
|||||||
QObject::connect(this, SIGNAL(currentChanged(int)),
|
QObject::connect(this, SIGNAL(currentChanged(int)),
|
||||||
this, SLOT(on_currentTabChanged(int)));
|
this, SLOT(on_currentTabChanged(int)));
|
||||||
|
|
||||||
#if QT_VERSION < 0x040500
|
|
||||||
closeBufferButton = new QToolButton(this);
|
closeBufferButton = new QToolButton(this);
|
||||||
closeBufferButton->setPalette(pal);
|
closeBufferButton->setPalette(pal);
|
||||||
// FIXME: rename the icon to closebuffer.png
|
// FIXME: rename the icon to closebuffer.png
|
||||||
@ -1344,7 +1346,6 @@ TabWorkArea::TabWorkArea(QWidget * parent)
|
|||||||
QObject::connect(closeBufferButton, SIGNAL(clicked()),
|
QObject::connect(closeBufferButton, SIGNAL(clicked()),
|
||||||
this, SLOT(closeCurrentBuffer()));
|
this, SLOT(closeCurrentBuffer()));
|
||||||
setCornerWidget(closeBufferButton, Qt::TopRightCorner);
|
setCornerWidget(closeBufferButton, Qt::TopRightCorner);
|
||||||
#endif
|
|
||||||
|
|
||||||
// setup drag'n'drop
|
// setup drag'n'drop
|
||||||
QTabBar* tb = new DragTabBar;
|
QTabBar* tb = new DragTabBar;
|
||||||
@ -1382,9 +1383,8 @@ void TabWorkArea::showBar(bool show)
|
|||||||
{
|
{
|
||||||
tabBar()->setEnabled(show);
|
tabBar()->setEnabled(show);
|
||||||
tabBar()->setVisible(show);
|
tabBar()->setVisible(show);
|
||||||
#if QT_VERSION < 0x040500
|
closeBufferButton->setVisible(show && lyxrc.single_close_tab_button);
|
||||||
closeBufferButton->setVisible(show);
|
setTabsClosable(!lyxrc.single_close_tab_button);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1773,7 +1773,7 @@ DragTabBar::DragTabBar(QWidget* parent)
|
|||||||
{
|
{
|
||||||
setAcceptDrops(true);
|
setAcceptDrops(true);
|
||||||
#if QT_VERSION >= 0x040500
|
#if QT_VERSION >= 0x040500
|
||||||
setTabsClosable(true);
|
setTabsClosable(!lyxrc.single_close_tab_button);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -336,10 +336,8 @@ private Q_SLOTS:
|
|||||||
private:
|
private:
|
||||||
///
|
///
|
||||||
int clicked_tab_;
|
int clicked_tab_;
|
||||||
#if QT_VERSION < 0x040500
|
|
||||||
///
|
///
|
||||||
QToolButton * closeBufferButton;
|
QToolButton * closeBufferButton;
|
||||||
#endif
|
|
||||||
}; // TabWorkArea
|
}; // TabWorkArea
|
||||||
|
|
||||||
|
|
||||||
|
@ -185,6 +185,16 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="5" column="0" >
|
||||||
|
<widget class="QCheckBox" name="singleCloseTabButtonCB" >
|
||||||
|
<property name="toolTip" >
|
||||||
|
<string>Whether to place close button on each tab or only one in the top left.</string>
|
||||||
|
</property>
|
||||||
|
<property name="text" >
|
||||||
|
<string>&Single close-tab button</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
Loading…
Reference in New Issue
Block a user