make bullet configuration functional in the document settings dialog

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14647 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Edwin Leuven 2006-08-13 15:44:05 +00:00
parent f402dcb0bd
commit 1a08a29b0f
6 changed files with 383 additions and 1498 deletions

View File

@ -4,7 +4,6 @@
* Licence details can be found in the file COPYING.
*
* \author Edwin Leuven
* \author John Levon
*
* Full author contact details are available in file CREDITS.
*/
@ -12,15 +11,10 @@
#include <config.h>
#include "BulletsModule.h"
// #include "QBrowseBox.h"
#include "qt_helpers.h"
#include "support/filetools.h"
#include <QInputDialog>
#include <QMenu>
#include <QPushButton>
#include <QComboBox>
#include <QPixmap>
#include <boost/assert.hpp>
@ -29,10 +23,7 @@ using lyx::support::libFileSearch;
using std::string;
BulletsModule::BulletsModule(QWidget * /*parent*/,
char const * /*name*/, Qt::WFlags /*fl*/)
: bullet_pressed_(0)
BulletsModule::BulletsModule(QWidget * , char const * , Qt::WFlags)
{
setupUi(this);
@ -40,107 +31,22 @@ BulletsModule::BulletsModule(QWidget * /*parent*/,
bullets_[iter] = ITEMIZE_DEFAULTS[iter];
}
QMenu * pm = new QMenu(this);
// FIXME: Need to verify that this does not leak memory.
/*QMenu * pm1 =*/ new QMenu(pm);
/*QMenu * pm2 =*/ new QMenu(pm);
/*QMenu * pm3 =*/ new QMenu(pm);
/*QMenu * pm4 =*/ new QMenu(pm);
/*QMenu * pm5 =*/ new QMenu(pm);
/*QMenu * pm6 =*/ new QMenu(pm);
// FIXME: We need a Qt4 compatible browsebox type widget
// which can act as a popup to a toolbutton
/*
standard_ = new QBrowseBox(6, 6, pm1);
maths_ = new QBrowseBox(6, 6, pm2);
ding1_ = new QBrowseBox(6, 6, pm3);
ding2_ = new QBrowseBox(6, 6, pm4);
ding3_ = new QBrowseBox(6, 6, pm5);
ding4_ = new QBrowseBox(6, 6, pm6);
///\todo See how to insert those BrowseBox:
pm1->addMenu((QMenu*) standard_);
pm2->addMenu((QMenu*)maths_);
pm3->addMenu((QMenu*)ding1_);
pm4->addMenu((QMenu*)ding2_);
pm5->addMenu((QMenu*)ding3_);
pm6->addMenu((QMenu*)ding4_);
pm->insertItem(qt_("&Standard"), pm1, 0);
pm->insertItem(qt_("&Maths"), pm2, 1);
pm->insertItem(qt_("Dings &1"), pm3, 2);
pm->insertItem(qt_("Dings &2"), pm4, 3);
pm->insertItem(qt_("Dings &3"), pm5, 4);
pm->insertItem(qt_("Dings &4"), pm6, 5);
pm->insertSeparator();
// FIXME: make this checkable
pm->insertItem(qt_("&Custom..."), this, SLOT(setCustom()), 0, 6);
connect(bullet1PB, SIGNAL(pressed()), this, SLOT(clicked1()));
bullet1PB->setPopup(pm);
connect(bullet2PB, SIGNAL(pressed()), this, SLOT(clicked2()));
bullet2PB->setPopup(pm);
connect(bullet3PB, SIGNAL(pressed()), this, SLOT(clicked3()));
bullet3PB->setPopup(pm);
connect(bullet4PB, SIGNAL(pressed()), this, SLOT(clicked4()));
bullet4PB->setPopup(pm);
// add levels
levelLW->addItem("1");
levelLW->addItem("2");
levelLW->addItem("3");
levelLW->addItem("4");
// insert pixmaps
string bmfile;
bmfile = libFileSearch("images", "standard", "xpm");
standard_->insertItem(QPixmap(toqstr(bmfile)));
setupPanel(new QListWidget(bulletpaneSW), qt_("Standard"), "standard");
setupPanel(new QListWidget(bulletpaneSW), qt_("Maths"), "amssymb");
setupPanel(new QListWidget(bulletpaneSW), qt_("Dings 1"), "psnfss1");
setupPanel(new QListWidget(bulletpaneSW), qt_("Dings 2"), "psnfss2");
setupPanel(new QListWidget(bulletpaneSW), qt_("Dings 3"), "psnfss3");
setupPanel(new QListWidget(bulletpaneSW), qt_("Dings 4"), "psnfss4");
bmfile = libFileSearch("images", "amssymb", "xpm");
maths_->insertItem(QPixmap(toqstr(bmfile)));
bmfile = libFileSearch("images", "psnfss1", "xpm");
ding1_->insertItem(QPixmap(toqstr(bmfile)));
bmfile = libFileSearch("images", "psnfss2", "xpm");
ding2_->insertItem(QPixmap(toqstr(bmfile)));
bmfile = libFileSearch("images", "psnfss3", "xpm");
ding3_->insertItem(QPixmap(toqstr(bmfile)));
bmfile = libFileSearch("images", "psnfss4", "xpm");
ding4_->insertItem(QPixmap(toqstr(bmfile)));
connect(standard_, SIGNAL(selected(int, int)),
this, SLOT(standard(int, int)));
connect(maths_, SIGNAL(selected(int, int)),
this, SLOT(maths(int, int)));
connect(ding1_, SIGNAL(selected(int, int)),
this, SLOT(ding1(int, int)));
connect(ding2_, SIGNAL(selected(int, int)),
this, SLOT(ding2(int, int)));
connect(ding3_, SIGNAL(selected(int, int)),
this, SLOT(ding3(int, int)));
connect(ding4_, SIGNAL(selected(int, int)),
this, SLOT(ding4(int, int)));
connect(bullet1PB, SIGNAL(pressed()), this, SLOT(selected1()));
connect(bullet2PB, SIGNAL(pressed()), this, SLOT(selected2()));
connect(bullet3PB, SIGNAL(pressed()), this, SLOT(selected3()));
connect(bullet4PB, SIGNAL(pressed()), this, SLOT(selected4()));
connect(bulletsize1CO, SIGNAL(activated(int)), this, SLOT(updateSizes()));
connect(bulletsize2CO, SIGNAL(activated(int)), this, SLOT(updateSizes()));
connect(bulletsize3CO, SIGNAL(activated(int)), this, SLOT(updateSizes()));
connect(bulletsize4CO, SIGNAL(activated(int)), this, SLOT(updateSizes()));
// update the view
for (int i = 0; i < 4; ++i)
setBullet(bullet1PB, bulletsize1CO, bullets_[i]);
*/
connect(levelLW, SIGNAL(currentRowChanged(int)), this, SLOT(showLevel(int)));
connect(bulletpaneCO, SIGNAL(activated(int)), bulletpaneSW, SLOT(setCurrentIndex(int)));
}
@ -149,152 +55,144 @@ BulletsModule::~BulletsModule()
}
void BulletsModule::updateSizes()
void BulletsModule::setupPanel(QListWidget * lw, QString panelname, std::string fname)
{
// emit signal
changed();
connect(lw, SIGNAL(currentItemChanged(QListWidgetItem*, QListWidgetItem*)),
this, SLOT(bulletSelected(QListWidgetItem *, QListWidgetItem*)));
// -1 apparently means default...
bullets_[0].setSize(bulletsize1CO->currentItem() - 1);
bullets_[1].setSize(bulletsize2CO->currentItem() - 1);
bullets_[2].setSize(bulletsize3CO->currentItem() - 1);
bullets_[3].setSize(bulletsize4CO->currentItem() - 1);
}
// add panelname to combox
bulletpaneCO->addItem(panelname);
// get pixmap with bullets
QPixmap pixmap = QPixmap(toqstr(libFileSearch("images", fname, "xpm")));
int const w = pixmap.width() / 6;
int const h = pixmap.height() / 6;
// These arrive before the menus are launched.
void BulletsModule::clicked1()
{
bullet_pressed_ = &bullets_[0];
}
// apply setting to listwidget
lw->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
lw->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
lw->setViewMode(QListView::IconMode);
lw->setFlow(QListView::LeftToRight);
lw->setMovement(QListView::Static);
lw->setUniformItemSizes(true);
lw->setGridSize( QSize(w , h) );
lw->resize( 6 * w + 6 , 6* h);
bulletpaneSW->setMinimumSize( 6 * w + 6 , 6 * h);
void BulletsModule::clicked2()
{
bullet_pressed_ = &bullets_[1];
}
void BulletsModule::clicked3()
{
bullet_pressed_ = &bullets_[2];
}
void BulletsModule::clicked4()
{
bullet_pressed_ = &bullets_[3];
}
// These arrive *after* the menus have done their work
void BulletsModule::selected1()
{
if (!tmpbulletset)
return;
tmpbulletset = false;
bullets_[0] = tmpbullet;
setBullet(bullet1PB, bulletsize1CO, bullets_[0]);
// emit signal
changed();
}
void BulletsModule::selected2()
{
if (!tmpbulletset)
return;
tmpbulletset = false;
bullets_[1] = tmpbullet;
setBullet(bullet2PB, bulletsize2CO, bullets_[1]);
// emit signal
changed();
}
void BulletsModule::selected3()
{
if (!tmpbulletset)
return;
tmpbulletset = false;
bullets_[2] = tmpbullet;
setBullet(bullet3PB, bulletsize3CO, bullets_[2]);
// emit signal
changed();
}
void BulletsModule::selected4()
{
if (!tmpbulletset)
return;
tmpbulletset = false;
bullets_[3] = tmpbullet;
setBullet(bullet4PB, bulletsize4CO, bullets_[3]);
// emit signal
changed();
}
QPixmap BulletsModule::getPixmap(int /*font*/, int /*character*/)
{
//int col = character % 6;
//int row = (character - col) / 6;
/* switch (font) {
case 0:
return standard_->pixmap(row,col);
case 1:
return maths_->pixmap(row,col);
case 2:
return ding1_->pixmap(row,col);
case 3:
return ding2_->pixmap(row,col);
case 4:
return ding3_->pixmap(row,col);
case 5:
return ding4_->pixmap(row,col);
default:
return standard_->pixmap(row,col);
}*/
// make qt4 frontend at least compilable now.
return QPixmap();
}
void BulletsModule::setBullet(QPushButton * pb, QComboBox * co, Bullet const & b)
{
if (b.getFont() == -1) {
pb->setPixmap(QPixmap());
pb->setText(toqstr(b.getText()));
} else {
pb->setPixmap(getPixmap(b.getFont(), b.getCharacter()));
// get individual bullets from pixmap
for (int row = 0; row < 6; ++row) {
for (int col = 0; col < 6; ++col) {
QPixmap small(w,h);
// FIXME: how to get the good color?
small.fill(QColor(Qt::white));
bitBlt(&small, 0, 0, &pixmap, col * w, row * h, w, h);
new QListWidgetItem(QIcon(small), "" , lw, (6*row + col));
}
}
pb->setMinimumSize(QSize(50, 50));
co->setCurrentItem(b.getSize() + 1);
// add bulletpanel to stackedwidget
bulletpaneSW->addWidget(lw);
}
void BulletsModule::setBullet(int level, const Bullet & bullet)
void BulletsModule::showLevel(int level)
{
unselectPreviousItem();
current_font_ = bullets_[level].getFont();
if (bullets_[level].getFont()<0) {
customCB->setCheckState(Qt::Checked);
customLE->setText(toqstr(bullets_[level].getText()));
} else {
selectBullet(level);
customCB->setCheckState(Qt::Unchecked);
customLE->clear();
bulletpaneCO->setCurrentIndex(current_font_);
bulletpaneSW->setCurrentIndex(current_font_);
}
bulletsizeCO->setCurrentIndex(bullets_[level].getSize() + 1);
}
void BulletsModule::selectBullet(int level)
{
int const bullet = bullets_[level].getCharacter();
QListWidget * lw = static_cast<QListWidget *>(bulletpaneSW->widget(current_font_));
// get all items (FIXME: is there a better way? this looks too complicated)
QList<QListWidgetItem *> items = lw->findItems("", Qt::MatchContains);
for (int i = 0 ; i < items.size() ; ++i) {
if (items.at(i)->type() == bullet) {
current_item_ = items.at(i);
lw->setItemSelected(current_item_, true);
}
}
}
void BulletsModule::init()
{
levelLW->setCurrentRow(0);
showLevel(0);
}
void BulletsModule::bulletSelected(QListWidgetItem * item, QListWidgetItem *)
{
unselectPreviousItem();
int const level = levelLW->currentRow();
bullets_[level].setCharacter(item->type());
bullets_[level].setFont(bulletpaneCO->currentIndex());
current_font_ = bulletpaneCO->currentIndex();
current_item_ = item;
changed();
}
void BulletsModule::unselectPreviousItem()
{
if (current_font_<0)
return;
QListWidget * lw = static_cast<QListWidget *>(bulletpaneSW->widget(current_font_));
lw->setItemSelected(current_item_, false);
}
void BulletsModule::on_customCB_toggled(bool custom)
{
if (!custom) {
if (current_font_<0)
current_font_ = bulletpaneCO->currentIndex();
return;
}
unselectPreviousItem();
current_font_ = -1;
changed();
}
void BulletsModule::on_customLE_textEdited(const QString & text)
{
if (customCB->checkState() == Qt::Unchecked)
return;
bullets_[levelLW->currentRow()].setFont(current_font_);
bullets_[levelLW->currentRow()].setText(fromqstr(text));
changed();
}
void BulletsModule::on_bulletsizeCO_activated(int size)
{
// -1 apparently means default...
bullets_[levelLW->currentRow()].setSize(size - 1);
}
void BulletsModule::setBullet(int level, Bullet const & bullet)
{
bullets_[level] = bullet;
// FIXME: backout until we fixed the browsebox
return;
QPushButton * pb = 0;
QComboBox * co = 0;
switch (level) {
case 0: pb = bullet1PB; co = bulletsize1CO; break;
case 1: pb = bullet2PB; co = bulletsize2CO; break;
case 2: pb = bullet3PB; co = bulletsize3CO; break;
case 3: pb = bullet4PB; co = bulletsize4CO; break;
default: BOOST_ASSERT(false); break;
}
setBullet(pb, co, bullet);
}
@ -304,68 +202,4 @@ Bullet const & BulletsModule::getBullet(int level) const
}
void BulletsModule::setCurrentBullet(int font, int character)
{
tmpbulletset = true;
tmpbullet.setFont(font);
tmpbullet.setCharacter(character);
}
void BulletsModule::standard(int row, int col)
{
setCurrentBullet(0, 6 * row + col);
}
void BulletsModule::maths(int row, int col)
{
setCurrentBullet(1, 6 * row + col);
}
void BulletsModule::ding1(int row, int col)
{
setCurrentBullet(2, 6 * row + col);
}
void BulletsModule::ding2(int row, int col)
{
setCurrentBullet(3, 6 * row + col);
}
void BulletsModule::ding3(int row, int col)
{
setCurrentBullet(4, 6 * row + col);
}
void BulletsModule::ding4(int row, int col)
{
setCurrentBullet(5, 6 * row + col);
}
void BulletsModule::setCustom()
{
QString const input = bullet_pressed_ ?
toqstr(bullet_pressed_->getText()) : QString::null;
bool ok = false;
QString text = QInputDialog::getText(
qt_( "Bullets" ),
qt_( "Enter a custom bullet" ),
QLineEdit::Normal,
input, &ok, this );
if (!ok)
return;
tmpbulletset = true;
tmpbullet.setText(fromqstr(text));
tmpbullet.setFont(-1);
}
#include "BulletsModule_moc.cpp"

