[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    Re: koffice/karbon/tools
From:       Rob Buis <rwlbuis () xs4all ! nl>
Date:       2006-01-10 8:49:14
Message-ID: 20060110084914.GA4395 () xs4all ! nl
[Download RAW message or body]

Hi Jan,

Thanks a lot! We should be able to improve the text tool
a lot using qt4 IMHO.
Cheers,

Rob.

On Tue, Jan 10, 2006 at 12:39:32AM +0000, Jan Hambrecht 
wrote:
> SVN commit 496195 by jaham:
> 
> fixed texttool which was partly broken by the new tool box
> * clicking on selected path object puts new text along a path
> * clicking on selected text object changes the text object
> * clicking outside of selected object creates new horizontal text
> * improved drawing of edited text
> 
> GUI: changed context help text accordingly
> 
> 
> 
>  M  +39 -27    vtexttool.cc  
>  M  +2 -2      vtexttool.h  
> 
> 
> --- trunk/koffice/karbon/tools/vtexttool.cc #496194:496195
> @@ -583,13 +583,6 @@
>  		m_tool->visit( text );
>  }
>  
> -void 
> -VTextOptionsWidget::moveEvent ( QMoveEvent * )
> -{
> -	if( m_tool && isVisible() )
> -		m_tool->textChanged();
> -}
> -
>  VTextTool::VTextTool( KarbonView *view )
>  		: VTool( view, "tool_text" )
>  {
> @@ -610,8 +603,8 @@
>  	QString s = "<qt><b>Text tool</b><br>";
>  	s += "Click on document to place horizontal text.<br>";
>  	s += "Click and drag in document to place directional text.<br>";
> -	s += "Select an object and click tool to place text along a path.<br>";
> -	s += "Select a text object and click the tool to change existing text.<br></qt>";
> +	s += "Click on a selected path object to place text along its outline.<br>";
> +	s += "Click on a selected text object to change it.<br></qt>";
>  
>  	return s;
>  }
> @@ -635,6 +628,13 @@
>  }
>  
>  void
> +VTextTool::draw( VPainter* painter )
> +{
> +	if( m_editedText )
> +		m_editedText->draw( painter, &m_editedText->boundingBox() );
> +}
> +
> +void
>  VTextTool::drawPathCreation()
>  {
>  	VPainter * painter = view()->painterFactory()->editpainter();
> @@ -654,16 +654,8 @@
>  void
>  VTextTool::drawEditedText()
>  {
> -	if( !m_editedText )
> -		return;
> -
> -	kdDebug(38000) << "Drawing: " << m_editedText->text() << endl;
> -
> -	VPainter* painter = view()->painterFactory()->editpainter();
> -
> -	painter->setZoomFactor( view()->zoom() );
> -
> -	m_editedText->draw( painter, &m_editedText->boundingBox() );
> +	if( m_editedText ) 
> +		view()->repaintAll( m_editedText->boundingBox() );
>  }
>  
>  void
> @@ -677,16 +669,32 @@
>  void
>  VTextTool::mouseButtonRelease()
>  {
> -	// use a default horizontal path when just clicking
> -	VSubpath path( 0L );
> -	path.moveTo( first() );
> -	path.lineTo( KoPoint( first().x()+10, first().y() ) );
> +	if( ! view() ) 
> +		return;
>  
> -	if( createText( path ) )
> +	VSelection* selection = view()->part()->document().selection();
> +	VObject* selObj = selection->objects().getFirst();
> +
> +	// initialize dialog with single selected object
> +	if( selection->objects().count() == 1 && selObj->boundingBox().contains( last() ) )
> +		m_optionsWidget->initialize( *selObj );
> +	else 
>  	{
> +		// use a default horizontal path when just clicking
> +		VSubpath path( 0L );
> +		path.moveTo( first() );
> +		path.lineTo( KoPoint( first().x()+10, first().y() ) );
> +	
> +		if( ! createText( path ) )
> +			return;
> +	}
> +
> +	if( dynamic_cast<VText*>( selObj ) )
> +		m_optionsWidget->setCaption( "Change Text" );
> +	else 
>  		m_optionsWidget->setCaption( "Insert Text" );
> -		m_optionsWidget->show();
> -	}
> +
> +	m_optionsWidget->show();
>  }
>  
>  void
> @@ -778,7 +786,6 @@
>  void
>  VTextTool::textChanged()
>  {
> -
>  	if( !m_editedText )
>  		return;
>  
> @@ -838,6 +845,9 @@
>  				  &view()->part()->document(),
>  				  i18n( "Insert Text" ),
>  				  newText );
> +
> +		delete m_editedText;
> +		m_editedText = 0L;
>  	}
>  
>  	view()->part()->addCommand( cmd, true );
> @@ -925,6 +935,8 @@
>  	m_optionsWidget->setUseShadow( text.useShadow() );
>  	m_optionsWidget->setShadow( text.shadowAngle(), text.shadowDistance(), text.translucentShadow() );
>  	m_creating = false;
> +	m_text->setState( VObject::hidden );
> +	m_editedText->setState( VObject::edit );
>  }
>  
>  VTextTool::VTextCmd::VTextCmd( VDocument* doc, const QString& name, VText* text )
> --- trunk/koffice/karbon/tools/vtexttool.h #496194:496195
> @@ -132,8 +132,6 @@
>  	void initialize( VObject &text );
>  
>  protected:
> -	void moveEvent( QMoveEvent * );
> -
>  	QTabWidget* m_tabWidget;
>  	KFontCombo* m_fontCombo;
>  	QCheckBox* m_boldCheck;
> @@ -188,6 +186,8 @@
>  	virtual void visitVSubpath( VSubpath& path );
>  	virtual void visitVText( VText& text );
>  
> +	virtual void draw( VPainter* painter );
> +
>  protected:
>  	virtual void mouseDragShiftPressed();
>  	virtual void mouseDragShiftReleased();
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic