Ed's Qt2 Character dialog.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1671 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Angus Leeming 2001-03-05 12:04:43 +00:00
parent cf1ce89d7c
commit 5126985133
10 changed files with 1404 additions and 3 deletions

View File

@ -4,4 +4,4 @@ Makefile
*.lo
.libs
libqt2.la
*moc.C
moc_*.C

View File

@ -0,0 +1,102 @@
/**
* \file FormCharacter.C
* Copyright 2001 The LyX Team.
* See the file COPYING.
*
* \author Edwin Leuven, leuven@fee.uva.nl
*/
#include <config.h>
#include "chardlgimpl.h"
#include "FormCharacter.h"
#include "bufferview_funcs.h"
#include "Dialogs.h"
#include "Liason.h"
#include "QtLyXView.h"
#include "buffer.h"
#include "lyxtext.h"
#include "language.h"
#include "support/lstrings.h"
#ifdef CXX_WORKING_NAMESPACES
using Liason::setMinibuffer;
#endif
FormCharacter::FormCharacter(LyXView *v, Dialogs *d)
: dialog_(0), lv_(v), d_(d), h_(0), u_(0)
{
// let the popup be shown
// This is a permanent connection so we won't bother
// storing a copy because we won't be disconnecting.
d->showLayoutCharacter.connect(slot(this, &FormCharacter::show));
// for LFUN_FREE
d->setUserFreeFont.connect(slot(this, &FormCharacter::apply));
}
FormCharacter::~FormCharacter()
{
delete dialog_;
}
void FormCharacter::apply()
{
if (!lv_->view()->available() || !dialog_)
return;
LyXFont font = dialog_->getChar();
if (dialog_->langItem()==1)
font.setLanguage(lv_->buffer()->params.language);
ToggleAndShow(lv_->view(), font, dialog_->toggleAll());
lv_->view()->setState();
lv_->buffer()->markDirty();
setMinibuffer(lv_, _("Character set"));
}
void FormCharacter::show()
{
if (!dialog_) {
dialog_ = new CharDlgImpl(this, 0, _("Character Options"), false);
// add languages
for (Languages::const_iterator cit = languages.begin();
cit != languages.end(); ++cit) {
const string language = (*cit).second.lang();
dialog_->lang->insertItem( tostr(language).c_str(), -1 );
}
}
if (!dialog_->isVisible()) {
h_ = d_->hideBufferDependent.connect(slot(this, &FormCharacter::hide));
u_ = d_->updateBufferDependent.connect(slot(this, &FormCharacter::update));
}
dialog_->raise();
dialog_->setActiveWindow();
update();
dialog_->show();
}
void FormCharacter::close()
{
h_.disconnect();
u_.disconnect();
}
void FormCharacter::hide()
{
dialog_->hide();
close();
}
void FormCharacter::update(bool)
{
if (!lv_->view()->available())
return;
dialog_->setReadOnly(lv_->buffer()->isReadonly());
}

View File

@ -0,0 +1,64 @@
// -*- C++ -*-
/**
* \file FormCharacter.h
* Copyright 2001 The LyX Team.
* See the file COPYING.
*
* \author Edwin Leuven
*/
#ifndef FORM_CHARACTER_H
#define FORM_CHARACTER_H
#include "DialogBase.h"
class LyXView;
class Dialogs;
class CharDlgImpl;
class FormCharacter : public DialogBase {
public:
///
FormCharacter(LyXView *, Dialogs *);
///
~FormCharacter();
/// Apply changes.
void apply();
/// Close connections.
void close();
private:
/// Show the dialog.
void show();
/// Hide the dialog.
void hide();
/// Update the dialog.
void update(bool switched = false);
/// Real GUI implementation.
CharDlgImpl * dialog_;
/// the LyXView we belong to.
LyXView * lv_;
/** Which Dialogs do we belong to?
* Used so we can get at the signals we have to connect to.
*/
Dialogs * d_;
/// is the buffer readonly?
bool readonly;
/// Hide connection.
Connection h_;
/// Update connection.
Connection u_;
};
#endif

View File

@ -34,7 +34,7 @@ FormCopyrightDialogBase::FormCopyrightDialogBase( QWidget* parent, const char*
FormCopyrightDialogBaseLayout->setMargin( 11 );
TextLabel5 = new QLabel( this, "TextLabel5" );
TextLabel5->setText( tr( "KLyX is Copyright (C) 1995 by Matthias Ettrich,\n1995-2001 by LyX Team" ) );
TextLabel5->setText( tr( "LyX is Copyright (C) 1995 by Matthias Ettrich,\n1995-2001 LyX Team" ) );
TextLabel5->setFrameShape( QLabel::Box );
TextLabel5->setFrameShadow( QLabel::Sunken );
TextLabel5->setMargin( 6 );
@ -51,7 +51,7 @@ FormCopyrightDialogBase::FormCopyrightDialogBase( QWidget* parent, const char*
FormCopyrightDialogBaseLayout->addWidget( TextLabel5_2 );
TextLabel5_2_2 = new QLabel( this, "TextLabel5_2_2" );
TextLabel5_2_2->setText( tr( "KLyX is distributed in the hope that it will be\nuseful, but WITHOUT ANY WARRANTY, \nwithout even the implied warranty of \nMERCHANTABILITY or FITNESS FOR A \nPARTICULAR PURPOSE. See the GNU General \nPublic License for more details.\nYou should have received a copy of the GNU \nGeneral Public License along with this program; \nif not, write to thee Free Software Foundation, Inc., \n675 Mass Ave, Cambridge, MA 02139, USA." ) );
TextLabel5_2_2->setText( tr( "LyX is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA." ) );
TextLabel5_2_2->setFrameShape( QLabel::Box );
TextLabel5_2_2->setFrameShadow( QLabel::Sunken );
TextLabel5_2_2->setMargin( 6 );

255
src/frontends/qt2/chardlg.C Normal file
View File

@ -0,0 +1,255 @@
/****************************************************************************
** Form implementation generated from reading ui file 'chardlg.ui'
**
** Created: Thu Mar 1 12:56:20 2001
** by: The User Interface Compiler (uic)
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/
#include "chardlg.h"
#include <qcheckbox.h>
#include <qcombobox.h>
#include <qgroupbox.h>
#include <qlabel.h>
#include <qpushbutton.h>
#include <qlayout.h>
#include <qvariant.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
/*
* Constructs a CharDlg which is a child of 'parent', with the
* name 'name' and widget flags set to 'f'
*
* The dialog will by default be modeless, unless you set 'modal' to
* TRUE to construct a modal dialog.
*/
CharDlg::CharDlg( QWidget* parent, const char* name, bool modal, WFlags fl )
: QDialog( parent, name, modal, fl )
{
if ( !name )
setName( "CharDlg" );
resize( 341, 249 );
setCaption( tr( "Character" ) );
setSizeGripEnabled( TRUE );
CharDlgLayout = new QGridLayout( this );
CharDlgLayout->setSpacing( 6 );
CharDlgLayout->setMargin( 11 );
sizeGB = new QGroupBox( this, "sizeGB" );
sizeGB->setTitle( tr( "Never toggled" ) );
sizeGB->setColumnLayout(0, Qt::Vertical );
sizeGB->layout()->setSpacing( 0 );
sizeGB->layout()->setMargin( 0 );
sizeGBLayout = new QHBoxLayout( sizeGB->layout() );
sizeGBLayout->setAlignment( Qt::AlignTop );
sizeGBLayout->setSpacing( 6 );
sizeGBLayout->setMargin( 11 );
sizeL = new QLabel( sizeGB, "sizeL" );
sizeL->setText( tr( "Size:" ) );
sizeGBLayout->addWidget( sizeL );
size = new QComboBox( FALSE, sizeGB, "size" );
size->insertItem( tr( "No Change" ) );
size->insertItem( tr( "Reset" ) );
size->insertItem( tr( "Tiny" ) );
size->insertItem( tr( "Smallest" ) );
size->insertItem( tr( "Smaller" ) );
size->insertItem( tr( "Small" ) );
size->insertItem( tr( "Normal" ) );
size->insertItem( tr( "Large" ) );
size->insertItem( tr( "Larger" ) );
size->insertItem( tr( "Largest" ) );
size->insertItem( tr( "Huge" ) );
size->insertItem( tr( "Huger" ) );
size->insertItem( tr( "Increase" ) );
size->insertItem( tr( "Decrease" ) );
sizeGBLayout->addWidget( size );
CharDlgLayout->addWidget( sizeGB, 0, 1 );
miscGB = new QGroupBox( this, "miscGB" );
miscGB->setTitle( tr( "Always toggled" ) );
miscGB->setColumnLayout(0, Qt::Vertical );
miscGB->layout()->setSpacing( 0 );
miscGB->layout()->setMargin( 0 );
miscGBLayout = new QHBoxLayout( miscGB->layout() );
miscGBLayout->setAlignment( Qt::AlignTop );
miscGBLayout->setSpacing( 6 );
miscGBLayout->setMargin( 11 );
always_toggledL = new QLabel( miscGB, "always_toggledL" );
always_toggledL->setText( tr( "Misc:" ) );
miscGBLayout->addWidget( always_toggledL );
misc = new QComboBox( FALSE, miscGB, "misc" );
misc->insertItem( tr( "No Change" ) );
misc->insertItem( tr( "Reset" ) );
misc->insertItem( tr( "Emph" ) );
misc->insertItem( tr( "Underbar" ) );
misc->insertItem( tr( "Noun" ) );
misc->insertItem( tr( "LaTeX Mode" ) );
miscGBLayout->addWidget( misc );
CharDlgLayout->addWidget( miscGB, 1, 1 );
charGB = new QGroupBox( this, "charGB" );
charGB->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, charGB->sizePolicy().hasHeightForWidth() ) );
charGB->setTitle( tr( "Character" ) );
charGB->setColumnLayout(0, Qt::Vertical );
charGB->layout()->setSpacing( 0 );
charGB->layout()->setMargin( 0 );
charGBLayout = new QGridLayout( charGB->layout() );
charGBLayout->setAlignment( Qt::AlignTop );
charGBLayout->setSpacing( 6 );
charGBLayout->setMargin( 11 );
familyL = new QLabel( charGB, "familyL" );
familyL->setText( tr( "Family:" ) );
charGBLayout->addWidget( familyL, 0, 0 );
family = new QComboBox( FALSE, charGB, "family" );
family->insertItem( tr( "No Change" ) );
family->insertItem( tr( "Reset" ) );
family->insertItem( tr( "Roman" ) );
family->insertItem( tr( "Sans Serif" ) );
family->insertItem( tr( "Typewriter" ) );
charGBLayout->addWidget( family, 0, 1 );
seriesL = new QLabel( charGB, "seriesL" );
seriesL->setText( tr( "Series:" ) );
charGBLayout->addWidget( seriesL, 1, 0 );
langL = new QLabel( charGB, "langL" );
langL->setText( tr( "Language:" ) );
charGBLayout->addWidget( langL, 4, 0 );
shape = new QComboBox( FALSE, charGB, "shape" );
shape->insertItem( tr( "No Change" ) );
shape->insertItem( tr( "Reset" ) );
shape->insertItem( tr( "Upright" ) );
shape->insertItem( tr( "Italic" ) );
shape->insertItem( tr( "Slanted" ) );
shape->insertItem( tr( "Small Caps" ) );
charGBLayout->addWidget( shape, 2, 1 );
color = new QComboBox( FALSE, charGB, "color" );
color->insertItem( tr( "No Change" ) );
color->insertItem( tr( "Reset" ) );
color->insertItem( tr( "No Color" ) );
color->insertItem( tr( "Black" ) );
color->insertItem( tr( "White" ) );
color->insertItem( tr( "Red" ) );
color->insertItem( tr( "Green" ) );
color->insertItem( tr( "Blue" ) );
color->insertItem( tr( "Cyan" ) );
color->insertItem( tr( "Yellow" ) );
color->insertItem( tr( "Magenta" ) );
charGBLayout->addWidget( color, 3, 1 );
shapeL = new QLabel( charGB, "shapeL" );
shapeL->setText( tr( "Shape:" ) );
charGBLayout->addWidget( shapeL, 2, 0 );
series = new QComboBox( FALSE, charGB, "series" );
series->insertItem( tr( "No Change" ) );
series->insertItem( tr( "Reset" ) );
series->insertItem( tr( "Medium" ) );
series->insertItem( tr( "Bold" ) );
charGBLayout->addWidget( series, 1, 1 );
colorL = new QLabel( charGB, "colorL" );
colorL->setEnabled( TRUE );
colorL->setText( tr( "Color:" ) );
charGBLayout->addWidget( colorL, 3, 0 );
lang = new QComboBox( FALSE, charGB, "lang" );
lang->insertItem( tr( "No Change" ) );
lang->insertItem( tr( "Reset" ) );
charGBLayout->addWidget( lang, 4, 1 );
toggleall = new QCheckBox( charGB, "toggleall" );
toggleall->setText( tr( "Toggle all" ) );
charGBLayout->addWidget( toggleall, 5, 1 );
QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding );
charGBLayout->addItem( spacer, 6, 1 );
CharDlgLayout->addMultiCellWidget( charGB, 0, 2, 0, 0 );
QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding );
CharDlgLayout->addItem( spacer_2, 2, 1 );
Layout9 = new QHBoxLayout;
Layout9->setSpacing( 6 );
Layout9->setMargin( 0 );
QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
Layout9->addItem( spacer_3 );
applyPB = new QPushButton( this, "applyPB" );
applyPB->setText( tr( "&Apply" ) );
Layout9->addWidget( applyPB );
okPB = new QPushButton( this, "okPB" );
okPB->setText( tr( "&OK" ) );
Layout9->addWidget( okPB );
cancelPB = new QPushButton( this, "cancelPB" );
cancelPB->setText( tr( "&Cancel" ) );
cancelPB->setDefault( TRUE );
Layout9->addWidget( cancelPB );
CharDlgLayout->addMultiCellLayout( Layout9, 3, 3, 0, 1 );
// signals and slots connections
connect( cancelPB, SIGNAL( clicked() ), this, SLOT( cancel_adaptor() ) );
connect( okPB, SIGNAL( clicked() ), this, SLOT( close_adaptor() ) );
connect( applyPB, SIGNAL( clicked() ), this, SLOT( apply_adaptor() ) );
// tab order
setTabOrder( family, series );
setTabOrder( series, shape );
setTabOrder( shape, color );
setTabOrder( color, lang );
setTabOrder( lang, toggleall );
setTabOrder( toggleall, size );
setTabOrder( size, misc );
setTabOrder( misc, applyPB );
setTabOrder( applyPB, okPB );
setTabOrder( okPB, cancelPB );
}
/*
* Destroys the object and frees any allocated resources
*/
CharDlg::~CharDlg()
{
// no need to delete child widgets, Qt does it all for us
}
void CharDlg::apply_adaptor()
{
qWarning( "CharDlg::apply_adaptor(): Not implemented yet!" );
}
void CharDlg::cancel_adaptor()
{
qWarning( "CharDlg::cancel_adaptor(): Not implemented yet!" );
}
void CharDlg::close_adaptor()
{
qWarning( "CharDlg::close_adaptor(): Not implemented yet!" );
}

View File

@ -0,0 +1,66 @@
/****************************************************************************
** Form interface generated from reading ui file 'chardlg.ui'
**
** Created: Thu Mar 1 12:56:14 2001
** by: The User Interface Compiler (uic)
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/
#ifndef CHARDLG_H
#define CHARDLG_H
#include <qvariant.h>
#include <qdialog.h>
class QVBoxLayout;
class QHBoxLayout;
class QGridLayout;
class QCheckBox;
class QComboBox;
class QGroupBox;
class QLabel;
class QPushButton;
class CharDlg : public QDialog
{
Q_OBJECT
public:
CharDlg( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
~CharDlg();
QGroupBox* sizeGB;
QLabel* sizeL;
QComboBox* size;
QGroupBox* miscGB;
QLabel* always_toggledL;
QComboBox* misc;
QGroupBox* charGB;
QLabel* familyL;
QComboBox* family;
QLabel* seriesL;
QLabel* langL;
QComboBox* shape;
QComboBox* color;
QLabel* shapeL;
QComboBox* series;
QLabel* colorL;
QComboBox* lang;
QCheckBox* toggleall;
QPushButton* applyPB;
QPushButton* okPB;
QPushButton* cancelPB;
protected slots:
virtual void apply_adaptor();
virtual void cancel_adaptor();
virtual void close_adaptor();
protected:
QGridLayout* CharDlgLayout;
QHBoxLayout* sizeGBLayout;
QHBoxLayout* miscGBLayout;
QGridLayout* charGBLayout;
QHBoxLayout* Layout9;
};
#endif // CHARDLG_H

View File

@ -0,0 +1,704 @@
<!DOCTYPE UI><UI>
<class>CharDlg</class>
<widget>
<class>QDialog</class>
<property stdset="1">
<name>name</name>
<cstring>CharDlg</cstring>
</property>
<property stdset="1">
<name>geometry</name>
<rect>
<x>0</x>
<y>0</y>
<width>341</width>
<height>249</height>
</rect>
</property>
<property stdset="1">
<name>caption</name>
<string>Character</string>
</property>
<property stdset="1">
<name>sizeGripEnabled</name>
<bool>true</bool>
</property>
<property>
<name>layoutMargin</name>
</property>
<property>
<name>layoutSpacing</name>
</property>
<grid>
<property stdset="1">
<name>margin</name>
<number>11</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>6</number>
</property>
<widget row="0" column="1" >
<class>QGroupBox</class>
<property stdset="1">
<name>name</name>
<cstring>sizeGB</cstring>
</property>
<property stdset="1">
<name>title</name>
<string>Never toggled</string>
</property>
<property>
<name>layoutMargin</name>
</property>
<hbox>
<property stdset="1">
<name>margin</name>
<number>11</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>6</number>
</property>
<widget>
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>sizeL</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Size:</string>
</property>
</widget>
<widget>
<class>QComboBox</class>
<item>
<property>
<name>text</name>
<string>No Change</string>
</property>
</item>
<item>
<property>
<name>text</name>
<string>Reset</string>
</property>
</item>
<item>
<property>
<name>text</name>
<string>Tiny</string>
</property>
</item>
<item>
<property>
<name>text</name>
<string>Smallest</string>
</property>
</item>
<item>
<property>
<name>text</name>
<string>Smaller</string>
</property>
</item>
<item>
<property>
<name>text</name>
<string>Small</string>
</property>
</item>
<item>
<property>
<name>text</name>
<string>Normal</string>
</property>
</item>
<item>
<property>
<name>text</name>
<string>Large</string>
</property>
</item>
<item>
<property>
<name>text</name>
<string>Larger</string>
</property>
</item>
<item>
<property>
<name>text</name>
<string>Largest</string>
</property>
</item>
<item>
<property>
<name>text</name>
<string>Huge</string>
</property>
</item>
<item>
<property>
<name>text</name>
<string>Huger</string>
</property>
</item>
<item>
<property>
<name>text</name>
<string>Increase</string>
</property>
</item>
<item>
<property>
<name>text</name>
<string>Decrease</string>
</property>
</item>
<property stdset="1">
<name>name</name>
<cstring>size</cstring>
</property>
</widget>
</hbox>
</widget>
<widget row="1" column="1" >
<class>QGroupBox</class>
<property stdset="1">
<name>name</name>
<cstring>miscGB</cstring>
</property>
<property stdset="1">
<name>title</name>
<string>Always toggled</string>
</property>
<property>
<name>layoutMargin</name>
</property>
<hbox>
<property stdset="1">
<name>margin</name>
<number>11</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>6</number>
</property>
<widget>
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>always_toggledL</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Misc:</string>
</property>
</widget>
<widget>
<class>QComboBox</class>
<item>
<property>
<name>text</name>
<string>No Change</string>
</property>
</item>
<item>
<property>
<name>text</name>
<string>Reset</string>
</property>
</item>
<item>
<property>
<name>text</name>
<string>Emph</string>
</property>
</item>
<item>
<property>
<name>text</name>
<string>Underbar</string>
</property>
</item>
<item>
<property>
<name>text</name>
<string>Noun</string>
</property>
</item>
<item>
<property>
<name>text</name>
<string>LaTeX Mode</string>
</property>
</item>
<property stdset="1">
<name>name</name>
<cstring>misc</cstring>
</property>
</widget>
</hbox>
</widget>
<widget row="0" column="0" rowspan="3" colspan="1" >
<class>QGroupBox</class>
<property stdset="1">
<name>name</name>
<cstring>charGB</cstring>
</property>
<property stdset="1">
<name>sizePolicy</name>
<sizepolicy>
<hsizetype>5</hsizetype>
<vsizetype>5</vsizetype>
</sizepolicy>
</property>
<property stdset="1">
<name>title</name>
<string>Character</string>
</property>
<property>
<name>layoutMargin</name>
</property>
<grid>
<property stdset="1">
<name>margin</name>
<number>11</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>6</number>
</property>
<widget row="0" column="0" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>familyL</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Family:</string>
</property>
</widget>
<widget row="0" column="1" >
<class>QComboBox</class>
<item>
<property>
<name>text</name>
<string>No Change</string>
</property>
</item>
<item>
<property>
<name>text</name>
<string>Reset</string>
</property>
</item>
<item>
<property>
<name>text</name>
<string>Roman</string>
</property>
</item>
<item>
<property>
<name>text</name>
<string>Sans Serif</string>
</property>
</item>
<item>
<property>
<name>text</name>
<string>Typewriter</string>
</property>
</item>
<property stdset="1">
<name>name</name>
<cstring>family</cstring>
</property>
</widget>
<widget row="1" column="0" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>seriesL</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Series:</string>
</property>
</widget>
<widget row="4" column="0" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>langL</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Language:</string>
</property>
</widget>
<widget row="2" column="1" >
<class>QComboBox</class>
<item>
<property>
<name>text</name>
<string>No Change</string>
</property>
</item>
<item>
<property>
<name>text</name>
<string>Reset</string>
</property>
</item>
<item>
<property>
<name>text</name>
<string>Upright</string>
</property>
</item>
<item>
<property>
<name>text</name>
<string>Italic</string>
</property>
</item>
<item>
<property>
<name>text</name>
<string>Slanted</string>
</property>
</item>
<item>
<property>
<name>text</name>
<string>Small Caps</string>
</property>
</item>
<property stdset="1">
<name>name</name>
<cstring>shape</cstring>
</property>
</widget>
<widget row="3" column="1" >
<class>QComboBox</class>
<item>
<property>
<name>text</name>
<string>No Change</string>
</property>
</item>
<item>
<property>
<name>text</name>
<string>Reset</string>
</property>
</item>
<item>
<property>
<name>text</name>
<string>No Color</string>
</property>
</item>
<item>
<property>
<name>text</name>
<string>Black</string>
</property>
</item>
<item>
<property>
<name>text</name>
<string>White</string>
</property>
</item>
<item>
<property>
<name>text</name>
<string>Red</string>
</property>
</item>
<item>
<property>
<name>text</name>
<string>Green</string>
</property>
</item>
<item>
<property>
<name>text</name>
<string>Blue</string>
</property>
</item>
<item>
<property>
<name>text</name>
<string>Cyan</string>
</property>
</item>
<item>
<property>
<name>text</name>
<string>Yellow</string>
</property>
</item>
<item>
<property>
<name>text</name>
<string>Magenta</string>
</property>
</item>
<property stdset="1">
<name>name</name>
<cstring>color</cstring>
</property>
</widget>
<widget row="2" column="0" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>shapeL</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Shape:</string>
</property>
</widget>
<widget row="1" column="1" >
<class>QComboBox</class>
<item>
<property>
<name>text</name>
<string>No Change</string>
</property>
</item>
<item>
<property>
<name>text</name>
<string>Reset</string>
</property>
</item>
<item>
<property>
<name>text</name>
<string>Medium</string>
</property>
</item>
<item>
<property>
<name>text</name>
<string>Bold</string>
</property>
</item>
<property stdset="1">
<name>name</name>
<cstring>series</cstring>
</property>
</widget>
<widget row="3" column="0" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>colorL</cstring>
</property>
<property stdset="1">
<name>enabled</name>
<bool>true</bool>
</property>
<property stdset="1">
<name>text</name>
<string>Color:</string>
</property>
</widget>
<widget row="4" column="1" >
<class>QComboBox</class>
<item>
<property>
<name>text</name>
<string>No Change</string>
</property>
</item>
<item>
<property>
<name>text</name>
<string>Reset</string>
</property>
</item>
<property stdset="1">
<name>name</name>
<cstring>lang</cstring>
</property>
</widget>
<widget row="5" column="1" >
<class>QCheckBox</class>
<property stdset="1">
<name>name</name>
<cstring>toggleall</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Toggle all</string>
</property>
</widget>
<spacer row="6" column="1" >
<property>
<name>name</name>
<cstring>Spacer2</cstring>
</property>
<property stdset="1">
<name>orientation</name>
<enum>Vertical</enum>
</property>
<property stdset="1">
<name>sizeType</name>
<enum>Expanding</enum>
</property>
<property>
<name>sizeHint</name>
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</grid>
</widget>
<spacer row="2" column="1" >
<property>
<name>name</name>
<cstring>Spacer3</cstring>
</property>
<property stdset="1">
<name>orientation</name>
<enum>Vertical</enum>
</property>
<property stdset="1">
<name>sizeType</name>
<enum>Expanding</enum>
</property>
<property>
<name>sizeHint</name>
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
<widget row="3" column="0" rowspan="1" colspan="2" >
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
<cstring>Layout9</cstring>
</property>
<hbox>
<property stdset="1">
<name>margin</name>
<number>0</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>6</number>
</property>
<spacer>
<property>
<name>name</name>
<cstring>Spacer2_2</cstring>
</property>
<property stdset="1">
<name>orientation</name>
<enum>Horizontal</enum>
</property>
<property stdset="1">
<name>sizeType</name>
<enum>Expanding</enum>
</property>
<property>
<name>sizeHint</name>
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
<widget>
<class>QPushButton</class>
<property stdset="1">
<name>name</name>
<cstring>applyPB</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>&amp;Apply</string>
</property>
</widget>
<widget>
<class>QPushButton</class>
<property stdset="1">
<name>name</name>
<cstring>okPB</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>&amp;OK</string>
</property>
</widget>
<widget>
<class>QPushButton</class>
<property stdset="1">
<name>name</name>
<cstring>cancelPB</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>&amp;Cancel</string>
</property>
<property stdset="1">
<name>default</name>
<bool>true</bool>
</property>
</widget>
</hbox>
</widget>
</grid>
</widget>
<connections>
<connection>
<sender>cancelPB</sender>
<signal>clicked()</signal>
<receiver>CharDlg</receiver>
<slot>cancel_adaptor()</slot>
</connection>
<connection>
<sender>okPB</sender>
<signal>clicked()</signal>
<receiver>CharDlg</receiver>
<slot>close_adaptor()</slot>
</connection>
<connection>
<sender>applyPB</sender>
<signal>clicked()</signal>
<receiver>CharDlg</receiver>
<slot>apply_adaptor()</slot>
</connection>
<slot access="protected">apply_adaptor()</slot>
<slot access="protected">cancel_adaptor()</slot>
<slot access="protected">close_adaptor()</slot>
</connections>
<tabstops>
<tabstop>family</tabstop>
<tabstop>series</tabstop>
<tabstop>shape</tabstop>
<tabstop>color</tabstop>
<tabstop>lang</tabstop>
<tabstop>toggleall</tabstop>
<tabstop>size</tabstop>
<tabstop>misc</tabstop>
<tabstop>applyPB</tabstop>
<tabstop>okPB</tabstop>
<tabstop>cancelPB</tabstop>
</tabstops>
</UI>

View File

@ -0,0 +1,136 @@
/**
* \file chardlgimpl.C
* Copyright 2001 The LyX Team.
* See the file COPYING.
*
* \author Edwin Leuven, leuven@fee.uva.nl
*/
#include "chardlg.h"
#include "chardlgimpl.h"
#include "FormCharacter.h"
#include "lyxtext.h"
#include "language.h"
#include <qcombobox.h>
#include <qcheckbox.h>
#include <qpushbutton.h>
#include <qgroupbox.h>
CharDlgImpl::CharDlgImpl(FormCharacter* form, QWidget * parent, const char* name, bool modal, WFlags fl )
: CharDlg( parent, name, modal, fl ), form_(form)
{
setCaption(name);
}
CharDlgImpl::~CharDlgImpl()
{
}
LyXFont CharDlgImpl::getChar()
{
LyXFont font(LyXFont::ALL_IGNORE);
int pos = family->currentItem();
switch (pos) {
case 0: font.setFamily(LyXFont::IGNORE_FAMILY); break;
case 1: font.setFamily(LyXFont::INHERIT_FAMILY); break;
case 2: font.setFamily(LyXFont::ROMAN_FAMILY); break;
case 3: font.setFamily(LyXFont::SANS_FAMILY); break;
case 4: font.setFamily(LyXFont::TYPEWRITER_FAMILY); break;
}
pos = series->currentItem();
switch (pos) {
case 0: font.setSeries(LyXFont::IGNORE_SERIES); break;
case 1: font.setSeries(LyXFont::INHERIT_SERIES); break;
case 2: font.setSeries(LyXFont::MEDIUM_SERIES); break;
case 3: font.setSeries(LyXFont::BOLD_SERIES); break;
}
pos = shape->currentItem();
switch (pos) {
case 0: font.setShape(LyXFont::IGNORE_SHAPE); break;
case 1: font.setShape(LyXFont::INHERIT_SHAPE); break;
case 2: font.setShape(LyXFont::UP_SHAPE); break;
case 3: font.setShape(LyXFont::ITALIC_SHAPE); break;
case 4: font.setShape(LyXFont::SLANTED_SHAPE); break;
case 5: font.setShape(LyXFont::SMALLCAPS_SHAPE); break;
}
pos = size->currentItem();
switch (pos) {
case 0: font.setSize(LyXFont::IGNORE_SIZE); break;
case 1: font.setSize(LyXFont::INHERIT_SIZE); break;
case 2: font.setSize(LyXFont::SIZE_TINY); break;
case 3: font.setSize(LyXFont::SIZE_SCRIPT); break;
case 4: font.setSize(LyXFont::SIZE_FOOTNOTE); break;
case 5: font.setSize(LyXFont::SIZE_SMALL); break;
case 6: font.setSize(LyXFont::SIZE_NORMAL); break;
case 7: font.setSize(LyXFont::SIZE_LARGE); break;
case 8: font.setSize(LyXFont::SIZE_LARGER); break;
case 9: font.setSize(LyXFont::SIZE_LARGEST); break;
case 10: font.setSize(LyXFont::SIZE_HUGE); break;
case 11: font.setSize(LyXFont::SIZE_HUGER); break;
case 12: font.setSize(LyXFont::INCREASE_SIZE); break;
case 13: font.setSize(LyXFont::DECREASE_SIZE); break;
}
pos = misc->currentItem();
switch (pos) {
case 0: font.setEmph(LyXFont::IGNORE);
font.setUnderbar(LyXFont::IGNORE);
font.setNoun(LyXFont::IGNORE);
font.setLatex(LyXFont::IGNORE);
break;
case 1: font.setEmph(LyXFont::INHERIT);
font.setUnderbar(LyXFont::INHERIT);
font.setNoun(LyXFont::INHERIT);
font.setLatex(LyXFont::INHERIT);
break;
case 2: font.setEmph(LyXFont::TOGGLE); break;
case 3: font.setUnderbar(LyXFont::TOGGLE); break;
case 4: font.setNoun(LyXFont::TOGGLE); break;
case 5: font.setLatex(LyXFont::TOGGLE); break;
}
pos = color->currentItem();
switch (pos) {
case 0: font.setColor(LColor::ignore); break;
case 1: font.setColor(LColor::inherit); break;
case 2: font.setColor(LColor::none); break;
case 3: font.setColor(LColor::black); break;
case 4: font.setColor(LColor::white); break;
case 5: font.setColor(LColor::red); break;
case 6: font.setColor(LColor::green); break;
case 7: font.setColor(LColor::blue); break;
case 8: font.setColor(LColor::cyan); break;
case 9: font.setColor(LColor::magenta); break;
case 10: font.setColor(LColor::yellow); break;
}
pos = lang->currentItem();
if (pos==0) {
font.setLanguage(ignore_language);
} else if (pos!=1) {
const char * language = lang->currentText();
font.setLanguage(languages.getLanguage(language));
};
return font;
}
void CharDlgImpl::closeEvent(QCloseEvent * e)
{
form_->close();
e->accept();
}
void CharDlgImpl::setReadOnly(bool readonly)
{
sizeGB->setEnabled(!readonly);
charGB->setEnabled(!readonly);
miscGB->setEnabled(!readonly);
okPB->setEnabled(!readonly);
applyPB->setEnabled(!readonly);
}