View File

@ -19,11 +19,6 @@
#include <QWidget>
// class QBrowseBox;
class QPushButton;
class QComboBox;
class QPixmap;
class BulletsModule : public QWidget, public Ui::BulletsUi {
Q_OBJECT
public:
@ -33,61 +28,32 @@ public:
~BulletsModule();
/// set a bullet
void setBullet(int level, const Bullet & bullet);
void setBullet(int level, Bullet const & bullet);
/// get bullet setting
Bullet const & getBullet(int level) const;
/// update 1st level
void init();
Q_SIGNALS:
void changed();
protected Q_SLOTS:
/// menu callbacks
void standard(int row, int col);
void maths(int row, int col);
void ding1(int row, int col);
void ding2(int row, int col);
void ding3(int row, int col);
void ding4(int row, int col);
void updateSizes();
void clicked1();
void clicked2();
void clicked3();
void clicked4();
void selected1();
void selected2();
void selected3();
void selected4();
/// set custom (text) bullet
void setCustom();
void on_bulletsizeCO_activated(int level);
void on_customCB_toggled(bool);
void on_customLE_textEdited(const QString &);
void bulletSelected(QListWidgetItem *, QListWidgetItem*);
void showLevel(int);
private:
QPixmap getPixmap(int font, int character);
/// update GUI view
void setBullet(QPushButton * pb, QComboBox * co, Bullet const & b);
/// set from menu
void setCurrentBullet(int font, int character);
bool tmpbulletset;
Bullet tmpbullet;
void unselectPreviousItem();
void setupPanel(QListWidget * lw, QString panelname, std::string fname);
void selectBullet(int level);
/// store results
boost::array<Bullet, 4> bullets_;
/* QBrowseBox * standard_;
QBrowseBox * maths_;
QBrowseBox * ding1_;
QBrowseBox * ding2_;
QBrowseBox * ding3_;
QBrowseBox * ding4_;*/
Bullet * bullet_pressed_;
int current_font_;
QListWidgetItem * current_item_;
};
#endif // BULLETSMODULE_H

