You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
203 lines
5.2 KiB
203 lines
5.2 KiB
//
|
|
// C++ Implementation: textlineedit
|
|
//
|
|
// Description:
|
|
//
|
|
//
|
|
// Author: Dominik Seichter <domseichter@web.de>, (C) 2004
|
|
//
|
|
// Copyright: See COPYING file that comes with this distribution
|
|
//
|
|
//
|
|
#include "textlineedit.h"
|
|
#include "tokendialog.h"
|
|
|
|
// KDE includes
|
|
#include <knuminput.h>
|
|
#include <tdeaction.h>
|
|
#include <tdeversion.h>
|
|
#include <kcolordialog.h>
|
|
#include <tdefiledialog.h>
|
|
#include <tdelocale.h>
|
|
#include <tdespell.h>
|
|
#include <klineedit.h>
|
|
#include <tdetoolbar.h>
|
|
#include <kcombobox.h>
|
|
|
|
// TQt includes
|
|
#include <tqdockarea.h>
|
|
#include <tqregexp.h>
|
|
#include <tqlabel.h>
|
|
#include <tqlayout.h>
|
|
|
|
TextLineEditor::TextLineEditor( TokenProvider* token, TQWidget *parent, const char *name )
|
|
: TQWidget( parent, name ), m_token( token )
|
|
{
|
|
TQVBoxLayout* layout = new TQVBoxLayout( this, 6, 6 );
|
|
|
|
|
|
|
|
editor = new KLineEdit( this );
|
|
|
|
editor->setFocus();
|
|
|
|
TQDockArea* area = new TQDockArea( TQt::Horizontal, TQDockArea::Normal, this );
|
|
toolBar = new TDEToolBar( area );
|
|
tool2Bar = new TDEToolBar( area );
|
|
tool3Bar = new TDEToolBar( area );
|
|
|
|
setupActions();
|
|
|
|
layout->addWidget( area );
|
|
layout->addWidget( editor );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
TextLineEditor::~TextLineEditor()
|
|
{
|
|
}
|
|
|
|
|
|
void TextLineEditor::setupActions()
|
|
{
|
|
ac = new TDEActionCollection( this );
|
|
|
|
|
|
TDEAction *action_undo = KStdAction::undo( editor, TQ_SLOT( undo() ), ac );
|
|
action_undo->setEnabled( false );
|
|
connect( editor, TQ_SIGNAL( undoAvailable(bool) ), action_undo, TQ_SLOT( setEnabled(bool) ) );
|
|
|
|
|
|
TDEAction *action_redo = KStdAction::redo( editor, TQ_SLOT( redo() ), ac );
|
|
action_redo->setEnabled( false );
|
|
connect( editor, TQ_SIGNAL( redoAvailable(bool) ), action_redo, TQ_SLOT( setEnabled(bool) ) );
|
|
|
|
TDEAction *action_cut = KStdAction::cut( editor, TQ_SLOT( cut() ), ac );
|
|
action_cut->setEnabled( false );
|
|
connect( editor, TQ_SIGNAL( copyAvailable(bool) ), action_cut, TQ_SLOT( setEnabled(bool) ) );
|
|
|
|
TDEAction *action_copy = KStdAction::copy( editor, TQ_SLOT( copy() ), ac );
|
|
action_copy->setEnabled( false );
|
|
connect( editor, TQ_SIGNAL( copyAvailable(bool) ), action_copy, TQ_SLOT( setEnabled(bool) ) );
|
|
|
|
TDEAction* action_paste = KStdAction::paste( editor, TQ_SLOT( paste() ), ac );
|
|
|
|
TDEAction* textDataAct = new TDEAction( i18n("Insert &Data Field"), "contents", 0, this, TQ_SLOT( insertNewField() ), ac, "text_data_act");
|
|
|
|
action_undo->plug( toolBar );
|
|
action_redo->plug( toolBar );
|
|
toolBar->insertSeparator();
|
|
action_cut->plug( toolBar );
|
|
action_copy->plug( toolBar );
|
|
action_paste->plug( toolBar );
|
|
|
|
|
|
TQStringList fuentes;
|
|
fuentes += "Times Roman (Medium) 8 point";
|
|
fuentes += "Times Roman (Medium) 10 point";
|
|
fuentes += "Times Roman (Bold) 10 point";
|
|
fuentes += "Times Roman (Bold) 12 point";
|
|
fuentes += "Times Roman (Bold) 14 point";
|
|
fuentes += "Times Roman (Italic) 12 point";
|
|
fuentes += "Helvetica (Medium) 6 point";
|
|
fuentes += "Helvetica (Medium) 10 point";
|
|
fuentes += "Helvetica (Medium) 12 point";
|
|
fuentes += "Helvetica (Bold) 12 point";
|
|
fuentes += "Helvetica (Bold) 14 point";
|
|
fuentes += "Helvetica (Italic) 12 point";
|
|
fuentes += "Presentation (Bold) 18 point";
|
|
fuentes += "Letter Gothic (Medium) 9.5 point";
|
|
fuentes += "Prestige Elite (Medium) 7 point";
|
|
fuentes += "Prestige Elite (Bold) 10 point";
|
|
fuentes += "Courier (Medium) 10 point";
|
|
fuentes += "Courier (Bold) 12 point";
|
|
fuentes += "OCR-A 12 point";
|
|
fuentes += "OCR-B 12 point";
|
|
|
|
textDataAct->plug( tool2Bar );
|
|
|
|
action_font_type = new KComboBox(tool2Bar,"font_type") ;
|
|
connect( action_font_type, TQ_SIGNAL( activated(int) ), this, TQ_SLOT( setFontType(int) ) );
|
|
action_font_type->insertStringList(fuentes) ;
|
|
|
|
|
|
|
|
TQLabel* labelv = new TQLabel( i18n("&Mag. Vert.:"), tool3Bar );
|
|
mag_vert = new KIntNumInput( tool3Bar,"magvert" );
|
|
TQLabel* labelh = new TQLabel( i18n("&Mag. Hor.:"), tool3Bar );
|
|
mag_hor = new KIntNumInput( tool3Bar,"maghor" );
|
|
connect( mag_vert, TQ_SIGNAL( activated(int) ), this, TQ_SLOT( setVerMag(int) ) );
|
|
connect( mag_hor, TQ_SIGNAL( activated(int) ), this, TQ_SLOT( setHorMag(int) ) );
|
|
mag_vert->setRange( 1, 9, 1, false );
|
|
mag_hor->setRange( 1, 9, 1, false );
|
|
|
|
|
|
labelv->setBuddy( mag_vert );
|
|
labelh->setBuddy( mag_hor );
|
|
|
|
|
|
|
|
updateActions();
|
|
|
|
|
|
}
|
|
|
|
TQString TextLineEditor::text()
|
|
{
|
|
return editor->text();
|
|
}
|
|
|
|
void TextLineEditor::setText( const TQString & t )
|
|
{
|
|
editor->setText( t );
|
|
}
|
|
|
|
|
|
void TextLineEditor::updateActions()
|
|
{
|
|
|
|
}
|
|
|
|
|
|
void TextLineEditor::insertNewField()
|
|
{
|
|
TokenDialog dlg( m_token, this, "dlg" );
|
|
if( dlg.exec() == TQDialog::Accepted )
|
|
editor->insert( dlg.token() ) ;
|
|
}
|
|
|
|
void TextLineEditor::setFontType( int index )
|
|
{
|
|
action_font_type->setCurrentItem(index);
|
|
}
|
|
|
|
int TextLineEditor::getFontType()
|
|
{
|
|
return action_font_type->currentItem();
|
|
}
|
|
void TextLineEditor::setVertMag( int index )
|
|
{
|
|
mag_vert->setValue(index);
|
|
}
|
|
|
|
int TextLineEditor::getVertMag()
|
|
{
|
|
return mag_vert->value();
|
|
}
|
|
|
|
void TextLineEditor::setHorMag( int index )
|
|
{
|
|
mag_hor->setValue(index);
|
|
}
|
|
|
|
int TextLineEditor::getHorMag()
|
|
{
|
|
return mag_hor->value();
|
|
}
|
|
#include "textlineedit.moc"
|