View File

@ -0,0 +1,73 @@
/**
* \file chardlgimpl.h
* Copyright 2001 LyX Team
* see the file COPYING
*
* \author Edwin Leuven
*/
#ifndef CHARDLGIMPL_H
#define CHARDLGIMPL_H
#include "chardlg.h"
#include "FormCharacter.h"
#include <qevent.h>
#include <qcheckbox.h>
#include <qcombobox.h>
class LyXFont;
class FormCharacter;
class CharDlgImpl : public CharDlg
{
Q_OBJECT
public:
CharDlgImpl(FormCharacter * form, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
~CharDlgImpl();
LyXFont getChar();
int langItem() {
lang->currentItem();
};
bool toggleAll() {
toggleall->isChecked();
};
void setReadOnly(bool);
protected:
void closeEvent(QCloseEvent * e);
private:
FormCharacter * form_;
protected slots:
void apply_adaptor() {
form_->apply();
}
void cancel_adaptor() {
form_->close();
hide();
}
void close_adaptor() {
form_->apply();
form_->close();
hide();
}
};
#endif // CHARDLGIMPL_H

View File

@ -26,6 +26,7 @@
#include "qlabel.h"
#include "qgroupbox.h"
using std::endl;
ParagraphDlgImpl::ParagraphDlgImpl(FormParagraph *form, QWidget* parent, const char* name, bool modal, WFlags fl )
: ParagraphDlg( parent, name, modal, fl ), form_(form)