View File

@ -1,308 +0,0 @@
/**
* \file QBrowseBox.C
*
* Original file taken from klyx 0.10 sources:
*
* \author Kalle Dalheimer
*
* Full author contact details are available in file CREDITS.
*/
#include <config.h>
#include "QBrowseBox.h"
#include <QPixmap>
#include <QPainter>
#include <QApplication>
#include <qdrawutil.h>
#include <QStyle>
#include <QMouseEvent>
#include <QFrame>
#include <QKeyEvent>
#include <QCloseEvent>
#include <QDesktopWidget>
#include <cmath>
QBrowseBox::QBrowseBox(int rows, int cols, QWidget* parent, const char * name, Qt::WFlags f)
: Q3GridView(parent,name,f)
{
setNumRows(rows);
setNumCols(cols);
pixmaps_ = new QPixmap[rows * cols];
activecell_.setX(-1);
activecell_.setY(-1);
setFrameStyle(QFrame::WinPanel | QFrame::Raised);
setVScrollBarMode(Q3ScrollView::AlwaysOff);
setHScrollBarMode(Q3ScrollView::AlwaysOff);
viewport()->setFocusPolicy(Qt::StrongFocus);
// setMouseTracking must be called after setFocusPolicy
viewport()->setMouseTracking(true);
inloop=false;
}
QBrowseBox::~QBrowseBox()
{
delete [] pixmaps_;
}
int QBrowseBox::coordsToIndex(int row, int col)
{
if (col < 0 || col > numCols() || row < 0 || row > numRows())
qDebug("coordsToIndex: invalid coords (%d, %d)\n", row, col);
return row + col * numCols();
}
void QBrowseBox::insertItem(QPixmap pixmap, int row, int col)
{
pixmaps_[coordsToIndex(row, col)] = pixmap;
}
void QBrowseBox::insertItem(QPixmap pixmap)
{
int w = pixmap.width() / numCols();
int h = pixmap.height() / numRows();
for (int row = 0; row < numRows(); ++row) {
for (int col = 0; col < numCols(); ++col) {
QPixmap small(w,h);
small.fill(backgroundColor());
bitBlt(&small, 0, 0, &pixmap, col * w, row * h,
w, h);
insertItem(small, row, col);
}
}
setCellWidth(pixmap.width() / numCols());
setCellHeight(pixmap.height() / numRows());
setMinimumWidth(pixmap.width() + (numCols() + 1) * 1);
setMinimumHeight(pixmap.height() + (numRows() + 1) * 1);
resize(minimumSize());
}
QPixmap QBrowseBox::pixmap(int row, int col)
{
if (col < 0 || col >= numCols() || row < 0 || row >= numRows())
return QPixmap();
return pixmaps_[coordsToIndex(row, col)];
}
int QBrowseBox::exec(const QPoint & pos)
{
return exec(pos.x(),pos.y());
}
int QBrowseBox::exec(const QWidget * trigger)
{
QPoint globalpos = trigger->parentWidget()->mapToGlobal( trigger->pos());
// is there enough space to put the box below the trigger?
if ( globalpos.y() + trigger->height()+height()+1<
QApplication::desktop()->height()) {
// is there enough space to set the box left-justified with the trigger
if (globalpos.x()+width()<QApplication::desktop()->width())
return exec(globalpos.x(),
globalpos.y()+trigger->height()+1);
else
return exec(globalpos.x()-width()-1,
globalpos.y()+trigger->height()+1);
} else {
if (globalpos.x()+width()<QApplication::desktop()->width())
return exec(globalpos.x(),
globalpos.y()-height()-1);
else
return exec(globalpos.x()-width()-1,
globalpos.y()-height()-1);
}
}
int QBrowseBox::exec(int x,int y)
{
firstrelease_ = true;
move(x,y);
show();
update();
qApp->enter_loop();
inloop = true;
if (activecell_.x()!=-1 && activecell_.y()!=-1 )
return coordsToIndex( activecell_.x(),activecell_.y());
else
return -1;
}
void QBrowseBox::keyPressEvent(QKeyEvent * e)
{
switch(e->key()) {
case Qt::Key_Up:
moveUp();
break;
case Qt::Key_Down:
moveDown();
break;
case Qt::Key_Left:
moveLeft();
break;
case Qt::Key_Right:
moveRight();
break;
case Qt::Key_Return:
emit selected(activecell_.x(), activecell_.y());
if ( isVisible() && parentWidget() &&
parentWidget()->inherits("QPopupMenu") )
parentWidget()->close();
else
close();
break;
case Qt::Key_Escape:
if (inloop)
qApp->exit_loop();
if ( isVisible() && parentWidget() &&
parentWidget()->inherits("QPopupMenu") )
parentWidget()->close();
default:
e->ignore();
}
}
void QBrowseBox::contentsMouseReleaseEvent(QMouseEvent *)
{
if (firstrelease_)
firstrelease_ = false;
else {
emit selected( activecell_.x(), activecell_.y());
if ( isVisible() && parentWidget() &&
parentWidget()->inherits("QPopupMenu") )
parentWidget()->close();
}
}
void QBrowseBox::closeEvent(QCloseEvent * e)
{
e->accept();
qApp->exit_loop();
}
void QBrowseBox::paintCell(QPainter * painter, int row, int col)
{
painter->setClipRect(cellGeometry(row, col));
int const index = coordsToIndex(row, col);
painter->drawPixmap(0, 0, pixmaps_[index]);
if (activecell_.x() == row && activecell_.y() == col) {
qDrawShadeRect(painter, 0, 0, cellWidth(),
cellHeight(), colorGroup(), false, 1);
} else {
qDrawPlainRect(painter, 0, 0, cellWidth(),
cellHeight(), colorGroup().background(), 1);
}
painter->setClipping(false);
}
void QBrowseBox::contentsMouseMoveEvent(QMouseEvent * e)
{
int x = e->pos().x();
int y = e->pos().y();
int cellx;
int celly;
if (x < 0 || y < 0 || x > width() || y > height()) {
// outside the box
cellx = -1;
celly = -1;
} else {
celly = (int)floor( ((double)x) / ((double)cellWidth()) );
cellx = (int)floor( ((double)y) / ((double)cellHeight()) );
}
if (activecell_.x() != cellx || activecell_.y() != celly) {
// mouse has been moved to another cell
int oldactivecellx = activecell_.x();
int oldactivecelly = activecell_.y();
activecell_.setX(cellx);
activecell_.setY(celly);
// remove old highlighting
updateCell(oldactivecellx, oldactivecelly);
// set new highlighting
updateCell(activecell_.x(), activecell_.y());
}
}
void QBrowseBox::moveLeft()
{
int const y = activecell_.y();
if (y>0)
activecell_.setY(y - 1);
else if (parentWidget())
QWidget::focusNextPrevChild(false);
updateCell(activecell_.x(), y);
updateCell(activecell_.x(), activecell_.y());
}
void QBrowseBox::moveRight()
{
int const y = activecell_.y();
if (y < numCols() - 1)
activecell_.setY(y+1);
updateCell(activecell_.x(), y);
updateCell(activecell_.x(), activecell_.y());
}
void QBrowseBox::moveUp()
{
int const x = activecell_.x();
if (x > 0)
activecell_.setX(x - 1);
else if (parentWidget())
QWidget::focusNextPrevChild(false);
updateCell(x, activecell_.y());
updateCell(activecell_.x(), activecell_.y());
}
void QBrowseBox::moveDown()
{
int const x = activecell_.x();
if (x < numRows() - 1)
activecell_.setX(x + 1);
updateCell(x, activecell_.y());
updateCell(activecell_.x(), activecell_.y());
}

