summaryrefslogtreecommitdiffstats
path: root/quanta/components/framewizard
diff options
context:
space:
mode:
Diffstat (limited to 'quanta/components/framewizard')
-rw-r--r--quanta/components/framewizard/Makefile.am9
-rw-r--r--quanta/components/framewizard/areaattributedb.cpp40
-rw-r--r--quanta/components/framewizard/areaattributedb.h49
-rw-r--r--quanta/components/framewizard/fmfpeditor.cpp111
-rw-r--r--quanta/components/framewizard/fmfpeditor.h42
-rw-r--r--quanta/components/framewizard/fmfpeditors.ui541
-rw-r--r--quanta/components/framewizard/fmrceditor.cpp34
-rw-r--r--quanta/components/framewizard/fmrceditor.h38
-rw-r--r--quanta/components/framewizard/fmrceditors.ui149
-rw-r--r--quanta/components/framewizard/framewizard.cpp120
-rw-r--r--quanta/components/framewizard/framewizard.h61
-rw-r--r--quanta/components/framewizard/framewizards.ui369
-rw-r--r--quanta/components/framewizard/fwglobal.cpp22
-rw-r--r--quanta/components/framewizard/fwglobal.h24
-rw-r--r--quanta/components/framewizard/selectablearea.cpp57
-rw-r--r--quanta/components/framewizard/selectablearea.h53
-rw-r--r--quanta/components/framewizard/treenode.cpp135
-rw-r--r--quanta/components/framewizard/treenode.h87
-rw-r--r--quanta/components/framewizard/visualframeeditor.cpp449
-rw-r--r--quanta/components/framewizard/visualframeeditor.h66
20 files changed, 2456 insertions, 0 deletions
diff --git a/quanta/components/framewizard/Makefile.am b/quanta/components/framewizard/Makefile.am
new file mode 100644
index 00000000..ad04c91f
--- /dev/null
+++ b/quanta/components/framewizard/Makefile.am
@@ -0,0 +1,9 @@
+noinst_LTLIBRARIES = libframewizard.la
+AM_CPPFLAGS = -I$(top_srcdir)/lib \
+ -I$(top_srcdir)/quanta/project \
+ -I$(top_srcdir)/quanta/utility \
+ $(all_includes)
+
+libframewizard_la_SOURCES = fmfpeditors.ui fmrceditors.ui framewizards.ui fwglobal.cpp areaattributedb.cpp selectablearea.cpp treenode.cpp visualframeeditor.cpp fmfpeditor.cpp fmrceditor.cpp framewizard.cpp
+METASOURCES = AUTO
+
diff --git a/quanta/components/framewizard/areaattributedb.cpp b/quanta/components/framewizard/areaattributedb.cpp
new file mode 100644
index 00000000..96cc77c0
--- /dev/null
+++ b/quanta/components/framewizard/areaattributedb.cpp
@@ -0,0 +1,40 @@
+/***************************************************************************
+ areaattributedb.cpp - description
+ -------------------
+ begin : gio mar 20 2003
+ copyright : (C) 2003 by gulmini luciano
+ email : gulmini.luciano@student.unife.it
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "areaattributedb.h"
+
+areaAttribute::areaAttribute(){
+ resetAttributes();
+}
+
+void areaAttribute::resetAttributes(){
+ m_attributeMap["name"] = "";
+ m_attributeMap["longdesc"] = "";
+ m_attributeMap["src"] = "";
+ m_attributeMap["scrolling"] = "auto"; // default value
+ m_attributeMap["id"] = "";
+ m_attributeMap["style"] = "";
+ m_attributeMap["title"] = "";
+ m_attributeMap["class"] = "";
+ m_attributeMap["noresize"] = "noresize";
+ m_attributeMap["frameborder"] = "1"; // default value
+ m_attributeMap["marginwidth"] = "10";
+ m_attributeMap["marginheight"] = "10";
+}
+#include "areaattributedb.moc"
+
+
diff --git a/quanta/components/framewizard/areaattributedb.h b/quanta/components/framewizard/areaattributedb.h
new file mode 100644
index 00000000..e13682b3
--- /dev/null
+++ b/quanta/components/framewizard/areaattributedb.h
@@ -0,0 +1,49 @@
+/***************************************************************************
+ areaattributedb.h - description
+ -------------------
+ begin : gio mar 20 2003
+ copyright : (C) 2003 by gulmini luciano
+ email : gulmini.luciano@student.unife.it
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef AREAATTRIBUTEDB_H
+#define AREAATTRIBUTEDB_H
+#include <qrect.h>
+#include <qmap.h>
+#include <qobject.h>
+/**this is
+ *@author gulmini luciano
+ */
+
+class areaAttribute : public QObject{
+ Q_OBJECT
+
+ private:
+ QRect m_geometry;
+ QMap<QString,QString> m_attributeMap; //tag specific attributes
+
+ public:
+ areaAttribute();
+ ~areaAttribute(){};
+ void setAttribute(const QString& name, const QString& value){ m_attributeMap[name] = value; }
+ void setAllAttributes(QMap<QString,QString> map){ m_attributeMap = map; }
+ void resetAttributes();
+ QRect geometry() const { return m_geometry; }
+ QString src() const{ return m_attributeMap["src"]; }
+ QString attributeValue(QString l) const { return attributeMap()[l];}
+ QMap<QString,QString> attributeMap() const { return m_attributeMap; }
+
+ public slots:
+ void setGeometry(QRect g) { m_geometry = g; }
+};
+
+#endif
diff --git a/quanta/components/framewizard/fmfpeditor.cpp b/quanta/components/framewizard/fmfpeditor.cpp
new file mode 100644
index 00000000..cc262453
--- /dev/null
+++ b/quanta/components/framewizard/fmfpeditor.cpp
@@ -0,0 +1,111 @@
+/***************************************************************************
+ fmfpeditor.cpp - description
+ -------------------
+ begin : mer giu 4 2003
+ copyright : (C) 2003 by Gulmini Luciano
+ email : gulmini.luciano@student.unife.it
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "fmfpeditor.h"
+#include <qspinbox.h>
+#include <qlineedit.h>
+#include <qbuttongroup.h>
+#include <qregexp.h>
+#include <kurlrequester.h>
+#include <qstringlist.h>
+#include <kfiledialog.h>
+#include <klocale.h>
+//#include <kpreviewwidgetbase.h>
+
+/*class PreviewWidget : public KPreviewWidgetBase {
+};*/
+
+fmFPeditor::fmFPeditor() : fmFPeditorS (){
+ sbLeft->setWrapping(true);
+ sbTop->setWrapping(true);
+
+ QString htmlFiles = i18n("*.html *.htm|HTML Files");
+ QString phpFiles = i18n("*.php|PHP Files");
+ QString xmlFiles = i18n("*.xml|XML Files");
+ QString xhtmlFiles = i18n("*xhtml|XHTML Files");
+ QString allFiles = i18n("*|All Files");
+
+ fc->setFilter(htmlFiles+"\n"+phpFiles+"\n"+xmlFiles+"\n"+xhtmlFiles+"\n"+allFiles);
+
+}
+fmFPeditor::~fmFPeditor(){
+}
+
+QString fmFPeditor::noresizeValue() {
+ switch(bgNoresize->id(bgNoresize->selected())){
+ case 0:return "";break;
+ default:return "noresize";
+ }
+}
+
+QString fmFPeditor::scrollingValue() {
+ switch(bgScrolling->id(bgScrolling->selected())){
+ case 0:return "yes";break;
+ case 2:return "no";break;
+ default:return "auto";
+ }
+}
+
+QString fmFPeditor::frameborderValue() {
+ switch(bgBorder->id(bgBorder->selected())){
+ case 1:return "0"; break;
+ default:return "1";
+ }
+}
+
+void fmFPeditor::setup(QMap<QString,QString> m){
+ leId->setText(m["id"]);
+ fc->setURL(m["src"]);
+ leClass->setText(m["class"]);
+ leLongdesc->setText(m["longdesc"]);
+ leTitle->setText(m["title"]);
+ leStyle->setText(m["style"]);
+ leName->setText(m["name"]);
+
+ if(m["noresize"]!="noresize") bgNoresize->setButton(0);
+ else bgNoresize->setButton(1);
+
+ if(m["scrolling"]=="yes") bgScrolling->setButton(0);
+ else
+ if(m["scrolling"]=="no") bgScrolling->setButton(2);
+
+ if(m["frameborder"]=="0") bgBorder->setButton(1);
+
+ sbLeft->setValue(m["marginwidth"].toInt());
+ sbTop->setValue(m["marginheight"].toInt());
+}
+
+QMap<QString,QString> fmFPeditor::attributeMap(){
+ QMap<QString,QString> map;
+
+ map["name"] = leName->text();
+ map["longdesc"] = leLongdesc->text();
+ map["src"] = fc->url();
+ map["scrolling"] = scrollingValue();
+ map["id"] = leId->text();
+ map["style"] = leStyle->text();
+ map["title"] = leTitle->text();
+ map["class"] = leClass->text();
+ map["noresize"] = noresizeValue();
+ map["frameborder"] = frameborderValue();
+ map["marginwidth"] = QString::number( sbLeft->value(),10 );
+ map["marginheight"] = QString::number( sbTop->value(),10 );
+
+ return map;
+}
+
+#include "fmfpeditor.moc"
diff --git a/quanta/components/framewizard/fmfpeditor.h b/quanta/components/framewizard/fmfpeditor.h
new file mode 100644
index 00000000..c434b421
--- /dev/null
+++ b/quanta/components/framewizard/fmfpeditor.h
@@ -0,0 +1,42 @@
+/***************************************************************************
+ fmfpeditor.h - description
+ -------------------
+ begin : mer giu 4 2003
+ copyright : (C) 2003 by Gulmini Luciano
+ email : gulmini.luciano@student.unife.it
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef FMFPEDITOR_H
+#define FMFPEDITOR_H
+
+#include <fmfpeditors.h>
+
+/**
+ *@author Gulmini Luciano
+ */
+
+class fmFPeditor : public fmFPeditorS {
+ Q_OBJECT
+
+ public:
+ fmFPeditor();
+ ~fmFPeditor();
+ void setup(QMap<QString,QString>);
+ QMap<QString,QString> attributeMap();
+
+ private:
+ QString noresizeValue();
+ QString scrollingValue();
+ QString frameborderValue();
+};
+
+#endif
diff --git a/quanta/components/framewizard/fmfpeditors.ui b/quanta/components/framewizard/fmfpeditors.ui
new file mode 100644
index 00000000..ef8990a9
--- /dev/null
+++ b/quanta/components/framewizard/fmfpeditors.ui
@@ -0,0 +1,541 @@
+<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
+<class>fmFPeditorS</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>fmFPeditorS</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>26</x>
+ <y>5</y>
+ <width>320</width>
+ <height>430</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Frame Properties</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget" row="1" column="0">
+ <property name="name">
+ <cstring>Layout8</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>55</width>
+ <height>0</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>pbOk</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;OK</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>pbCancel</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Cancel</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QTabWidget" row="0" column="0">
+ <property name="name">
+ <cstring>tw</cstring>
+ </property>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>tab</cstring>
+ </property>
+ <attribute name="title">
+ <string>Common</string>
+ </attribute>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QButtonGroup" row="4" column="0">
+ <property name="name">
+ <cstring>bgBorder</cstring>
+ </property>
+ <property name="title">
+ <string>Border</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QRadioButton" row="0" column="0">
+ <property name="name">
+ <cstring>rbBorderYes</cstring>
+ </property>
+ <property name="text">
+ <string>Yes</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QRadioButton" row="0" column="1">
+ <property name="name">
+ <cstring>rbBorderNo</cstring>
+ </property>
+ <property name="text">
+ <string>No</string>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QGroupBox" row="2" column="0">
+ <property name="name">
+ <cstring>gbMargins</cstring>
+ </property>
+ <property name="title">
+ <string>Margins</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLayoutWidget" row="0" column="0">
+ <property name="name">
+ <cstring>Layout8</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout4</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel2_3</cstring>
+ </property>
+ <property name="text">
+ <string>From left:</string>
+ </property>
+ </widget>
+ <widget class="QSpinBox">
+ <property name="name">
+ <cstring>sbLeft</cstring>
+ </property>
+ <property name="suffix">
+ <string>px</string>
+ </property>
+ <property name="value">
+ <number>10</number>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout3</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel1_3</cstring>
+ </property>
+ <property name="text">
+ <string>From top:</string>
+ </property>
+ </widget>
+ <widget class="QSpinBox">
+ <property name="name">
+ <cstring>sbTop</cstring>
+ </property>
+ <property name="suffix">
+ <string>px</string>
+ </property>
+ <property name="value">
+ <number>10</number>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </hbox>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QButtonGroup" row="3" column="0">
+ <property name="name">
+ <cstring>bgScrolling</cstring>
+ </property>
+ <property name="title">
+ <string>Scrolling</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QRadioButton" row="0" column="0">
+ <property name="name">
+ <cstring>rbScrollingYes</cstring>
+ </property>
+ <property name="text">
+ <string>Yes</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton" row="0" column="2">
+ <property name="name">
+ <cstring>rbScrollingAuto</cstring>
+ </property>
+ <property name="text">
+ <string>Auto</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QRadioButton" row="0" column="1">
+ <property name="name">
+ <cstring>rbScrollingNo</cstring>
+ </property>
+ <property name="text">
+ <string>No</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QButtonGroup" row="1" column="0">
+ <property name="name">
+ <cstring>bgNoresize</cstring>
+ </property>
+ <property name="title">
+ <string>Resize</string>
+ </property>
+ <property name="exclusive">
+ <bool>false</bool>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QRadioButton" row="0" column="0">
+ <property name="name">
+ <cstring>rbResizeYes</cstring>
+ </property>
+ <property name="text">
+ <string>Yes</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton" row="0" column="1">
+ <property name="name">
+ <cstring>rbResizeNo</cstring>
+ </property>
+ <property name="text">
+ <string>No</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QLayoutWidget" row="0" column="0">
+ <property name="name">
+ <cstring>Layout10</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout9</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>tlFrameSource</cstring>
+ </property>
+ <property name="text">
+ <string>Frame source:</string>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>tlFrameName</cstring>
+ </property>
+ <property name="text">
+ <string>Frame name:</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout8</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="KURLRequester">
+ <property name="name">
+ <cstring>fc</cstring>
+ </property>
+ </widget>
+ <widget class="QLineEdit">
+ <property name="name">
+ <cstring>leName</cstring>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ </hbox>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>tab</cstring>
+ </property>
+ <attribute name="title">
+ <string>Others</string>
+ </attribute>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget" row="0" column="0">
+ <property name="name">
+ <cstring>Layout11</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>tlId</cstring>
+ </property>
+ <property name="text">
+ <string>Id:</string>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel2_2</cstring>
+ </property>
+ <property name="text">
+ <string>Class:</string>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel3</cstring>
+ </property>
+ <property name="text">
+ <string>Style:</string>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel4</cstring>
+ </property>
+ <property name="text">
+ <string>Title:</string>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel6</cstring>
+ </property>
+ <property name="text">
+ <string>Long description:</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QLayoutWidget" row="0" column="1">
+ <property name="name">
+ <cstring>Layout10</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLineEdit">
+ <property name="name">
+ <cstring>leId</cstring>
+ </property>
+ </widget>
+ <widget class="QLineEdit">
+ <property name="name">
+ <cstring>leClass</cstring>
+ </property>
+ </widget>
+ <widget class="QLineEdit">
+ <property name="name">
+ <cstring>leStyle</cstring>
+ </property>
+ </widget>
+ <widget class="QLineEdit">
+ <property name="name">
+ <cstring>leTitle</cstring>
+ </property>
+ </widget>
+ <widget class="QLineEdit">
+ <property name="name">
+ <cstring>leLongdesc</cstring>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <spacer row="1" column="1">
+ <property name="name">
+ <cstring>spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </grid>
+ </widget>
+ </widget>
+ </grid>
+</widget>
+<connections>
+ <connection>
+ <sender>pbOk</sender>
+ <signal>clicked()</signal>
+ <receiver>fmFPeditorS</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection>
+ <sender>pbCancel</sender>
+ <signal>clicked()</signal>
+ <receiver>fmFPeditorS</receiver>
+ <slot>reject()</slot>
+ </connection>
+</connections>
+<pixmapinproject/>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/quanta/components/framewizard/fmrceditor.cpp b/quanta/components/framewizard/fmrceditor.cpp
new file mode 100644
index 00000000..270b3e8c
--- /dev/null
+++ b/quanta/components/framewizard/fmrceditor.cpp
@@ -0,0 +1,34 @@
+/***************************************************************************
+ fmrceditor.cpp - description
+ -------------------
+ begin : mer giu 4 2003
+ copyright : (C) 2003 by Gulmini Luciano
+ email : gulmini.luciano@student.unife.it
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "fmrceditor.h"
+#include <qspinbox.h>
+#include <qlabel.h>
+
+fmRCeditor::fmRCeditor() : fmRCeditorS(){}
+
+fmRCeditor::~fmRCeditor(){}
+
+int fmRCeditor::spinBoxValue() const {
+ return sb->value();
+}
+
+void fmRCeditor::setLabelText(QString s){
+ tl->setText(s);
+}
+
+#include "fmrceditor.moc"
diff --git a/quanta/components/framewizard/fmrceditor.h b/quanta/components/framewizard/fmrceditor.h
new file mode 100644
index 00000000..55441e91
--- /dev/null
+++ b/quanta/components/framewizard/fmrceditor.h
@@ -0,0 +1,38 @@
+/***************************************************************************
+ fmrceditor.h - description
+ -------------------
+ begin : mer giu 4 2003
+ copyright : (C) 2003 by Gulmini Luciano
+ email : gulmini.luciano@student.unife.it
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef FMRCEDITOR_H
+#define FMRCEDITOR_H
+
+#include <fmrceditors.h>
+
+/**
+ *@author Gulmini Luciano
+ */
+
+class fmRCeditor : public fmRCeditorS {
+ Q_OBJECT
+ public:
+ fmRCeditor();
+ ~fmRCeditor();
+ public:
+ int spinBoxValue() const;
+ void setLabelText(QString);
+
+};
+
+#endif
diff --git a/quanta/components/framewizard/fmrceditors.ui b/quanta/components/framewizard/fmrceditors.ui
new file mode 100644
index 00000000..25cd41bd
--- /dev/null
+++ b/quanta/components/framewizard/fmrceditors.ui
@@ -0,0 +1,149 @@
+<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
+<class>fmRCeditorS</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>fmRCeditorS</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>300</width>
+ <height>150</height>
+ </rect>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>300</width>
+ <height>150</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>300</width>
+ <height>150</height>
+ </size>
+ </property>
+ <property name="caption">
+ <string>Rows Columns Editor</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLayoutWidget" row="0" column="0">
+ <property name="name">
+ <cstring>Layout11</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>tl</cstring>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ </widget>
+ <widget class="QSpinBox">
+ <property name="name">
+ <cstring>sb</cstring>
+ </property>
+ <property name="minValue">
+ <number>0</number>
+ </property>
+ <property name="value">
+ <number>2</number>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget" row="1" column="0">
+ <property name="name">
+ <cstring>Layout3</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer8</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>31</width>
+ <height>0</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>pbOk</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;OK</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>pbCancel</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Cancel</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </grid>
+</widget>
+<connections>
+ <connection>
+ <sender>pbOk</sender>
+ <signal>clicked()</signal>
+ <receiver>fmRCeditorS</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection>
+ <sender>pbCancel</sender>
+ <signal>clicked()</signal>
+ <receiver>fmRCeditorS</receiver>
+ <slot>reject()</slot>
+ </connection>
+</connections>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/quanta/components/framewizard/framewizard.cpp b/quanta/components/framewizard/framewizard.cpp
new file mode 100644
index 00000000..2f3903dd
--- /dev/null
+++ b/quanta/components/framewizard/framewizard.cpp
@@ -0,0 +1,120 @@
+/***************************************************************************
+ framewizard.cpp - description
+ -------------------
+ begin : mer giu 4 14:14:07 CEST 2003
+ copyright : (C) |YEAR| by Gu2003Luciano
+ email : gulmini.luciano@student.unife.it
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "framewizard.h"
+#include "fmrceditor.h"
+#include "fmfpeditor.h"
+#include <kmessagebox.h>
+//#include <kdebug.h>
+#include <klocale.h>
+#include <qpushbutton.h>
+
+#include "fwglobal.h"
+
+static const QString info1=i18n("You must select an area."),
+ info2=i18n("Before editing a frame you must save the file.");
+
+FrameWizard::FrameWizard(QWidget *parent, const char *name) : FrameWizardS(parent, name),
+m_hasSelected(false),m_saved(false)
+{
+ m_hasSelected = false;
+ m_currSA=vfe->internalTree()->root()->label();
+ connect(this, SIGNAL(launchDraw()), this, SLOT(draw()));
+ connect(vfe, SIGNAL(areaSelected(const QString &)), this, SLOT(catchSelectedArea(const QString &)));
+
+ connect(pbHorizontal, SIGNAL(clicked()), this, SLOT(split()));
+ connect(pbVertical, SIGNAL(clicked()), this, SLOT(split()));
+ connect(pbEditFrame, SIGNAL(clicked()), this, SLOT(showFrameEditorDlg()));
+ connect(pbReset, SIGNAL(clicked()), this, SLOT(reset()));
+ connect(pbDelete, SIGNAL(clicked()), this, SLOT(remove()));
+}
+
+FrameWizard::~FrameWizard(){
+#define QT_CHECK_NULL
+Q_CHECK_PTR( vfe );
+}
+
+void FrameWizard::catchSelectedArea(const QString &id ){
+ m_currSA = id; //is the current SelectableArea selected
+ m_hasSelected = true;// a SelectableArea has been selected
+}
+
+void FrameWizard::split(){
+ if(m_hasSelected) {
+ int split = 0;
+ QString currNodeLabel = m_currSA;
+ QString senderName=sender()->name();
+ if(senderName=="pbHorizontal"){
+ split = showRCeditorDlg(i18n("Enter the desired number of rows:"));
+ if(split>=2) vfe->split(currNodeLabel,split,HORIZONTAL);
+ }
+ else
+ if(senderName=="pbVertical"){
+ split = showRCeditorDlg(i18n("Enter the desired number of columns:"));
+ if(split>=2) vfe->split(currNodeLabel,split,VERTICAL);
+ }
+ emit launchDraw();
+ }
+ else KMessageBox::information( this, info1, i18n("Warning") );
+ m_hasSelected=false;
+}
+
+void FrameWizard::draw(){
+ vfe->draw();
+}
+
+int FrameWizard::showRCeditorDlg(const QString &s){
+ int res = 0;
+ fmRCeditor *dlg = new fmRCeditor;
+ dlg->setLabelText(s);
+ if(dlg->exec()) res = dlg->spinBoxValue();
+ delete dlg;
+ return res;
+}
+
+void FrameWizard::showFrameEditorDlg(){
+ if(m_saved){
+ if(m_hasSelected) {
+ fmFPeditor *dlg = new fmFPeditor();
+ dlg->setup(vfe->internalTree()->findAreaAttribute(m_currSA)->attributeMap());
+ if(dlg->exec()) {
+ vfe->internalTree()->findAreaAttribute(m_currSA)->setAllAttributes(dlg->attributeMap());
+ vfe->draw();
+ }
+ delete dlg;
+ }
+ else KMessageBox::information( this, info1, i18n("Warning") );
+ m_hasSelected=false;
+ }
+ else KMessageBox::information( this, info2, i18n("Warning") );
+}
+
+void FrameWizard::reset(){
+ vfe->internalTree()->reset();
+ draw();
+}
+
+void FrameWizard::remove(){
+ if(m_hasSelected) {
+ vfe->removeNode(m_currSA);
+ draw();
+ }
+ else KMessageBox::information( this, info1, i18n("Warning") );
+ m_hasSelected=false;
+}
+
+#include "framewizard.moc"
diff --git a/quanta/components/framewizard/framewizard.h b/quanta/components/framewizard/framewizard.h
new file mode 100644
index 00000000..22e93789
--- /dev/null
+++ b/quanta/components/framewizard/framewizard.h
@@ -0,0 +1,61 @@
+/***************************************************************************
+ framewizard.h - description
+ -------------------
+ begin : mer giu 4 14:14:07 CEST 2003
+ copyright : (C) |YEAR| by Gu2003Luciano
+ email : gulmini.luciano@student.unife.it
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef FRAMEWIZARD_H
+#define FRAMEWIZARD_H
+
+#include <framewizards.h>
+#include "visualframeeditor.h"
+class QStringList;
+
+/** FrameWizard is the base class of the project */
+class FrameWizard : public FrameWizardS
+{
+ Q_OBJECT
+ private:
+ bool m_hasSelected,
+ m_saved; // if saved = false the the file containing the frameset structure
+ // has been not saved and so you cannot edit the frame
+ // This is for me: se non si salva il file no si riesce a conoscere il
+ // percorso relativo dei file da mettere nell'attributo src
+ QString m_currSA;
+
+ public:
+ FrameWizard( QWidget* parent=0, const char *name=0);
+ ~FrameWizard();
+
+ private slots:
+ void showFrameEditorDlg();
+ void reset();
+ void remove();
+ void catchSelectedArea(const QString &id );
+ void split();
+ void draw();
+ int showRCeditorDlg(const QString &s);
+
+ public :
+ void loadExistingFramesetStructure(const QStringList &list){ vfe->loadExistingStructure(list);}
+ QString generateFramesetStructure(){ return vfe->framesetStructure(); }
+ void setSaved( bool b){ m_saved=b; }
+ void setMarkupLanguage(const QString& s){ vfe->setMarkupLanguage(s);}
+
+ signals:
+ void launchDraw();
+
+};
+
+#endif
diff --git a/quanta/components/framewizard/framewizards.ui b/quanta/components/framewizard/framewizards.ui
new file mode 100644
index 00000000..a06d321b
--- /dev/null
+++ b/quanta/components/framewizard/framewizards.ui
@@ -0,0 +1,369 @@
+<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
+<class>FrameWizardS</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>FrameWizardS</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>640</width>
+ <height>482</height>
+ </rect>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>32767</width>
+ <height>32767</height>
+ </size>
+ </property>
+ <property name="caption">
+ <string>Frame Wizard</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLayoutWidget" row="1" column="0">
+ <property name="name">
+ <cstring>Layout2</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>pbHelp</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Help</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>30</width>
+ <height>0</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout1</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>pbOk</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;OK</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>pbCancel</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Cancel</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget" row="0" column="0">
+ <property name="name">
+ <cstring>Layout11</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout9</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>tl</cstring>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer6</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>0</width>
+ <height>30</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>ButtonGroup4</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="title">
+ <string>Splitting</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QPushButton" row="1" column="0">
+ <property name="name">
+ <cstring>pbVertical</cstring>
+ </property>
+ <property name="text">
+ <string>Vertical</string>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="0" column="0">
+ <property name="name">
+ <cstring>pbHorizontal</cstring>
+ </property>
+ <property name="text">
+ <string>Horizontal</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer9</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>0</width>
+ <height>16</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>ButtonGroup5</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="title">
+ <string>Editing</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QPushButton" row="2" column="0">
+ <property name="name">
+ <cstring>pbEditFrame</cstring>
+ </property>
+ <property name="text">
+ <string>Edit Frame</string>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="1" column="0">
+ <property name="name">
+ <cstring>pbDelete</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="text">
+ <string>Delete</string>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="0" column="0">
+ <property name="name">
+ <cstring>pbReset</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="text">
+ <string>Reset</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer5</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>0</width>
+ <height>30</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ <widget class="VisualFrameEditor">
+ <property name="name">
+ <cstring>vfe</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>3</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="focusPolicy">
+ <enum>ClickFocus</enum>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </grid>
+</widget>
+<customwidgets>
+ <customwidget>
+ <class>VisualFrameEditor</class>
+ <header location="global">visualframeeditor.h</header>
+ <sizehint>
+ <width>-1</width>
+ <height>-1</height>
+ </sizehint>
+ <container>0</container>
+ <sizepolicy>
+ <hordata>5</hordata>
+ <verdata>5</verdata>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ <pixmap>image0</pixmap>
+ </customwidget>
+</customwidgets>
+<images>
+ <image name="image0">
+ <data format="XBM.GZ" length="79">789c534e494dcbcc4b554829cdcdad8c2fcf4c29c95030e0524611cd48cd4ccf28010a1797249664262b2467241641a592324b8aa363156c15aab914146aadb90067111b1f</data>
+ </image>
+</images>
+<connections>
+ <connection>
+ <sender>pbCancel</sender>
+ <signal>clicked()</signal>
+ <receiver>FrameWizardS</receiver>
+ <slot>close()</slot>
+ </connection>
+ <connection>
+ <sender>pbOk</sender>
+ <signal>clicked()</signal>
+ <receiver>FrameWizardS</receiver>
+ <slot>accept()</slot>
+ </connection>
+</connections>
+<pixmapinproject/>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>visualframeeditor.h</includehint>
+</includehints>
+</UI>
diff --git a/quanta/components/framewizard/fwglobal.cpp b/quanta/components/framewizard/fwglobal.cpp
new file mode 100644
index 00000000..f2f971da
--- /dev/null
+++ b/quanta/components/framewizard/fwglobal.cpp
@@ -0,0 +1,22 @@
+/***************************************************************************
+ fwglobal.cpp - description
+ -------------------
+ begin : mar feb 17 2004
+ copyright : (C) 2003 by gulmini luciano
+ email : gulmini.luciano@student.unife.it
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+#include "fwglobal.h"
+
+int proxInt(double d){
+ if((d-int(d))>= 0.5 ) return int(d)+1;
+ return int(d);
+}
diff --git a/quanta/components/framewizard/fwglobal.h b/quanta/components/framewizard/fwglobal.h
new file mode 100644
index 00000000..9377012c
--- /dev/null
+++ b/quanta/components/framewizard/fwglobal.h
@@ -0,0 +1,24 @@
+/***************************************************************************
+ fwglobal.h - description
+ -------------------
+ begin : mar feb 17 2004
+ copyright : (C) 2003 by gulmini luciano
+ email : gulmini.luciano@student.unife.it
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+#ifndef FWGLOBAL_H
+#define FWGLOBAL_H
+
+enum SplitType{ HORIZONTAL,VERTICAL,NONE };
+
+int proxInt(double d);
+
+#endif
diff --git a/quanta/components/framewizard/selectablearea.cpp b/quanta/components/framewizard/selectablearea.cpp
new file mode 100644
index 00000000..32ea234b
--- /dev/null
+++ b/quanta/components/framewizard/selectablearea.cpp
@@ -0,0 +1,57 @@
+/***************************************************************************
+ selectablearea.cpp - description
+ -------------------
+ begin : mer mar 5 2003
+ copyright : (C) 2003 by gulmini luciano
+ email : gulmini.luciano@student.unife.it
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "selectablearea.h"
+#include <qframe.h>
+//#include <kdebug.h>
+#include "fwglobal.h"
+
+SelectableArea::SelectableArea(QWidget *parent, const char *name ) : KHTMLPart(parent,name) {
+ view()->setFrameShape(QFrame::NoFrame);
+ view()->setMinimumSize(QSize(1,1));
+ view()->installEventFilter(this);
+}
+
+SelectableArea::~SelectableArea(){}
+
+bool SelectableArea::eventFilter(QObject *o, QEvent *event){
+ switch ( event->type() ) {
+ case QEvent::FocusIn : {
+ view()->setFrameShape(QFrame::Box);
+ view()->setFrameShadow ( QFrame::Plain );
+ view()->setLineWidth(2);
+ emit selected(m_idLabel);
+ return true;
+ };
+ break;
+ case QEvent::FocusOut : {
+ view()->setFrameShape(QFrame::NoFrame);
+ return true;
+ }
+ break;
+ case QEvent::Resize : {
+ emit Resized( view()->geometry() );
+ view()->hide();
+ view()->show();
+ return true;
+ }
+ break;
+ default: return KHTMLPart::eventFilter( o, event );
+ }
+}
+
+#include "selectablearea.moc"
diff --git a/quanta/components/framewizard/selectablearea.h b/quanta/components/framewizard/selectablearea.h
new file mode 100644
index 00000000..252ec6c9
--- /dev/null
+++ b/quanta/components/framewizard/selectablearea.h
@@ -0,0 +1,53 @@
+/***************************************************************************
+ selectablearea.h - description
+ -------------------
+ begin : mer mar 5 2003
+ copyright : (C) 2003 by gulmini luciano
+ email : gulmini.luciano@student.unife.it
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef SELECTABLEAREA_H
+#define SELECTABLEAREA_H
+
+//#include <qwidget.h>
+#include <khtml_part.h>
+#include <khtmlview.h>
+
+/**a QTextBrowser that can be selected
+ *@author gulmini luciano
+ */
+
+
+class SelectableArea : public KHTMLPart {
+ Q_OBJECT
+
+ public :
+ SelectableArea(QWidget *parent=0, const char *name=0);
+ ~SelectableArea();
+ QString idLabel() const { return m_idLabel; }
+ void setIdLabel(const QString &i) { m_idLabel = i; }
+ void setSource(const QString& s) { if(!s.isEmpty()) openURL( KURL(s) ); }
+
+ protected :
+ virtual bool eventFilter(QObject*, QEvent*);
+
+ private :
+ QString m_idLabel;
+
+ signals :
+ void selected(const QString &);
+ void Resized(QRect);
+};
+
+
+
+#endif
diff --git a/quanta/components/framewizard/treenode.cpp b/quanta/components/framewizard/treenode.cpp
new file mode 100644
index 00000000..fcb60231
--- /dev/null
+++ b/quanta/components/framewizard/treenode.cpp
@@ -0,0 +1,135 @@
+/***************************************************************************
+ treenode.cpp - description
+ -------------------
+ begin : lun mar 17 2003
+ copyright : (C) 2003 by gulmini luciano
+ email : gulmini.luciano@student.unife.it
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "treenode.h"
+
+static const int SIZE = 101;
+
+treeNode::treeNode(const QString &l, const QString &pl) : m_label(l), m_parentLabel(pl), m_splitType(NONE){
+ m_childrenList.setAutoDelete(true);
+ m_atts = new areaAttribute;
+}
+
+treeNode::~treeNode(){
+ delete m_atts;
+}
+
+void treeNode::addChildNode(const QString &l) {
+ m_childrenList.append( new treeNode(l,m_label) );
+}
+
+void treeNode::removeChildNode(const QString &l,bool autoDelete) {
+ m_childrenList.setAutoDelete(autoDelete);
+ m_childrenList.remove(findChild(l));
+}
+
+treeNode* treeNode::findChild(const QString &l){
+ QPtrListIterator<treeNode> it( m_childrenList );
+ treeNode *node;
+ while ( (node = it.current()) != 0 ) {
+ ++it;
+ if(node->label() == l) return node;
+ }
+ return 0L;
+}
+
+int tree::nodeId = 0;
+
+tree::tree(){
+ m_root = new treeNode(QString::number(nodeId,10));
+ m_nodeList.resize(SIZE);
+}
+
+tree::~tree(){
+ delete m_root;
+}
+
+void tree::refreshGeometries(treeNode *n){
+ int dim = -6;// so we won't add exceeding pixels
+
+ if(n->hasChildren()){
+ n->firstChild();
+ while(n->currentChild()){
+ refreshGeometries(n->currentChild());
+ n->nextChild();
+ }
+
+ QPtrList<treeNode> list = n->childrenList();
+ QPtrListIterator<treeNode> it( list );
+ treeNode *node= it.current();
+ QRect newGeometry = n->atts()->geometry();
+ if(n->splitType()==VERTICAL){
+ newGeometry.setHeight(node->atts()->geometry().height());
+ while ( (node = it.current()) != 0 ) {
+ ++it;
+ dim += node->atts()->geometry().width();
+ dim += 6;
+ }
+ newGeometry.setWidth(dim);
+ }
+ else
+ if(n->splitType()==HORIZONTAL){
+ newGeometry.setWidth(node->atts()->geometry().width());
+ while ( (node = it.current()) != 0 ) {
+ ++it;
+ dim += node->atts()->geometry().height();
+ dim += 6;
+ }
+ newGeometry.setHeight(dim);
+ }
+
+ n->atts()->setGeometry( newGeometry );
+ }
+}
+
+treeNode* tree::findNode(const QString &l){
+ if(l==m_root->label()) return m_root;
+ return m_nodeList.find(l);
+}
+
+QString tree::addChildNode(const QString &l){
+ treeNode *node;
+ if( (node = findNode(l)) != 0) {
+ ++nodeId;
+ treeNode *newNode = new treeNode(QString::number(nodeId,10),node->label());
+ newNode->atts()->setAttribute( "src",node->atts()->src() );
+ node->addChildNode(newNode);
+ m_nodeList.insert(QString::number(nodeId,10),newNode);
+ }
+ return QString::number(nodeId,10);
+}
+
+bool tree::insertChildNode(const QString &l){
+ QString parent = findNode(l)->parentLabel();
+ int pos=findNode( parent )->childPosition( findNode(l) );
+ ++nodeId;
+ treeNode *newNode = new treeNode(QString::number(nodeId,10),parent);
+ newNode->atts()->setAttribute( "src",findNode(l)->atts()->src() );
+ m_nodeList.insert(QString::number(nodeId,10),newNode);
+ return findNode( parent )->insertChild(pos,newNode);
+}
+
+void tree::reset(){
+ nodeId = 1;
+ m_root->removeChildren();
+ m_root->atts()->resetAttributes();
+ m_nodeList.clear();
+}
+
+void tree::removeChildNode(const QString &pl,const QString &l,bool autoDelete){
+ findNode(pl)->removeChildNode(l,autoDelete);
+}
diff --git a/quanta/components/framewizard/treenode.h b/quanta/components/framewizard/treenode.h
new file mode 100644
index 00000000..c2d0f3d6
--- /dev/null
+++ b/quanta/components/framewizard/treenode.h
@@ -0,0 +1,87 @@
+/***************************************************************************
+ treenode.h - description
+ -------------------
+ begin : lun mar 17 2003
+ copyright : (C) 2003 by gulmini luciano
+ email : gulmini.luciano@student.unife.it
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef TREENODE_H
+#define TREENODE_H
+
+#include <qptrlist.h>
+#include <qdict.h>
+#include <qstringlist.h>
+
+#include "fwglobal.h"
+#include "areaattributedb.h"
+
+/**a node in the tree
+ *@author gulmini luciano
+ */
+class treeNode {
+ private:
+ QString m_label,
+ m_parentLabel;
+ SplitType m_splitType;
+ QPtrList<treeNode> m_childrenList;
+ areaAttribute *m_atts;
+
+ public:
+ treeNode(const QString &l=QString::null, const QString &pl=QString::null);
+ ~treeNode();
+ void addChildNode(const QString &L);
+ void addChildNode(treeNode *n){ m_childrenList.append(n); }
+ void removeChildNode(const QString &l, bool autoDelete);
+ void setSplitType(SplitType s) { m_splitType = s; }
+ void setLabel(const QString &l) { m_label = l; }
+ void removeChildren() { m_childrenList.clear(); }
+ void setParentLabel(const QString &s){ m_parentLabel = s;}
+ int childPosition(treeNode* n){ return m_childrenList.find(n); }
+ bool insertChild(unsigned int pos, treeNode* n) { return m_childrenList.insert( pos, n); }
+ QString label() const { return m_label; }
+ QString parentLabel() const { return m_parentLabel; }
+ SplitType splitType() const { return m_splitType; }
+ QPtrList<treeNode> childrenList() { return m_childrenList; }
+
+ treeNode* firstChild() { return m_childrenList.first(); }
+ treeNode* nextChild() { return m_childrenList.next(); }
+ treeNode* lastChild() { return m_childrenList.last(); }
+ treeNode* currentChild() { return m_childrenList.current(); }
+ treeNode* findChild(const QString &L);
+
+ areaAttribute* atts() { return m_atts; }
+
+ int countChildren() const { return m_childrenList.count(); }
+ bool hasChildren() const { return !m_childrenList.isEmpty(); }
+};
+
+class tree{
+ private:
+ treeNode *m_root;
+ QDict<treeNode> m_nodeList;
+ static int nodeId;
+
+ public:
+ tree();
+ ~tree();
+ treeNode* root() const { return m_root; }
+ QString addChildNode(const QString &l);
+ bool insertChildNode(const QString &L);
+ void removeChildNode(const QString &pl,const QString &l,bool autoDelete);//parent node,child node
+ treeNode* findNode(const QString &L);
+ areaAttribute* findAreaAttribute(const QString &l){ return findNode(l)->atts(); };
+ void reset();
+ void refreshGeometries(treeNode*);
+};
+
+#endif
diff --git a/quanta/components/framewizard/visualframeeditor.cpp b/quanta/components/framewizard/visualframeeditor.cpp
new file mode 100644
index 00000000..3871ac61
--- /dev/null
+++ b/quanta/components/framewizard/visualframeeditor.cpp
@@ -0,0 +1,449 @@
+/***************************************************************************
+ visualframeeditor.cpp - description
+ -------------------
+ begin : mar mar 25 2003
+ copyright : (C) 2003 by gulmini luciano
+ email : gulmini.luciano@student.unife.it
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "visualframeeditor.h"
+
+#include <qobjectlist.h>
+#include <qsplitter.h>
+//#include <kdebug.h>
+
+#include "qextfileinfo.h"
+#include "project.h"
+
+static int cancelledPixels(int n){
+ return (n-1)*6;
+}
+
+QMap<QString, QValueList< int > > SIZES;
+static int splitterIdNumber = 0;
+
+
+VisualFrameEditor::VisualFrameEditor(QWidget * parent, const char * name) : QHBox(parent,name){
+ m_internalTree = new tree;
+ m_internalTree->root()->atts()->setGeometry(QRect(0,0,510,422));
+ m_firstInsertedSA = 0L;
+ m_markupLanguage = HTML;
+}
+
+VisualFrameEditor::~VisualFrameEditor(){
+ delete m_internalTree;
+ delete m_firstInsertedSA;
+}
+
+void VisualFrameEditor::setGeometries(const QString &l){
+ int cP = cancelledPixels(m_internalTree->findNode(l)->countChildren());
+ QRect newGeometry(m_internalTree->findNode(l)->atts()->geometry());
+ QPtrList<treeNode> list=m_internalTree->findNode(l)->childrenList();
+ QPtrListIterator<treeNode> it( list );
+ treeNode *node;
+ if(m_internalTree->findNode(l)->splitType() == VERTICAL){
+ int dummyDimension=m_internalTree->findNode(l)->atts()->geometry().width()-cP;
+ while ( (node = it.current()) != 0 ) {
+ ++it;
+ newGeometry.setWidth( int(dummyDimension/m_internalTree->findNode(l)->countChildren()) );
+ m_internalTree->findNode(node->label())->atts()->setGeometry(newGeometry);
+ }
+ }
+ else
+ if(m_internalTree->findNode(l)->splitType() == HORIZONTAL){
+ int dummyDimension=m_internalTree->findNode(l)->atts()->geometry().height()-cP;
+ while ( (node = it.current()) != 0 ) {
+ ++it;
+ newGeometry.setHeight( int(dummyDimension/m_internalTree->findNode(l)->countChildren()) );
+ m_internalTree->findNode(node->label())->atts()->setGeometry(newGeometry);
+ }
+ }
+}
+
+void VisualFrameEditor::split(const QString &l, int n, SplitType type) {
+ if(l==m_internalTree->root()->label()){
+ m_internalTree->root()->setSplitType(type);
+ for(int i = 1; i<=n; i++) m_internalTree->addChildNode(l);
+ setGeometries(l);
+ }
+ else {
+ QString parentLabel=m_internalTree->findNode(l)->parentLabel();
+ SplitType parentSplit=m_internalTree->findNode(parentLabel)->splitType();
+ if( parentSplit != 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());
+ }
+ }
+}
+
+void VisualFrameEditor::loadExistingStructure(const QStringList &list){
+ if(!list.isEmpty()) {
+ m_existingStructure = list;
+ m_existingStructure.remove("</frameset>");//closure tag not needed
+ buildInternalTree(m_internalTree->root()->label());
+ }
+}
+
+QStringList VisualFrameEditor::convertAsterisks(const QString &s,int d){
+ QStringList list=QStringList::split(",",s);
+ int leftPercentage = 100;
+ int leftPercentageDistributedAmongAsterisks=0;
+ int weightAsteriskCounter=0;
+ // This for is used to determine how much percentage must be assign to an asterisk
+ // example cols="40%,5*,*"
+ // then every asterisk must be assigned a percentage of 10% so the real percentage
+ // notation is cols="40%,50%,10%"
+ for ( QStringList::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("*")) {
+ int weight= (*it).section("*",0,0).toInt();
+ if( weight==0 ) weight=1;
+ weightAsteriskCounter += weight;
+ }
+ }
+
+ if(weightAsteriskCounter!=0) leftPercentageDistributedAmongAsterisks = proxInt(double(leftPercentage)/double(weightAsteriskCounter));
+ // this for changes asterisk notation in percentage notation
+ // This part of the comment is for me:
+ // NB: I valori delle percentuali generati da if .. else possono non corrispondere
+ // a quelli effettivamente generati dal metodo build che opera un'altra normalizzazione.
+ // In genere la differenza �dell' 1%
+ for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) {
+ if((*it).contains("*")){
+ int weight= (*it).section("*",0,0).toInt();
+ if(weight==0) weight=1;
+ int newPercentage = weight*leftPercentageDistributedAmongAsterisks;
+ (*it)=(QString::number(newPercentage,10)+"%");
+ leftPercentage-=newPercentage;
+ }
+ }
+ return list;
+}
+
+void VisualFrameEditor::buildInternalTree(const QString &parent){
+ QString line = m_existingStructure.first();
+ if(line.contains("<frameset")) {
+ if(line.contains("rows")) {
+ split(parent,(line.contains(",")+1),HORIZONTAL);
+
+ QRegExp pattern("rows\\s*=\"([\\s\\d%,\\*]*)\"");
+ pattern.search(line);
+
+ QRect dummy=m_internalTree->findNode(parent)->atts()->geometry();
+ QStringList percentages = convertAsterisks(pattern.cap(1),dummy.height());
+
+ int dummyDimension=dummy.height()-cancelledPixels(line.contains(",")+1);
+
+ QPtrList<treeNode> list=m_internalTree->findNode(parent)->childrenList();
+ QPtrListIterator<treeNode> it( list );
+ treeNode *node;
+ while ( (node = it.current()) != 0 ) {
+ ++it;
+ QRect newGeometry(dummy);
+ double newDimension;
+ if(percentages.first().contains("%"))
+ newDimension=(dummyDimension*(percentages.first().remove("%").toInt()))/100.0;
+ else newDimension=(double)percentages.first().toInt();
+ newGeometry.setHeight( proxInt(newDimension) );
+ node->atts()->setGeometry(newGeometry);
+ percentages.pop_front();
+ }
+ }
+ else
+ if(line.contains("cols")) {
+ split(parent,(line.contains(",")+1),VERTICAL);
+ QRegExp pattern("cols\\s*=\"([\\s\\d%,\\*]*)\"");
+ pattern.search(line);
+
+ QRect dummy=m_internalTree->findNode(parent)->atts()->geometry();
+ QStringList percentages = convertAsterisks(pattern.cap(1),dummy.width());
+
+ int dummyDimension=dummy.width()-cancelledPixels(line.contains(",")+1);
+
+ QPtrList<treeNode> list=m_internalTree->findNode(parent)->childrenList();
+ QPtrListIterator<treeNode> it( list );
+ treeNode *node;
+ while ( (node = it.current()) != 0 ) {
+ ++it;
+ QRect newGeometry(dummy);
+ double newDimension;
+ if(percentages.first().contains("%"))
+ newDimension=(dummyDimension*(percentages.first().remove("%").toInt()))/100.0;
+ else newDimension=(double)percentages.first().toInt();
+ newGeometry.setWidth( proxInt(newDimension) );
+ node->atts()->setGeometry(newGeometry);
+ percentages.pop_front();
+ }
+ }
+
+ 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();
+ }
+ }
+ else {
+ QMap<QString,QString> attributeMap;
+ if( line.contains( QRegExp("\\s+noresize") ) ) attributeMap["noresize"] = "noresize";
+ else attributeMap["noresize"] = QString::null;
+
+ QRegExp 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();
+ line.remove(srcPattern);//we don't need to operate on this anymore
+ }
+
+ QRegExp pattern("\\s+(\\w+\\s*=\\s*\"[\\w\\s\\./_\\+\\d]*\")");
+
+ int pos = 0;
+ while ( pos >= 0 ) {
+ pos = pattern.search( line, pos );
+ attributeMap[ pattern.cap(1).section( QRegExp("=\\s*\"") ,0,0) ] = pattern.cap(1).section(QRegExp("=\\s*\""),1,1).remove("\"");
+ if ( pos >= 0 ) pos += pattern.matchedLength();
+ }
+ m_internalTree->findNode(parent)->atts()->setAllAttributes(attributeMap);
+ m_existingStructure.pop_front();
+ }
+}
+
+void VisualFrameEditor::paintEvent ( QPaintEvent * ){
+ hide();
+ delete m_firstInsertedSA;
+ m_firstInsertedSA = 0L;
+
+ QObjectList* splitterList = queryList("QSplitter");
+ for (uint i = 0; i < splitterList->count(); i++) {
+ QObject* o = splitterList->at(i);
+ removeChild(o); //this will delete all childr of "o"
+ }
+
+ delete splitterList;
+ splitterIdNumber = 0;
+ drawGUI( m_internalTree->root(), this);
+ show();
+}
+
+void VisualFrameEditor::removeNode(const QString &l){
+ if( l == m_internalTree->root()->label() ) m_internalTree->reset();//trying to remove root node is equivalent to reinitialize
+ else {
+ QString parentLabel=m_internalTree->findNode(l)->parentLabel();
+ if(m_internalTree->findNode(parentLabel)->countChildren()>=3)
+ m_internalTree->removeChildNode(parentLabel,l,true);
+ else {
+ m_internalTree->removeChildNode(parentLabel,l,true);
+ if( !m_internalTree->findNode(parentLabel)->firstChild()->hasChildren() ){ //final nodes
+ QMap<QString,QString> 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);
+ }
+ else {
+ QPtrList<treeNode> list = m_internalTree->findNode(parentLabel)->firstChild()->childrenList();
+ if( parentLabel != m_internalTree->root()->label() ) {
+ QString grandParentLabel = m_internalTree->findNode(parentLabel)->parentLabel();
+ m_internalTree->removeChildNode( parentLabel,m_internalTree->findNode(parentLabel)->firstChild()->label(),false );
+ m_internalTree->removeChildNode( grandParentLabel ,parentLabel, true );
+ treeNode *node;
+ for ( node = list.first(); node; node = list.next() ) {
+ node->setParentLabel(grandParentLabel);
+ m_internalTree->findNode(grandParentLabel)->addChildNode(node);
+ }
+ }
+ else {
+ m_internalTree->findNode(parentLabel)->setSplitType( m_internalTree->findNode(parentLabel)->firstChild()->splitType() );
+ m_internalTree->removeChildNode( parentLabel,m_internalTree->findNode(parentLabel)->firstChild()->label(),false );
+ treeNode *node;
+ for ( node = list.first(); node; node = list.next() ) {
+ node->setParentLabel(parentLabel);
+ m_internalTree->findNode(parentLabel)->addChildNode(node);
+ }
+ }
+ }
+ }
+ }
+}
+
+void VisualFrameEditor::drawGUI(treeNode *n, QWidget* parent){
+ if(n->hasChildren()) {
+ QString splitterName("splitter"+QString::number(++splitterIdNumber,10));
+ QSplitter *splitter = new QSplitter(parent,splitterName);
+ if(SIZES.contains(splitterName)) splitter->setSizes( SIZES[splitterName] );
+ switch( n->splitType() ){
+ case VERTICAL : splitter->setOrientation(QSplitter::Horizontal);break;
+ case HORIZONTAL : splitter->setOrientation(QSplitter::Vertical);break;
+ default:break;
+ }
+ n->firstChild();
+ while(n->currentChild()) {
+ drawGUI(n->currentChild(),splitter);
+ n->nextChild();
+ }
+ }
+ else {
+ SelectableArea *sa=new SelectableArea(parent,n->label());
+ if(parent->isA("QSplitter")) dynamic_cast<QSplitter *>(parent)->setResizeMode(sa->view(),QSplitter::KeepSize );
+ else
+ if(!m_firstInsertedSA) m_firstInsertedSA = sa;
+ sa->view()->setGeometry(n->atts()->geometry());
+ sa->setIdLabel( n->label() );
+ sa->setSource( n->atts()->src() );
+ connect(sa, SIGNAL(Resized(QRect)), m_internalTree->findNode(sa->idLabel())->atts(), SLOT(setGeometry(QRect)));
+ connect(sa, SIGNAL(selected(const QString &)),this, SIGNAL(areaSelected(const QString &)));
+ }
+}
+
+QString VisualFrameEditor::createFrameTag(areaAttribute *a){
+ QString Src(a->attributeValue("src")),
+ Longdesc(a->attributeValue("longdesc")),
+ Name(a->attributeValue("name")),
+ Scrolling(a->attributeValue("scrolling")),
+ Id(a->attributeValue("id")),
+ Style(a->attributeValue("style")),
+ Title(a->attributeValue("title")),
+ Class(a->attributeValue("class")),
+ Noresize(a->attributeValue("noresize")),
+ Frameborder(a->attributeValue("frameborder")),
+ Marginwidth(a->attributeValue("marginwidth")),
+ Marginheight(a->attributeValue("marginheight"));
+
+ QString tagBegin="<frame",
+ tagEnd,
+ tagMiddle;
+
+ if( !Src.isEmpty() ) {
+ KURL base;
+ base.setPath( Project::ref()->projectBaseURL().path() );
+ KURL u;
+ u.setPath(Src);
+ tagMiddle+= (" src=\"" + QExtFileInfo::toRelative( u, base).path() + "\"");
+ }
+
+ if( !Longdesc.isEmpty() )
+ tagMiddle+= (" longdesc=\""+Longdesc+"\"");
+ //if( !Name.isEmpty() )
+ tagMiddle+=(" name=\""+Name+"\"");
+ if( Scrolling!="auto" && !Scrolling.isEmpty() ) tagMiddle+=(" scrolling=\""+Scrolling+"\"");
+ if( !Id.isEmpty() ) tagMiddle+=(" id=\""+Id+"\"");
+ if( !Style.isEmpty() ) tagMiddle+=(" style=\""+Style+"\"");
+ if( !Title.isEmpty() ) tagMiddle+=(" title=\""+Title+"\"");
+ if( !Class.isEmpty() ) tagMiddle+=(" class=\""+Class+"\"");
+ if( Frameborder=="0" ) tagMiddle+=(" frameborder=\""+Frameborder+"\"");
+ if( Marginwidth!="0" && !Marginwidth.isEmpty() ) tagMiddle+=(" marginwidth=\""+Marginwidth+"\"");
+ if( Marginheight!="0" && !Marginheight.isEmpty()) tagMiddle+=(" marginheight=\""+Marginheight+"\"");
+
+ switch(m_markupLanguage){
+ case HTML: if( Noresize=="noresize" ) tagMiddle+=(" "+Noresize);
+ tagEnd=">\n";break;
+ case XHTML: if( Noresize=="noresize" ) tagMiddle+=(" noresize=\""+Noresize+"\"");
+ tagEnd="/>\n";break;
+ default:;
+ }
+
+ return tagBegin+tagMiddle+tagEnd;
+}
+
+QString VisualFrameEditor::RCvalue(treeNode *n) {
+ QString s;
+ QMap<int,int> dimMap;
+ double percentage = 100.0;
+ int remainingPercentage=100;
+ int child_number = n->countChildren();
+ 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();
+ 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();
+ break;
+ default:break;
+ }
+
+ while( lostPixels > 0) {
+ for(int i=1;i<=child_number;++i){
+ dimMap[i]+=1;
+ lostPixels--;
+ if(lostPixels == 0) break;
+ }
+ }
+
+ for(int i=1;i<=child_number-1;++i) {
+ remainingPercentage-=proxInt(dimMap[i]*percentage);
+ s+=QString::number(proxInt(dimMap[i]*percentage),10);
+ s+="%,";
+ }
+
+ return s+=(QString::number(remainingPercentage,10)+"%");
+}
+
+static QStringList nonFormattedStructure;
+
+void VisualFrameEditor::createStructure(treeNode* n){
+ if(n==m_internalTree->root() && !n->hasChildren()) return;
+ if(n->hasChildren()) {
+ switch( n->splitType() ){
+ case VERTICAL: nonFormattedStructure.append("<frameset cols=\""+RCvalue(n)+"\">\n");break;
+ case HORIZONTAL: nonFormattedStructure.append("<frameset rows=\""+RCvalue(n)+"\">\n");break;
+ default:break;
+ }
+ n->firstChild();
+ while(n->currentChild()){
+ createStructure(n->currentChild());
+ n->nextChild();
+ }
+ nonFormattedStructure.append("</frameset>\n");
+ }
+ else nonFormattedStructure.append(createFrameTag(n->atts()));
+}
+
+QString VisualFrameEditor::formatStructure(){
+ QString s;
+ int tabNum = 0;
+ for ( QStringList::Iterator it = nonFormattedStructure.begin(); it != nonFormattedStructure.end(); ++it ) {
+ if((*it).contains("<frameset")) tabNum++;
+ else
+ if((*it).contains("</frameset>")) {
+ tabNum--;
+ s.truncate(s.length()-1);
+ }
+ s+=*it;
+ for(int i=1;i<=tabNum;i++) s+='\t';
+ }
+ nonFormattedStructure.clear();
+ return s;
+}
+
+QString VisualFrameEditor::framesetStructure() {
+ m_internalTree->refreshGeometries(m_internalTree->root());
+ createStructure(m_internalTree->root());
+ return formatStructure();
+}
+
+void VisualFrameEditor::setMarkupLanguage(const QString& s){
+ if( s.contains("xhtml",false)!=0 ) m_markupLanguage = XHTML;
+ else
+ if( s.contains("html",false)!=0 ) m_markupLanguage = HTML;
+}
+
+#include "visualframeeditor.moc"
diff --git a/quanta/components/framewizard/visualframeeditor.h b/quanta/components/framewizard/visualframeeditor.h
new file mode 100644
index 00000000..4924f3cb
--- /dev/null
+++ b/quanta/components/framewizard/visualframeeditor.h
@@ -0,0 +1,66 @@
+/***************************************************************************
+ visualframeeditor.h - description
+ -------------------
+ begin : mar mar 25 2003
+ copyright : (C) 2003 by gulmini luciano
+ email : gulmini.luciano@student.unife.it
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef VISUALFRAMEEDITOR_H
+#define VISUALFRAMEEDITOR_H
+
+#include "treenode.h"
+#include "selectablearea.h"
+#include <qhbox.h>
+
+/**
+ *@author gulmini luciano
+ */
+
+
+class VisualFrameEditor : public QHBox {
+ Q_OBJECT
+ private:
+ enum MarkupLanguage{XHTML,HTML};
+ tree *m_internalTree;
+ SelectableArea* m_firstInsertedSA;
+ QStringList m_existingStructure;
+ MarkupLanguage m_markupLanguage;
+
+ void buildInternalTree(const QString &parent);
+ void setGeometries(const QString &l);
+ void drawGUI(treeNode *n, QWidget* parent);
+ QStringList convertAsterisks(const QString &s, int d);
+
+ QString createFrameTag(areaAttribute *a);
+ QString formatStructure();
+ QString RCvalue(treeNode *n);
+ void createStructure(treeNode* n);
+
+ public:
+ VisualFrameEditor( QWidget * parent = 0, const char * name = 0);
+ ~VisualFrameEditor();
+ void draw() { repaint(); }
+ void loadExistingStructure(const QStringList &list);
+ QString framesetStructure();
+ void removeNode(const QString &l);
+ void split(const QString &l, int n, SplitType type);
+ void setMarkupLanguage(const QString& s);
+ tree* internalTree() { return m_internalTree;}
+
+ protected:
+ virtual void paintEvent ( QPaintEvent * );
+ signals:
+ void areaSelected(const QString &);
+};
+
+#endif