Version 1.7.12
authorinsilmaril
Thu Mar 23 12:38:54 2006 +0000 (2006-03-23)
changeset 254d3080e02b13a
parent 253 174dd40bf06a
child 255 5da693c51f10
Version 1.7.12
branchobj.cpp
branchobj.h
demos/todo.vym
exports.cpp
exportxhtmldialog.ui.h
     1.1 --- a/branchobj.cpp	Wed Mar 15 15:54:32 2006 +0000
     1.2 +++ b/branchobj.cpp	Thu Mar 23 12:38:54 2006 +0000
     1.3 @@ -359,6 +359,7 @@
     1.4  		standardFlags->setVisibility(v);
     1.5  		LinkableMapObj::setVisibility (v);
     1.6  		
     1.7 +		// Only change childs, if I am not scrolled
     1.8  		if (!scrolled && (depth < toDepth))
     1.9  		{
    1.10  			// Now go recursivly through all childs
    1.11 @@ -696,8 +697,41 @@
    1.12  	requestReposition();
    1.13  }
    1.14  
    1.15 +void BranchObj::setHideTmp (HideTmpMode mode)
    1.16 +{
    1.17 +	if (mode==HideExport && hasHiddenExportParent(this))
    1.18 +	{
    1.19 +		setVisibility (false);
    1.20 +		hidden=true;
    1.21 +	}else
    1.22 +	{
    1.23 +		setVisibility (true);
    1.24 +		hidden=false;
    1.25 +	}	
    1.26 +
    1.27 +    BranchObj *bo;
    1.28 +    for (bo=branch.first(); bo; bo=branch.next() )
    1.29 +		bo->setHideTmp (mode);
    1.30 +}
    1.31 +
    1.32 +bool BranchObj::hasHiddenExportParent(BranchObj *start)
    1.33 +{
    1.34 +	// Calls parents recursivly to
    1.35 +	// find out, if we are temp. hidden
    1.36 +
    1.37 +	if (hideExport) return true;
    1.38 +
    1.39 +	BranchObj* bo=(BranchObj*)(parObj);
    1.40 +	if (bo) 
    1.41 +		return bo->hasHiddenExportParent(start);
    1.42 +	else
    1.43 +		return false;
    1.44 +}
    1.45 +
    1.46  QString BranchObj::saveToDir (const QString &tmpdir,const QString &prefix, const QPoint& offset)
    1.47  {
    1.48 +	if (hidden) return "";
    1.49 +
    1.50      QString s,a;
    1.51  	QString scrolledAttr;
    1.52  	if (scrolled) 
    1.53 @@ -1163,9 +1197,10 @@
    1.54  	cout << "BO::alignRelTo "<<getHeading()<<endl;
    1.55  	cout << "  d="<<depth<<
    1.56  		"  ref="<<ref<<
    1.57 -		"  bbTot="<<bboxTotal.topLeft()<<
    1.58 +//		"  bbox.topLeft="<<bboxTotal.topLeft()<<
    1.59  		"  absPos="<<absPos<<
    1.60 -		"  pad="<<topPad<<","<<botPad<<","<<leftPad<<","<<rightPad<<
    1.61 +//		"  pad="<<topPad<<","<<botPad<<","<<leftPad<<","<<rightPad<<
    1.62 +		"  hidden="<<hidden<<
    1.63  		"  th="<<th<<endl;
    1.64  */
    1.65  
    1.66 @@ -1218,8 +1253,11 @@
    1.67      BranchObj *b;
    1.68      for (b=branch.first(); b; b=branch.next() )
    1.69      {	
    1.70 -		b->alignRelativeTo (ref2);
    1.71 -		ref2.setY(ref2.y() + b->getBBoxSizeWithChilds().height() );
    1.72 +		if (!b->isHidden())
    1.73 +		{
    1.74 +			b->alignRelativeTo (ref2);
    1.75 +			ref2.setY(ref2.y() + b->getBBoxSizeWithChilds().height() );
    1.76 +		}
    1.77      }
    1.78  }
    1.79  
    1.80 @@ -1265,11 +1303,13 @@
    1.81  
    1.82  	BranchObj* b;
    1.83  	for (b=branch.first();b ;b=branch.next() )
    1.84 -		r=addBBox(b->getTotalBBox(),r);
    1.85 +		if (!b->isHidden())
    1.86 +			r=addBBox(b->getTotalBBox(),r);
    1.87  
    1.88  	FloatImageObj* fio;
    1.89  	for (fio=floatimage.first();fio ;fio=floatimage.next() )
    1.90 -		r=addBBox(fio->getTotalBBox(),r);
    1.91 +		if (!fio->isHidden())
    1.92 +			r=addBBox(fio->getTotalBBox(),r);
    1.93  		
    1.94  	return r;
    1.95  }
    1.96 @@ -1299,6 +1339,22 @@
    1.97  		return;
    1.98  	}
    1.99  	
   1.100 +	if (hidden)
   1.101 +	{
   1.102 +		bboxTotal.setWidth (0);
   1.103 +		bboxTotal.setHeight(0);
   1.104 +		if (parObj)
   1.105 +		{
   1.106 +			bboxTotal.setX (parObj->x());
   1.107 +			bboxTotal.setY (parObj->y());
   1.108 +		} else
   1.109 +		{
   1.110 +			bboxTotal.setX (bbox.x());
   1.111 +			bboxTotal.setY (bbox.y());
   1.112 +		}
   1.113 +		return;
   1.114 +	}
   1.115 +	
   1.116  	QRect r(0,0,0,0);
   1.117  	QRect br;
   1.118  	// Now calculate recursivly
   1.119 @@ -1308,11 +1364,14 @@
   1.120  	BranchObj* b;
   1.121  	for (b=branch.first();b ;b=branch.next() )
   1.122  	{
   1.123 -		b->calcBBoxSizeWithChilds();
   1.124 -		br=b->getBBoxSizeWithChilds();
   1.125 -		r.setWidth( max (br.width(), r.width() ));
   1.126 -		r.setHeight(br.height() + r.height() );
   1.127 -		if (br.y()<bboxTotal.y()) bboxTotal.setY(br.y());
   1.128 +		if (!b->isHidden())
   1.129 +		{
   1.130 +			b->calcBBoxSizeWithChilds();
   1.131 +			br=b->getBBoxSizeWithChilds();
   1.132 +			r.setWidth( max (br.width(), r.width() ));
   1.133 +			r.setHeight(br.height() + r.height() );
   1.134 +			if (br.y()<bboxTotal.y()) bboxTotal.setY(br.y());
   1.135 +		}
   1.136  	}
   1.137  	// Add myself and also
   1.138  	// add width of link to sum if necessary
   1.139 @@ -1322,8 +1381,6 @@
   1.140  		bboxTotal.setWidth (bbox.width() + r.width() + linkwidth);
   1.141  	
   1.142  	bboxTotal.setHeight(max (r.height(),  bbox.height()));
   1.143 -//	frame->setRect(QRect(bbox.x(),bbox.y(),bbox.width(),bbox.height() ) );
   1.144 -
   1.145  }
   1.146  
   1.147  void BranchObj::select()
   1.148 @@ -1355,12 +1412,6 @@
   1.149  	// Update Toolbar
   1.150  	standardFlags->updateToolbar();
   1.151  
   1.152 -	// Update Browserbutton
   1.153 -	if (!url.isEmpty())
   1.154 -		actionEditOpenURL->setEnabled (true);
   1.155 -	else	
   1.156 -		actionEditOpenURL->setEnabled (false);
   1.157 -
   1.158  	// Update actions in mapeditor
   1.159  	mapEditor->updateActions();
   1.160  }
     2.1 --- a/branchobj.h	Wed Mar 15 15:54:32 2006 +0000
     2.2 +++ b/branchobj.h	Thu Mar 23 12:38:54 2006 +0000
     2.3 @@ -12,6 +12,7 @@
     2.4  };
     2.5  
     2.6  enum BranchModification {NewBranch, MovedBranch};
     2.7 +enum HideTmpMode {HideNone, HideExport};
     2.8  
     2.9  /////////////////////////////////////////////////////////////////////////////
    2.10  class BranchObj:public OrnamentedObj {
    2.11 @@ -60,6 +61,10 @@
    2.12  	virtual void setDockPos();
    2.13      virtual LinkableMapObj* findMapObj(QPoint,LinkableMapObj*);	// find MapObj 
    2.14      virtual void setHeading (QString);
    2.15 +
    2.16 +	virtual void setHideTmp (HideTmpMode);
    2.17 +	virtual bool hasHiddenExportParent (BranchObj*);
    2.18 +
    2.19  	virtual QString saveToDir (const QString&,const QString&, const QPoint&);// Save data recursivly to tempdir
    2.20  	virtual void addXLink (XLinkObj*);
    2.21  	virtual void removeXLinkRef (XLinkObj*);// Remove ref in list
     3.1 Binary file demos/todo.vym has changed
     4.1 --- a/exports.cpp	Wed Mar 15 15:54:32 2006 +0000
     4.2 +++ b/exports.cpp	Thu Mar 23 12:38:54 2006 +0000
     4.3 @@ -131,30 +131,27 @@
     4.4  	bo=mapCenter->first();
     4.5  	while (bo) 
     4.6  	{
     4.7 -		if (!bo->hideInExport())
     4.8 +		// Make indentstring
     4.9 +		for (i=0;i<bo->getDepth();i++) actIndent+= indentPerDepth;
    4.10 +
    4.11 +		if (bo->getDepth()==0)
    4.12  		{
    4.13 -			// Make indentstring
    4.14 -			for (i=0;i<bo->getDepth();i++) actIndent+= indentPerDepth;
    4.15 -
    4.16 -			if (bo->getDepth()==0)
    4.17 -			{
    4.18 -				ts << (bo->getHeading()+ "\n");
    4.19 -				for (j=0;j<bo->getHeading().length();j++) ts<<"=";
    4.20 -				ts << "\n";
    4.21 -			} else 	if (bo->getDepth()==1)
    4.22 -				ts << ("\n"+getSectionString(bo) + bo->getHeading()+ "\n");
    4.23 -			else	if (bo->getDepth()==2)
    4.24 -				ts << (actIndent + " o " + bo->getHeading()+ "\n");
    4.25 -			else	
    4.26 -				ts << (actIndent + " - " + bo->getHeading()+ "\n");
    4.27 -			
    4.28 -			// If necessary, write note
    4.29 -			if (!bo->getNote().isEmpty())
    4.30 -			{
    4.31 -				s =bo->getNoteASCII();
    4.32 -				s=s.replace ("\n","\n"+actIndent);
    4.33 -				ts << (s+"\n\n");
    4.34 -			}
    4.35 +			ts << (bo->getHeading()+ "\n");
    4.36 +			for (j=0;j<bo->getHeading().length();j++) ts<<"=";
    4.37 +			ts << "\n";
    4.38 +		} else 	if (bo->getDepth()==1)
    4.39 +			ts << ("\n"+getSectionString(bo) + bo->getHeading()+ "\n");
    4.40 +		else	if (bo->getDepth()==2)
    4.41 +			ts << (actIndent + " o " + bo->getHeading()+ "\n");
    4.42 +		else	
    4.43 +			ts << (actIndent + " - " + bo->getHeading()+ "\n");
    4.44 +		
    4.45 +		// If necessary, write note
    4.46 +		if (!bo->getNote().isEmpty())
    4.47 +		{
    4.48 +			s =bo->getNoteASCII();
    4.49 +			s=s.replace ("\n","\n"+actIndent);
    4.50 +			ts << (s+"\n\n");
    4.51  		}
    4.52  		bo=bo->next();
    4.53  		actIndent="";
    4.54 @@ -226,31 +223,28 @@
    4.55    BranchObj *bo;
    4.56    bo=mapCenter->first();
    4.57    while (bo) {
    4.58 -	if (!bo->hideInExport())
    4.59 -	{
    4.60 -		if (bo->getDepth()==0);
    4.61 -		else if (bo->getDepth()==1) {
    4.62 -		  ts << ("\\chapter{" + bo->getHeading()+ "}\n");
    4.63 -		}
    4.64 -		else if (bo->getDepth()==2) {
    4.65 -		  ts << ("\\section{" + bo->getHeading()+ "}\n");
    4.66 -		}
    4.67 -		else if (bo->getDepth()==3) {
    4.68 -		  ts << ("\\subsection{" + bo->getHeading()+ "}\n");
    4.69 -		}
    4.70 -		else if (bo->getDepth()==4) {
    4.71 -		  ts << ("\\subsubsection{" + bo->getHeading()+ "}\n");
    4.72 -		}
    4.73 -		else {
    4.74 -		  ts << ("\\paragraph*{" + bo->getHeading()+ "}\n");
    4.75 -		}
    4.76 -		
    4.77 -		// If necessary, write note
    4.78 -		if (!bo->getNote().isEmpty()) {
    4.79 -		  ts << (bo->getNoteASCII());
    4.80 -		  ts << ("\n");
    4.81 -		}
    4.82 -    }
    4.83 +	if (bo->getDepth()==0);
    4.84 +	else if (bo->getDepth()==1) {
    4.85 +	  ts << ("\\chapter{" + bo->getHeading()+ "}\n");
    4.86 +	}
    4.87 +	else if (bo->getDepth()==2) {
    4.88 +	  ts << ("\\section{" + bo->getHeading()+ "}\n");
    4.89 +	}
    4.90 +	else if (bo->getDepth()==3) {
    4.91 +	  ts << ("\\subsection{" + bo->getHeading()+ "}\n");
    4.92 +	}
    4.93 +	else if (bo->getDepth()==4) {
    4.94 +	  ts << ("\\subsubsection{" + bo->getHeading()+ "}\n");
    4.95 +	}
    4.96 +	else {
    4.97 +	  ts << ("\\paragraph*{" + bo->getHeading()+ "}\n");
    4.98 +	}
    4.99 +	
   4.100 +	// If necessary, write note
   4.101 +	if (!bo->getNote().isEmpty()) {
   4.102 +	  ts << (bo->getNoteASCII());
   4.103 +	  ts << ("\n");
   4.104 +	}
   4.105      bo=bo->next();
   4.106     }
   4.107    file.close();
   4.108 @@ -279,17 +273,14 @@
   4.109          r+="<text:list text:style-name=\"vym-list\">\n";
   4.110          while (bo)
   4.111          {
   4.112 -			if (!bo->hideInExport())
   4.113 -			{
   4.114 -				r+="<text:list-item><text:p >";
   4.115 -				r+=quotemeta(bo->getHeading());
   4.116 -				// If necessary, write note
   4.117 -				if (!bo->getNote().isEmpty())
   4.118 -					r+=bo->getNoteOpenDoc();
   4.119 -				r+="</text:p>";
   4.120 -				r+=buildList (bo);	// recursivly add deeper branches
   4.121 -				r+="</text:list-item>\n";
   4.122 -			}
   4.123 +			r+="<text:list-item><text:p >";
   4.124 +			r+=quotemeta(bo->getHeading());
   4.125 +			// If necessary, write note
   4.126 +			if (!bo->getNote().isEmpty())
   4.127 +				r+=bo->getNoteOpenDoc();
   4.128 +			r+="</text:p>";
   4.129 +			r+=buildList (bo);	// recursivly add deeper branches
   4.130 +			r+="</text:list-item>\n";
   4.131  			i++;
   4.132  			bo=current->getBranchNum(i);
   4.133          }
   4.134 @@ -337,14 +328,11 @@
   4.135  		while (pagesBO)
   4.136  		{
   4.137  			// Add page with list of items
   4.138 -			if (!pagesBO->hideInExport())
   4.139 -			{
   4.140 -				onePage=pageTemplate;
   4.141 -				onePage.replace ("<!-- INSERT PAGE HEADING -->", quotemeta (pagesBO->getHeading() ) );
   4.142 -				list=buildList (pagesBO);
   4.143 -				onePage.replace ("<!-- INSERT LIST -->", list);
   4.144 -				allPages+=onePage;
   4.145 -			}
   4.146 +			onePage=pageTemplate;
   4.147 +			onePage.replace ("<!-- INSERT PAGE HEADING -->", quotemeta (pagesBO->getHeading() ) );
   4.148 +			list=buildList (pagesBO);
   4.149 +			onePage.replace ("<!-- INSERT LIST -->", list);
   4.150 +			allPages+=onePage;
   4.151  			j++;
   4.152  			pagesBO=sectionBO->getBranchNum(j);
   4.153  		}
     5.1 --- a/exportxhtmldialog.ui.h	Wed Mar 15 15:54:32 2006 +0000
     5.2 +++ b/exportxhtmldialog.ui.h	Thu Mar 23 12:38:54 2006 +0000
     5.3 @@ -22,7 +22,7 @@
     5.4  void ExportXHTMLDialog::readSettings()
     5.5  {
     5.6  
     5.7 -	dir=settings.readLocalEntry (filepath,"/vym/export/xhtml/exportDir","./" );
     5.8 +	dir=settings.readLocalEntry (filepath,"/vym/export/xhtml/exportDir",vymBaseDir.current().path() );
     5.9  	lineEditDir->setText(dir);
    5.10  	
    5.11      if ( settings.readLocalEntry (filepath,"/vym/export/xhtml/useImage","yes")=="yes")
    5.12 @@ -331,6 +331,8 @@
    5.13  	
    5.14  	p.setOutputFile (dir+mapname+".html");
    5.15  	p.setInputFile (dir+mapname+".xml");
    5.16 +	p.setXSLFile (xsl);
    5.17 +	cout << "bdp="<<vymBaseDir.path()<<"   xsl="<<xsl<<endl;
    5.18  	p.process();
    5.19  
    5.20  	if (!postscript.isEmpty()) runScript (postscript,dir+mapname+".html");