diff --git a/src/frontends/qt2/.cvsignore b/src/frontends/qt2/.cvsignore index 508b382224..51e36fa7ad 100644 --- a/src/frontends/qt2/.cvsignore +++ b/src/frontends/qt2/.cvsignore @@ -4,4 +4,4 @@ Makefile *.lo .libs libqt2.la -*moc.C +moc_*.C diff --git a/src/frontends/qt2/FormCharacter.C b/src/frontends/qt2/FormCharacter.C new file mode 100644 index 0000000000..716acfcbc4 --- /dev/null +++ b/src/frontends/qt2/FormCharacter.C @@ -0,0 +1,102 @@ +/** + * \file FormCharacter.C + * Copyright 2001 The LyX Team. + * See the file COPYING. + * + * \author Edwin Leuven, leuven@fee.uva.nl + */ + +#include + +#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()); +} diff --git a/src/frontends/qt2/FormCharacter.h b/src/frontends/qt2/FormCharacter.h new file mode 100644 index 0000000000..4a09091e36 --- /dev/null +++ b/src/frontends/qt2/FormCharacter.h @@ -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 diff --git a/src/frontends/qt2/FormCopyrightDialogBase.C b/src/frontends/qt2/FormCopyrightDialogBase.C index a802c5c6c2..37bee172db 100644 --- a/src/frontends/qt2/FormCopyrightDialogBase.C +++ b/src/frontends/qt2/FormCopyrightDialogBase.C @@ -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 ); diff --git a/src/frontends/qt2/chardlg.C b/src/frontends/qt2/chardlg.C new file mode 100644 index 0000000000..f5b0fddb4e --- /dev/null +++ b/src/frontends/qt2/chardlg.C @@ -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 +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * 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!" ); +} + diff --git a/src/frontends/qt2/chardlg.h b/src/frontends/qt2/chardlg.h new file mode 100644 index 0000000000..d2e7b1e243 --- /dev/null +++ b/src/frontends/qt2/chardlg.h @@ -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 +#include +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 diff --git a/src/frontends/qt2/chardlg.ui b/src/frontends/qt2/chardlg.ui new file mode 100644 index 0000000000..3c9eea2c7e --- /dev/null +++ b/src/frontends/qt2/chardlg.ui @@ -0,0 +1,704 @@ + +CharDlg + + QDialog + + name + CharDlg + + + geometry + + 0 + 0 + 341 + 249 + + + + caption + Character + + + sizeGripEnabled + true + + + layoutMargin + + + layoutSpacing + + + + margin + 11 + + + spacing + 6 + + + QGroupBox + + name + sizeGB + + + title + Never toggled + + + layoutMargin + + + + margin + 11 + + + spacing + 6 + + + QLabel + + name + sizeL + + + text + Size: + + + + QComboBox + + + text + No Change + + + + + text + Reset + + + + + text + Tiny + + + + + text + Smallest + + + + + text + Smaller + + + + + text + Small + + + + + text + Normal + + + + + text + Large + + + + + text + Larger + + + + + text + Largest + + + + + text + Huge + + + + + text + Huger + + + + + text + Increase + + + + + text + Decrease + + + + name + size + + + + + + QGroupBox + + name + miscGB + + + title + Always toggled + + + layoutMargin + + + + margin + 11 + + + spacing + 6 + + + QLabel + + name + always_toggledL + + + text + Misc: + + + + QComboBox + + + text + No Change + + + + + text + Reset + + + + + text + Emph + + + + + text + Underbar + + + + + text + Noun + + + + + text + LaTeX Mode + + + + name + misc + + + + + + QGroupBox + + name + charGB + + + sizePolicy + + 5 + 5 + + + + title + Character + + + layoutMargin + + + + margin + 11 + + + spacing + 6 + + + QLabel + + name + familyL + + + text + Family: + + + + QComboBox + + + text + No Change + + + + + text + Reset + + + + + text + Roman + + + + + text + Sans Serif + + + + + text + Typewriter + + + + name + family + + + + QLabel + + name + seriesL + + + text + Series: + + + + QLabel + + name + langL + + + text + Language: + + + + QComboBox + + + text + No Change + + + + + text + Reset + + + + + text + Upright + + + + + text + Italic + + + + + text + Slanted + + + + + text + Small Caps + + + + name + shape + + + + QComboBox + + + text + No Change + + + + + text + Reset + + + + + text + No Color + + + + + text + Black + + + + + text + White + + + + + text + Red + + + + + text + Green + + + + + text + Blue + + + + + text + Cyan + + + + + text + Yellow + + + + + text + Magenta + + + + name + color + + + + QLabel + + name + shapeL + + + text + Shape: + + + + QComboBox + + + text + No Change + + + + + text + Reset + + + + + text + Medium + + + + + text + Bold + + + + name + series + + + + QLabel + + name + colorL + + + enabled + true + + + text + Color: + + + + QComboBox + + + text + No Change + + + + + text + Reset + + + + name + lang + + + + QCheckBox + + name + toggleall + + + text + Toggle all + + + + + name + Spacer2 + + + orientation + Vertical + + + sizeType + Expanding + + + sizeHint + + 20 + 20 + + + + + + + + name + Spacer3 + + + orientation + Vertical + + + sizeType + Expanding + + + sizeHint + + 20 + 20 + + + + + QLayoutWidget + + name + Layout9 + + + + margin + 0 + + + spacing + 6 + + + + name + Spacer2_2 + + + orientation + Horizontal + + + sizeType + Expanding + + + sizeHint + + 20 + 20 + + + + + QPushButton + + name + applyPB + + + text + &Apply + + + + QPushButton + + name + okPB + + + text + &OK + + + + QPushButton + + name + cancelPB + + + text + &Cancel + + + default + true + + + + + + + + + cancelPB + clicked() + CharDlg + cancel_adaptor() + + + okPB + clicked() + CharDlg + close_adaptor() + + + applyPB + clicked() + CharDlg + apply_adaptor() + + apply_adaptor() + cancel_adaptor() + close_adaptor() + + + family + series + shape + color + lang + toggleall + size + misc + applyPB + okPB + cancelPB + + diff --git a/src/frontends/qt2/chardlgimpl.C b/src/frontends/qt2/chardlgimpl.C new file mode 100644 index 0000000000..a4be01eb5e --- /dev/null +++ b/src/frontends/qt2/chardlgimpl.C @@ -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 +#include +#include +#include + +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); +} diff --git a/src/frontends/qt2/chardlgimpl.h b/src/frontends/qt2/chardlgimpl.h new file mode 100644 index 0000000000..c6894dc4af --- /dev/null +++ b/src/frontends/qt2/chardlgimpl.h @@ -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 +#include +#include + +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 diff --git a/src/frontends/qt2/paragraphdlgimpl.C b/src/frontends/qt2/paragraphdlgimpl.C index 64f2affc14..afbfbbeac1 100644 --- a/src/frontends/qt2/paragraphdlgimpl.C +++ b/src/frontends/qt2/paragraphdlgimpl.C @@ -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)