From f9744033b3f2ebc8fc3de125cf7bf2252b122415 Mon Sep 17 00:00:00 2001 From: Abdelrazak Younes Date: Thu, 21 Feb 2008 12:29:26 +0000 Subject: [PATCH] * TabWorkArea: rename 'close tab' button to 'close buffer' and add a 'close tab' button. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23088 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/qt4/GuiWorkArea.cpp | 32 +++++++++++++++++++++++++------ src/frontends/qt4/GuiWorkArea.h | 2 ++ 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/src/frontends/qt4/GuiWorkArea.cpp b/src/frontends/qt4/GuiWorkArea.cpp index 17edb2f5cf..4a51b6922b 100644 --- a/src/frontends/qt4/GuiWorkArea.cpp +++ b/src/frontends/qt4/GuiWorkArea.cpp @@ -1036,21 +1036,35 @@ TabWorkArea::TabWorkArea(QWidget * parent) : QTabWidget(parent) pal.setColor(QPalette::Inactive, QPalette::Button, pal.color(QPalette::Inactive, QPalette::Window)); + QObject::connect(this, SIGNAL(currentChanged(int)), + this, SLOT(on_currentTabChanged(int))); + + QToolButton * closeBufferButton = new QToolButton(this); + closeBufferButton->setPalette(pal); + // FIXME: rename the icon to closebuffer.png + closeBufferButton->setIcon(QIcon(":/images/closetab.png")); + closeBufferButton->setText("Close Buffer"); + closeBufferButton->setAutoRaise(true); + closeBufferButton->setCursor(Qt::ArrowCursor); + closeBufferButton->setToolTip(tr("Close Buffer")); + closeBufferButton->setEnabled(true); + QObject::connect(closeBufferButton, SIGNAL(clicked()), + this, SLOT(closeCurrentBuffer())); + setCornerWidget(closeBufferButton, Qt::TopRightCorner); + QToolButton * closeTabButton = new QToolButton(this); closeTabButton->setPalette(pal); + // FIXME: we need another icon for this. closeTabButton->setIcon(QIcon(":/images/closetab.png")); - closeTabButton->setText("Close"); + closeTabButton->setText("Minimize Buffer"); closeTabButton->setAutoRaise(true); closeTabButton->setCursor(Qt::ArrowCursor); closeTabButton->setToolTip(tr("Close tab")); closeTabButton->setEnabled(true); - - QObject::connect(this, SIGNAL(currentChanged(int)), - this, SLOT(on_currentTabChanged(int))); QObject::connect(closeTabButton, SIGNAL(clicked()), this, SLOT(closeCurrentTab())); + setCornerWidget(closeTabButton, Qt::TopLeftCorner); - setCornerWidget(closeTabButton); setUsesScrollButtons(true); } @@ -1182,12 +1196,18 @@ void TabWorkArea::on_currentTabChanged(int i) } -void TabWorkArea::closeCurrentTab() +void TabWorkArea::closeCurrentBuffer() { lyx::dispatch(FuncRequest(LFUN_BUFFER_CLOSE)); } +void TabWorkArea::closeCurrentTab() +{ + removeWorkArea(currentWorkArea()); +} + + void TabWorkArea::updateTabText(GuiWorkArea * wa) { int const i = indexOf(wa); diff --git a/src/frontends/qt4/GuiWorkArea.h b/src/frontends/qt4/GuiWorkArea.h index 0da12f8e3c..b528bb478e 100644 --- a/src/frontends/qt4/GuiWorkArea.h +++ b/src/frontends/qt4/GuiWorkArea.h @@ -257,6 +257,8 @@ public Q_SLOTS: /// void on_currentTabChanged(int index); /// + void closeCurrentBuffer(); + /// void closeCurrentTab(); /// void updateTabText(GuiWorkArea *);