KDE Bug Tracking System
Home
Report New Wish or Bug
Query Existing Reports
First
Last
Prev
Next
No search results available
Search page
Bug
137452
:
Export to file only visible elements
P
roduct
:
karbon
Co
m
ponent
:
general
Status
:
RESOLVED
Resolution
:
FIXED
Target
:
---
Version
:
unspecified
Pr
i
ority
:
NOR
Severity
:
wishlist
V
otes
:
0
Description
:
Opened:
2006-11-16 16:20
Last Changed:
2006-12-24 19:00:42
Version: 1.6.0 (using KDE KDE 3.5.5) Installed from: Ubuntu RPMs Right now it is possible to organize the different drawing objects into groups and layers, which make the whole drawing process a whole lot easier. One thing that I enjoyed having was the possibility to toggle the visibility of individual groups and layers. That feature has the potential to speed up the drawing process, specially when drawing lots of diagrams which differ only in small variations. For example, right now I'm trying to use karbon14 to draw a series of diagrams depicting various stages of the traffic flow through a few crossings when managed by traffic lights. So to make my job easier I just grouped the crossing diagram on a layer, the traffic flow arrows on another and the labels on a third layer. Now I can generate all the diagrams I need (the crossing presentation including track legends, various traffic flow phases, saturation points, etc...) by toggling the visibility of those layers. Well, that works in karbon14. The problem is that to be able to include them in my report which I'm writing in LaTeX, I need to export those diagrams to the enhanced postscript format and karbon14's export functionality renders every drawing object, whether they are marked as visible or not. So, although the karbon14 file is neatly organized, thanks to the exporter's behaviour, I still need to draw the individual diagrams. So it would be nice if the exporter feature could only export the visible drawing objects. That would be a heck of a feature and would speed up the drawing process in those cases similar to mine.
Comment
#1
Jan Hambrecht 2006-11-16 16:25:13
Yes that seem like a nice feature to me. Problem is koffice 1.6.1 is about to be released in the next days. So that feature will only get into 1.6.2 if there is any.
Comment
#2
Jan Hambrecht 2006-12-24 19:00:40
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
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