summaryrefslogtreecommitdiffstats
path: root/quanta/components/framewizard/visualframeeditor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'quanta/components/framewizard/visualframeeditor.cpp')
-rw-r--r--quanta/components/framewizard/visualframeeditor.cpp142
1 files changed, 71 insertions, 71 deletions
diff --git a/quanta/components/framewizard/visualframeeditor.cpp b/quanta/components/framewizard/visualframeeditor.cpp
index a11dae84..d75074bd 100644
--- a/quanta/components/framewizard/visualframeeditor.cpp
+++ b/quanta/components/framewizard/visualframeeditor.cpp
@@ -32,7 +32,7 @@ TQMap<TQString, TQValueList< int > > SIZES;
static int splitterIdNumber = 0;
-VisualFrameEditor::VisualFrameEditor(TQWidget * parent, const char * name) : TQHBox(parent,name){
+VisualFrameEditor::VisualFrameEditor(TQWidget * tqparent, const char * name) : TQHBox(tqparent,name){
m_internalTree = new tree;
m_internalTree->root()->atts()->setGeometry(TQRect(0,0,510,422));
m_firstInsertedSA = 0L;
@@ -46,12 +46,12 @@ VisualFrameEditor::~VisualFrameEditor(){
void VisualFrameEditor::setGeometries(const TQString &l){
int cP = cancelledPixels(m_internalTree->findNode(l)->countChildren());
- TQRect newGeometry(m_internalTree->findNode(l)->atts()->geometry());
- TQPtrList<treeNode> list=m_internalTree->findNode(l)->childrenList();
+ TQRect newGeometry(m_internalTree->findNode(l)->atts()->tqgeometry());
+ TQPtrList<treeNode> list=m_internalTree->findNode(l)->tqchildrenList();
TQPtrListIterator<treeNode> it( list );
treeNode *node;
if(m_internalTree->findNode(l)->splitType() == VERTICAL){
- int dummyDimension=m_internalTree->findNode(l)->atts()->geometry().width()-cP;
+ int dummyDimension=m_internalTree->findNode(l)->atts()->tqgeometry().width()-cP;
while ( (node = it.current()) != 0 ) {
++it;
newGeometry.setWidth( int(dummyDimension/m_internalTree->findNode(l)->countChildren()) );
@@ -60,7 +60,7 @@ void VisualFrameEditor::setGeometries(const TQString &l){
}
else
if(m_internalTree->findNode(l)->splitType() == HORIZONTAL){
- int dummyDimension=m_internalTree->findNode(l)->atts()->geometry().height()-cP;
+ int dummyDimension=m_internalTree->findNode(l)->atts()->tqgeometry().height()-cP;
while ( (node = it.current()) != 0 ) {
++it;
newGeometry.setHeight( int(dummyDimension/m_internalTree->findNode(l)->countChildren()) );
@@ -76,17 +76,17 @@ void VisualFrameEditor::split(const TQString &l, int n, SplitType type) {
setGeometries(l);
}
else {
- TQString parentLabel=m_internalTree->findNode(l)->parentLabel();
- SplitType parentSplit=m_internalTree->findNode(parentLabel)->splitType();
- if( parentSplit != type ) {
+ TQString tqparentLabel=m_internalTree->findNode(l)->tqparentLabel();
+ SplitType tqparentSplit=m_internalTree->findNode(tqparentLabel)->splitType();
+ if( tqparentSplit != type ) {
m_internalTree->findNode(l)->setSplitType(type);
for(int i = 1; i<=n; i++) m_internalTree->addChildNode(l);
setGeometries(l);
}
else {
for(int i = 1; i<=n; i++) m_internalTree->insertChildNode(l);
- m_internalTree->findNode(parentLabel)->removeChildNode(l,true);
- setGeometries(m_internalTree->findNode(parentLabel)->label());
+ m_internalTree->findNode(tqparentLabel)->removeChildNode(l,true);
+ setGeometries(m_internalTree->findNode(tqparentLabel)->label());
}
}
}
@@ -109,9 +109,9 @@ TQStringList VisualFrameEditor::convertAsterisks(const TQString &s,int d){
// then every asterisk must be assigned a percentage of 10% so the real percentage
// notation is cols="40%,50%,10%"
for ( TQStringList::Iterator it = list.begin(); it != list.end(); ++it ) {
- if(!(*it).contains("%") && !(*it).contains("*")) leftPercentage -= ( (*it).toInt()*100 )/d;
- if((*it).contains("%")) leftPercentage -= (*it).section("%",0,0).toInt();
- if((*it).contains("*")) {
+ if(!(*it).tqcontains("%") && !(*it).tqcontains("*")) leftPercentage -= ( (*it).toInt()*100 )/d;
+ if((*it).tqcontains("%")) leftPercentage -= (*it).section("%",0,0).toInt();
+ if((*it).tqcontains("*")) {
int weight= (*it).section("*",0,0).toInt();
if( weight==0 ) weight=1;
weightAsteriskCounter += weight;
@@ -125,7 +125,7 @@ TQStringList VisualFrameEditor::convertAsterisks(const TQString &s,int d){
// a quelli effettivamente generati dal metodo build che opera un'altra normalizzazione.
// In genere la differenza �dell' 1%
for ( TQStringList::Iterator it = list.begin(); it != list.end(); ++it ) {
- if((*it).contains("*")){
+ if((*it).tqcontains("*")){
int weight= (*it).section("*",0,0).toInt();
if(weight==0) weight=1;
int newPercentage = weight*leftPercentageDistributedAmongAsterisks;
@@ -136,28 +136,28 @@ TQStringList VisualFrameEditor::convertAsterisks(const TQString &s,int d){
return list;
}
-void VisualFrameEditor::buildInternalTree(const TQString &parent){
+void VisualFrameEditor::buildInternalTree(const TQString &tqparent){
TQString line = m_existingStructure.first();
- if(line.contains("<frameset")) {
- if(line.contains("rows")) {
- split(parent,(line.contains(",")+1),HORIZONTAL);
+ if(line.tqcontains("<frameset")) {
+ if(line.tqcontains("rows")) {
+ split(tqparent,(line.tqcontains(",")+1),HORIZONTAL);
TQRegExp pattern("rows\\s*=\"([\\s\\d%,\\*]*)\"");
pattern.search(line);
- TQRect dummy=m_internalTree->findNode(parent)->atts()->geometry();
+ TQRect dummy=m_internalTree->findNode(tqparent)->atts()->tqgeometry();
TQStringList percentages = convertAsterisks(pattern.cap(1),dummy.height());
- int dummyDimension=dummy.height()-cancelledPixels(line.contains(",")+1);
+ int dummyDimension=dummy.height()-cancelledPixels(line.tqcontains(",")+1);
- TQPtrList<treeNode> list=m_internalTree->findNode(parent)->childrenList();
+ TQPtrList<treeNode> list=m_internalTree->findNode(tqparent)->tqchildrenList();
TQPtrListIterator<treeNode> it( list );
treeNode *node;
while ( (node = it.current()) != 0 ) {
++it;
TQRect newGeometry(dummy);
double newDimension;
- if(percentages.first().contains("%"))
+ if(percentages.first().tqcontains("%"))
newDimension=(dummyDimension*(percentages.first().remove("%").toInt()))/100.0;
else newDimension=(double)percentages.first().toInt();
newGeometry.setHeight( proxInt(newDimension) );
@@ -166,24 +166,24 @@ void VisualFrameEditor::buildInternalTree(const TQString &parent){
}
}
else
- if(line.contains("cols")) {
- split(parent,(line.contains(",")+1),VERTICAL);
+ if(line.tqcontains("cols")) {
+ split(tqparent,(line.tqcontains(",")+1),VERTICAL);
TQRegExp pattern("cols\\s*=\"([\\s\\d%,\\*]*)\"");
pattern.search(line);
- TQRect dummy=m_internalTree->findNode(parent)->atts()->geometry();
+ TQRect dummy=m_internalTree->findNode(tqparent)->atts()->tqgeometry();
TQStringList percentages = convertAsterisks(pattern.cap(1),dummy.width());
- int dummyDimension=dummy.width()-cancelledPixels(line.contains(",")+1);
+ int dummyDimension=dummy.width()-cancelledPixels(line.tqcontains(",")+1);
- TQPtrList<treeNode> list=m_internalTree->findNode(parent)->childrenList();
+ TQPtrList<treeNode> list=m_internalTree->findNode(tqparent)->tqchildrenList();
TQPtrListIterator<treeNode> it( list );
treeNode *node;
while ( (node = it.current()) != 0 ) {
++it;
TQRect newGeometry(dummy);
double newDimension;
- if(percentages.first().contains("%"))
+ if(percentages.first().tqcontains("%"))
newDimension=(dummyDimension*(percentages.first().remove("%").toInt()))/100.0;
else newDimension=(double)percentages.first().toInt();
newGeometry.setWidth( proxInt(newDimension) );
@@ -193,23 +193,23 @@ void VisualFrameEditor::buildInternalTree(const TQString &parent){
}
m_existingStructure.pop_front();
- m_internalTree->findNode(parent)->firstChild();
- while(m_internalTree->findNode(parent)->currentChild()) {
- buildInternalTree(m_internalTree->findNode(parent)->currentChild()->label());
- m_internalTree->findNode(parent)->nextChild();
+ m_internalTree->findNode(tqparent)->firstChild();
+ while(m_internalTree->findNode(tqparent)->currentChild()) {
+ buildInternalTree(m_internalTree->findNode(tqparent)->currentChild()->label());
+ m_internalTree->findNode(tqparent)->nextChild();
}
}
else {
TQMap<TQString,TQString> attributeMap;
- if( line.contains( TQRegExp("\\s+noresize") ) ) attributeMap["noresize"] = "noresize";
- else attributeMap["noresize"] = TQString::null;
+ if( line.tqcontains( TQRegExp("\\s+noresize") ) ) attributeMap["noresize"] = "noresize";
+ else attributeMap["noresize"] = TQString();
TQRegExp srcPattern("\\s+src\\s*=\\s*\"([%-\\w\\s\\./_\\+\\d]*)\""); //search for files
if(srcPattern.search(line) !=-1 ) {
KURL pathToConvert, basePath;
pathToConvert.setPath(srcPattern.cap(1));
basePath.setPath( Project::ref()->projectBaseURL().path() );
- attributeMap["src"] = QExtFileInfo::toAbsolute( pathToConvert, basePath ).path();
+ attributeMap["src"] = TQExtFileInfo::toAbsolute( pathToConvert, basePath ).path();
line.remove(srcPattern);//we don't need to operate on this anymore
}
@@ -221,7 +221,7 @@ void VisualFrameEditor::buildInternalTree(const TQString &parent){
attributeMap[ pattern.cap(1).section( TQRegExp("=\\s*\"") ,0,0) ] = pattern.cap(1).section(TQRegExp("=\\s*\""),1,1).remove("\"");
if ( pos >= 0 ) pos += pattern.matchedLength();
}
- m_internalTree->findNode(parent)->atts()->setAllAttributes(attributeMap);
+ m_internalTree->findNode(tqparent)->atts()->setAllAttributes(attributeMap);
m_existingStructure.pop_front();
}
}
@@ -246,23 +246,23 @@ void VisualFrameEditor::paintEvent ( TQPaintEvent * ){
void VisualFrameEditor::removeNode(const TQString &l){
if( l == m_internalTree->root()->label() ) m_internalTree->reset();//trying to remove root node is equivalent to reinitialize
else {
- TQString parentLabel=m_internalTree->findNode(l)->parentLabel();
- if(m_internalTree->findNode(parentLabel)->countChildren()>=3)
- m_internalTree->removeChildNode(parentLabel,l,true);
+ TQString tqparentLabel=m_internalTree->findNode(l)->tqparentLabel();
+ if(m_internalTree->findNode(tqparentLabel)->countChildren()>=3)
+ m_internalTree->removeChildNode(tqparentLabel,l,true);
else {
- m_internalTree->removeChildNode(parentLabel,l,true);
- if( !m_internalTree->findNode(parentLabel)->firstChild()->hasChildren() ){ //final nodes
- TQMap<TQString,TQString> map = m_internalTree->findNode(parentLabel)->firstChild()->atts()->attributeMap();
- m_internalTree->findNode(parentLabel)->removeChildren();
- m_internalTree->findNode(parentLabel)->atts()->setAllAttributes( map ) ;
- m_internalTree->findNode(parentLabel)->setSplitType(NONE);
+ m_internalTree->removeChildNode(tqparentLabel,l,true);
+ if( !m_internalTree->findNode(tqparentLabel)->firstChild()->hasChildren() ){ //final nodes
+ TQMap<TQString,TQString> map = m_internalTree->findNode(tqparentLabel)->firstChild()->atts()->attributeMap();
+ m_internalTree->findNode(tqparentLabel)->removeChildren();
+ m_internalTree->findNode(tqparentLabel)->atts()->setAllAttributes( map ) ;
+ m_internalTree->findNode(tqparentLabel)->setSplitType(NONE);
}
else {
- TQPtrList<treeNode> list = m_internalTree->findNode(parentLabel)->firstChild()->childrenList();
- if( parentLabel != m_internalTree->root()->label() ) {
- TQString grandParentLabel = m_internalTree->findNode(parentLabel)->parentLabel();
- m_internalTree->removeChildNode( parentLabel,m_internalTree->findNode(parentLabel)->firstChild()->label(),false );
- m_internalTree->removeChildNode( grandParentLabel ,parentLabel, true );
+ TQPtrList<treeNode> list = m_internalTree->findNode(tqparentLabel)->firstChild()->tqchildrenList();
+ if( tqparentLabel != m_internalTree->root()->label() ) {
+ TQString grandParentLabel = m_internalTree->findNode(tqparentLabel)->tqparentLabel();
+ m_internalTree->removeChildNode( tqparentLabel,m_internalTree->findNode(tqparentLabel)->firstChild()->label(),false );
+ m_internalTree->removeChildNode( grandParentLabel ,tqparentLabel, true );
treeNode *node;
for ( node = list.first(); node; node = list.next() ) {
node->setParentLabel(grandParentLabel);
@@ -270,12 +270,12 @@ void VisualFrameEditor::removeNode(const TQString &l){
}
}
else {
- m_internalTree->findNode(parentLabel)->setSplitType( m_internalTree->findNode(parentLabel)->firstChild()->splitType() );
- m_internalTree->removeChildNode( parentLabel,m_internalTree->findNode(parentLabel)->firstChild()->label(),false );
+ m_internalTree->findNode(tqparentLabel)->setSplitType( m_internalTree->findNode(tqparentLabel)->firstChild()->splitType() );
+ m_internalTree->removeChildNode( tqparentLabel,m_internalTree->findNode(tqparentLabel)->firstChild()->label(),false );
treeNode *node;
for ( node = list.first(); node; node = list.next() ) {
- node->setParentLabel(parentLabel);
- m_internalTree->findNode(parentLabel)->addChildNode(node);
+ node->setParentLabel(tqparentLabel);
+ m_internalTree->findNode(tqparentLabel)->addChildNode(node);
}
}
}
@@ -283,14 +283,14 @@ void VisualFrameEditor::removeNode(const TQString &l){
}
}
-void VisualFrameEditor::drawGUI(treeNode *n, TQWidget* parent){
+void VisualFrameEditor::drawGUI(treeNode *n, TQWidget* tqparent){
if(n->hasChildren()) {
TQString splitterName("splitter"+TQString::number(++splitterIdNumber,10));
- TQSplitter *splitter = new TQSplitter(parent,splitterName.ascii());
- if(SIZES.contains(splitterName)) splitter->setSizes( SIZES[splitterName] );
+ TQSplitter *splitter = new TQSplitter(tqparent,splitterName.ascii());
+ if(SIZES.tqcontains(splitterName)) splitter->setSizes( SIZES[splitterName] );
switch( n->splitType() ){
- case VERTICAL : splitter->setOrientation(TQSplitter::Horizontal);break;
- case HORIZONTAL : splitter->setOrientation(TQSplitter::Vertical);break;
+ case VERTICAL : splitter->setOrientation(Qt::Horizontal);break;
+ case HORIZONTAL : splitter->setOrientation(Qt::Vertical);break;
default:break;
}
n->firstChild();
@@ -300,11 +300,11 @@ void VisualFrameEditor::drawGUI(treeNode *n, TQWidget* parent){
}
}
else {
- SelectableArea *sa=new SelectableArea(parent,n->label().ascii());
- if(parent->isA(TQSPLITTER_OBJECT_NAME_STRING)) dynamic_cast<TQSplitter *>(parent)->setResizeMode(sa->view(),TQSplitter::KeepSize );
+ SelectableArea *sa=new SelectableArea(tqparent,n->label().ascii());
+ if(tqparent->isA(TQSPLITTER_OBJECT_NAME_STRING)) dynamic_cast<TQSplitter *>(tqparent)->setResizeMode(sa->view(),TQSplitter::KeepSize );
else
if(!m_firstInsertedSA) m_firstInsertedSA = sa;
- sa->view()->setGeometry(n->atts()->geometry());
+ sa->view()->setGeometry(n->atts()->tqgeometry());
sa->setIdLabel( n->label() );
sa->setSource( n->atts()->src() );
connect(sa, TQT_SIGNAL(Resized(TQRect)), m_internalTree->findNode(sa->idLabel())->atts(), TQT_SLOT(setGeometry(TQRect)));
@@ -335,7 +335,7 @@ TQString VisualFrameEditor::createFrameTag(areaAttribute *a){
base.setPath( Project::ref()->projectBaseURL().path() );
KURL u;
u.setPath(Src);
- tagMiddle+= (" src=\"" + QExtFileInfo::toRelative( u, base).path() + "\"");
+ tagMiddle+= (" src=\"" + TQExtFileInfo::toRelative( u, base).path() + "\"");
}
if( !Longdesc.isEmpty() )
@@ -371,11 +371,11 @@ TQString VisualFrameEditor::RCvalue(treeNode *n) {
int lostPixels = (6*(child_number-1)); // 6 pixels are lost every time a splitter is drawn
switch( n->splitType() ) {
- case VERTICAL: percentage/=n->atts()->geometry().width();
- for(int i=1;i<=child_number;++i) dimMap[i]=n->childrenList().at(i-1)->atts()->geometry().width();
+ case VERTICAL: percentage/=n->atts()->tqgeometry().width();
+ for(int i=1;i<=child_number;++i) dimMap[i]=n->tqchildrenList().at(i-1)->atts()->tqgeometry().width();
break;
- case HORIZONTAL: percentage/=n->atts()->geometry().height();
- for(int i=1;i<=child_number;++i) dimMap[i]=n->childrenList().at(i-1)->atts()->geometry().height();
+ case HORIZONTAL: percentage/=n->atts()->tqgeometry().height();
+ for(int i=1;i<=child_number;++i) dimMap[i]=n->tqchildrenList().at(i-1)->atts()->tqgeometry().height();
break;
default:break;
}
@@ -421,9 +421,9 @@ TQString VisualFrameEditor::formatStructure(){
TQString s;
int tabNum = 0;
for ( TQStringList::Iterator it = nonFormattedStructure.begin(); it != nonFormattedStructure.end(); ++it ) {
- if((*it).contains("<frameset")) tabNum++;
+ if((*it).tqcontains("<frameset")) tabNum++;
else
- if((*it).contains("</frameset>")) {
+ if((*it).tqcontains("</frameset>")) {
tabNum--;
s.truncate(s.length()-1);
}
@@ -441,9 +441,9 @@ TQString VisualFrameEditor::framesetStructure() {
}
void VisualFrameEditor::setMarkupLanguage(const TQString& s){
- if( s.contains("xhtml",false)!=0 ) m_markupLanguage = XHTML;
+ if( s.tqcontains("xhtml",false)!=0 ) m_markupLanguage = XHTML;
else
- if( s.contains("html",false)!=0 ) m_markupLanguage = HTML;
+ if( s.tqcontains("html",false)!=0 ) m_markupLanguage = HTML;
}
#include "visualframeeditor.moc"