KDE Bug Tracking System
Home
Report New Wish or Bug
Query Existing Reports
First
Last
Prev
Next
No search results available
Search page
Bug
137457
:
Export to EPS screws up the bounding boxes
P
roduct
:
karbon
Co
m
ponent
:
general
Status
:
RESOLVED
Resolution
:
FIXED
Target
:
---
Version
:
unspecified
Pr
i
ority
:
NOR
Severity
:
normal
V
otes
:
0
Description
:
Opened:
2006-11-16 17:27
Last Changed:
2006-12-24 19:00:42
Version: 1.6.0 (using KDE KDE 3.5.5) Installed from: Ubuntu RPMs It seems that when karbon14 exports the drawings to EPS format the bounding boxes that are defined are not compatible with the saved drawing (i.e., covering only a fraction of the drawing). That can be fixed by editing the eps file by hand but it is still a PitA.
Comment
#1
Jan Hambrecht 2006-11-18 14:39:52
I already found the bug, but it is too late for the fix to go into the next release (1.6.1) which will be out in the next days. However there will be a 1.6.2 release where the bug will be fixed.
Comment
#2
Jan Hambrecht 2006-11-18 14:44:47
Created an attachment (id=18600)
[details]
fixes selection of all objects fix for the unvalid bounding box when exporting to eps
Comment
#3
Jan Hambrecht 2006-12-24 19:00:42
SVN commit 616263 by jaham: Make it optional to export hidden layers to eps. This works only with layers as the hidden/visible state of objects is not preserved when saving and i do not feel like changing karbons default file format in the stable series. Introduced a new visitor which calculates bounding boxes configurable to use hidden objects or not. Add missing initialisation of member variable in VSelectObjects visitor which fixes selection of all objects. Merry Christmas! BUG:137457 BUG:137452 GUI:added a checkbox to the eps export dialog M +44 -11 filters/karbon/eps/epsexport.cc M +5 -0 filters/karbon/eps/epsexport.h M +9 -0 filters/karbon/eps/epsexportdlg.cc M +3 -2 filters/karbon/eps/epsexportdlg.h M +4 -2 karbon/visitors/Makefile.am A karbon/visitors/vcomputeboundingbox.cc [License: LGPL (v2+)] A karbon/visitors/vcomputeboundingbox.h [License: LGPL (v2+)] M +1 -1 karbon/visitors/vselectobjects.h --- branches/koffice/1.6/koffice/filters/karbon/eps/epsexport.cc #616262:616263 @@ -46,8 +46,8 @@ #include "vselection.h" #include "vstroke.h" #include "vtext.h" +#include "vcomputeboundingbox.h" - // Define PostScript level1 operators. static char l1_newpath = 'N'; static char l1_closepath = 'C'; @@ -83,7 +83,7 @@ EpsExport::EpsExport( KoFilter*, const char*, const QStringList& ) - : KoFilter() + : KoFilter(), m_exportHidden( true ) { } @@ -113,6 +113,7 @@ { // Which PostScript level to support? m_psLevel = dialog->psLevel() + 1; + m_exportHidden = dialog->exportHidden(); QFile fileOut( m_chain->outputFile() ); if( !fileOut.open( IO_WriteOnly ) ) @@ -154,12 +155,11 @@ void EpsExport::visitVDocument( VDocument& document ) { - // Select all objects. - document.selection()->append(); + // calculate the documents bounding box + VComputeBoundingBox bbox( ! m_exportHidden ); + document.accept( bbox ); + const KoRect &rect = bbox.boundingRect(); - // Get the bounding box of all selected objects. - const KoRect& rect = document.selection()->boundingBox(); - // Print a header. *m_stream << "%!PS-Adobe-3.0 EPSF-3.0\n" @@ -178,10 +178,6 @@ "%%Creator: Karbon14 EPS Exportfilter 0.5" << endl; - // We dont need the selection anymore. - document.selection()->clear(); - - // Process document info. KoStoreDevice* storeIn; storeIn = m_chain->storageFile( "documentinfo.xml", KoStore::Read ); @@ -235,6 +231,38 @@ } void +EpsExport::visitVGroup( VGroup& group ) +{ + VObjectListIterator itr( group.objects() ); + + for( ; itr.current(); ++itr ) + { + // do not export hidden child objects + if( ! m_exportHidden && ! isVisible( itr.current() ) ) + continue; + itr.current()->accept( *this ); + } +} + +void +EpsExport::visitVLayer( VLayer& layer ) +{ + // do not export hidden layers + if( ! m_exportHidden && ! isVisible( &layer ) ) + return; + + VObjectListIterator itr( layer.objects() ); + + for( ; itr.current(); ++itr ) + { + // do not export hidden objects + if( ! m_exportHidden && ! isVisible( itr.current() ) ) + continue; + itr.current()->accept( *this ); + } +} + +void EpsExport::visitVPath( VPath& composite ) { *m_stream << l1_newpath << "\n"; @@ -444,5 +472,10 @@ copy[2] << " " << l1_setrgbcolor; } +bool +EpsExport::isVisible( const VObject* object ) const +{ + return object->state() != VObject::hidden && object->state() != VObject::hidden_locked; +} #include "epsexport.moc" --- branches/koffice/1.6/koffice/filters/karbon/eps/epsexport.h #616262:616263 @@ -52,14 +52,19 @@ virtual void visitVDocument( VDocument& document ); virtual void visitVSubpath( VSubpath& path ); virtual void visitVText( VText& text ); + virtual void visitVGroup( VGroup& group ); + virtual void visitVLayer( VLayer& layer ); void getStroke( const VStroke& stroke ); void getFill( const VFill& fill ); void getColor( const VColor& color ); + bool isVisible( const VObject* object ) const; + QTextStream* m_stream; uint m_psLevel; + bool m_exportHidden; }; #endif --- branches/koffice/1.6/koffice/filters/karbon/eps/epsexportdlg.cc #616262:616263 @@ -21,6 +21,7 @@ #include <qradiobutton.h> #include <qstring.h> #include <qvbox.h> +#include <qcheckbox.h> #include <klocale.h> #include <knuminput.h> @@ -41,6 +42,9 @@ radio = new QRadioButton( i18n( "PostScript level 2" ), m_psLevelButtons ); radio = new QRadioButton( i18n( "PostScript level 3" ), m_psLevelButtons ); + m_hiddenExport = new QCheckBox( i18n( "Export hidden layers" ), page ); + m_hiddenExport->setChecked( true ); + m_psLevelButtons->setRadioButtonExclusive( true ); m_psLevelButtons->setButton( 2 ); } @@ -52,5 +56,10 @@ m_psLevelButtons->id( m_psLevelButtons->selected() ) ); } +bool +EpsExportDlg::exportHidden() const +{ + return m_hiddenExport->isChecked(); +} #include "epsexportdlg.moc" --- branches/koffice/1.6/koffice/filters/karbon/eps/epsexportdlg.h #616262:616263 @@ -24,8 +24,8 @@ class QButtonGroup; +class QCheckBox; - class EpsExportDlg : public KDialogBase { Q_OBJECT @@ -34,9 +34,10 @@ EpsExportDlg( QWidget* parent = 0L, const char* name = 0L ); uint psLevel() const; - + bool exportHidden() const; private: QButtonGroup* m_psLevelButtons; + QCheckBox* m_hiddenExport; }; #endif --- branches/koffice/1.6/koffice/karbon/visitors/Makefile.am #616262:616263 @@ -13,14 +13,16 @@ vselectobjects.h \ vdrawselection.h \ vselectiondesc.h \ - vtransformnodes.h + vtransformnodes.h \ + vcomputeboundingbox.h libkarbonvisitors_la_SOURCES = \ vselectnodes.cc \ vselectobjects.cc \ vdrawselection.cc \ vselectiondesc.cc \ - vtransformnodes.cc + vtransformnodes.cc \ + vcomputeboundingbox.cc libkarbonvisitors_la_METASOURCES = \ AUTO --- branches/koffice/1.6/koffice/karbon/visitors/vselectobjects.h #616262:616263 @@ -39,7 +39,7 @@ { public: VSelectObjects( VObjectList& selection, bool select = true ) - : m_selection( selection ), m_select( select ), m_insideGroups( false ) {} + : m_selection( selection ), m_select( select ), m_rectMode( true ), m_insideGroups( false ) {} VSelectObjects( VObjectList& selection, const KoRect& rect, bool select = true ) : m_selection( selection ), m_select( select ), m_rect( rect ), m_rectMode( true ), m_insideGroups( false ) { }
P
latform
:
Ubuntu Packages
O
S
:
Linux
K
eywords
:
People
Reporter
:
Assigned To
:
Tim Beaulen
Related actions
View Bug Activity
Format For Printing
XML
Clone This Bug
Note
You need to
log in
before you can comment on or make changes to this bug.
Attachments
fixes selection of all objects
(723 bytes, patch)
2006-11-18 14:44
,
Jan Hambrecht
Details
View All
Add an attachment
(proposed patch, testcase, etc.)
Depends on
:
B
locks
:
Show dependency tree
-
Show dependency graph
First
Last
Prev
Next
No search results available
Search page
Actions
Reports
Requests
Reports
Bugs reported today
Bugs reported in the last 3 days
Bug reports with patches
Weekly Bug statistics
The most hated bugs
The most severe bugs
The most frequently reported bugs
The most wanted features
Junior Jobs
Report ownership counts and charts
My Account
New Account
Log In