summaryrefslogtreecommitdiffstats
path: root/kpovmodeler/pmnormaledit.cpp
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commit47d455dd55be855e4cc691c32f687f723d9247ee (patch)
tree52e236aaa2576bdb3840ebede26619692fed6d7d /kpovmodeler/pmnormaledit.cpp
downloadtdegraphics-47d455dd55be855e4cc691c32f687f723d9247ee.tar.gz
tdegraphics-47d455dd55be855e4cc691c32f687f723d9247ee.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdegraphics@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kpovmodeler/pmnormaledit.cpp')
-rw-r--r--kpovmodeler/pmnormaledit.cpp118
1 files changed, 118 insertions, 0 deletions
diff --git a/kpovmodeler/pmnormaledit.cpp b/kpovmodeler/pmnormaledit.cpp
new file mode 100644
index 00000000..161f2b0b
--- /dev/null
+++ b/kpovmodeler/pmnormaledit.cpp
@@ -0,0 +1,118 @@
+/*
+**************************************************************************
+ description
+ --------------------
+ copyright : (C) 2000-2001 by Luis Carvalho
+ email : lpassos@mail.telepac.pt
+**************************************************************************
+
+**************************************************************************
+* *
+* This program is free software; you can redistribute it and/or modify *
+* it under the terms of the GNU General Public License as published by *
+* the Free Software Foundation; either version 2 of the License, or *
+* (at your option) any later version. *
+* *
+**************************************************************************/
+
+
+#include "pmnormaledit.h"
+#include "pmnormal.h"
+#include "pmlinkedit.h"
+#include "pmlineedits.h"
+
+#include <qlayout.h>
+#include <qlabel.h>
+#include <qcheckbox.h>
+#include <klocale.h>
+
+
+PMNormalEdit::PMNormalEdit( QWidget* parent, const char* name )
+ : Base( parent, name )
+{
+ m_pDisplayedObject = 0;
+}
+
+void PMNormalEdit::createTopWidgets( )
+{
+ QHBoxLayout* hl;
+
+ Base::createTopWidgets( );
+
+ hl = new QHBoxLayout( topLayout( ) );
+ m_pBumpSizeCheck = new QCheckBox( i18n( "Bump size" ), this );
+ m_pBumpSizeEdit = new PMFloatEdit( this );
+ hl->addWidget( m_pBumpSizeCheck );
+ hl->addWidget( m_pBumpSizeEdit );
+ hl->addStretch( 1 );
+
+ hl = new QHBoxLayout( topLayout( ) );
+ QLabel* lbl = new QLabel( i18n( "Accuracy" ), this );
+ m_pAccuracy = new PMFloatEdit( this );
+ hl->addWidget( lbl );
+ hl->addWidget( m_pAccuracy );
+ hl->addStretch( 1 );
+
+ m_pUVMapping = new QCheckBox( i18n( "UV mapping" ), this );
+ topLayout( )->addWidget( m_pUVMapping );
+
+ connect( m_pBumpSizeCheck, SIGNAL( clicked( ) ), SLOT( slotBumpSizeClicked( )) );
+ connect( m_pBumpSizeEdit, SIGNAL( dataChanged( ) ), SIGNAL( dataChanged( )) );
+ connect( m_pAccuracy, SIGNAL( dataChanged( ) ), SIGNAL( dataChanged( ) ) );
+ connect( m_pUVMapping, SIGNAL( clicked( ) ), SIGNAL( dataChanged( ) ) );
+}
+
+void PMNormalEdit::displayObject( PMObject* o )
+{
+ if( o->isA( "Normal" ) )
+ {
+ bool readOnly = o->isReadOnly( );
+ m_pDisplayedObject = ( PMNormal* )o;
+
+ m_pBumpSizeCheck->setChecked( m_pDisplayedObject->isBumpSizeEnabled( ) );
+ m_pBumpSizeCheck->setEnabled( !readOnly );
+ m_pBumpSizeEdit->setValue( m_pDisplayedObject->bumpSize( ) );
+ m_pBumpSizeEdit->setReadOnly( readOnly );
+ slotBumpSizeClicked( );
+ m_pAccuracy->setValue( m_pDisplayedObject->accuracy( ) );
+ m_pAccuracy->setReadOnly( readOnly );
+ m_pUVMapping->setChecked( m_pDisplayedObject->uvMapping() );
+ m_pUVMapping->setEnabled( !readOnly );
+
+ Base::displayObject( o );
+ }
+ else
+ kdError( PMArea ) << "PMNormalEdit: Can't display object\n";
+}
+
+void PMNormalEdit::saveContents( )
+{
+ if( m_pDisplayedObject )
+ {
+ Base::saveContents( );
+ m_pDisplayedObject->enableBumpSize( m_pBumpSizeCheck->isChecked( ) );
+ m_pDisplayedObject->setBumpSize( m_pBumpSizeEdit->value( ) );
+ m_pDisplayedObject->setAccuracy( m_pAccuracy->value( ) );
+ m_pDisplayedObject->setUVMapping( m_pUVMapping->isChecked() );
+ }
+}
+
+bool PMNormalEdit::isDataValid( )
+{
+ if( !m_pBumpSizeEdit->isDataValid( ) ) return false;
+ if( !m_pAccuracy->isDataValid( ) ) return false;
+
+ return Base::isDataValid( );
+}
+
+void PMNormalEdit::slotBumpSizeClicked( )
+{
+ if( m_pBumpSizeCheck->isChecked( ) )
+ m_pBumpSizeEdit->show( );
+ else
+ m_pBumpSizeEdit->hide( );
+ emit sizeChanged( );
+ emit dataChanged( );
+}
+
+#include "pmnormaledit.moc"