View File

@ -1,71 +0,0 @@
// -*- C++ -*-
/**
* \file QBrowseBox.h
*
* Original file taken from klyx 0.10 sources:
*
* \author Kalle Dalheimer
*
* Full author contact details are available in file CREDITS.
*/
#ifndef QBROWSEBOX_H
#define QBROWSEBOX_H
#include <QPixmap>
#include <QMouseEvent>
#include <QKeyEvent>
#include <QCloseEvent>
#include <Q3GridView>
class QString;
class QPainter;
class QPixmap;
class QBrowseBox : public Q3GridView
{
Q_OBJECT
public:
QBrowseBox(int rows, int cols, QWidget * parent = 0, const char * name = 0, Qt::WFlags f = 0);
~QBrowseBox();
void insertItem(QPixmap pixmap);
QPixmap pixmap(int row, int col);
int exec(const QPoint & pos);
int exec(int x, int y);
int exec(const QWidget * trigger);
Q_SIGNALS:
void selected(int, int);
protected:
virtual void keyPressEvent(QKeyEvent * e);
virtual void contentsMouseReleaseEvent(QMouseEvent *);
virtual void closeEvent(QCloseEvent * e);
virtual void contentsMouseMoveEvent(QMouseEvent * e);
virtual void paintCell(QPainter *, int row, int col);
private:
// make sure the automatically generated one is not used
QBrowseBox & operator=(QBrowseBox const &);
void moveLeft();
void moveRight();
void moveUp();
void moveDown();
void insertItem(QPixmap pixmap, int row, int col);
int coordsToIndex(int row, int col);
QPixmap* pixmaps_;
QPoint activecell_;
bool firstrelease_;
bool inloop;
};
#endif

View File

@ -375,20 +375,18 @@ QDocumentDialog::QDocumentDialog(QDocument * form)
connect(branchesModule, SIGNAL(changed()), this, SLOT(change_adaptor()));
preambleModule = new UiWidget<Ui::PreambleUi>;
// preamble
preambleModule = new UiWidget<Ui::PreambleUi>;
connect(preambleModule->preambleTE, SIGNAL(textChanged()), this, SLOT(change_adaptor()));
bulletsModule = new BulletsModule;
// FIXME: disable until we fix browsebox in BulletsModule.[Ch]
bulletsModule->setEnabled(false);
// bullets
bulletsModule = new BulletsModule;
connect(bulletsModule, SIGNAL(changed()), this, SLOT(change_adaptor()));
floatModule = new FloatPlacement;
// float
floatModule = new FloatPlacement;
connect(floatModule, SIGNAL(changed()), this, SLOT(change_adaptor()));
docPS->addPanel(latexModule, _("Document Class"));
@ -970,10 +968,11 @@ void QDocumentDialog::update(BufferParams const & params)
}
// bullets
bulletsModule->setBullet(0,params.user_defined_bullet(0));
bulletsModule->setBullet(1,params.user_defined_bullet(1));
bulletsModule->setBullet(2,params.user_defined_bullet(2));
bulletsModule->setBullet(3,params.user_defined_bullet(3));
bulletsModule->setBullet(0, params.user_defined_bullet(0));
bulletsModule->setBullet(1, params.user_defined_bullet(1));
bulletsModule->setBullet(2, params.user_defined_bullet(2));
bulletsModule->setBullet(3, params.user_defined_bullet(3));
bulletsModule->init();
// packages
QString text = toqstr(params.graphicsDriver);

File diff suppressed because it is too large Load Diff