From 86d2f21a46fd637de3030ed7fc2653dc3a61974f Mon Sep 17 00:00:00 2001 From: Ivan Kosik Date: Mon, 13 May 2013 03:53:52 +0300 Subject: [PATCH 01/71] Work on issue #17. Added energe-based arranger --- sources/kbe/mainwindow.ui | 2 +- sources/kbe/media/translations/lang_en_EN.qm | Bin 0 -> 3360 bytes sources/kbe/media/translations/lang_ru_RU.qm | Bin 0 -> 5151 bytes sources/plugins/scg/arrangers/scgarranger.cpp | 22 +- sources/plugins/scg/arrangers/scgarranger.h | 9 +- .../scg/arrangers/scgarrangerenergybased.cpp | 220 +++++++++++ .../scg/arrangers/scgarrangerenergybased.h | 98 +++++ .../scg/arrangers/scgforcecalculator.cpp | 140 +++++++ .../scg/arrangers/scgforcecalculator.h | 126 +++++++ .../commands/scgcommandminimizecontour.cpp | 53 +++ .../scg/commands/scgcommandminimizecontour.h | 52 +++ .../scg/commands/scgcommandpointschange.cpp | 1 - .../commands/scgcommandremovebreakpoints.cpp | 62 +++ .../commands/scgcommandremovebreakpoints.h | 52 +++ .../scg/media/icons/tool-align-energy.png | Bin 0 -> 5451 bytes .../scg/media/translations/scg_en_EN.qm | Bin 0 -> 7778 bytes .../scg/media/translations/scg_en_EN.ts | 357 ++++++++++++------ .../scg/media/translations/scg_ru_RU.qm | Bin 0 -> 13983 bytes .../scg/media/translations/scg_ru_RU.ts | 357 ++++++++++++------ sources/plugins/scg/scg.pro | 12 +- sources/plugins/scg/scg.qrc | 1 + sources/plugins/scg/scgcontour.cpp | 69 ++++ sources/plugins/scg/scgcontour.h | 11 + sources/plugins/scg/scgplugin.cpp | 2 + sources/plugins/scg/scgscene.cpp | 31 ++ sources/plugins/scg/scgscene.h | 18 + sources/plugins/scg/scgwindow.cpp | 16 +- sources/plugins/scg/scgwindow.h | 2 + 28 files changed, 1457 insertions(+), 256 deletions(-) create mode 100644 sources/kbe/media/translations/lang_en_EN.qm create mode 100644 sources/kbe/media/translations/lang_ru_RU.qm create mode 100644 sources/plugins/scg/arrangers/scgarrangerenergybased.cpp create mode 100644 sources/plugins/scg/arrangers/scgarrangerenergybased.h create mode 100644 sources/plugins/scg/arrangers/scgforcecalculator.cpp create mode 100644 sources/plugins/scg/arrangers/scgforcecalculator.h create mode 100644 sources/plugins/scg/commands/scgcommandminimizecontour.cpp create mode 100644 sources/plugins/scg/commands/scgcommandminimizecontour.h create mode 100644 sources/plugins/scg/commands/scgcommandremovebreakpoints.cpp create mode 100644 sources/plugins/scg/commands/scgcommandremovebreakpoints.h create mode 100644 sources/plugins/scg/media/icons/tool-align-energy.png create mode 100644 sources/plugins/scg/media/translations/scg_en_EN.qm create mode 100644 sources/plugins/scg/media/translations/scg_ru_RU.qm diff --git a/sources/kbe/mainwindow.ui b/sources/kbe/mainwindow.ui index 39245a2..eeb8ec2 100644 --- a/sources/kbe/mainwindow.ui +++ b/sources/kbe/mainwindow.ui @@ -20,7 +20,7 @@ 0 0 600 - 25 + 21 diff --git a/sources/kbe/media/translations/lang_en_EN.qm b/sources/kbe/media/translations/lang_en_EN.qm new file mode 100644 index 0000000000000000000000000000000000000000..da035b063120e14fb3895cc68bb556010c333052 GIT binary patch literal 3360 zcmbW3ZD?Cn7=TaGn~$dHhVG9Y6OPr)bhF92>4sgJ*^jjAvb7!QESr<U)w)Y~ro{Oa+~?pSl~;OifJJA_c+6hg{N2t^1&p{)qDKZnrt1&}&Y z<`vL)A?5P~$kRyqX#>b#P^kPN{C*aNPJ9gV4-}dQKK2ocoO%=F4`|2c;|QS*O&MB? zCeDFA@+q3y@)bhSRp{X3o4~FM&Hs1+q41T!#izc9*k<7R!yKWu%fZyi6<~ilcx2-t zkWaRib3w@Q?Y3_$4eW-L6XWj#A5hLbe+}d(Ag_bGs+@Tt0RCe8$Oy={l==EG zh@S~5j*M;z=a0S!{_YCDykZU5?FgTb{t9u=gwM~O1bH~pb>#uz_DAwpV<5kaT3>$& zJd0i^LEPAy=%wE-19z?cXdPs1xTF2|`yo%%(fRaQ_K@RhI^I3} z5X3(e55JOw{J)6b)3qD?o``Qd1aZ)w_!G~*0d_2Y@l*=NF|NFjb>6a3dcYHiShTv}4R>Dji|O5Zd3M zm4%9EV8O8^i7D-x4<25d=);MP4i(!)7@uKW6^$Ex2H(p_QZ#5bBTZZ<2GjUJca^EC zLAybx;+D#wWeEya)v#rj2D%e{@GUJ>hsh>3;>4zYoVXWfie|R?QDBnx<4j?C@6H^S zb2U29E$OUGmn^G0OZpAQb^NHK=~Zb-m_#zc`!N@sK9)(lR@n@}6_b_+x+_xF`qSw~ zqmdGpWLAn(Nao+PnKa2RO z5z3i`^THIoRAG814LV0ZW><^E#N);s!O2GiBy098{J5Q%y3Iu$=js~eb2wRMu&1Kl zBGTYHv3ViH43oNOSo$0usWNE--XNN=7TpaRjOZ3+c#0T0;l##CgO%+i#01lsBzVkZ zRz(*$IcD}vEZVo$V6ZCXx>(3EFF14$^d`pzQionj{-v=PU$ibzQ-j!hiO#A{3BbFp zGR_u>outO3lmDP8X?4MW&W6R~eMGMila(q9`YBSU2F??+Mj&PlcAG9OUaJUsVH9!F z(pkCJB4(AyRy?P8OSUfE>{-vwM(u+|VN0A!rIy9zhjQLryyHUY3J>0TuH37TQbPIl*O1gfR<;#Mt zY9;jleT5;f5;eR7E>69h4k*;_PDVUv`1p!9xk*`}eua+@3ocDow59JJg@>hSte@~+ zMiZJ`4zznYP{A9DyEzpqtSs062Xw~UYjY7k(48X!&j}khV1i&Nu-hu73gH^HFpLzq zaJG4eQF60PdL!Z7tkb^UP;j)*8;FilsuoE}_r?_G%y}ar_eS<+l{a%j9t zG@nr6@v8sQZ_jhlfR}|v@er{nwuEh#D9))2`q^h(^my9#;yN52n9Z<}-s@exlUWjr zGA4Dx4Ce*W8Z%bEx1n1fJS~LbGaZ){(%WO(1Z{W|!O6TgpiI^%_eR<-1Y%mb`6ZXE-VgLXD literal 0 HcmV?d00001 diff --git a/sources/kbe/media/translations/lang_ru_RU.qm b/sources/kbe/media/translations/lang_ru_RU.qm new file mode 100644 index 0000000000000000000000000000000000000000..d04fe42a8c80ae49318ba6eba4e7998180d4284d GIT binary patch literal 5151 zcmbtYU2I!d9Y0A#EFhDT0F`>bj#6*RvX$Xy%Nj&fZ8jKAjR&5e=3=m9c;sG8e0pe-!fVT2G$Ii7~ z-?l5n@jdsR`~Utvj{G=1_{KjkKl`hDj=pm7yDz`9NJ!hOgwSUQ>3xTg&RIeZ&J(hI z1?vEzS1I;QLf;G!(ibE2?-PXhFOkm7&+z^t>AdtytiK_hR{?+M1nGMI1+0&gPn>?1 z5OTJ+PZE4nV$*_9v$v!#diLNwgE<`%lN8>@4u#qKj{X4SkhfTKy>@T|c5Pe&Yk+ zzlrr4*7xX(Pq%^Y5Y`T?^H{sEzC^E-nQQ!^vUh94j zbRYJ;w)-5`k*>S`umHG)uH-*@!S~LtpND?|#=q;f-+l}7%y(Z&f&U%8?l=DRThJ-@ zJXOYe$4Xz%zs~@U^z}dS13dq+Z?=B`^k3*(9vXq(f9-qeD-T1C5B$FGBw)v9{3q@@ z2R@(o&p);Rv`774`r7w^_f`Mv&xZj2!~Ug*q#kLkQje$m|F-*UP}c<^hfm@S86-h^ zh@PVN(vEjfWR-ug2kJ2bmCKU52tUx4;&V$Gd))<~A zaKA`Tx#SLR<;)5*4Q4ysa!N%{!uOH@nIw#i;hQ9jBmrVm&~X7IXXplY17yl2IS`m+ zV=TFtU}ep+1!xDRB-!2vxG*jVBW+gNIm$}ND}e-d%{j;=)`j>XDc7g=L& zxFFJLT^q(;n$@;+E#qKA6tc{=Qgg$BNj!}^X$cbzOtHYpFbhnx$c`1QUbcjzg;`{4 z`@yvYbM}hb+_0nVI^!wZ9***`E{r^TRPKzWwUlXb2O5Q$VH(;OBI61x8sRKwX_>j< zoZ}S3rh5I2i^mdNHD#x}OLSGOcuRpxQWk_s!~>sp)& zM@o7$qKoK~W(b=lP0KV=IgyWyV^8j{lnOiCVypTdXTi^z5Y`%TU!LVwzGRqXmMCX6 zV~+(h0x@NlYY^k09XRc>xFDRoS+VnbY^fj|3*Z%=HSIdNm@atU)&$$+dY&7+#DcoW zlo}w`MP4|Ztysd&ZWXvw<0p;R;JWc@%(jHTOb2>wKb_n}=!xx^C5MGVq1(hj zws~Q6D<0>F<8tsb95$tvM2M^*J8r#>X9|n>-C|bS>1oj4PA12!+F88M9=h zL#>KH#Nz)f;=Z{T5mncVIS*${<0DJ0tKDv|C8ND>edW?yR!S~F*rUV9Z4r#oA_Xpl%{(rd+Yw( z)bHThBh4KhF*JqvtGD7F)!A80_vAO+f*q|j^jW$Fp_2`i{8dUDP7V#YMfj$4@yC&5 zme?sdUOCeQ>We#;e&71d=~aO?J`B*g4+FGyb0EKxX)7l(&V9E5dg10&t4g#2!HMhi z2x4TmmOrut%&I~-MP;G%iu4&2m17|F^`h?7HmljRz3dalhC>=w^j$t5_#R3%^*QhE6jT5FXu`83l zg+NmarV5sOlO6hYc8^KErk|Yg&4Tr}ADTy7$X%T_0IJy+FTD z?*Z+oa=@I@1X%z#%&1Z)`x7+9H4Z1m=?ay7N4j9YN6CR$R{g4bFdR!Z2r=4 z^F{ao`KIa3@c+Vj$IjF@;p_amlpAMiiBO>Lup?+NC#BGljNc*zvLkk_ss;VCp#~RdNI>TX>bg7 zQ99PON(*drh1p2906>}ps!_L|i|IyD^Gun+W&~wwIl#`kvh+w)H8*%MJPhYuH@~=; z6ep7#BtZ+3im%3g-z|}GZ1rsSL#Yv)Z17cKwIi-XH0^c4s?%|3vS=e*qEQIdcF2 literal 0 HcmV?d00001 diff --git a/sources/plugins/scg/arrangers/scgarranger.cpp b/sources/plugins/scg/arrangers/scgarranger.cpp index 409d7fc..8ca6105 100644 --- a/sources/plugins/scg/arrangers/scgarranger.cpp +++ b/sources/plugins/scg/arrangers/scgarranger.cpp @@ -70,7 +70,7 @@ void SCgArranger::registerCommand(SCgObject* obj, const QPointF& newPos) if(!mParentCommand) mParentCommand = mScene->changeObjectPositionCommand(obj, newPos, 0, false); else - mScene->changeObjectPositionCommand(obj, newPos, mParentCommand, false); + mScene->changeObjectPositionCommand(obj, newPos, mParentCommand, false); } void SCgArranger::registerCommand(SCgPointObject* obj, const QVector& newPoints) @@ -79,7 +79,25 @@ void SCgArranger::registerCommand(SCgPointObject* obj, const QVector& n if(!mParentCommand) mParentCommand = mScene->changeObjectPointsCommand(obj, newPoints, 0, false); else - mScene->changeObjectPointsCommand(obj, newPoints, mParentCommand, false); + mScene->changeObjectPointsCommand(obj, newPoints, mParentCommand, false); +} + +void SCgArranger::registerCommandRemoveBreakPoints(SCgPair *pair) +{ + if (!mParentCommand) { + mParentCommand = mScene->removeBreakPointsCommand(pair, 0, false); + } else { + mScene->removeBreakPointsCommand(pair, mParentCommand, false); + } +} + +void SCgArranger::registerCommandMinimizeContour(SCgContour *contour) +{ + if (!mParentCommand) { + mParentCommand = mScene->minimizeContourCommand(contour, 0, false); + } else { + mScene->minimizeContourCommand(contour, mParentCommand, false); + } } SCgObject* SCgArranger::createGhost(SCgObject* obj, qreal opacityLevel) diff --git a/sources/plugins/scg/arrangers/scgarranger.h b/sources/plugins/scg/arrangers/scgarranger.h index acd1f84..ae2343a 100644 --- a/sources/plugins/scg/arrangers/scgarranger.h +++ b/sources/plugins/scg/arrangers/scgarranger.h @@ -35,7 +35,7 @@ class QGraphicsItem; class SCgBaseCommand; /*! To create new arranger you should implement 4 functions: - * bool userMenu(); + * bool configDialog(); * void startOperation(); * int type(); * QString name(); @@ -73,9 +73,16 @@ Q_OBJECT //! Command for changing node position. void registerCommand(SCgObject* obj, const QPointF& newPos); + //! Command for changing pointObject points. void registerCommand(SCgPointObject* obj, const QVector& newPoints); + //! Command for removing all break points of pairs. + void registerCommandRemoveBreakPoints(SCgPair *pair); + + //! Command for minimizing contour. + void registerCommandMinimizeContour(SCgContour *contour); + //! Deletes all ghosts from scene. void deleteGhosts(); diff --git a/sources/plugins/scg/arrangers/scgarrangerenergybased.cpp b/sources/plugins/scg/arrangers/scgarrangerenergybased.cpp new file mode 100644 index 0000000..b417018 --- /dev/null +++ b/sources/plugins/scg/arrangers/scgarrangerenergybased.cpp @@ -0,0 +1,220 @@ +#include "scgarrangerenergybased.h" + +#include "scgforcecalculator.h" +#include "scgview.h" +#include "scgcontour.h" + +#include +#include + +#include +#include +#include +#include + +#include +//------------------------------------------------------------------------------ +SCgEnergyBasedArranger::SCgEnergyBasedArranger(QObject *parent) + : SCgArranger(parent) + , mDialog(0) + , mSpringRate(1) + , mSpringLength(100) + , mRepulsionFactor(10000) + , mFakeRepulsionFactor(500) + , mShiftFactor(0.3) +{ + mNodes.clear(); + mTimerId = 0; + + mStopTimer = new QTimer(this); + mStopTimer->setInterval(20000); + mStopTimer->setSingleShot(true); + connect(mStopTimer, SIGNAL(timeout()), SLOT(stopTimerTimeout())); + + connect(&mFutureWatcher, SIGNAL(finished()), SLOT(forceCalculationFinished())); +} +//------------------------------------------------------------------------------ +SCgEnergyBasedArranger::~SCgEnergyBasedArranger() +{ +} +//------------------------------------------------------------------------------ +bool SCgEnergyBasedArranger::configDialog() +{ + if (!mDialog) { + createDialog(); + } + mDialog->setParent(mView->viewport(), Qt::Dialog); + bool res = mDialog->exec() == QDialog::Accepted; + + mDialog->setParent(0, Qt::Dialog); + + return res; +} +//------------------------------------------------------------------------------ +void SCgEnergyBasedArranger::startOperation() +{ + // Get selected SCgObjects: + mNodes.clear(); + mPairs.clear(); + mBusses.clear(); + mContours.clear(); + foreach (QGraphicsItem *selectedItem, mView->scene()->selectedItems()) { + if (SCgObject::isSCgObjectType(selectedItem->type())) { + if (selectedItem->type() == SCgNode::Type) { + SCgNode *node = static_cast(selectedItem); + + registerCommand(node, node->pos()); + + mNodes.append(node); + } + if (selectedItem->type() == SCgPair::Type) { + SCgPair *pair = static_cast(selectedItem); + + // Remove all pair break points: + registerCommandRemoveBreakPoints(pair); + + mPairs.insert(pair); + } else if (selectedItem->type() == SCgBus::Type) { + mBusses.insert(static_cast(selectedItem)); + } else if (selectedItem->type() == SCgContour::Type) { + SCgContour *contour = static_cast(selectedItem); + + // Minimize contour: + registerCommandMinimizeContour(contour); + + mContours.insert(contour); + } + } + } + + if (mTimerId == 0) { + mStopTimer->start(); + mTimerId = startTimer(1000 / 40); + } +} +//------------------------------------------------------------------------------ +QDialog * SCgEnergyBasedArranger::createDialog() +{ + mDialog = new QDialog(); + mDialog->setWindowTitle(tr("Energy-based Arranger Parameters")); + + + QLabel *springRateLabel = new QLabel(tr("Spring rate:"), mDialog); + mSpringRateSpinBox = new QDoubleSpinBox(mDialog); + mSpringRateSpinBox->setMaximum(100); + mSpringRateSpinBox->setValue(mSpringRate); + mSpringRateSpinBox->setToolTip(tr("Spring rate")); + + QLabel *springLengthLabel = new QLabel(tr("Spring length:"), mDialog); + mSpringLengthSpinBox = new QDoubleSpinBox(mDialog); + mSpringLengthSpinBox->setMaximum(10000); + mSpringLengthSpinBox->setValue(mSpringLength); + mSpringLengthSpinBox->setToolTip(tr("Natural spring length")); + + QLabel *repulsionFactorLabel = new QLabel(tr("Node repulsion factor:"), mDialog); + mRepulsionFactorSpinBox = new QDoubleSpinBox(mDialog); + mRepulsionFactorSpinBox->setMaximum(100000000); + mRepulsionFactorSpinBox->setValue(mRepulsionFactor); + mRepulsionFactorSpinBox->setToolTip(tr("Repulsive force factor between real nodes")); + + QLabel *fakeRepulsionFactorLabel = new QLabel(tr("Fake node repulsion factor:"), mDialog); + mFakeRepulsionFactorSpinBox = new QDoubleSpinBox(mDialog); + mFakeRepulsionFactorSpinBox->setMaximum(50000); + mFakeRepulsionFactorSpinBox->setValue(mFakeRepulsionFactor); + mFakeRepulsionFactorSpinBox->setToolTip(tr("Repulsive force factor between real and fake nodes")); + + QLabel *shiftFactorLabel = new QLabel(tr("Shift factor:")); + mShiftFactorSpinBox = new QDoubleSpinBox(mDialog); + mShiftFactorSpinBox->setMaximum(30); + mShiftFactorSpinBox->setValue(mShiftFactor); + mShiftFactorSpinBox->setToolTip(tr("Shift force factor")); + + + QFormLayout *formLayout = new QFormLayout; + formLayout->addRow(springRateLabel, mSpringRateSpinBox); + formLayout->addRow(springLengthLabel, mSpringLengthSpinBox); + formLayout->addRow(repulsionFactorLabel, mRepulsionFactorSpinBox); + formLayout->addRow(fakeRepulsionFactorLabel, mFakeRepulsionFactorSpinBox); + formLayout->addRow(shiftFactorLabel, mShiftFactorSpinBox); + + + QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok + | QDialogButtonBox::Cancel); + connect(buttonBox, SIGNAL(accepted()), mDialog, SLOT(accept())); + connect(buttonBox, SIGNAL(rejected()), mDialog, SLOT(reject())); + buttonBox->setParent(mDialog); + formLayout->addRow(buttonBox); + + mDialog->setLayout(formLayout); + return mDialog; +} +//------------------------------------------------------------------------------ +QString SCgEnergyBasedArranger::name() const +{ + return tr("Energy-based arrange"); +} +//------------------------------------------------------------------------------ +void SCgEnergyBasedArranger::timerEvent(QTimerEvent *event) +{ + Q_UNUSED(event); + + + Parameters parameters(mSpringRateSpinBox->value(), mSpringLengthSpinBox->value(), + mRepulsionFactorSpinBox->value(), + mFakeRepulsionFactorSpinBox->value()); + QFuture future = QtConcurrent::mapped(mNodes, SCgForceCalculator(mNodes, + mPairs, mBusses, parameters)); + mFutureWatcher.setFuture(future); +} +//------------------------------------------------------------------------------ +void SCgEnergyBasedArranger::stopTimerTimeout() +{ + if (mTimerId != 0) { + //%qDebug() << "Timer was stopped after 20 000 ms"; + killTimer(mTimerId); + registerMoving(); + mTimerId = 0; + } +} +//------------------------------------------------------------------------------ +void SCgEnergyBasedArranger::forceCalculationFinished() +{ + const QList forces = mFutureWatcher.future().results(); + QListIterator it(forces); + qint32 index = 0; + bool objectsMoved = false; + while (it.hasNext()) { + const Force &force = it.next(); + // If force isn't nearly 0, then move node: + if (qAbs(force.mX) > 1 || qAbs(force.mY) > 1) { + mNodes.at(index)->moveBy(force.mX * mShiftFactorSpinBox->value(), + force.mY * mShiftFactorSpinBox->value()); + //%mNodes.at(index)->updateConnected();//%? + objectsMoved = true; + } + ++index; + } + + foreach (SCgContour *contour, mContours) { + contour->minimize(); + } + + if (!objectsMoved) { + killTimer(mTimerId); + //%qDebug() << "Objects aren't moving. Timer was killed."; + registerMoving(); + mTimerId = 0; + mStopTimer->stop(); + } +} +//------------------------------------------------------------------------------ +void SCgEnergyBasedArranger::registerMoving() +{ + foreach (SCgNode *node, mNodes) { + registerCommand(node, node->pos()); + } + foreach (SCgContour *contour, mContours) { + registerCommand(contour, contour->scenePoints()); + } +} +//------------------------------------------------------------------------------ diff --git a/sources/plugins/scg/arrangers/scgarrangerenergybased.h b/sources/plugins/scg/arrangers/scgarrangerenergybased.h new file mode 100644 index 0000000..754b445 --- /dev/null +++ b/sources/plugins/scg/arrangers/scgarrangerenergybased.h @@ -0,0 +1,98 @@ +#ifndef SCGARRANGERENERGYBASED_H +#define SCGARRANGERENERGYBASED_H + +#include "scgarranger.h" + +#include + +class QDoubleSpinBox; + +struct Force; +//------------------------------------------------------------------------------ +class SCgEnergyBasedArranger : public SCgArranger +{ + Q_OBJECT + +public: + enum + { + Type = 5 + }; + + explicit SCgEnergyBasedArranger(QObject *parent = 0); + virtual ~SCgEnergyBasedArranger(); + + //! @see SCgArranger::type(). + int type() const {return Type;} + +protected: + //! @see SCgArranger::configDialog() + bool configDialog(); + + //! @see SCgArranger::startOperation() + void startOperation(); + + //! Holds dialog window, shown to user. + //! @see SCgArrangerEnergyBased::createDialog() + QDialog *mDialog; + + //! Creates dialog for asking energy-based arrange parameters. + QDialog * createDialog(); + + //! @see SCgArranger::name + QString name() const; + + //! Recalculates forces and moves objects each 25 ms. + void timerEvent(QTimerEvent *event); + + /*! @defgroup EnergyBasedPars Energy-based arranger parameters + * @{ + */ + double mSpringRate; + double mSpringLength; + double mRepulsionFactor; + double mFakeRepulsionFactor; + double mShiftFactor; + + QDoubleSpinBox *mSpringRateSpinBox; + QDoubleSpinBox *mSpringLengthSpinBox; + QDoubleSpinBox *mRepulsionFactorSpinBox; + QDoubleSpinBox *mFakeRepulsionFactorSpinBox; + QDoubleSpinBox *mShiftFactorSpinBox; + /*! @}*/ + +private: + //! Register undo/redo commands for object moving. + void registerMoving(); + + //! Nodes which were selected during the operation start. + QList mNodes; + + //! SCgPairs which were selected during the operation start. + QSet mPairs; + + //! SCgBusses which were selected during the operation start. + QSet mBusses; + + //! SCgContours which were selected during the operation start. + QSet mContours; + + //! Timer id which calls timerEvent every 25 ms. + qint32 mTimerId; + + //! Timer which stops the arranging after 20 s. + QTimer *mStopTimer; + + //! Allows monitoring a QFuture using signals and slots. + //! @see SCgArrangerEnergyBased::forceCalculationFinished() + QFutureWatcher mFutureWatcher; + +private slots: + //! Stops the arranging. + void stopTimerTimeout(); + + //! Process results of multithread execution. + void forceCalculationFinished(); +}; +//------------------------------------------------------------------------------ +#endif // SCGARRANGERENERGYBASED_H diff --git a/sources/plugins/scg/arrangers/scgforcecalculator.cpp b/sources/plugins/scg/arrangers/scgforcecalculator.cpp new file mode 100644 index 0000000..c9b2156 --- /dev/null +++ b/sources/plugins/scg/arrangers/scgforcecalculator.cpp @@ -0,0 +1,140 @@ +#include "scgforcecalculator.h" + +#include + +const double minDistance = 10; // Minimal distance between nodes. It's used at calculation. +// (It's influence fast leap of nodes). +//------------------------------------------------------------------------------ +SCgForceCalculator::SCgForceCalculator(const QList &nodes, + const QSet &pairs, const QSet &busses, + Parameters parameters) + : mNodes(nodes), mPairs(pairs), mBusses(busses), mParameters(parameters) +{ +} +//------------------------------------------------------------------------------ +Force SCgForceCalculator::operator()(const SCgNodeP &node) const +{ + Force force; + addInteractionWithRealNodes(node, force); + addInteractionWithPairs(node, force); + addInteractionWithFakePairNodes(node, force); + addInteractionWithFakeBusNodes(node, force); + + return force; +} +//------------------------------------------------------------------------------ +void SCgForceCalculator::addInteractionWithRealNodes(const SCgNode *node, + Force &force) const +{ + foreach (SCgNode *curNode, mNodes) { + if (curNode != node) { + // Coordinates of other node: + qreal x2 = curNode->scenePos().x(); + qreal y2 = curNode->scenePos().y(); + + // Calculate distance between nodes: + qreal x1 = node->scenePos().x(); + qreal y1 = node->scenePos().y(); + double distance = calculateDistance(x1, y1, x2, y2); + + // Add interaction force. + if (distance < minDistance) { + distance = minDistance; // Need to avoid fast leaps of nodes and devision by zero. + } + force.mX += mParameters.mRepulsionFactor * (x1 - x2) / qPow(distance, 3); + force.mY += mParameters.mRepulsionFactor * (y1 - y2) / qPow(distance, 3); + } + } +} +//------------------------------------------------------------------------------ +void SCgForceCalculator::addInteractionWithPairs(const SCgNode *node, + Force &force) const +{ + foreach (SCgObject *object, node->connectedObjects()) { + if (object->type() == SCgPair::Type) { + SCgPair *pair = static_cast(object); + + // x1, y1 - coodinates of pair end, which connected with node. + // x2, y2 - other end of pair: + qreal x1, y1, x2, y2; + if (pair->beginObject() == node) { + x2 = pair->scenePoints().last().x(); + y2 = pair->scenePoints().last().y(); + x1 = pair->scenePoints().first().x(); + y1 = pair->scenePoints().first().y(); + } else { + x2 = pair->scenePoints().first().x(); + y2 = pair->scenePoints().first().y(); + x1 = pair->scenePoints().last().x(); + y1 = pair->scenePoints().last().y(); + } + + // Calculate length of pair: + double distance = calculateDistance(x1, y1, x2, y2); + + // Add interaction force. + if (distance < minDistance) { + distance = minDistance; // Need to avoid fast leaps of nodes and devision by zero. + } + force.mX -= mParameters.mSpringRate * (distance - mParameters.mSpringLength) + * (x1 - x2) / distance; + force.mY -= mParameters.mSpringRate * (distance - mParameters.mSpringLength) + * (y1 - y2) / distance; + } + } +} +//------------------------------------------------------------------------------ +void SCgForceCalculator::addInteractionWithFakePairNodes(const SCgNode *node, + Force &force) const +{ + foreach (SCgPair *pair, mPairs) { + // Calculate coordinates of fake node (middle of the pair): + qreal fakeX = (pair->scenePoints().last().x() + pair->scenePoints().first().x()) / 2; + qreal fakeY = (pair->scenePoints().last().y() + pair->scenePoints().first().y()) / 2; + + addInteractionWithFakeNodes(node, force, fakeX, fakeY); + } +} +//------------------------------------------------------------------------------ +void SCgForceCalculator::addInteractionWithFakeBusNodes(const SCgNode *node, + Force &force) const +{ + foreach (SCgBus *bus, mBusses) { + // Calculate coordinates of fake node and add interection with this one: + // on the middle of the bus: + qreal fakeX = (bus->scenePoints().last().x() + bus->scenePoints().first().x()) / 2; + qreal fakeY = (bus->scenePoints().last().y() + bus->scenePoints().first().y()) / 2; + addInteractionWithFakeNodes(node, force, fakeX, fakeY); + // on the end of the bus: + fakeX = bus->scenePoints().last().x(); + fakeY = bus->scenePoints().last().y(); + addInteractionWithFakeNodes(node, force, fakeX, fakeY); + } +} +//------------------------------------------------------------------------------ +void SCgForceCalculator::addInteractionWithFakeNodes(const SCgNode *node, + Force &force, qreal fakeX, qreal fakeY) const +{ + // Calculate distance between the node and a fake node: + qreal nodeX = node->scenePos().x(); + qreal nodeY = node->scenePos().y(); + double distance = calculateDistance(nodeX, nodeY, fakeX, fakeY); + + // Add interaction force with the fake node: + if (distance < minDistance) { + distance = minDistance; // Need to avoid fast leaps of nodes and devision by zero. + } + force.mX += mParameters.mFakeRepulsionFactor * (nodeX - fakeX) / qPow(distance, 3); + force.mY += mParameters.mFakeRepulsionFactor * (nodeY - fakeY) / qPow(distance, 3); +} +//------------------------------------------------------------------------------ +double calculateDistance(QPointF p1, QPointF p2) +{ + return qSqrt(qPow(p2.x() - p1.x(), 2) + qPow(p2.y() - p1.y(), 2)); +} +//------------------------------------------------------------------------------ +double calculateDistance(qreal x1, qreal y1, qreal x2, qreal y2) +{ + return qSqrt(qPow(x2 - x1, 2) + qPow(y2 - y1, 2)); +} +//------------------------------------------------------------------------------ diff --git a/sources/plugins/scg/arrangers/scgforcecalculator.h b/sources/plugins/scg/arrangers/scgforcecalculator.h new file mode 100644 index 0000000..2445ed7 --- /dev/null +++ b/sources/plugins/scg/arrangers/scgforcecalculator.h @@ -0,0 +1,126 @@ +#ifndef FORCECALCULATOR_H +#define FORCECALCULATOR_H + +#include "scgnode.h" +#include "scgpair.h" +#include "scgbus.h" + +#include +#include + +typedef SCgNode * SCgNodeP; +//------------------------------------------------------------------------------ +//! Force are influencing object. +struct Force +{ + explicit Force(double x = 0, double y = 0) : mX(x), mY(y) {} + + //! Force along the X axis. + double mX; + //! Force along the Y axis. + double mY; +}; +//------------------------------------------------------------------------------ +//! Energy-based arranger parameters. +struct Parameters +{ + explicit Parameters(double springRate = 1, double springLength = 100, + double repulsionFactor = 10000, + double fakeRepulsionFactor = 500) + : mSpringRate(springRate), mSpringLength(springLength), + mRepulsionFactor(repulsionFactor), + mFakeRepulsionFactor(fakeRepulsionFactor) {} + + double mSpringRate; + double mSpringLength; + double mRepulsionFactor; + double mFakeRepulsionFactor; +}; +//------------------------------------------------------------------------------ +class SCgForceCalculator +{ +public: + SCgForceCalculator(const QList &nodes, + const QSet &pairs, const QSet &busses, + Parameters parameters); + + typedef Force result_type; + + //! Calculate force which influences node. + /*! + * @p node - SCgNode for that method calculate force. + * @return force which influences node. + */ + Force operator()(const SCgNodeP &node) const; + +private: + //! Add force of interaction node with other real nodes. + /*! + * @p node - SCgNode for which we calculate the force. + * @p force - current force which influences node. + */ + void addInteractionWithRealNodes(const SCgNode *node, Force &force) const; + + //! Add force which influences node because of connected pairs. + /*! + * @p node - SCgNode for which we calculate the force. + * @p force - current force which influences node. + */ + void addInteractionWithPairs(const SCgNode *node, Force &force) const; + + //! Add force of interaction node with fake nodes (they are located in middle of pairs). + /*! + * @p node - SCgNode for which we calculate the force. + * @p force - current force which influences node. + */ + void addInteractionWithFakePairNodes(const SCgNode *node, Force &force) const; + + //! Add force of interaction node with fake nodes (they are located in middle and end of busses). + /*! + * @p node - SCgNode for which we calculate the force. + * @p force - current force which influences node. + */ + void addInteractionWithFakeBusNodes(const SCgNode *node, Force &force) const; + + //! Add force of interaction node with fake node. + /*! + * @p node - SCgNode for which we calculate the force. + * @p force - current force which influences node. + * @p fakeX - X coordinate of fake node. + * @p fakeY - Y coordinate of fake node. + */ + void addInteractionWithFakeNodes(const SCgNode *node, Force &force, + qreal fakeX, qreal fakeY) const; + + //! Nodes are selected for arranging. + const QList mNodes; + + //! Pairs are selected for arranging. + const QSet mPairs; + + //! Busses are selected for arranging. + const QSet mBusses; + + //! Parameters for energe-based arranging. + Parameters mParameters; +}; +//------------------------------------------------------------------------------ +//! Calculate distance between two points. +/*! + * @p p1 - first point. + * @p p2 - second point. + * @return distance between the points. + */ +inline double calculateDistance(QPointF p1, QPointF p2); +//------------------------------------------------------------------------------ +//! Calculate distance between two points. +/*! + * @p x1 - X coordinate of the first point. + * @p y1 - Y coordinate of the first point. + * @p x2 - X coordinate of the second point. + * @p y2 - Y coordinate of the second point. + * @return distance between the points. + */ +inline double calculateDistance(qreal x1, qreal y1, qreal x2, qreal y2); +//------------------------------------------------------------------------------ +#endif // FORCECALCULATOR_H diff --git a/sources/plugins/scg/commands/scgcommandminimizecontour.cpp b/sources/plugins/scg/commands/scgcommandminimizecontour.cpp new file mode 100644 index 0000000..508e843 --- /dev/null +++ b/sources/plugins/scg/commands/scgcommandminimizecontour.cpp @@ -0,0 +1,53 @@ +/* +----------------------------------------------------------------------------- +This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) +For the latest info, see http://www.ostis.net + +Copyright (c) 2010 OSTIS + +OSTIS 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 3 of the License, or +(at your option) any later version. + +OSTIS is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with OSTIS. If not, see . +----------------------------------------------------------------------------- +*/ + +#include "scgcommandminimizecontour.h" + +#include "scgcontour.h" + +SCgCommandMinimizeContour::SCgCommandMinimizeContour(SCgScene *scene, + SCgContour *contour, + QUndoCommand *parent) + : SCgBaseCommand(scene, contour, parent) + , mOldPoints(contour->scenePoints()) + , mNewPoints(contour->minimizedPoints()) +{ + setText(QObject::tr("Minimize contour's size")); +} + +SCgCommandMinimizeContour::~SCgCommandMinimizeContour() +{ +} + +void SCgCommandMinimizeContour::redo() +{ + SCgBaseCommand::redo(); + + static_cast(mObject)->setPoints(mNewPoints); +} + +void SCgCommandMinimizeContour::undo() +{ + static_cast(mObject)->setPoints(mOldPoints); + + SCgBaseCommand::undo(); +} diff --git a/sources/plugins/scg/commands/scgcommandminimizecontour.h b/sources/plugins/scg/commands/scgcommandminimizecontour.h new file mode 100644 index 0000000..91e8e88 --- /dev/null +++ b/sources/plugins/scg/commands/scgcommandminimizecontour.h @@ -0,0 +1,52 @@ +/* +----------------------------------------------------------------------------- +This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) +For the latest info, see http://www.ostis.net + +Copyright (c) 2010 OSTIS + +OSTIS 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 3 of the License, or +(at your option) any later version. + +OSTIS is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with OSTIS. If not, see . +----------------------------------------------------------------------------- +*/ + +#ifndef SCGCOMMANDMINIMIZECONTOUR_H +#define SCGCOMMANDMINIMIZECONTOUR_H + +#include "scgbasecommand.h" + +//! Command for minimizing contour size. +class SCgCommandMinimizeContour : public SCgBaseCommand +{ +public: + /*! Constructor + @param scene Pointer to SCgScene that will be used for command working + @param contour Contour which will be minimized + @param parent Pointer to parent command. @see QUndoCommand() + */ + explicit SCgCommandMinimizeContour(SCgScene *scene, + SCgContour *contour, + QUndoCommand *parent = 0); + + virtual ~SCgCommandMinimizeContour(); + +protected: + void redo(); + void undo(); + +private: + QVector mOldPoints; + QVector mNewPoints; +}; + +#endif // SCGCOMMANDMINIMIZECONTOUR_H diff --git a/sources/plugins/scg/commands/scgcommandpointschange.cpp b/sources/plugins/scg/commands/scgcommandpointschange.cpp index 59ae638..1e1e6fa 100644 --- a/sources/plugins/scg/commands/scgcommandpointschange.cpp +++ b/sources/plugins/scg/commands/scgcommandpointschange.cpp @@ -45,7 +45,6 @@ SCgCommandPointsChange::SCgCommandPointsChange(SCgScene* scene, SCgCommandPointsChange::~SCgCommandPointsChange() { - } void SCgCommandPointsChange::redo() diff --git a/sources/plugins/scg/commands/scgcommandremovebreakpoints.cpp b/sources/plugins/scg/commands/scgcommandremovebreakpoints.cpp new file mode 100644 index 0000000..009395c --- /dev/null +++ b/sources/plugins/scg/commands/scgcommandremovebreakpoints.cpp @@ -0,0 +1,62 @@ +/* +----------------------------------------------------------------------------- +This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) +For the latest info, see http://www.ostis.net + +Copyright (c) 2010 OSTIS + +OSTIS 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 3 of the License, or +(at your option) any later version. + +OSTIS is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with OSTIS. If not, see . +----------------------------------------------------------------------------- +*/ + +#include "scgpair.h" +#include "scgcontour.h" + +#include "scgcommandremovebreakpoints.h" + +SCgCommandRemoveBreakPoints::SCgCommandRemoveBreakPoints(SCgScene *scene, + SCgPair *pair, + QUndoCommand *parent) + : SCgBaseCommand(scene, pair, parent) + , mOldPoints(pair->scenePoints()) + , mOldBeginDot(pair->beginDot()) + , mOldEndDot(pair->endDot()) +{ + setText(QObject::tr("Remove pair's break points")); +} + +SCgCommandRemoveBreakPoints::~SCgCommandRemoveBreakPoints() +{ +} + +void SCgCommandRemoveBreakPoints::redo() +{ + SCgBaseCommand::redo(); + + SCgPair *pair = static_cast(mObject); + QVector newPoints; + newPoints << pair->scenePoints().first() + << pair->scenePoints().last(); + static_cast(mObject)->setPoints(newPoints); +} + +void SCgCommandRemoveBreakPoints::undo() +{ + static_cast(mObject)->setPoints(mOldPoints); + + static_cast(mObject)->setBeginDot(mOldBeginDot); + static_cast(mObject)->setEndDot(mOldEndDot); + + SCgBaseCommand::undo(); +} diff --git a/sources/plugins/scg/commands/scgcommandremovebreakpoints.h b/sources/plugins/scg/commands/scgcommandremovebreakpoints.h new file mode 100644 index 0000000..a21fd7c --- /dev/null +++ b/sources/plugins/scg/commands/scgcommandremovebreakpoints.h @@ -0,0 +1,52 @@ +/* +----------------------------------------------------------------------------- +This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) +For the latest info, see http://www.ostis.net + +Copyright (c) 2010 OSTIS + +OSTIS 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 3 of the License, or +(at your option) any later version. + +OSTIS is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with OSTIS. If not, see . +----------------------------------------------------------------------------- +*/ + +#include "scgbasecommand.h" + +#ifndef SCGCOMMANDREMOVEBREAKPOINTS_H +#define SCGCOMMANDREMOVEBREAKPOINTS_H + +//! Command for removing break points of pairs. +class SCgCommandRemoveBreakPoints : public SCgBaseCommand +{ +public: + /*! Constructor + @param scene Pointer to SCgScene that will be used for command working + @param pair Pair which will be removed break points + @param parent Pointer to parent command. @see QUndoCommand() + */ + explicit SCgCommandRemoveBreakPoints(SCgScene *scene, + SCgPair *pair, + QUndoCommand *parent = 0); + virtual ~SCgCommandRemoveBreakPoints(); + +protected: + void redo(); + void undo(); + +private: + double mOldEndDot; + double mOldBeginDot; + QVector mOldPoints; +}; + +#endif // SCGCOMMANDREMOVEBREAKPOINTS_H diff --git a/sources/plugins/scg/media/icons/tool-align-energy.png b/sources/plugins/scg/media/icons/tool-align-energy.png new file mode 100644 index 0000000000000000000000000000000000000000..340fafdedb64c0aac8b656a61cb6db417a778fe1 GIT binary patch literal 5451 zcmV-R6}0M!P)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D6yQljK~!i%&02R< zTW7L==bg8^SsQHAJ3YizOT7O3U7cgk8Gq-yNE+YYotfXv+JQ&SV8cYnCPfA@}@j8q<*!3d`M5^*G=m#3?f{W5F& zWlNoG9c`>^mo8dnztqvw1w+F7MsNff$(g14vf7Hey*u_@y>M-Kco>Y$%q+OhB7zFo z`0(J4EnV5^DS*et!PeE$&KrjzczFc);aQ=ya1Kkz=ZV52`Rs5;5Q{+z^COZ07}gy} zzz{)Q9o&2gej2&9zP|p(jT?wfO9?7qx2|6k@WLo$5}g_l=;sp}LYQ)a}D6Jtki6UM9B^b3lED>tJUr8?M9<}u-KenI+q?2>__(T#DIExc;Q_= z=wvD{gzb+fxw*K@r1Iwjzb)9cgrEWj6n*>l57}86o*r&Kc$|leGseZm)7jbH&SvQn zt0jy6x^(fPCGWgr_2)m^SzBYBT^KZ4IGZitaM<)v0f(0wpPZGF5hIdN0;tqL+TGjt z7OYxAPy(Afa^y%%OpMLaWlOBA-JM;W?Ce2ZVdLNkE6x++&1UvWVL9qjr9`yWj2ns zc1}xdLi{O0E?vVl=Rm6#?9-yYAb34Tp`BQ%h}P*+nbc0o_XQIB`|3+S!OCj>#-f% zw)^{$6*9R_8(UFUUZgi@)f%NzotT(xFchz7@7S?z=dP_g+ZtQ*GIL9E3(5-&#rcIQ zseU>xIX;dpg-T05F{@E|f*927u<9OE#!WZysrgT-Qn zz5DKQV2-yU6lbUBy7wRSA(Hr9K?FaN&EUx-s??;+lA_YOn);@O#`Wt~tyR8dfZR_UujvqO&e|KAJLq&N}YN{?LJ8j+C4$$13bT*4l zBw$EB;8=GTSNHgYqzAt|1e@j?AC|~6w4wO>Z!f?<+%R5ddQL@IbwO^CNFbpH2MQuM zf(UMOlu#5Y2&IPrqd>S)XjFnX(caO))!oethYewb#>VNy(NRv$t{g7^#?4z`(j1C! z9N3g;5>Dd6ci*?SE>BHPgXSoJOohhJ*B9&OhjVhYS+>;L(cZzu$sLFB_Qv~}n=Lw% zA0DZTOUla5-?Vvq&-)+M)HdP?-WV_3k)y{D#(xVuhTIjMo%{J;KOH`Jq^zVoBP}~6 zDV@h?lOi}jUjR&HFou4`l0w*3c={PX<9pMHMy@X@pP&wL_`l!Syb z$^L=cckDudneU~d7F58Ho4zjxe?M~QurylY>*ELNP4Mw>b9Z-j!($0BKEkX8yeABg zg4{dQef03bcTb+^xpJxR!grV3TRXtXp6*ybazL~s=Diaq5%MtKHbyOIJvKZvSYKBY z!4D_<`nfv0fnqT@S|B5c5*ixJh63$P@bz%>bar%cw0H8s5~Bs;ilVZ$D^@qxHj4N{ zX!C;uXpy3*m8;g=x_uWcnz6m{P@J7HO^lDmNTX@gKp0+>as>n)B%4Z>6sJu~(50yr zIv|y{me$&uDz!?Xk;u|?3AH8VImu~^KpKoN(Cp`>W>i#G_kQu!#C-evb^x0vF(_rs zV1_zcUac>yGgLGcSH(&-a$$^0tWb*Nx)^P`E)@=geQEwa0e(cXhqEW%lgJEaDTU%B<{PiiALwb(!@p%eCC+Ko)z7roA8r`;KdwNouIz|~0#-|4cL95~Ah6M!- z^Dqbm43X&N4P6M-akVlQ@~x@9t)qQSc1B@1R~)BH+O>1vq{-~5x1v`BQZ!AN8UOa} zyN3@SZC~DDC@M)#NlQpcS7>xFrfB1nbcrb$Ir)atiu&fZ^&2+s-FM)F56@n_bPZVX z@sr;!Ug|3=t4mAG%1F<-ed|7$go|a7rxU1v&6p-lW8(k}F7lYkc>lpq-}hhr{M&DO z&YeB=$;W3t`xG{3zxwj~{=TcXZ{7Iu{>z~eqiJe-X3l7WpU%RsKzHoir`5!V^CP}EMenEQ z>MJX?a=A<_4)zNGDtBIL>$1$w+rtaSuy}>Ky{_>ey-Tyl%UJ8Ik>blzdavluCL>VGQ8bAZ2t5YoSmbeCytE4Qwbyr z-Un7V#5%b6dl9tKnAV#5t?N2FJ64w$6w4zeL^r&I9|fpBJ=Z%i4z#gg8NHy+v64GL7h(2X(~&LS{v&sN(>2!sfkHx1%<^zL6o0w zpgcxZT3oSVUDxNIeK|I2nx2}US?1P^fRLZz$3m z;&j@Ga9%i{%ja=mg`Oi;tCmWlC{(%^mPqmq2%)poDqU4YEwqbWom;->{bmMy560k1 zSxC@&Y|?0c?Ehu&7iA@-332ghDXH=p8I=}HAo}=_{D|HpFDxF5Bfww+hXP?#RJ1HE zJ{e-Kt+k`Fye3|kBoanfB5k6wJUvxx)0}M*b z8PJ~|{Cx59rIW|sYinxO=j9jX=2exIujyEMV9(x9KKKwmeK|Y?ie%>4$mprRo#b)2 zR09*4gan6Tu~;gVs?+IOn_D(*?5Zp+6AOd_9zP`| zt-Jfs^XFz(giw6*z(9Z!fg6G7$z*auLP9}7K~hpuZFSv>_Kr;(H^TtBxogYD4P9_p zQC3-8Tnt}mX=wpqu^KIh$x_P|)#VlI)@^|7nzv@53_}kLVfuN5VWMEthKd$)v7fO4NW;Yd6AJ~3WY`uq;c3>twNKXmQ|Qjuzr2#@UXd! zLdNH}!ehv^J2*JFWy=<=R+};}N(Ho3A{eoPXrVxNpd=rEH&=|iyQi-&nZ*jzsI=hK zEuEViYZ_!xG3DizJw0b$ym$$w7Vep%77GA_iUgbc_wRRhc7n&`ayg653#KzcnJg}c z8v&h^Os>{w<8!hL>g$@fZQXUI=c8*^uD^ITc<095u63L8@(QY|YQFjApI~Qf45m8^ z2r6Jm93oDG^_O3M>Fw>^wQJYvHJvLu);2XSud8o?751CA>^ykr7&N;ubPc{3nJ*OZ zo4HxjT;HXBy}l?eE@A7|?Us5@3u2iZL+TR9*w`2}M5AMq6ULdL;fcYQW8)LkMiaCk z=ERwTZ$Y8{qj1l`;ndv7i&02FktnLEspTyq4}kRQbzWddC;;F(m_cB^f~NM??YsBx z|L<>uFCIS|7#tZMnJ`WOiOz#E&O2v(+z3Q3kx1xtdUJF0(9jTKXWkwvK?Mv6LJ)8i ztS}(<_xG<|yEZ2)ABK?tGBq%e3N)xtDb-qyEKdEtn#v5N5@8fGC{!g?w70hdqkJYKj`t*Wf9Dm3VeOUlyHGs7c<(Dg<~OQHFI1~NG@rL?pZhE%YF zuiCh>JEf7ZqF+=@>sKG2oFpDJsKq^&S zQgUr$Q&V$md_q!``46g(KmHhu03?gVA&3QX44LGi|A4mL#l^nlnkLL=59`>7`OPHc zPQk>Oand;T@RvuYPxch%>sbso@FWCqPfrix`M1JjAg?pn>C>m70~U+L$onkSm314| zb?w{JeeCFolP7vWckkS@clW;cPoLSkd0Sj;JfIRrM5d=^Y}l~j-o5|4!u{sS0|Yq< zWPSep`TF(iV`F3E%0E=$$)8c;qEEq>MPoK-FyFUu|ST&2_cY>GlLb* zYixXSXn6ejZ-f8(=~uvc`AYw_zMHr2+Y{{SjWdLGE9!nyze002ovPDHLkV1miE Bq3{3z literal 0 HcmV?d00001 diff --git a/sources/plugins/scg/media/translations/scg_en_EN.qm b/sources/plugins/scg/media/translations/scg_en_EN.qm new file mode 100644 index 0000000000000000000000000000000000000000..f29bcaa0e5ec6c823d3be4dcd44f29d4cdb08ee8 GIT binary patch literal 7778 zcmb_gdvH|M89&MH%|5dWn>RA$NL|BoAt5}Z5Fs0$3L?v+C{%BDPj)Zdy?4F$ZkEta z?O4b0HI%BfQ^gL}*Qo7Sr4Y?R0cQfX0?r0p4%i0B0NVlY z2Al)NLBP3y?*q;wq!ED32b=`B0I(DAI>2p!aYDu)0PH3t@)F=mLhA54Sp_Hq zCIAl;vicCtA0lMyU4+!%OWe=&<8Onwf8z$9Geo-aKZMk7A<_dc64IO^(jmZ>6bT-L zz9E&=+Hf&hS%6$$H(5Pz86nkfvYI^wJ~xva`d$NFh^%q%0-tuW>Heo7_c^lvo+R+k zk~i;ffShlUk8YhzNR>)He)a?*o=3^W2;`32LoWS!AtA19RqXPQA@@M_O%Q%JZG8`Xu*W^+#5J(P=e~CokPergiFdmnc{b>o|WJKaB>0evHHxsQGd7~JbV z*#&w2*%JBZ2H5kQB<*_y@w`)tya~OU+N6$WwgYdg6hALP{&6XN;@5zZbZ27-c3hP9 zeh24)bJC0N8Niz){d^nzUH`0fx$^?_-&V7_6LIm*sJSf%y<1Mz+~))T$R{=Tal2f8 z2i8rf*>?c+HQQ_6e)XLgWpTuzNQZ7)9T%G`XK!Lx%WqR zPk`N*y!-b55%6X2ldqfbv+6zS`UU)Or}zDS(34XR9DmH`_CQX{d|$@_r4< zZ}UCAlk#Nv>$va3m5+jt?w30ApdH+@Y(1QyQzwp1p z{sSkW|F6QwK0|(Z*M%=%do}oeO(A4LmFo-q<1K{L;ODEY(Y98~RF-9$MKf|A(^@Us z8f|Z-vSk@cPu^nSO*}W>)U%x>tzqPIyYh;fQnWP98G4eLCRmuXSJ4zR!&0=MSQ*-@ ztEyh$ILt6~!(8YWFq{>axdPyjqCG6FXjC^S!ymdW9?T4ylNEz1sl}6{ZIcD8Lh+2O zr5R1?ng!zom@QXg(mushdK6W$`UOOdMIuE@Dk<(fM?(R{gd&B5*lNNC&?&tNGXzv6 zIRjKVUC}I4Kv6$jj@6$N1yPEtx+X%H9(PxCp;}= z6qQju$2499z5I`8o2Ur71avX~I@vIpQ%k5(swx`zwaZeqv=JSG$mWIU8AL5&&ycAWbOu|pISOiIyGCY z3Oa>1-KkDvS9!m;&}8YHq7+fObQc+#%mR_!1*l%om{DSxQIZ*|n9$jxGX767yWhlU zSDv>@wEK2ZyKmX3?Lhz0O8tJYSqZGXVG}bY z#pY2Nqo_SLoAx<$$i-3v6xrTvPd@I>oL#(jg_R3{qV>tDg2t-qC?ouyM^bBpW7%oM z(0VYU?V^ZAZI=!rql=g3J&!IQVV0a0ILm7$W9gaV?j5vo%J)#8jaQ~~J4j{vc64wk zA$jt}B;eC%&{UycCa>kGmbCW{?hu;QQ8{*AV=VG%bv1X2KM_wO6W0KF*b*cy&E-^k zRcHiG-0`I|gS!=3)zic9>*5(*M+;A2yd@c3m6g+WJ8KxEw!e)??AxpxSgZ^=$CVl) zFoA7NOOHrHm!Ztk{WE)H6N7rGVeq}kpco`_79-EF+Zt!(;B|4d64o%?>#txXJFH5Y zlqbJxxx9mSB{K4gX|U1oE;)EIiZx5u>Q;ug z28>(`(X zG7eg8$mdixia*B>dK`OFFLpRCsvK3wW?2fJefcU!62?Mi**RFb7|$Y>%~}1OC6zX6 zDSeZ|3Vc+n!{*ojCo$^au9Bjocx+thyktJtt^zt=mz>;T=H#Sv!{LHp$}lUc;+&gj z0IbWMsUaVob#?S^0_OX7m-(W3rw$Z zZsr1v(2!d`%Cthv(mTY+8dt3pu&G)lI1I04g&`MJd#a2QRcW1!HY?y&l@J{I6Hc#N zs;UC4Kmv`icoz_$1rr&)PyyaJ`?88A4oAzpBMNxBHp$N8%*ZYd<9?>_J(*6K7K^q` z<(zy#-HchR53i2KYx#(#J^ggmKw`&Y_Wf*BnyTqSmQ^#w$Fs%9_7lkHvfIVfbHv9T z;^VpE<9Xua`QqaR;^XUt$K(0M-hN-;(=v;0EktkNH!D=)7)ad9Qi@&Uqx!z?iu;Tz zV?z)VM3(L351!5=8J380i4`p3+u19$FXU`&d|Tlgh!EGa62n|K>^?fGZS_Nj_P}Bz zWb5URZ8YoLEl1@WS;rsXD-WD|Jxl3Axm*<8pzEr=jEpL{uGqyCEtj`uAyNQBzTqN) zneRzsZ?><9qjJZF&G*5Iaxq-oY$^(tn=d3nJtKq5LPZ=sx9EBnk3mAFUK{Dl`Ft;W JXLVK8e*u0B!`}b^ literal 0 HcmV?d00001 diff --git a/sources/plugins/scg/media/translations/scg_en_EN.ts b/sources/plugins/scg/media/translations/scg_en_EN.ts index 5e5be73..e6e4b9c 100644 --- a/sources/plugins/scg/media/translations/scg_en_EN.ts +++ b/sources/plugins/scg/media/translations/scg_en_EN.ts @@ -4,217 +4,242 @@ QObject - + Change incident object - + Clone - + Change content - + Change content visibility - + + Show all content + + + + + Hide all content + + + + Create bus - + Create contour - + Create node - + Create pair - + Delete contour - + Move identifier - + Insert - + Delete object - + Change object's identifier - + Move item - + Change object's type - + Move object's point - + Change object's points - + Move items - + Swap pair - + Error while opening file %1 - + Error while opening file %1. Parse error at line %2, column %3: %4 - + Building process has finished with following errors: - + error to parse file '%1' - + File saving error. Cannot write file %1: %2. - + Given document has unsupported format %1 - + Version %1 of GWF files not supported. Just 1.6 and 2.0 versions supported. - + Content type '%1' doesn't supported for now - + Unknown content type '%1' - + There are no points data for element '%1' - + '%1' element haven't '%2' attribute - + invalid float value in attribute '%1' of element '%2' - + + invalid bollean value in attribute '%1' of element '%2' + + + + node element '%1' haven't content tag - + type '%1' is unknown for element '%2' - + sc.g-bus - + sc.g-contour - + Can't find begin or end object for pair id="%1" - + Try to set the bus owner("%1") which is not a node type. Bus id="%2" - + Try to create contour ("%1") with less than 3 points. - + sc.g-node - + sc.g-pair + + + Minimize contour's size + + + + + Remove pair's break points + + SCgBusMode - + Node can't have more than one bus! @@ -222,7 +247,7 @@ Just 1.6 and 2.0 versions supported. SCgContentChangeDialog - + Apply @@ -230,7 +255,7 @@ Just 1.6 and 2.0 versions supported. SCgContentImageDialog - + Choose Source Image @@ -238,35 +263,98 @@ Just 1.6 and 2.0 versions supported. SCgContentStringDialog - + Word wrap + + SCgEnergyBasedArranger + + + Energy-based Arranger Parameters + + + + + Spring rate: + + + + + Spring rate + + + + + Spring length: + + + + + Natural spring length + + + + + Node repulsion factor: + + + + + Repulsive force factor between real nodes + + + + + Fake node repulsion factor: + + + + + Repulsive force factor between real and fake nodes + + + + + Shift factor: + + + + + Shift force factor + + + + + Energy-based arrange + + + SCgFindWidget - + Find: - + Previous - + Next - + Case Sensitive - + Search wrapped @@ -274,24 +362,24 @@ Just 1.6 and 2.0 versions supported. SCgGridArranger - - + + X axis step - - + + Y axis step - + Symmetrical grid - + Grid arrange @@ -299,12 +387,12 @@ Just 1.6 and 2.0 versions supported. SCgHorizontalArranger - + Nothing to align. Did you forget to select objects for alignment? - + Horizontal arrange @@ -312,17 +400,17 @@ Just 1.6 and 2.0 versions supported. SCgScene - + File opening error - + Unsupported extention - + Current file's extention doesn't supported @@ -330,22 +418,22 @@ Just 1.6 and 2.0 versions supported. SCgTupleArranger - + Tuple arranger - + Horizontal offset - + Vertical offset - + Distance between objects @@ -353,7 +441,7 @@ Just 1.6 and 2.0 versions supported. SCgUndoViewModel - + <empty> @@ -361,12 +449,12 @@ Just 1.6 and 2.0 versions supported. SCgVerticalArranger - + Nothing to align. Did you forget to select objects for alignment? - + Vertical arrange @@ -374,114 +462,124 @@ Just 1.6 and 2.0 versions supported. SCgView - - + + Set content - + C - + Show content - + H - + + Show all content + + + + + Hide all content + + + + Delete content - + D - - + + Change identifier - + I - + Delete - + Delete contour - + Backspace - + Swap orientation - + S - + Copy - + Cut - + Paste - + Select All - + Change content - + Change type - + Const - + Var - + New identifier: @@ -489,178 +587,189 @@ Just 1.6 and 2.0 versions supported. SCgWindow - + &Find by Identifier... - + Undo - + Redo - + Mini map - + History - + Selection mode - + 1 Selection mode - + Pair creation mode - + 2 Pair creation mode - + Bus creation mode - + 3 Bus creation mode - + Contour creation mode - + 4 Contour creation mode - + Grid alignment - + 5 Grid alignment - + Tuple alignment - + 6 Tuple alignment - + Vertical alignment - + 7 Vertical alignment - + Horizontal alignment - + 8 Horizontal alignment - + + Energy-based layout + + + + + 9 + Energy-based layout + + + + Select input/output - + Select subgraph - + Export image - + 0 Export image - + Zoom in - + + Zoom in - + Zoom out - + - Zoom out - + SCg Tools - + %1 image (*.%1) - + Export file to ... - + Edit diff --git a/sources/plugins/scg/media/translations/scg_ru_RU.qm b/sources/plugins/scg/media/translations/scg_ru_RU.qm new file mode 100644 index 0000000000000000000000000000000000000000..58cdd12e62735c76dbb51ac4f09f2423505ae4ba GIT binary patch literal 13983 zcmd5@dvILUc|Vr!TC3H|*25M?v9D$8X?eX`tz=o2){<6!KVumi9O7iPx>{XW?OpEf zN{BFRN-0A~hO}wYOcJ+4hDTeP7G~Nq?Q{wxK&E-nW(X-mnm`{RnUnw%68NWK(%*N^ zeeS)xQk-z5ci@hoFquP}D=U5xd0FzJz1e14Qk{~$3oaE1j= z{hYCmKVX56KgQU;Fbh13buhx}zXE=@UttY=-O7%wfNtx5vJ)eRA>ZTdgz^yfSz;%b zpJpt4FFP&Wfqky9i}yVYx*uT=+>>Ig?RECteQn_P9`?ouIvK0ZvbX;9CB`QrSD!lbBIwK2D_^}E&(BqV;ul{B{od-Q&(ATo;eyor(r(7y_mp(+ z%?~oxo{=8ff$v*X>7i54VU0>(8UVlD{nGP4#d>|8^zt<5ZCMVmA78+8HG#m@Pcv5g zR-pMg@HOyKAoj>DjBR@{ka#lyJsb<9U;2B-sy-R`?JbRr1^+zonUB)-y1-+v>R8pl z;~#{+`)&%n8-E-8w`@EShh3VV-1wm!_#XV9jUTJU{@s^1evIVW_@r37|7_#cC-8jZ zxs5M8d>izBux4Q5N$m4@&CrK&|K88m6yN+^#_DEjzCHXS?6;%l-|pYeSnngj=1=|& zzJD~>6MuoR`rCp>t~-kLC&5eq1$)&zA51^-@36}kg3DWDjO~0Z`1{}c3jF9h!Oz{j zjj^q-2d_TxPgqxi4}LihJ>MC8zWT3W*RKWtV-?R=9Te;C->a2sKqvA{ZS094)`8j& zv_QZ6uGGGq>|`u-f9>nXJ`X*<8VbaV@I@Bt$bw#PO{jn0YoM11g&+M6o?8vY{sMa6 z{%~mGl`hD?Ej01QU09XS*_Edl+tDW0UE4z++WJ}O`^TX_Ze3w))0?3e@5?eKzZm+- z+u&>9&bmFfVcqv&-S{N-+w)r8R;Ukzq|f(4ebr@KwtF@@kPkf6>j*#mp=`?w>EtD z8Iu3T#`d4q;Qo&`eqt2%+Zk^PJ@GQ^`9{;Xe*yn!{&~~8-8`R zr=^3^ur!XJ329o2Fq!qRE@YA(T${kR(^w<8GAWHpgHpnAPn7k*Ku{@ucJ*`(_Q*;` zSyHkEc`>=HWP1v7Pgk@@P8JHfI#(S18Yhz%M zw0_jO;<69!h~ZARQVwCSN$DgM)yoAQ!cKj-6AEQ2n`aZOlUuaY5_VrAN#=oc^YWaM zRZJG3vHh8$;<3k}VK0kX#k*LYkSlHwN8 z#>8SWn^xqMmMy?ZJbT7{_l#nvn6Vpq1}UjBo$K6m29l*hj6$3v zoT!M12?zx-KsFBlKLPQ^z(&LpYl}fn&8F0Oa(K+SLRXRnMV>2qwclTHCy`H(>0Q3lXzWL!s1?2bQklC1_Z2$= z>Wtm8+Pqiy(TeQ(rY=itb7M+H9t{piySVl!%^L~G;b|_pnQU#@ID;AmO_q~f_U;Nh z`Ne&Mu~V6FACT=BU4<;%3VWap{|(6)VUJ=DE}WOhlb&W@u}|HdL)Vb z%P=8^L(uya)@kXK{glwXAx+ehX5a|vJD*&(ihekR+L_e~@`|p)j|_W&?P%D;_X%k? zIGv=V%3)LtpT-c1POwE#ivunEUQgEPJ*om*A=9La2Gq*S#jGpgEJ3qfgC1@grDkqb z!b~VAmW&&ZXY-2gt;ge12TwyBJ0axlq$@N>`WG00gAeRU(4{ohY&{JKwWQu*g&ZnX z9v?mI#Q+8gItVO!+>UAxUb`ALoz|9>N+mE_ZhJ@4C|90p#pVTN$;0&|hp=9rhagD; z20g@aS-A>`8fKXxWD)V^_((bCp>C?-V?2@g)$kU+tGj}Ggos*6Z7+i;AwuN&I9rLkIGF zvXJB`!0e3(D0tW_z`${G7O;ZY1X;>)0v_;abLhYkXUJLxw5KQVV}e;~K?vH7W2M%O z9F%gTEhzdSi}B$L`l?*egh&_(hcGk& zd678CxDg)H)B#cR2R0o78t4b?Ix4S2R4PQI1c8V}|Aaz-Z_jeaIm<20n?c8}0<{3) zQo-YWkuObjOG2qpX7@`ohJx}+0ZQOFOx9Miif*cCQB5t%Y94kk$VvR3S2!vR%hN>y z=4hg#-X?02`y_cAg#;B`vm2z~SO;9S40zoQ*;|1!vu1B)LsE~YeF{~8;%^EhsEy?H z2fg(QTYv)X8oG{}#E}E}Z7EVd15rdTE}B{q@k9}s1NAP90VG-u{2j&Lb|pG_QPK0N z1{^RbYYXzxOGkKp6>7CgTsU;1m@mkK;So8BmNgoV$jjn6R2CC>d%ZJK0wRurNh`%T z1vi@kOS|p7+ou4@arnY(zHb=c$pMKFmwcXll0H#2Bm2_d6Zj{t?8jd;2@qV+z5a6+ zF^e(!{xW&UIg1%qv&+ehismDu0Se&nB1&V{9>j=d1sb+@0I%qvv%b)b^ft-m(R4~H&=CCHh z`bswO?RRKaG>i}`n=KsXS--Dz+084`SJ6l#)V10M@$roXX%{50VU5ue!Vg3u9*2vM zfL-#8L0;7eYY*aEs_V|`MA?G^0z)vzex(g?=NU?=DL%C#=a82)R9Rk+(C|}VyptRx zG@D2xJd?YEL8`la=8p232nhs3E^pC4l$!9Gg_MOFotw_5{#2u z)APhSwGW5EvS3_%vmc)aaZiMc?Vd`sBo;LdZO<%P?UW)PUrMGq{B5)8^6wmEJ1oFQ zx}nN$4~lFzuf3${7)|QQ90~6bV-^$FY}&CO!BiR&($te+kU;D-S|VIeQ9H#;s)$;; zPat~}hM%?6CLc!GORw&oOXe}&n9_Bc>FF{WyW|oYYn_8vVny6HO}CkMagFw)DJmsP zI`k49wurX6h$aP5Q|5An&SP8@M-H38zfnHYqeM#{Nzef!JoqAjGm^3x!I(WHffDk+ zr~wd7;1Ff@wD|fX$y*8K!6|hmSIqFLwUA5|G<|F>zG6}vF9zC$i{L;$)*d7Ytfv%230;Yewu?S^lZTrzl0<kY^E8qkB}CDwQR9eqpNlqWnWZs-q%O}Y*}Pi7Fp8vU zK*B$Q)1*u4d|DBQd-c2T zj2ikmfS}?Q#SV70p^}GrAAV0^Z|eH(a#w#;2YPpuxhANWzH=2)8qyQAF)KRNaY~L< z$ILx#tgvZzbqNJpS5ruBY3xP(`tI8<^eX(vY*BZkoV*=yF<($P^7xgu zxyjzk6htz(AwDgXZyK?~f(RD{b@q7_u? zpQCJV*<|i$nvOK&PwAKV&$4&zbTV~oK9@|1lO19W>fBK6x@kj#cB`>2;zPINad za9=#`z6clX1tcJ?n{R5BIgNCn+@>?iisLYn<6W26lW~Oojbjl@rGaxvz$!NnZU$%F z7r|gVH#MSh5}jOnar!)^|! zO~fJCsbv59*+p%o>~1G~;*MZ0K?mnSA*#G1#3~;YZsG@pfQE3lBw-hi4BK6Mi3Wgx zHcjtOIuu)dF)3b6v0M%I=ohCd24*c83xdsF+!5yY*puHToO!4;8I*hb!(D@Y#8E9a zy@Y;ALmtJ)Fp?!5w}_s~Y#-dojkGS##S)hBw{%m}CC{zO$F1}h4)YTdCk3~c?I~rz zeR*%?%aO{L`O69AX-6wRJyiK}tn%gI%9lqfU*2E&@@VDD2TCu)suAEwnr@+$GxDVU zRu~=7m4Yn0SZt=lMSf;W=z9ss#b^7Gb#L!Ts*WzVjV9yBr)v_TeqTf+e9-be>F~VD zGrH5-6e8C!1#WRofip?;O@3QPrM<{uQ`B99A?JGrA{7~p50s6@2SJ5@7Q4-dZ>Jac z#A`ih#(csA%*WQCAbQo3xVLE38#H*d`&jH+CI*dSVn975^@%>aHX@CRR)u${Jq-#)4RJy~5=y?HX&K)7 zm56wwZ)F#UPh$K%%=U3;;{MK=HYy9>Vju%Gn=2OfA)>JONF)0&BBllOrc*?kvD~}K z*f3w5OJg#|k0wf_+U_zOxskvw;vn4iO-$Hm7E&R*{pR}BCZk`i5JH QObject - + Change incident object Именение инцидентного объекта - + Clone Клонирование - + Change content Изменение содержимого - + Change content visibility Изменение видимости содержимого - + + Show all content + + + + + Hide all content + + + + Create bus Создание sc.g-шины - + Create contour Создание sc.g-контура - + Create node Создание sc.g-узла - + Create pair Создание sc.g-пары (дуги) - + Delete contour Удаление sc.g-контура - + Move identifier Перемещение идентификатора - + Insert Вставка - + Delete object Удаление объекта - + Change object's identifier Изменение текстового идентификатора - + Move item Перемещение sc.g-элемента - + Change object's type Изменение типа sc.g-элемента - + Move object's point Перемещение точки излома - + Change object's points Изменение точек излома - + Move items Премещение группы sc.g-элементов - + Swap pair Инвертирование направления sc.g-пары (дуги) - + Error while opening file %1 Ошибка при открытии файла %1 - + Error while opening file %1. Parse error at line %2, column %3: %4 Ошибка при открытии файла %1. Ошибка в строке %2, символ %3: %4 - + Building process has finished with following errors: Процесс построения sc.g-текста завершился со следующими ошибками: - + error to parse file '%1' Ошибка чтения файла '%1' - + File saving error. Cannot write file %1: %2. Ошибка сохранения файла. Не удается записать файл %1: %2 - + Given document has unsupported format %1 Формат документа %1 не поддерживается - + Version %1 of GWF files not supported. Just 1.6 and 2.0 versions supported. Версия %1 gwf файла не поддерживается. Поддерживаются ли версии 1.6 и 2.0 - + Content type '%1' doesn't supported for now Тип содержимого '%1' не поддерживается - + Unknown content type '%1' Неизвестный тип содержимого '%1' - + There are no points data for element '%1' Нету данных о точках излома для элемента '%1' - + '%1' element haven't '%2' attribute у элемента '%1' нет атрибута '%2' - + invalid float value in attribute '%1' of element '%2' неверное вещественное значение атрибута '%1' для элемента '%2' - + + invalid bollean value in attribute '%1' of element '%2' + + + + node element '%1' haven't content tag элемент '%1' не имеет дрочернего тега 'content' - + type '%1' is unknown for element '%2' неизвестный тип '%1' для элемента '%2' - + sc.g-bus sc.g-шина - + sc.g-contour sc.g-контур - + Can't find begin or end object for pair id="%1" Не удается найти начальный или конечный элемент для sc.g-пары (дуги) с id="%1" - + Try to set the bus owner("%1") which is not a node type. Bus id="%2" Попытка установить владельцем sc.g-шины объект "%1", который не является sc.g-узлом. id sc.g-шины = "%2" - + Try to create contour ("%1") with less than 3 points. Попытка создать sc.g-контур "%1" с менее чем тремя точками - + sc.g-node sc.g-узел - + sc.g-pair sc.g-пара (дуга) + + + Minimize contour's size + Минимизировать размеры контура + + + + Remove pair's break points + Удалитьточки излома дуги + SCgBusMode - + Node can't have more than one bus! У sc.g-узла не может быть более чем одной sc.g-шины @@ -222,7 +247,7 @@ Just 1.6 and 2.0 versions supported. SCgContentChangeDialog - + Apply Применить @@ -230,7 +255,7 @@ Just 1.6 and 2.0 versions supported. SCgContentImageDialog - + Choose Source Image Выберите исходное изображение @@ -238,35 +263,98 @@ Just 1.6 and 2.0 versions supported. SCgContentStringDialog - + Word wrap Перенос текста + + SCgEnergyBasedArranger + + + Energy-based Arranger Parameters + Параметры физического размещения + + + + Spring rate: + Коэффициент упругости пружины: + + + + Spring rate + Коэффициент упругости пружины + + + + Spring length: + Длина пружины: + + + + Natural spring length + Естественная длина пружины + + + + Node repulsion factor: + Коэффициент отталкивания узлов: + + + + Repulsive force factor between real nodes + Коэффициент силы отталкивания между настоящими узлами + + + + Fake node repulsion factor: + Коэффициент отталкивания фальшивых узлов: + + + + Repulsive force factor between real and fake nodes + Коэффициент силы отталкивания между настоящими и фальшивыми узлами + + + + Shift factor: + Коэффициент сдвига: + + + + Shift force factor + Коэффициент силы сдвига + + + + Energy-based arrange + Физическое размещение + + SCgFindWidget - + Find: Поиск: - + Previous Предыдущий - + Next Следующий - + Case Sensitive Учитывать регистр - + Search wrapped Поиск с учетом переноса @@ -274,24 +362,24 @@ Just 1.6 and 2.0 versions supported. SCgGridArranger - - + + X axis step Шаг по оси X - - + + Y axis step Шаг по оси Y - + Symmetrical grid Симметричная сетка - + Grid arrange Выравнивание по сетке @@ -299,12 +387,12 @@ Just 1.6 and 2.0 versions supported. SCgHorizontalArranger - + Nothing to align. Did you forget to select objects for alignment? Не указаны sc.g-элементы для выравнивания - + Horizontal arrange Горизотальное выравнивание @@ -312,17 +400,17 @@ Just 1.6 and 2.0 versions supported. SCgScene - + File opening error Ошибка при открытии файла - + Unsupported extention Расширение не поддерживается - + Current file's extention doesn't supported Расширения указанных файлов не поддерживаются @@ -330,22 +418,22 @@ Just 1.6 and 2.0 versions supported. SCgTupleArranger - + Tuple arranger Выравнивание связки с sc.g-шиной - + Horizontal offset Горизонтальное смещение - + Vertical offset Вертикальное смещение - + Distance between objects Расстояние между объектами @@ -353,7 +441,7 @@ Just 1.6 and 2.0 versions supported. SCgUndoViewModel - + <empty> <пусто> @@ -361,12 +449,12 @@ Just 1.6 and 2.0 versions supported. SCgVerticalArranger - + Nothing to align. Did you forget to select objects for alignment? Не указаны sc.g-элементы для выравнивания - + Vertical arrange Вертикальное выравнивание @@ -374,114 +462,124 @@ Just 1.6 and 2.0 versions supported. SCgView - - + + Set content Установка содержимого - + C - + Show content Показать содержимое - + H - + + Show all content + + + + + Hide all content + + + + Delete content Удалить содержимое - + D - - + + Change identifier Изменить идентификатор - + I - + Delete Удалить - + Delete contour Удалить контур - + Backspace - + Swap orientation Изменить направление sc.g-пары (дуги) - + S - + Copy Копировать - + Cut Вырезать - + Paste Вставить - + Select All Выделить все - + Change content Изменить содержимое - + Change type Изменить тип - + Const sc.g-константы - + Var sc.g-переменные - + New identifier: Новый идентификатор: @@ -489,178 +587,189 @@ Just 1.6 and 2.0 versions supported. SCgWindow - + &Find by Identifier... &Поиск по идентифкатору - + Undo Отменить - + Redo Вернуть - + Mini map Миникарта - + History История - + Selection mode Режим выделения - + 1 Selection mode - + Pair creation mode Режим создания sc.g-пары (дуги) - + 2 Pair creation mode - + Bus creation mode Режим создания sc.g-шины - + 3 Bus creation mode - + Contour creation mode Режим создания sc.g-контура - + 4 Contour creation mode - + Grid alignment Выравнивание по сетке - + 5 Grid alignment - + Tuple alignment Выравнивание связки с sc.g-шиной - + 6 Tuple alignment - + Vertical alignment Вертикальное выравнивание - + 7 Vertical alignment - + Horizontal alignment Горизонтальное выравнивание - + 8 Horizontal alignment - + + Energy-based layout + Физическое размещение + + + + 9 + Energy-based layout + + + + Select input/output Выделить входящие/выходящие sc.g-пары (дуги) - + Select subgraph Выделить подграф - + Export image Экспортировать изображение - + 0 Export image - + Zoom in Увеличить - + + Zoom in - + Zoom out Уменьшить - + - Zoom out - + SCg Tools SCg инструменты - + %1 image (*.%1) %1 изображение (*.%1) - + Export file to ... Экспортировать файл в ... - + Edit Правка diff --git a/sources/plugins/scg/scg.pro b/sources/plugins/scg/scg.pro index 1b1849e..320da80 100644 --- a/sources/plugins/scg/scg.pro +++ b/sources/plugins/scg/scg.pro @@ -87,7 +87,11 @@ HEADERS += \ modes/scgcontourmode.h \ modes/scgclonemode.h \ modes/scgbusmode.h \ - commands/scgcommandswappairorient.h + commands/scgcommandswappairorient.h \ + arrangers/scgarrangerenergybased.h \ + commands/scgcommandremovebreakpoints.h \ + commands/scgcommandminimizecontour.h \ + arrangers/scgforcecalculator.h SOURCES += \ scgwindow.cpp \ @@ -162,7 +166,11 @@ SOURCES += \ modes/scgcontourmode.cpp \ modes/scgclonemode.cpp \ modes/scgbusmode.cpp \ - commands/scgcommandswappairorient.cpp + commands/scgcommandswappairorient.cpp \ + arrangers/scgarrangerenergybased.cpp \ + commands/scgcommandremovebreakpoints.cpp \ + commands/scgcommandminimizecontour.cpp \ + arrangers/scgforcecalculator.cpp TRANSLATIONS += media/translations/scg_en_EN.ts \ media/translations/scg_ru_RU.ts diff --git a/sources/plugins/scg/scg.qrc b/sources/plugins/scg/scg.qrc index 0f70622..611b24f 100644 --- a/sources/plugins/scg/scg.qrc +++ b/sources/plugins/scg/scg.qrc @@ -32,5 +32,6 @@ media/translations/scg_en_EN.qm media/translations/scg_ru_RU.qm media/TypeClonningCursor.bmp + media/icons/tool-align-energy.png diff --git a/sources/plugins/scg/scgcontour.cpp b/sources/plugins/scg/scgcontour.cpp index c0781c5..2cec386 100644 --- a/sources/plugins/scg/scgcontour.cpp +++ b/sources/plugins/scg/scgcontour.cpp @@ -30,6 +30,7 @@ along with OSTIS. If not, see . #include #include #include +#include SCgContour::SCgContour() : mColorBack(QColor(250, 250, 250, 224)) @@ -98,6 +99,74 @@ void SCgContour::positionChanged() updateShape(); } +void SCgContour::minimize() +{ + setPoints(minimizedPoints()); +} + +SCgPointObject::PointFVector SCgContour::minimizedPoints() const +{ + // Collect items which is a scgObject: + QSet scgObjects; + foreach(QGraphicsItem* item, childItems()) + { + if (SCgObject::isSCgObjectType(item->type())) + { + SCgObject *scgObject = static_cast(item); + scgObjects.insert(scgObject); + } + } + + if (!scgObjects.isEmpty()) { + // Find min and max points: + qreal minX, minY, maxX, maxY; + + QSet::const_iterator it; + it = scgObjects.begin(); + SCgObject *firstObj = *it; + QRectF firstObjRect = firstObj->boundingRect(); + + minX = firstObj->mapToScene(firstObjRect.topLeft()).x(); + minY = firstObj->mapToScene(firstObjRect.topLeft()).y(); + maxX = firstObj->mapToScene(firstObjRect.bottomRight()).x(); + maxY = firstObj->mapToScene(firstObjRect.bottomRight()).y(); + + for (++it; it != scgObjects.end(); ++it) { + SCgObject *obj = *it; + QRectF objRect = obj->boundingRect(); + + QPointF topLeft = obj->mapToScene(objRect.topLeft()); + QPointF bottomRight = obj->mapToScene(objRect.bottomRight()); + + if (topLeft.x() < minX) { + minX = topLeft.x(); + } + if (topLeft.y() < minY) { + minY = topLeft.y(); + } + if (bottomRight.x() > maxX) { + maxX = bottomRight.x(); + } + if (bottomRight.y() > maxY) { + maxY = bottomRight.y(); + } + } + + // Increase distance from borders: + minX -= borderDistance; + minY -= borderDistance; + maxX += borderDistance; + maxY += borderDistance; + + // Remove all points and set only 4 corner points: + PointFVector newPoints; + newPoints << QPointF(minX, minY) << QPointF(maxX, minY) + << QPointF(maxX, maxY) << QPointF(minX, maxY); + + return newPoints; + } +} + void SCgContour::updateShape() { prepareGeometryChange(); diff --git a/sources/plugins/scg/scgcontour.h b/sources/plugins/scg/scgcontour.h index cc874a7..9e30b56 100644 --- a/sources/plugins/scg/scgcontour.h +++ b/sources/plugins/scg/scgcontour.h @@ -50,6 +50,14 @@ class SCgContour : public SCgPointObject */ void positionChanged(); + //! Minimizes size and leaves only 4 points: + void minimize(); + + /*! Get 4 points of minimized contour + @return Minimized contour points + */ + PointFVector minimizedPoints() const; + //! @see SCgPointObject::updateShape; void updateShape(); @@ -96,6 +104,9 @@ class SCgContour : public SCgPointObject //! Corner radius for drawing shape static const qreal cornerRadius = 20.0; + //! Distance from border to content for minimized contour: + static const qreal borderDistance = 20.0; + //! Contour shape QPainterPath mShape; diff --git a/sources/plugins/scg/scgplugin.cpp b/sources/plugins/scg/scgplugin.cpp index bcbd18e..90680a0 100644 --- a/sources/plugins/scg/scgplugin.cpp +++ b/sources/plugins/scg/scgplugin.cpp @@ -33,6 +33,7 @@ along with OSTIS. If not, see . #include "arrangers/scgarrangerhorizontal.h" #include "arrangers/scgarrangertuple.h" #include "arrangers/scgarrangervertical.h" +#include "arrangers/scgarrangerenergybased.h" #include #include @@ -83,6 +84,7 @@ void SCgPlugin::initialize() SCgLayoutManager::instance().addArranger(new SCgVerticalArranger(this)); SCgLayoutManager::instance().addArranger(new SCgHorizontalArranger(this)); SCgLayoutManager::instance().addArranger(new SCgTupleArranger(this)); + SCgLayoutManager::instance().addArranger(new SCgEnergyBasedArranger(this)); qApp->installTranslator(mTranslator); } diff --git a/sources/plugins/scg/scgscene.cpp b/sources/plugins/scg/scgscene.cpp index 9dfa6b2..19bb4ce 100644 --- a/sources/plugins/scg/scgscene.cpp +++ b/sources/plugins/scg/scgscene.cpp @@ -58,6 +58,8 @@ along with OSTIS. If not, see . #include "commands/scgcommandpointschange.h" #include "commands/scgcommandidtfmove.h" #include "commands/scgcommandswappairorient.h" +#include "commands/scgcommandremovebreakpoints.h" +#include "commands/scgcommandminimizecontour.h" #include #include @@ -690,6 +692,35 @@ SCgBaseCommand* SCgScene::createContourCommand(const QList& chil return cmd; } +SCgBaseCommand * SCgScene::removeBreakPointsCommand(SCgPair *pair, SCgBaseCommand *parentCmd, bool addToStack) +{ + Q_ASSERT_X(pair != 0, + "SCgBaseCommand* SCgScene::removeBreakPointsCommand(SCgPair *pair, SCgBaseCommand *parentCmd, bool addToStack)", + "Pointer to object is null"); + + SCgBaseCommand *cmd = new SCgCommandRemoveBreakPoints(this, pair, parentCmd); + + if (addToStack) { + mUndoStack->push(cmd); + } + + return cmd; +} + +SCgBaseCommand * SCgScene::minimizeContourCommand(SCgContour *contour, SCgBaseCommand *parentCmd, bool addToStack) +{ + Q_ASSERT_X(contour != 0, + "SCgBaseCommand* SCgScene::minimizeContourCommand(SCgContour *contour, SCgBaseCommand *parentCmd, bool addToStack)", + "Pointer to object is null"); + + SCgBaseCommand *cmd = new SCgCommandMinimizeContour(this, contour, parentCmd); + + if (addToStack) { + mUndoStack->push(cmd); + } + + return cmd; +} SCgBaseCommand* SCgScene::changeObjectPositionCommand(SCgObject* obj, const QPointF& newPos, diff --git a/sources/plugins/scg/scgscene.h b/sources/plugins/scg/scgscene.h index ae84979..978d3a4 100644 --- a/sources/plugins/scg/scgscene.h +++ b/sources/plugins/scg/scgscene.h @@ -316,6 +316,24 @@ Q_OBJECT SCgBaseCommand* parentCmd = 0, bool addToStack = true); + /*! Create undo/redo command to remove break points of sc.g-pair + * @param pair Pointer to sc.g-pair + * @param parentCmd Pointer to parend undo/redo command + * @param addToStack Flag to add created command into stack + */ + SCgBaseCommand * removeBreakPointsCommand(SCgPair *pair, + SCgBaseCommand *parentCmd = 0, + bool addToStack = true); + + /*! Create undo/redo command to minimize contour + * @param contour Pointer to sc.g-contour + * @param parentCmd Pointer to parend undo/redo command + * @param addToStack Flag to add created command into stack + */ + SCgBaseCommand * minimizeContourCommand(SCgContour *contour, + SCgBaseCommand *parentCmd = 0, + bool addToStack = true); + /*! Create undo/redo command to change object position * @param obj Pointer to changed sc.g-object * @param newPos New Object position diff --git a/sources/plugins/scg/scgwindow.cpp b/sources/plugins/scg/scgwindow.cpp index b284da3..8a304ef 100644 --- a/sources/plugins/scg/scgwindow.cpp +++ b/sources/plugins/scg/scgwindow.cpp @@ -43,6 +43,7 @@ along with OSTIS. If not, see . #include "arrangers/scgarrangerhorizontal.h" #include "arrangers/scgarrangergrid.h" #include "arrangers/scgarrangertuple.h" +#include "arrangers/scgarrangerenergybased.h" #include "select/scgselectinputoutput.h" #include "select/scgselectsubgraph.h" @@ -260,7 +261,15 @@ void SCgWindow::createToolBar() alignButton->addAction(action); connect(action, SIGNAL(triggered()), this, SLOT(onHorizontalAlignment())); - // selection gtoup button + // Energy-based layout + action = new QAction(findIcon("tool-align-energy.png"), tr("Energy-based layout"), mToolBar); + action->setCheckable(false); + action->setShortcut(QKeySequence(tr("9", "Energy-based layout"))); + alignButton->addAction(action); + connect(action, SIGNAL(triggered()), this, SLOT(onEnergyBasedLayout())); + + + // selection group button QToolButton *selectButton = new QToolButton(mToolBar); selectButton->setIcon(findIcon("tool-select-group.png")); selectButton->setPopupMode(QToolButton::InstantPopup); @@ -418,6 +427,11 @@ void SCgWindow::onHorizontalAlignment() SCgLayoutManager::instance().arrange(mView, SCgHorizontalArranger::Type); } +void SCgWindow::onEnergyBasedLayout() +{ + SCgLayoutManager::instance().arrange(mView, SCgEnergyBasedArranger::Type); +} + void SCgWindow::onSelectInputOutput() { SCgSelectInputOutput select; diff --git a/sources/plugins/scg/scgwindow.h b/sources/plugins/scg/scgwindow.h index bbf2bda..0042c94 100644 --- a/sources/plugins/scg/scgwindow.h +++ b/sources/plugins/scg/scgwindow.h @@ -201,6 +201,8 @@ private slots: void onVerticalAlignment(); //! Slot to handle a horizontal alignment action void onHorizontalAlignment(); + //! Slot to handle a energy-based layout action + void onEnergyBasedLayout(); //! Slot to handle select input/output action void onSelectInputOutput(); //! Slot to handle select subgraph action From 62ad51dd7093078aae46d9472425046148f3cb14 Mon Sep 17 00:00:00 2001 From: Ivan Kosik Date: Mon, 13 May 2013 04:14:34 +0300 Subject: [PATCH 02/71] Correct pathes to the translation files --- .../scg/media/translations/scg_en_EN.ts | 290 +++++++++--------- .../scg/media/translations/scg_ru_RU.ts | 290 +++++++++--------- 2 files changed, 290 insertions(+), 290 deletions(-) diff --git a/sources/plugins/scg/media/translations/scg_en_EN.ts b/sources/plugins/scg/media/translations/scg_en_EN.ts index e6e4b9c..e3f96b5 100644 --- a/sources/plugins/scg/media/translations/scg_en_EN.ts +++ b/sources/plugins/scg/media/translations/scg_en_EN.ts @@ -4,234 +4,234 @@ QObject - + Change incident object - + Clone - + Change content - + Change content visibility - + Show all content - + Hide all content - + Create bus - + Create contour - + Create node - + Create pair - + Delete contour - + Move identifier - + Insert - + Delete object - + Change object's identifier - + Move item - + Change object's type - + Move object's point - + Change object's points - + Move items - + Swap pair - + Error while opening file %1 - + Error while opening file %1. Parse error at line %2, column %3: %4 - + Building process has finished with following errors: - + error to parse file '%1' - + File saving error. Cannot write file %1: %2. - + Given document has unsupported format %1 - + Version %1 of GWF files not supported. Just 1.6 and 2.0 versions supported. - + Content type '%1' doesn't supported for now - + Unknown content type '%1' - + There are no points data for element '%1' - + '%1' element haven't '%2' attribute - + invalid float value in attribute '%1' of element '%2' - + invalid bollean value in attribute '%1' of element '%2' - + node element '%1' haven't content tag - + type '%1' is unknown for element '%2' - + sc.g-bus - + sc.g-contour - + Can't find begin or end object for pair id="%1" - + Try to set the bus owner("%1") which is not a node type. Bus id="%2" - + Try to create contour ("%1") with less than 3 points. - + sc.g-node - + sc.g-pair - + Minimize contour's size - + Remove pair's break points @@ -239,7 +239,7 @@ Just 1.6 and 2.0 versions supported. SCgBusMode - + Node can't have more than one bus! @@ -247,7 +247,7 @@ Just 1.6 and 2.0 versions supported. SCgContentChangeDialog - + Apply @@ -255,7 +255,7 @@ Just 1.6 and 2.0 versions supported. SCgContentImageDialog - + Choose Source Image @@ -263,7 +263,7 @@ Just 1.6 and 2.0 versions supported. SCgContentStringDialog - + Word wrap @@ -271,62 +271,62 @@ Just 1.6 and 2.0 versions supported. SCgEnergyBasedArranger - + Energy-based Arranger Parameters - + Spring rate: - + Spring rate - + Spring length: - + Natural spring length - + Node repulsion factor: - + Repulsive force factor between real nodes - + Fake node repulsion factor: - + Repulsive force factor between real and fake nodes - + Shift factor: - + Shift force factor - + Energy-based arrange @@ -334,27 +334,27 @@ Just 1.6 and 2.0 versions supported. SCgFindWidget - + Find: - + Previous - + Next - + Case Sensitive - + Search wrapped @@ -362,24 +362,24 @@ Just 1.6 and 2.0 versions supported. SCgGridArranger - - + + X axis step - - + + Y axis step - + Symmetrical grid - + Grid arrange @@ -387,12 +387,12 @@ Just 1.6 and 2.0 versions supported. SCgHorizontalArranger - + Nothing to align. Did you forget to select objects for alignment? - + Horizontal arrange @@ -400,17 +400,17 @@ Just 1.6 and 2.0 versions supported. SCgScene - + File opening error - + Unsupported extention - + Current file's extention doesn't supported @@ -418,22 +418,22 @@ Just 1.6 and 2.0 versions supported. SCgTupleArranger - + Tuple arranger - + Horizontal offset - + Vertical offset - + Distance between objects @@ -441,7 +441,7 @@ Just 1.6 and 2.0 versions supported. SCgUndoViewModel - + <empty> @@ -449,12 +449,12 @@ Just 1.6 and 2.0 versions supported. SCgVerticalArranger - + Nothing to align. Did you forget to select objects for alignment? - + Vertical arrange @@ -462,124 +462,124 @@ Just 1.6 and 2.0 versions supported. SCgView - - + + Set content - + C - + Show content - + H - + Show all content - + Hide all content - + Delete content - + D - - + + Change identifier - + I - + Delete - + Delete contour - + Backspace - + Swap orientation - + S - + Copy - + Cut - + Paste - + Select All - + Change content - + Change type - + Const - + Var - + New identifier: @@ -587,189 +587,189 @@ Just 1.6 and 2.0 versions supported. SCgWindow - + &Find by Identifier... - + Undo - + Redo - + Mini map - + History - + Selection mode - + 1 Selection mode - + Pair creation mode - + 2 Pair creation mode - + Bus creation mode - + 3 Bus creation mode - + Contour creation mode - + 4 Contour creation mode - + Grid alignment - + 5 Grid alignment - + Tuple alignment - + 6 Tuple alignment - + Vertical alignment - + 7 Vertical alignment - + Horizontal alignment - + 8 Horizontal alignment - + Energy-based layout - + 9 Energy-based layout - + Select input/output - + Select subgraph - + Export image - + 0 Export image - + Zoom in - + + Zoom in - + Zoom out - + - Zoom out - + SCg Tools - + %1 image (*.%1) - + Export file to ... - + Edit diff --git a/sources/plugins/scg/media/translations/scg_ru_RU.ts b/sources/plugins/scg/media/translations/scg_ru_RU.ts index b63a2f2..c827090 100644 --- a/sources/plugins/scg/media/translations/scg_ru_RU.ts +++ b/sources/plugins/scg/media/translations/scg_ru_RU.ts @@ -4,234 +4,234 @@ QObject - + Change incident object Именение инцидентного объекта - + Clone Клонирование - + Change content Изменение содержимого - + Change content visibility Изменение видимости содержимого - + Show all content - + Hide all content - + Create bus Создание sc.g-шины - + Create contour Создание sc.g-контура - + Create node Создание sc.g-узла - + Create pair Создание sc.g-пары (дуги) - + Delete contour Удаление sc.g-контура - + Move identifier Перемещение идентификатора - + Insert Вставка - + Delete object Удаление объекта - + Change object's identifier Изменение текстового идентификатора - + Move item Перемещение sc.g-элемента - + Change object's type Изменение типа sc.g-элемента - + Move object's point Перемещение точки излома - + Change object's points Изменение точек излома - + Move items Премещение группы sc.g-элементов - + Swap pair Инвертирование направления sc.g-пары (дуги) - + Error while opening file %1 Ошибка при открытии файла %1 - + Error while opening file %1. Parse error at line %2, column %3: %4 Ошибка при открытии файла %1. Ошибка в строке %2, символ %3: %4 - + Building process has finished with following errors: Процесс построения sc.g-текста завершился со следующими ошибками: - + error to parse file '%1' Ошибка чтения файла '%1' - + File saving error. Cannot write file %1: %2. Ошибка сохранения файла. Не удается записать файл %1: %2 - + Given document has unsupported format %1 Формат документа %1 не поддерживается - + Version %1 of GWF files not supported. Just 1.6 and 2.0 versions supported. Версия %1 gwf файла не поддерживается. Поддерживаются ли версии 1.6 и 2.0 - + Content type '%1' doesn't supported for now Тип содержимого '%1' не поддерживается - + Unknown content type '%1' Неизвестный тип содержимого '%1' - + There are no points data for element '%1' Нету данных о точках излома для элемента '%1' - + '%1' element haven't '%2' attribute у элемента '%1' нет атрибута '%2' - + invalid float value in attribute '%1' of element '%2' неверное вещественное значение атрибута '%1' для элемента '%2' - + invalid bollean value in attribute '%1' of element '%2' - + node element '%1' haven't content tag элемент '%1' не имеет дрочернего тега 'content' - + type '%1' is unknown for element '%2' неизвестный тип '%1' для элемента '%2' - + sc.g-bus sc.g-шина - + sc.g-contour sc.g-контур - + Can't find begin or end object for pair id="%1" Не удается найти начальный или конечный элемент для sc.g-пары (дуги) с id="%1" - + Try to set the bus owner("%1") which is not a node type. Bus id="%2" Попытка установить владельцем sc.g-шины объект "%1", который не является sc.g-узлом. id sc.g-шины = "%2" - + Try to create contour ("%1") with less than 3 points. Попытка создать sc.g-контур "%1" с менее чем тремя точками - + sc.g-node sc.g-узел - + sc.g-pair sc.g-пара (дуга) - + Minimize contour's size Минимизировать размеры контура - + Remove pair's break points Удалитьточки излома дуги @@ -239,7 +239,7 @@ Just 1.6 and 2.0 versions supported. SCgBusMode - + Node can't have more than one bus! У sc.g-узла не может быть более чем одной sc.g-шины @@ -247,7 +247,7 @@ Just 1.6 and 2.0 versions supported. SCgContentChangeDialog - + Apply Применить @@ -255,7 +255,7 @@ Just 1.6 and 2.0 versions supported. SCgContentImageDialog - + Choose Source Image Выберите исходное изображение @@ -263,7 +263,7 @@ Just 1.6 and 2.0 versions supported. SCgContentStringDialog - + Word wrap Перенос текста @@ -271,62 +271,62 @@ Just 1.6 and 2.0 versions supported. SCgEnergyBasedArranger - + Energy-based Arranger Parameters Параметры физического размещения - + Spring rate: Коэффициент упругости пружины: - + Spring rate Коэффициент упругости пружины - + Spring length: Длина пружины: - + Natural spring length Естественная длина пружины - + Node repulsion factor: Коэффициент отталкивания узлов: - + Repulsive force factor between real nodes Коэффициент силы отталкивания между настоящими узлами - + Fake node repulsion factor: Коэффициент отталкивания фальшивых узлов: - + Repulsive force factor between real and fake nodes Коэффициент силы отталкивания между настоящими и фальшивыми узлами - + Shift factor: Коэффициент сдвига: - + Shift force factor Коэффициент силы сдвига - + Energy-based arrange Физическое размещение @@ -334,27 +334,27 @@ Just 1.6 and 2.0 versions supported. SCgFindWidget - + Find: Поиск: - + Previous Предыдущий - + Next Следующий - + Case Sensitive Учитывать регистр - + Search wrapped Поиск с учетом переноса @@ -362,24 +362,24 @@ Just 1.6 and 2.0 versions supported. SCgGridArranger - - + + X axis step Шаг по оси X - - + + Y axis step Шаг по оси Y - + Symmetrical grid Симметричная сетка - + Grid arrange Выравнивание по сетке @@ -387,12 +387,12 @@ Just 1.6 and 2.0 versions supported. SCgHorizontalArranger - + Nothing to align. Did you forget to select objects for alignment? Не указаны sc.g-элементы для выравнивания - + Horizontal arrange Горизотальное выравнивание @@ -400,17 +400,17 @@ Just 1.6 and 2.0 versions supported. SCgScene - + File opening error Ошибка при открытии файла - + Unsupported extention Расширение не поддерживается - + Current file's extention doesn't supported Расширения указанных файлов не поддерживаются @@ -418,22 +418,22 @@ Just 1.6 and 2.0 versions supported. SCgTupleArranger - + Tuple arranger Выравнивание связки с sc.g-шиной - + Horizontal offset Горизонтальное смещение - + Vertical offset Вертикальное смещение - + Distance between objects Расстояние между объектами @@ -441,7 +441,7 @@ Just 1.6 and 2.0 versions supported. SCgUndoViewModel - + <empty> <пусто> @@ -449,12 +449,12 @@ Just 1.6 and 2.0 versions supported. SCgVerticalArranger - + Nothing to align. Did you forget to select objects for alignment? Не указаны sc.g-элементы для выравнивания - + Vertical arrange Вертикальное выравнивание @@ -462,124 +462,124 @@ Just 1.6 and 2.0 versions supported. SCgView - - + + Set content Установка содержимого - + C - + Show content Показать содержимое - + H - + Show all content - + Hide all content - + Delete content Удалить содержимое - + D - - + + Change identifier Изменить идентификатор - + I - + Delete Удалить - + Delete contour Удалить контур - + Backspace - + Swap orientation Изменить направление sc.g-пары (дуги) - + S - + Copy Копировать - + Cut Вырезать - + Paste Вставить - + Select All Выделить все - + Change content Изменить содержимое - + Change type Изменить тип - + Const sc.g-константы - + Var sc.g-переменные - + New identifier: Новый идентификатор: @@ -587,189 +587,189 @@ Just 1.6 and 2.0 versions supported. SCgWindow - + &Find by Identifier... &Поиск по идентифкатору - + Undo Отменить - + Redo Вернуть - + Mini map Миникарта - + History История - + Selection mode Режим выделения - + 1 Selection mode - + Pair creation mode Режим создания sc.g-пары (дуги) - + 2 Pair creation mode - + Bus creation mode Режим создания sc.g-шины - + 3 Bus creation mode - + Contour creation mode Режим создания sc.g-контура - + 4 Contour creation mode - + Grid alignment Выравнивание по сетке - + 5 Grid alignment - + Tuple alignment Выравнивание связки с sc.g-шиной - + 6 Tuple alignment - + Vertical alignment Вертикальное выравнивание - + 7 Vertical alignment - + Horizontal alignment Горизонтальное выравнивание - + 8 Horizontal alignment - + Energy-based layout Физическое размещение - + 9 Energy-based layout - + Select input/output Выделить входящие/выходящие sc.g-пары (дуги) - + Select subgraph Выделить подграф - + Export image Экспортировать изображение - + 0 Export image - + Zoom in Увеличить - + + Zoom in - + Zoom out Уменьшить - + - Zoom out - + SCg Tools SCg инструменты - + %1 image (*.%1) %1 изображение (*.%1) - + Export file to ... Экспортировать файл в ... - + Edit Правка From 5ebe011e137a161fe5b12ed4f6ac47f2f257684e Mon Sep 17 00:00:00 2001 From: Denis Koronchik Date: Sun, 8 Sep 2013 16:55:57 +0300 Subject: [PATCH 03/71] done issue #291 --- sources/plugins/scg/gwf/gwfobjectinforeader.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sources/plugins/scg/gwf/gwfobjectinforeader.cpp b/sources/plugins/scg/gwf/gwfobjectinforeader.cpp index e05204a..9c6ac87 100644 --- a/sources/plugins/scg/gwf/gwfobjectinforeader.cpp +++ b/sources/plugins/scg/gwf/gwfobjectinforeader.cpp @@ -290,7 +290,8 @@ bool GwfObjectInfoReader::parseNode(const QDomElement &element) if (!getAttributeString(contEl, "mime_type", nodeInfo->contentMimeTypeRef())) return false; - if (!getAttributeBool(contEl, "content_visibility", nodeInfo->contentVisibleRef())) + // in old versions format, there wasn't content_visibility attribute, so we need to check if it exists + if (contEl.hasAttribute("content_visibility") && !getAttributeBool(contEl, "content_visibility", nodeInfo->contentVisibleRef())) return false; // set content to nodeInfo From 87b5147be266f877b5c020ba965a10982c0f38f1 Mon Sep 17 00:00:00 2001 From: Denis Koronchik Date: Sun, 8 Sep 2013 20:39:30 +0300 Subject: [PATCH 04/71] work on issue #284 --- sources/kbe/interfaces/editorinterface.h | 3 + sources/kbe/mainwindow.cpp | 12 ++-- sources/kbe/mainwindow.h | 4 +- sources/kbe/newfiledialog.cpp | 20 +++--- sources/kbe/newfiledialog.h | 10 +-- sources/kbe/pluginmanager.cpp | 22 +++--- sources/kbe/pluginmanager.h | 23 ++++-- sources/kbe/ui_mainwindow.h | 7 +- sources/plugins/m4scp/m4scpwindow.cpp | 5 ++ sources/plugins/m4scp/m4scpwindow.h | 2 + sources/plugins/scg/scgwindow.cpp | 5 ++ sources/plugins/scg/scgwindow.h | 2 + sources/plugins/scs/media/icons/mime_type.png | Bin 0 -> 1137 bytes sources/plugins/scs/scs.pro | 3 +- sources/plugins/scs/scs.qrc | 1 + sources/plugins/scs/scswindow.cpp | 68 +++++++++--------- sources/plugins/scs/scswindow.h | 2 + 17 files changed, 113 insertions(+), 76 deletions(-) create mode 100644 sources/plugins/scs/media/icons/mime_type.png diff --git a/sources/kbe/interfaces/editorinterface.h b/sources/kbe/interfaces/editorinterface.h index 40740a3..5ab0e01 100644 --- a/sources/kbe/interfaces/editorinterface.h +++ b/sources/kbe/interfaces/editorinterface.h @@ -169,6 +169,9 @@ class EditorFactoryInterface //! Return file extensions supported by that type of window virtual QStringList supportedFormatsExt() = 0; + + //! Return icon, that associated with editor factory + virtual QIcon icon() const = 0; }; diff --git a/sources/kbe/mainwindow.cpp b/sources/kbe/mainwindow.cpp index 0fe1779..67d569d 100644 --- a/sources/kbe/mainwindow.cpp +++ b/sources/kbe/mainwindow.cpp @@ -314,12 +314,12 @@ void MainWindow::openRecentFile() } } -EditorInterface* MainWindow::createSubWindow(const QString& ext) +EditorInterface* MainWindow::createSubWindow(const QString& type) { EditorInterface* childWindow = 0; - if (PluginManager::instance()->supportedFilesExt().contains(ext)) - childWindow = PluginManager::instance()->createWindow(ext); + if (PluginManager::instance()->editorFactories().contains(type)) + childWindow = PluginManager::instance()->createWindow(type); else return 0; @@ -337,13 +337,13 @@ QString MainWindow::getSettingKeyValueForWindow(const QString& editorType) const void MainWindow::fileNew() { - if (PluginManager::instance()->supportedFilesExt().size() > 0) + if (PluginManager::instance()->editorFactories().size() > 0) { - NewFileDialog *fileNewDlg = new NewFileDialog(PluginManager::instance()->supportedFilesExt().toList(), this); + NewFileDialog *fileNewDlg = new NewFileDialog(this); int dlgResult = fileNewDlg->exec(); if (dlgResult == QDialog::Accepted) - createSubWindow(fileNewDlg->selectedFormat()); + createSubWindow(fileNewDlg->selectedEditor()); } } diff --git a/sources/kbe/mainwindow.h b/sources/kbe/mainwindow.h index 78e3621..11a5dde 100644 --- a/sources/kbe/mainwindow.h +++ b/sources/kbe/mainwindow.h @@ -108,10 +108,10 @@ class MainWindow : public QMainWindow, /*! * Fabric method for creating subWindow. - * @param ext File format extension + * @param type String that represents window type * @return created window. */ - EditorInterface* createSubWindow(const QString& ext); + EditorInterface* createSubWindow(const QString& type); /*! * Generates a key for QSettings.setValue() using given editor type @p editorType diff --git a/sources/kbe/newfiledialog.cpp b/sources/kbe/newfiledialog.cpp index b8bc009..b2dafad 100644 --- a/sources/kbe/newfiledialog.cpp +++ b/sources/kbe/newfiledialog.cpp @@ -21,6 +21,8 @@ along with OSTIS. If not, see . */ #include "newfiledialog.h" +#include "pluginmanager.h" +#include "interfaces/editorinterface.h" #include #include @@ -28,7 +30,7 @@ along with OSTIS. If not, see . #include #include -NewFileDialog::NewFileDialog(const QStringList &availableTypes, QWidget *parent) : +NewFileDialog::NewFileDialog(QWidget *parent) : QDialog(parent) { QVBoxLayout *lay = new QVBoxLayout; @@ -36,14 +38,16 @@ NewFileDialog::NewFileDialog(const QStringList &availableTypes, QWidget *parent) mAvailableTypesList = new QListWidget(this); mAvailableTypesList->setSelectionMode(QAbstractItemView::SingleSelection); - mAvailableTypesList->setIconSize(QSize(16, 16)); + mAvailableTypesList->setIconSize(QSize(32, 32)); - for (int i = 0; i< availableTypes.length(); ++i) + QList factories = PluginManager::instance()->editorFactories().values(); + QList::iterator it, itEnd = factories.end(); + + for (it = factories.begin(); it != itEnd; ++it) { - QString ext = availableTypes.at(i); /// @todo add custom icon and tooltip support. - QListWidgetItem *itemToAdd = new QListWidgetItem(QIcon(), ext + " " + tr("format") + "(."+ ext + ")"); - itemToAdd->setData(ExtensionPayloadRole, ext); + QListWidgetItem *itemToAdd = new QListWidgetItem((*it)->icon(), (*it)->name()); + itemToAdd->setData(EditorTypeRole, (*it)->name()); mAvailableTypesList->addItem(itemToAdd); } @@ -74,7 +78,7 @@ NewFileDialog::~NewFileDialog() { } -QString NewFileDialog::selectedFormat() const +QString NewFileDialog::selectedEditor() const { - return mAvailableTypesList->selectedItems().at(0)->data(ExtensionPayloadRole).toString(); + return mAvailableTypesList->selectedItems().at(0)->data(EditorTypeRole).toString(); } diff --git a/sources/kbe/newfiledialog.h b/sources/kbe/newfiledialog.h index f60dd5d..596f648 100644 --- a/sources/kbe/newfiledialog.h +++ b/sources/kbe/newfiledialog.h @@ -15,20 +15,16 @@ class NewFileDialog : public QDialog /* Available payloads for QListWidgetItem */ enum Payload { - ExtensionPayloadRole = 0 + EditorTypeRole = 0 }; public: - /*! - * Creates an instance of NewFileDialog with specified list of available formats \p availableFormats. - * \param availableFormats List with extensions of available formats. - */ - explicit NewFileDialog(const QStringList &availableTypes, QWidget *parent = 0); + explicit NewFileDialog(QWidget *parent = 0); virtual ~NewFileDialog(); /*! * \return Format currently selected by the user */ - QString selectedFormat() const; + QString selectedEditor() const; signals: public slots: diff --git a/sources/kbe/pluginmanager.cpp b/sources/kbe/pluginmanager.cpp index 0138a1f..9402fd7 100644 --- a/sources/kbe/pluginmanager.cpp +++ b/sources/kbe/pluginmanager.cpp @@ -125,14 +125,13 @@ void PluginManager::processLoadPlugin(PluginInterface *pluginInterface) EditorFactoryInterface* factory = qobject_cast(_interface); if (factory != 0) { + QString type = factory->name(); + Q_ASSERT(mEditorFactories.find(type) == mEditorFactories.end()); + mEditorFactories[type] = factory; QStringList extList = factory->supportedFormatsExt(); QString ext; - foreach(ext, extList) - { - Q_ASSERT(mEditorFactories.find(ext) == mEditorFactories.end()); - mEditorFactories[ext] = factory; + foreach(ext, extList) mSupportedExtensions << ext; - } continue; } @@ -145,7 +144,7 @@ void PluginManager::processLoadPlugin(PluginInterface *pluginInterface) QString PluginManager::openFilters() const { QString filters; - QSet::const_iterator it; + tExtensionsSet::const_iterator it; for (it = mSupportedExtensions.begin(); it != mSupportedExtensions.end(); ++it) { if (!filters.isEmpty()) @@ -174,15 +173,20 @@ QString PluginManager::saveFilters(const QStringList &supExtensions) const return filters; } -const QSet& PluginManager::supportedFilesExt() const +const PluginManager::tExtensionsSet& PluginManager::supportedFilesExt() const { return mSupportedExtensions; } -EditorInterface* PluginManager::createWindow(const QString &ext) +const PluginManager::tEditorFactoryInterfacesMap& PluginManager::editorFactories() const +{ + return mEditorFactories; +} + +EditorInterface* PluginManager::createWindow(const QString &type) { // trying to find factory - QMap::iterator it = mEditorFactories.find(ext); + tEditorFactoryInterfacesMap::iterator it = mEditorFactories.find(type); Q_ASSERT(it != mEditorFactories.end()); diff --git a/sources/kbe/pluginmanager.h b/sources/kbe/pluginmanager.h index 40fdb72..c53fece 100644 --- a/sources/kbe/pluginmanager.h +++ b/sources/kbe/pluginmanager.h @@ -45,6 +45,11 @@ class PluginManager : public QObject private: static PluginManager *mInstance; +public: + typedef QMap tPluginLoadersMap; + typedef QSet tExtensionsSet; + typedef QMap tEditorFactoryInterfacesMap; + public: /*! Initialize plugin manager and all available plugins @@ -65,14 +70,17 @@ class PluginManager : public QObject */ QString saveFilters(const QStringList &supExtensions) const; - //! Return list of supported file extensions - const QSet& supportedFilesExt() const; + //! Return set of supported file extensions + const tExtensionsSet& supportedFilesExt() const; + + //! Return map of registered editor factories + const tEditorFactoryInterfacesMap& editorFactories() const; /*! Create editor for specified file extension - * @param ext File extension + * @param type String that represents window type * @return Return pointer to created window */ - EditorInterface* createWindow(const QString &ext); + EditorInterface* createWindow(const QString &type); protected: /*! Load plugin with specified \p path @@ -86,13 +94,14 @@ class PluginManager : public QObject */ void processLoadPlugin(PluginInterface *pluginInterface); + protected: //! Map of used plugin loaders - QMap mPluginLoaders; + tPluginLoadersMap mPluginLoaders; //! List of supported extensions - QSet mSupportedExtensions; + tExtensionsSet mSupportedExtensions; //! Registered factories - QMap mEditorFactories; + tEditorFactoryInterfacesMap mEditorFactories; signals: diff --git a/sources/kbe/ui_mainwindow.h b/sources/kbe/ui_mainwindow.h index bafda27..ec091c2 100644 --- a/sources/kbe/ui_mainwindow.h +++ b/sources/kbe/ui_mainwindow.h @@ -1,8 +1,8 @@ /******************************************************************************** ** Form generated from reading UI file 'mainwindow.ui' ** -** Created: Mon Apr 16 11:15:33 2012 -** by: Qt User Interface Compiler version 4.8.1 +** Created: Sun Sep 8 17:07:39 2013 +** by: Qt User Interface Compiler version 4.8.4 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -87,12 +87,13 @@ class Ui_MainWindow actionFeedback->setObjectName(QString::fromUtf8("actionFeedback")); actionGuide = new QAction(MainWindow); actionGuide->setObjectName(QString::fromUtf8("actionGuide")); + actionGuide->setEnabled(false); centralWidget = new QWidget(MainWindow); centralWidget->setObjectName(QString::fromUtf8("centralWidget")); MainWindow->setCentralWidget(centralWidget); menuBar = new QMenuBar(MainWindow); menuBar->setObjectName(QString::fromUtf8("menuBar")); - menuBar->setGeometry(QRect(0, 0, 600, 25)); + menuBar->setGeometry(QRect(0, 0, 600, 21)); menuFile = new QMenu(menuBar); menuFile->setObjectName(QString::fromUtf8("menuFile")); menuExport = new QMenu(menuFile); diff --git a/sources/plugins/m4scp/m4scpwindow.cpp b/sources/plugins/m4scp/m4scpwindow.cpp index 238f807..329e394 100644 --- a/sources/plugins/m4scp/m4scpwindow.cpp +++ b/sources/plugins/m4scp/m4scpwindow.cpp @@ -194,3 +194,8 @@ QStringList M4SCpWindowFactory::supportedFormatsExt() return list; } + +QIcon M4SCpWindowFactory::icon() const +{ + return M4SCpWindow::findIcon("mime_type.png"); +} diff --git a/sources/plugins/m4scp/m4scpwindow.h b/sources/plugins/m4scp/m4scpwindow.h index 6b32a55..f6e2425 100644 --- a/sources/plugins/m4scp/m4scpwindow.h +++ b/sources/plugins/m4scp/m4scpwindow.h @@ -105,6 +105,8 @@ class M4SCpWindowFactory : public QObject, EditorInterface* createInstance(); //! @copydoc EditorFactoryInterface::supportedFormatsExt QStringList supportedFormatsExt(); + //! @copydoc EditorFactoryInterface::icon + QIcon icon() const; }; #endif // M4SCPWINDOW_H diff --git a/sources/plugins/scg/scgwindow.cpp b/sources/plugins/scg/scgwindow.cpp index 8a304ef..fda64ea 100644 --- a/sources/plugins/scg/scgwindow.cpp +++ b/sources/plugins/scg/scgwindow.cpp @@ -739,3 +739,8 @@ QStringList SCgWindowFactory::supportedFormatsExt() res << "gwf"; return res; } + +QIcon SCgWindowFactory::icon() const +{ + return SCgWindow::findIcon("mime_type.png"); +} diff --git a/sources/plugins/scg/scgwindow.h b/sources/plugins/scg/scgwindow.h index 0042c94..1ddc422 100644 --- a/sources/plugins/scg/scgwindow.h +++ b/sources/plugins/scg/scgwindow.h @@ -264,6 +264,8 @@ class SCgWindowFactory : public QObject, EditorInterface* createInstance(); //! @copydoc EditorFactoryInterface::supportedFormatsExt QStringList supportedFormatsExt(); + //! @copydoc EditorFactoryInterface::icon + QIcon icon() const; }; diff --git a/sources/plugins/scs/media/icons/mime_type.png b/sources/plugins/scs/media/icons/mime_type.png new file mode 100644 index 0000000000000000000000000000000000000000..b559ed5b25ef946c19394b070944f43b7ddc69b9 GIT binary patch literal 1137 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE0wix1Z>k4UEa{HEjtq=#3k+XOiwE+VlDyqr z82-2SpV<%OaTa()76WMyFm^kcZO6dCyx7ylF~s9|?$q7+GNB^J>c1Oqw*LL$R^0o; z>y<&vWJPHMHIamtEDh=6U72K6zK1zy2xDU9xZMOn)_4 z|A`O&ZeS&~YhLUI@2Usieed(_Sr_}kdfQAhwKySn{YS??hJE?`gI~YyyU~H#MfV=@ z@0}fYcXed)1`QLgh6$WNFmaCk>^~*{p5EVo_Vn+~4C;5ox3AkbPlC+!uh(C_ zvV&!TK&3&E#yJZ|U(pj=EE3NopNl-Y=!5aJxo!%n4O8wHDz~RL^E!lR5aPyRD8cpdbz zpj)iT=+=D36K{8)aXRYu(=^{yX2FzC`i3WN)f{ELxyEbJE+1ysTsLM`sf70Du3SyZ zi6_2lhVUuRe7u@L>bd5EPHkNdr`I6B>N{7tEMYoO9CdCm-kW=&k*?kEkr+ znDPEcVCkjD&6Cp?UoMoHB-L|tx#R3(UkdjBxEV3eZfEuXh-A-B#x+4LHE-*GdwsZd z=akcWbNih2+rp%^4=&gjGW+|ixVst6x@FH#Z?2!^Q*qG3c`FB>=+XX5?#X;N+!h=1 z)^9FbTe@`fomiPOy5`fHMfbnguauoxT`6Jrob&lkHgVOn=lEmKM1JCPwE4Si@7;*` zvtL(cvsahPZF{nX<2V1Czjq6kI<2(?=3CVg*NBpo#FA92n xVq{=tY-D9%u5Dm!WnkcHCHw|OLvDUbW?Cg~4JPTU1ArPBJYD@<);T3K0RRSv@5TTC literal 0 HcmV?d00001 diff --git a/sources/plugins/scs/scs.pro b/sources/plugins/scs/scs.pro index 411bc32..9357465 100644 --- a/sources/plugins/scs/scs.pro +++ b/sources/plugins/scs/scs.pro @@ -21,8 +21,7 @@ lrelease.commands = $$[QT_INSTALL_BINS]/lrelease ${QMAKE_FILE_IN} -qm ${QMA lrelease.CONFIG += no_link target_predeps QMAKE_EXTRA_COMPILERS += lrelease -RESOURCES += \ - scs.qrc +RESOURCES += scs.qrc INCLUDEPATH += \ scsparser \ diff --git a/sources/plugins/scs/scs.qrc b/sources/plugins/scs/scs.qrc index 8ea8dd7..46dc405 100644 --- a/sources/plugins/scs/scs.qrc +++ b/sources/plugins/scs/scs.qrc @@ -4,5 +4,6 @@ media/icons/find-close.png media/icons/find-next.png media/icons/find-previous.png + media/icons/mime_type.png diff --git a/sources/plugins/scs/scswindow.cpp b/sources/plugins/scs/scswindow.cpp index 01ae23f..50add07 100644 --- a/sources/plugins/scs/scswindow.cpp +++ b/sources/plugins/scs/scswindow.cpp @@ -185,7 +185,7 @@ QIcon SCsWindow::icon() const QIcon SCsWindow::findIcon(const QString &iconName) { - return QIcon(":/media/icons/" + iconName); + return QIcon(":/scs/media/icons/" + iconName); } void SCsWindow::textChanged() @@ -195,37 +195,6 @@ void SCsWindow::textChanged() } -// --------------------- -SCsWindowFactory::SCsWindowFactory(QObject *parent) : - QObject(parent) -{ -} - -SCsWindowFactory::~SCsWindowFactory() -{ -} - -const QString& SCsWindowFactory::name() const -{ - static QString name = "scs"; - return name; -} - -EditorInterface* SCsWindowFactory::createInstance() -{ - return new SCsWindow(""); -} - -QStringList SCsWindowFactory::supportedFormatsExt() -{ - QStringList list; - list << "scs"; - - return list; -} - - - void SCsWindow::findNext() { mEditor->find(mFindWidget->text(), mFindWidget->getFlags()); @@ -261,3 +230,38 @@ void SCsWindow::onEscapePressed() mErrorTable->hide(); mEditor->setFocus(); } + + +// --------------------- +SCsWindowFactory::SCsWindowFactory(QObject *parent) : + QObject(parent) +{ +} + +SCsWindowFactory::~SCsWindowFactory() +{ +} + +const QString& SCsWindowFactory::name() const +{ + static QString name = "scs"; + return name; +} + +EditorInterface* SCsWindowFactory::createInstance() +{ + return new SCsWindow(""); +} + +QStringList SCsWindowFactory::supportedFormatsExt() +{ + QStringList list; + list << "scs"; + + return list; +} + +QIcon SCsWindowFactory::icon() const +{ + return SCsWindow::findIcon("mime_type.png"); +} diff --git a/sources/plugins/scs/scswindow.h b/sources/plugins/scs/scswindow.h index 38597b7..402d39e 100644 --- a/sources/plugins/scs/scswindow.h +++ b/sources/plugins/scs/scswindow.h @@ -115,6 +115,8 @@ class SCsWindowFactory : public QObject, EditorInterface* createInstance(); //! @copydoc EditorFactoryInterface::supportedFormatsExt QStringList supportedFormatsExt(); + //! @copydoc EditorFactoryInterface::icon + QIcon icon() const; }; #endif // SCSWINDOW_H From ee9c51d55bb85fc529d37796a1157815acc227aa Mon Sep 17 00:00:00 2001 From: Denis Koronchik Date: Wed, 11 Sep 2013 00:25:39 +0300 Subject: [PATCH 05/71] fixed bug with files open --- sources/kbe/mainwindow.cpp | 28 ++++++++++++++++----- sources/kbe/mainwindow.h | 13 +++++++--- sources/kbe/newfiledialog.cpp | 2 +- sources/kbe/pluginmanager.cpp | 35 ++++++++++++++++++++------ sources/kbe/pluginmanager.h | 24 ++++++++++++------ sources/plugins/scg/scgexportimage.cpp | 1 + tools/debian/control | 4 +-- tools/make-deb.sh | 2 +- 8 files changed, 81 insertions(+), 28 deletions(-) diff --git a/sources/kbe/mainwindow.cpp b/sources/kbe/mainwindow.cpp index 67d569d..4b227c3 100644 --- a/sources/kbe/mainwindow.cpp +++ b/sources/kbe/mainwindow.cpp @@ -314,12 +314,28 @@ void MainWindow::openRecentFile() } } -EditorInterface* MainWindow::createSubWindow(const QString& type) +EditorInterface* MainWindow::createSubWindowByType(const QString& type) { EditorInterface* childWindow = 0; - if (PluginManager::instance()->editorFactories().contains(type)) - childWindow = PluginManager::instance()->createWindow(type); + if (PluginManager::instance()->editorFactoriesByType().contains(type)) + childWindow = PluginManager::instance()->createWindowByType(type); + else + return 0; + + mWidget2EditorInterface[childWindow->widget()] = childWindow; + mTabWidget->addSubWindow(childWindow); + childWindow->_setObserver(this); + + return childWindow; +} + +EditorInterface* MainWindow::createSubWindowByExt(const QString& ext) +{ + EditorInterface* childWindow = 0; + + if (PluginManager::instance()->editorFactoriesByExt().contains(ext)) + childWindow = PluginManager::instance()->createWindowByExt(ext); else return 0; @@ -337,13 +353,13 @@ QString MainWindow::getSettingKeyValueForWindow(const QString& editorType) const void MainWindow::fileNew() { - if (PluginManager::instance()->editorFactories().size() > 0) + if (PluginManager::instance()->editorFactoriesByType().size() > 0) { NewFileDialog *fileNewDlg = new NewFileDialog(this); int dlgResult = fileNewDlg->exec(); if (dlgResult == QDialog::Accepted) - createSubWindow(fileNewDlg->selectedEditor()); + createSubWindowByType(fileNewDlg->selectedEditor()); } } @@ -374,7 +390,7 @@ void MainWindow::load(QString fileName) QString ext = fi.suffix(); if(PluginManager::instance()->supportedFilesExt().contains(ext)) { - EditorInterface* childWindow = createSubWindow(ext); + EditorInterface* childWindow = createSubWindowByExt(ext); if (childWindow->loadFromFile(fileName)) { diff --git a/sources/kbe/mainwindow.h b/sources/kbe/mainwindow.h index 11a5dde..5a704a4 100644 --- a/sources/kbe/mainwindow.h +++ b/sources/kbe/mainwindow.h @@ -107,11 +107,18 @@ class MainWindow : public QMainWindow, bool checkSubWindowSavedState(); /*! - * Fabric method for creating subWindow. + * Create window by specified type * @param type String that represents window type - * @return created window. + * @return If window created, then return pointer to it. Otherwise it returns null. */ - EditorInterface* createSubWindow(const QString& type); + EditorInterface* createSubWindowByType(const QString& type); + + /*! + * Create window for specified fiel extension support + * @param ext File extension + * @return If window created, then return pointer to it. Otherwise it returns null. + */ + EditorInterface* createSubWindowByExt(const QString& ext); /*! * Generates a key for QSettings.setValue() using given editor type @p editorType diff --git a/sources/kbe/newfiledialog.cpp b/sources/kbe/newfiledialog.cpp index b2dafad..6ffc21b 100644 --- a/sources/kbe/newfiledialog.cpp +++ b/sources/kbe/newfiledialog.cpp @@ -40,7 +40,7 @@ NewFileDialog::NewFileDialog(QWidget *parent) : mAvailableTypesList->setSelectionMode(QAbstractItemView::SingleSelection); mAvailableTypesList->setIconSize(QSize(32, 32)); - QList factories = PluginManager::instance()->editorFactories().values(); + QList factories = PluginManager::instance()->editorFactoriesByType().values(); QList::iterator it, itEnd = factories.end(); for (it = factories.begin(); it != itEnd; ++it) diff --git a/sources/kbe/pluginmanager.cpp b/sources/kbe/pluginmanager.cpp index 9402fd7..4f3ed9d 100644 --- a/sources/kbe/pluginmanager.cpp +++ b/sources/kbe/pluginmanager.cpp @@ -126,12 +126,15 @@ void PluginManager::processLoadPlugin(PluginInterface *pluginInterface) if (factory != 0) { QString type = factory->name(); - Q_ASSERT(mEditorFactories.find(type) == mEditorFactories.end()); - mEditorFactories[type] = factory; + Q_ASSERT(mEditorFactoriesByType.find(type) == mEditorFactoriesByType.end()); + mEditorFactoriesByType[type] = factory; QStringList extList = factory->supportedFormatsExt(); QString ext; - foreach(ext, extList) + foreach(ext, extList) + { mSupportedExtensions << ext; + mEditorFactoriesByExt[ext] = factory; + } continue; } @@ -178,17 +181,33 @@ const PluginManager::tExtensionsSet& PluginManager::supportedFilesExt() const return mSupportedExtensions; } -const PluginManager::tEditorFactoryInterfacesMap& PluginManager::editorFactories() const +const PluginManager::tEditorFactoryInterfacesMap& PluginManager::editorFactoriesByType() const { - return mEditorFactories; + return mEditorFactoriesByType; } -EditorInterface* PluginManager::createWindow(const QString &type) +const PluginManager::tEditorFactoryInterfacesMap& PluginManager::editorFactoriesByExt() const +{ + return mEditorFactoriesByExt; +} + +EditorInterface* PluginManager::createWindowByType(const QString &type) +{ + // trying to find factory + tEditorFactoryInterfacesMap::iterator it = mEditorFactoriesByType.find(type); + + Q_ASSERT(it != mEditorFactoriesByType.end()); + + return (*it)->createInstance(); +} + + +EditorInterface* PluginManager::createWindowByExt(const QString &ext) { // trying to find factory - tEditorFactoryInterfacesMap::iterator it = mEditorFactories.find(type); + tEditorFactoryInterfacesMap::iterator it = mEditorFactoriesByExt.find(ext); - Q_ASSERT(it != mEditorFactories.end()); + Q_ASSERT(it != mEditorFactoriesByExt.end()); return (*it)->createInstance(); } diff --git a/sources/kbe/pluginmanager.h b/sources/kbe/pluginmanager.h index c53fece..c25a59c 100644 --- a/sources/kbe/pluginmanager.h +++ b/sources/kbe/pluginmanager.h @@ -73,14 +73,22 @@ class PluginManager : public QObject //! Return set of supported file extensions const tExtensionsSet& supportedFilesExt() const; - //! Return map of registered editor factories - const tEditorFactoryInterfacesMap& editorFactories() const; + //! Return map of registered editor factories by types + const tEditorFactoryInterfacesMap& editorFactoriesByType() const; + //! Return map of registered editor factories by file extensions + const tEditorFactoryInterfacesMap& editorFactoriesByExt() const; - /*! Create editor for specified file extension + /*! Create editor for specified window type * @param type String that represents window type - * @return Return pointer to created window + * @return If window created, then return pointer to it; otherwise returns null. */ - EditorInterface* createWindow(const QString &type); + EditorInterface* createWindowByType(const QString &type); + + /*! Create editor for specified file extension + * @param ext File extension + * @return If window created, then return pointer to it; otherwise returns null. + */ + EditorInterface* createWindowByExt(const QString &ext); protected: /*! Load plugin with specified \p path @@ -100,8 +108,10 @@ class PluginManager : public QObject tPluginLoadersMap mPluginLoaders; //! List of supported extensions tExtensionsSet mSupportedExtensions; - //! Registered factories - tEditorFactoryInterfacesMap mEditorFactories; + //! Registered factories by types + tEditorFactoryInterfacesMap mEditorFactoriesByType; + //! REgistered factories by extinsions + tEditorFactoryInterfacesMap mEditorFactoriesByExt; signals: diff --git a/sources/plugins/scg/scgexportimage.cpp b/sources/plugins/scg/scgexportimage.cpp index eaa816e..e49f1e6 100644 --- a/sources/plugins/scg/scgexportimage.cpp +++ b/sources/plugins/scg/scgexportimage.cpp @@ -57,6 +57,7 @@ bool SCgExportImage::doExport(SCgScene *scene, const QString &fileName) QSize imgSize(sz.width() + 10, sz.height() + 10); QImage img(imgSize, QImage::Format_ARGB32_Premultiplied); + img.fill(Qt::transparent); if (!img.isNull()) { QPainter painter(&img); diff --git a/tools/debian/control b/tools/debian/control index 9997fea..3b29c3f 100644 --- a/tools/debian/control +++ b/tools/debian/control @@ -2,8 +2,8 @@ Package: kbe Version: 0.3.0 Section: science Priority: optional -Architecture: i386 -Installed-Size: 20684 +Architecture: amd64 +Installed-Size: 2020 Depends: libc6 (>= 2.3), libgcc1 (>= 1:4.1.1), libqt4-svg (>= 4:4.5.3), libqt4-xml (>= 4:4.5.3), libqt4-xmlpatterns (>= 4:4.5.3), libqtcore4 (>= 4:4.7.0~beta1), libqtgui4 (>= 4:4.7.0~beta1) Maintainer: Nikita Grishko Homepage: https://github.com/deniskoronchik/kbe diff --git a/tools/make-deb.sh b/tools/make-deb.sh index 2f2b462..a364796 100755 --- a/tools/make-deb.sh +++ b/tools/make-deb.sh @@ -26,7 +26,7 @@ build_source_files() { echo -en "\033[37;1;41mBuild binary...\033[0m\n" sed '/updater/d' all.pro > all_linux.pro - qmake all_linux.pro + qmake-qt4 all_linux.pro make } From 3037b68f1886bc41b30955580c23aff757c30268 Mon Sep 17 00:00:00 2001 From: Denis Koronchik Date: Thu, 12 Sep 2013 22:27:56 +0300 Subject: [PATCH 06/71] fixed bug with noorient pair save/load --- sources/plugins/scg/scgalphabet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/plugins/scg/scgalphabet.cpp b/sources/plugins/scg/scgalphabet.cpp index 2ee67b6..cbf0cab 100644 --- a/sources/plugins/scg/scgalphabet.cpp +++ b/sources/plugins/scg/scgalphabet.cpp @@ -164,7 +164,7 @@ void SCgAlphabet::initialize() // scg core pairs mObjectTypes["pair/-/-/-/orient/accessory"] = createPairIcon(pairSize, "pair/-/-/-/orient/accessory"); - mObjectTypes["pair/-/-/-/noorien"] = createPairIcon(pairSize, "pair/-/-/-/noorien"); + mObjectTypes["pair/-/-/-/noorient"] = createPairIcon(pairSize, "pair/-/-/-/noorient"); mObjectTypes["pair/-/-/-/orient"] = createPairIcon(pairSize, "pair/-/-/-/orient"); // scg extencion pairs From b9d58e17bc6c06e60bf1879f3f0d1cd798d10986 Mon Sep 17 00:00:00 2001 From: asvitenkov Date: Sat, 14 Sep 2013 14:06:15 +0300 Subject: [PATCH 07/71] fixed some build errors --- .../scsmultilinecommenthighlightingrule.cpp | 0 .../scsmultilinecommenthighlightingrule.h | 0 sources/plugins/scs/scs.pro | 13 +- .../scs/scsabstracthighlightingrule.cpp | 52 ------ .../plugins/scs/scsabstracthighlightingrule.h | 47 ------ .../plugins/scs/scshighlightingrulespool.cpp | 153 ------------------ .../plugins/scs/scshighlightingrulespool.h | 48 ------ .../plugins/scs/scsstdhighlightingrule.cpp | 50 ------ sources/plugins/scs/scsstdhighlightingrule.h | 40 ----- 9 files changed, 8 insertions(+), 395 deletions(-) rename sources/plugins/scs/{ => highlightingrules}/scsmultilinecommenthighlightingrule.cpp (100%) rename sources/plugins/scs/{ => highlightingrules}/scsmultilinecommenthighlightingrule.h (100%) delete mode 100644 sources/plugins/scs/scsabstracthighlightingrule.cpp delete mode 100644 sources/plugins/scs/scsabstracthighlightingrule.h delete mode 100644 sources/plugins/scs/scshighlightingrulespool.cpp delete mode 100644 sources/plugins/scs/scshighlightingrulespool.h delete mode 100644 sources/plugins/scs/scsstdhighlightingrule.cpp delete mode 100644 sources/plugins/scs/scsstdhighlightingrule.h diff --git a/sources/plugins/scs/scsmultilinecommenthighlightingrule.cpp b/sources/plugins/scs/highlightingrules/scsmultilinecommenthighlightingrule.cpp similarity index 100% rename from sources/plugins/scs/scsmultilinecommenthighlightingrule.cpp rename to sources/plugins/scs/highlightingrules/scsmultilinecommenthighlightingrule.cpp diff --git a/sources/plugins/scs/scsmultilinecommenthighlightingrule.h b/sources/plugins/scs/highlightingrules/scsmultilinecommenthighlightingrule.h similarity index 100% rename from sources/plugins/scs/scsmultilinecommenthighlightingrule.h rename to sources/plugins/scs/highlightingrules/scsmultilinecommenthighlightingrule.h diff --git a/sources/plugins/scs/scs.pro b/sources/plugins/scs/scs.pro index 9357465..4740f0f 100644 --- a/sources/plugins/scs/scs.pro +++ b/sources/plugins/scs/scs.pro @@ -28,10 +28,11 @@ INCLUDEPATH += \ highlightingrules HEADERS += \ - highlightingrules/scshighlightingrulespool.h \ + highlightingrules/scsstdhighlightingrule.h \ highlightingrules/scsmultilinehighlightingrule.h \ + highlightingrules/scsmultilinecommenthighlightingrule.h \ + highlightingrules/scshighlightingrulespool.h \ highlightingrules/scsabstracthighlightingrule.h \ - highlightingrules/scsstdhighlightingrule.h \ scsparser/scsparserexception.h \ scsparser/scsparserwrapper.h \ scsparser/SCsCLexer.h \ @@ -48,10 +49,12 @@ HEADERS += \ scscodeanalyzer.h \ scscodecompleter.h + SOURCES += \ - highlightingrules/scshighlightingrulespool.cpp \ - highlightingrules/scsmultilinehighlightingrule.cpp \ highlightingrules/scsstdhighlightingrule.cpp \ + highlightingrules/scsmultilinehighlightingrule.cpp \ + highlightingrules/scsmultilinecommenthighlightingrule.cpp \ + highlightingrules/scshighlightingrulespool.cpp \ highlightingrules/scsabstracthighlightingrule.cpp \ scsparser/scsparserwrapper.cpp \ scsparser/scsparserexception.cpp \ @@ -69,4 +72,4 @@ SOURCES += \ scssyntaxhighlighter.cpp \ scscodecompleter.cpp -LIBS+= -lantlr3c + diff --git a/sources/plugins/scs/scsabstracthighlightingrule.cpp b/sources/plugins/scs/scsabstracthighlightingrule.cpp deleted file mode 100644 index 5418444..0000000 --- a/sources/plugins/scs/scsabstracthighlightingrule.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/* ------------------------------------------------------------------------------ -This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) -For the latest info, see http://www.ostis.net - -Copyright (c) 2010 OSTIS - -OSTIS 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 3 of the License, or -(at your option) any later version. - -OSTIS is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with OSTIS. If not, see . ------------------------------------------------------------------------------ -*/ - -#include "scsabstracthighlightingrule.h" - -SCsAbstractHighlightingRule::SCsAbstractHighlightingRule() -{ -} - -SCsAbstractHighlightingRule::SCsAbstractHighlightingRule(QTextCharFormat format) -{ - mFormat = format; -} - -SCsAbstractHighlightingRule::~SCsAbstractHighlightingRule() -{ - -} - -void SCsAbstractHighlightingRule::assignFormat(SCsSyntaxHighlighter *highlighter, const QString &text) -{ - -} - -void SCsAbstractHighlightingRule::setFormat(QTextCharFormat format) -{ - mFormat = format; -} - -QTextCharFormat SCsAbstractHighlightingRule::format() -{ - return mFormat; -} diff --git a/sources/plugins/scs/scsabstracthighlightingrule.h b/sources/plugins/scs/scsabstracthighlightingrule.h deleted file mode 100644 index 04e8cd2..0000000 --- a/sources/plugins/scs/scsabstracthighlightingrule.h +++ /dev/null @@ -1,47 +0,0 @@ -/* ------------------------------------------------------------------------------ -This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) -For the latest info, see http://www.ostis.net - -Copyright (c) 2010 OSTIS - -OSTIS 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 3 of the License, or -(at your option) any later version. - -OSTIS is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with OSTIS. If not, see . ------------------------------------------------------------------------------ -*/ - -#ifndef SCSABSTRACTHIGHLIGHTINGRULE_H -#define SCSABSTRACTHIGHLIGHTINGRULE_H - -#include "scssyntaxhighlighter.h" - -#include - -class SCsSyntaxHighlighter; - -class SCsAbstractHighlightingRule -{ -public: - SCsAbstractHighlightingRule(); - SCsAbstractHighlightingRule(QTextCharFormat format); - QTextCharFormat format(); - void setFormat(QTextCharFormat format); - ~SCsAbstractHighlightingRule(); - virtual void assignFormat(SCsSyntaxHighlighter* highlighter, const QString& text); - -private: - QTextCharFormat mFormat; - -}; - -#endif // SCSABSTRACTHIGHLIGHTINGRULE_H diff --git a/sources/plugins/scs/scshighlightingrulespool.cpp b/sources/plugins/scs/scshighlightingrulespool.cpp deleted file mode 100644 index b9b28bf..0000000 --- a/sources/plugins/scs/scshighlightingrulespool.cpp +++ /dev/null @@ -1,153 +0,0 @@ -/* ------------------------------------------------------------------------------ -This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) -For the latest info, see http://www.ostis.net - -Copyright (c) 2010 OSTIS - -OSTIS 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 3 of the License, or -(at your option) any later version. - -OSTIS is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with OSTIS. If not, see . ------------------------------------------------------------------------------ -*/ - -#include "scshighlightingrulespool.h" -#include "scsstdhighlightingrule.h" - -SCsHighlightingRulesPool* SCsHighlightingRulesPool::msInstance = 0; - -SCsHighlightingRulesPool* SCsHighlightingRulesPool::getInstance() -{ - if(!SCsHighlightingRulesPool::msInstance) - { - SCsHighlightingRulesPool::msInstance = new SCsHighlightingRulesPool(); - } - - return SCsHighlightingRulesPool::msInstance; -} - -SCsHighlightingRulesPool::SCsHighlightingRulesPool() -{ - QTextCharFormat commaFormat; - QBrush brush = QBrush(Qt::black); - commaFormat.setForeground(brush); - QRegExp pattern = QRegExp("[\\.,;:=]"); - mRules.append(new SCsStdHighlightingRule(pattern, commaFormat)); - - initiScNodesRules(); - initScArcRules(); - - QTextCharFormat format; - format.setForeground(QBrush(QColor(0, 128, 0))); - pattern = QRegExp("\".*\""); - mRules.append(new SCsStdHighlightingRule(pattern, format)); - - pattern = QRegExp("/\".*\"/"); - format.setForeground(QBrush(QColor(0, 164, 0))); - mRules.append(new SCsStdHighlightingRule(pattern, format)); - - format.setForeground(Qt::blue); - pattern = QRegExp("#include"); - mRules.append(new SCsStdHighlightingRule(pattern, format)); - - format.setForeground(Qt::darkGray); - QRegExp start = QRegExp("//"); - QRegExp end = QRegExp("\\n"); - mRules.append(new SCsMultiLineCommentHighlightingRule(start, end, format)); - - format.setForeground(Qt::darkGray); - start = QRegExp("/\\*"); - end = QRegExp("\\*/"); - mRules.append(new SCsMultiLineCommentHighlightingRule(start, end, format)); - -} - -void SCsHighlightingRulesPool::initiScNodesRules() -{ - QTextCharFormat format; - - // Attr - format.setForeground(QColor(255, 128, 64));// const - mRules.append(new SCsStdHighlightingRule(QRegExp("[A-Za-z0-9_]+:"), format)); - format.setForeground(QColor(255, 128, 64));// var - mRules.append(new SCsStdHighlightingRule(QRegExp("[A-Za-z0-9_]+::"), format)); - format.setForeground(QColor(255, 128, 64));// meta - mRules.append(new SCsStdHighlightingRule(QRegExp("[A-Za-z0-9_]+:::"), format)); - - // Set - format.setForeground(QColor(0, 0, 64));// const - mRules.append(new SCsStdHighlightingRule(QRegExp("[{}]"), format)); - format.setForeground(QColor(0, 0, 64));// var - mRules.append(new SCsStdHighlightingRule(QRegExp("\\{\\."), format)); - mRules.append(new SCsStdHighlightingRule(QRegExp("\\.\\}"), format)); - format.setForeground(QColor(0, 0, 64));// meta - mRules.append(new SCsStdHighlightingRule(QRegExp("\\{\\.\\."), format)); - mRules.append(new SCsStdHighlightingRule(QRegExp("\\.\\.\\}"), format)); - - // Contour - format.setForeground(QColor(122, 55, 139));// const - mRules.append(new SCsStdHighlightingRule(QRegExp("[\\[\\]]"), format)); - format.setForeground(QColor(180, 82, 205));// var - mRules.append(new SCsStdHighlightingRule(QRegExp("\\[\\."), format)); - mRules.append(new SCsStdHighlightingRule(QRegExp("\\.\\]"), format)); - format.setForeground(QColor(209, 95, 238));// meta - mRules.append(new SCsStdHighlightingRule(QRegExp("\\[\\.\\."), format)); - mRules.append(new SCsStdHighlightingRule(QRegExp("\\.\\.\\]"), format)); - - // SCs link - format.setForeground(QColor(0, 0, 139));// const - mRules.append(new SCsStdHighlightingRule(QRegExp("$[A-Za-z0-9]+[_]*[A-Za-z]*"), format)); - format.setForeground(QColor(0, 0, 205));// var - mRules.append(new SCsStdHighlightingRule(QRegExp("$_[A-Za-z0-9]+[_]*[A-Za-z]*"), format)); - format.setForeground(QColor(0, 0, 238));// meta - mRules.append(new SCsStdHighlightingRule(QRegExp("$__[A-Za-z0-9]+[_]*[A-Za-z]*"), format)); - -} - -void SCsHighlightingRulesPool::initScArcRules() -{ - QTextCharFormat format; - - // Pos - format.setForeground(QColor(255, 0, 128)); // const - mRules.append(new SCsStdHighlightingRule(QRegExp("\\-\\>"), format)); - format.setForeground(QColor(255, 0, 128)); // var - mRules.append(new SCsStdHighlightingRule(QRegExp("\\-\\>\\>"), format)); - format.setForeground(QColor(255, 0, 128)); // meta - mRules.append(new SCsStdHighlightingRule(QRegExp("\\-\\>\\>\\>"), format)); - - // Neg - format.setForeground(QColor(255, 0, 128)); // const - mRules.append(new SCsStdHighlightingRule(QRegExp("/\\>"), format)); - format.setForeground(QColor(255, 0, 128)); // var - mRules.append(new SCsStdHighlightingRule(QRegExp("/\\>\\>"), format)); - format.setForeground(QColor(255, 0, 128)); // meta - mRules.append(new SCsStdHighlightingRule(QRegExp("/\\>\\>\\>"), format)); - - // Fuzzy - format.setForeground(QColor(255, 0, 128)); // const - mRules.append(new SCsStdHighlightingRule(QRegExp("~\\>"), format)); - format.setForeground(QColor(255, 0, 128)); // var - mRules.append(new SCsStdHighlightingRule(QRegExp("~\\>\\>"), format)); - format.setForeground(QColor(255, 0, 128)); // meta - mRules.append(new SCsStdHighlightingRule(QRegExp("~\\>\\>\\>"), format)); - -} - -QList SCsHighlightingRulesPool::rules() -{ - return mRules; -} - -SCsHighlightingRulesPool::~SCsHighlightingRulesPool() -{ -} diff --git a/sources/plugins/scs/scshighlightingrulespool.h b/sources/plugins/scs/scshighlightingrulespool.h deleted file mode 100644 index 6fb4e31..0000000 --- a/sources/plugins/scs/scshighlightingrulespool.h +++ /dev/null @@ -1,48 +0,0 @@ -/* ------------------------------------------------------------------------------ -This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) -For the latest info, see http://www.ostis.net - -Copyright (c) 2010 OSTIS - -OSTIS 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 3 of the License, or -(at your option) any later version. - -OSTIS is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with OSTIS. If not, see . ------------------------------------------------------------------------------ -*/ - -#ifndef SCSHIGHLIGHTINGRULESPOOL_H -#define SCSHIGHLIGHTINGRULESPOOL_H - -#include "scsabstracthighlightingrule.h" -#include "scsmultilinecommenthighlightingrule.h" - -#include - -class SCsHighlightingRulesPool -{ -public: - static SCsHighlightingRulesPool* getInstance(); - QList rules(); - ~SCsHighlightingRulesPool(); - -private: - SCsHighlightingRulesPool(); - - void initScArcRules(); - void initiScNodesRules(); - - QList mRules; - static SCsHighlightingRulesPool* msInstance; -}; - -#endif // SCSHIGHLIGHTINGRULESPOOL_H diff --git a/sources/plugins/scs/scsstdhighlightingrule.cpp b/sources/plugins/scs/scsstdhighlightingrule.cpp deleted file mode 100644 index 80d72ab..0000000 --- a/sources/plugins/scs/scsstdhighlightingrule.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/* ------------------------------------------------------------------------------ -This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) -For the latest info, see http://www.ostis.net - -Copyright (c) 2010 OSTIS - -OSTIS 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 3 of the License, or -(at your option) any later version. - -OSTIS is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with OSTIS. If not, see . ------------------------------------------------------------------------------ -*/ - -#include "scsstdhighlightingrule.h" - -SCsStdHighlightingRule::SCsStdHighlightingRule() -{ -} - -SCsStdHighlightingRule::SCsStdHighlightingRule(QRegExp pattern, QTextCharFormat format) - : SCsAbstractHighlightingRule(format) -{ - mPattern = pattern; -} - -QRegExp SCsStdHighlightingRule::getPattern() -{ - return mPattern; -} - -void SCsStdHighlightingRule::assignFormat(SCsSyntaxHighlighter *highliter, const QString& text) -{ - QRegExp expression(mPattern); - int index = expression.indexIn(text); - while (index >= 0) - { - int length = expression.matchedLength(); - highliter->setFormating(index,length, format()); - index = expression.indexIn(text, index + length); - } -} diff --git a/sources/plugins/scs/scsstdhighlightingrule.h b/sources/plugins/scs/scsstdhighlightingrule.h deleted file mode 100644 index af9e846..0000000 --- a/sources/plugins/scs/scsstdhighlightingrule.h +++ /dev/null @@ -1,40 +0,0 @@ -/* ------------------------------------------------------------------------------ -This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) -For the latest info, see http://www.ostis.net - -Copyright (c) 2010 OSTIS - -OSTIS 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 3 of the License, or -(at your option) any later version. - -OSTIS is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with OSTIS. If not, see . ------------------------------------------------------------------------------ -*/ - -#ifndef SCSSTDHIGHLIGHTINGRULE_H -#define SCSSTDHIGHLIGHTINGRULE_H - -#include "scsabstracthighlightingrule.h" - -class SCsStdHighlightingRule : public SCsAbstractHighlightingRule -{ -public: - SCsStdHighlightingRule(); - SCsStdHighlightingRule(QRegExp pattern, QTextCharFormat format); - QRegExp getPattern(); - virtual void assignFormat(SCsSyntaxHighlighter* highlighter, const QString& text); - -private: - QRegExp mPattern; -}; - -#endif // SCSSTDHIGHLIGHTINGRULE_H From ad62177ac285d5a911e47a2629e3aad52088050b Mon Sep 17 00:00:00 2001 From: Denis Koronchik Date: Sat, 14 Sep 2013 14:13:24 +0300 Subject: [PATCH 08/71] fixed error with references to local objects --- sources/kbe/ui_mainwindow.h | 2 +- sources/plugins/scg/scgalphabet.cpp | 8 ++++---- sources/plugins/scg/scgalphabet.h | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/sources/kbe/ui_mainwindow.h b/sources/kbe/ui_mainwindow.h index ec091c2..2d96af9 100644 --- a/sources/kbe/ui_mainwindow.h +++ b/sources/kbe/ui_mainwindow.h @@ -1,7 +1,7 @@ /******************************************************************************** ** Form generated from reading UI file 'mainwindow.ui' ** -** Created: Sun Sep 8 17:07:39 2013 +** Created: Sat Sep 14 13:49:29 2013 ** by: Qt User Interface Compiler version 4.8.4 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! diff --git a/sources/plugins/scg/scgalphabet.cpp b/sources/plugins/scg/scgalphabet.cpp index cbf0cab..f11a4b6 100644 --- a/sources/plugins/scg/scgalphabet.cpp +++ b/sources/plugins/scg/scgalphabet.cpp @@ -315,7 +315,7 @@ SCgAlphabet::SCgPermType SCgAlphabet::aliasToPermanencyCode(const QString &alias return mPermTypes[alias]; } -const QString& SCgAlphabet::aliasFromConstCode(SCgAlphabet::SCgConstType code) const +QString SCgAlphabet::aliasFromConstCode(SCgAlphabet::SCgConstType code) const { if (!mConstAliases.contains(code)) return msEmptyTypeAlias; @@ -323,7 +323,7 @@ const QString& SCgAlphabet::aliasFromConstCode(SCgAlphabet::SCgConstType code) c return mConstAliases[code]; } -const QString& SCgAlphabet::aliasFromStructCode(SCgAlphabet::SCgNodeStructType code) const +QString SCgAlphabet::aliasFromStructCode(SCgAlphabet::SCgNodeStructType code) const { if (!mStructAliases.contains(code)) return msEmptyTypeAlias; @@ -331,7 +331,7 @@ const QString& SCgAlphabet::aliasFromStructCode(SCgAlphabet::SCgNodeStructType c return mStructAliases[code]; } -const QString& SCgAlphabet::aliasFromPositiveCode(SCgAlphabet::SCgPosType code) const +QString SCgAlphabet::aliasFromPositiveCode(SCgAlphabet::SCgPosType code) const { if (!mPositivityAliases.contains(code)) return msEmptyTypeAlias; @@ -339,7 +339,7 @@ const QString& SCgAlphabet::aliasFromPositiveCode(SCgAlphabet::SCgPosType code) return mPositivityAliases[code]; } -const QString& SCgAlphabet::aliasFromPermanencyCode(SCgAlphabet::SCgPermType code) const +QString SCgAlphabet::aliasFromPermanencyCode(SCgAlphabet::SCgPermType code) const { if (!mPermanencyAliases.contains(code)) return msEmptyTypeAlias; diff --git a/sources/plugins/scg/scgalphabet.h b/sources/plugins/scg/scgalphabet.h index 3a39bea..0b45e0f 100644 --- a/sources/plugins/scg/scgalphabet.h +++ b/sources/plugins/scg/scgalphabet.h @@ -132,22 +132,22 @@ Q_OBJECT /*! Converts const type code into string alias * @param code Constant type code to convert */ - const QString& aliasFromConstCode(SCgConstType code) const; + QString aliasFromConstCode(SCgConstType code) const; /*! Converts struct type code into string alias * @param code Struct type code to convert */ - const QString& aliasFromStructCode(SCgNodeStructType code) const; + QString aliasFromStructCode(SCgNodeStructType code) const; /*! Converts positivity type code into string alias * @param code Positivity code to convert */ - const QString& aliasFromPositiveCode(SCgPosType code) const; + QString aliasFromPositiveCode(SCgPosType code) const; /*! Converts permanency type code into string alias * @param code Permanency type code to convert */ - const QString& aliasFromPermanencyCode(SCgPermType code) const; + QString aliasFromPermanencyCode(SCgPermType code) const; protected: QIcon createNodeIcon(const QSize &size, const SCgConstType &type_const, const SCgNodeStructType &type_struct); From 981e4c71b66ececfb689029ed8c4fdbe32253f2a Mon Sep 17 00:00:00 2001 From: Denis Koronchik Date: Sat, 14 Sep 2013 14:29:11 +0300 Subject: [PATCH 09/71] fix linking of scs plugin --- sources/plugins/scs/scs.pro | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sources/plugins/scs/scs.pro b/sources/plugins/scs/scs.pro index 4740f0f..e504fe4 100644 --- a/sources/plugins/scs/scs.pro +++ b/sources/plugins/scs/scs.pro @@ -10,7 +10,9 @@ CONFIG += plugin OBJECTS_DIR = obj MOC_DIR = moc - +unix { + LIBS+= -lantlr3c +} TRANSLATIONS += media/translations/scs_en_EN.ts \ media/translations/scs_ru_RU.ts From 829adf23463123876b98e8f9d143f049ddb123a6 Mon Sep 17 00:00:00 2001 From: svetoff Date: Sat, 14 Sep 2013 16:33:16 +0300 Subject: [PATCH 10/71] fixed char position in line --- sources/plugins/scs/scscodeeditor.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/sources/plugins/scs/scscodeeditor.cpp b/sources/plugins/scs/scscodeeditor.cpp index 22d19b9..0705c92 100644 --- a/sources/plugins/scs/scscodeeditor.cpp +++ b/sources/plugins/scs/scscodeeditor.cpp @@ -308,8 +308,14 @@ void SCsCodeEditor::moveTextCursor(int line, int charPos) QTextCursor cursor = textCursor(); cursor.movePosition(QTextCursor::Start); - cursor.movePosition(QTextCursor::NextBlock, QTextCursor::MoveAnchor, line-1); - cursor.movePosition(QTextCursor::NextCharacter, QTextCursor::MoveAnchor, charPos); + cursor.movePosition(QTextCursor::Down, QTextCursor::MoveAnchor, line-1); + if( cursor.movePosition(QTextCursor::EndOfLine, QTextCursor::MoveAnchor) ) + { + if( cursor.columnNumber() < charPos) + charPos = 0; + } + cursor.movePosition(QTextCursor::StartOfLine, QTextCursor::MoveAnchor); + cursor.movePosition(QTextCursor::Right, QTextCursor::MoveAnchor, charPos-1); setTextCursor(cursor); setFocus(Qt::ShortcutFocusReason); From 2528855a982bede1de9347ce6385121a9b11df93 Mon Sep 17 00:00:00 2001 From: Anton Svitenkov Date: Tue, 17 Sep 2013 12:09:19 +0300 Subject: [PATCH 11/71] done issue #287 --- sources/kbe/main.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sources/kbe/main.cpp b/sources/kbe/main.cpp index 9895112..dc1b0fb 100644 --- a/sources/kbe/main.cpp +++ b/sources/kbe/main.cpp @@ -71,6 +71,8 @@ int main(int argc, char *argv[]) //splash.showMessage(a.tr("Create interface"), Qt::AlignBottom | Qt::AlignHCenter); MainWindow::getInstance()->show(); + a.processEvents(); + for(int i = 1; i < argc; i++) { QString arg = a.arguments().at(i); @@ -82,6 +84,8 @@ int main(int argc, char *argv[]) if (!settings.contains(Config::settingsShowStartupDialog)) settings.setValue(Config::settingsShowStartupDialog, QVariant(true)); + MainWindow::getInstance()->updateWindowTitle(); + // show startup dialog // if (settings.value(SETTINGS_STARTUP_DIALOG_SHOW).toBool()) // { From df75cf15d590d74d5cde84f76f568616a317206e Mon Sep 17 00:00:00 2001 From: asvitenkov Date: Mon, 14 Oct 2013 10:29:23 +0300 Subject: [PATCH 12/71] fix bug with undefined behavior when user clicked on identifier with key "Ctrl" --- sources/plugins/scg/modes/scgselectmode.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/plugins/scg/modes/scgselectmode.cpp b/sources/plugins/scg/modes/scgselectmode.cpp index ff8ab3a..342ab75 100644 --- a/sources/plugins/scg/modes/scgselectmode.cpp +++ b/sources/plugins/scg/modes/scgselectmode.cpp @@ -114,7 +114,7 @@ void SCgSelectMode::mousePress(QGraphicsSceneMouseEvent *event) { if (event->modifiers() == Qt::ControlModifier && event->button() == Qt::LeftButton) { - SCgObject *obj = static_cast(mScene->itemAt(event->scenePos())); + SCgObject *obj = dynamic_cast(mScene->itemAt(event->scenePos())); if (obj && (obj->type() == SCgNode::Type || obj->type() == SCgPair::Type)) { mIsTypeClonning = true; From ddedc8ace14ee2c017a138ad5ec3c96e9e27788b Mon Sep 17 00:00:00 2001 From: asvitenkov Date: Mon, 14 Oct 2013 10:34:12 +0300 Subject: [PATCH 13/71] done issue #152 --- .../plugins/scg/gwf/gwfobjectinforeader.cpp | 6 ++ sources/plugins/scg/gwf/gwfstreamwriter.cpp | 1 + sources/plugins/scg/scg.pro | 6 +- .../plugins/scg/scgdefaultobjectbuilder.cpp | 2 + sources/plugins/scg/scgnode.cpp | 58 +++++++++++++ sources/plugins/scg/scgnode.h | 16 +++- sources/plugins/scg/scgnodetextitem.cpp | 87 +++++++++++++++++++ sources/plugins/scg/scgnodetextitem.h | 36 ++++++++ sources/plugins/scg/scgobjectsinfo.cpp | 10 +++ sources/plugins/scg/scgobjectsinfo.h | 2 + sources/plugins/scg/scgobjectsinfodata.cpp | 6 +- sources/plugins/scg/scgobjectsinfodata.h | 1 + 12 files changed, 226 insertions(+), 5 deletions(-) create mode 100644 sources/plugins/scg/scgnodetextitem.cpp create mode 100644 sources/plugins/scg/scgnodetextitem.h diff --git a/sources/plugins/scg/gwf/gwfobjectinforeader.cpp b/sources/plugins/scg/gwf/gwfobjectinforeader.cpp index 9c6ac87..01e6235 100644 --- a/sources/plugins/scg/gwf/gwfobjectinforeader.cpp +++ b/sources/plugins/scg/gwf/gwfobjectinforeader.cpp @@ -273,6 +273,12 @@ bool GwfObjectInfoReader::parseNode(const QDomElement &element) if (!getAttributeDouble(element, "x", x) || !getAttributeDouble(element, "y", y)) return false; + + // get identifier position + int& idtfPos = nodeInfo->idtfPosRef(); + if (!getAttributeInt(element, "idtf_pos", idtfPos)) + idtfPos = 0; + // get content element QDomElement contEl = element.firstChildElement("content"); if (contEl.isNull()) diff --git a/sources/plugins/scg/gwf/gwfstreamwriter.cpp b/sources/plugins/scg/gwf/gwfstreamwriter.cpp index 5f8705b..f58c249 100644 --- a/sources/plugins/scg/gwf/gwfstreamwriter.cpp +++ b/sources/plugins/scg/gwf/gwfstreamwriter.cpp @@ -195,6 +195,7 @@ void GwfStreamWriter::writeNode( SCgObject *obj) SCgNode *node = static_cast(obj); writeAttribute("haveBus", node->bus() ? "true" : "false"); + writeAttribute("idtf_pos", QString::number((int)node->idtfPos())); writeContent(node); diff --git a/sources/plugins/scg/scg.pro b/sources/plugins/scg/scg.pro index 320da80..528d715 100644 --- a/sources/plugins/scg/scg.pro +++ b/sources/plugins/scg/scg.pro @@ -91,7 +91,8 @@ HEADERS += \ arrangers/scgarrangerenergybased.h \ commands/scgcommandremovebreakpoints.h \ commands/scgcommandminimizecontour.h \ - arrangers/scgforcecalculator.h + arrangers/scgforcecalculator.h \ + scgnodetextitem.h SOURCES += \ scgwindow.cpp \ @@ -170,7 +171,8 @@ SOURCES += \ arrangers/scgarrangerenergybased.cpp \ commands/scgcommandremovebreakpoints.cpp \ commands/scgcommandminimizecontour.cpp \ - arrangers/scgforcecalculator.cpp + arrangers/scgforcecalculator.cpp \ + scgnodetextitem.cpp TRANSLATIONS += media/translations/scg_en_EN.ts \ media/translations/scg_ru_RU.ts diff --git a/sources/plugins/scg/scgdefaultobjectbuilder.cpp b/sources/plugins/scg/scgdefaultobjectbuilder.cpp index c766f52..e01ca2a 100644 --- a/sources/plugins/scg/scgdefaultobjectbuilder.cpp +++ b/sources/plugins/scg/scgdefaultobjectbuilder.cpp @@ -178,6 +178,8 @@ void DefaultSCgObjectBuilder::buildNode(SCgNodeInfo* info) if (!node->contentData().isNull() && info->contentVisible()) node->showContent(); setObjectInfo(node, info); + node->setIdtfPos((SCgNode::IdentifierPosition)info->idtfPos()); + } } diff --git a/sources/plugins/scg/scgnode.cpp b/sources/plugins/scg/scgnode.cpp index 08752e1..f4ccd2a 100644 --- a/sources/plugins/scg/scgnode.cpp +++ b/sources/plugins/scg/scgnode.cpp @@ -26,12 +26,16 @@ along with OSTIS. If not, see . #include "scgcontentviewer.h" #include "scgbus.h" #include "scgview.h" +#include "scgnodetextitem.h" +#include "scgconfig.h" #include #include #include #include +#define DEFAULT_IDTF_POS BottomRight + SCgNode::SCgNode(QGraphicsItem *parent, QGraphicsScene *scene) : SCgObject(parent, scene), SCgContent(), @@ -355,3 +359,57 @@ void SCgNode::setBus(SCgBus *bus) { mBus = bus; } + + +void SCgNode::setIdtfValue(const QString &idtf) +{ + mIdtfValue = idtf; + if(idtf != "") + { + if (!mTextItem) + { + mTextItem = new SCgNodeTextItem(idtf,this); + + QFont font("Times New Roman [Arial]", 10, 10, false); + font.setBold(true); + font.setItalic(true); + + mTextItem->setFont(font); + mTextItem->setParentItem(this); + mTextItem->setZValue(7); + mTextItem->setDefaultTextColor(scg_cfg_get_value_color(scg_text_element_color_normal)); + } + mTextItem->setPlainText(mIdtfValue); + } else if (mTextItem) + { + delete mTextItem; + mTextItem = 0; + } + + positionChanged(); +} + +SCgNode::IdentifierPosition SCgNode::idtfPos() const +{ + if(!mTextItem) + return DEFAULT_IDTF_POS; + + SCgNodeTextItem* pItem = dynamic_cast(mTextItem); + Q_CHECK_PTR(pItem); + if(pItem) + return pItem->textPos(); + + return DEFAULT_IDTF_POS; +} + + +void SCgNode::setIdtfPos(IdentifierPosition pos) +{ + if(!mTextItem) + return; + + SCgNodeTextItem* pItem = dynamic_cast(mTextItem); + Q_CHECK_PTR(pItem); + if(pItem) + pItem->setTextPos(pos); +} diff --git a/sources/plugins/scg/scgnode.h b/sources/plugins/scg/scgnode.h index 0ad0351..4a2fd9a 100644 --- a/sources/plugins/scg/scgnode.h +++ b/sources/plugins/scg/scgnode.h @@ -37,11 +37,26 @@ friend class SCgBus; public: enum { Type = UserType + 2 }; + enum IdentifierPosition + { + BottomRight = 0, + BottomLeft, + TopLeft, + TopRight + }; /*! Type for qgraphicsitem_cast */ int type() const { return Type; } explicit SCgNode(QGraphicsItem *parent = 0, QGraphicsScene *scene = 0); + + void setIdtfValue(const QString &idtf); + + void setIdtfPos(IdentifierPosition pos); + IdentifierPosition idtfPos() const; + + QRectF boundingRect() const; + virtual ~SCgNode(); private: @@ -49,7 +64,6 @@ friend class SCgBus; void updateType(); protected: - QRectF boundingRect() const; QPainterPath shape() const; void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); void paintStruct(QPainter *painter); diff --git a/sources/plugins/scg/scgnodetextitem.cpp b/sources/plugins/scg/scgnodetextitem.cpp new file mode 100644 index 0000000..d671225 --- /dev/null +++ b/sources/plugins/scg/scgnodetextitem.cpp @@ -0,0 +1,87 @@ +#include +#include "scgnodetextitem.h" + + +SCgNodeTextItem::SCgNodeTextItem(const QString &str, SCgNode* parent, SCgNode::IdentifierPosition idtfPos, QGraphicsScene* scene ) + :SCgTextItem(str,(QGraphicsItem*)parent,scene), mTextPos(idtfPos) +{ + Q_CHECK_PTR(parent); + mParentItem = parent; + updateTextPos(mTextPos); +} + + +SCgNodeTextItem::SCgNodeTextItem(SCgNode *parent, SCgNode::IdentifierPosition idtfPos, QGraphicsScene *scene): + SCgTextItem((QGraphicsItem*)parent, scene), mTextPos(idtfPos) +{ + Q_CHECK_PTR(parent); + mParentItem = parent; + updateTextPos(mTextPos); +} + + +SCgNodeTextItem::~SCgNodeTextItem() +{ + +} +void SCgNodeTextItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event) +{ + + if( (flags() & QGraphicsItem::ItemIsMovable) != 0 ) + setTextPos(posToIdtfPos(mapToParent(event->pos()))); +} + + +void SCgNodeTextItem::setTextPos(SCgNode::IdentifierPosition pos) +{ + if(mTextPos != pos) + { + mTextPos = pos; + updateTextPos(mTextPos); + } +} + +SCgNode::IdentifierPosition SCgNodeTextItem::posToIdtfPos(const QPointF &point) const +{ + SCgNode::IdentifierPosition idtfPos = SCgNode::BottomRight; + + qreal x = point.x(); + qreal y = point.y(); + + if(qFuzzyIsNull(x)) + x+=1; + if(qFuzzyIsNull(y)) + y+=1; + + if( x > 0 ) + if( y > 0) + idtfPos = SCgNode::BottomRight; + else + idtfPos = SCgNode::TopRight; + else + if( y > 0) + idtfPos = SCgNode::BottomLeft; + else + idtfPos = SCgNode::TopLeft; + + return idtfPos; +} + + +void SCgNodeTextItem::updateTextPos(SCgNode::IdentifierPosition pos) +{ + QRectF rect = boundingRect(); + QRectF parentRect = mParentItem->boundingRect(); + + QPointF newPos = parentRect.bottomRight() - QPointF(rect.x(),rect.y()); + + if( pos == SCgNode::BottomLeft || pos == SCgNode::TopLeft ) + newPos.rx() = parentRect.left() - rect.width() - rect.x(); + + if( pos == SCgNode::TopLeft || pos == SCgNode::TopRight ) + newPos.ry() = parentRect.top() - rect.height() - rect.y(); + + setPos(newPos); + mParentItem->setSelected(true); + setSelected(false); +} diff --git a/sources/plugins/scg/scgnodetextitem.h b/sources/plugins/scg/scgnodetextitem.h new file mode 100644 index 0000000..35a6844 --- /dev/null +++ b/sources/plugins/scg/scgnodetextitem.h @@ -0,0 +1,36 @@ +#ifndef SCGNODETEXTITEM_H +#define SCGNODETEXTITEM_H + + +#include "scgtextitem.h" +#include "scgnode.h" + +class QGraphicsSceneMouseEvent; + +class SCgNodeTextItem : public SCgTextItem +{ + Q_OBJECT + +public: + //! Object type + enum { Type = UserType + 9 }; + + explicit SCgNodeTextItem(const QString &str, SCgNode* parent, SCgNode::IdentifierPosition idtfPos = SCgNode::BottomRight, QGraphicsScene* scene = 0); + explicit SCgNodeTextItem(SCgNode* parent, SCgNode::IdentifierPosition idtfPos = SCgNode::BottomRight, QGraphicsScene* scene = 0); + virtual ~SCgNodeTextItem(); + +protected: + virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event); + + void setTextPos(SCgNode::IdentifierPosition pos); + SCgNode::IdentifierPosition textPos() const { return mTextPos; } + void updateTextPos(SCgNode::IdentifierPosition pos); + SCgNode::IdentifierPosition posToIdtfPos(const QPointF &point) const; + + SCgNode::IdentifierPosition mTextPos; + SCgNode *mParentItem; + + friend class SCgNode; +}; + +#endif // SCGNODETEXTITEM_H diff --git a/sources/plugins/scg/scgobjectsinfo.cpp b/sources/plugins/scg/scgobjectsinfo.cpp index 0bfc978..e63b3ba 100644 --- a/sources/plugins/scg/scgobjectsinfo.cpp +++ b/sources/plugins/scg/scgobjectsinfo.cpp @@ -147,6 +147,11 @@ const QVariant& SCgNodeInfo::contentData() const return d->mContentData; } +int SCgNodeInfo::idtfPos() const +{ + return d->mIdtfPos; +} + QPointF& SCgNodeInfo::posRef() { return d->mPos; @@ -177,6 +182,11 @@ QVariant& SCgNodeInfo::contentDataRef() return d->mContentData; } +int& SCgNodeInfo::idtfPosRef() +{ + return d->mIdtfPos; +} + //________________________________________________ SCgPairInfo::SCgPairInfo(const SCgPair* obj) { diff --git a/sources/plugins/scg/scgobjectsinfo.h b/sources/plugins/scg/scgobjectsinfo.h index 10d1584..6dce6de 100644 --- a/sources/plugins/scg/scgobjectsinfo.h +++ b/sources/plugins/scg/scgobjectsinfo.h @@ -108,6 +108,7 @@ class SCgNodeInfo: public SCgObjectInfo bool contentVisible() const; const QString& contentFilename() const; const QVariant& contentData() const; + int idtfPos() const; /**@}*/ /** @@ -122,6 +123,7 @@ class SCgNodeInfo: public SCgObjectInfo bool& contentVisibleRef(); QString& contentFilenameRef(); QVariant& contentDataRef(); + int& idtfPosRef(); /**@}*/ private: diff --git a/sources/plugins/scg/scgobjectsinfodata.cpp b/sources/plugins/scg/scgobjectsinfodata.cpp index 3d22b1d..8e0d123 100644 --- a/sources/plugins/scg/scgobjectsinfodata.cpp +++ b/sources/plugins/scg/scgobjectsinfodata.cpp @@ -59,7 +59,8 @@ SCgNodeInfoData::SCgNodeInfoData(const SCgNode* obj): mPos(obj->scenePos()), mContentMimeType(obj->contentMimeType()), mContentVisible(obj->isContentVisible()), mContentFilename(obj->contentFileName()), - mContentData(obj->contentData()) + mContentData(obj->contentData()), + mIdtfPos((int)obj->idtfPos()) { } @@ -71,7 +72,8 @@ SCgNodeInfoData::SCgNodeInfoData(const SCgNodeInfoData &other): QSharedData(othe mContentMimeType(other.mContentMimeType), mContentVisible(other.mContentVisible), mContentFilename(other.mContentFilename), - mContentData(other.mContentData) + mContentData(other.mContentData), + mIdtfPos(other.mIdtfPos) { } diff --git a/sources/plugins/scg/scgobjectsinfodata.h b/sources/plugins/scg/scgobjectsinfodata.h index 445f692..d5e3fc1 100644 --- a/sources/plugins/scg/scgobjectsinfodata.h +++ b/sources/plugins/scg/scgobjectsinfodata.h @@ -87,6 +87,7 @@ class SCgNodeInfoData:public QSharedData bool mContentVisible; QString mContentFilename; QVariant mContentData; + int mIdtfPos; }; From b0b7a78981f65abab875567cd2099956e2aa7748 Mon Sep 17 00:00:00 2001 From: asvitenkov Date: Wed, 16 Oct 2013 10:18:19 +0300 Subject: [PATCH 14/71] done issue #152 removed dynamic_cast fixed code style --- sources/plugins/scg/modes/scgselectmode.cpp | 17 +++-- sources/plugins/scg/scgnode.cpp | 79 +++++++++++---------- sources/plugins/scg/scgnode.h | 4 +- sources/plugins/scg/scgnodetextitem.cpp | 52 ++++++++++---- sources/plugins/scg/scgnodetextitem.h | 22 ++++++ 5 files changed, 115 insertions(+), 59 deletions(-) diff --git a/sources/plugins/scg/modes/scgselectmode.cpp b/sources/plugins/scg/modes/scgselectmode.cpp index 342ab75..0938a97 100644 --- a/sources/plugins/scg/modes/scgselectmode.cpp +++ b/sources/plugins/scg/modes/scgselectmode.cpp @@ -114,8 +114,11 @@ void SCgSelectMode::mousePress(QGraphicsSceneMouseEvent *event) { if (event->modifiers() == Qt::ControlModifier && event->button() == Qt::LeftButton) { - SCgObject *obj = dynamic_cast(mScene->itemAt(event->scenePos())); - if (obj && (obj->type() == SCgNode::Type || obj->type() == SCgPair::Type)) + QGraphicsItem *pItem = mScene->itemAt(event->scenePos()); + if (!pItem || (pItem->type() != SCgNode::Type && pItem->type() != SCgPair::Type)) + return; + SCgObject *obj = static_cast(pItem); + if (obj) { mIsTypeClonning = true; mCloningType = obj->typeAlias(); @@ -233,9 +236,13 @@ void SCgSelectMode::mouseRelease(QGraphicsSceneMouseEvent *event) } else if (mIsTypeClonning) { - SCgObject *obj = static_cast(mScene->itemAt(event->scenePos())); - if (obj && obj->type() == mObjectType && obj->typeAlias() != mCloningType) - mScene->changeObjectTypeCommand(obj, mCloningType); + QGraphicsItem *pItem = mScene->itemAt(event->scenePos()); + if (pItem && pItem->type() == mObjectType) + { + SCgObject *obj = static_cast(pItem); + if (obj && obj->typeAlias() != mCloningType) + mScene->changeObjectTypeCommand(obj, mCloningType); + } mIsTypeClonning = false; mObjectType = 0; mCloningType = ""; diff --git a/sources/plugins/scg/scgnode.cpp b/sources/plugins/scg/scgnode.cpp index f4ccd2a..77dc0c7 100644 --- a/sources/plugins/scg/scgnode.cpp +++ b/sources/plugins/scg/scgnode.cpp @@ -164,7 +164,7 @@ void SCgNode::del(QList &delList) mContentViewer->hide(); if(mBus) - mBus->del(delList); + mBus->del(delList); SCgObject::del(delList); } @@ -172,7 +172,7 @@ void SCgNode::del(QList &delList) void SCgNode::undel(SCgScene* scene) { if(mBus) - mBus->undel(scene); + mBus->undel(scene); SCgObject::undel(scene); if(mIsContentVisible) @@ -363,53 +363,56 @@ void SCgNode::setBus(SCgBus *bus) void SCgNode::setIdtfValue(const QString &idtf) { - mIdtfValue = idtf; - if(idtf != "") - { - if (!mTextItem) - { - mTextItem = new SCgNodeTextItem(idtf,this); - - QFont font("Times New Roman [Arial]", 10, 10, false); - font.setBold(true); - font.setItalic(true); - - mTextItem->setFont(font); - mTextItem->setParentItem(this); - mTextItem->setZValue(7); - mTextItem->setDefaultTextColor(scg_cfg_get_value_color(scg_text_element_color_normal)); - } - mTextItem->setPlainText(mIdtfValue); - } else if (mTextItem) - { - delete mTextItem; - mTextItem = 0; - } - - positionChanged(); + mIdtfValue = idtf; + if (idtf != "") + { + if (!mTextItem) + { + mTextItem = new SCgNodeTextItem(idtf,this); + + QFont font("Times New Roman [Arial]", 10, 10, false); + font.setBold(true); + font.setItalic(true); + + mTextItem->setFont(font); + mTextItem->setParentItem(this); + mTextItem->setZValue(7); + mTextItem->setDefaultTextColor(scg_cfg_get_value_color(scg_text_element_color_normal)); + } + mTextItem->setPlainText(mIdtfValue); + } + else if (mTextItem) + { + delete mTextItem; + mTextItem = 0; + } + + positionChanged(); } SCgNode::IdentifierPosition SCgNode::idtfPos() const { - if(!mTextItem) - return DEFAULT_IDTF_POS; + if (!mTextItem) + return DEFAULT_IDTF_POS; - SCgNodeTextItem* pItem = dynamic_cast(mTextItem); - Q_CHECK_PTR(pItem); - if(pItem) - return pItem->textPos(); + SCgNodeTextItem* pItem = static_cast(mTextItem); + Q_CHECK_PTR(pItem); - return DEFAULT_IDTF_POS; + if (pItem) + return pItem->textPos(); + + return DEFAULT_IDTF_POS; } void SCgNode::setIdtfPos(IdentifierPosition pos) { - if(!mTextItem) + if (!mTextItem) return; - SCgNodeTextItem* pItem = dynamic_cast(mTextItem); - Q_CHECK_PTR(pItem); - if(pItem) - pItem->setTextPos(pos); + SCgNodeTextItem* pItem = static_cast(mTextItem); + Q_CHECK_PTR(pItem); + + if (pItem) + pItem->setTextPos(pos); } diff --git a/sources/plugins/scg/scgnode.h b/sources/plugins/scg/scgnode.h index 4a2fd9a..0c0cec0 100644 --- a/sources/plugins/scg/scgnode.h +++ b/sources/plugins/scg/scgnode.h @@ -37,13 +37,13 @@ friend class SCgBus; public: enum { Type = UserType + 2 }; - enum IdentifierPosition + typedef enum { BottomRight = 0, BottomLeft, TopLeft, TopRight - }; + }IdentifierPosition; /*! Type for qgraphicsitem_cast */ int type() const { return Type; } diff --git a/sources/plugins/scg/scgnodetextitem.cpp b/sources/plugins/scg/scgnodetextitem.cpp index d671225..7a75317 100644 --- a/sources/plugins/scg/scgnodetextitem.cpp +++ b/sources/plugins/scg/scgnodetextitem.cpp @@ -1,9 +1,32 @@ +/* +----------------------------------------------------------------------------- +This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) +For the latest info, see http://www.ostis.net + +Copyright (c) 2010 OSTIS + +OSTIS 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 3 of the License, or +(at your option) any later version. + +OSTIS is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with OSTIS. If not, see . +----------------------------------------------------------------------------- +*/ + #include #include "scgnodetextitem.h" SCgNodeTextItem::SCgNodeTextItem(const QString &str, SCgNode* parent, SCgNode::IdentifierPosition idtfPos, QGraphicsScene* scene ) - :SCgTextItem(str,(QGraphicsItem*)parent,scene), mTextPos(idtfPos) + : SCgTextItem(str,(QGraphicsItem*)parent,scene) + , mTextPos(idtfPos) { Q_CHECK_PTR(parent); mParentItem = parent; @@ -11,8 +34,9 @@ SCgNodeTextItem::SCgNodeTextItem(const QString &str, SCgNode* parent, SCgNode::I } -SCgNodeTextItem::SCgNodeTextItem(SCgNode *parent, SCgNode::IdentifierPosition idtfPos, QGraphicsScene *scene): - SCgTextItem((QGraphicsItem*)parent, scene), mTextPos(idtfPos) +SCgNodeTextItem::SCgNodeTextItem(SCgNode *parent, SCgNode::IdentifierPosition idtfPos, QGraphicsScene *scene) + : SCgTextItem((QGraphicsItem*)parent, scene) + , mTextPos(idtfPos) { Q_CHECK_PTR(parent); mParentItem = parent; @@ -27,14 +51,14 @@ SCgNodeTextItem::~SCgNodeTextItem() void SCgNodeTextItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event) { - if( (flags() & QGraphicsItem::ItemIsMovable) != 0 ) + if ((flags() & QGraphicsItem::ItemIsMovable) != 0) setTextPos(posToIdtfPos(mapToParent(event->pos()))); } void SCgNodeTextItem::setTextPos(SCgNode::IdentifierPosition pos) { - if(mTextPos != pos) + if (mTextPos != pos) { mTextPos = pos; updateTextPos(mTextPos); @@ -48,18 +72,18 @@ SCgNode::IdentifierPosition SCgNodeTextItem::posToIdtfPos(const QPointF &point) qreal x = point.x(); qreal y = point.y(); - if(qFuzzyIsNull(x)) - x+=1; - if(qFuzzyIsNull(y)) - y+=1; + if (qFuzzyIsNull(x)) + x += 1; + if (qFuzzyIsNull(y)) + y += 1; - if( x > 0 ) - if( y > 0) + if (x > 0) + if (y > 0) idtfPos = SCgNode::BottomRight; else idtfPos = SCgNode::TopRight; else - if( y > 0) + if (y > 0) idtfPos = SCgNode::BottomLeft; else idtfPos = SCgNode::TopLeft; @@ -75,10 +99,10 @@ void SCgNodeTextItem::updateTextPos(SCgNode::IdentifierPosition pos) QPointF newPos = parentRect.bottomRight() - QPointF(rect.x(),rect.y()); - if( pos == SCgNode::BottomLeft || pos == SCgNode::TopLeft ) + if (pos == SCgNode::BottomLeft || pos == SCgNode::TopLeft) newPos.rx() = parentRect.left() - rect.width() - rect.x(); - if( pos == SCgNode::TopLeft || pos == SCgNode::TopRight ) + if (pos == SCgNode::TopLeft || pos == SCgNode::TopRight) newPos.ry() = parentRect.top() - rect.height() - rect.y(); setPos(newPos); diff --git a/sources/plugins/scg/scgnodetextitem.h b/sources/plugins/scg/scgnodetextitem.h index 35a6844..27f7366 100644 --- a/sources/plugins/scg/scgnodetextitem.h +++ b/sources/plugins/scg/scgnodetextitem.h @@ -1,3 +1,25 @@ +/* +----------------------------------------------------------------------------- +This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) +For the latest info, see http://www.ostis.net + +Copyright (c) 2010 OSTIS + +OSTIS 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 3 of the License, or +(at your option) any later version. + +OSTIS is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with OSTIS. If not, see . +----------------------------------------------------------------------------- +*/ + #ifndef SCGNODETEXTITEM_H #define SCGNODETEXTITEM_H From 81f2b3e04a2ad6d92d3cb75d7957040cf9d776a2 Mon Sep 17 00:00:00 2001 From: asvitenkov Date: Fri, 25 Oct 2013 21:54:46 +0300 Subject: [PATCH 15/71] fix some errors --- sources/plugins/scg/modes/scgselectmode.cpp | 2 ++ sources/plugins/scg/scgnodetextitem.h | 2 ++ sources/plugins/scg/scgscene.cpp | 3 ++- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/sources/plugins/scg/modes/scgselectmode.cpp b/sources/plugins/scg/modes/scgselectmode.cpp index 0938a97..520fe5a 100644 --- a/sources/plugins/scg/modes/scgselectmode.cpp +++ b/sources/plugins/scg/modes/scgselectmode.cpp @@ -29,6 +29,7 @@ along with OSTIS. If not, see . #include "scgpair.h" #include "scgtextitem.h" #include "scgpointgraphicsitem.h" +#include "scgnodetextitem.h" #include #include @@ -184,6 +185,7 @@ void SCgSelectMode::mouseRelease(QGraphicsSceneMouseEvent *event) case SCgPointGraphicsItem::Type: case SCgIncidentPointGraphicsItem::Type: case SCgTextItem::Type: + case SCgNodeTextItem::Type: case SCgPair::Type: { // exclude PointGraphicsItem's object, because it always has a parent item diff --git a/sources/plugins/scg/scgnodetextitem.h b/sources/plugins/scg/scgnodetextitem.h index 27f7366..f45798a 100644 --- a/sources/plugins/scg/scgnodetextitem.h +++ b/sources/plugins/scg/scgnodetextitem.h @@ -41,6 +41,8 @@ class SCgNodeTextItem : public SCgTextItem explicit SCgNodeTextItem(SCgNode* parent, SCgNode::IdentifierPosition idtfPos = SCgNode::BottomRight, QGraphicsScene* scene = 0); virtual ~SCgNodeTextItem(); + //! Return a type of graphics item as integer + virtual int type() const { return Type; } protected: virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event); diff --git a/sources/plugins/scg/scgscene.cpp b/sources/plugins/scg/scgscene.cpp index 19bb4ce..a42848a 100644 --- a/sources/plugins/scg/scgscene.cpp +++ b/sources/plugins/scg/scgscene.cpp @@ -30,6 +30,7 @@ along with OSTIS. If not, see . #include "scgtextitem.h" #include "scgpointgraphicsitem.h" #include "scgcontentfactory.h" +#include "scgnodetextitem.h" #include "modes/scgbusmode.h" #include "modes/scgpairmode.h" @@ -589,7 +590,7 @@ SCgBaseCommand* SCgScene::moveSelectedCommand(const ItemUndoInfo& undoInfo, SCgB } } } - else if (item->type() == SCgTextItem::Type) + else if (item->type() == SCgTextItem::Type || item->type() == SCgNodeTextItem::Type) { if(!cmd) cmd = new SCgCommandIdtfMove(static_cast(item), From bfebce09119ba91a941ec363dcb631bd1f94d30f Mon Sep 17 00:00:00 2001 From: Anton Belka Date: Tue, 26 Nov 2013 03:58:29 +0300 Subject: [PATCH 16/71] Fixed build deb packages, issue #194 --- tools/{debian => DEBIAN}/changelog | 0 tools/{debian => DEBIAN}/control | 4 ++-- tools/{debian => DEBIAN}/copyright | 0 tools/make-deb.sh | 25 ++++++++++++++----------- 4 files changed, 16 insertions(+), 13 deletions(-) rename tools/{debian => DEBIAN}/changelog (100%) rename tools/{debian => DEBIAN}/control (94%) rename tools/{debian => DEBIAN}/copyright (100%) diff --git a/tools/debian/changelog b/tools/DEBIAN/changelog similarity index 100% rename from tools/debian/changelog rename to tools/DEBIAN/changelog diff --git a/tools/debian/control b/tools/DEBIAN/control similarity index 94% rename from tools/debian/control rename to tools/DEBIAN/control index 3b29c3f..55009e8 100644 --- a/tools/debian/control +++ b/tools/DEBIAN/control @@ -2,8 +2,8 @@ Package: kbe Version: 0.3.0 Section: science Priority: optional -Architecture: amd64 -Installed-Size: 2020 +Architecture: i386 +Installed-Size: 1876 Depends: libc6 (>= 2.3), libgcc1 (>= 1:4.1.1), libqt4-svg (>= 4:4.5.3), libqt4-xml (>= 4:4.5.3), libqt4-xmlpatterns (>= 4:4.5.3), libqtcore4 (>= 4:4.7.0~beta1), libqtgui4 (>= 4:4.7.0~beta1) Maintainer: Nikita Grishko Homepage: https://github.com/deniskoronchik/kbe diff --git a/tools/debian/copyright b/tools/DEBIAN/copyright similarity index 100% rename from tools/debian/copyright rename to tools/DEBIAN/copyright diff --git a/tools/make-deb.sh b/tools/make-deb.sh index a364796..921ecbc 100755 --- a/tools/make-deb.sh +++ b/tools/make-deb.sh @@ -25,6 +25,8 @@ install_all_dependencies_if_not_yet_installed() build_source_files() { echo -en "\033[37;1;41mBuild binary...\033[0m\n" + sed -i 's/Config::pathPlugins = root_dir;/Config::pathPlugins = "\/usr\/lib\/kbe";/' kbe/main.cpp; + sed -i 's/Config::pathPlugins.cd("plugins");/\/\/Config::pathPlugins.cd("plugins");/' kbe/main.cpp; sed '/updater/d' all.pro > all_linux.pro qmake-qt4 all_linux.pro make @@ -44,18 +46,17 @@ make_catalog_structure() fill_catalog_structure_with_content() { # Copying needed files into catalog structure - cp -r ./debian ./kbe/ - #cp -r $PROJECT_SOURCES_ROOT/kbe/media ./kbe/usr/share/kbe/ - cp -r $PROJECT_SOURCES_ROOT/bin/* ./kbe/usr/lib/kbe + cp -r ./DEBIAN ./kbe/ + cp -r $PROJECT_SOURCES_ROOT/bin/plugins/* ./kbe/usr/lib/kbe + cp $PROJECT_SOURCES_ROOT/bin/kbe ./kbe/usr/bin/kbe cp ./files/kbe.desktop ./kbe/usr/share/applications/ cp ./files/kbe.xpm ./kbe/usr/share/pixmaps/ # Making symbolic links - ln -s ../lib/kbe/kbe ./kbe/usr/bin/kbe #ln -s ../../share/kbe/media ./kbe/usr/lib/kbe/media # Remove debug and other unneeded info - strip ./kbe/usr/lib/kbe/kbe + strip ./kbe/usr/bin/kbe cp DEBIAN/changelog ./kbe/usr/share/doc/kbe/ gzip -9 ./kbe/usr/share/doc/kbe/changelog @@ -64,9 +65,9 @@ fill_catalog_structure_with_content() echo -en "\033[37;1;41mMake *.deb pachage...\033[0m\n" cd ./kbe - md5deep -l usr/lib/kbe/kbe > ./debian/md5sums - md5deep -r -l usr/share >> ./debian/md5sums - chmod 644 ./debian/md5sums + md5deep -l usr/bin/kbe > ./DEBIAN/md5sums + md5deep -r -l usr/share >> ./DEBIAN/md5sums + chmod 644 ./DEBIAN/md5sums cd - } @@ -81,11 +82,11 @@ set_attribute_value_in_file() make_changes_in_control_file() { - set_attribute_value_in_file 'Version' $VERSION debian/control - set_attribute_value_in_file 'Architecture' $ARCHITECTURE debian/control + set_attribute_value_in_file 'Version' $VERSION DEBIAN/control + set_attribute_value_in_file 'Architecture' $ARCHITECTURE DEBIAN/control # Calculate full size full_size=$(du -s ./kbe/usr | awk '{print $1}') - set_attribute_value_in_file 'Installed-Size' $full_size debian/control + set_attribute_value_in_file 'Installed-Size' $full_size DEBIAN/control } build_deb_package() @@ -98,6 +99,8 @@ build_deb_package() clean() { echo -en "\033[37;1;41mRemove temporary data...\033[0m\n" + sed -i 's/Config::pathPlugins = "\/usr\/lib\/kbe";/Config::pathPlugins = root_dir;/' $PROJECT_SOURCES_ROOT/kbe/main.cpp; + sed -i 's/\/\/Config::pathPlugins.cd("plugins");/Config::pathPlugins.cd("plugins");/' $PROJECT_SOURCES_ROOT/kbe/main.cpp; rm $PROJECT_SOURCES_ROOT/all_linux.pro rm -r ./kbe find $PROJECT_SOURCES_ROOT/ -name 'Makefile' -type f -print0 | xargs -0 rm From 2a58c6d0ab67b2170d1ea0d25e6c96f214d63bc2 Mon Sep 17 00:00:00 2001 From: Anton Belka Date: Wed, 4 Dec 2013 00:18:04 +0300 Subject: [PATCH 17/71] Fixed build deb depends, issue #194 --- tools/make-deb.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tools/make-deb.sh b/tools/make-deb.sh index 921ecbc..8324ebb 100755 --- a/tools/make-deb.sh +++ b/tools/make-deb.sh @@ -1,7 +1,6 @@ #!/bin/bash VERSION=0.3.0 -ARCHITECTURE=$(dpkg-architecture -qDEB_BUILD_ARCH) PROJECT_SOURCES_ROOT=../sources install_dependency_if_not_yet_installed() @@ -13,13 +12,19 @@ install_dependency_if_not_yet_installed() fi } +# Check dpkg-dev before use dpkg-architecture +install_dependency_if_not_yet_installed dpkg-dev +ARCHITECTURE=$(dpkg-architecture -qDEB_BUILD_ARCH) + install_all_dependencies_if_not_yet_installed() { echo -en "\033[37;1;41mCheck dependencies...\033[0m\n" install_dependency_if_not_yet_installed md5deep + install_dependency_if_not_yet_installed gcc install_dependency_if_not_yet_installed qt4-dev-tools install_dependency_if_not_yet_installed make install_dependency_if_not_yet_installed fakeroot + install_dependency_if_not_yet_installed libantlr3c-dev } build_source_files() @@ -47,6 +52,7 @@ fill_catalog_structure_with_content() { # Copying needed files into catalog structure cp -r ./DEBIAN ./kbe/ + #cp -r $PROJECT_SOURCES_ROOT/kbe/media ./kbe/usr/share/kbe/ cp -r $PROJECT_SOURCES_ROOT/bin/plugins/* ./kbe/usr/lib/kbe cp $PROJECT_SOURCES_ROOT/bin/kbe ./kbe/usr/bin/kbe cp ./files/kbe.desktop ./kbe/usr/share/applications/ @@ -72,7 +78,7 @@ fill_catalog_structure_with_content() } set_attribute_value_in_file() -{ +{ local attribute=$1 local value=$2 local file=$3 From b7b5e12933c7f9b0da7974855ba2dfb8a7391a12 Mon Sep 17 00:00:00 2001 From: asvitenkov Date: Sun, 8 Dec 2013 22:33:36 +0300 Subject: [PATCH 18/71] Updated SCs parser. Added asynchronous SCs parser. Updated SCs errors analyzer and autocompletion. Fixed: set focus on SCs editor when creating a new file or load file. Fixed some small errors. --- .../scsmultilinehighlightingrule.cpp | 24 +- .../scsmultilinehighlightingrule.h | 22 ++ sources/plugins/scs/scs.pro | 2 + sources/plugins/scs/scscodeanalyzer.cpp | 92 ++++-- sources/plugins/scs/scscodeanalyzer.h | 15 +- sources/plugins/scs/scscodeeditor.cpp | 74 +++-- sources/plugins/scs/scscodeeditor.h | 6 +- sources/plugins/scs/scscodeerroranalyzer.cpp | 64 ++-- sources/plugins/scs/scscodeerroranalyzer.h | 45 ++- sources/plugins/scs/scserrortablewidget.h | 22 ++ sources/plugins/scs/scserrortablewidgetitem.h | 22 ++ sources/plugins/scs/scsfindwidget.cpp | 3 +- sources/plugins/scs/scsfindwidget.h | 24 +- sources/plugins/scs/scsparser/SCsCLexer.h | 5 - sources/plugins/scs/scsparser/SCsCParser.h | 5 - .../plugins/scs/scsparser/scsasynchparser.cpp | 296 ++++++++++++++++++ .../plugins/scs/scsparser/scsasynchparser.h | 149 +++++++++ .../plugins/scs/scsparser/scscparserdefs.c | 21 ++ .../plugins/scs/scsparser/scscparserdefs.h | 22 ++ .../scs/scsparser/scsparserexception.cpp | 22 ++ .../scs/scsparser/scsparserexception.h | 42 ++- .../scs/scsparser/scsparserwrapper.cpp | 129 ++++---- .../plugins/scs/scsparser/scsparserwrapper.h | 36 ++- sources/plugins/scs/scswindow.cpp | 8 +- sources/plugins/scs/scswindow.h | 2 + 25 files changed, 975 insertions(+), 177 deletions(-) create mode 100644 sources/plugins/scs/scsparser/scsasynchparser.cpp create mode 100644 sources/plugins/scs/scsparser/scsasynchparser.h diff --git a/sources/plugins/scs/highlightingrules/scsmultilinehighlightingrule.cpp b/sources/plugins/scs/highlightingrules/scsmultilinehighlightingrule.cpp index 762166e..dd226a0 100644 --- a/sources/plugins/scs/highlightingrules/scsmultilinehighlightingrule.cpp +++ b/sources/plugins/scs/highlightingrules/scsmultilinehighlightingrule.cpp @@ -1,3 +1,25 @@ +/* +----------------------------------------------------------------------------- +This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) +For the latest info, see http://www.ostis.net + +Copyright (c) 2010 OSTIS + +OSTIS 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 3 of the License, or +(at your option) any later version. + +OSTIS is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with OSTIS. If not, see . +----------------------------------------------------------------------------- +*/ + #include "scsmultilinehighlightingrule.h" SCsMultiLinetHighlightingRule::SCsMultiLinetHighlightingRule(QRegExp start, QRegExp end, QTextCharFormat format, BlockRuleState state) @@ -12,7 +34,7 @@ void SCsMultiLinetHighlightingRule::assignFormat(SCsSyntaxHighlighter *highlight { int state = highlighter->curBlockState(); - if(state>0 && state!= mState ) + if (state>0 && state!= mState ) return; highlighter->setCurBlockState(0); diff --git a/sources/plugins/scs/highlightingrules/scsmultilinehighlightingrule.h b/sources/plugins/scs/highlightingrules/scsmultilinehighlightingrule.h index f63b068..e17e435 100644 --- a/sources/plugins/scs/highlightingrules/scsmultilinehighlightingrule.h +++ b/sources/plugins/scs/highlightingrules/scsmultilinehighlightingrule.h @@ -1,3 +1,25 @@ +/* +----------------------------------------------------------------------------- +This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) +For the latest info, see http://www.ostis.net + +Copyright (c) 2010 OSTIS + +OSTIS 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 3 of the License, or +(at your option) any later version. + +OSTIS is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with OSTIS. If not, see . +----------------------------------------------------------------------------- +*/ + #ifndef SCSMULTILINEHIGHLIGHTINGRULE_H #define SCSMULTILINEHIGHLIGHTINGRULE_H diff --git a/sources/plugins/scs/scs.pro b/sources/plugins/scs/scs.pro index e504fe4..adf1042 100644 --- a/sources/plugins/scs/scs.pro +++ b/sources/plugins/scs/scs.pro @@ -40,6 +40,7 @@ HEADERS += \ scsparser/SCsCLexer.h \ scsparser/SCsCParser.h \ scsparser/scscparserdefs.h \ + scsparser/scsasynchparser.h \ scswindow.h \ scsplugin.h \ scscodeerroranalyzer.h \ @@ -63,6 +64,7 @@ SOURCES += \ scsparser/SCsCLexer.c \ scsparser/SCsCParser.c \ scsparser/scscparserdefs.c \ + scsparser/scsasynchparser.cpp \ scswindow.cpp \ scserrortablewidget.cpp \ scscodeeditor.cpp \ diff --git a/sources/plugins/scs/scscodeanalyzer.cpp b/sources/plugins/scs/scscodeanalyzer.cpp index 66a6e85..aac0c55 100644 --- a/sources/plugins/scs/scscodeanalyzer.cpp +++ b/sources/plugins/scs/scscodeanalyzer.cpp @@ -20,37 +20,36 @@ along with OSTIS. If not, see . ----------------------------------------------------------------------------- */ - - #include "scscodeanalyzer.h" -#include -#include -#include -#include -#include -#include - -#include - #include "scsparserwrapper.h" +#include "scsasynchparser.h" + +#include const QRegExp SCsCodeAnalyzer::msIdentifierExp("([A-Za-z0-9_.#]+)"); SCsCodeAnalyzer::SCsCodeAnalyzer(QObject *parent) : -QObject(parent) + QObject(parent) + , mUpdateModel(0) + , mAsynchParser(0) + , mIsBusy(false) { - + mAsynchParser = new SCsAsynchParser(this); + connect(mAsynchParser,SIGNAL(parseIdentifiersFinished()),SLOT(asynchUpdateExtractIdftFinished())); } -void SCsCodeAnalyzer::fillModel(QStandardItemModel *model) +void SCsCodeAnalyzer::fillModel(QStandardItemModel *model, const QSet &idtfs) { - model->clear(); + Q_CHECK_PTR(model); - QSet identifiers = mDocumentIdentifiers; + if (!model) + return; - foreach(const QString &id, identifiers) + model->clear(); + + foreach (const QString &id, idtfs) { QStandardItem *item = new QStandardItem(id); model->appendRow(item); @@ -76,33 +75,80 @@ bool SCsCodeAnalyzer::isIdentifier(const QString &text) void SCsCodeAnalyzer::update(const QString &text, QStandardItemModel *model) { - extractIdentifiers(text, &mDocumentIdentifiers); + if (mIsBusy) + return; + + extractIdentifiers(text, mDocumentIdentifiers); mDocumentIdentifiers -= mIgnoreIdentifiers; - fillModel(model); + fillModel(model, mDocumentIdentifiers); mIgnoreIdentifiers.clear(); } +void SCsCodeAnalyzer::asynchUpdate(const QString &text, QStandardItemModel *model) +{ + if (mIsBusy) + return; + + if (text.isEmpty()) + return; + + mIsBusy = true; + + mUpdateModel = model; + + mAsynchParser->parseIdentifiers(text); + +} void SCsCodeAnalyzer::parse(const QString &text, QStandardItemModel *model) { + if (mIsBusy) + return; + + if (text.isEmpty()) + return; + mDocumentIdentifiers.clear(); mIgnoreIdentifiers.clear(); - extractIdentifiers(text, &mDocumentIdentifiers); + extractIdentifiers(text, mDocumentIdentifiers); - fillModel(model); + fillModel(model, mDocumentIdentifiers); } -void SCsCodeAnalyzer::extractIdentifiers(const QString &text, QSet *identifiers) +void SCsCodeAnalyzer::extractIdentifiers(const QString &text, QSet &identifiers) { SCsParser parser; - *identifiers = parser.getIdentifier(text); + QSharedPointer idtf = parser.getIdentifier(text); + + identifiers = *idtf; } + + +void SCsCodeAnalyzer::asynchUpdateExtractIdftFinished() +{ + Q_ASSERT(mAsynchParser->isParseIdentifiersResultPresent()); + + if (!mAsynchParser->isParseIdentifiersResultPresent()) + return; + + QSharedPointer idtfs = mAsynchParser->parseIdentifiersResult(); + + *idtfs -= mIgnoreIdentifiers; + + fillModel(mUpdateModel, *idtfs); + + mIgnoreIdentifiers.clear(); + + mIsBusy = false; +} + + diff --git a/sources/plugins/scs/scscodeanalyzer.h b/sources/plugins/scs/scscodeanalyzer.h index 462b3dc..b5f485d 100644 --- a/sources/plugins/scs/scscodeanalyzer.h +++ b/sources/plugins/scs/scscodeanalyzer.h @@ -33,6 +33,8 @@ along with OSTIS. If not, see . #include class QStandardItemModel; +class SCsParseExtractIdftAsynchTask; +class SCsAsynchParser; class SCsCodeAnalyzer : public QObject @@ -55,6 +57,8 @@ class SCsCodeAnalyzer : public QObject */ void update(const QString &text, QStandardItemModel *model); + void asynchUpdate(const QString &text, QStandardItemModel *model); + /*! Force to ignore the addition of an \p identifier during the next update * (identifier wouldn't be added to autocomleter item model) * @param identifier String that contains identifier @@ -67,14 +71,19 @@ class SCsCodeAnalyzer : public QObject static bool isIdentifier(const QString &text); protected: - void fillModel(QStandardItemModel *model); - void extractIdentifiers(const QString &text, QSet *identifiers); + void fillModel(QStandardItemModel *model, const QSet &idtfs); + void extractIdentifiers(const QString &text, QSet &identifiers); + +private slots: + void asynchUpdateExtractIdftFinished(); private: const static QRegExp msIdentifierExp; QSet mDocumentIdentifiers; QSet mIgnoreIdentifiers; - + QStandardItemModel* mUpdateModel; + SCsAsynchParser* mAsynchParser; + bool mIsBusy; }; diff --git a/sources/plugins/scs/scscodeeditor.cpp b/sources/plugins/scs/scscodeeditor.cpp index 0705c92..d6edad9 100644 --- a/sources/plugins/scs/scscodeeditor.cpp +++ b/sources/plugins/scs/scscodeeditor.cpp @@ -49,7 +49,7 @@ SCsCodeEditor::SCsCodeEditor(QWidget *parent, SCsErrorTableWidget *errorTable) : mLineNumberArea = new SCsLineNumberArea(this); mAnalyzer = new SCsCodeAnalyzer(this); mCompleter = new SCsCodeCompleter(this); - mErrorAnalyzer = new SCsCodeErrorAnalyzer(mErrorTable,this); + mErrorAnalyzer = new SCsCodeErrorAnalyzer(this, mErrorTable); mCompleter->setWidget(this); mCompleter->setCompletionMode(QCompleter::PopupCompletion); @@ -65,11 +65,14 @@ SCsCodeEditor::SCsCodeEditor(QWidget *parent, SCsErrorTableWidget *errorTable) : connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(highlightCurrentLine())); connect(this, SIGNAL(textChanged()), this, SLOT(updateAnalyzer())); connect(mErrorAnalyzer,SIGNAL(errorLines(QSet)),this,SLOT(setErrorsLines(QSet))); - if( mErrorTable != NULL ) + + if (mErrorTable != NULL) connect(mErrorTable, SIGNAL(errorAt(int,int)), this, SLOT(moveTextCursor(int,int))); updateLineNumberAreaWidth(0); highlightCurrentLine(); + + setLineWrapMode(QPlainTextEdit::NoWrap); } void SCsCodeEditor::setDocumentPath(const QString &path) @@ -118,22 +121,22 @@ void SCsCodeEditor::resizeEvent(QResizeEvent *e) void SCsCodeEditor::highlightCurrentLine() { - QList extraSelections; + QList extraSelections; - if (!isReadOnly()) - { - QTextEdit::ExtraSelection selection; + if (!isReadOnly()) + { + QTextEdit::ExtraSelection selection; - QColor lineColor = QColor(Qt::yellow).lighter(160); + QColor lineColor = QColor(Qt::yellow).lighter(160); - selection.format.setBackground(lineColor); - selection.format.setProperty(QTextFormat::FullWidthSelection, true); - selection.cursor = textCursor(); - selection.cursor.clearSelection(); - extraSelections.append(selection); - } + selection.format.setBackground(lineColor); + selection.format.setProperty(QTextFormat::FullWidthSelection, true); + selection.cursor = textCursor(); + selection.cursor.clearSelection(); + extraSelections.append(selection); + } - setExtraSelections(extraSelections); + setExtraSelections(extraSelections); } void SCsCodeEditor::lineNumberAreaPaintEvent(QPaintEvent *event) @@ -152,7 +155,7 @@ void SCsCodeEditor::lineNumberAreaPaintEvent(QPaintEvent *event) painter.setPen(Qt::black); painter.drawText(0, top, mLineNumberArea->width(), fontMetrics().height(), Qt::AlignRight, number); - if(isLineWithError(blockNumber+1)) + if (isLineWithError(blockNumber+1)) painter.drawPixmap(4,top+2,mErrorPixmap); } @@ -188,7 +191,7 @@ void SCsCodeEditor::keyPressEvent(QKeyEvent *e) // return; // } - if(e->modifiers() == Qt::ControlModifier && e->key() == Qt::Key_R) + if (e->modifiers() == Qt::ControlModifier && e->key() == Qt::Key_R) updateErrorAnalyzer(); if (mCompleter->popup()->isVisible()) @@ -272,29 +275,29 @@ void SCsCodeEditor::updateAnalyzer() mLastCursorPosition = tc.position(); mAnalyzer->ignoreUpdate(currentWord); - mAnalyzer->update(toPlainText(), completerModel); + mAnalyzer->asynchUpdate(toPlainText(), completerModel); } - -bool SCsCodeEditor::isLineWithError(int line) +void SCsCodeEditor::updateErrorAnalyzer() { - return mErrorLines.contains(line); -} -void SCsCodeEditor::setErrorsLines(QSet lines) -{ - mErrorLines = lines; -} + QString text = document()->toPlainText(); + mErrorAnalyzer->parse(text); + //update(); +} -void SCsCodeEditor::updateErrorAnalyzer() -{ - QString text = document()->toPlainText(); - mErrorAnalyzer->parse(text); +bool SCsCodeEditor::isLineWithError(int line) +{ + return mErrorLines.contains(line); +} +void SCsCodeEditor::setErrorsLines(const QSet &lines) +{ + mErrorLines = lines; update(); } @@ -302,20 +305,23 @@ void SCsCodeEditor::updateErrorAnalyzer() void SCsCodeEditor::moveTextCursor(int line, int charPos) { - if(charPos<0) + if (charPos<0) charPos = 0; - QTextCursor cursor = textCursor(); + if (line < 0) + line = 0; + + QTextCursor cursor = textCursor(); cursor.movePosition(QTextCursor::Start); cursor.movePosition(QTextCursor::Down, QTextCursor::MoveAnchor, line-1); - if( cursor.movePosition(QTextCursor::EndOfLine, QTextCursor::MoveAnchor) ) + if (cursor.movePosition(QTextCursor::EndOfLine, QTextCursor::MoveAnchor)) { - if( cursor.columnNumber() < charPos) + if (cursor.columnNumber() < charPos) charPos = 0; } cursor.movePosition(QTextCursor::StartOfLine, QTextCursor::MoveAnchor); - cursor.movePosition(QTextCursor::Right, QTextCursor::MoveAnchor, charPos-1); + cursor.movePosition(QTextCursor::Right, QTextCursor::MoveAnchor, charPos+1); setTextCursor(cursor); setFocus(Qt::ShortcutFocusReason); diff --git a/sources/plugins/scs/scscodeeditor.h b/sources/plugins/scs/scscodeeditor.h index 3d04c56..ec26802 100644 --- a/sources/plugins/scs/scscodeeditor.h +++ b/sources/plugins/scs/scscodeeditor.h @@ -54,8 +54,10 @@ class SCsCodeEditor : public QPlainTextEdit void updateErrorAnalyzer(); +public slots: + void setErrorsLines(const QSet &lines); + private slots: - void setErrorsLines(QSet lines); void updateLineNumberAreaWidth(int newBlockCount); void highlightCurrentLine(); void updateLineNumberArea(const QRect &, int); @@ -97,8 +99,6 @@ class SCsLineNumberArea : public QWidget private: SCsCodeEditor *mCodeEditor; - int mStartSelectionBlockNumber; - int mEndSelectionBlockNumber; }; #endif // SCSCODEEDITOR_H diff --git a/sources/plugins/scs/scscodeerroranalyzer.cpp b/sources/plugins/scs/scscodeerroranalyzer.cpp index 662a7e6..0fcd4fa 100644 --- a/sources/plugins/scs/scscodeerroranalyzer.cpp +++ b/sources/plugins/scs/scscodeerroranalyzer.cpp @@ -1,47 +1,48 @@ #include "scscodeerroranalyzer.h" -#include "scsparserwrapper.h" +#include "scscodeeditor.h" #include "scserrortablewidget.h" -#include "scsparserexception.h" +#include "scsasynchparser.h" #include -SCsCodeErrorAnalyzer::SCsCodeErrorAnalyzer(SCsErrorTableWidget *errorTable, QObject *parent /* = 0 */) - : QObject(parent), mErrorTable(errorTable) +SCsCodeErrorAnalyzer::SCsCodeErrorAnalyzer(SCsCodeEditor* editor, SCsErrorTableWidget *errorTable) + : QObject(editor) + , mEditor(editor) + , mErrorTable(errorTable) + , mAsynchParser(0) { + Q_CHECK_PTR(mEditor); + mAsynchParser = new SCsAsynchParser(this); + + connect(mAsynchParser,SIGNAL(parseExceptionsFinished()),SLOT(parseExceptionFinished())); } void SCsCodeErrorAnalyzer::parse(QString &text) { - SCsParser psr; - QVector exeptions = psr.getExceptions(text); - QSet lines; - for(int i=0; idoWork() || text.isEmpty()) + return; - showError(exeptions); + mAsynchParser->parseExceptions(text); } -void SCsCodeErrorAnalyzer::showError(QVector &exceptions) +void SCsCodeErrorAnalyzer::showError(const QVector &exceptions) const { - if(mErrorTable == NULL) + if (mErrorTable == NULL) return; mErrorTable->clear(); - QVector::iterator it=exceptions.begin(); - while( it != exceptions.end()) + QVector::const_iterator it; + for (it = exceptions.begin(); it != exceptions.end(); ++it) { QString description = getErrorDescription(*it); - mErrorTable->addError(description,it->line(),it->positionInLine()); - it++; + mErrorTable->addError(description, it->line(), it->positionInLine()); } - if(!exceptions.isEmpty()) + if (!exceptions.isEmpty()) mErrorTable->show(); else mErrorTable->hide(); @@ -49,7 +50,7 @@ void SCsCodeErrorAnalyzer::showError(QVector &exceptions) } -QString SCsCodeErrorAnalyzer::getErrorDescription(SCsParserException &ex) +QString SCsCodeErrorAnalyzer::getErrorDescription(const SCsParserException &ex) const { QString descr; SCsParserException::ExceptionType type = ex.getExceptionType(); @@ -88,3 +89,26 @@ QString SCsCodeErrorAnalyzer::getErrorDescription(SCsParserException &ex) return descr; } + + +void SCsCodeErrorAnalyzer::parseExceptionFinished() +{ + Q_ASSERT(mAsynchParser->isParseExceptionsResultPresent()); + + if (!mAsynchParser->isParseExceptionsResultPresent()) + return; + + QSharedPointer exceptions = mAsynchParser->parseExceptionsResult(); + + if (exceptions.isNull()) + return; + + QSet lines; + for (int i=0; isize(); ++i) + lines.insert(exceptions->at(i).line()); + + emit errorLines(lines); + + showError(*exceptions); + +} diff --git a/sources/plugins/scs/scscodeerroranalyzer.h b/sources/plugins/scs/scscodeerroranalyzer.h index a0214ff..0d12908 100644 --- a/sources/plugins/scs/scscodeerroranalyzer.h +++ b/sources/plugins/scs/scscodeerroranalyzer.h @@ -1,28 +1,59 @@ +/* +----------------------------------------------------------------------------- +This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) +For the latest info, see http://www.ostis.net + +Copyright (c) 2010 OSTIS + +OSTIS 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 3 of the License, or +(at your option) any later version. + +OSTIS is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with OSTIS. If not, see . +----------------------------------------------------------------------------- +*/ + #ifndef SCSCODEERRORANALYZER_H #define SCSCODEERRORANALYZER_H #include -#include + +#include "scsparserexception.h" class SCsErrorTableWidget; class SCsParserException; +class SCsCodeEditor; +class SCsParseExceptionsAsynchTask; +class SCsAsynchParser; class SCsCodeErrorAnalyzer : public QObject { Q_OBJECT public: - explicit SCsCodeErrorAnalyzer(SCsErrorTableWidget *errorTable, QObject *parent = 0); + explicit SCsCodeErrorAnalyzer(SCsCodeEditor* editor, SCsErrorTableWidget *errorTable); void parse(QString &text); private: - void showError(QVector &exceptions); - QString getErrorDescription(SCsParserException &ex); + void showError(const QVector &exceptions) const; + QString getErrorDescription(const SCsParserException &ex) const; + + SCsAsynchParser* mAsynchParser; + + SCsErrorTableWidget* mErrorTable; + SCsCodeEditor* mEditor; - SCsErrorTableWidget *mErrorTable; signals: void errorLines(QSet lines); -public slots: - + +private slots: + void parseExceptionFinished(); }; #endif // SCSCODEERRORANALYZER_H diff --git a/sources/plugins/scs/scserrortablewidget.h b/sources/plugins/scs/scserrortablewidget.h index 477fde0..dcc0853 100644 --- a/sources/plugins/scs/scserrortablewidget.h +++ b/sources/plugins/scs/scserrortablewidget.h @@ -1,3 +1,25 @@ +/* +----------------------------------------------------------------------------- +This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) +For the latest info, see http://www.ostis.net + +Copyright (c) 2010 OSTIS + +OSTIS 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 3 of the License, or +(at your option) any later version. + +OSTIS is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with OSTIS. If not, see . +----------------------------------------------------------------------------- +*/ + #ifndef SCSERRORTABLEWIDGET_H #define SCSERRORTABLEWIDGET_H diff --git a/sources/plugins/scs/scserrortablewidgetitem.h b/sources/plugins/scs/scserrortablewidgetitem.h index cd2d964..91e00df 100644 --- a/sources/plugins/scs/scserrortablewidgetitem.h +++ b/sources/plugins/scs/scserrortablewidgetitem.h @@ -1,3 +1,25 @@ +/* +----------------------------------------------------------------------------- +This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) +For the latest info, see http://www.ostis.net + +Copyright (c) 2010 OSTIS + +OSTIS 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 3 of the License, or +(at your option) any later version. + +OSTIS is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with OSTIS. If not, see . +----------------------------------------------------------------------------- +*/ + #ifndef SCSERRORTABLEWIDGETITEM_H #define SCSERRORTABLEWIDGETITEM_H diff --git a/sources/plugins/scs/scsfindwidget.cpp b/sources/plugins/scs/scsfindwidget.cpp index 8400c4a..04a29b6 100644 --- a/sources/plugins/scs/scsfindwidget.cpp +++ b/sources/plugins/scs/scsfindwidget.cpp @@ -68,7 +68,8 @@ SCsFindWidget::~SCsFindWidget() } -QTextDocument::FindFlags SCsFindWidget::getFlags(){ +QTextDocument::FindFlags SCsFindWidget::getFlags() const +{ QTextDocument::FindFlags searchFlags; if (mCaseSensitiveCheck->isChecked()) diff --git a/sources/plugins/scs/scsfindwidget.h b/sources/plugins/scs/scsfindwidget.h index b0270f7..329899e 100644 --- a/sources/plugins/scs/scsfindwidget.h +++ b/sources/plugins/scs/scsfindwidget.h @@ -1,3 +1,25 @@ +/* +----------------------------------------------------------------------------- +This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) +For the latest info, see http://www.ostis.net + +Copyright (c) 2010 OSTIS + +OSTIS 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 3 of the License, or +(at your option) any later version. + +OSTIS is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with OSTIS. If not, see . +----------------------------------------------------------------------------- +*/ + #ifndef SCSCODEEDITORFINDWIDGET_H #define SCSCODEEDITORFINDWIDGET_H @@ -21,7 +43,7 @@ class SCsFindWidget : public QWidget bool wholeWord() const; void setPalette(bool found); - QTextDocument::FindFlags getFlags(); + QTextDocument::FindFlags getFlags() const; void find(); diff --git a/sources/plugins/scs/scsparser/SCsCLexer.h b/sources/plugins/scs/scsparser/SCsCLexer.h index 969c860..0929e45 100644 --- a/sources/plugins/scs/scsparser/SCsCLexer.h +++ b/sources/plugins/scs/scsparser/SCsCLexer.h @@ -1,11 +1,6 @@ /** \file * This C header file was generated by $ANTLR version 3.4 * - * - From the grammar source file : D:\\Programming\\PROJECTS\\Eclipse\\workspace\\ScsGrammar\\src\\SCsC.g - * - On : 2013-04-20 09:11:20 - * - for the lexer : SCsCLexerLexer - * - * Editing it, at least manually, is not wise. * * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws. * diff --git a/sources/plugins/scs/scsparser/SCsCParser.h b/sources/plugins/scs/scsparser/SCsCParser.h index bbc6a8b..c5397ec 100644 --- a/sources/plugins/scs/scsparser/SCsCParser.h +++ b/sources/plugins/scs/scsparser/SCsCParser.h @@ -1,11 +1,6 @@ /** \file * This C header file was generated by $ANTLR version 3.4 * - * - From the grammar source file : D:\\Programming\\PROJECTS\\Eclipse\\workspace\\ScsGrammar\\src\\SCsC.g - * - On : 2013-04-20 09:11:20 - * - for the parser : SCsCParserParser - * - * Editing it, at least manually, is not wise. * * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws. * diff --git a/sources/plugins/scs/scsparser/scsasynchparser.cpp b/sources/plugins/scs/scsparser/scsasynchparser.cpp new file mode 100644 index 0000000..1cbd1ac --- /dev/null +++ b/sources/plugins/scs/scsparser/scsasynchparser.cpp @@ -0,0 +1,296 @@ +/* +----------------------------------------------------------------------------- +This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) +For the latest info, see http://www.ostis.net + +Copyright (c) 2010 OSTIS + +OSTIS 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 3 of the License, or +(at your option) any later version. + +OSTIS is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with OSTIS. If not, see . +----------------------------------------------------------------------------- +*/ + +#include "scsasynchparser.h" +#include "scsparserwrapper.h" + +#include + +QSharedPointer parseExceptionsFn(const QString &text) +{ + SCsParser psr; + QSharedPointer array = psr.getExceptions(text); + return array; +} + +QSharedPointer parseIdentifiersFn(const QString &text) +{ + SCsParser psr; + QSharedPointer array = psr.getIdentifier(text); + return array; +} + +QSharedPointer parseTokensFn(const QString &text) +{ + SCsParser psr; + QSharedPointer array = psr.getTokens(text); + return array; +} + +QSharedPointer parseErrorLinesFn(const QString &text) +{ + SCsParser psr; + QSharedPointer array = psr.getErrorLines(text); + return array; +} + +////////////////////////////////////////////////////////////////////////// + +SCsAsynchParser::SCsAsynchParser(QObject *parent) + : QObject(parent) + , mIsProcessed(false) + , mCurrentOperation(NONE) +{ + connect(&mExceptionWatcher,SIGNAL(finished()),this,SLOT(processParseExceptionsFinished())); + connect(&mIdentifiersWatcher,SIGNAL(finished()),this,SLOT(processParseIdentifiersFinished())); +} + +SCsAsynchParser::~SCsAsynchParser() +{ + +} + +bool SCsAsynchParser::parseExceptions(const QString &data) +{ + if (mIsProcessed) + return false; + + mCurrentOperation = PARSE_EXCEPTIONS; + + mIsProcessed = true; + + mData = data; + + mExceptionWatcher.setFuture(QtConcurrent::run(parseExceptionsFn, mData)); + + return true; +} + +bool SCsAsynchParser::isParseExceptionsResultPresent() const +{ + return (mCurrentOperation == PARSE_EXCEPTIONS && mExceptionWatcher.isFinished()); +} + +void SCsAsynchParser::processParseExceptionsFinished() +{ + emit parseExceptionsFinished(); +} + +QSharedPointer SCsAsynchParser::parseExceptionsResult() +{ + Q_ASSERT(isParseExceptionsResultPresent()); + + if (!isParseExceptionsResultPresent()) + { + return QSharedPointer(); + } + + mIsProcessed = false; + mCurrentOperation = NONE; + return mExceptionWatcher.result(); +} + + +bool SCsAsynchParser::parseIdentifiers(const QString &data) +{ + if (mIsProcessed) + return false; + + mCurrentOperation = PARSE_IDENTIFIERS; + + mIsProcessed = true; + + mData = data; + + mIdentifiersWatcher.setFuture(QtConcurrent::run(parseIdentifiersFn, mData)); + + return true; +} + +bool SCsAsynchParser::isParseIdentifiersResultPresent() const +{ + return (mCurrentOperation == PARSE_IDENTIFIERS && mIdentifiersWatcher.isFinished()); +} + +void SCsAsynchParser::processParseIdentifiersFinished() +{ + emit parseIdentifiersFinished(); +} + +QSharedPointer SCsAsynchParser::parseIdentifiersResult() +{ + Q_ASSERT(isParseIdentifiersResultPresent()); + + if (!isParseIdentifiersResultPresent()) + { + return QSharedPointer(); + } + + mIsProcessed = false; + mCurrentOperation = NONE; + return mIdentifiersWatcher.result(); +} + + +bool SCsAsynchParser::parseTokens(const QString &data) +{ + if (mIsProcessed) + return false; + + mCurrentOperation = PARSE_TOKENS; + + mIsProcessed = true; + + mData = data; + + mTokensWatcher.setFuture(QtConcurrent::run(parseTokensFn, mData)); + + return true; +} + +bool SCsAsynchParser::isParseTokensResultPresent() const +{ + return (mCurrentOperation == PARSE_TOKENS && mTokensWatcher.isFinished()); +} + +void SCsAsynchParser::processParseTokensFinished() +{ + emit parseTokensFinished(); +} + +QSharedPointer SCsAsynchParser::parseTokensResult() +{ + Q_ASSERT(isParseTokensResultPresent()); + + if (!isParseTokensResultPresent()) + { + return QSharedPointer(); + } + + mIsProcessed = false; + mCurrentOperation = NONE; + return mTokensWatcher.result(); +} + + +bool SCsAsynchParser::parseErrorLines(const QString &data) +{ + if (mIsProcessed) + return false; + + mCurrentOperation = PARSE_ERROR_LINES; + + mIsProcessed = true; + + mData = data; + + mErrorLinesWatcher.setFuture(QtConcurrent::run(parseErrorLinesFn, mData)); + + return true; +} + +bool SCsAsynchParser::isParseErrorLinesResultPresent() const +{ + return (mCurrentOperation == PARSE_ERROR_LINES && mErrorLinesWatcher.isFinished()); +} + +void SCsAsynchParser::processParseErrorLinesFinished() +{ + emit parseErrorLinesFinished(); +} + +QSharedPointer SCsAsynchParser::parseErrorLinesResult() +{ + Q_ASSERT(isParseErrorLinesResultPresent()); + + if (!isParseErrorLinesResultPresent()) + { + return QSharedPointer(); + } + + mIsProcessed = false; + mCurrentOperation = NONE; + return mErrorLinesWatcher.result(); +} + +////////////////////////////////////////////////////////////////////////// + + +SCsParseExceptionsAsynchTask::SCsParseExceptionsAsynchTask(const QString &text, QObject *parent) + : QObject(parent) + , mText(text) +{ + connect(&mWatcher,SIGNAL(finished()),this,SIGNAL(taskFinished())); +} + +SCsParseExceptionsAsynchTask::~SCsParseExceptionsAsynchTask() +{ + +} + +void SCsParseExceptionsAsynchTask::execute() +{ + if (!isRunning()) + mWatcher.setFuture(QtConcurrent::run(parseExceptionsFn,mText)); +} + +QSharedPointer SCsParseExceptionsAsynchTask::result() +{ + return QSharedPointer(mWatcher.result()); +} + + +void SCsParseExceptionsAsynchTask::finished() +{ + emit taskFinished(); +} + + +////////////////////////////////////////////////////////////////////////// + +SCsParseExtractIdftAsynchTask::SCsParseExtractIdftAsynchTask(const QString &text, QObject *parent) + : QObject(parent) + , mText(text) +{ + connect(&mWatcher,SIGNAL(finished()),this,SIGNAL(taskFinished())); +} + +SCsParseExtractIdftAsynchTask::~SCsParseExtractIdftAsynchTask() +{ +} + +void SCsParseExtractIdftAsynchTask::execute() +{ + if (!isRunning()) + mWatcher.setFuture(QtConcurrent::run(parseIdentifiersFn,mText)); +} + +QSharedPointer SCsParseExtractIdftAsynchTask::result() +{ + return QSharedPointer(mWatcher.result()); +} + + +void SCsParseExtractIdftAsynchTask::finished() +{ + emit taskFinished(); +} diff --git a/sources/plugins/scs/scsparser/scsasynchparser.h b/sources/plugins/scs/scsparser/scsasynchparser.h new file mode 100644 index 0000000..211d963 --- /dev/null +++ b/sources/plugins/scs/scsparser/scsasynchparser.h @@ -0,0 +1,149 @@ +/* +----------------------------------------------------------------------------- +This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) +For the latest info, see http://www.ostis.net + +Copyright (c) 2010 OSTIS + +OSTIS 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 3 of the License, or +(at your option) any later version. + +OSTIS is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with OSTIS. If not, see . +----------------------------------------------------------------------------- +*/ + +#ifndef SCSASYNCHPARSER_H +#define SCSASYNCHPARSER_H + +#include "scsparserexception.h" + +#include +#include +#include + +class SCsAsynchParser: public QObject +{ + Q_OBJECT + + typedef enum{ + NONE = 0 + , PARSE_EXCEPTIONS + , PARSE_ERROR_LINES + , PARSE_IDENTIFIERS + , PARSE_TOKENS + } ParserOperation; + +public: + SCsAsynchParser(QObject *parent = 0); + virtual ~SCsAsynchParser(); + + bool parseExceptions(const QString &data); + bool parseErrorLines(const QString &data); + bool parseIdentifiers(const QString &data); + bool parseTokens(const QString &data); + + QSharedPointer parseExceptionsResult(); + QSharedPointer parseErrorLinesResult(); + QSharedPointer parseIdentifiersResult(); + QSharedPointer parseTokensResult(); + + bool isParseExceptionsResultPresent() const; + bool isParseErrorLinesResultPresent() const; + bool isParseIdentifiersResultPresent() const; + bool isParseTokensResultPresent() const; + + bool doWork() const { return mIsProcessed; } + +signals: + void parseExceptionsFinished(); + void parseErrorLinesFinished(); + void parseIdentifiersFinished(); + void parseTokensFinished(); + +private slots: + void processParseExceptionsFinished(); + void processParseErrorLinesFinished(); + void processParseIdentifiersFinished(); + void processParseTokensFinished(); + +protected: + bool mIsProcessed; + QString mData; + ParserOperation mCurrentOperation; + + QFutureWatcher< QSharedPointer > mExceptionWatcher; + QFutureWatcher< QSharedPointer > mErrorLinesWatcher; + QFutureWatcher< QSharedPointer > mIdentifiersWatcher; + QFutureWatcher< QSharedPointer > mTokensWatcher; + +private: + Q_DISABLE_COPY(SCsAsynchParser) +}; + + +class SCsParseExceptionsAsynchTask: public QObject +{ + Q_OBJECT + +public: + + SCsParseExceptionsAsynchTask(const QString &text, QObject *parent = 0); + virtual ~SCsParseExceptionsAsynchTask(); + + void execute(); + QSharedPointer result(); + bool isRunning() const { return mWatcher.isRunning(); } + bool isStarted() const { return mWatcher.isStarted(); } + bool isFinished() const { return mWatcher.isFinished(); } + +signals: + void taskFinished(); + +private slots: + void finished(); + +private: + Q_DISABLE_COPY(SCsParseExceptionsAsynchTask) + + QFutureWatcher< QSharedPointer > mWatcher; + QString mText; +}; + + +class SCsParseExtractIdftAsynchTask: public QObject +{ + Q_OBJECT + +public: + + SCsParseExtractIdftAsynchTask(const QString &text, QObject *parent = 0); + virtual ~SCsParseExtractIdftAsynchTask(); + + void execute(); + QSharedPointer result(); + bool isRunning() const { return mWatcher.isRunning(); } + bool isStarted() const { return mWatcher.isStarted(); } + bool isFinished() const { return mWatcher.isFinished(); } + +signals: + void taskFinished(); + + private slots: + void finished(); + +private: + Q_DISABLE_COPY(SCsParseExtractIdftAsynchTask) + + QFutureWatcher< QSharedPointer > mWatcher; + QString mText; +}; + +#endif // SCSASYNCHPARSER_H diff --git a/sources/plugins/scs/scsparser/scscparserdefs.c b/sources/plugins/scs/scsparser/scscparserdefs.c index 59e4539..6e49178 100644 --- a/sources/plugins/scs/scsparser/scscparserdefs.c +++ b/sources/plugins/scs/scsparser/scscparserdefs.c @@ -1,3 +1,24 @@ +/* +----------------------------------------------------------------------------- +This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) +For the latest info, see http://www.ostis.net + +Copyright (c) 2010 OSTIS + +OSTIS 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 3 of the License, or +(at your option) any later version. + +OSTIS is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with OSTIS. If not, see . +----------------------------------------------------------------------------- +*/ #include "scscparserdefs.h" diff --git a/sources/plugins/scs/scsparser/scscparserdefs.h b/sources/plugins/scs/scsparser/scscparserdefs.h index f232374..8a45e10 100644 --- a/sources/plugins/scs/scsparser/scscparserdefs.h +++ b/sources/plugins/scs/scsparser/scscparserdefs.h @@ -1,3 +1,25 @@ +/* +----------------------------------------------------------------------------- +This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) +For the latest info, see http://www.ostis.net + +Copyright (c) 2010 OSTIS + +OSTIS 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 3 of the License, or +(at your option) any later version. + +OSTIS is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with OSTIS. If not, see . +----------------------------------------------------------------------------- +*/ + #ifndef _SCSPARSERDEFS_H #define _SCSPARSERDEFS_H diff --git a/sources/plugins/scs/scsparser/scsparserexception.cpp b/sources/plugins/scs/scsparser/scsparserexception.cpp index d04431c..5f6f98c 100644 --- a/sources/plugins/scs/scsparser/scsparserexception.cpp +++ b/sources/plugins/scs/scsparser/scsparserexception.cpp @@ -1,3 +1,25 @@ +/* +----------------------------------------------------------------------------- +This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) +For the latest info, see http://www.ostis.net + +Copyright (c) 2010 OSTIS + +OSTIS 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 3 of the License, or +(at your option) any later version. + +OSTIS is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with OSTIS. If not, see . +----------------------------------------------------------------------------- +*/ + #include "scsparserexception.h" SCsParserException::SCsParserException(): diff --git a/sources/plugins/scs/scsparser/scsparserexception.h b/sources/plugins/scs/scsparser/scsparserexception.h index 1a283dc..09b317a 100644 --- a/sources/plugins/scs/scsparser/scsparserexception.h +++ b/sources/plugins/scs/scsparser/scsparserexception.h @@ -1,8 +1,32 @@ +/* +----------------------------------------------------------------------------- +This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) +For the latest info, see http://www.ostis.net + +Copyright (c) 2010 OSTIS + +OSTIS 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 3 of the License, or +(at your option) any later version. + +OSTIS is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with OSTIS. If not, see . +----------------------------------------------------------------------------- +*/ + #ifndef SCSPARSEREXCEPTION_H #define SCSPARSEREXCEPTION_H #include +#include +#include class SCsParserException { @@ -23,10 +47,10 @@ class SCsParserException virtual ~SCsParserException(); - ExceptionPlace type(){ return mExceptionPlace; } - int line() { return mLine; } - int positionInLine() { return mPositionInLine; } - ExceptionType getExceptionType() { return mExceptionType; } + ExceptionPlace type() const { return mExceptionPlace; } + int line() const { return mLine; } + int positionInLine() const { return mPositionInLine; } + ExceptionType getExceptionType() const { return mExceptionType; } private: ExceptionPlace mExceptionPlace; @@ -36,11 +60,6 @@ class SCsParserException }; - - - - - class SCsParserToken { public: @@ -68,6 +87,9 @@ class SCsParserToken int mTokenType; }; - +typedef QVector SCsParserExceptionArray; +typedef QVector SCsParserTokenArray; +typedef QSet SCsParserErrorLinesArray; +typedef QSet SCsParserIdtfArray; #endif // SCSPARSEREXCEPTION_H diff --git a/sources/plugins/scs/scsparser/scsparserwrapper.cpp b/sources/plugins/scs/scsparser/scsparserwrapper.cpp index de999d3..2b72d5b 100644 --- a/sources/plugins/scs/scsparser/scsparserwrapper.cpp +++ b/sources/plugins/scs/scsparser/scsparserwrapper.cpp @@ -1,4 +1,24 @@ +/* +----------------------------------------------------------------------------- +This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) +For the latest info, see http://www.ostis.net +Copyright (c) 2010 OSTIS + +OSTIS 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 3 of the License, or +(at your option) any later version. + +OSTIS is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with OSTIS. If not, see . +----------------------------------------------------------------------------- +*/ #include "SCsCLexer.h" #include "SCsCParser.h" @@ -18,9 +38,15 @@ SCsParser::SCsParser(QObject *parent) : } -pANTLR3_INPUT_STREAM SCsParser::createInputStream(const std::string &text) +SCsParser::~SCsParser() +{ + +} + + +pANTLR3_INPUT_STREAM SCsParser::createInputStream(const std::string &text) const { - pANTLR3_INPUT_STREAM input; + pANTLR3_INPUT_STREAM input = 0; #if defined( __WIN32__ ) || defined( _WIN32 ) input = antlr3StringStreamNew((pANTLR3_UINT8)text.c_str(),ANTLR3_ENC_UTF8,text.length(),(pANTLR3_UINT8)"scs"); @@ -33,10 +59,10 @@ pANTLR3_INPUT_STREAM SCsParser::createInputStream(const std::string &text) } -QSet SCsParser::getErrorLines(const QString &text) +QSharedPointer SCsParser::getErrorLines(const QString &text) const { - QSet errorLines; + QSharedPointer errorLines = QSharedPointer(new SCsParserErrorLinesArray()); pANTLR3_INPUT_STREAM input; pSCsCLexer lxr; @@ -47,13 +73,13 @@ QSet SCsParser::getErrorLines(const QString &text) std::string strData = text.toStdString(); input = createInputStream(strData); - if(input == NULL) + if (input == NULL) { return errorLines; } lxr = SCsCLexerNew(input); - if( lxr == NULL ) + if (lxr == NULL) { input->free(input); return errorLines; @@ -61,7 +87,7 @@ QSet SCsParser::getErrorLines(const QString &text) tstream = antlr3CommonTokenStreamSourceNew(ANTLR3_SIZE_HINT, TOKENSOURCE(lxr)); - if( tstream == NULL ) + if (tstream == NULL) { lxr->free(lxr); input->free(input); @@ -70,7 +96,7 @@ QSet SCsParser::getErrorLines(const QString &text) psr = SCsCParserNew(tstream); - if( psr == NULL ) + if (psr == NULL) { tstream->free(tstream); lxr->free(lxr); @@ -83,15 +109,15 @@ QSet SCsParser::getErrorLines(const QString &text) _ParserException *psrEx = ParserHeadException(); _LexerException *lxrEx = LexerHeadException(); - while(psrEx) + while (psrEx) { - errorLines.insert(psrEx->mLine); + errorLines->insert(psrEx->mLine); psrEx = psrEx->pNextException; } - while(lxrEx) + while (lxrEx) { - errorLines.insert(lxrEx->mLine); + errorLines->insert(lxrEx->mLine); lxrEx = lxrEx->pNextException; } @@ -108,10 +134,10 @@ QSet SCsParser::getErrorLines(const QString &text) -QVector SCsParser::getExceptions(const QString &text) +QSharedPointer SCsParser::getExceptions(const QString &text) const { - QVector exceptions; + QSharedPointer exceptions = QSharedPointer(new SCsParserExceptionArray()); pANTLR3_INPUT_STREAM input; pSCsCLexer lxr; @@ -121,32 +147,34 @@ QVector SCsParser::getExceptions(const QString &text) std::string strData = text.toStdString(); input = createInputStream(strData); - if( input == NULL ) + if (input == NULL) { - input->free(input); return exceptions; } lxr = SCsCLexerNew(input); - if( lxr == NULL ) + if (lxr == NULL) { - lxr->free(lxr); + input->free(input); return exceptions; } tstream = antlr3CommonTokenStreamSourceNew(ANTLR3_SIZE_HINT, TOKENSOURCE(lxr)); - if( tstream == NULL ) + if (tstream == NULL) { - tstream->free(tstream); + input->free(input); + lxr->free(lxr); return exceptions; } psr = SCsCParserNew(tstream); - if( psr == NULL ) + if (psr == NULL) { - psr->free(psr); + input->free(input); + lxr->free(lxr); + tstream->free(tstream); return exceptions; } @@ -155,15 +183,15 @@ QVector SCsParser::getExceptions(const QString &text) _ParserException *psrEx = ParserHeadException(); _LexerException *lxrEx = LexerHeadException(); - while(psrEx) + while (psrEx) { - exceptions.push_back(SCsParserException(SCsParserException::PARSER, psrEx->mLine, psrEx->mCharPositionInLine, psrEx->mType)); + exceptions->push_back(SCsParserException(SCsParserException::PARSER, psrEx->mLine, psrEx->mCharPositionInLine, psrEx->mType)); psrEx = psrEx->pNextException; } - while(lxrEx) + while (lxrEx) { - exceptions.push_back(SCsParserException(SCsParserException::LEXER, lxrEx->mLine, lxrEx->mCharPositionInLine, lxrEx->mType)); + exceptions->push_back(SCsParserException(SCsParserException::LEXER, lxrEx->mLine, lxrEx->mCharPositionInLine, lxrEx->mType)); lxrEx = lxrEx->pNextException; } @@ -179,18 +207,10 @@ QVector SCsParser::getExceptions(const QString &text) } - -SCsParser::~SCsParser() -{ - -} - - - -QVector SCsParser::getTokens(const QString &text) +QSharedPointer SCsParser::getTokens(const QString &text) const { - QVector token; + QSharedPointer token = QSharedPointer(new SCsParserTokenArray()); pANTLR3_INPUT_STREAM input; pSCsCLexer lxr; pANTLR3_COMMON_TOKEN_STREAM tstream; @@ -198,24 +218,24 @@ QVector SCsParser::getTokens(const QString &text) std::string strData = text.toStdString(); input = createInputStream(strData); - if( input == NULL ) + if (input == NULL) { - input->free(input); return token; } lxr = SCsCLexerNew(input); - if( lxr == NULL ) + if (lxr == NULL) { - lxr->free(lxr); + input->free(input); return token; } tstream = antlr3CommonTokenStreamSourceNew(ANTLR3_SIZE_HINT, TOKENSOURCE(lxr)); - if( tstream == NULL ) + if (tstream == NULL) { - tstream->free(tstream); + input->free(input); + lxr->free(lxr); return token; } @@ -228,13 +248,12 @@ QVector SCsParser::getTokens(const QString &text) { tok = (pANTLR3_COMMON_TOKEN) tokens->elements[i].element; tokText = tok->getText(tok); - token.append(SCsParserToken(tok->getType(tok), QString((char*)tokText->chars), tok->getLine(tok), tok->getCharPositionInLine(tok))); + token->append(SCsParserToken(tok->getType(tok), QString((char*)tokText->chars), tok->getLine(tok), tok->getCharPositionInLine(tok))); } - - freeLexerExceptionList(); freeParserExceptionList(); + tstream->free(tstream); lxr->free(lxr); input->free(input); @@ -243,20 +262,20 @@ QVector SCsParser::getTokens(const QString &text) } -QSet SCsParser::getIdentifier(const QString &text) +QSharedPointer SCsParser::getIdentifier(const QString &text) const { - QSet idtf; + QSharedPointer idtf = QSharedPointer(new SCsParserIdtfArray()); + + QSharedPointer token = getTokens(text); + QVector::iterator it; - QVector token = getTokens(text); - QVector::iterator it = token.begin(); - while (it!=token.end()) + for (it = token->begin(); it != token->end(); ++it) { - if(it->tokenType() == NAME) - { - idtf.insert(it->tokenText()); - } - ++it; + if (it->tokenType() == NAME) + idtf->insert(it->tokenText()); } + token->clear(); + return idtf; } diff --git a/sources/plugins/scs/scsparser/scsparserwrapper.h b/sources/plugins/scs/scsparser/scsparserwrapper.h index f20ada6..313e6b4 100644 --- a/sources/plugins/scs/scsparser/scsparserwrapper.h +++ b/sources/plugins/scs/scsparser/scsparserwrapper.h @@ -1,31 +1,51 @@ +/* +----------------------------------------------------------------------------- +This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) +For the latest info, see http://www.ostis.net + +Copyright (c) 2010 OSTIS + +OSTIS 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 3 of the License, or +(at your option) any later version. + +OSTIS is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with OSTIS. If not, see . +----------------------------------------------------------------------------- +*/ + #ifndef SCSPARSERWRAPPER_H #define SCSPARSERWRAPPER_H #include #include #include +#include #include "scsparserexception.h" #include - - class SCsParser : public QObject { Q_OBJECT public: explicit SCsParser(QObject *parent = 0); ~SCsParser(); - QSet getErrorLines(const QString &text); - QVector getTokens(const QString &text); - QSet getIdentifier(const QString &text); - QVector getExceptions(const QString &text); + QSharedPointer getErrorLines(const QString &text) const; + QSharedPointer getTokens(const QString &text) const; + QSharedPointer getIdentifier(const QString &text) const; + QSharedPointer getExceptions(const QString &text) const; protected: - //pANTLR3_INPUT_STREAM createInputStream(const QString &text); - pANTLR3_INPUT_STREAM createInputStream(const std::string &text); + pANTLR3_INPUT_STREAM createInputStream(const std::string &text) const; private: diff --git a/sources/plugins/scs/scswindow.cpp b/sources/plugins/scs/scswindow.cpp index 50add07..fa69ee2 100644 --- a/sources/plugins/scs/scswindow.cpp +++ b/sources/plugins/scs/scswindow.cpp @@ -52,7 +52,7 @@ SCsWindow::SCsWindow(const QString& _windowTitle, QWidget *parent): mErrorTable = new SCsErrorTableWidget(this); - mEditor = new SCsCodeEditor(this,mErrorTable); + mEditor = new SCsCodeEditor(this, mErrorTable); QFont font("Arial", 11); font.setStyleHint(QFont::Serif); mEditor->setFont(font); @@ -232,6 +232,12 @@ void SCsWindow::onEscapePressed() } +void SCsWindow::activate(QMainWindow *window) +{ + EditorInterface::activate(window); + mEditor->setFocus(); +} + // --------------------- SCsWindowFactory::SCsWindowFactory(QObject *parent) : QObject(parent) diff --git a/sources/plugins/scs/scswindow.h b/sources/plugins/scs/scswindow.h index 402d39e..8829bd4 100644 --- a/sources/plugins/scs/scswindow.h +++ b/sources/plugins/scs/scswindow.h @@ -71,6 +71,8 @@ class SCsWindow : public QWidget, */ void _update(); + void activate(QMainWindow *window); + /*! Get icon specified for window type */ QIcon icon() const; From bf0c1d6d3442b4bad1171f3e79d21965c3b6c417 Mon Sep 17 00:00:00 2001 From: Anton Belka Date: Mon, 9 Dec 2013 19:28:14 +0300 Subject: [PATCH 19/71] work on issue #243 --- tools/launchpad/control | 13 ++++ tools/launchpad/rules | 19 ++++++ tools/make-deb.sh | 10 +-- tools/make-launchpad.sh | 132 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 169 insertions(+), 5 deletions(-) create mode 100644 tools/launchpad/control create mode 100755 tools/launchpad/rules create mode 100755 tools/make-launchpad.sh diff --git a/tools/launchpad/control b/tools/launchpad/control new file mode 100644 index 0000000..b0ea0c9 --- /dev/null +++ b/tools/launchpad/control @@ -0,0 +1,13 @@ +Source: kbe +Section: science +Priority: optional +Maintainer: Nikita Grishko +Homepage: https://github.com/deniskoronchik/kbe +Build-Depends: debhelper (>= 8.0.0), cdbs, libqt4-dev, qt4-qmake, libantlr3c-dev + +Package: kbe +Architecture: i386 +Depends: libc6 (>= 2.3), libgcc1 (>= 1:4.1.1), libqt4-svg (>= 4:4.5.3), libqt4-xml (>= 4:4.5.3), libqt4-xmlpatterns (>= 4:4.5.3), libqtcore4 (>= 4:4.7.0~beta1), libqtgui4 (>= 4:4.7.0~beta1), libantlr3c-3.2-0 +Description: KBE - Knowledge Base source Editor + This is a specialized tool that allow to create knowledge bases for intelligent systems based on OSTIS technology. + It include such extensions as SCg-code editor (graphical editor of semantic networks), m4scp editor (editor of scp programs that used to process knowledges), scs editor (string representation of semantic networks) diff --git a/tools/launchpad/rules b/tools/launchpad/rules new file mode 100755 index 0000000..1c2f79e --- /dev/null +++ b/tools/launchpad/rules @@ -0,0 +1,19 @@ +#!/usr/bin/make -f +# -*- makefile -*- +# Sample debian/rules that uses debhelper. +# This file was originally written by Joey Hess and Craig Small. +# As a special exception, when this file is copied by dh-make into a +# dh-make output file, you may use that output file without restriction. +# This special exception was added by Craig Small in version 0.37 of dh-make. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + + +include /usr/share/cdbs/1/rules/debhelper.mk +include /usr/share/cdbs/1/class/qmake.mk + +# Add here any variable or target overrides you need. +QMAKE=qmake-qt4 +CFLAGS=-O3 +CXXFLAGS=-O3 diff --git a/tools/make-deb.sh b/tools/make-deb.sh index 8324ebb..50ba932 100755 --- a/tools/make-deb.sh +++ b/tools/make-deb.sh @@ -6,7 +6,7 @@ PROJECT_SOURCES_ROOT=../sources install_dependency_if_not_yet_installed() { local dependency=$1 - if ! dpkg -l | grep $dependency + if ! dpkg -l | cut -d" " -f3 | grep $dependency then sudo apt-get install $dependency fi @@ -30,8 +30,8 @@ install_all_dependencies_if_not_yet_installed() build_source_files() { echo -en "\033[37;1;41mBuild binary...\033[0m\n" - sed -i 's/Config::pathPlugins = root_dir;/Config::pathPlugins = "\/usr\/lib\/kbe";/' kbe/main.cpp; - sed -i 's/Config::pathPlugins.cd("plugins");/\/\/Config::pathPlugins.cd("plugins");/' kbe/main.cpp; + sed -i 's/Config::pathPlugins = root_dir;/Config::pathPlugins = "\/usr\/lib\/kbe";/' kbe/main.cpp + sed -i 's/Config::pathPlugins.cd("plugins");/\/\/Config::pathPlugins.cd("plugins");/' kbe/main.cpp sed '/updater/d' all.pro > all_linux.pro qmake-qt4 all_linux.pro make @@ -105,8 +105,8 @@ build_deb_package() clean() { echo -en "\033[37;1;41mRemove temporary data...\033[0m\n" - sed -i 's/Config::pathPlugins = "\/usr\/lib\/kbe";/Config::pathPlugins = root_dir;/' $PROJECT_SOURCES_ROOT/kbe/main.cpp; - sed -i 's/\/\/Config::pathPlugins.cd("plugins");/Config::pathPlugins.cd("plugins");/' $PROJECT_SOURCES_ROOT/kbe/main.cpp; + sed -i 's/Config::pathPlugins = "\/usr\/lib\/kbe";/Config::pathPlugins = root_dir;/' $PROJECT_SOURCES_ROOT/kbe/main.cpp + sed -i 's/\/\/Config::pathPlugins.cd("plugins");/Config::pathPlugins.cd("plugins");/' $PROJECT_SOURCES_ROOT/kbe/main.cpp rm $PROJECT_SOURCES_ROOT/all_linux.pro rm -r ./kbe find $PROJECT_SOURCES_ROOT/ -name 'Makefile' -type f -print0 | xargs -0 rm diff --git a/tools/make-launchpad.sh b/tools/make-launchpad.sh new file mode 100755 index 0000000..4c6fa0a --- /dev/null +++ b/tools/make-launchpad.sh @@ -0,0 +1,132 @@ +#!/bin/bash + +VERSION=0.3.0 +ARCHITECTURE=i386 +PROJECT_ROOT=.. +PROJECT_SOURCES_ROOT=sources +BZR_REPO=kbe + +usage() +{ + echo "Before using $0 check your launchpad access:" + echo " bzr lp-login LOGIN" + echo " bzr info lp:kbe" + echo "" + echo "If you understand information above then:" + echo " Usage: $0 YES" + exit 1 +} + +install_dependency_if_not_yet_installed() +{ + local dependency=$1 + if ! dpkg -l | cut -d" " -f3 | grep $dependency + then + sudo apt-get install $dependency + fi +} + +install_all_dependencies_if_not_yet_installed() +{ + echo -en "\033[37;1;41mCheck dependencies...\033[0m\n" + install_dependency_if_not_yet_installed bzr +} + +set_attribute_value_in_file() +{ + local attribute=$1 + local value=$2 + local file=$3 + + sed -i '/'"$attribute"'/s|: .*$|: '"$value"'|' $file +} + +make_changes_in_control_file() +{ + echo -en "\033[37;1;41mMake changes in control file...\033[0m\n" + set_attribute_value_in_file 'Architecture' $ARCHITECTURE launchpad/control +} + +prepare_project_structure() +{ + echo -en "\033[37;1;41mPrepare project structure...\033[0m\n" + ln -s sources/all.pro all.pro + ln -s sources/kbe kbe + ln -s sources/plugins plugins + cp -r tools/launchpad debian + cp tools/DEBIAN/{changelog,copyright} debian +} + +prepare_sources() +{ + echo -en "\033[37;1;41mPrepare sources...\033[0m\n" + cp kbe/kbe.pro kbe/kbe.pro.backup + echo "" >> kbe/kbe.pro + echo "target.path = /usr/bin" >> kbe/kbe.pro + echo "lib.path = /usr/lib/kbe" >> kbe/kbe.pro + echo "lib.files = ../bin/plugins/*" >> kbe/kbe.pro + echo "desktop.path = /usr/share/applications" >> kbe/kbe.pro + echo "desktop.files = ../../tools/files/kbe.desktop" >> kbe/kbe.pro + echo "xpm.path = /usr/share/pixmaps" >> kbe/kbe.pro + echo "xpm.files = ../../tools/files/kbe.xpm" >> kbe/kbe.pro + echo "INSTALLS += target lib desktop xpm" >> kbe/kbe.pro + sed -i 's/Config::pathPlugins = root_dir;/Config::pathPlugins = "\/usr\/lib\/kbe";/' kbe/main.cpp + sed -i 's/Config::pathPlugins.cd("plugins");/\/\/Config::pathPlugins.cd("plugins");/' kbe/main.cpp +} + +push_bzr_repo() +{ + echo -en "\033[37;1;41mPush Bazaar repository...\033[0m\n" + if [ -d ".bzr" ]; then + rm -r .bzr + fi + bzr branch lp:kbe kbe_bzr + if [ -d "kbe_bzr" ]; then + REVNO=`bzr revno kbe_bzr` + let REVNO+=1 + mv kbe_bzr/.bzr .bzr + rm -r kbe_bzr + else + REVNO=1 + bzr init + fi + bzr add . + bzr rm --keep .git + bzr commit -m "Release $VERSION-r$REVNO" --unchanged + bzr push --overwrite lp:$BZR_REPO +} + +clean() +{ + echo -en "\033[37;1;41mRemove temporary data...\033[0m\n" + rm all.pro + rm kbe + rm plugins + rm -r .bzr + rm -r debian + mv -f $PROJECT_SOURCES_ROOT/kbe/kbe.pro.backup $PROJECT_SOURCES_ROOT/kbe/kbe.pro + sed -i 's/Config::pathPlugins = "\/usr\/lib\/kbe";/Config::pathPlugins = root_dir;/' $PROJECT_SOURCES_ROOT/kbe/main.cpp + sed -i 's/\/\/Config::pathPlugins.cd("plugins");/Config::pathPlugins.cd("plugins");/' $PROJECT_SOURCES_ROOT/kbe/main.cpp +} + +make_launchpad_packages() +{ + install_all_dependencies_if_not_yet_installed + + make_changes_in_control_file + + cd $PROJECT_ROOT + prepare_project_structure + + cd $PROJECT_SOURCES_ROOT + prepare_sources + + cd $PROJECT_ROOT + push_bzr_repo + + clean +} + +# Starting point +[[ $1 != "YES" ]] && usage +make_launchpad_packages From cdbbc55828360dbd2ce1345ffbb867d405f39e85 Mon Sep 17 00:00:00 2001 From: asvitenkov Date: Sun, 9 Feb 2014 20:12:32 +0300 Subject: [PATCH 20/71] Code refactoring. Add utf8 encoding --- .../scsabstracthighlightingrule.cpp | 3 +- sources/plugins/scs/scscodeeditor.cpp | 11 +++-- sources/plugins/scs/scscodeerroranalyzer.cpp | 6 +-- sources/plugins/scs/scscodeerroranalyzer.h | 2 +- sources/plugins/scs/scserrortablewidget.cpp | 3 ++ sources/plugins/scs/scsfindwidget.cpp | 2 + .../scs/scsparser/scsparserexception.cpp | 48 ++++++++++++------- .../scs/scsparser/scsparserexception.h | 2 +- .../scs/scsparser/scsparserwrapper.cpp | 2 +- sources/plugins/scs/scswindow.cpp | 18 ++++--- 10 files changed, 62 insertions(+), 35 deletions(-) diff --git a/sources/plugins/scs/highlightingrules/scsabstracthighlightingrule.cpp b/sources/plugins/scs/highlightingrules/scsabstracthighlightingrule.cpp index 5418444..97c7c56 100644 --- a/sources/plugins/scs/highlightingrules/scsabstracthighlightingrule.cpp +++ b/sources/plugins/scs/highlightingrules/scsabstracthighlightingrule.cpp @@ -38,7 +38,8 @@ SCsAbstractHighlightingRule::~SCsAbstractHighlightingRule() void SCsAbstractHighlightingRule::assignFormat(SCsSyntaxHighlighter *highlighter, const QString &text) { - + Q_UNUSED(highlighter); + Q_UNUSED(text); } void SCsAbstractHighlightingRule::setFormat(QTextCharFormat format) diff --git a/sources/plugins/scs/scscodeeditor.cpp b/sources/plugins/scs/scscodeeditor.cpp index d6edad9..31a92a7 100644 --- a/sources/plugins/scs/scscodeeditor.cpp +++ b/sources/plugins/scs/scscodeeditor.cpp @@ -40,11 +40,11 @@ along with OSTIS. If not, see . #define SPACE_FOR_ERROR_LABEL 20 -SCsCodeEditor::SCsCodeEditor(QWidget *parent, SCsErrorTableWidget *errorTable) : - QPlainTextEdit(parent) - ,mLastCursorPosition(0) - ,mIsTextInsert(false) - ,mErrorTable(errorTable) +SCsCodeEditor::SCsCodeEditor(QWidget *parent, SCsErrorTableWidget *errorTable) + : QPlainTextEdit(parent) + , mErrorTable(errorTable) + , mLastCursorPosition(0) + , mIsTextInsert(false) { mLineNumberArea = new SCsLineNumberArea(this); mAnalyzer = new SCsCodeAnalyzer(this); @@ -77,6 +77,7 @@ SCsCodeEditor::SCsCodeEditor(QWidget *parent, SCsErrorTableWidget *errorTable) : void SCsCodeEditor::setDocumentPath(const QString &path) { + Q_UNUSED(path); mAnalyzer->parse(toPlainText(), (QStandardItemModel*)mCompleter->model()); } diff --git a/sources/plugins/scs/scscodeerroranalyzer.cpp b/sources/plugins/scs/scscodeerroranalyzer.cpp index 0fcd4fa..2b68857 100644 --- a/sources/plugins/scs/scscodeerroranalyzer.cpp +++ b/sources/plugins/scs/scscodeerroranalyzer.cpp @@ -7,9 +7,9 @@ SCsCodeErrorAnalyzer::SCsCodeErrorAnalyzer(SCsCodeEditor* editor, SCsErrorTableWidget *errorTable) : QObject(editor) - , mEditor(editor) - , mErrorTable(errorTable) , mAsynchParser(0) + , mErrorTable(errorTable) + , mEditor(editor) { Q_CHECK_PTR(mEditor); @@ -18,7 +18,7 @@ SCsCodeErrorAnalyzer::SCsCodeErrorAnalyzer(SCsCodeEditor* editor, SCsErrorTableW connect(mAsynchParser,SIGNAL(parseExceptionsFinished()),SLOT(parseExceptionFinished())); } -void SCsCodeErrorAnalyzer::parse(QString &text) +void SCsCodeErrorAnalyzer::parse(const QString &text) { if (mAsynchParser->doWork() || text.isEmpty()) return; diff --git a/sources/plugins/scs/scscodeerroranalyzer.h b/sources/plugins/scs/scscodeerroranalyzer.h index 0d12908..4adc7b9 100644 --- a/sources/plugins/scs/scscodeerroranalyzer.h +++ b/sources/plugins/scs/scscodeerroranalyzer.h @@ -38,7 +38,7 @@ class SCsCodeErrorAnalyzer : public QObject Q_OBJECT public: explicit SCsCodeErrorAnalyzer(SCsCodeEditor* editor, SCsErrorTableWidget *errorTable); - void parse(QString &text); + void parse(const QString &text); private: void showError(const QVector &exceptions) const; diff --git a/sources/plugins/scs/scserrortablewidget.cpp b/sources/plugins/scs/scserrortablewidget.cpp index d3890e9..6c22969 100644 --- a/sources/plugins/scs/scserrortablewidget.cpp +++ b/sources/plugins/scs/scserrortablewidget.cpp @@ -35,6 +35,9 @@ void SCsErrorTableWidget::doubleClickAtCell(int row, int col) { if(item(row,0)->type() != ERROR_TABLE_WIDGET_ITEM_TYPE) return; + + Q_UNUSED(col); + SCsErrorTableWidgetItem *item = (SCsErrorTableWidgetItem*) this->item(row,ERROR_TABLE_WIDGET_ITEM_COLUMN); Q_CHECK_PTR(item); diff --git a/sources/plugins/scs/scsfindwidget.cpp b/sources/plugins/scs/scsfindwidget.cpp index 04a29b6..2f56ddc 100644 --- a/sources/plugins/scs/scsfindwidget.cpp +++ b/sources/plugins/scs/scsfindwidget.cpp @@ -148,12 +148,14 @@ void SCsFindWidget::updateButtons() void SCsFindWidget::caseSensitivityChanged(int val) { + Q_UNUSED(val) emit find(mSearchEdit->text()); } void SCsFindWidget::wholeWordChanged(int val) { + Q_UNUSED(val) emit find(mSearchEdit->text()); } diff --git a/sources/plugins/scs/scsparser/scsparserexception.cpp b/sources/plugins/scs/scsparser/scsparserexception.cpp index 5f6f98c..716e856 100644 --- a/sources/plugins/scs/scsparser/scsparserexception.cpp +++ b/sources/plugins/scs/scsparser/scsparserexception.cpp @@ -22,25 +22,32 @@ along with OSTIS. If not, see . #include "scsparserexception.h" -SCsParserException::SCsParserException(): - mLine(-1), mPositionInLine(-1), mExceptionType(-1), mExceptionPlace(SCsParserException::UNDEFINED) +SCsParserException::SCsParserException() + : mExceptionPlace(SCsParserException::UNDEFINED) + , mExceptionType(-1) + , mLine(-1) + , mPositionInLine(-1) { } -SCsParserException::SCsParserException(SCsParserException::ExceptionPlace place) : - mLine(-1), mPositionInLine(-1), mExceptionType(-1), mExceptionPlace(place) +SCsParserException::SCsParserException(SCsParserException::ExceptionPlace place) + : mExceptionPlace(place) + , mExceptionType(-1) + , mLine(-1) + , mPositionInLine(-1) { } -SCsParserException::SCsParserException(ExceptionPlace place, int line, int positionInLine, ExceptionType exType): - mLine(line) - ,mPositionInLine(positionInLine) - ,mExceptionType(exType) - ,mExceptionPlace(place) +SCsParserException::SCsParserException(ExceptionPlace place, int line, int positionInLine, ExceptionType exType) + : mExceptionPlace(place) + , mExceptionType(exType) + , mLine(line) + , mPositionInLine(positionInLine) + { } @@ -71,24 +78,31 @@ SCsParserException::~SCsParserException() } -SCsParserToken::SCsParserToken(): - mTokenType(0), mLine(-1), mPositionInLine(-1) +SCsParserToken::SCsParserToken() + : mLine(-1) + , mPositionInLine(-1) + , mTokenType(0) { } -SCsParserToken::SCsParserToken(int tokenType): - mTokenType(tokenType), mLine(-1), mPositionInLine(-1) +SCsParserToken::SCsParserToken(int tokenType) + : mLine(-1) + , mPositionInLine(-1) + , mTokenType(tokenType) { } -SCsParserToken::SCsParserToken(int tokenType, QString tokenText, int line, int positionInLine): - mTokenType(tokenType), mLine(line), mPositionInLine(positionInLine) +SCsParserToken::SCsParserToken(int tokenType,const QString &tokenText, int line, int positionInLine) + : mTokenText(tokenText) + , mLine(line) + , mPositionInLine(positionInLine) + , mTokenType(tokenType) { - mTokenText = tokenText; + } @@ -116,4 +130,4 @@ SCsParserToken& SCsParserToken::operator=(const SCsParserToken& copy) SCsParserToken::~SCsParserToken() { -} \ No newline at end of file +} diff --git a/sources/plugins/scs/scsparser/scsparserexception.h b/sources/plugins/scs/scsparser/scsparserexception.h index 09b317a..646a9b9 100644 --- a/sources/plugins/scs/scsparser/scsparserexception.h +++ b/sources/plugins/scs/scsparser/scsparserexception.h @@ -70,7 +70,7 @@ class SCsParserToken }; SCsParserToken(); SCsParserToken(int tokenType); - SCsParserToken(int tokenType, QString tokenText, int line, int positionInLine); + SCsParserToken(int tokenType, const QString &tokenText, int line, int positionInLine); SCsParserToken(const SCsParserToken& copy); SCsParserToken& operator=(const SCsParserToken& copy); virtual ~SCsParserToken(); diff --git a/sources/plugins/scs/scsparser/scsparserwrapper.cpp b/sources/plugins/scs/scsparser/scsparserwrapper.cpp index 2b72d5b..9739b65 100644 --- a/sources/plugins/scs/scsparser/scsparserwrapper.cpp +++ b/sources/plugins/scs/scsparser/scsparserwrapper.cpp @@ -244,7 +244,7 @@ QSharedPointer SCsParser::getTokens(const QString &text) co pANTLR3_COMMON_TOKEN tok; pANTLR3_STRING tokText; - for(int i=0; icount; i++) + for(uint i=0; icount; i++) { tok = (pANTLR3_COMMON_TOKEN) tokens->elements[i].element; tokText = tok->getText(tok); diff --git a/sources/plugins/scs/scswindow.cpp b/sources/plugins/scs/scswindow.cpp index fa69ee2..86e4015 100644 --- a/sources/plugins/scs/scswindow.cpp +++ b/sources/plugins/scs/scswindow.cpp @@ -38,12 +38,12 @@ along with OSTIS. If not, see . #include #include -SCsWindow::SCsWindow(const QString& _windowTitle, QWidget *parent): - QWidget(parent), - mEditor(0), - mHighlighter(0), - mIsSaved(false), - mErrorTable(0) +SCsWindow::SCsWindow(const QString& _windowTitle, QWidget *parent) + : QWidget(parent) + , mEditor(0) + , mHighlighter(0) + , mErrorTable(0) + , mIsSaved(false) { @@ -86,6 +86,8 @@ SCsWindow::SCsWindow(const QString& _windowTitle, QWidget *parent): connect(mEditor, SIGNAL(textChanged()), this, SLOT(textChanged())); + + setWindowTitle(_windowTitle); } SCsWindow::~SCsWindow() @@ -131,6 +133,8 @@ bool SCsWindow::loadFromFile(const QString &fileName) } QTextStream in(&fileIn); + in.setCodec("UTF-8"); + mEditor->document()->setPlainText(in.readAll()); mEditor->setDocumentPath(fileName); fileIn.close(); @@ -156,6 +160,8 @@ bool SCsWindow::saveToFile(const QString &fileName) return false; } QTextStream out(&fileOut); + out.setCodec("UTF-8"); + out << mEditor->document()->toPlainText(); fileOut.close(); From 583e2484f4774e161841ecb6d5f748947ec89225 Mon Sep 17 00:00:00 2001 From: Denis Koronchik Date: Mon, 7 Apr 2014 14:47:02 +0300 Subject: [PATCH 21/71] done issues #335, #333 --- .../plugins/scg/scgdefaultobjectbuilder.cpp | 460 +++++++++--------- sources/plugins/scg/scgnode.cpp | 6 +- sources/plugins/scg/scgnode.h | 16 +- sources/plugins/scg/scgnodetextitem.cpp | 53 +- sources/plugins/scg/scgnodetextitem.h | 18 +- 5 files changed, 283 insertions(+), 270 deletions(-) diff --git a/sources/plugins/scg/scgdefaultobjectbuilder.cpp b/sources/plugins/scg/scgdefaultobjectbuilder.cpp index e01ca2a..7df5017 100644 --- a/sources/plugins/scg/scgdefaultobjectbuilder.cpp +++ b/sources/plugins/scg/scgdefaultobjectbuilder.cpp @@ -1,230 +1,230 @@ -/* ------------------------------------------------------------------------------ -This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) -For the latest info, see http://www.ostis.net - -Copyright (c) 2010 OSTIS - -OSTIS 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 3 of the License, or -(at your option) any later version. - -OSTIS is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with OSTIS. If not, see . ------------------------------------------------------------------------------ -*/ - -#include - -#include "scgdefaultobjectbuilder.h" -#include "scgobjectsinfo.h" - -#include "scgnode.h" -#include "scgbus.h" -#include "scgcontour.h" -#include "scgpair.h" - -DefaultSCgObjectBuilder::DefaultSCgObjectBuilder(QGraphicsScene* scene):AbstractSCgObjectBuilder(scene), - mScene(scene) -{ -} - -DefaultSCgObjectBuilder::~DefaultSCgObjectBuilder() -{ -} - -void DefaultSCgObjectBuilder::buildObjects(const AbstractSCgObjectBuilder::TypeToObjectsMap& objects) -{ - SCgObjectInfo* info; - // parse nodes - foreach(info, objects[SCgNode::Type]) - buildNode(static_cast(info)); - // parse pairs - foreach(info, objects[SCgPair::Type]) - buildPair(static_cast(info)); - // parse buses - foreach(info, objects[SCgBus::Type]) - buildBus(static_cast(info)); - // parse contours - foreach(info, objects[SCgContour::Type]) - buildContour(static_cast(info)); - - // set parents relation - ParentChildMap::iterator parentIt; - for (parentIt = mParentChild.begin(); parentIt != mParentChild.end(); parentIt++) - { - if (!mId2SCgObj.contains(parentIt.value())) - continue; - - SCgObject *parent = mId2SCgObj[parentIt.value()]; - SCgObject *child = mId2SCgObj[parentIt.key()]; - - child->setParentItem(parent); - } - - // holds true, if there are errors while setting begin and end objects. - bool isConnectedDuty = false; - // set begin and end objects for pairs - foreach(SCgObjectInfo* info, objects[SCgPair::Type]) - { - SCgPairInfo* pairInfo = static_cast(info); - SCgPair *pair = static_cast(mId2SCgObj[pairInfo->id()]); - - // we can't build pair without begin or end objects - if (!mId2SCgObj.contains(pairInfo->beginObjectId()) || - !mId2SCgObj.contains(pairInfo->endObjectId())) - { - mErrors.append(QObject::tr("Can't find begin or end object for pair id=\"%1\"") - .arg(pairInfo->id())); - mId2SCgObj.remove(pairInfo->id()); - isConnectedDuty = true; - delete pair; - continue; - } - - SCgObject *begObject = mId2SCgObj[pairInfo->beginObjectId()]; - SCgObject *endObject = mId2SCgObj[pairInfo->endObjectId()]; - - pair->setBeginObject(begObject); - pair->setEndObject(endObject); - } - // In this case we must check if all begin and end objects are valid. - // If they not, we have to delete all unfinished pairs. - // It isn't optimal solution but it executed only if there are errors in loaded file. - while(isConnectedDuty) - { - isConnectedDuty = false; - foreach(SCgObjectInfo* info, objects[SCgPair::Type]) - { - SCgPairInfo* pairInfo = static_cast(info); - - bool isNotContainOne = !(mId2SCgObj.contains(pairInfo->beginObjectId()) && - mId2SCgObj.contains(pairInfo->endObjectId())); - if ( mId2SCgObj.contains(pairInfo->id()) && isNotContainOne) - { - SCgPair *pair = static_cast(mId2SCgObj[pairInfo->id()]); - mId2SCgObj.remove(pairInfo->id()); - delete pair; - isConnectedDuty = true; - } - } - } - - // set bus owners - foreach(SCgObjectInfo* info, objects[SCgBus::Type]) - { - SCgBusInfo* busInfo = static_cast(info); - SCgObject *objectOwner = 0; - - if (!mId2SCgObj.contains(busInfo->ownerId())) - { - SCgNode *node = new SCgNode; - - node->setPos(busInfo->points().first()); - node->setTypeAlias("node/const/general_node"); - objectOwner = node; - mScene->addItem(node); - }else - objectOwner = mId2SCgObj[busInfo->ownerId()]; - - // check type and set owner to bus - if (objectOwner->type() != SCgNode::Type) - { - mErrors.append(QObject::tr("Try to set the bus owner(\"%1\") which is not a node type. Bus id=\"%2\"") - .arg(busInfo->ownerId()) - .arg(busInfo->id())); - continue; - } - - SCgBus *bus = static_cast(mId2SCgObj[busInfo->id()]); - SCgNode *owner = static_cast(objectOwner); - - bus->setOwner(owner); - } -} - -void DefaultSCgObjectBuilder::setObjectInfo(SCgObject* obj, SCgObjectInfo* info) -{ - obj->setTypeAlias(info->typeAlias()); - obj->setIdtfValue(info->idtfValue()); - - // store parent id - mParentChild[info->id()] = info->parentId(); - - // store for id mapping - mId2SCgObj[info->id()] = obj; - - // Adding item on scene - mScene->addItem(obj); -} - -void DefaultSCgObjectBuilder::buildNode(SCgNodeInfo* info) -{ - if(!mId2SCgObj.contains(info->id())) - { - SCgNode *node = new SCgNode; - - node->setPos(info->pos()); - node->setContent(info->contentMimeType(), - info->contentData(), - info->contentFilename(), - (SCgContent::ContType)info->contentType()); - if (!node->contentData().isNull() && info->contentVisible()) - node->showContent(); - setObjectInfo(node, info); - node->setIdtfPos((SCgNode::IdentifierPosition)info->idtfPos()); - - } -} - -void DefaultSCgObjectBuilder::buildPair(SCgPairInfo* info) -{ - if(!mId2SCgObj.contains(info->id())) - { - SCgPair* pair = new SCgPair; - - pair->setBeginDot(info->beginDot()); - pair->setEndDot(info->endDot()); - pair->setPoints(info->points()); - - setObjectInfo(pair, info); - } -} - -void DefaultSCgObjectBuilder::buildBus(SCgBusInfo* info) -{ - if(!mId2SCgObj.contains(info->id())) - { - SCgBus* bus = new SCgBus; - - bus->setPoints(info->points()); - - setObjectInfo(bus, info); - } -} - -void DefaultSCgObjectBuilder::buildContour(SCgContourInfo* info) -{ - if(info->points().size() > 2) - { - if(!mId2SCgObj.contains(info->id())) - { - SCgContour* contour = new SCgContour; - - contour->setPos(QPolygonF(info->points()).boundingRect().center()); - contour->setPoints(info->points()); - - setObjectInfo(contour, info); - } - }else - { - mErrors.append(QObject::tr("Try to create contour (\"%1\") with less than 3 points.") - .arg(info->id()) ); - } -} +/* +----------------------------------------------------------------------------- +This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) +For the latest info, see http://www.ostis.net + +Copyright (c) 2010 OSTIS + +OSTIS 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 3 of the License, or +(at your option) any later version. + +OSTIS is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with OSTIS. If not, see . +----------------------------------------------------------------------------- +*/ + +#include + +#include "scgdefaultobjectbuilder.h" +#include "scgobjectsinfo.h" + +#include "scgnode.h" +#include "scgbus.h" +#include "scgcontour.h" +#include "scgpair.h" + +DefaultSCgObjectBuilder::DefaultSCgObjectBuilder(QGraphicsScene* scene):AbstractSCgObjectBuilder(scene), + mScene(scene) +{ +} + +DefaultSCgObjectBuilder::~DefaultSCgObjectBuilder() +{ +} + +void DefaultSCgObjectBuilder::buildObjects(const AbstractSCgObjectBuilder::TypeToObjectsMap& objects) +{ + SCgObjectInfo* info; + // parse nodes + foreach(info, objects[SCgNode::Type]) + buildNode(static_cast(info)); + // parse pairs + foreach(info, objects[SCgPair::Type]) + buildPair(static_cast(info)); + // parse buses + foreach(info, objects[SCgBus::Type]) + buildBus(static_cast(info)); + // parse contours + foreach(info, objects[SCgContour::Type]) + buildContour(static_cast(info)); + + // set parents relation + ParentChildMap::iterator parentIt; + for (parentIt = mParentChild.begin(); parentIt != mParentChild.end(); parentIt++) + { + if (!mId2SCgObj.contains(parentIt.value())) + continue; + + SCgObject *parent = mId2SCgObj[parentIt.value()]; + SCgObject *child = mId2SCgObj[parentIt.key()]; + + child->setParentItem(parent); + } + + // holds true, if there are errors while setting begin and end objects. + bool isConnectedDuty = false; + // set begin and end objects for pairs + foreach(SCgObjectInfo* info, objects[SCgPair::Type]) + { + SCgPairInfo* pairInfo = static_cast(info); + SCgPair *pair = static_cast(mId2SCgObj[pairInfo->id()]); + + // we can't build pair without begin or end objects + if (!mId2SCgObj.contains(pairInfo->beginObjectId()) || + !mId2SCgObj.contains(pairInfo->endObjectId())) + { + mErrors.append(QObject::tr("Can't find begin or end object for pair id=\"%1\"") + .arg(pairInfo->id())); + mId2SCgObj.remove(pairInfo->id()); + isConnectedDuty = true; + delete pair; + continue; + } + + SCgObject *begObject = mId2SCgObj[pairInfo->beginObjectId()]; + SCgObject *endObject = mId2SCgObj[pairInfo->endObjectId()]; + + pair->setBeginObject(begObject); + pair->setEndObject(endObject); + } + // In this case we must check if all begin and end objects are valid. + // If they not, we have to delete all unfinished pairs. + // It isn't optimal solution but it executed only if there are errors in loaded file. + while(isConnectedDuty) + { + isConnectedDuty = false; + foreach(SCgObjectInfo* info, objects[SCgPair::Type]) + { + SCgPairInfo* pairInfo = static_cast(info); + + bool isNotContainOne = !(mId2SCgObj.contains(pairInfo->beginObjectId()) && + mId2SCgObj.contains(pairInfo->endObjectId())); + if ( mId2SCgObj.contains(pairInfo->id()) && isNotContainOne) + { + SCgPair *pair = static_cast(mId2SCgObj[pairInfo->id()]); + mId2SCgObj.remove(pairInfo->id()); + delete pair; + isConnectedDuty = true; + } + } + } + + // set bus owners + foreach(SCgObjectInfo* info, objects[SCgBus::Type]) + { + SCgBusInfo* busInfo = static_cast(info); + SCgObject *objectOwner = 0; + + if (!mId2SCgObj.contains(busInfo->ownerId())) + { + SCgNode *node = new SCgNode; + + node->setPos(busInfo->points().first()); + node->setTypeAlias("node/const/general_node"); + objectOwner = node; + mScene->addItem(node); + }else + objectOwner = mId2SCgObj[busInfo->ownerId()]; + + // check type and set owner to bus + if (objectOwner->type() != SCgNode::Type) + { + mErrors.append(QObject::tr("Try to set the bus owner(\"%1\") which is not a node type. Bus id=\"%2\"") + .arg(busInfo->ownerId()) + .arg(busInfo->id())); + continue; + } + + SCgBus *bus = static_cast(mId2SCgObj[busInfo->id()]); + SCgNode *owner = static_cast(objectOwner); + + bus->setOwner(owner); + } +} + +void DefaultSCgObjectBuilder::setObjectInfo(SCgObject* obj, SCgObjectInfo* info) +{ + obj->setTypeAlias(info->typeAlias()); + obj->setIdtfValue(info->idtfValue()); + + // store parent id + mParentChild[info->id()] = info->parentId(); + + // store for id mapping + mId2SCgObj[info->id()] = obj; + + // Adding item on scene + mScene->addItem(obj); +} + +void DefaultSCgObjectBuilder::buildNode(SCgNodeInfo* info) +{ + if(!mId2SCgObj.contains(info->id())) + { + SCgNode *node = new SCgNode; + + node->setPos(info->pos()); + node->setContent(info->contentMimeType(), + info->contentData(), + info->contentFilename(), + (SCgContent::ContType)info->contentType()); + if (!node->contentData().isNull() && info->contentVisible()) + node->showContent(); + setObjectInfo(node, info); + node->setIdtfPos((SCgNode::eIdentifierPosition)info->idtfPos()); + + } +} + +void DefaultSCgObjectBuilder::buildPair(SCgPairInfo* info) +{ + if(!mId2SCgObj.contains(info->id())) + { + SCgPair* pair = new SCgPair; + + pair->setBeginDot(info->beginDot()); + pair->setEndDot(info->endDot()); + pair->setPoints(info->points()); + + setObjectInfo(pair, info); + } +} + +void DefaultSCgObjectBuilder::buildBus(SCgBusInfo* info) +{ + if(!mId2SCgObj.contains(info->id())) + { + SCgBus* bus = new SCgBus; + + bus->setPoints(info->points()); + + setObjectInfo(bus, info); + } +} + +void DefaultSCgObjectBuilder::buildContour(SCgContourInfo* info) +{ + if(info->points().size() > 2) + { + if(!mId2SCgObj.contains(info->id())) + { + SCgContour* contour = new SCgContour; + + contour->setPos(QPolygonF(info->points()).boundingRect().center()); + contour->setPoints(info->points()); + + setObjectInfo(contour, info); + } + }else + { + mErrors.append(QObject::tr("Try to create contour (\"%1\") with less than 3 points.") + .arg(info->id()) ); + } +} diff --git a/sources/plugins/scg/scgnode.cpp b/sources/plugins/scg/scgnode.cpp index 77dc0c7..fd1aab4 100644 --- a/sources/plugins/scg/scgnode.cpp +++ b/sources/plugins/scg/scgnode.cpp @@ -186,7 +186,7 @@ QPointF SCgNode::cross(const QPointF &from, float dot) const if (!mIsContentVisible) { QVector2D vec(from - scenePos()); - p = vec.normalized().toPointF() * (mSize.width() / 2.f + 5.f); + p = vec.normalized().toPointF() * (mSize.width() / 2.f); }else { @@ -390,7 +390,7 @@ void SCgNode::setIdtfValue(const QString &idtf) positionChanged(); } -SCgNode::IdentifierPosition SCgNode::idtfPos() const +SCgNode::eIdentifierPosition SCgNode::idtfPos() const { if (!mTextItem) return DEFAULT_IDTF_POS; @@ -405,7 +405,7 @@ SCgNode::IdentifierPosition SCgNode::idtfPos() const } -void SCgNode::setIdtfPos(IdentifierPosition pos) +void SCgNode::setIdtfPos(eIdentifierPosition pos) { if (!mTextItem) return; diff --git a/sources/plugins/scg/scgnode.h b/sources/plugins/scg/scgnode.h index 0c0cec0..e54a3e7 100644 --- a/sources/plugins/scg/scgnode.h +++ b/sources/plugins/scg/scgnode.h @@ -38,12 +38,12 @@ friend class SCgBus; public: enum { Type = UserType + 2 }; typedef enum - { - BottomRight = 0, - BottomLeft, - TopLeft, - TopRight - }IdentifierPosition; + { + BottomRight = 0, + BottomLeft, + TopLeft, + TopRight + } eIdentifierPosition; /*! Type for qgraphicsitem_cast */ int type() const { return Type; } @@ -52,8 +52,8 @@ friend class SCgBus; void setIdtfValue(const QString &idtf); - void setIdtfPos(IdentifierPosition pos); - IdentifierPosition idtfPos() const; + void setIdtfPos(eIdentifierPosition pos); + eIdentifierPosition idtfPos() const; QRectF boundingRect() const; diff --git a/sources/plugins/scg/scgnodetextitem.cpp b/sources/plugins/scg/scgnodetextitem.cpp index 7a75317..5e58046 100644 --- a/sources/plugins/scg/scgnodetextitem.cpp +++ b/sources/plugins/scg/scgnodetextitem.cpp @@ -24,7 +24,7 @@ along with OSTIS. If not, see . #include "scgnodetextitem.h" -SCgNodeTextItem::SCgNodeTextItem(const QString &str, SCgNode* parent, SCgNode::IdentifierPosition idtfPos, QGraphicsScene* scene ) +SCgNodeTextItem::SCgNodeTextItem(const QString &str, SCgNode* parent, SCgNode::eIdentifierPosition idtfPos, QGraphicsScene* scene ) : SCgTextItem(str,(QGraphicsItem*)parent,scene) , mTextPos(idtfPos) { @@ -34,7 +34,7 @@ SCgNodeTextItem::SCgNodeTextItem(const QString &str, SCgNode* parent, SCgNode::I } -SCgNodeTextItem::SCgNodeTextItem(SCgNode *parent, SCgNode::IdentifierPosition idtfPos, QGraphicsScene *scene) +SCgNodeTextItem::SCgNodeTextItem(SCgNode *parent, SCgNode::eIdentifierPosition idtfPos, QGraphicsScene *scene) : SCgTextItem((QGraphicsItem*)parent, scene) , mTextPos(idtfPos) { @@ -56,7 +56,7 @@ void SCgNodeTextItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event) } -void SCgNodeTextItem::setTextPos(SCgNode::IdentifierPosition pos) +void SCgNodeTextItem::setTextPos(SCgNode::eIdentifierPosition pos) { if (mTextPos != pos) { @@ -65,47 +65,60 @@ void SCgNodeTextItem::setTextPos(SCgNode::IdentifierPosition pos) } } -SCgNode::IdentifierPosition SCgNodeTextItem::posToIdtfPos(const QPointF &point) const +SCgNode::eIdentifierPosition SCgNodeTextItem::posToIdtfPos(const QPointF &point) const { - SCgNode::IdentifierPosition idtfPos = SCgNode::BottomRight; + SCgNode::eIdentifierPosition idtfPos = SCgNode::BottomRight; - qreal x = point.x(); - qreal y = point.y(); + qreal x = point.x(); + qreal y = point.y(); - if (qFuzzyIsNull(x)) + if (qFuzzyIsNull(x)) x += 1; - if (qFuzzyIsNull(y)) + if (qFuzzyIsNull(y)) y += 1; if (x > 0) + { if (y > 0) idtfPos = SCgNode::BottomRight; - else + else idtfPos = SCgNode::TopRight; - else + } + else + { if (y > 0) idtfPos = SCgNode::BottomLeft; - else + else idtfPos = SCgNode::TopLeft; + } - return idtfPos; + return idtfPos; } -void SCgNodeTextItem::updateTextPos(SCgNode::IdentifierPosition pos) +void SCgNodeTextItem::updateTextPos(SCgNode::eIdentifierPosition pos) { - QRectF rect = boundingRect(); - QRectF parentRect = mParentItem->boundingRect(); + QRectF rect = boundingRect(); + QRectF parentRect = mParentItem->boundingRect(); - QPointF newPos = parentRect.bottomRight() - QPointF(rect.x(),rect.y()); + QPointF newPos; if (pos == SCgNode::BottomLeft || pos == SCgNode::TopLeft) - newPos.rx() = parentRect.left() - rect.width() - rect.x(); + newPos.setX(parentRect.left() - rect.width() + 8); + else + newPos.setX(parentRect.right() - 8); if (pos == SCgNode::TopLeft || pos == SCgNode::TopRight) - newPos.ry() = parentRect.top() - rect.height() - rect.y(); + newPos.setY(parentRect.top() - rect.height() + 8); + else + newPos.setY(parentRect.bottom() - 8); - setPos(newPos); + setPos(newPos); mParentItem->setSelected(true); setSelected(false); } + +SCgNode::eIdentifierPosition SCgNodeTextItem::textPos() const +{ + return mTextPos; +} diff --git a/sources/plugins/scg/scgnodetextitem.h b/sources/plugins/scg/scgnodetextitem.h index f45798a..79e6a71 100644 --- a/sources/plugins/scg/scgnodetextitem.h +++ b/sources/plugins/scg/scgnodetextitem.h @@ -32,13 +32,14 @@ class QGraphicsSceneMouseEvent; class SCgNodeTextItem : public SCgTextItem { Q_OBJECT + friend class SCgNode; public: //! Object type enum { Type = UserType + 9 }; - explicit SCgNodeTextItem(const QString &str, SCgNode* parent, SCgNode::IdentifierPosition idtfPos = SCgNode::BottomRight, QGraphicsScene* scene = 0); - explicit SCgNodeTextItem(SCgNode* parent, SCgNode::IdentifierPosition idtfPos = SCgNode::BottomRight, QGraphicsScene* scene = 0); + explicit SCgNodeTextItem(const QString &str, SCgNode* parent, SCgNode::eIdentifierPosition idtfPos = SCgNode::BottomRight, QGraphicsScene* scene = 0); + explicit SCgNodeTextItem(SCgNode* parent, SCgNode::eIdentifierPosition idtfPos = SCgNode::BottomRight, QGraphicsScene* scene = 0); virtual ~SCgNodeTextItem(); //! Return a type of graphics item as integer @@ -46,15 +47,14 @@ class SCgNodeTextItem : public SCgTextItem protected: virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event); - void setTextPos(SCgNode::IdentifierPosition pos); - SCgNode::IdentifierPosition textPos() const { return mTextPos; } - void updateTextPos(SCgNode::IdentifierPosition pos); - SCgNode::IdentifierPosition posToIdtfPos(const QPointF &point) const; + void setTextPos(SCgNode::eIdentifierPosition pos); + SCgNode::eIdentifierPosition textPos() const; - SCgNode::IdentifierPosition mTextPos; - SCgNode *mParentItem; + void updateTextPos(SCgNode::eIdentifierPosition pos); + SCgNode::eIdentifierPosition posToIdtfPos(const QPointF &point) const; - friend class SCgNode; + SCgNode::eIdentifierPosition mTextPos; + SCgNode *mParentItem; }; #endif // SCGNODETEXTITEM_H From c13114f6f7acc0c278dbbc647f27e5480ac372dd Mon Sep 17 00:00:00 2001 From: Anton Belka Date: Wed, 2 Apr 2014 01:11:27 +0300 Subject: [PATCH 22/71] Fix cmake rules --- sources/CMakeLists.txt | 7 +- sources/kbe/CMakeLists.txt | 146 ++++++---------- sources/plugins/CMakeLists.txt | 3 + sources/plugins/m4scp/CMakeLists.txt | 64 +++++++ sources/plugins/scg/CMakeLists.txt | 240 ++++++++++++++++++++------- sources/plugins/scs/CMakeLists.txt | 93 +++++++++++ 6 files changed, 398 insertions(+), 155 deletions(-) create mode 100644 sources/plugins/m4scp/CMakeLists.txt create mode 100644 sources/plugins/scs/CMakeLists.txt diff --git a/sources/CMakeLists.txt b/sources/CMakeLists.txt index 6f2edf8..156595e 100644 --- a/sources/CMakeLists.txt +++ b/sources/CMakeLists.txt @@ -1,7 +1,10 @@ cmake_minimum_required (VERSION 2.6) -set(PROJECT_ROOT_DIR ${CMAKE_SOURCE_DIR}) -set(PROJECT_OUTPUT_DIR ${PROJECT_ROOT_DIR}/build) +set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ../bin) +set (CMAKE_LIBRARY_OUTPUT_DIRECTORY ../../bin/plugins) + +set (PROJECT_ROOT_DIR ${CMAKE_SOURCE_DIR}) +set (PROJECT_OUTPUT_DIR ${PROJECT_ROOT_DIR}/build) if (WIN32) set(CMAKE_USE_RELATIVE_PATHS true) diff --git a/sources/kbe/CMakeLists.txt b/sources/kbe/CMakeLists.txt index 1b5c4a4..490fb4d 100644 --- a/sources/kbe/CMakeLists.txt +++ b/sources/kbe/CMakeLists.txt @@ -1,124 +1,78 @@ set (PROJECT kbe) -set(KBE_DIR ${PROJECT_ROOT_DIR}/kbe) -set(KBE_MEDIA_DIR ${KBE_DIR}/media) +set (KBE_DIR ${PROJECT_ROOT_DIR}/kbe) +set (KBE_MEDIA_DIR ${KBE_DIR}/media) -set(KBE_SRCS - basewindow.cpp - config.cpp - extendedtabwidget.cpp - guidedialog.cpp - main.cpp - mainwindow.cpp - pluginmanager.cpp -) - -set(KBE_HDRS - basewindow.h - config.h - extendedtabwidget.h - guidedialog.h - mainwindow.h +set (HEADERS + version.h platform.h + mainwindow.h + extendedtabwidget.h + config.h + interfaces/plugininterface.h pluginmanager.h - version.h + interfaces/editorinterface.h + guidedialog.h + newfiledialog.h ) -set(KBE_MOC_HDRS - basewindow.h - extendedtabwidget.h - guidedialog.h - mainwindow.h - pluginmanager.h +set (SOURCES + mainwindow.cpp + main.cpp + extendedtabwidget.cpp + config.cpp + pluginmanager.cpp + guidedialog.cpp + newfiledialog.cpp ) -set (KBE_UI_FORMS +set (FORMS mainwindow.ui ) -set (KBE_ALL_SRCS - ${KBE_SRCS} - ${KBE_UI_FORMS} +set (RESOURCES + kbe.qrc + ) + +set (RC_FILE + kbe.rc ) -set (KBE_TRANSLATIONS +set (TRANSLATIONS ${KBE_MEDIA_DIR}/translations/lang_en_EN.ts ${KBE_MEDIA_DIR}/translations/lang_ru_RU.ts ) project (${PROJECT}) - -include_directories (./) +FOREACH (TRANSLATION ${TRANSLATIONS}) + execute_process(COMMAND lrelease-qt4 ${TRANSLATION}) +ENDFOREACH(TRANSLATION) + +include_directories(./) include (${QT_USE_FILE}) -qt4_wrap_ui (SAMPLE_UI_HDRS ${KBE_UI_FORMS}) -qt4_wrap_cpp (MOC_SOURCES ${KBE_MOC_HDRS}) - -option (FIM_WITHOUT_I18N "Do not use language tool (for debugging)" OFF) - -if (NOT FIM_WITHOUT_I18N) - -option (FIM_UPDATE_TRANSLATIONS "Update translations (*.ts files)" OFF) - -if (FIM_UPDATE_TRANSLATIONS) - QT4_CREATE_TRANSLATION(QM_FILES ${KBE_ALL_SRCS} ${KBE_TRANSLATIONS} OPTIONS -no-obsolete) - message("Updating *.ts files") -else (FIM_UPDATE_TRANSLATIONS) - QT4_ADD_TRANSLATION(QM_FILES ${KBE_TRANSLATIONS}) - message("Using existing *.ts files") -endif (FIM_UPDATE_TRANSLATIONS) - -endif (NOT FIM_WITHOUT_I18N) - -add_definitions (-Wall) - -source_group ("Header Files" FILES ${KBE_HDRS}) -source_group ("Source Files" FILES ${KBE_ALL_SRCS}) -source_group ("Generated Files" FILES ${MOC_SOURCES} ${QM_FILES}) +qt4_add_resources (QRC_SOURCES ${RESOURCES}) +qt4_wrap_ui (UI_HEADERS ${FORMS}) +qt4_wrap_cpp (MOC_SOURCES ${HEADERS}) + +if (MSVC) + add_definitions (/W3) +elseif (CMAKE_COMPILER_IS_GNUCXX) + add_definitions (-Wall) +else () + message ("Unknown compiler") +endif () + +source_group ("Header Files" FILES ${HEADERS}) +source_group ("Source Files" FILES ${SOURCES}) +source_group ("Generated Files" FILES ${MOC_SOURCES}) +source_group ("Resource Files" FILES ${QRC_SOURCES}) if (WIN32) -add_executable (${PROJECT} - ${KBE_HDRS} - ${MOC_SOURCES} - ${KBE_ALL_SRCS} - ${QM_FILES} - kbe.rc - ) + add_executable (${PROJECT} ${HEADERS} ${SOURCES} ${MOC_SOURCES} ${QRC_SOURCES} ${RC_FILE}) else (WIN32) -add_executable (${PROJECT} - ${KBE_HDRS} - ${MOC_SOURCES} - ${KBE_ALL_SRCS} - ${QM_FILES} - ) + add_executable (${PROJECT} ${HEADERS} ${SOURCES} ${MOC_SOURCES} ${QRC_SOURCES}) endif (WIN32) target_link_libraries (${PROJECT} ${QT_LIBRARIES}) - -#file (COPY ./sources/media DESTINATION ${CMAKE_BINARY_DIR}) - -IF (WIN32) - - add_custom_command (TARGET kbe COMMAND - if not exist $(TargetDir)media\\lang\\ mkdir $(TargetDir)media\\lang\\) - - foreach(FILENAME ${QM_FILES}) - add_custom_command(TARGET kbe - COMMAND copy \"${FILENAME}\" $(TargetDir)media\\lang\\) - add_custom_command(TARGET kbe - COMMAND del \"${FILENAME}\") - endforeach(FILENAME) - -ELSE (WIN32) - - add_custom_command (TARGET kbe COMMAND - mkdir ${KBE_MEDIA_DIR}/lang/) - foreach(FILENAME ${QM_FILES}) - add_custom_command(TARGET kbe - COMMAND cp ${FILENAME} ${KBE_MEDIA_DIR}/lang/) - add_custom_command(TARGET kbe - COMMAND rm ${FILENAME}) - endforeach(FILENAME) - -ENDIF (WIN32) diff --git a/sources/plugins/CMakeLists.txt b/sources/plugins/CMakeLists.txt index 35a67b6..5c9c9aa 100644 --- a/sources/plugins/CMakeLists.txt +++ b/sources/plugins/CMakeLists.txt @@ -1,4 +1,7 @@ +OPTION (BUILD_SHARED_LIBS "Build shared libraries." ON) set(PLUGINS_DIR ${PROJECT_ROOT_DIR}/plugins) +add_subdirectory(m4scp) add_subdirectory(scg) +add_subdirectory(scs) diff --git a/sources/plugins/m4scp/CMakeLists.txt b/sources/plugins/m4scp/CMakeLists.txt new file mode 100644 index 0000000..d6e4e85 --- /dev/null +++ b/sources/plugins/m4scp/CMakeLists.txt @@ -0,0 +1,64 @@ +set (PROJECT m4scp) + +set (M4SCP_DIR ${PLUGINS_DIR}/m4scp) +set (M4SCP_MEDIA_DIR ${M4SCP_DIR}/media) + +set (HEADERS + m4scpwindow.h + m4scpsyntaxhighlighter.h + m4scpsyntax.h + m4scpcodeeditor.h + m4scpcodecompleter.h + m4scpplugin.h + m4scpcodeanalyzer.h + m4scpblockdata.h +) + +set (SOURCES + m4scpwindow.cpp + m4scpsyntaxhighlighter.cpp + m4scpsyntax.cpp + m4scpcodeeditor.cpp + m4scpcodecompleter.cpp + m4scpplugin.cpp + m4scpcodeanalyzer.cpp +) + +set (RESOURCES + m4scp.qrc + ) + +set (TRANSLATIONS + ${M4SCP_MEDIA_DIR}/translations/m4scp_en_EN.ts + ${M4SCP_MEDIA_DIR}/translations/m4scp_ru_RU.ts + ) + +project (${PROJECT}) + +FOREACH (TRANSLATION ${TRANSLATIONS}) + execute_process(COMMAND lrelease-qt4 ${TRANSLATION}) +ENDFOREACH(TRANSLATION) + +include_directories(./) +include_directories(${PROJECT_ROOT_DIR}/kbe) + +include (${QT_USE_FILE}) +qt4_add_resources (QRC_SOURCES ${RESOURCES}) +qt4_wrap_cpp (MOC_SOURCES ${HEADERS}) + +if (MSVC) + add_definitions (/W3) +elseif (CMAKE_COMPILER_IS_GNUCXX) + add_definitions (-Wall) +else () + message ("Unknown compiler") +endif () + +source_group ("Header Files" FILES ${HEADERS}) +source_group ("Source Files" FILES ${SOURCES}) +source_group ("Generated Files" FILES ${MOC_SOURCES}) +source_group ("Resource Files" FILES ${QRC_SOURCES}) + +add_library (${PROJECT} ${HEADERS} ${SOURCES} ${MOC_SOURCES} ${QRC_SOURCES}) + +target_link_libraries (${PROJECT} ${QT_LIBRARIES}) diff --git a/sources/plugins/scg/CMakeLists.txt b/sources/plugins/scg/CMakeLists.txt index 9fdf4e4..c034f92 100644 --- a/sources/plugins/scg/CMakeLists.txt +++ b/sources/plugins/scg/CMakeLists.txt @@ -1,79 +1,205 @@ set (PROJECT scg) -set(SCG_DIR ${PLUGINS_DIR}/scg) -set(SCG_MEDIA_DIR ${SCG_DIR}/media) +set (SCG_DIR ${PLUGINS_DIR}/scg) +set (SCG_MEDIA_DIR ${SCG_DIR}/media) -set(SCG_SRCS - scgabstractobjectbuilder.cpp - scgalphabet.cpp - scgbus.cpp - scgconfig.cpp - scgcontent.cpp - scgcontentchangedialog.cpp - scgcontentdialog.cpp - scgcontentfactory.cpp - scgcontentimage.cpp - scgcontentnumeric.cpp - scgcontentstring.cpp -) - -set(SCG_HDRS - scgabstractobjectbuilder.h - scgalphabet.h - scgbus.h - scgconfig.h - scgcontent.h - scgcontentchangedialog.h - scgcontentdialog.h - scgcontentfactory.h - scgcontentimage.h - scgcontentnumeric.h +set (HEADERS + scgwindow.h + scgview.h + scgtemplateobjectbuilder.h + scgscene.h + scgpointobject.h + scgpair.h + scgobjectsinfodata.h + scgobjectsinfo.h + scgobject.h + scgnode.h + scgminimap.h + scglayoutmanager.h + scgfilewriterimage.h + scgdefaultobjectbuilder.h + scgcontour.h + scgcontentviewer.h scgcontentstring.h + scgcontentnumeric.h + scgcontentimage.h + scgcontentfactory.h + scgcontentdialog.h + scgcontentchangedialog.h + scgcontent.h + scgconfig.h + scgbus.h + scgalphabet.h + scgabstractobjectbuilder.h + scgpointgraphicsitem.h + scgtextitem.h + gwf/gwfstreamwriter.h + gwf/gwfobjectinforeader.h + gwf/gwffilewriter.h + gwf/gwffileloader.h + scgplugin.h + scgfindwidget.h + scgundoviewmodel.h + scgundoview.h + commands/scgcommandselectedobjectmove.h + commands/scgcommandpointschange.h + commands/scgcommandpointmove.h + commands/scgcommandobjectmove.h + commands/scgcommandobjectdelete.h + commands/scgcommandinsert.h + commands/scgcommanddeletecontour.h + commands/scgcommandcreatepair.h + commands/scgcommandcreatenode.h + commands/scgcommandcreatecontour.h + commands/scgcommandcreatebus.h + commands/scgcommandcontentvisibility.h + commands/scgcommandcontentchange.h + commands/scgcommandclone.h + commands/scgcommandchangeincedentobject.h + commands/scgbasecommand.h + commands/scgcommandidtfmove.h + commands/scgcommandobjectidtfchange.h + commands/scgcommandobjecttypechange.h + scgexportimage.h + arrangers/scgarrangervertical.h + arrangers/scgarrangertuple.h + arrangers/scgarrangerhorizontal.h + arrangers/scgarrangergrid.h + arrangers/scgarranger.h + select/scgselectinputoutput.h + select/scgselect.h + select/scgselectsubgraph.h + modes/scgselectmode.h + modes/scgpairmode.h + modes/scgmode.h + modes/scginsertmode.h + modes/scgcontourmode.h + modes/scgclonemode.h + modes/scgbusmode.h + commands/scgcommandswappairorient.h + arrangers/scgarrangerenergybased.h + commands/scgcommandremovebreakpoints.h + commands/scgcommandminimizecontour.h + arrangers/scgforcecalculator.h + scgnodetextitem.h ) -set(SCG_MOC_HDRS - +set (SOURCES + scgwindow.cpp + scgview.cpp + scgtemplateobjectbuilder.cpp + scgscene.cpp + scgpointobject.cpp + scgpair.cpp + scgobjectsinfodata.cpp + scgobjectsinfo.cpp + scgobject.cpp + scgnode.cpp + scgminimap.cpp + scglayoutmanager.cpp + scgfilewriterimage.cpp + scgdefaultobjectbuilder.cpp + scgcontour.cpp + scgcontentviewer.cpp + scgcontentstring.cpp + scgcontentnumeric.cpp + scgcontentimage.cpp + scgcontentfactory.cpp + scgcontentdialog.cpp + scgcontentchangedialog.cpp + scgcontent.cpp + scgconfig.cpp + scgbus.cpp + scgalphabet.cpp + scgabstractobjectbuilder.cpp + scgpointgraphicsitem.cpp + scgtextitem.cpp + gwf/gwfstreamwriter.cpp + gwf/gwfobjectinforeader.cpp + gwf/gwffilewriter.cpp + gwf/gwffileloader.cpp + scgplugin.cpp + scgfindwidget.cpp + scgundoviewmodel.cpp + scgundoview.cpp + commands/scgcommandselectedobjectmove.cpp + commands/scgcommandpointschange.cpp + commands/scgcommandpointmove.cpp + commands/scgcommandobjectmove.cpp + commands/scgcommandobjectdelete.cpp + commands/scgcommandinsert.cpp + commands/scgcommanddeletecontour.cpp + commands/scgcommandcreatepair.cpp + commands/scgcommandcreatecontour.cpp + commands/scgcommandcreatebus.cpp + commands/scgcommandcontentvisibility.cpp + commands/scgcommandcontentchange.cpp + commands/scgcommandclone.cpp + commands/scgcommandchangeincedentobject.cpp + commands/scgbasecommand.cpp + commands/scgcommandcreatenode.cpp + commands/scgcommandidtfmove.cpp + commands/scgcommandobjectidtfchange.cpp + commands/scgcommandobjecttypechange.cpp + scgexportimage.cpp + arrangers/scgarrangervertical.cpp + arrangers/scgarrangertuple.cpp + arrangers/scgarrangerhorizontal.cpp + arrangers/scgarrangergrid.cpp + arrangers/scgarranger.cpp + select/scgselectinputoutput.cpp + select/scgselect.cpp + select/scgselectsubgraph.cpp + modes/scgselectmode.cpp + modes/scgpairmode.cpp + modes/scgmode.cpp + modes/scginsertmode.cpp + modes/scgcontourmode.cpp + modes/scgclonemode.cpp + modes/scgbusmode.cpp + commands/scgcommandswappairorient.cpp + arrangers/scgarrangerenergybased.cpp + commands/scgcommandremovebreakpoints.cpp + commands/scgcommandminimizecontour.cpp + arrangers/scgforcecalculator.cpp + scgnodetextitem.cpp ) -set (SCG_UI_FORMS +set (RESOURCES + scg.qrc ) -set (SCG_ALL_SRCS - ${SCG_SRCS} - ${SCG_UI_FORMS} +set (TRANSLATIONS + ${SCG_MEDIA_DIR}/translations/scg_en_EN.ts + ${SCG_MEDIA_DIR}/translations/scg_ru_RU.ts ) project (${PROJECT}) +FOREACH (TRANSLATION ${TRANSLATIONS}) + execute_process(COMMAND lrelease-qt4 ${TRANSLATION}) +ENDFOREACH(TRANSLATION) + include_directories(./) include_directories(${PROJECT_ROOT_DIR}/kbe) include (${QT_USE_FILE}) -qt4_wrap_ui (SAMPLE_UI_HDRS ${SCG_UI_FORMS}) -qt4_wrap_cpp (MOC_SOURCES ${SCG_MOC_HDRS}) - -add_definitions (-Wall) +qt4_add_resources (QRC_SOURCES ${RESOURCES}) +qt4_wrap_cpp (MOC_SOURCES ${HEADERS}) -source_group ("Header Files" FILES ${SCG_HDRS}) -source_group ("Source Files" FILES ${SCG_ALL_SRCS}) -source_group ("Generated Files" FILES ${MOC_SOURCES} ${QM_FILES}) +if (MSVC) + add_definitions (/W3) +elseif (CMAKE_COMPILER_IS_GNUCXX) + add_definitions (-Wall) +else () + message ("Unknown compiler") +endif () -if (WIN32) -add_library (${PROJECT} - ${SCG_HDRS} - ${MOC_SOURCES} - ${SCG_ALL_SRCS} - ${QM_FILES} - scg.rc - ) -else (WIN32) -add_library (${PROJECT} - ${SCG_HDRS} - ${MOC_SOURCES} - ${SCG_ALL_SRCS} - ${QM_FILES} - ) -endif (WIN32) +source_group ("Header Files" FILES ${HEADERS}) +source_group ("Source Files" FILES ${SOURCES}) +source_group ("Generated Files" FILES ${MOC_SOURCES}) +source_group ("Resource Files" FILES ${QRC_SOURCES}) + +add_library (${PROJECT} ${HEADERS} ${SOURCES} ${MOC_SOURCES} ${QRC_SOURCES}) target_link_libraries (${PROJECT} ${QT_LIBRARIES}) - diff --git a/sources/plugins/scs/CMakeLists.txt b/sources/plugins/scs/CMakeLists.txt new file mode 100644 index 0000000..fb1cb90 --- /dev/null +++ b/sources/plugins/scs/CMakeLists.txt @@ -0,0 +1,93 @@ +set (PROJECT scs) + +set (SCS_DIR ${PLUGINS_DIR}/scs) +set (SCS_MEDIA_DIR ${SCS_DIR}/media) + +set (HEADERS + highlightingrules/scsstdhighlightingrule.h + highlightingrules/scsmultilinehighlightingrule.h + highlightingrules/scsmultilinecommenthighlightingrule.h + highlightingrules/scshighlightingrulespool.h + highlightingrules/scsabstracthighlightingrule.h + scsparser/scsparserexception.h + scsparser/scsparserwrapper.h + scsparser/SCsCLexer.h + scsparser/SCsCParser.h + scsparser/scscparserdefs.h + scsparser/scsasynchparser.h + scswindow.h + scsplugin.h + scscodeerroranalyzer.h + scserrortablewidget.h + scscodeeditor.h + scserrortablewidgetitem.h + scsfindwidget.h + scssyntaxhighlighter.h + scscodeanalyzer.h + scscodecompleter.h +) + +set (SOURCES + highlightingrules/scsstdhighlightingrule.cpp + highlightingrules/scsmultilinehighlightingrule.cpp + highlightingrules/scsmultilinecommenthighlightingrule.cpp + highlightingrules/scshighlightingrulespool.cpp + highlightingrules/scsabstracthighlightingrule.cpp + scsparser/scsparserwrapper.cpp + scsparser/scsparserexception.cpp + scsparser/SCsCLexer.c + scsparser/SCsCParser.c + scsparser/scscparserdefs.c + scsparser/scsasynchparser.cpp + scswindow.cpp + scserrortablewidget.cpp + scscodeeditor.cpp + scsfindwidget.cpp + scscodeerroranalyzer.cpp + scsplugin.cpp + scserrortablewidgetitem.cpp + scscodeanalyzer.cpp + scssyntaxhighlighter.cpp + scscodecompleter.cpp +) + +set (RESOURCES + scs.qrc + ) + +set (TRANSLATIONS + ${SCS_MEDIA_DIR}/translations/scs_en_EN.ts + ${SCS_MEDIA_DIR}/translations/scs_ru_RU.ts + ) + +project (${PROJECT}) + +FOREACH (TRANSLATION ${TRANSLATIONS}) + execute_process(COMMAND lrelease-qt4 ${TRANSLATION}) +ENDFOREACH(TRANSLATION) + +include_directories(./) +include_directories(./scsparser) +include_directories(./highlightingrules) +include_directories(${PROJECT_ROOT_DIR}/kbe) + +include (${QT_USE_FILE}) +qt4_add_resources (QRC_SOURCES ${RESOURCES}) +qt4_wrap_cpp (MOC_SOURCES ${HEADERS}) + +if (MSVC) + add_definitions (/W3) +elseif (CMAKE_COMPILER_IS_GNUCXX) + add_definitions (-Wall) +else () + message ("Unknown compiler") +endif () + +source_group ("Header Files" FILES ${HEADERS}) +source_group ("Source Files" FILES ${SOURCES}) +source_group ("Generated Files" FILES ${MOC_SOURCES}) +source_group ("Resource Files" FILES ${QRC_SOURCES}) + +add_library (${PROJECT} ${HEADERS} ${SOURCES} ${MOC_SOURCES} ${QRC_SOURCES}) + +target_link_libraries (${PROJECT} ${QT_LIBRARIES}) From 182c5d33ab6d8101eac0a21692b1d38dc7cd202d Mon Sep 17 00:00:00 2001 From: Anton Belka Date: Mon, 7 Apr 2014 20:51:40 +0300 Subject: [PATCH 23/71] scg: use utf-8 encoding (issue #334) --- sources/plugins/scg/gwf/gwffilewriter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/plugins/scg/gwf/gwffilewriter.cpp b/sources/plugins/scg/gwf/gwffilewriter.cpp index c33a3a1..7bed561 100644 --- a/sources/plugins/scg/gwf/gwffilewriter.cpp +++ b/sources/plugins/scg/gwf/gwffilewriter.cpp @@ -55,7 +55,7 @@ bool GWFFileWriter::save(QString file_name, QObject *input) return false; } stream.setDevice(&fileOut); - stream.startWriting("windows-1251"); + stream.startWriting("UTF-8"); QList items = scene->items (); QGraphicsItem * item; From ad9f677c21d27eeed4045a7d5af7b6e27c2df30e Mon Sep 17 00:00:00 2001 From: Denis Koronchik Date: Sun, 4 May 2014 02:04:56 +0300 Subject: [PATCH 24/71] work on packaging; update changelogs --- docs/changelog.html | 396 +++++++++++++++++++----------------- sources/kbe/kbe.pro | 7 +- sources/kbe/ui_mainwindow.h | 4 +- tools/DEBIAN/changelog | 21 ++ tools/DEBIAN/control | 4 +- tools/launchpad/control | 2 +- tools/make-launchpad.sh | 2 +- 7 files changed, 240 insertions(+), 196 deletions(-) diff --git a/docs/changelog.html b/docs/changelog.html index 335e011..db08493 100644 --- a/docs/changelog.html +++ b/docs/changelog.html @@ -1,7 +1,7 @@ - + @@ -13,88 +13,116 @@

Change Log


-

v0.3.0(Integrator)

+ +

v0.3.1 (Integrator)

+
    +

    Common changes

    +
  • Added hotkeys to switch tabs
  • +
  • Added cancel button to save file dialog on exit
  • +
  • Improved new file dialog
  • +
  • Fixed plugin loading on linux
  • +
  • Fixed dock widget positions save/load
  • +
  • Fixed main window title
  • + +

    SCg-editor

    +
  • Added load/save of content state
  • +
  • Added command to show/hide all contents
  • +
  • Added node type changing depending on text identifier
  • +
  • Added element type copying
  • +
  • Fixed text identifier positions
  • +
  • Fixed problem to load gwf files with 'content_visibility' attribute
  • +
  • Fixed visual style of scg-elements

    Now arcs/edges has no idents from nodes, and correctly draws when they output or input for other one

  • +
  • Fixed default encoding to utf-8
  • + + +

    SCs editor

    +
  • Added support of scs 0.2.0 standard
  • +
  • Fixed default encoding to utf-8
  • + +
+ +

v0.3.0 (Integrator)

    -

    Common changes

    -
  • Added plugins support
  • -
  • Refactored user guide documentation

    Now it made in tex format

  • -
  • Added scripts to make deb package on Ubuntu
  • -
  • Fixed errors with file opening
  • -
  • Disabled import/export menu
  • -
  • Resources for each editor moved into qrc files, and now them compiled into plugin
  • -
  • Added feedback dialog
  • -
  • Added coding standards
  • -
  • New tool icons set used
  • -
  • Fixed possible bugs with tabs

    There was possibility to make tool crashed, when working with tabs

  • -
  • Added icons for tabs
  • -
  • Added guide dialog on startup
  • -
  • Added examples of files
  • -
  • Added new files dialog, that allows to create files with supported formats
  • - -

    SCg-editor

    -
  • Improved drag and drop feature

    Now if drag file on sc.g-node, then that file will be set as content

  • -
  • Fixed bug with sc.g-bus dragging

    Sometimes it crashes tool

  • -
  • Fixed bug with sc.g-pair dragging into contour

    Now if you drag two sc.g-nodes with sc.g-pair into sc.g-contour, then sc.g-pair also will be added into sc.g-contour

  • -
  • Added object cloning

    Now you can clone selected objects by Shift + mouse dragging

  • -
  • Added possibility to navigate in sc.g-document with keyboard
  • -
  • Added new command to select sc.g-elements

    For now there are two commands: select input/output sc.g-pairs, select subgraph

  • -
  • Added possibilit ot move text identifiers
  • -
  • Added automatical type changing for sc.g-element depending on their text identifiers
  • -
  • Refactored undo/redo commands

    They moved into specified directory

  • -
  • Refactored scg modes

    They moved into separate directory, and class names was changed

  • -
  • Added support of 0.1.0 version of SCg-code
  • -
  • Fixed bug with bus arrange
  • -
  • Improved type changing menu

    Now it supports common types of objects

  • -
  • Fixed bugs with copying
  • -
  • Changed rules of sc.g-contour drawing

    Now it draws with rounded corners

  • -
  • Changed rules of sc.g-border drawing

    Now it draws with mark in left top corner

  • -
  • Fixed bugs with exporting into image
  • -
  • Fixed bug with context menu calling

    Disabled calling of context menu with keyboard

  • -
  • Arrangers and slection tools grouped on toolbar
  • -
  • Fixed bug with content change dialog size under linux
  • - -

    M4Scp editor

    -
  • Added syntax highlighting
  • -
  • Added line numbers into editor
  • -
  • Added autocompletion of scp operators
  • -
  • Added icons into autocompletion list
  • - -

    SCs editor

    -
  • Added syntax highlighting
  • -
  • Added line numbers into editor
  • -
  • Added autocompletion of includes, identifiers

    It also parse included files and add identifiers from them

  • +

    Common changes

    +
  • Added plugins support
  • +
  • Refactored user guide documentation

    Now it made in tex format

  • +
  • Added scripts to make deb package on Ubuntu
  • +
  • Fixed errors with file opening
  • +
  • Disabled import/export menu
  • +
  • Resources for each editor moved into qrc files, and now them compiled into plugin
  • +
  • Added feedback dialog
  • +
  • Added coding standards
  • +
  • New tool icons set used
  • +
  • Fixed possible bugs with tabs

    There was possibility to make tool crashed, when working with tabs

  • +
  • Added icons for tabs
  • +
  • Added guide dialog on startup
  • +
  • Added examples of files
  • +
  • Added new files dialog, that allows to create files with supported formats
  • + +

    SCg-editor

    +
  • Improved drag and drop feature

    Now if drag file on sc.g-node, then that file will be set as content

  • +
  • Fixed bug with sc.g-bus dragging

    Sometimes it crashes tool

  • +
  • Fixed bug with sc.g-pair dragging into contour

    Now if you drag two sc.g-nodes with sc.g-pair into sc.g-contour, then sc.g-pair also will be added into sc.g-contour

  • +
  • Added object cloning

    Now you can clone selected objects by Shift + mouse dragging

  • +
  • Added possibility to navigate in sc.g-document with keyboard
  • +
  • Added new command to select sc.g-elements

    For now there are two commands: select input/output sc.g-pairs, select subgraph

  • +
  • Added possibilit ot move text identifiers
  • +
  • Added automatical type changing for sc.g-element depending on their text identifiers
  • +
  • Refactored undo/redo commands

    They moved into specified directory

  • +
  • Refactored scg modes

    They moved into separate directory, and class names was changed

  • +
  • Added support of 0.1.0 version of SCg-code
  • +
  • Fixed bug with bus arrange
  • +
  • Improved type changing menu

    Now it supports common types of objects

  • +
  • Fixed bugs with copying
  • +
  • Changed rules of sc.g-contour drawing

    Now it draws with rounded corners

  • +
  • Changed rules of sc.g-border drawing

    Now it draws with mark in left top corner

  • +
  • Fixed bugs with exporting into image
  • +
  • Fixed bug with context menu calling

    Disabled calling of context menu with keyboard

  • +
  • Arrangers and slection tools grouped on toolbar
  • +
  • Fixed bug with content change dialog size under linux
  • + +

    M4Scp editor

    +
  • Added syntax highlighting
  • +
  • Added line numbers into editor
  • +
  • Added autocompletion of scp operators
  • +
  • Added icons into autocompletion list
  • + +

    SCs editor

    +
  • Added syntax highlighting
  • +
  • Added line numbers into editor
  • +
  • Added autocompletion of includes, identifiers

    It also parse included files and add identifiers from them


v0.2.1(Opener)

    -

    Common changes

    -
  • Added new incos for commands
  • -
  • Fixed installer

    Now it works with windows 7

  • -

    SCg-editor changes

    -
  • Added new arranger for tuples

    It allow to arrange any node, that have bus with output or input pairs

  • -
  • Added creation of nodes with content, by draging files into sc.g-window

    Now you can just drag fiel into window to create node with content of this file

  • -
  • Improved work with contours

    Any object, that draged into contour will be added into it. Any object that dragged from contour will be removed from it

  • -
  • Improved image selection

    Now all supported formats showed, when you select image content with dialog

  • -
  • Improved number content changing

    Added maximum and minimum ranges. Invalid values hightlight added.

  • -
  • Fixed bug in line creation mode with last point deletion by right mouse button

    Context menu opened each time, when user try to remove last point

  • -
  • Fixed bug with arrangers

    When apply arranger (grid) not all pairs calculates normaly, when they starts (finished) from any line object like bus or other pair

  • +

    Common changes

    +
  • Added new incos for commands
  • +
  • Fixed installer

    Now it works with windows 7

  • +

    SCg-editor changes

    +
  • Added new arranger for tuples

    It allow to arrange any node, that have bus with output or input pairs

  • +
  • Added creation of nodes with content, by draging files into sc.g-window

    Now you can just drag fiel into window to create node with content of this file

  • +
  • Improved work with contours

    Any object, that draged into contour will be added into it. Any object that dragged from contour will be removed from it

  • +
  • Improved image selection

    Now all supported formats showed, when you select image content with dialog

  • +
  • Improved number content changing

    Added maximum and minimum ranges. Invalid values hightlight added.

  • +
  • Fixed bug in line creation mode with last point deletion by right mouse button

    Context menu opened each time, when user try to remove last point

  • +
  • Fixed bug with arrangers

    When apply arranger (grid) not all pairs calculates normaly, when they starts (finished) from any line object like bus or other pair


v0.2.0(Opener)

    -

    Common changes

    -
  • Application logo was changed
  • -
  • Now main menu reconstructing with available operations, depending on active window
  • -
  • Fixed bug with drag and drop on linux
  • -
  • Fixed bug with image export

    It wasn't possible to export into image before document saving

  • -

    SCg-editor changes

    -
  • Fixed bug with bus deletion

    It wasn't possible to create bus from node, after another bus (from that node) deletion

  • -
  • Fixed bug with node deletion

    Bus associated to node wans't delete

  • -
  • Fixed bug with just contour deletion command display in history
  • -
  • Fixed bugs with russian translation
  • -
  • Fixed bug with content dialog size
  • +

    Common changes

    +
  • Application logo was changed
  • +
  • Now main menu reconstructing with available operations, depending on active window
  • +
  • Fixed bug with drag and drop on linux
  • +
  • Fixed bug with image export

    It wasn't possible to export into image before document saving

  • +

    SCg-editor changes

    +
  • Fixed bug with bus deletion

    It wasn't possible to create bus from node, after another bus (from that node) deletion

  • +
  • Fixed bug with node deletion

    Bus associated to node wans't delete

  • +
  • Fixed bug with just contour deletion command display in history
  • +
  • Fixed bugs with russian translation
  • +
  • Fixed bug with content dialog size
@@ -102,137 +130,137 @@

v0.2.0 rc1 (Opener)

    -

    Common changes

    -
  • Added support of file opening that passed as arguments
  • -
  • Added command to save all documents
  • -
  • Added command to close all (other, current) tabs
  • -
  • Fixed error with icons drawing
  • -
  • Icons for tabs were added
  • -
  • Errors with tabs naming were fixed
  • -
  • Memory leaks and high cpu usage problems were fixed
  • -
  • List of recently opened documents was added
  • - -

    SCg-editor changes

    -
  • Added commands to work with linear object points
  • -
  • Added commands to work with arc incident points
  • -
  • Copy, cut, paste commands added
  • -
  • Added control of undo/redo stack
  • -
  • Added minimap
  • - -
  • Added filters of supported formats for content type
  • -
  • Now it possible to grab scene with middle mouse button
  • -
  • Possibility to move objects with Ctrl+Arrow keys added
  • -
  • Possibility to align linear objects during creation (Shift button)
  • -
  • Possibility to find object by identifiers added (Ctrl+F)
  • - -
  • Problems with undo/redo commands were fixed
  • -
  • Problems with binary pairs saving were fixed
  • -
  • Error with contour and bus identifiers loading was fixed
  • -
  • Problem with "predmet" nodes drawing was fixed
  • -
  • Error with contour was fixed

    Some of arcs wasn't work correctly in contours

  • -
  • Problems with gwf file opening were fixed
  • -
  • Errors in objects arrange were fixed
  • - -
  • Change object type menu re-structured

    Now type changing menu have hierarhy structure. That structure depends on possible types

  • -
  • Arc width changed, to make it easier to pick it with mouse
  • - +

    Common changes

    +
  • Added support of file opening that passed as arguments
  • +
  • Added command to save all documents
  • +
  • Added command to close all (other, current) tabs
  • +
  • Fixed error with icons drawing
  • +
  • Icons for tabs were added
  • +
  • Errors with tabs naming were fixed
  • +
  • Memory leaks and high cpu usage problems were fixed
  • +
  • List of recently opened documents was added
  • + +

    SCg-editor changes

    +
  • Added commands to work with linear object points
  • +
  • Added commands to work with arc incident points
  • +
  • Copy, cut, paste commands added
  • +
  • Added control of undo/redo stack
  • +
  • Added minimap
  • + +
  • Added filters of supported formats for content type
  • +
  • Now it possible to grab scene with middle mouse button
  • +
  • Possibility to move objects with Ctrl+Arrow keys added
  • +
  • Possibility to align linear objects during creation (Shift button)
  • +
  • Possibility to find object by identifiers added (Ctrl+F)
  • + +
  • Problems with undo/redo commands were fixed
  • +
  • Problems with binary pairs saving were fixed
  • +
  • Error with contour and bus identifiers loading was fixed
  • +
  • Problem with "predmet" nodes drawing was fixed
  • +
  • Error with contour was fixed

    Some of arcs wasn't work correctly in contours

  • +
  • Problems with gwf file opening were fixed
  • +
  • Errors in objects arrange were fixed
  • + +
  • Change object type menu re-structured

    Now type changing menu have hierarhy structure. That structure depends on possible types

  • +
  • Arc width changed, to make it easier to pick it with mouse
  • +

v0.1.3 (Trailblazer)

    -

    Common changes

    - -

    SCg-editor changes

    -
  • Added select all function
  • -
  • Added hotkeys for align buttons
  • -
  • Added temporary pairs drawing
  • -
  • Added zoom
  • -
  • Fixed support for old GWF files
  • -
  • Fixed error with content setting

    Content set every time, even on cancel button press

  • -
  • Fixed ask to save

    System asked to save file on window close, even it not changed since last save

  • -
  • Fixed error two and more bus for node

    Not it is impossible to add more that one bus for node

  • -
  • Ctrl key remove from hotkeys sequences on SCg-toolbar
  • +

    Common changes

    + +

    SCg-editor changes

    +
  • Added select all function
  • +
  • Added hotkeys for align buttons
  • +
  • Added temporary pairs drawing
  • +
  • Added zoom
  • +
  • Fixed support for old GWF files
  • +
  • Fixed error with content setting

    Content set every time, even on cancel button press

  • +
  • Fixed ask to save

    System asked to save file on window close, even it not changed since last save

  • +
  • Fixed error two and more bus for node

    Not it is impossible to add more that one bus for node

  • +
  • Ctrl key remove from hotkeys sequences on SCg-toolbar

v0.1.2 (Trailblazer)

    -

    Common changes

    -
  • Path to media files changed to absolute

    Now tool makes absolute path to media files based on relative paths on startup

  • -
  • Added check for document save on closing
  • -
  • Fixed error with toolbar names
  • -
  • Fixed error with menu items enabling/disabling
  • -
  • Fixed error with tab names

    For now name for tabs set correctly

  • - -

    SCg-editor changes

    -
  • Group type changing removed
  • -
  • Added possibility to work with contour element (remove, change type and etc.)
  • -
  • Added work with contour child elements
  • -
  • Fixed undo operation for contour creation
  • -
  • Added unbounded size for canvas
  • -
  • Added possibility for bus, pair and contours creation inside contours
  • -
  • Added vertical, horizontal and grid alignment
  • -
  • Fixed error with contour identificators

    Tool crashed when moved contour with identifier

  • -
  • Fixed errors with GWF files opening
  • -
  • Added hotkeys
  • -
  • Add work with z-ccordinates

    For now selected object have fewer z-coordinate and draw above others

  • -
  • Add drawing of subject nodes
  • -
  • Add possibility to set identifier for bus
  • -
  • Add operation to remove contour without removing child elements
  • -
  • Fixed error with image content drawing
  • -
  • Add possibility to set empty content to node
  • -
  • Added redo/undo operation for content showing
  • -
  • Added redo/undo operation for content set
  • - +

    Common changes

    +
  • Path to media files changed to absolute

    Now tool makes absolute path to media files based on relative paths on startup

  • +
  • Added check for document save on closing
  • +
  • Fixed error with toolbar names
  • +
  • Fixed error with menu items enabling/disabling
  • +
  • Fixed error with tab names

    For now name for tabs set correctly

  • + +

    SCg-editor changes

    +
  • Group type changing removed
  • +
  • Added possibility to work with contour element (remove, change type and etc.)
  • +
  • Added work with contour child elements
  • +
  • Fixed undo operation for contour creation
  • +
  • Added unbounded size for canvas
  • +
  • Added possibility for bus, pair and contours creation inside contours
  • +
  • Added vertical, horizontal and grid alignment
  • +
  • Fixed error with contour identificators

    Tool crashed when moved contour with identifier

  • +
  • Fixed errors with GWF files opening
  • +
  • Added hotkeys
  • +
  • Add work with z-ccordinates

    For now selected object have fewer z-coordinate and draw above others

  • +
  • Add drawing of subject nodes
  • +
  • Add possibility to set identifier for bus
  • +
  • Add operation to remove contour without removing child elements
  • +
  • Fixed error with image content drawing
  • +
  • Add possibility to set empty content to node
  • +
  • Added redo/undo operation for content showing
  • +
  • Added redo/undo operation for content set
  • +

v0.1.1 (Trailblazer)

    -

    Common changes

    -
  • Some code refactored to Qt code style
  • -
  • Save/load subsystem rewrited
  • -

    SCg-editor changes

    -
  • Group selections added
  • -
  • Group type changing

    It is possible to change type for more than one selected element

  • -
  • Contents:
  • -
      -
    • Added content showing and changing
    • -
    • Added content loading
    • -
    • Added support of image content
    • -
    • Added numerical content
    • -
    • Added automatical wrap for strings
    • -
    • Fixed drawing of content boundings

      Content boundings was wrong after content adding

    • -
    -
  • Fixed identifiers for SCgPairs
  • -
  • Background drawing in image exporting.

    Background doesn't draw into exported image.

  • -
  • Undo/Redo commands:
  • -
      -
    • Added object deletion command
    • -
    • Added identifier changing command
    • -
    • Added type changing command
    • -
    - +

    Common changes

    +
  • Some code refactored to Qt code style
  • +
  • Save/load subsystem rewrited
  • +

    SCg-editor changes

    +
  • Group selections added
  • +
  • Group type changing

    It is possible to change type for more than one selected element

  • +
  • Contents:
  • +
      +
    • Added content showing and changing
    • +
    • Added content loading
    • +
    • Added support of image content
    • +
    • Added numerical content
    • +
    • Added automatical wrap for strings
    • +
    • Fixed drawing of content boundings

      Content boundings was wrong after content adding

    • +
    +
  • Fixed identifiers for SCgPairs
  • +
  • Background drawing in image exporting.

    Background doesn't draw into exported image.

  • +
  • Undo/Redo commands:
  • +
      +
    • Added object deletion command
    • +
    • Added identifier changing command
    • +
    • Added type changing command
    • +
    +

v0.1.0 rc1 (Trailblazer)

    -

    Common changes

    -
  • Base interface for an multidocument application
  • -
  • Mechanism for Undo/Redo
  • -
  • Export to image
  • -

    SCg-editor changes

    -
  • Base SCg-alphabet support: SCg-node, SCg-pair, SCg-bus, SCg-contour
  • -
  • GWF format support
  • -
  • Base interfaces and mechanisms for contents
  • -
  • Object identifiers
  • -
  • Object deletion
  • -
  • String content support
  • -
  • Undo/Redo commands:
  • -
      -
    • Object creation
    • -
    +

    Common changes

    +
  • Base interface for an multidocument application
  • +
  • Mechanism for Undo/Redo
  • +
  • Export to image
  • +

    SCg-editor changes

    +
  • Base SCg-alphabet support: SCg-node, SCg-pair, SCg-bus, SCg-contour
  • +
  • GWF format support
  • +
  • Base interfaces and mechanisms for contents
  • +
  • Object identifiers
  • +
  • Object deletion
  • +
  • String content support
  • +
  • Undo/Redo commands:
  • +
      +
    • Object creation
    • +

diff --git a/sources/kbe/kbe.pro b/sources/kbe/kbe.pro index fc39df0..d48a980 100644 --- a/sources/kbe/kbe.pro +++ b/sources/kbe/kbe.pro @@ -4,12 +4,7 @@ DESTDIR = ../bin -CONFIG(debug, debug|release) { - TARGET = kbe_d - DEFINES += _DEBUG -} else { - TARGET = kbe -} +TARGET = kbe TEMPLATE = app diff --git a/sources/kbe/ui_mainwindow.h b/sources/kbe/ui_mainwindow.h index 2d96af9..12d5b29 100644 --- a/sources/kbe/ui_mainwindow.h +++ b/sources/kbe/ui_mainwindow.h @@ -1,8 +1,8 @@ /******************************************************************************** ** Form generated from reading UI file 'mainwindow.ui' ** -** Created: Sat Sep 14 13:49:29 2013 -** by: Qt User Interface Compiler version 4.8.4 +** Created: Thu Dec 19 22:34:30 2013 +** by: Qt User Interface Compiler version 4.8.1 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ diff --git a/tools/DEBIAN/changelog b/tools/DEBIAN/changelog index 7447965..76b2c84 100644 --- a/tools/DEBIAN/changelog +++ b/tools/DEBIAN/changelog @@ -1,3 +1,24 @@ +kbe (0.3.1-ubuntu) unstable; urgency=low + + * Added hotkeys to switch tabs + * Added cancel button to save file dialog on exit + * Improved new file dialog + * Fixed plugin loading on linux + * Fixed dock widget positions save/load + * Fixed main window title + + * scg. Added load/save of content state + * scg. Added command to show/hide all contents + * scg. Added node type changing depending on text identifier + * scg. Added element type copying + * scg. Fixed text identifier positions + * scg. Fixed problem to load gwf files with 'content_visibility' attribute + * scg. Fixed visual style of scg-elements + * scg. Fixed default encoding to utf-8 + + * scg. Added support of scs 0.2.0 standard + * scg. Fixed default encoding to utf-8 + kbe (0.3.0-ubuntu) precise; urgency=low * Added plugins support * Refactored user guide documentation diff --git a/tools/DEBIAN/control b/tools/DEBIAN/control index 55009e8..7bf5328 100644 --- a/tools/DEBIAN/control +++ b/tools/DEBIAN/control @@ -2,8 +2,8 @@ Package: kbe Version: 0.3.0 Section: science Priority: optional -Architecture: i386 -Installed-Size: 1876 +Architecture: amd64 +Installed-Size: 21812 Depends: libc6 (>= 2.3), libgcc1 (>= 1:4.1.1), libqt4-svg (>= 4:4.5.3), libqt4-xml (>= 4:4.5.3), libqt4-xmlpatterns (>= 4:4.5.3), libqtcore4 (>= 4:4.7.0~beta1), libqtgui4 (>= 4:4.7.0~beta1) Maintainer: Nikita Grishko Homepage: https://github.com/deniskoronchik/kbe diff --git a/tools/launchpad/control b/tools/launchpad/control index b0ea0c9..fede038 100644 --- a/tools/launchpad/control +++ b/tools/launchpad/control @@ -1,7 +1,7 @@ Source: kbe Section: science Priority: optional -Maintainer: Nikita Grishko +Maintainer: Denis Koronchik , Nikita Grishko Homepage: https://github.com/deniskoronchik/kbe Build-Depends: debhelper (>= 8.0.0), cdbs, libqt4-dev, qt4-qmake, libantlr3c-dev diff --git a/tools/make-launchpad.sh b/tools/make-launchpad.sh index 4c6fa0a..468bcd7 100755 --- a/tools/make-launchpad.sh +++ b/tools/make-launchpad.sh @@ -1,6 +1,6 @@ #!/bin/bash -VERSION=0.3.0 +VERSION=0.3.1 ARCHITECTURE=i386 PROJECT_ROOT=.. PROJECT_SOURCES_ROOT=sources From 1e06ad92a54f54a546b2df69119d49082147d0dd Mon Sep 17 00:00:00 2001 From: Denis Koronchik Date: Tue, 6 May 2014 01:06:47 +0300 Subject: [PATCH 25/71] fix changelog --- tools/DEBIAN/changelog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/DEBIAN/changelog b/tools/DEBIAN/changelog index 76b2c84..5ddc0a8 100644 --- a/tools/DEBIAN/changelog +++ b/tools/DEBIAN/changelog @@ -19,6 +19,8 @@ kbe (0.3.1-ubuntu) unstable; urgency=low * scg. Added support of scs 0.2.0 standard * scg. Fixed default encoding to utf-8 + -- Denis Koronchik Tue, 5 May 2014 1:06:43 +0300 + kbe (0.3.0-ubuntu) precise; urgency=low * Added plugins support * Refactored user guide documentation From 436f0aeb62eef5d9afe593a4ec02d5bc4c7a02d0 Mon Sep 17 00:00:00 2001 From: Denis Koronchik Date: Tue, 6 May 2014 11:56:59 +0300 Subject: [PATCH 26/71] Fix time in changelog --- tools/DEBIAN/changelog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/DEBIAN/changelog b/tools/DEBIAN/changelog index 5ddc0a8..b87bd16 100644 --- a/tools/DEBIAN/changelog +++ b/tools/DEBIAN/changelog @@ -19,7 +19,7 @@ kbe (0.3.1-ubuntu) unstable; urgency=low * scg. Added support of scs 0.2.0 standard * scg. Fixed default encoding to utf-8 - -- Denis Koronchik Tue, 5 May 2014 1:06:43 +0300 + -- Denis Koronchik Tue, 5 May 2014 01:06:43 +0300 kbe (0.3.0-ubuntu) precise; urgency=low * Added plugins support From 5b8f561e9bfa0608a8b87c4f9864a302e12edcfd Mon Sep 17 00:00:00 2001 From: Denis Koronchik Date: Tue, 6 May 2014 12:31:51 +0300 Subject: [PATCH 27/71] Change version in code --- sources/kbe/version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/kbe/version.h b/sources/kbe/version.h index 485d0d3..dfc6ce3 100644 --- a/sources/kbe/version.h +++ b/sources/kbe/version.h @@ -70,7 +70,7 @@ class Version #define MAJOR 0 #define MINOR 3 -#define PATCH 0 +#define PATCH 1 #define REVISION 0 #define RC "" #define CODENAME "integrator" From 3609108580fb072cf8444196851a1c310b1ce1b5 Mon Sep 17 00:00:00 2001 From: mikluke Date: Tue, 13 May 2014 16:07:08 +0300 Subject: [PATCH 28/71] #8 Project Manager added --- sources/kbe/kbe.pro | 13 +- sources/kbe/kbe.qrc | 9 + sources/kbe/mainwindow.cpp | 117 ++- sources/kbe/mainwindow.h | 6 +- sources/kbe/mainwindow.ui | 30 + sources/kbe/media/icons/pm-add.png | Bin 0 -> 549 bytes sources/kbe/media/icons/pm-branch-closed.png | Bin 0 -> 212 bytes sources/kbe/media/icons/pm-branch-end.png | Bin 0 -> 193 bytes sources/kbe/media/icons/pm-branch-more.png | Bin 0 -> 114 bytes sources/kbe/media/icons/pm-branch-open.png | Bin 0 -> 222 bytes sources/kbe/media/icons/pm-collapse.png | Bin 0 -> 453 bytes sources/kbe/media/icons/pm-expand.png | Bin 0 -> 601 bytes sources/kbe/media/icons/pm-vline.png | Bin 0 -> 175 bytes .../kbe/media/stylesheets/projectmanager.qss | 23 + sources/kbe/projectmanager.cpp | 724 ++++++++++++++++++ sources/kbe/projectmanager.h | 105 +++ sources/kbe/projectmanagermodel.cpp | 624 +++++++++++++++ sources/kbe/projectmanagermodel.h | 203 +++++ sources/kbe/ui_mainwindow.h | 27 +- 19 files changed, 1856 insertions(+), 25 deletions(-) create mode 100644 sources/kbe/media/icons/pm-add.png create mode 100644 sources/kbe/media/icons/pm-branch-closed.png create mode 100644 sources/kbe/media/icons/pm-branch-end.png create mode 100644 sources/kbe/media/icons/pm-branch-more.png create mode 100644 sources/kbe/media/icons/pm-branch-open.png create mode 100644 sources/kbe/media/icons/pm-collapse.png create mode 100644 sources/kbe/media/icons/pm-expand.png create mode 100644 sources/kbe/media/icons/pm-vline.png create mode 100644 sources/kbe/media/stylesheets/projectmanager.qss create mode 100644 sources/kbe/projectmanager.cpp create mode 100644 sources/kbe/projectmanager.h create mode 100644 sources/kbe/projectmanagermodel.cpp create mode 100644 sources/kbe/projectmanagermodel.h diff --git a/sources/kbe/kbe.pro b/sources/kbe/kbe.pro index d48a980..12b1b70 100644 --- a/sources/kbe/kbe.pro +++ b/sources/kbe/kbe.pro @@ -4,7 +4,7 @@ DESTDIR = ../bin -TARGET = kbe +QT += xml TEMPLATE = app @@ -15,7 +15,9 @@ SOURCES += \ config.cpp \ pluginmanager.cpp \ guidedialog.cpp \ - newfiledialog.cpp + newfiledialog.cpp \ + projectmanager.cpp \ + projectmanagermodel.cpp HEADERS += version.h \ platform.h \ @@ -26,7 +28,9 @@ HEADERS += version.h \ pluginmanager.h \ interfaces/editorinterface.h \ guidedialog.h \ - newfiledialog.h + newfiledialog.h \ + projectmanager.h \ + projectmanagermodel.h FORMS += mainwindow.ui @@ -46,3 +50,6 @@ RC_FILE = kbe.rc OBJECTS_DIR = obj MOC_DIR = moc + +OTHER_FILES += \ + media/stylesheets/projectmanager.qss diff --git a/sources/kbe/kbe.qrc b/sources/kbe/kbe.qrc index 5534bdf..45fdb46 100644 --- a/sources/kbe/kbe.qrc +++ b/sources/kbe/kbe.qrc @@ -16,5 +16,14 @@ media/startup/images/bottom-shadow.gif media/translations/lang_en_EN.qm media/translations/lang_ru_RU.qm + media/icons/pm-branch-closed.png + media/icons/pm-branch-end.png + media/icons/pm-branch-more.png + media/icons/pm-branch-open.png + media/icons/pm-vline.png + media/stylesheets/projectmanager.qss + media/icons/pm-collapse.png + media/icons/pm-expand.png + media/icons/pm-add.png diff --git a/sources/kbe/mainwindow.cpp b/sources/kbe/mainwindow.cpp index 4b227c3..faa06e8 100644 --- a/sources/kbe/mainwindow.cpp +++ b/sources/kbe/mainwindow.cpp @@ -77,6 +77,19 @@ MainWindow::MainWindow(QWidget *parent) : connect(mTabWidget, SIGNAL(tabsUpdate()), this, SLOT(updateMenu())); connect(mTabWidget, SIGNAL(currentChanged(int)), this, SLOT(updateMenu())); + /*creating project manager widget */ + ProjectManagerDockWidget::instance() -> setWindowTitle(tr("Project Manager")); + ProjectManagerDockWidget::instance()->setObjectName("Project Name"); + addDockWidget(Qt::LeftDockWidgetArea,ProjectManagerDockWidget::instance()); + + if (ProjectManagerView* prView = ProjectManagerDockWidget::instance()->getTreeView()) + { + connect(prView, SIGNAL(openFile(QString)), this, SLOT(fileOpen(QString))); + connect(prView, SIGNAL(event(ProjectManagerView::ProjectManagerEvent)), + this, SLOT(acceptProjectManagerEvent(ProjectManagerView::ProjectManagerEvent))); + } + + setCentralWidget(mTabWidget); connect(mTabWidget, SIGNAL(currentChanged(int)), @@ -150,10 +163,12 @@ void MainWindow::createToolBars() void MainWindow::createActions() { ui->actionNew->setIcon(QIcon::fromTheme("document-new", getIcon("document-new.png"))); + ui->actionNew_Project->setIcon(QIcon::fromTheme("document-new", getIcon("document-new.png"))); ui->actionOpen->setIcon(QIcon::fromTheme("document-open", getIcon("document-open.png"))); + ui->actionOpen_Project->setIcon(QIcon::fromTheme("document-open", getIcon("document-open.png"))); ui->actionSave->setIcon(QIcon::fromTheme("document-save", getIcon("document-save.png"))); ui->actionSave_as->setIcon(QIcon::fromTheme("document-save-as", getIcon("document-save-as.png"))); - + ui->actionSave_Project->setIcon(QIcon::fromTheme("document-save", getIcon("document-save-as.png"))); ui->actionClose->setIcon(QIcon::fromTheme("window-close", getIcon("window-close.png"))); ui->actionExit->setIcon(QIcon::fromTheme("application-exit", getIcon("application-exit.png"))); @@ -174,6 +189,16 @@ void MainWindow::createActions() connect(ui->actionClose_Others, SIGNAL(triggered()), this, SLOT(updateMenu())); connect(ui->actionExit, SIGNAL(triggered()), this, SLOT(fileExit())); + if (ProjectManagerView* pmTreeView = ProjectManagerDockWidget::instance()->getTreeView()) + { + connect(ui->actionNew_Project, SIGNAL(triggered()), pmTreeView, SLOT(onProjectNew())); + connect(ui->actionOpen_Project, SIGNAL(triggered()), pmTreeView, SLOT(onProjectOpen())); + ui->actionSave_Project->setEnabled(false); + connect(ui->actionSave_Project, SIGNAL(triggered()), pmTreeView, SLOT(onProjectSave())); + ui->actionClose_Project->setEnabled(false); + connect(ui->actionClose_Project,SIGNAL(triggered()), pmTreeView, SLOT(onProjectClose())); + } + for (int i = 0; i < MaxRecentFiles; ++i) { recentFileActs[i] = new QAction(this); @@ -245,18 +270,20 @@ void MainWindow::updateMenu() void MainWindow::updateSpecificViewMenu() { - ui->menuView->menuAction()->setVisible(false);//setDisabled(true); +// ui->menuView->menuAction()->setVisible(false);//setDisabled(true); ui->menuView->clear(); + ui->menuView->addAction(ProjectManagerDockWidget::instance()->toggleViewAction()); if(mLastActiveWindow) { QList ws = mLastActiveWindow->widgetsForDocks(); if(!ws.empty()) { + foreach(QWidget* w, ws) ui->menuView->addAction(mDockWidgets[w->objectName()]->toggleViewAction()); - ui->menuView->menuAction()->setVisible(true); } } +// ui->menuView->menuAction()->setVisible(true); } void MainWindow::updateRecentFileActions() { @@ -338,7 +365,6 @@ EditorInterface* MainWindow::createSubWindowByExt(const QString& ext) childWindow = PluginManager::instance()->createWindowByExt(ext); else return 0; - mWidget2EditorInterface[childWindow->widget()] = childWindow; mTabWidget->addSubWindow(childWindow); childWindow->_setObserver(this); @@ -363,25 +389,40 @@ void MainWindow::fileNew() } } -void MainWindow::fileOpen() +void MainWindow::fileOpen(QString fileName) { - QFileDialog::Options options; - options |= QFileDialog::DontUseNativeDialog; - QString selectedFilter; - QFileDialog dlg; + if (fileName.isNull()) + { + QFileDialog::Options options; + options |= QFileDialog::DontUseNativeDialog; + QString selectedFilter; + QFileDialog dlg; + + mBlurEffect->setEnabled(true); + dlg.setDirectory(mLastDir); + fileName = dlg.getOpenFileName(this, + tr("Open file"), + "", + PluginManager::instance()->openFilters(), + &selectedFilter, + options); + if (!fileName.isEmpty()) + load(fileName); + mLastDir = QDir(fileName); + mBlurEffect->setEnabled(false); + return; + } - mBlurEffect->setEnabled(true); - dlg.setDirectory(mLastDir); - QString fileName = dlg.getOpenFileName(this, - tr("Open file"), - "", - PluginManager::instance()->openFilters(), - &selectedFilter, - options); - if (!fileName.isEmpty()) + if (!fileName.isEmpty() && QFile::exists(fileName)) + { load(fileName); - mLastDir = QDir(fileName); - mBlurEffect->setEnabled(false); + return; + } + + QFileInfo fileInfo(fileName); + EditorInterface* childWindow = createSubWindowByExt(fileInfo.suffix()); + saveWindow(childWindow, fileName, fileInfo.suffix()); + } void MainWindow::load(QString fileName) @@ -765,9 +806,45 @@ void MainWindow::closeEvent(QCloseEvent *event) } } + // close project + if (ProjectManagerView* pmView = ProjectManagerDockWidget::instance()->getTreeView()) + if (!pmView -> onProjectClose()) + { + event->ignore(); + return; + } + saveLayout(); } +void MainWindow::acceptProjectManagerEvent(ProjectManagerView::ProjectManagerEvent event) +{ + switch (event) + { + case ProjectManagerView::ProjectCreated: + case ProjectManagerView::ProjectOpened: + ui->actionNew_Project -> setEnabled(false); + ui->actionOpen_Project -> setEnabled(false); + ui->actionSave_Project -> setEnabled(false); + ui->actionClose_Project -> setEnabled(true); + break; + case ProjectManagerView::ProjectSaved: + ui->actionSave_Project -> setEnabled(false); + break; + case ProjectManagerView::ProjectClosed: + ui->actionNew_Project -> setEnabled(true); + ui->actionOpen_Project -> setEnabled(true); + ui->actionSave_Project -> setEnabled(false); + ui->actionClose_Project -> setEnabled(false); + break; + case ProjectManagerView::ProjectChanged: + ui->actionSave_Project -> setEnabled(true); + break; + case ProjectManagerView::DefaultEvent: + break; + } +} + void MainWindow::dragEnterEvent(QDragEnterEvent *event) { event->acceptProposedAction(); diff --git a/sources/kbe/mainwindow.h b/sources/kbe/mainwindow.h index 5a704a4..ab460be 100644 --- a/sources/kbe/mainwindow.h +++ b/sources/kbe/mainwindow.h @@ -27,6 +27,7 @@ along with OSTIS. If not, see . #include #include #include "extendedtabwidget.h" +#include "projectmanager.h" #include "interfaces/editorinterface.h" namespace Ui { @@ -180,7 +181,7 @@ public slots: void openRecentFile(); void fileNew(); - void fileOpen(); + void fileOpen(QString fileName=QString()); void fileSave(QWidget* window = 0); void fileSaveAs(QWidget* window = 0); void fileSaveAll(); @@ -210,6 +211,9 @@ public slots: void updateDockWidgets(bool hide); void closeEvent(QCloseEvent *event); + + //! Accepts Project Managers events. + void acceptProjectManagerEvent(ProjectManagerView::ProjectManagerEvent); }; #endif // MAINWINDOW_H diff --git a/sources/kbe/mainwindow.ui b/sources/kbe/mainwindow.ui index eeb8ec2..d642efb 100644 --- a/sources/kbe/mainwindow.ui +++ b/sources/kbe/mainwindow.ui @@ -37,9 +37,12 @@
+ + + @@ -47,6 +50,7 @@ + @@ -64,6 +68,7 @@ View + @@ -184,6 +189,31 @@ Guide + + + Project Manager + + + + + New Project + + + + + Open Project + + + + + Save Project + + + + + Close Project + + diff --git a/sources/kbe/media/icons/pm-add.png b/sources/kbe/media/icons/pm-add.png new file mode 100644 index 0000000000000000000000000000000000000000..8a9fbd271d309f3bfb0e85fd7b4bc6ba2783e7aa GIT binary patch literal 549 zcmeAS@N?(olHy`uVBq!ia0vp^0U*r51|<6gKdoh8V0`20;uunK>+M~Cze5fp$3Mm$ zcHZ%dsr31+-t4=lUikLZ>pApr=CR%pJ|Mi|nc6z-^`6p4jXp1H)-BnmU#YFuSU1D( z7U$oID${n=zg)_{-uAPFjjRo?|1`s`GMi;~OQ`JI%K80I*|eiKwkkAkc3$l))PR;n-t^EJ>LS|jdu<72G+_ASd zKK!Y0>UF2LrQ4qQ9osn7)>|?HU01T?$qhyp0S5*~76ZNm-(UK!%4E=f_34#`?Afyk zdknmzpC_jsW7rYM^!a1u^vtMZW`@H2Tmfm*#R85oaVRt}pc1kSSKd7j{aSG?-dAk< z%w?%>GH&f(_dBkdQ=__M*55sAZO!Ae4t%{)y8hLk{_}N7$qk>@{(AF#>)l&_kGL_` zUfZxOdUqR=i6>gW?7x31vwqe_{_RDdB5(F4T62S33U)4nFj!D=L2X0Dm2CE-hudVe zp$c-uFGyD3d|0G<`)R|h4;v)}O*`jR{+MC*Z=J`c-i4+WsRq)FJ&lY#LF;Ci-xB2Z z;K)tj$Tj44yz(%YcPUFDd*miorR+!dH7eFygeYVmx~Y)-+nR^>j`@Q5zZ7rnRbB#& Oeg;ohKbLh*2~7Z!Md|SX literal 0 HcmV?d00001 diff --git a/sources/kbe/media/icons/pm-branch-closed.png b/sources/kbe/media/icons/pm-branch-closed.png new file mode 100644 index 0000000000000000000000000000000000000000..1b4f23a4e907b1f11d509437bb0f559ce3d30b3e GIT binary patch literal 212 zcmV;_04x8AP)P0 z|Bs=;Y?awM-O0MTL~GEWrvG2PTK%8Va-#&IGyqKpds3rDn4hqdsz`8>*$T6DdeilEi1sv5!Afex-34hPh=C~rl#Bp+*mt#O)~x>k O0000Oo literal 0 HcmV?d00001 diff --git a/sources/kbe/media/icons/pm-branch-more.png b/sources/kbe/media/icons/pm-branch-more.png new file mode 100644 index 0000000000000000000000000000000000000000..e74bf87190cff178f3d4d57c5d6c290395de68fa GIT binary patch literal 114 zcmeAS@N?(olHy`uVBq!ia0vp^5F!$q5RqA{(m>r)=15 zc!8%U${>reR7WF~J53|SR9R|rj-z3^fV1Ih!;2LrliYPBwl**_$gR?t^R)TkSD+yb Mp00i_>zopr00sUZ#Q*>R literal 0 HcmV?d00001 diff --git a/sources/kbe/media/icons/pm-branch-open.png b/sources/kbe/media/icons/pm-branch-open.png new file mode 100644 index 0000000000000000000000000000000000000000..41052281354c85581e44ef650a95c6434309ee5e GIT binary patch literal 222 zcmV<403rX0P)cUqyC>V4Q4CM*6B^v z`>#7$7mPt{vsGs6aB9$-uBQWZ=RfsY_5Wa8t^N{`RLfP< Y0f}^Xwv*cM;Q#;t07*qoM6N<$f*pBYB>(^b literal 0 HcmV?d00001 diff --git a/sources/kbe/media/icons/pm-collapse.png b/sources/kbe/media/icons/pm-collapse.png new file mode 100644 index 0000000000000000000000000000000000000000..ce71fcdcf55706b86f5042f136b9ad592566aa2c GIT binary patch literal 453 zcmeAS@N?(olHy`uVBq!ia0vp^0U*r51|<6gKdoh8VC?a9aSW-r_4e+@iH8gXS`$Ny zT<0iPcj&7rsy%*JRmgnGhtYw3-2vO5Is(k;Y?-Z`OK!#+&-R`_UH0a|!!r(K?GC+K z_I2G|^KEypH?Ny@?#($n$r)F^a$N7Rdd=$b;Lrpon+x-<6uW#7Q<#@7SJBx~Zv635 z?U_AGW>&m)vYfXoyJrn|t9|V6t^Yjs^Na4f6Zu$gA2;i*RUa-1NM|RVlKS{hxlL+~ zoX;NL@GM6C?ZOO#gZk!;+fH3Nb(%hq~@1*^Xocc-Y`L|QoCG64}ITRWgnD7ysXP8fI*qE~0 zIKigIM|qLK#milf->>uBX64oNy!j?aLX5^fB>6nEzQD&- z>ho6h&lA5Qd_MF=fB0R)W9zwW7hBuxw`rN*K1Hv3ectqqT((9%Ko zM=t^jXp>19V4!5q~U-tg+_jiYNcD^;eksZjI zVgFSyUq7+GL$_fo!>zBszTN0EjFP%=Bm3eFX4jC1cU}p9jJ{F#$y@2xeB156j?7`6 z?$mQsxO76?0{K}HHh~RGe<%9f7ycc(E@VouOZc1ehfINHD?hj}J?kr4^`fgzYO?kz z&BfaP3d6FF$W%O<&#v~SU5$NS#etB&2Br6dzq(kNo!Yr*^{a_>E>nE{Y)l)97tb-? z^(s!Q)y=ZJBy``@&#pSH%Rg;h=5BAY^g{^Ku3w3r`bOHAhrfbLtDnm{r-UW|r@t}8 literal 0 HcmV?d00001 diff --git a/sources/kbe/media/stylesheets/projectmanager.qss b/sources/kbe/media/stylesheets/projectmanager.qss new file mode 100644 index 0000000..dd9b946 --- /dev/null +++ b/sources/kbe/media/stylesheets/projectmanager.qss @@ -0,0 +1,23 @@ + QTreeView::branch:has-siblings:!adjoins-item { + border-image: url(:/media/icons/pm-vline.png) 0; + } + + QTreeView::branch:has-siblings:adjoins-item { + border-image: url(:/media/icons/pm-branch-more.png) 0; + } + + QTreeView::branch:!has-children:!has-siblings:adjoins-item { + border-image: url(:/media/icons/pm-branch-end.png) 0; + } + + QTreeView::branch:has-children:!has-siblings:closed, + QTreeView::branch:closed:has-children:has-siblings { + border-image: none; + image: url(:/media/icons/pm-branch-closed.png); + } + + QTreeView::branch:open:has-children:!has-siblings, + QTreeView::branch:open:has-children:has-siblings { + border-image: none; + image: url(:/media/icons/pm-branch-open.png); + } diff --git a/sources/kbe/projectmanager.cpp b/sources/kbe/projectmanager.cpp new file mode 100644 index 0000000..852f29a --- /dev/null +++ b/sources/kbe/projectmanager.cpp @@ -0,0 +1,724 @@ +#include "projectmanager.h" + +#include "pluginmanager.h" +#include "newfiledialog.h" + +#include +#include + +#include +#include +#include + +#include +#include +#include + +#include + +ProjectManagerDockWidget* ProjectManagerDockWidget::mInstance = 0; + +ProjectManagerDockWidget::ProjectManagerDockWidget(QWidget *parent) : + QDockWidget(parent) +{ + treeView = new ProjectManagerView(this); + + this->setFeatures(QDockWidget::DockWidgetVerticalTitleBar); + + QFile file(":/media/stylesheets/projectmanager.qss"); + file.open(QFile::ReadOnly); + QString styleSheet = QLatin1String(file.readAll()); + treeView->setStyleSheet(styleSheet); + + setWidget(treeView); +} + +ProjectManagerDockWidget::~ProjectManagerDockWidget() +{ + Q_ASSERT(mInstance != 0); + mInstance = 0; +} + +ProjectManagerDockWidget* ProjectManagerDockWidget::instance() +{ + if (!mInstance) + mInstance = new ProjectManagerDockWidget(); + + return mInstance; +} + +ProjectManagerView::ProjectManagerView(QWidget *parent) : + QTreeView(parent) +{ + model = new ProjectManagerModel(this); + setModel(model); + + header() -> close(); + + setContextMenuPolicy(Qt::CustomContextMenu); + + setAcceptDrops(true); + setDragEnabled(true); + setDragDropMode(QAbstractItemView::InternalMove); + setDropIndicatorShown(true); + + this->connect(this,SIGNAL(customContextMenuRequested(QPoint)), + SLOT(onContextMenuRequested(QPoint))); + +} + +void ProjectManagerView::onContextMenuRequested(QPoint mousePoint) +{ + ProjectManagerModelItem* item = model -> getItem(currentIndex()); + createContextMenu(item); +} + +void ProjectManagerView::createContextMenu(ProjectManagerModelItem* item) +{ + QMenu *menu = new QMenu; + + if (item) + switch (item->getItemType()) + { + case ProjectManagerModelItem::Unknown: + break; + case ProjectManagerModelItem::Project: + { +#ifndef Q_OS_LINUX + menu -> addAction(QIcon(), tr("Show in explorer"), this, SLOT(onShowInExplorer())); + menu -> addSeparator(); +#endif + menu -> addAction(QIcon(":/media/icons/document-save.png"), tr("Save project"), this, SLOT(onProjectSave())); + menu -> addAction(QIcon(":/media/icons/window-close.png"), tr("Close Project"),this,SLOT(onProjectClose())); + + menu -> addSeparator(); + } + case ProjectManagerModelItem::Filter: + { + menu -> addAction(QIcon(":/media/icons/pm-add.png"), tr("Add File"),this,SLOT(onAddFile())); + menu -> addAction(QIcon(":/media/icons/pm-add.png"), tr("Add Existing Files"), this, SLOT(onAddExistingFiles())); + menu -> addAction(QIcon(":/media/icons/pm-add.png"), tr("Add Filter"), this, SLOT(onAddFilter())); + + menu -> addSeparator(); + + menu -> addAction(QIcon(), tr("Rename"), this, SLOT(onRename())); + QMenu* delMenu = menu -> addMenu(QIcon(), tr("Delete")); + delMenu -> addAction(QIcon(), tr("Delete From Project"),this,SLOT(onRemove())); + delMenu -> addAction(QIcon(), tr("Delete Permanently"),this,SLOT(onRemovePermanently())); + + menu -> addSeparator(); + + menu -> addAction(QIcon(":/media/icons/pm-expand.png"),tr("Expand All"),this,SLOT(expandAll())); + menu -> addAction(QIcon(":/media/icons/pm-collapse.png"),tr("Collapse All"),this,SLOT(collapseAll())); + break; + } + case ProjectManagerModelItem::File: + { + menu -> setDefaultAction(menu -> addAction(QIcon(), tr("Open file"),this,SLOT(onOpenFile()))); + +#ifdef Q_OS_WIN + menu -> addAction(QIcon(), tr("Show in explorer"), this, SLOT(onShowInExplorer())); +#endif + + menu -> addSeparator(); + + menu -> addAction(QIcon(), tr("Rename"), this, SLOT(onFileRename())); + QMenu* delMenu = menu -> addMenu(QIcon(), tr("Delete")); + delMenu -> addAction(QIcon(), tr("Delete From Project"),this,SLOT(onRemove())); + delMenu -> addAction(QIcon(), tr("Delete Permanently"),this,SLOT(onRemovePermanently())); + + menu -> addSeparator(); + menu -> addAction(QIcon(), tr("Properties"), this, SLOT(onPropertiesShow())); + } + } + else + { + menu -> addAction(QIcon(":/media/icons/pm-expand.png"),tr("Expand All"),this,SLOT(expandAll())); + menu -> addAction(QIcon(":/media/icons/pm-collapse.png"),tr("Collapse All"),this,SLOT(collapseAll())); + + menu -> addSeparator(); + + menu -> addAction(QIcon(":/media/icons/window-close.png"),tr("Close Project"),this,SLOT(onProjectClose())); + } + menu->exec(QCursor::pos()); +} + + +void ProjectManagerView::mouseDoubleClickEvent(QMouseEvent *event) +{ + ProjectManagerModelItem* item = model->getItem(indexAt(event->pos())); + QTreeView::mouseDoubleClickEvent(event); + + if (item && item->getItemType() == ProjectManagerModelItem::File) + { + if (!QFile::exists(item->getAbsoluteFilePath())) + { + QString filter = item -> getAbsoluteFilePath().split(SEPARATOR).last(); + filter.append(" ("+filter+");;"); + filter.append(tr("Any file") + " (*." + item->getAbsoluteFilePath().split(".").last() + ")"); + QString existingFileForReplace = QFileDialog::getOpenFileName(this, tr("File not found"), item->getAbsoluteFileDir(), + filter,0,QFileDialog::DontUseNativeDialog); + if (existingFileForReplace.isNull()) + return; + else + { + QString newFilePath; + newFilePath = QDir(item->getProjectItem()->getAbsoluteSourcesDir()).relativeFilePath(existingFileForReplace); + int reply = QMessageBox::question(this, tr("Replace file path"), tr("Replace file path to \"")+newFilePath+ + tr("\" instead \"") + item->getFilePath() + "\"", QMessageBox::Yes|QMessageBox::No); + if (reply == QMessageBox::Yes) + { + if (item -> getName() != QFileInfo(existingFileForReplace).fileName()) + { + item->setObjectName(item->parent()->objectName() + SEPARATOR + QFileInfo(existingFileForReplace).fileName()); + item->setName(QFileInfo(existingFileForReplace).fileName()); + } + item->setFilePath(newFilePath); + } + else + { + emit openFile(newFilePath); + return; + } + } + } + emit openFile(item->getAbsoluteFilePath()); + } + +} + +void ProjectManagerView::updateTreeView() +{ + QModelIndexList list; + + Q_FOREACH (QModelIndex index, model->getPersistentIndexList()) + if (isExpanded(index)) + list << index; + + reset(); + + Q_FOREACH (QModelIndex index, list) + if (index.isValid()) + expand(index); +} + + +void ProjectManagerView::mousePressEvent(QMouseEvent* event) +{ + QModelIndex item = indexAt(event->pos()); + QTreeView::mousePressEvent(event); + if ((item.row() == -1 && item.column() == -1)) + { + clearSelection(); + const QModelIndex index; + selectionModel()->setCurrentIndex(index, QItemSelectionModel::Select); + } +} + + +void ProjectManagerView::onProjectNew() +{ + QString fileName = QFileDialog::getSaveFileName(this, tr("Add new project"), + QDir::current().absolutePath(), + tr("Folder"), + 0, QFileDialog::DontUseNativeDialog); + if (fileName.isEmpty()) + return; + + QFileInfo projectFileInfo(fileName); + + QString name = projectFileInfo.fileName(); + QString absPath = projectFileInfo.absoluteFilePath(); + QDir parentDir = projectFileInfo.absoluteDir(); + + if (model->getRootItem()->findChild(name)) + { + QMessageBox::warning(this,tr("Adding project error"),name+" "+tr("already exists")); + return onProjectNew(); + } + + //creating project's directory + if (parentDir.mkdir(name)) + { + parentDir = QDir(absPath); + parentDir.mkdir("sources"); + + ProjectManagerModelItem* project = new ProjectManagerModelItem(name,QFileInfo(absPath,name+".kbpro").absoluteFilePath(), + ProjectManagerModelItem::Project, + model->getRootItem()); + model->insertProject(project); + model->saveProject(project, QFileInfo(absPath,name+".kbpro").absoluteFilePath()); + emit event(ProjectCreated); + } + else + QMessageBox::critical(this, tr("Creating project error"), + tr("Can not create directory for project")); + +} + + +void ProjectManagerView::onProjectSave() +{ + if (ProjectManagerModelItem* rootItem = model->getRootItem()) + for (int i=0; i< rootItem->childCount(); i++) + { + QString fileName = rootItem->child(0)->getAbsoluteFilePath(); + + if (rootItem->child(i)->getFilePath().isEmpty() || !QFile::exists(fileName)) + { + fileName = QFileDialog::getSaveFileName(this, tr("Project file not found"), + QDir::current().absolutePath(),rootItem->child(i)->getName()+"(*.kbpro)", + 0,QFileDialog::DontUseNativeDialog); + if (fileName.isEmpty()) + continue; + + rootItem->child(i)->setFilePath(fileName); + } + model->saveProject(rootItem->child(i),fileName); + emit event(ProjectSaved); + } +} + + + +bool ProjectManagerView::onProjectClose() +{ + if (ProjectManagerModelItem* rootItem = model->getRootItem()) + while (rootItem->childCount()) + { + ProjectManagerModelItem* item = rootItem->child(0); + if (item && item->isModified()) + { + int ret = QMessageBox::warning(this, tr("Save project?"), + tr("Project") + " " + item->getName() + " " + tr("is modified but not saved. Do you want save project?"), + QMessageBox::Yes|QMessageBox::No|QMessageBox::Cancel); + switch (ret) + { + case QMessageBox::Cancel: + return false; + case QMessageBox::Yes: + { + QString fileName = item->getAbsoluteFilePath(); + + if (item->getFilePath().isEmpty() || !QFile::exists(fileName)) + { + fileName = QFileDialog::getSaveFileName(this, tr("Project file not found"), + QDir::current().absolutePath(),item->getName()+("(*.kbpro)"), + 0,QFileDialog::DontUseNativeDialog); + if (fileName.isEmpty()) + return false; + + item->setFilePath(fileName); + } + + model->saveProject(item,item->getAbsoluteFilePath()); + } + case QMessageBox::No: + break; + } + } + model->removeItem(item); + } + emit event(ProjectClosed); + return true; +} + +void ProjectManagerView::onProjectOpen() +{ + QString fileName = QFileDialog::getOpenFileName(this, tr("Choose project file"), + QDir::current().absolutePath(),tr("KBE project file")+("(*.kbpro)"), + 0,QFileDialog::DontUseNativeDialog); + if (!fileName.isEmpty()) + { + model->loadProject(fileName); + emit event(ProjectOpened); + } +} + + +void ProjectManagerView::onRemove() +{ + if (!currentIndex().isValid()) + return; + ProjectManagerModelItem* item = model->getItem(currentIndex()); + + if (item && item->getItemType() != ProjectManagerModelItem::Project) + { + model->removeItem(item); + emit event(ProjectChanged); + } +} + + +void ProjectManagerView::onRemovePermanently() +{ + if (!currentIndex().isValid()) + return; + + if (ProjectManagerModelItem* item = model->getItem(currentIndex())) + switch (item->getItemType()) + { + case ProjectManagerModelItem::File: + if (QFile::remove(item->getAbsoluteFilePath())) + onRemove(); + break; + case ProjectManagerModelItem::Filter: + permanentRemoveTree(item); + emit event(ProjectChanged); + } +} + + +void ProjectManagerView::permanentRemoveTree(ProjectManagerModelItem *item) +{ + if (!item) + return; + + while (item->childCount()) + permanentRemoveTree(item->child(0)); + + switch (item->getItemType()) + { + case ProjectManagerModelItem::File: + QFile::remove(item->getAbsoluteFilePath()); + + case ProjectManagerModelItem::Filter: + model->removeItem(item); + } + +} + + +void ProjectManagerView::renameItem(ProjectManagerModelItem *item, QString newName) +{ + if (item && item->parent()) + { + QString objName = item -> objectName(); + QString itemName = item -> getName(); + objName.replace(objName.length()-itemName.length(),itemName.length(), newName); + item -> setName(newName); + } +} + + +QString ProjectManagerView::onRename() +{ + if (!currentIndex().isValid()) + return QString(); + ProjectManagerModelItem* item = model->getItem(currentIndex()); + QString itemName(item->getName()); + + bool isAccepted = true; + QString newName = QInputDialog::getText(this,tr("Rename"),tr("Please type new name for ")+itemName, + QLineEdit::Normal,itemName,&isAccepted,Qt::Dialog); + + if (isAccepted && !newName.isEmpty() && newName != itemName) + { + if (item->parent() && item->parent()->findChild(item->parent()->objectName()+"/"+newName)) + { + QMessageBox::warning(this,tr("Rename error"),item->parent()->getName()+ " " + tr("already has") + " " + newName); + return onRename(); + } + emit event(ProjectChanged); + if (item -> getItemType() <= ProjectManagerModelItem::Filter) + renameItem(item,newName); + return newName; + } + else + return itemName; +} + + +void ProjectManagerView::onFileRename() +{ + if (!currentIndex().isValid()) + return; + + ProjectManagerModelItem* item = model->getItem(currentIndex()); + + QString newName = onRename(); + + QFileInfo currentFileInfo(item->getAbsoluteFilePath()); + + if (!currentFileInfo.exists()) + { + QMessageBox::critical(this,tr("Rename critical error"),tr("File not found on storage: ") + currentFileInfo.absoluteFilePath()); + return; + } + + QFileInfo newFile(currentFileInfo.absoluteDir(),newName); + + if (newFile.exists()) + { + QMessageBox::warning(this,tr("Rename error"),newName + tr(" already exists in ") + currentFileInfo.absolutePath()); + onFileRename(); + return; + } + + if (!QFile::rename(currentFileInfo.absoluteFilePath(),newFile.absoluteFilePath())) + QMessageBox::critical(this,tr("Rename critical error"),tr("Unknown error")); + else + { + renameItem(item,newName); + emit event(ProjectChanged); + } +} + + +void ProjectManagerView::onAddFilter() +{ + if (!currentIndex().isValid()) + return; + + ProjectManagerModelItem* item = model->getItem(currentIndex()); + + bool isAccepted = true; + QString name = QInputDialog::getText(this,tr("Add new filter"),tr("Please type name of new filter in") + " " + item->getName(), + QLineEdit::Normal, QString(),&isAccepted,Qt::Dialog); + if (isAccepted && !name.isEmpty()) + { + QString fullName = item->objectName() + SEPARATOR + name; + if (item->parent() && item->parent()->findChild(fullName)) + { + QMessageBox::warning(this,tr("Adding filter error"),item->parent()->getName() + " " + tr("already has") + " " + name); + return onAddFilter(); + } + + QDir sourcesDir = item->getAbsoluteSourcesDir(); + qDebug() << sourcesDir.absolutePath(); + if (!sourcesDir.exists()) + if (! QDir(item->getProjectItem()->getAbsoluteFileDir()).mkdir("sources")) + { + QMessageBox::critical(this, tr("Adding filter error"), tr("Can not create sources directory")); + return; + } + + QStringList localStorageDirsList = fullName.split(SEPARATOR); + localStorageDirsList.removeFirst(); + + QString localStorageDirPath = localStorageDirsList.join(SEPARATOR); + if (sourcesDir.mkpath(localStorageDirPath) || QDir(QFileInfo(sourcesDir.absolutePath(),localStorageDirPath).absolutePath()).exists()) + { + + model->insertItem(fullName,localStorageDirPath,ProjectManagerModelItem::Filter); + emit event(ProjectChanged); + + if (!isExpanded(currentIndex())) + expand(currentIndex()); + + updateTreeView(); + } else + QMessageBox::critical(this, tr("Adding filter error"), tr("Can not create filter directory")); + + } +} + + +void ProjectManagerView::onAddExistingFiles() +{ + if (!currentIndex().isValid()) + return; + + ProjectManagerModelItem* filterItem = model->getItem(currentIndex()); + QString filterDirectory; + if (filterItem->getItemType()==ProjectManagerModelItem::Project) + filterDirectory = filterItem->getAbsoluteSourcesDir().absolutePath(); + else + filterDirectory = filterItem->getAbsoluteFileDir(); + + QStringList files = QFileDialog::getOpenFileNames(this,tr("Add existing files"), + filterDirectory, + PluginManager::instance()->openFilters(), + 0,QFileDialog::DontUseNativeDialog); + QStringList errors; + Q_FOREACH(QString filePath, files) + { + + QString absoluteFilePath; + if (!filePath.contains(filterItem->getAbsoluteSourcesDir().absolutePath())) + { + absoluteFilePath = QFileInfo(filterDirectory, QFileInfo(filePath).fileName()).absoluteFilePath(); + if (!QFile::copy(filePath, absoluteFilePath)) + { + errors.append( tr("Can not copy file to sources: ") + filePath); + continue; + } + } + else + absoluteFilePath = filePath; + + QString relativeFilePath = filterItem->getAbsoluteSourcesDir().relativeFilePath(absoluteFilePath); + QString shownName = filterItem->getProjectItem()->objectName() + SEPARATOR + relativeFilePath; + + if (ProjectManagerModelItem* findedItem = model->getItemByFilePath( relativeFilePath, filterItem->getProjectItem())) + errors.append( relativeFilePath + " " + tr("already exists in project as") + " " + findedItem->objectName()); + else + { + model->insertItem(shownName,relativeFilePath,ProjectManagerModelItem::File); + emit event(ProjectChanged); + } + + if (!isExpanded(currentIndex())) + setExpanded(currentIndex(), true); + } + + updateTreeView(); + + if (!errors.isEmpty()) + QMessageBox::warning(this,tr("Add existing files error"),tr("Adding has some errors:") + "\n" + errors.join("\n")); +} + + +void ProjectManagerView::onAddFile() +{ + if (!currentIndex().isValid()) + return; + ProjectManagerModelItem* item = model->getItem(currentIndex()); + + QString selectedFilter; + QString absoluteFilePath = QFileDialog::getSaveFileName(this,tr("Add file"), + item->getAbsoluteFileDir(), + PluginManager::instance()->openFilters(), + &selectedFilter, + QFileDialog::DontUseNativeDialog); + + if (absoluteFilePath.isEmpty()) + return; + + int pos = selectedFilter.indexOf("*."); + Q_ASSERT_X(pos != -1, "ProjectManagerView::onAddFile", "Can't find begin of extension"); + pos++; + int pos2 = selectedFilter.indexOf(")", pos); + Q_ASSERT_X(pos != -1, "ProjectManagerView::onAddFile", "Can't find end of extension"); + + QString ext = selectedFilter.mid(pos,pos2-pos).trimmed(); + if (!absoluteFilePath.contains(ext,Qt::CaseInsensitive)) + absoluteFilePath.append(ext); + + if (QFile::exists(absoluteFilePath)) + QFile::remove(absoluteFilePath); + + QString relativeFilePath = item->getAbsoluteSourcesDir().relativeFilePath(absoluteFilePath); + QString shownName = item->getProjectItem()->objectName() + SEPARATOR + relativeFilePath; + + + if (ProjectManagerModelItem* findedItem = model->getItemByFilePath( relativeFilePath, item->getProjectItem())) + model->removeItem(findedItem); + + model->insertItem(shownName,relativeFilePath,ProjectManagerModelItem::File); + + if (!isExpanded(currentIndex())) + setExpanded(currentIndex(), true); + updateTreeView(); + + emit event(ProjectChanged); + emit openFile(absoluteFilePath); +} + + +void ProjectManagerView::onOpenFile() +{ + ProjectManagerModelItem* item = model->getItem(currentIndex()); + + if (item && item->getItemType() == ProjectManagerModelItem::File) + { + if (!QFile::exists(item->getAbsoluteFilePath())) + { + QString filter = item -> getAbsoluteFilePath().split(SEPARATOR).last(); + filter.append(" ("+filter+");;"); + filter.append(tr("Any file") + " (*." + item->getAbsoluteFilePath().split(".").last() + ")"); + QString existingFileForReplace = QFileDialog::getOpenFileName(this, tr("File not found"), item->getAbsoluteFileDir(), + filter,0,QFileDialog::DontUseNativeDialog); + if (existingFileForReplace.isNull()) + return; + else + { + QString newFilePath; + newFilePath = QDir(item->getProjectItem()->getAbsoluteSourcesDir()).relativeFilePath(existingFileForReplace); + int reply = QMessageBox::question(this, tr("Replace file path"), tr("Replace file path to \"")+newFilePath+ + tr("\" instead \"") + item->getFilePath() + "\"", QMessageBox::Yes|QMessageBox::No); + if (reply == QMessageBox::Yes) + { + if (item -> getName() != QFileInfo(existingFileForReplace).fileName()) + { + item->setObjectName(item->parent()->objectName() + SEPARATOR + QFileInfo(existingFileForReplace).fileName()); + item->setName(QFileInfo(existingFileForReplace).fileName()); + } + item->setFilePath(newFilePath); + } + else + { + emit openFile(newFilePath); + return; + } + } + } + emit openFile(item->getAbsoluteFilePath()); + } + +} + + +void ProjectManagerView::onShowInExplorer() +{ + QString pathIn; + if (!currentIndex().isValid()) + return; + ProjectManagerModelItem* item = model->getItem(currentIndex()); + if (item && !item->getFilePath().isEmpty()) + pathIn = item->getAbsoluteFilePath(); + else + return; + + #ifdef defined(Q_OS_WIN) + const QString explorer = "explorer"; + QString param; + if (!QFileInfo(pathIn).isDir()) + param = QLatin1String("/select,"); + param += QDir::toNativeSeparators(pathIn); + QProcess::startDetached(explorer, QStringList(param)); + #elif defined(Q_OS_MAC) + + QStringList scriptArgs; + scriptArgs << QLatin1String("-e") + << QString::fromLatin1("tell application \"Finder\" to reveal POSIX file \"%1\"") + .arg(pathIn); + QProcess::execute(QLatin1String("/usr/bin/osascript"), scriptArgs); + scriptArgs.clear(); + scriptArgs << QLatin1String("-e") + << QLatin1String("tell application \"Finder\" to activate"); + QProcess::execute("/usr/bin/osascript", scriptArgs); + #endif + +// Todo: opening file in filemanager for Linux +/*#else + const QFileInfo fileInfo(pathIn); + const QString folder = fileInfo.absoluteFilePath(); + const QString app = Utils::UnixUtils::fileBrowser(Core::ICore::instance()->settings()); + QProcess browserProc; + const QString browserArgs = Utils::UnixUtils::substituteFileBrowserParameters(app, folder); + if (debug) + qDebug() << browserArgs; + bool success = browserProc.startDetached(browserArgs); + const QString error = QString::fromLocal8Bit(browserProc.readAllStandardError()); + success = success && error.isEmpty(); + if (!success) + showGraphicalShellError(this, app, error); + #endif +*/ +} + + +void ProjectManagerView::onPropertiesShow() +{ + if (!currentIndex().isValid()) + return; + if (ProjectManagerModelItem* item = model->getItem(currentIndex())) + { + QStringList properties; + properties << tr("Item:") + "\t\t" + item->objectName(); + properties << tr("File:") + "\t\t" + item->getAbsoluteFilePath(); + properties << tr("Size:") + "\t\t" + QString::number(QFileInfo(item->getAbsoluteFilePath()).size()) << "bytes"; + QMessageBox::information(this,tr("Properties"),properties.join("\n")); + } +} diff --git a/sources/kbe/projectmanager.h b/sources/kbe/projectmanager.h new file mode 100644 index 0000000..6bd5cdc --- /dev/null +++ b/sources/kbe/projectmanager.h @@ -0,0 +1,105 @@ +#ifndef PROJECTMANAGER_H +#define PROJECTMANAGER_H + +#include +#include + +#include "projectmanagermodel.h" + +class QMouseEvent; +class ProjectManagerView; +class ProjectManagerModel; +class ProjectManagerModelItem; + +class ProjectManagerDockWidget : public QDockWidget +{ + Q_OBJECT +public: + explicit ProjectManagerDockWidget(QWidget *parent = 0); + virtual ~ProjectManagerDockWidget(); + + static ProjectManagerDockWidget* instance(); + + ProjectManagerView* getTreeView() { return treeView; } +private: + static ProjectManagerDockWidget* mInstance; + + //! Content of this widget + ProjectManagerView *treeView; +}; + +class ProjectManagerView : public QTreeView +{ + Q_OBJECT + +public: + enum ProjectManagerEvent { + DefaultEvent, + ProjectCreated, + ProjectOpened, + ProjectSaved, + ProjectClosed, + ProjectChanged + }; + Q_ENUMS(ProjectManagerEvent) + + explicit ProjectManagerView(QWidget *parent = 0); + +public slots: + void onContextMenuRequested(QPoint); + void onProjectNew(); + void onProjectOpen(); + void onProjectSave(); + bool onProjectClose(); + void onRemove(); + void onRemovePermanently(); + QString onRename(); + void onFileRename(); + void onAddFilter(); + void onAddExistingFiles(); + void onAddFile(); + void onOpenFile(); + void onShowInExplorer(); + void onPropertiesShow(); + +signals: + /*! This signal will send when ProjectManager requests opening some file. + * @param Filename + */ + void openFile(QString); + + /*! This signal will send when ProjectManager modified(or managed) project. + * @param Filename + */ + void event(ProjectManagerView::ProjectManagerEvent); + +private: + /*! Changes item name + * @param item Item which name will be changed + * @param newName new name for item + */ + void renameItem(ProjectManagerModelItem* item, QString newName); + + /*! Removes item and his childs from localstorage and view + * @param item Item which will be removed + */ + void permanentRemoveTree(ProjectManagerModelItem* item); + + /*! Creates context menu which appears for item + * @param item Item for which menu will be appear + */ + void createContextMenu(ProjectManagerModelItem* item); + + //! QTreeView::mousePressEvent with feature that item's focus will be removed if click occured on empty area + void mousePressEvent(QMouseEvent*); + + //! Opens file if double clicked item's type is file + void mouseDoubleClickEvent(QMouseEvent *event); + + void updateTreeView(); + +private: + ProjectManagerModel* model; +}; + +#endif // PROJECTMANAGER_H diff --git a/sources/kbe/projectmanagermodel.cpp b/sources/kbe/projectmanagermodel.cpp new file mode 100644 index 0000000..dae0efb --- /dev/null +++ b/sources/kbe/projectmanagermodel.cpp @@ -0,0 +1,624 @@ +#include "projectmanagermodel.h" + +#include +#include + +#include +#include +#include + +#include +#include +#include + +#include + +#define MIME_FORMAT "application/kbe.project.item.list" + +#define TAG_PROJECT "KBEProject" +#define TAG_ATTR_NAME "name" +#define TAG_FILE "file" +#define TAG_ATTR_PATH "path" +#define TAG_ATTR_FILTER "filter" + +ProjectManagerModel::ProjectManagerModel(QObject *parent) + : QAbstractItemModel(parent) +{ + rootItem = new ProjectManagerModelItem(); +} + +ProjectManagerModel::~ProjectManagerModel() +{ + delete rootItem; +} + +int ProjectManagerModel::columnCount(const QModelIndex &parent) const +{ + if (parent.isValid()) + return static_cast(parent.internalPointer())->columnCount(); + else + return rootItem->columnCount(); +} + +QModelIndexList ProjectManagerModel::getPersistentIndexList() const +{ + return persistentIndexList(); +} + +QVariant ProjectManagerModel::data(const QModelIndex &index, int role) const +{ + if (!index.isValid()) + return QVariant(); + + if (role != Qt::DisplayRole) + return QVariant(); + + ProjectManagerModelItem *item = static_cast(index.internalPointer()); + + return item->data(index.column()); +} + +Qt::DropActions ProjectManagerModel::supportedDropActions() const +{ + return Qt::MoveAction; +} + +QStringList ProjectManagerModel::mimeTypes() const +{ + QStringList types; + types << MIME_FORMAT; + return types; +} + +QMimeData *ProjectManagerModel::mimeData(const QModelIndexList &indexes) const +{ + QMimeData *mimeData = new QMimeData(); + QByteArray encodedData; + + QDataStream stream(&encodedData, QIODevice::WriteOnly); + QList urlList; + + Q_FOREACH (QModelIndex index, indexes) + { + if (index.isValid() && !index.column()) + if (ProjectManagerModelItem* item = getItem(index)) + { + + QString objectName = item->objectName(); + QString shownName = item->getName(); + QString filePath = item->getAbsoluteFilePath(); + ProjectManagerModelItem::ItemType type = item->getItemType(); + + stream << objectName << shownName << filePath << type; + urlList.append(QUrl::fromLocalFile(filePath)); + } + } + + mimeData->setData("application/kbe.project.item.list", encodedData); + mimeData->setUrls(urlList); + + return mimeData; +} + +bool ProjectManagerModel::dropMimeData(const QMimeData *data, + Qt::DropAction action, int row, int column, const QModelIndex &parent) +{ + if (action == Qt::IgnoreAction) + return true; + + if (!data->hasFormat(MIME_FORMAT) || !parent.isValid()) + return false; + + if (ProjectManagerModelItem* item = getItem(parent)) + { + QByteArray encodedData = data->data(MIME_FORMAT); + QDataStream stream(&encodedData, QIODevice::ReadOnly); + QList< QPair > newItems; + + while (!stream.atEnd()) + { + QString lastObjectName; + QString shownName; + QString absoluteFilePath; + int n_itemType; + ProjectManagerModelItem::ItemType itemType; + + stream >> lastObjectName; + stream >> shownName; + stream >> absoluteFilePath; + stream >> n_itemType; + + itemType = static_cast(n_itemType); + + ProjectManagerModelItem* newItem = new ProjectManagerModelItem(shownName,absoluteFilePath,itemType); + QString lastPath(lastObjectName); + + newItems << QPair(newItem,lastPath); + } + + for (int i=0; iobjectName() + SEPARATOR + newItem->getName(); + QString filePath = QDir(item->getProjectItem()->getAbsoluteFileDir()).relativeFilePath(newItem->getFilePath()); + + if (shownName.split(SEPARATOR).first()!=lastName.split(SEPARATOR).first()) + return false; + + QString newAbsoluteFilePath = QFileInfo(item->getAbsoluteFileDir(), newItem->getName()).absoluteFilePath(); + + if (QFile::copy(newItem->getFilePath(),newAbsoluteFilePath)) + { + qDebug() << newItem->getFilePath(); + QFile::remove(newItem->getFilePath()); + removeItem(lastName); + insertItem(shownName,filePath,newItem->getItemType()); + + } + } + return true; + } + return false; +} + +void ProjectManagerModel::loadProject(QString filePath) +{ + if (filePath.isEmpty()) + return; + + ProjectManagerModelItem* projectItem = NULL; + + QFile proFile(filePath); + + if (proFile.open(QFile::ReadOnly)) + { + QXmlStreamReader rStream(&proFile); + + while (!rStream.atEnd() && !rStream.hasError()) + { + rStream.readNextStartElement(); + if (rStream.name()==TAG_PROJECT && rStream.isStartElement()) + { + if (projectItem) + { + removeItem(projectItem); + break; + } + QString shownName = rStream.attributes().value(TAG_ATTR_NAME).toString(); + QString fileName = proFile.fileName(); + + if (rootItem->findChild(shownName)) + return; + + projectItem = new ProjectManagerModelItem(shownName, fileName, + ProjectManagerModelItem::Project, rootItem); + projectItem->setObjectName(shownName); + + insertProject(projectItem); + } + + if (rStream.name()==TAG_FILE && rStream.isStartElement()) + { + QString fileName = rStream.attributes().value(TAG_ATTR_PATH).toString(); + QString filter = rStream.attributes().value(TAG_ATTR_FILTER).toString(); + + if (!filter.isEmpty()) + filter.push_front(SEPARATOR); + + QString newObjectName = projectItem->objectName()+ filter + SEPARATOR + fileName.split(SEPARATOR).last(); + + addChild(newObjectName, fileName, ProjectManagerModelItem::File, rootItem); + } + } + projectItem->setModified(false); + proFile.close(); + } +} + +void ProjectManagerModel::saveProject(ProjectManagerModelItem *project, QString filePath) +{ + if (!project || filePath.isEmpty()) + return; + + QFile proFile(filePath); + if (proFile.open(QFile::WriteOnly)) + { + QXmlStreamWriter wStream(&proFile); + wStream.setAutoFormatting(true); + wStream.setAutoFormattingIndent(4); + + wStream.writeStartDocument(); + + wStream.writeStartElement(TAG_PROJECT); + wStream.writeAttribute(TAG_ATTR_NAME, project->getName()); + saveChilds(project,wStream); + wStream.writeEndElement(); + + wStream.writeEndDocument(); + + proFile.close(); + + project -> setModified(false); + } +} + +void ProjectManagerModel::saveChilds(ProjectManagerModelItem *item, QXmlStreamWriter &wStream) +{ + if (!item) + return; + + for (int i=0; ichildCount(); i++) + saveChilds(item->child(i),wStream); + + if (item->getItemType() == ProjectManagerModelItem::Project || + item->getItemType() == ProjectManagerModelItem::Filter) + return; + + wStream.writeStartElement(TAG_FILE); + QStringList filterPath = item->objectName().split(SEPARATOR); + filterPath.pop_back(); + filterPath.pop_front(); + if (filterPath.count()) + wStream.writeAttribute(TAG_ATTR_FILTER,filterPath.join(SEPARATOR)); + wStream.writeAttribute(TAG_ATTR_PATH,item->getFilePath()); + + wStream.writeEndElement(); +} + +void ProjectManagerModel::insertItem(const QString shownName, const QString filePath, ProjectManagerModelItem::ItemType type) +{ + QStringList path = shownName.split(SEPARATOR); + + path.pop_back(); + + ProjectManagerModelItem* neededFilter = getPath(path,rootItem); + + if (!neededFilter) + return; + + beginInsertRows(createIndex(0,0,neededFilter), + neededFilter->childCount(), + neededFilter->childCount()+1); + + addChild(shownName,filePath,type,rootItem); + + endInsertRows(); +} + +void ProjectManagerModel::insertProject(ProjectManagerModelItem *item) +{ + beginInsertRows(QModelIndex(), + 0, + 1); + + rootItem -> appendChild(item); + + endInsertRows(); +} + +void ProjectManagerModel::removeItem(ProjectManagerModelItem *item) +{ + if (item==NULL) + return; + QModelIndex index = createIndex(0,0,item); + if (index.isValid()) + { + beginRemoveRows(index,0,item->childCount()); + + item->parent()->removeChild(item); + + endRemoveRows(); + } +} + +void ProjectManagerModel::removeItem(QString itemObjectName) +{ + if (itemObjectName.isNull() || itemObjectName.isEmpty()) + return; + + if (ProjectManagerModelItem* item = getRootItem()->findChild(itemObjectName)) + { + QModelIndex index = createIndex(0,0,item); + if (index.isValid()) + { + beginRemoveRows(index,0,item->childCount()); + + item->parent()->removeChild(item); + + endRemoveRows(); + } + } +} + +Qt::ItemFlags ProjectManagerModel::flags(const QModelIndex &index) const +{ + if (!index.isValid()) + return 0; + + if (ProjectManagerModelItem* item = getItem(index)) + switch (item->getItemType()) + { + case ProjectManagerModelItem::Project: + return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsDropEnabled; + case ProjectManagerModelItem::Filter: + return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled; + case ProjectManagerModelItem::File: + return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsDragEnabled; + case ProjectManagerModelItem::Unknown: + return Qt::ItemIsEnabled; + } + + return 0; +} + +QVariant ProjectManagerModel::headerData(int section, Qt::Orientation orientation, + int role) const +{ + if (orientation == Qt::Horizontal && role == Qt::DisplayRole) + return rootItem->data(section); + + return QVariant(); +} + +QModelIndex ProjectManagerModel::index(int row, int column, const QModelIndex &parent) + const +{ + if (!hasIndex(row, column, parent)) + return QModelIndex(); + + ProjectManagerModelItem *parentItem; + + if (!parent.isValid()) + parentItem = rootItem; + else + parentItem = getItem(parent); + + if (ProjectManagerModelItem *childItem = parentItem->child(row)) + return createIndex(row, column, childItem); + + return QModelIndex(); +} + +QModelIndex ProjectManagerModel::parent(const QModelIndex &index) const +{ + if (!index.isValid()) + return QModelIndex(); + + if (ProjectManagerModelItem *parentItem = getItem(index)->parent()) + { + if (parentItem == rootItem) + return QModelIndex(); + return createIndex(parentItem->row(), 0, parentItem); + } + + return QModelIndex(); +} + +int ProjectManagerModel::rowCount(const QModelIndex &parent) const +{ + ProjectManagerModelItem *parentItem; + + if (parent.column() > 0) + return 0; + + if (!parent.isValid()) + parentItem = rootItem; + else + parentItem = getItem(parent); + + return parentItem->childCount(); +} + +ProjectManagerModelItem* ProjectManagerModel::getItem(const QModelIndex &index) const +{ + if (index.isValid()) + if (ProjectManagerModelItem* item = static_cast(index.internalPointer())) + return item; + + return NULL; +} + +ProjectManagerModelItem* ProjectManagerModel::getRootItem() +{ + return rootItem; +} + +ProjectManagerModelItem* ProjectManagerModel::getItemByFilePath(QString filePath, ProjectManagerModelItem *parent) +{ + if (parent) + { + for (int i=0; ichildCount(); i++) + { + if (filePath == parent->child(i)->getFilePath()) + return parent->child(i); + + if (ProjectManagerModelItem* item = getItemByFilePath(filePath,parent->child(i))) + return item; + } + } + return NULL; +} + +ProjectManagerModelItem* ProjectManagerModel::addChild(const QString shownName, const QString filePath, + ProjectManagerModelItem::ItemType type, ProjectManagerModelItem* rootItem) +{ + ProjectManagerModelItem* item = NULL; + QStringList path = shownName.split(SEPARATOR); + QString name = path.last(); + + if (ProjectManagerModelItem* existingChild = getPath(QStringList(shownName.split(SEPARATOR).first()),rootItem) -> findChild(shownName)) + return existingChild; + + path.pop_back(); + + if (ProjectManagerModelItem* neededFilter = getPath(path,rootItem)) + { + item = new ProjectManagerModelItem(name,filePath,type,neededFilter); + item -> setObjectName(shownName); + neededFilter -> appendChild(item); + } + + return item; +} + +ProjectManagerModelItem* ProjectManagerModel::getPath(QStringList path, ProjectManagerModelItem *parent) +{ + if (path.isEmpty()) + return parent; + + QString neededItemObjectName = path.first(); + + if (!neededItemObjectName.isEmpty()) + { + if (!parent->objectName().isEmpty()) + neededItemObjectName.push_front(parent->objectName()+SEPARATOR); + if (ProjectManagerModelItem* item = parent -> findChild(neededItemObjectName)) + { + path.pop_front(); + return getPath(path, item); + } else + { + QString relativeDirPath; + if (parent -> getItemType() == ProjectManagerModelItem::Project) + relativeDirPath = path.first(); + else + relativeDirPath = parent->getAbsoluteSourcesDir().relativeFilePath(QFileInfo(parent->getAbsoluteFilePath(),path.first()).absoluteFilePath()); + + ProjectManagerModelItem* newItem = new ProjectManagerModelItem(path.first(),relativeDirPath,ProjectManagerModelItem::Filter,parent); + newItem -> setObjectName(neededItemObjectName); + parent -> appendChild(newItem); + path.pop_front(); + return getPath(path,newItem); + } + } + return parent; +} + +QModelIndex ProjectManagerModel::getParentModelIndex(ProjectManagerModelItem* item) +{ + if (item->parent()) + return createIndex(0,0,item->parent()); + return QModelIndex(); +} + +ProjectManagerModelItem::ProjectManagerModelItem(QObject *parent): + QObject(parent), m_isModified(false) +{ + parentItem = NULL; +} + +ProjectManagerModelItem::ProjectManagerModelItem(QString shownName, QString filePath, ItemType type, ProjectManagerModelItem *parent): + QObject(parent), m_isModified(false) +{ + parentItem = parent; + + setObjectName(shownName); + + this -> shownName = shownName; + this -> filePath = filePath; + this -> type = type; +} + +ProjectManagerModelItem::~ProjectManagerModelItem() +{ + qDeleteAll(childItems); +} + +void ProjectManagerModelItem::appendChild(ProjectManagerModelItem *item) +{ + if (getProjectItem()) + getProjectItem()->setModified(true); + childItems.append(item); +} + +void ProjectManagerModelItem::removeChild(ProjectManagerModelItem *child) +{ + if (!child) + return; + + childItems.removeOne(child); + for (int i=0; i< child -> childCount(); i++) + child->removeChild(child->child(i)); + child->setObjectName(""); + + if (getProjectItem()) + getProjectItem()->setModified(true); +} + +ProjectManagerModelItem *ProjectManagerModelItem::child(int row) +{ + return childItems.value(row); +} + +int ProjectManagerModelItem::childCount() const +{ + return childItems.count(); +} + +int ProjectManagerModelItem::columnCount() const +{ + return 1; +} + +QVariant ProjectManagerModelItem::data(int column) const +{ + return shownName; +} + +ProjectManagerModelItem *ProjectManagerModelItem::parent() +{ + return parentItem; +} + +ProjectManagerModelItem* ProjectManagerModelItem::getProjectItem() +{ + ProjectManagerModelItem* projectItem = this; + while (projectItem && projectItem -> type != ProjectManagerModelItem::Project) + projectItem = projectItem->parent(); + + return projectItem; +} + +void ProjectManagerModelItem::setFilePath(QString filePath) +{ + this->filePath = filePath; +} + +QString ProjectManagerModelItem::getAbsoluteFilePath() +{ + switch(type) + { + case Project: + return QFileInfo(filePath).absoluteFilePath(); + case Filter: + case File: + return QFileInfo(getAbsoluteSourcesDir().absolutePath(),filePath).absoluteFilePath(); + default: + return QString(); + } +} + +QString ProjectManagerModelItem::getAbsoluteFileDir() +{ + if (this->getItemType() == Project) + return QFileInfo(getAbsoluteFilePath()).absoluteDir().absolutePath(); + if (this->getItemType() != Filter) + return QFileInfo(getAbsoluteFilePath()).absoluteDir().absolutePath(); + else + return getAbsoluteFilePath(); +} + +QDir ProjectManagerModelItem::getAbsoluteSourcesDir() +{ + return QDir(QFileInfo(this->getProjectItem()->getAbsoluteFileDir(),"sources").absoluteFilePath()); +} + +int ProjectManagerModelItem::row() const +{ + if (parentItem) + return parentItem->childItems.indexOf(const_cast(this)); + + return 1; +} diff --git a/sources/kbe/projectmanagermodel.h b/sources/kbe/projectmanagermodel.h new file mode 100644 index 0000000..74ed0c9 --- /dev/null +++ b/sources/kbe/projectmanagermodel.h @@ -0,0 +1,203 @@ +#ifndef PROJECTMANAGERTREEVIEW_H +#define PROJECTMANAGERTREEVIEW_H + +#include +#include +#include + +#include + +#define SEPARATOR "/" + +class QXmlStreamWriter; +class QModelIndex; +class QDir; + +class ProjectManagerModelItem: public QObject +{ + Q_OBJECT + +public: + /* Types of item */ + enum ItemType { + Unknown, + Project, + Filter, + File + }; + + Q_ENUMS(ItemType) + + ProjectManagerModelItem(QObject* parent=0); + ProjectManagerModelItem(QString shownName, QString filePath, ItemType type, ProjectManagerModelItem *parent = 0); + ~ProjectManagerModelItem(); + + /*! Appends child in childItems list + * @param child Item which will be appeded + */ + void appendChild(ProjectManagerModelItem *child); + + /*! Removes child from childItems list + * @param child Item which will be removed + */ + void removeChild(ProjectManagerModelItem* child); + + ProjectManagerModelItem* child(int row); + int childCount() const; + int columnCount() const; + QVariant data(int column) const; + int row() const; + + //! Returns item's parent + ProjectManagerModelItem* parent(); + + //! Returns project item which contains this item + ProjectManagerModelItem* getProjectItem(); + + //! Returns absolute file path of current item + QString getAbsoluteFilePath(); + + //! Returns absolute path to directory which contains current item + QString getAbsoluteFileDir(); + + //! Returns absolute directory to directory which contains sources of project + QDir getAbsoluteSourcesDir(); + + ItemType getItemType() const { return type; } + QString getFilePath() const { return filePath; } + void setFilePath(QString filePath); + QString getName() const { return shownName.toString(); } + void setName(QString name) { shownName = name; } + bool isModified() const { return m_isModified; } + void setModified(bool val) { m_isModified = val; } + +private: + //! Flag which indicates that item is modified + bool m_isModified; + + //! Pointer to parent + ProjectManagerModelItem *parentItem; + //! List of item's child + QList childItems; + + //Object name contains full path to item and shown name + + //! Name which will be shown in view + QVariant shownName; + //! Relative(for files) or Absolute(for projects) path + QString filePath; + //! Type of item + ItemType type; +}; + + + +class ProjectManagerModel : public QAbstractItemModel +{ + Q_OBJECT + +public: + ProjectManagerModel(QObject *parent); + ~ProjectManagerModel(); + + /*! Adds child to model + * @param shownName Item's name which contain all filters and project name. Finally will be shown name without adds + * @param filePath Relative(for files) or Absolute(for projects) path to real file + * @param type Item's type + * @param rootItem Model's root item + */ + ProjectManagerModelItem* addChild(const QString shownName, const QString filePath, ProjectManagerModelItem::ItemType type, ProjectManagerModelItem* rootItem); + + /*! Removes item from model + * @param item which will be removed from model + */ + void removeItem(ProjectManagerModelItem* item); + + /*! Removes item from model by objectName + * @param itemObjectName Item's objectName + */ + void removeItem(QString itemObjectName); + + /*! Inserts item to model + * @param shownName Item's name which contain all filters and project name. Finally will be shown name without adds + * @param filePath Relative(for files) or Absolute(for projects) path to real file + * @param type Item's type + */ + void insertItem(const QString shownName, const QString filePath, ProjectManagerModelItem::ItemType type); + + /*! Inserts project item to model + * @param item Project item which will be inserted in model + */ + void insertProject(ProjectManagerModelItem* item); + + + //! Returns model's root item + ProjectManagerModelItem* getRootItem(); + + /*! Returns item of parent by filePath + * @param filePath Path to item's file on local storage + * @param parent item which seek to item + */ + ProjectManagerModelItem* getItemByFilePath(QString filePath, ProjectManagerModelItem* parent); + + + /*! Returns QModelIndex of item's parent + * @param item which parent is needed + */ + QModelIndex getParentModelIndex(ProjectManagerModelItem* item); + + + /*! Loads project to model by filePath + * @param filePath Path to project file + */ + void loadProject(QString filePath); + + /*! Saves project from model + * @param project Project which will be saved + * @param filePath Path to file in which will be saved project + */ + void saveProject(ProjectManagerModelItem* project,QString filePath=0); + + QStringList mimeTypes() const; + QMimeData* mimeData(const QModelIndexList &indexes) const; + bool dropMimeData(const QMimeData *data, + Qt::DropAction action, int row, int column, const QModelIndex &parent); + Qt::DropActions supportedDropActions() const; + + //! Converts index to PrijectManagerModelItem + ProjectManagerModelItem* getItem(const QModelIndex &index) const; + + QVariant data(const QModelIndex &index, int role) const; + Qt::ItemFlags flags(const QModelIndex &index) const; + QVariant headerData(int section, Qt::Orientation orientation, + int role = Qt::DisplayRole) const; + QModelIndex index(int row, int column, + const QModelIndex &parent = QModelIndex()) const; + QModelIndex parent(const QModelIndex &index) const; + int rowCount(const QModelIndex &parent = QModelIndex()) const; + int columnCount(const QModelIndex &parent = QModelIndex()) const; + QModelIndexList getPersistentIndexList() const; + +private: + + /*! Recoursivly saves item with childs to stream + * @param item Item which be saved + * @param wStream Stream in which item will be saved + */ + void saveChilds(ProjectManagerModelItem* item, QXmlStreamWriter& wStream); + + + /*! Creates path(filters) in model and returns pointer for tale + * @param path Path which will be created in model + * @param parent Item which will be used to find or create next filter + * \return Pointer to last created item (path's tale) + */ + ProjectManagerModelItem* getPath(QStringList path, ProjectManagerModelItem *parent); + +private: + //! Model's root item + ProjectManagerModelItem *rootItem; + +}; + +#endif // PROJECTMANAGERTREEVIEW_H diff --git a/sources/kbe/ui_mainwindow.h b/sources/kbe/ui_mainwindow.h index 12d5b29..987c5ba 100644 --- a/sources/kbe/ui_mainwindow.h +++ b/sources/kbe/ui_mainwindow.h @@ -1,7 +1,7 @@ /******************************************************************************** ** Form generated from reading UI file 'mainwindow.ui' ** -** Created: Thu Dec 19 22:34:30 2013 +** Created: Thu 1. May 18:57:02 2014 ** by: Qt User Interface Compiler version 4.8.1 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! @@ -41,6 +41,11 @@ class Ui_MainWindow QAction *actionClose; QAction *actionFeedback; QAction *actionGuide; + QAction *actionView_ProjectManager; + QAction *actionNew_Project; + QAction *actionOpen_Project; + QAction *actionSave_Project; + QAction *actionClose_Project; QWidget *centralWidget; QMenuBar *menuBar; QMenu *menuFile; @@ -88,6 +93,16 @@ class Ui_MainWindow actionGuide = new QAction(MainWindow); actionGuide->setObjectName(QString::fromUtf8("actionGuide")); actionGuide->setEnabled(false); + actionView_ProjectManager = new QAction(MainWindow); + actionView_ProjectManager->setObjectName(QString::fromUtf8("actionView_ProjectManager")); + actionNew_Project = new QAction(MainWindow); + actionNew_Project->setObjectName(QString::fromUtf8("actionNew_Project")); + actionOpen_Project = new QAction(MainWindow); + actionOpen_Project->setObjectName(QString::fromUtf8("actionOpen_Project")); + actionSave_Project = new QAction(MainWindow); + actionSave_Project->setObjectName(QString::fromUtf8("actionSave_Project")); + actionClose_Project = new QAction(MainWindow); + actionClose_Project->setObjectName(QString::fromUtf8("actionClose_Project")); centralWidget = new QWidget(MainWindow); centralWidget->setObjectName(QString::fromUtf8("centralWidget")); MainWindow->setCentralWidget(centralWidget); @@ -112,9 +127,12 @@ class Ui_MainWindow menuBar->addAction(menuView->menuAction()); menuBar->addAction(menuHelp->menuAction()); menuFile->addAction(actionNew); + menuFile->addAction(actionNew_Project); menuFile->addAction(actionOpen); + menuFile->addAction(actionOpen_Project); menuFile->addAction(actionSave); menuFile->addAction(actionSave_as); + menuFile->addAction(actionSave_Project); menuFile->addAction(actionSave_all); menuFile->addSeparator(); menuFile->addAction(menuExport->menuAction()); @@ -122,6 +140,7 @@ class Ui_MainWindow menuFile->addSeparator(); menuFile->addAction(actionClose); menuFile->addAction(actionClose_All); + menuFile->addAction(actionClose_Project); menuFile->addAction(actionClose_Others); menuFile->addSeparator(); menuFile->addAction(actionExit); @@ -130,6 +149,7 @@ class Ui_MainWindow menuHelp->addAction(actionAbout_Qt); menuHelp->addAction(actionFeedback); menuHelp->addAction(actionGuide); + menuView->addAction(actionView_ProjectManager); retranslateUi(MainWindow); @@ -163,6 +183,11 @@ class Ui_MainWindow actionClose->setShortcut(QApplication::translate("MainWindow", "Ctrl+W", 0, QApplication::UnicodeUTF8)); actionFeedback->setText(QApplication::translate("MainWindow", "Feedback", 0, QApplication::UnicodeUTF8)); actionGuide->setText(QApplication::translate("MainWindow", "Guide", 0, QApplication::UnicodeUTF8)); + actionView_ProjectManager->setText(QApplication::translate("MainWindow", "Project Manager", 0, QApplication::UnicodeUTF8)); + actionNew_Project->setText(QApplication::translate("MainWindow", "New Project", 0, QApplication::UnicodeUTF8)); + actionOpen_Project->setText(QApplication::translate("MainWindow", "Open Project", 0, QApplication::UnicodeUTF8)); + actionSave_Project->setText(QApplication::translate("MainWindow", "Save Project", 0, QApplication::UnicodeUTF8)); + actionClose_Project->setText(QApplication::translate("MainWindow", "Close Project", 0, QApplication::UnicodeUTF8)); menuFile->setTitle(QApplication::translate("MainWindow", "File", 0, QApplication::UnicodeUTF8)); menuExport->setTitle(QApplication::translate("MainWindow", "Export", 0, QApplication::UnicodeUTF8)); menuHelp->setTitle(QApplication::translate("MainWindow", "Help", 0, QApplication::UnicodeUTF8)); From 8730a2afa39b69bcd4feb0a83047ee095de8f1d6 Mon Sep 17 00:00:00 2001 From: mikluke Date: Tue, 13 May 2014 16:17:45 +0300 Subject: [PATCH 29/71] #8 Project Manager added --- sources/kbe/kbe.pro | 13 +- sources/kbe/kbe.qrc | 9 + sources/kbe/mainwindow.cpp | 117 ++- sources/kbe/mainwindow.h | 6 +- sources/kbe/mainwindow.ui | 30 + sources/kbe/media/icons/pm-add.png | Bin 0 -> 549 bytes sources/kbe/media/icons/pm-branch-closed.png | Bin 0 -> 212 bytes sources/kbe/media/icons/pm-branch-end.png | Bin 0 -> 193 bytes sources/kbe/media/icons/pm-branch-more.png | Bin 0 -> 114 bytes sources/kbe/media/icons/pm-branch-open.png | Bin 0 -> 222 bytes sources/kbe/media/icons/pm-collapse.png | Bin 0 -> 453 bytes sources/kbe/media/icons/pm-expand.png | Bin 0 -> 601 bytes sources/kbe/media/icons/pm-vline.png | Bin 0 -> 175 bytes .../kbe/media/stylesheets/projectmanager.qss | 23 + sources/kbe/projectmanager.cpp | 724 ++++++++++++++++++ sources/kbe/projectmanager.h | 105 +++ sources/kbe/projectmanagermodel.cpp | 624 +++++++++++++++ sources/kbe/projectmanagermodel.h | 203 +++++ sources/kbe/ui_mainwindow.h | 27 +- 19 files changed, 1856 insertions(+), 25 deletions(-) create mode 100644 sources/kbe/media/icons/pm-add.png create mode 100644 sources/kbe/media/icons/pm-branch-closed.png create mode 100644 sources/kbe/media/icons/pm-branch-end.png create mode 100644 sources/kbe/media/icons/pm-branch-more.png create mode 100644 sources/kbe/media/icons/pm-branch-open.png create mode 100644 sources/kbe/media/icons/pm-collapse.png create mode 100644 sources/kbe/media/icons/pm-expand.png create mode 100644 sources/kbe/media/icons/pm-vline.png create mode 100644 sources/kbe/media/stylesheets/projectmanager.qss create mode 100644 sources/kbe/projectmanager.cpp create mode 100644 sources/kbe/projectmanager.h create mode 100644 sources/kbe/projectmanagermodel.cpp create mode 100644 sources/kbe/projectmanagermodel.h diff --git a/sources/kbe/kbe.pro b/sources/kbe/kbe.pro index d48a980..12b1b70 100644 --- a/sources/kbe/kbe.pro +++ b/sources/kbe/kbe.pro @@ -4,7 +4,7 @@ DESTDIR = ../bin -TARGET = kbe +QT += xml TEMPLATE = app @@ -15,7 +15,9 @@ SOURCES += \ config.cpp \ pluginmanager.cpp \ guidedialog.cpp \ - newfiledialog.cpp + newfiledialog.cpp \ + projectmanager.cpp \ + projectmanagermodel.cpp HEADERS += version.h \ platform.h \ @@ -26,7 +28,9 @@ HEADERS += version.h \ pluginmanager.h \ interfaces/editorinterface.h \ guidedialog.h \ - newfiledialog.h + newfiledialog.h \ + projectmanager.h \ + projectmanagermodel.h FORMS += mainwindow.ui @@ -46,3 +50,6 @@ RC_FILE = kbe.rc OBJECTS_DIR = obj MOC_DIR = moc + +OTHER_FILES += \ + media/stylesheets/projectmanager.qss diff --git a/sources/kbe/kbe.qrc b/sources/kbe/kbe.qrc index 5534bdf..45fdb46 100644 --- a/sources/kbe/kbe.qrc +++ b/sources/kbe/kbe.qrc @@ -16,5 +16,14 @@ media/startup/images/bottom-shadow.gif media/translations/lang_en_EN.qm media/translations/lang_ru_RU.qm + media/icons/pm-branch-closed.png + media/icons/pm-branch-end.png + media/icons/pm-branch-more.png + media/icons/pm-branch-open.png + media/icons/pm-vline.png + media/stylesheets/projectmanager.qss + media/icons/pm-collapse.png + media/icons/pm-expand.png + media/icons/pm-add.png diff --git a/sources/kbe/mainwindow.cpp b/sources/kbe/mainwindow.cpp index 4b227c3..faa06e8 100644 --- a/sources/kbe/mainwindow.cpp +++ b/sources/kbe/mainwindow.cpp @@ -77,6 +77,19 @@ MainWindow::MainWindow(QWidget *parent) : connect(mTabWidget, SIGNAL(tabsUpdate()), this, SLOT(updateMenu())); connect(mTabWidget, SIGNAL(currentChanged(int)), this, SLOT(updateMenu())); + /*creating project manager widget */ + ProjectManagerDockWidget::instance() -> setWindowTitle(tr("Project Manager")); + ProjectManagerDockWidget::instance()->setObjectName("Project Name"); + addDockWidget(Qt::LeftDockWidgetArea,ProjectManagerDockWidget::instance()); + + if (ProjectManagerView* prView = ProjectManagerDockWidget::instance()->getTreeView()) + { + connect(prView, SIGNAL(openFile(QString)), this, SLOT(fileOpen(QString))); + connect(prView, SIGNAL(event(ProjectManagerView::ProjectManagerEvent)), + this, SLOT(acceptProjectManagerEvent(ProjectManagerView::ProjectManagerEvent))); + } + + setCentralWidget(mTabWidget); connect(mTabWidget, SIGNAL(currentChanged(int)), @@ -150,10 +163,12 @@ void MainWindow::createToolBars() void MainWindow::createActions() { ui->actionNew->setIcon(QIcon::fromTheme("document-new", getIcon("document-new.png"))); + ui->actionNew_Project->setIcon(QIcon::fromTheme("document-new", getIcon("document-new.png"))); ui->actionOpen->setIcon(QIcon::fromTheme("document-open", getIcon("document-open.png"))); + ui->actionOpen_Project->setIcon(QIcon::fromTheme("document-open", getIcon("document-open.png"))); ui->actionSave->setIcon(QIcon::fromTheme("document-save", getIcon("document-save.png"))); ui->actionSave_as->setIcon(QIcon::fromTheme("document-save-as", getIcon("document-save-as.png"))); - + ui->actionSave_Project->setIcon(QIcon::fromTheme("document-save", getIcon("document-save-as.png"))); ui->actionClose->setIcon(QIcon::fromTheme("window-close", getIcon("window-close.png"))); ui->actionExit->setIcon(QIcon::fromTheme("application-exit", getIcon("application-exit.png"))); @@ -174,6 +189,16 @@ void MainWindow::createActions() connect(ui->actionClose_Others, SIGNAL(triggered()), this, SLOT(updateMenu())); connect(ui->actionExit, SIGNAL(triggered()), this, SLOT(fileExit())); + if (ProjectManagerView* pmTreeView = ProjectManagerDockWidget::instance()->getTreeView()) + { + connect(ui->actionNew_Project, SIGNAL(triggered()), pmTreeView, SLOT(onProjectNew())); + connect(ui->actionOpen_Project, SIGNAL(triggered()), pmTreeView, SLOT(onProjectOpen())); + ui->actionSave_Project->setEnabled(false); + connect(ui->actionSave_Project, SIGNAL(triggered()), pmTreeView, SLOT(onProjectSave())); + ui->actionClose_Project->setEnabled(false); + connect(ui->actionClose_Project,SIGNAL(triggered()), pmTreeView, SLOT(onProjectClose())); + } + for (int i = 0; i < MaxRecentFiles; ++i) { recentFileActs[i] = new QAction(this); @@ -245,18 +270,20 @@ void MainWindow::updateMenu() void MainWindow::updateSpecificViewMenu() { - ui->menuView->menuAction()->setVisible(false);//setDisabled(true); +// ui->menuView->menuAction()->setVisible(false);//setDisabled(true); ui->menuView->clear(); + ui->menuView->addAction(ProjectManagerDockWidget::instance()->toggleViewAction()); if(mLastActiveWindow) { QList ws = mLastActiveWindow->widgetsForDocks(); if(!ws.empty()) { + foreach(QWidget* w, ws) ui->menuView->addAction(mDockWidgets[w->objectName()]->toggleViewAction()); - ui->menuView->menuAction()->setVisible(true); } } +// ui->menuView->menuAction()->setVisible(true); } void MainWindow::updateRecentFileActions() { @@ -338,7 +365,6 @@ EditorInterface* MainWindow::createSubWindowByExt(const QString& ext) childWindow = PluginManager::instance()->createWindowByExt(ext); else return 0; - mWidget2EditorInterface[childWindow->widget()] = childWindow; mTabWidget->addSubWindow(childWindow); childWindow->_setObserver(this); @@ -363,25 +389,40 @@ void MainWindow::fileNew() } } -void MainWindow::fileOpen() +void MainWindow::fileOpen(QString fileName) { - QFileDialog::Options options; - options |= QFileDialog::DontUseNativeDialog; - QString selectedFilter; - QFileDialog dlg; + if (fileName.isNull()) + { + QFileDialog::Options options; + options |= QFileDialog::DontUseNativeDialog; + QString selectedFilter; + QFileDialog dlg; + + mBlurEffect->setEnabled(true); + dlg.setDirectory(mLastDir); + fileName = dlg.getOpenFileName(this, + tr("Open file"), + "", + PluginManager::instance()->openFilters(), + &selectedFilter, + options); + if (!fileName.isEmpty()) + load(fileName); + mLastDir = QDir(fileName); + mBlurEffect->setEnabled(false); + return; + } - mBlurEffect->setEnabled(true); - dlg.setDirectory(mLastDir); - QString fileName = dlg.getOpenFileName(this, - tr("Open file"), - "", - PluginManager::instance()->openFilters(), - &selectedFilter, - options); - if (!fileName.isEmpty()) + if (!fileName.isEmpty() && QFile::exists(fileName)) + { load(fileName); - mLastDir = QDir(fileName); - mBlurEffect->setEnabled(false); + return; + } + + QFileInfo fileInfo(fileName); + EditorInterface* childWindow = createSubWindowByExt(fileInfo.suffix()); + saveWindow(childWindow, fileName, fileInfo.suffix()); + } void MainWindow::load(QString fileName) @@ -765,9 +806,45 @@ void MainWindow::closeEvent(QCloseEvent *event) } } + // close project + if (ProjectManagerView* pmView = ProjectManagerDockWidget::instance()->getTreeView()) + if (!pmView -> onProjectClose()) + { + event->ignore(); + return; + } + saveLayout(); } +void MainWindow::acceptProjectManagerEvent(ProjectManagerView::ProjectManagerEvent event) +{ + switch (event) + { + case ProjectManagerView::ProjectCreated: + case ProjectManagerView::ProjectOpened: + ui->actionNew_Project -> setEnabled(false); + ui->actionOpen_Project -> setEnabled(false); + ui->actionSave_Project -> setEnabled(false); + ui->actionClose_Project -> setEnabled(true); + break; + case ProjectManagerView::ProjectSaved: + ui->actionSave_Project -> setEnabled(false); + break; + case ProjectManagerView::ProjectClosed: + ui->actionNew_Project -> setEnabled(true); + ui->actionOpen_Project -> setEnabled(true); + ui->actionSave_Project -> setEnabled(false); + ui->actionClose_Project -> setEnabled(false); + break; + case ProjectManagerView::ProjectChanged: + ui->actionSave_Project -> setEnabled(true); + break; + case ProjectManagerView::DefaultEvent: + break; + } +} + void MainWindow::dragEnterEvent(QDragEnterEvent *event) { event->acceptProposedAction(); diff --git a/sources/kbe/mainwindow.h b/sources/kbe/mainwindow.h index 5a704a4..ab460be 100644 --- a/sources/kbe/mainwindow.h +++ b/sources/kbe/mainwindow.h @@ -27,6 +27,7 @@ along with OSTIS. If not, see . #include #include #include "extendedtabwidget.h" +#include "projectmanager.h" #include "interfaces/editorinterface.h" namespace Ui { @@ -180,7 +181,7 @@ public slots: void openRecentFile(); void fileNew(); - void fileOpen(); + void fileOpen(QString fileName=QString()); void fileSave(QWidget* window = 0); void fileSaveAs(QWidget* window = 0); void fileSaveAll(); @@ -210,6 +211,9 @@ public slots: void updateDockWidgets(bool hide); void closeEvent(QCloseEvent *event); + + //! Accepts Project Managers events. + void acceptProjectManagerEvent(ProjectManagerView::ProjectManagerEvent); }; #endif // MAINWINDOW_H diff --git a/sources/kbe/mainwindow.ui b/sources/kbe/mainwindow.ui index eeb8ec2..d642efb 100644 --- a/sources/kbe/mainwindow.ui +++ b/sources/kbe/mainwindow.ui @@ -37,9 +37,12 @@ + + + @@ -47,6 +50,7 @@ + @@ -64,6 +68,7 @@ View + @@ -184,6 +189,31 @@ Guide + + + Project Manager + + + + + New Project + + + + + Open Project + + + + + Save Project + + + + + Close Project + + diff --git a/sources/kbe/media/icons/pm-add.png b/sources/kbe/media/icons/pm-add.png new file mode 100644 index 0000000000000000000000000000000000000000..8a9fbd271d309f3bfb0e85fd7b4bc6ba2783e7aa GIT binary patch literal 549 zcmeAS@N?(olHy`uVBq!ia0vp^0U*r51|<6gKdoh8V0`20;uunK>+M~Cze5fp$3Mm$ zcHZ%dsr31+-t4=lUikLZ>pApr=CR%pJ|Mi|nc6z-^`6p4jXp1H)-BnmU#YFuSU1D( z7U$oID${n=zg)_{-uAPFjjRo?|1`s`GMi;~OQ`JI%K80I*|eiKwkkAkc3$l))PR;n-t^EJ>LS|jdu<72G+_ASd zKK!Y0>UF2LrQ4qQ9osn7)>|?HU01T?$qhyp0S5*~76ZNm-(UK!%4E=f_34#`?Afyk zdknmzpC_jsW7rYM^!a1u^vtMZW`@H2Tmfm*#R85oaVRt}pc1kSSKd7j{aSG?-dAk< z%w?%>GH&f(_dBkdQ=__M*55sAZO!Ae4t%{)y8hLk{_}N7$qk>@{(AF#>)l&_kGL_` zUfZxOdUqR=i6>gW?7x31vwqe_{_RDdB5(F4T62S33U)4nFj!D=L2X0Dm2CE-hudVe zp$c-uFGyD3d|0G<`)R|h4;v)}O*`jR{+MC*Z=J`c-i4+WsRq)FJ&lY#LF;Ci-xB2Z z;K)tj$Tj44yz(%YcPUFDd*miorR+!dH7eFygeYVmx~Y)-+nR^>j`@Q5zZ7rnRbB#& Oeg;ohKbLh*2~7Z!Md|SX literal 0 HcmV?d00001 diff --git a/sources/kbe/media/icons/pm-branch-closed.png b/sources/kbe/media/icons/pm-branch-closed.png new file mode 100644 index 0000000000000000000000000000000000000000..1b4f23a4e907b1f11d509437bb0f559ce3d30b3e GIT binary patch literal 212 zcmV;_04x8AP)P0 z|Bs=;Y?awM-O0MTL~GEWrvG2PTK%8Va-#&IGyqKpds3rDn4hqdsz`8>*$T6DdeilEi1sv5!Afex-34hPh=C~rl#Bp+*mt#O)~x>k O0000Oo literal 0 HcmV?d00001 diff --git a/sources/kbe/media/icons/pm-branch-more.png b/sources/kbe/media/icons/pm-branch-more.png new file mode 100644 index 0000000000000000000000000000000000000000..e74bf87190cff178f3d4d57c5d6c290395de68fa GIT binary patch literal 114 zcmeAS@N?(olHy`uVBq!ia0vp^5F!$q5RqA{(m>r)=15 zc!8%U${>reR7WF~J53|SR9R|rj-z3^fV1Ih!;2LrliYPBwl**_$gR?t^R)TkSD+yb Mp00i_>zopr00sUZ#Q*>R literal 0 HcmV?d00001 diff --git a/sources/kbe/media/icons/pm-branch-open.png b/sources/kbe/media/icons/pm-branch-open.png new file mode 100644 index 0000000000000000000000000000000000000000..41052281354c85581e44ef650a95c6434309ee5e GIT binary patch literal 222 zcmV<403rX0P)cUqyC>V4Q4CM*6B^v z`>#7$7mPt{vsGs6aB9$-uBQWZ=RfsY_5Wa8t^N{`RLfP< Y0f}^Xwv*cM;Q#;t07*qoM6N<$f*pBYB>(^b literal 0 HcmV?d00001 diff --git a/sources/kbe/media/icons/pm-collapse.png b/sources/kbe/media/icons/pm-collapse.png new file mode 100644 index 0000000000000000000000000000000000000000..ce71fcdcf55706b86f5042f136b9ad592566aa2c GIT binary patch literal 453 zcmeAS@N?(olHy`uVBq!ia0vp^0U*r51|<6gKdoh8VC?a9aSW-r_4e+@iH8gXS`$Ny zT<0iPcj&7rsy%*JRmgnGhtYw3-2vO5Is(k;Y?-Z`OK!#+&-R`_UH0a|!!r(K?GC+K z_I2G|^KEypH?Ny@?#($n$r)F^a$N7Rdd=$b;Lrpon+x-<6uW#7Q<#@7SJBx~Zv635 z?U_AGW>&m)vYfXoyJrn|t9|V6t^Yjs^Na4f6Zu$gA2;i*RUa-1NM|RVlKS{hxlL+~ zoX;NL@GM6C?ZOO#gZk!;+fH3Nb(%hq~@1*^Xocc-Y`L|QoCG64}ITRWgnD7ysXP8fI*qE~0 zIKigIM|qLK#milf->>uBX64oNy!j?aLX5^fB>6nEzQD&- z>ho6h&lA5Qd_MF=fB0R)W9zwW7hBuxw`rN*K1Hv3ectqqT((9%Ko zM=t^jXp>19V4!5q~U-tg+_jiYNcD^;eksZjI zVgFSyUq7+GL$_fo!>zBszTN0EjFP%=Bm3eFX4jC1cU}p9jJ{F#$y@2xeB156j?7`6 z?$mQsxO76?0{K}HHh~RGe<%9f7ycc(E@VouOZc1ehfINHD?hj}J?kr4^`fgzYO?kz z&BfaP3d6FF$W%O<&#v~SU5$NS#etB&2Br6dzq(kNo!Yr*^{a_>E>nE{Y)l)97tb-? z^(s!Q)y=ZJBy``@&#pSH%Rg;h=5BAY^g{^Ku3w3r`bOHAhrfbLtDnm{r-UW|r@t}8 literal 0 HcmV?d00001 diff --git a/sources/kbe/media/stylesheets/projectmanager.qss b/sources/kbe/media/stylesheets/projectmanager.qss new file mode 100644 index 0000000..dd9b946 --- /dev/null +++ b/sources/kbe/media/stylesheets/projectmanager.qss @@ -0,0 +1,23 @@ + QTreeView::branch:has-siblings:!adjoins-item { + border-image: url(:/media/icons/pm-vline.png) 0; + } + + QTreeView::branch:has-siblings:adjoins-item { + border-image: url(:/media/icons/pm-branch-more.png) 0; + } + + QTreeView::branch:!has-children:!has-siblings:adjoins-item { + border-image: url(:/media/icons/pm-branch-end.png) 0; + } + + QTreeView::branch:has-children:!has-siblings:closed, + QTreeView::branch:closed:has-children:has-siblings { + border-image: none; + image: url(:/media/icons/pm-branch-closed.png); + } + + QTreeView::branch:open:has-children:!has-siblings, + QTreeView::branch:open:has-children:has-siblings { + border-image: none; + image: url(:/media/icons/pm-branch-open.png); + } diff --git a/sources/kbe/projectmanager.cpp b/sources/kbe/projectmanager.cpp new file mode 100644 index 0000000..852f29a --- /dev/null +++ b/sources/kbe/projectmanager.cpp @@ -0,0 +1,724 @@ +#include "projectmanager.h" + +#include "pluginmanager.h" +#include "newfiledialog.h" + +#include +#include + +#include +#include +#include + +#include +#include +#include + +#include + +ProjectManagerDockWidget* ProjectManagerDockWidget::mInstance = 0; + +ProjectManagerDockWidget::ProjectManagerDockWidget(QWidget *parent) : + QDockWidget(parent) +{ + treeView = new ProjectManagerView(this); + + this->setFeatures(QDockWidget::DockWidgetVerticalTitleBar); + + QFile file(":/media/stylesheets/projectmanager.qss"); + file.open(QFile::ReadOnly); + QString styleSheet = QLatin1String(file.readAll()); + treeView->setStyleSheet(styleSheet); + + setWidget(treeView); +} + +ProjectManagerDockWidget::~ProjectManagerDockWidget() +{ + Q_ASSERT(mInstance != 0); + mInstance = 0; +} + +ProjectManagerDockWidget* ProjectManagerDockWidget::instance() +{ + if (!mInstance) + mInstance = new ProjectManagerDockWidget(); + + return mInstance; +} + +ProjectManagerView::ProjectManagerView(QWidget *parent) : + QTreeView(parent) +{ + model = new ProjectManagerModel(this); + setModel(model); + + header() -> close(); + + setContextMenuPolicy(Qt::CustomContextMenu); + + setAcceptDrops(true); + setDragEnabled(true); + setDragDropMode(QAbstractItemView::InternalMove); + setDropIndicatorShown(true); + + this->connect(this,SIGNAL(customContextMenuRequested(QPoint)), + SLOT(onContextMenuRequested(QPoint))); + +} + +void ProjectManagerView::onContextMenuRequested(QPoint mousePoint) +{ + ProjectManagerModelItem* item = model -> getItem(currentIndex()); + createContextMenu(item); +} + +void ProjectManagerView::createContextMenu(ProjectManagerModelItem* item) +{ + QMenu *menu = new QMenu; + + if (item) + switch (item->getItemType()) + { + case ProjectManagerModelItem::Unknown: + break; + case ProjectManagerModelItem::Project: + { +#ifndef Q_OS_LINUX + menu -> addAction(QIcon(), tr("Show in explorer"), this, SLOT(onShowInExplorer())); + menu -> addSeparator(); +#endif + menu -> addAction(QIcon(":/media/icons/document-save.png"), tr("Save project"), this, SLOT(onProjectSave())); + menu -> addAction(QIcon(":/media/icons/window-close.png"), tr("Close Project"),this,SLOT(onProjectClose())); + + menu -> addSeparator(); + } + case ProjectManagerModelItem::Filter: + { + menu -> addAction(QIcon(":/media/icons/pm-add.png"), tr("Add File"),this,SLOT(onAddFile())); + menu -> addAction(QIcon(":/media/icons/pm-add.png"), tr("Add Existing Files"), this, SLOT(onAddExistingFiles())); + menu -> addAction(QIcon(":/media/icons/pm-add.png"), tr("Add Filter"), this, SLOT(onAddFilter())); + + menu -> addSeparator(); + + menu -> addAction(QIcon(), tr("Rename"), this, SLOT(onRename())); + QMenu* delMenu = menu -> addMenu(QIcon(), tr("Delete")); + delMenu -> addAction(QIcon(), tr("Delete From Project"),this,SLOT(onRemove())); + delMenu -> addAction(QIcon(), tr("Delete Permanently"),this,SLOT(onRemovePermanently())); + + menu -> addSeparator(); + + menu -> addAction(QIcon(":/media/icons/pm-expand.png"),tr("Expand All"),this,SLOT(expandAll())); + menu -> addAction(QIcon(":/media/icons/pm-collapse.png"),tr("Collapse All"),this,SLOT(collapseAll())); + break; + } + case ProjectManagerModelItem::File: + { + menu -> setDefaultAction(menu -> addAction(QIcon(), tr("Open file"),this,SLOT(onOpenFile()))); + +#ifdef Q_OS_WIN + menu -> addAction(QIcon(), tr("Show in explorer"), this, SLOT(onShowInExplorer())); +#endif + + menu -> addSeparator(); + + menu -> addAction(QIcon(), tr("Rename"), this, SLOT(onFileRename())); + QMenu* delMenu = menu -> addMenu(QIcon(), tr("Delete")); + delMenu -> addAction(QIcon(), tr("Delete From Project"),this,SLOT(onRemove())); + delMenu -> addAction(QIcon(), tr("Delete Permanently"),this,SLOT(onRemovePermanently())); + + menu -> addSeparator(); + menu -> addAction(QIcon(), tr("Properties"), this, SLOT(onPropertiesShow())); + } + } + else + { + menu -> addAction(QIcon(":/media/icons/pm-expand.png"),tr("Expand All"),this,SLOT(expandAll())); + menu -> addAction(QIcon(":/media/icons/pm-collapse.png"),tr("Collapse All"),this,SLOT(collapseAll())); + + menu -> addSeparator(); + + menu -> addAction(QIcon(":/media/icons/window-close.png"),tr("Close Project"),this,SLOT(onProjectClose())); + } + menu->exec(QCursor::pos()); +} + + +void ProjectManagerView::mouseDoubleClickEvent(QMouseEvent *event) +{ + ProjectManagerModelItem* item = model->getItem(indexAt(event->pos())); + QTreeView::mouseDoubleClickEvent(event); + + if (item && item->getItemType() == ProjectManagerModelItem::File) + { + if (!QFile::exists(item->getAbsoluteFilePath())) + { + QString filter = item -> getAbsoluteFilePath().split(SEPARATOR).last(); + filter.append(" ("+filter+");;"); + filter.append(tr("Any file") + " (*." + item->getAbsoluteFilePath().split(".").last() + ")"); + QString existingFileForReplace = QFileDialog::getOpenFileName(this, tr("File not found"), item->getAbsoluteFileDir(), + filter,0,QFileDialog::DontUseNativeDialog); + if (existingFileForReplace.isNull()) + return; + else + { + QString newFilePath; + newFilePath = QDir(item->getProjectItem()->getAbsoluteSourcesDir()).relativeFilePath(existingFileForReplace); + int reply = QMessageBox::question(this, tr("Replace file path"), tr("Replace file path to \"")+newFilePath+ + tr("\" instead \"") + item->getFilePath() + "\"", QMessageBox::Yes|QMessageBox::No); + if (reply == QMessageBox::Yes) + { + if (item -> getName() != QFileInfo(existingFileForReplace).fileName()) + { + item->setObjectName(item->parent()->objectName() + SEPARATOR + QFileInfo(existingFileForReplace).fileName()); + item->setName(QFileInfo(existingFileForReplace).fileName()); + } + item->setFilePath(newFilePath); + } + else + { + emit openFile(newFilePath); + return; + } + } + } + emit openFile(item->getAbsoluteFilePath()); + } + +} + +void ProjectManagerView::updateTreeView() +{ + QModelIndexList list; + + Q_FOREACH (QModelIndex index, model->getPersistentIndexList()) + if (isExpanded(index)) + list << index; + + reset(); + + Q_FOREACH (QModelIndex index, list) + if (index.isValid()) + expand(index); +} + + +void ProjectManagerView::mousePressEvent(QMouseEvent* event) +{ + QModelIndex item = indexAt(event->pos()); + QTreeView::mousePressEvent(event); + if ((item.row() == -1 && item.column() == -1)) + { + clearSelection(); + const QModelIndex index; + selectionModel()->setCurrentIndex(index, QItemSelectionModel::Select); + } +} + + +void ProjectManagerView::onProjectNew() +{ + QString fileName = QFileDialog::getSaveFileName(this, tr("Add new project"), + QDir::current().absolutePath(), + tr("Folder"), + 0, QFileDialog::DontUseNativeDialog); + if (fileName.isEmpty()) + return; + + QFileInfo projectFileInfo(fileName); + + QString name = projectFileInfo.fileName(); + QString absPath = projectFileInfo.absoluteFilePath(); + QDir parentDir = projectFileInfo.absoluteDir(); + + if (model->getRootItem()->findChild(name)) + { + QMessageBox::warning(this,tr("Adding project error"),name+" "+tr("already exists")); + return onProjectNew(); + } + + //creating project's directory + if (parentDir.mkdir(name)) + { + parentDir = QDir(absPath); + parentDir.mkdir("sources"); + + ProjectManagerModelItem* project = new ProjectManagerModelItem(name,QFileInfo(absPath,name+".kbpro").absoluteFilePath(), + ProjectManagerModelItem::Project, + model->getRootItem()); + model->insertProject(project); + model->saveProject(project, QFileInfo(absPath,name+".kbpro").absoluteFilePath()); + emit event(ProjectCreated); + } + else + QMessageBox::critical(this, tr("Creating project error"), + tr("Can not create directory for project")); + +} + + +void ProjectManagerView::onProjectSave() +{ + if (ProjectManagerModelItem* rootItem = model->getRootItem()) + for (int i=0; i< rootItem->childCount(); i++) + { + QString fileName = rootItem->child(0)->getAbsoluteFilePath(); + + if (rootItem->child(i)->getFilePath().isEmpty() || !QFile::exists(fileName)) + { + fileName = QFileDialog::getSaveFileName(this, tr("Project file not found"), + QDir::current().absolutePath(),rootItem->child(i)->getName()+"(*.kbpro)", + 0,QFileDialog::DontUseNativeDialog); + if (fileName.isEmpty()) + continue; + + rootItem->child(i)->setFilePath(fileName); + } + model->saveProject(rootItem->child(i),fileName); + emit event(ProjectSaved); + } +} + + + +bool ProjectManagerView::onProjectClose() +{ + if (ProjectManagerModelItem* rootItem = model->getRootItem()) + while (rootItem->childCount()) + { + ProjectManagerModelItem* item = rootItem->child(0); + if (item && item->isModified()) + { + int ret = QMessageBox::warning(this, tr("Save project?"), + tr("Project") + " " + item->getName() + " " + tr("is modified but not saved. Do you want save project?"), + QMessageBox::Yes|QMessageBox::No|QMessageBox::Cancel); + switch (ret) + { + case QMessageBox::Cancel: + return false; + case QMessageBox::Yes: + { + QString fileName = item->getAbsoluteFilePath(); + + if (item->getFilePath().isEmpty() || !QFile::exists(fileName)) + { + fileName = QFileDialog::getSaveFileName(this, tr("Project file not found"), + QDir::current().absolutePath(),item->getName()+("(*.kbpro)"), + 0,QFileDialog::DontUseNativeDialog); + if (fileName.isEmpty()) + return false; + + item->setFilePath(fileName); + } + + model->saveProject(item,item->getAbsoluteFilePath()); + } + case QMessageBox::No: + break; + } + } + model->removeItem(item); + } + emit event(ProjectClosed); + return true; +} + +void ProjectManagerView::onProjectOpen() +{ + QString fileName = QFileDialog::getOpenFileName(this, tr("Choose project file"), + QDir::current().absolutePath(),tr("KBE project file")+("(*.kbpro)"), + 0,QFileDialog::DontUseNativeDialog); + if (!fileName.isEmpty()) + { + model->loadProject(fileName); + emit event(ProjectOpened); + } +} + + +void ProjectManagerView::onRemove() +{ + if (!currentIndex().isValid()) + return; + ProjectManagerModelItem* item = model->getItem(currentIndex()); + + if (item && item->getItemType() != ProjectManagerModelItem::Project) + { + model->removeItem(item); + emit event(ProjectChanged); + } +} + + +void ProjectManagerView::onRemovePermanently() +{ + if (!currentIndex().isValid()) + return; + + if (ProjectManagerModelItem* item = model->getItem(currentIndex())) + switch (item->getItemType()) + { + case ProjectManagerModelItem::File: + if (QFile::remove(item->getAbsoluteFilePath())) + onRemove(); + break; + case ProjectManagerModelItem::Filter: + permanentRemoveTree(item); + emit event(ProjectChanged); + } +} + + +void ProjectManagerView::permanentRemoveTree(ProjectManagerModelItem *item) +{ + if (!item) + return; + + while (item->childCount()) + permanentRemoveTree(item->child(0)); + + switch (item->getItemType()) + { + case ProjectManagerModelItem::File: + QFile::remove(item->getAbsoluteFilePath()); + + case ProjectManagerModelItem::Filter: + model->removeItem(item); + } + +} + + +void ProjectManagerView::renameItem(ProjectManagerModelItem *item, QString newName) +{ + if (item && item->parent()) + { + QString objName = item -> objectName(); + QString itemName = item -> getName(); + objName.replace(objName.length()-itemName.length(),itemName.length(), newName); + item -> setName(newName); + } +} + + +QString ProjectManagerView::onRename() +{ + if (!currentIndex().isValid()) + return QString(); + ProjectManagerModelItem* item = model->getItem(currentIndex()); + QString itemName(item->getName()); + + bool isAccepted = true; + QString newName = QInputDialog::getText(this,tr("Rename"),tr("Please type new name for ")+itemName, + QLineEdit::Normal,itemName,&isAccepted,Qt::Dialog); + + if (isAccepted && !newName.isEmpty() && newName != itemName) + { + if (item->parent() && item->parent()->findChild(item->parent()->objectName()+"/"+newName)) + { + QMessageBox::warning(this,tr("Rename error"),item->parent()->getName()+ " " + tr("already has") + " " + newName); + return onRename(); + } + emit event(ProjectChanged); + if (item -> getItemType() <= ProjectManagerModelItem::Filter) + renameItem(item,newName); + return newName; + } + else + return itemName; +} + + +void ProjectManagerView::onFileRename() +{ + if (!currentIndex().isValid()) + return; + + ProjectManagerModelItem* item = model->getItem(currentIndex()); + + QString newName = onRename(); + + QFileInfo currentFileInfo(item->getAbsoluteFilePath()); + + if (!currentFileInfo.exists()) + { + QMessageBox::critical(this,tr("Rename critical error"),tr("File not found on storage: ") + currentFileInfo.absoluteFilePath()); + return; + } + + QFileInfo newFile(currentFileInfo.absoluteDir(),newName); + + if (newFile.exists()) + { + QMessageBox::warning(this,tr("Rename error"),newName + tr(" already exists in ") + currentFileInfo.absolutePath()); + onFileRename(); + return; + } + + if (!QFile::rename(currentFileInfo.absoluteFilePath(),newFile.absoluteFilePath())) + QMessageBox::critical(this,tr("Rename critical error"),tr("Unknown error")); + else + { + renameItem(item,newName); + emit event(ProjectChanged); + } +} + + +void ProjectManagerView::onAddFilter() +{ + if (!currentIndex().isValid()) + return; + + ProjectManagerModelItem* item = model->getItem(currentIndex()); + + bool isAccepted = true; + QString name = QInputDialog::getText(this,tr("Add new filter"),tr("Please type name of new filter in") + " " + item->getName(), + QLineEdit::Normal, QString(),&isAccepted,Qt::Dialog); + if (isAccepted && !name.isEmpty()) + { + QString fullName = item->objectName() + SEPARATOR + name; + if (item->parent() && item->parent()->findChild(fullName)) + { + QMessageBox::warning(this,tr("Adding filter error"),item->parent()->getName() + " " + tr("already has") + " " + name); + return onAddFilter(); + } + + QDir sourcesDir = item->getAbsoluteSourcesDir(); + qDebug() << sourcesDir.absolutePath(); + if (!sourcesDir.exists()) + if (! QDir(item->getProjectItem()->getAbsoluteFileDir()).mkdir("sources")) + { + QMessageBox::critical(this, tr("Adding filter error"), tr("Can not create sources directory")); + return; + } + + QStringList localStorageDirsList = fullName.split(SEPARATOR); + localStorageDirsList.removeFirst(); + + QString localStorageDirPath = localStorageDirsList.join(SEPARATOR); + if (sourcesDir.mkpath(localStorageDirPath) || QDir(QFileInfo(sourcesDir.absolutePath(),localStorageDirPath).absolutePath()).exists()) + { + + model->insertItem(fullName,localStorageDirPath,ProjectManagerModelItem::Filter); + emit event(ProjectChanged); + + if (!isExpanded(currentIndex())) + expand(currentIndex()); + + updateTreeView(); + } else + QMessageBox::critical(this, tr("Adding filter error"), tr("Can not create filter directory")); + + } +} + + +void ProjectManagerView::onAddExistingFiles() +{ + if (!currentIndex().isValid()) + return; + + ProjectManagerModelItem* filterItem = model->getItem(currentIndex()); + QString filterDirectory; + if (filterItem->getItemType()==ProjectManagerModelItem::Project) + filterDirectory = filterItem->getAbsoluteSourcesDir().absolutePath(); + else + filterDirectory = filterItem->getAbsoluteFileDir(); + + QStringList files = QFileDialog::getOpenFileNames(this,tr("Add existing files"), + filterDirectory, + PluginManager::instance()->openFilters(), + 0,QFileDialog::DontUseNativeDialog); + QStringList errors; + Q_FOREACH(QString filePath, files) + { + + QString absoluteFilePath; + if (!filePath.contains(filterItem->getAbsoluteSourcesDir().absolutePath())) + { + absoluteFilePath = QFileInfo(filterDirectory, QFileInfo(filePath).fileName()).absoluteFilePath(); + if (!QFile::copy(filePath, absoluteFilePath)) + { + errors.append( tr("Can not copy file to sources: ") + filePath); + continue; + } + } + else + absoluteFilePath = filePath; + + QString relativeFilePath = filterItem->getAbsoluteSourcesDir().relativeFilePath(absoluteFilePath); + QString shownName = filterItem->getProjectItem()->objectName() + SEPARATOR + relativeFilePath; + + if (ProjectManagerModelItem* findedItem = model->getItemByFilePath( relativeFilePath, filterItem->getProjectItem())) + errors.append( relativeFilePath + " " + tr("already exists in project as") + " " + findedItem->objectName()); + else + { + model->insertItem(shownName,relativeFilePath,ProjectManagerModelItem::File); + emit event(ProjectChanged); + } + + if (!isExpanded(currentIndex())) + setExpanded(currentIndex(), true); + } + + updateTreeView(); + + if (!errors.isEmpty()) + QMessageBox::warning(this,tr("Add existing files error"),tr("Adding has some errors:") + "\n" + errors.join("\n")); +} + + +void ProjectManagerView::onAddFile() +{ + if (!currentIndex().isValid()) + return; + ProjectManagerModelItem* item = model->getItem(currentIndex()); + + QString selectedFilter; + QString absoluteFilePath = QFileDialog::getSaveFileName(this,tr("Add file"), + item->getAbsoluteFileDir(), + PluginManager::instance()->openFilters(), + &selectedFilter, + QFileDialog::DontUseNativeDialog); + + if (absoluteFilePath.isEmpty()) + return; + + int pos = selectedFilter.indexOf("*."); + Q_ASSERT_X(pos != -1, "ProjectManagerView::onAddFile", "Can't find begin of extension"); + pos++; + int pos2 = selectedFilter.indexOf(")", pos); + Q_ASSERT_X(pos != -1, "ProjectManagerView::onAddFile", "Can't find end of extension"); + + QString ext = selectedFilter.mid(pos,pos2-pos).trimmed(); + if (!absoluteFilePath.contains(ext,Qt::CaseInsensitive)) + absoluteFilePath.append(ext); + + if (QFile::exists(absoluteFilePath)) + QFile::remove(absoluteFilePath); + + QString relativeFilePath = item->getAbsoluteSourcesDir().relativeFilePath(absoluteFilePath); + QString shownName = item->getProjectItem()->objectName() + SEPARATOR + relativeFilePath; + + + if (ProjectManagerModelItem* findedItem = model->getItemByFilePath( relativeFilePath, item->getProjectItem())) + model->removeItem(findedItem); + + model->insertItem(shownName,relativeFilePath,ProjectManagerModelItem::File); + + if (!isExpanded(currentIndex())) + setExpanded(currentIndex(), true); + updateTreeView(); + + emit event(ProjectChanged); + emit openFile(absoluteFilePath); +} + + +void ProjectManagerView::onOpenFile() +{ + ProjectManagerModelItem* item = model->getItem(currentIndex()); + + if (item && item->getItemType() == ProjectManagerModelItem::File) + { + if (!QFile::exists(item->getAbsoluteFilePath())) + { + QString filter = item -> getAbsoluteFilePath().split(SEPARATOR).last(); + filter.append(" ("+filter+");;"); + filter.append(tr("Any file") + " (*." + item->getAbsoluteFilePath().split(".").last() + ")"); + QString existingFileForReplace = QFileDialog::getOpenFileName(this, tr("File not found"), item->getAbsoluteFileDir(), + filter,0,QFileDialog::DontUseNativeDialog); + if (existingFileForReplace.isNull()) + return; + else + { + QString newFilePath; + newFilePath = QDir(item->getProjectItem()->getAbsoluteSourcesDir()).relativeFilePath(existingFileForReplace); + int reply = QMessageBox::question(this, tr("Replace file path"), tr("Replace file path to \"")+newFilePath+ + tr("\" instead \"") + item->getFilePath() + "\"", QMessageBox::Yes|QMessageBox::No); + if (reply == QMessageBox::Yes) + { + if (item -> getName() != QFileInfo(existingFileForReplace).fileName()) + { + item->setObjectName(item->parent()->objectName() + SEPARATOR + QFileInfo(existingFileForReplace).fileName()); + item->setName(QFileInfo(existingFileForReplace).fileName()); + } + item->setFilePath(newFilePath); + } + else + { + emit openFile(newFilePath); + return; + } + } + } + emit openFile(item->getAbsoluteFilePath()); + } + +} + + +void ProjectManagerView::onShowInExplorer() +{ + QString pathIn; + if (!currentIndex().isValid()) + return; + ProjectManagerModelItem* item = model->getItem(currentIndex()); + if (item && !item->getFilePath().isEmpty()) + pathIn = item->getAbsoluteFilePath(); + else + return; + + #ifdef defined(Q_OS_WIN) + const QString explorer = "explorer"; + QString param; + if (!QFileInfo(pathIn).isDir()) + param = QLatin1String("/select,"); + param += QDir::toNativeSeparators(pathIn); + QProcess::startDetached(explorer, QStringList(param)); + #elif defined(Q_OS_MAC) + + QStringList scriptArgs; + scriptArgs << QLatin1String("-e") + << QString::fromLatin1("tell application \"Finder\" to reveal POSIX file \"%1\"") + .arg(pathIn); + QProcess::execute(QLatin1String("/usr/bin/osascript"), scriptArgs); + scriptArgs.clear(); + scriptArgs << QLatin1String("-e") + << QLatin1String("tell application \"Finder\" to activate"); + QProcess::execute("/usr/bin/osascript", scriptArgs); + #endif + +// Todo: opening file in filemanager for Linux +/*#else + const QFileInfo fileInfo(pathIn); + const QString folder = fileInfo.absoluteFilePath(); + const QString app = Utils::UnixUtils::fileBrowser(Core::ICore::instance()->settings()); + QProcess browserProc; + const QString browserArgs = Utils::UnixUtils::substituteFileBrowserParameters(app, folder); + if (debug) + qDebug() << browserArgs; + bool success = browserProc.startDetached(browserArgs); + const QString error = QString::fromLocal8Bit(browserProc.readAllStandardError()); + success = success && error.isEmpty(); + if (!success) + showGraphicalShellError(this, app, error); + #endif +*/ +} + + +void ProjectManagerView::onPropertiesShow() +{ + if (!currentIndex().isValid()) + return; + if (ProjectManagerModelItem* item = model->getItem(currentIndex())) + { + QStringList properties; + properties << tr("Item:") + "\t\t" + item->objectName(); + properties << tr("File:") + "\t\t" + item->getAbsoluteFilePath(); + properties << tr("Size:") + "\t\t" + QString::number(QFileInfo(item->getAbsoluteFilePath()).size()) << "bytes"; + QMessageBox::information(this,tr("Properties"),properties.join("\n")); + } +} diff --git a/sources/kbe/projectmanager.h b/sources/kbe/projectmanager.h new file mode 100644 index 0000000..6bd5cdc --- /dev/null +++ b/sources/kbe/projectmanager.h @@ -0,0 +1,105 @@ +#ifndef PROJECTMANAGER_H +#define PROJECTMANAGER_H + +#include +#include + +#include "projectmanagermodel.h" + +class QMouseEvent; +class ProjectManagerView; +class ProjectManagerModel; +class ProjectManagerModelItem; + +class ProjectManagerDockWidget : public QDockWidget +{ + Q_OBJECT +public: + explicit ProjectManagerDockWidget(QWidget *parent = 0); + virtual ~ProjectManagerDockWidget(); + + static ProjectManagerDockWidget* instance(); + + ProjectManagerView* getTreeView() { return treeView; } +private: + static ProjectManagerDockWidget* mInstance; + + //! Content of this widget + ProjectManagerView *treeView; +}; + +class ProjectManagerView : public QTreeView +{ + Q_OBJECT + +public: + enum ProjectManagerEvent { + DefaultEvent, + ProjectCreated, + ProjectOpened, + ProjectSaved, + ProjectClosed, + ProjectChanged + }; + Q_ENUMS(ProjectManagerEvent) + + explicit ProjectManagerView(QWidget *parent = 0); + +public slots: + void onContextMenuRequested(QPoint); + void onProjectNew(); + void onProjectOpen(); + void onProjectSave(); + bool onProjectClose(); + void onRemove(); + void onRemovePermanently(); + QString onRename(); + void onFileRename(); + void onAddFilter(); + void onAddExistingFiles(); + void onAddFile(); + void onOpenFile(); + void onShowInExplorer(); + void onPropertiesShow(); + +signals: + /*! This signal will send when ProjectManager requests opening some file. + * @param Filename + */ + void openFile(QString); + + /*! This signal will send when ProjectManager modified(or managed) project. + * @param Filename + */ + void event(ProjectManagerView::ProjectManagerEvent); + +private: + /*! Changes item name + * @param item Item which name will be changed + * @param newName new name for item + */ + void renameItem(ProjectManagerModelItem* item, QString newName); + + /*! Removes item and his childs from localstorage and view + * @param item Item which will be removed + */ + void permanentRemoveTree(ProjectManagerModelItem* item); + + /*! Creates context menu which appears for item + * @param item Item for which menu will be appear + */ + void createContextMenu(ProjectManagerModelItem* item); + + //! QTreeView::mousePressEvent with feature that item's focus will be removed if click occured on empty area + void mousePressEvent(QMouseEvent*); + + //! Opens file if double clicked item's type is file + void mouseDoubleClickEvent(QMouseEvent *event); + + void updateTreeView(); + +private: + ProjectManagerModel* model; +}; + +#endif // PROJECTMANAGER_H diff --git a/sources/kbe/projectmanagermodel.cpp b/sources/kbe/projectmanagermodel.cpp new file mode 100644 index 0000000..dae0efb --- /dev/null +++ b/sources/kbe/projectmanagermodel.cpp @@ -0,0 +1,624 @@ +#include "projectmanagermodel.h" + +#include +#include + +#include +#include +#include + +#include +#include +#include + +#include + +#define MIME_FORMAT "application/kbe.project.item.list" + +#define TAG_PROJECT "KBEProject" +#define TAG_ATTR_NAME "name" +#define TAG_FILE "file" +#define TAG_ATTR_PATH "path" +#define TAG_ATTR_FILTER "filter" + +ProjectManagerModel::ProjectManagerModel(QObject *parent) + : QAbstractItemModel(parent) +{ + rootItem = new ProjectManagerModelItem(); +} + +ProjectManagerModel::~ProjectManagerModel() +{ + delete rootItem; +} + +int ProjectManagerModel::columnCount(const QModelIndex &parent) const +{ + if (parent.isValid()) + return static_cast(parent.internalPointer())->columnCount(); + else + return rootItem->columnCount(); +} + +QModelIndexList ProjectManagerModel::getPersistentIndexList() const +{ + return persistentIndexList(); +} + +QVariant ProjectManagerModel::data(const QModelIndex &index, int role) const +{ + if (!index.isValid()) + return QVariant(); + + if (role != Qt::DisplayRole) + return QVariant(); + + ProjectManagerModelItem *item = static_cast(index.internalPointer()); + + return item->data(index.column()); +} + +Qt::DropActions ProjectManagerModel::supportedDropActions() const +{ + return Qt::MoveAction; +} + +QStringList ProjectManagerModel::mimeTypes() const +{ + QStringList types; + types << MIME_FORMAT; + return types; +} + +QMimeData *ProjectManagerModel::mimeData(const QModelIndexList &indexes) const +{ + QMimeData *mimeData = new QMimeData(); + QByteArray encodedData; + + QDataStream stream(&encodedData, QIODevice::WriteOnly); + QList urlList; + + Q_FOREACH (QModelIndex index, indexes) + { + if (index.isValid() && !index.column()) + if (ProjectManagerModelItem* item = getItem(index)) + { + + QString objectName = item->objectName(); + QString shownName = item->getName(); + QString filePath = item->getAbsoluteFilePath(); + ProjectManagerModelItem::ItemType type = item->getItemType(); + + stream << objectName << shownName << filePath << type; + urlList.append(QUrl::fromLocalFile(filePath)); + } + } + + mimeData->setData("application/kbe.project.item.list", encodedData); + mimeData->setUrls(urlList); + + return mimeData; +} + +bool ProjectManagerModel::dropMimeData(const QMimeData *data, + Qt::DropAction action, int row, int column, const QModelIndex &parent) +{ + if (action == Qt::IgnoreAction) + return true; + + if (!data->hasFormat(MIME_FORMAT) || !parent.isValid()) + return false; + + if (ProjectManagerModelItem* item = getItem(parent)) + { + QByteArray encodedData = data->data(MIME_FORMAT); + QDataStream stream(&encodedData, QIODevice::ReadOnly); + QList< QPair > newItems; + + while (!stream.atEnd()) + { + QString lastObjectName; + QString shownName; + QString absoluteFilePath; + int n_itemType; + ProjectManagerModelItem::ItemType itemType; + + stream >> lastObjectName; + stream >> shownName; + stream >> absoluteFilePath; + stream >> n_itemType; + + itemType = static_cast(n_itemType); + + ProjectManagerModelItem* newItem = new ProjectManagerModelItem(shownName,absoluteFilePath,itemType); + QString lastPath(lastObjectName); + + newItems << QPair(newItem,lastPath); + } + + for (int i=0; iobjectName() + SEPARATOR + newItem->getName(); + QString filePath = QDir(item->getProjectItem()->getAbsoluteFileDir()).relativeFilePath(newItem->getFilePath()); + + if (shownName.split(SEPARATOR).first()!=lastName.split(SEPARATOR).first()) + return false; + + QString newAbsoluteFilePath = QFileInfo(item->getAbsoluteFileDir(), newItem->getName()).absoluteFilePath(); + + if (QFile::copy(newItem->getFilePath(),newAbsoluteFilePath)) + { + qDebug() << newItem->getFilePath(); + QFile::remove(newItem->getFilePath()); + removeItem(lastName); + insertItem(shownName,filePath,newItem->getItemType()); + + } + } + return true; + } + return false; +} + +void ProjectManagerModel::loadProject(QString filePath) +{ + if (filePath.isEmpty()) + return; + + ProjectManagerModelItem* projectItem = NULL; + + QFile proFile(filePath); + + if (proFile.open(QFile::ReadOnly)) + { + QXmlStreamReader rStream(&proFile); + + while (!rStream.atEnd() && !rStream.hasError()) + { + rStream.readNextStartElement(); + if (rStream.name()==TAG_PROJECT && rStream.isStartElement()) + { + if (projectItem) + { + removeItem(projectItem); + break; + } + QString shownName = rStream.attributes().value(TAG_ATTR_NAME).toString(); + QString fileName = proFile.fileName(); + + if (rootItem->findChild(shownName)) + return; + + projectItem = new ProjectManagerModelItem(shownName, fileName, + ProjectManagerModelItem::Project, rootItem); + projectItem->setObjectName(shownName); + + insertProject(projectItem); + } + + if (rStream.name()==TAG_FILE && rStream.isStartElement()) + { + QString fileName = rStream.attributes().value(TAG_ATTR_PATH).toString(); + QString filter = rStream.attributes().value(TAG_ATTR_FILTER).toString(); + + if (!filter.isEmpty()) + filter.push_front(SEPARATOR); + + QString newObjectName = projectItem->objectName()+ filter + SEPARATOR + fileName.split(SEPARATOR).last(); + + addChild(newObjectName, fileName, ProjectManagerModelItem::File, rootItem); + } + } + projectItem->setModified(false); + proFile.close(); + } +} + +void ProjectManagerModel::saveProject(ProjectManagerModelItem *project, QString filePath) +{ + if (!project || filePath.isEmpty()) + return; + + QFile proFile(filePath); + if (proFile.open(QFile::WriteOnly)) + { + QXmlStreamWriter wStream(&proFile); + wStream.setAutoFormatting(true); + wStream.setAutoFormattingIndent(4); + + wStream.writeStartDocument(); + + wStream.writeStartElement(TAG_PROJECT); + wStream.writeAttribute(TAG_ATTR_NAME, project->getName()); + saveChilds(project,wStream); + wStream.writeEndElement(); + + wStream.writeEndDocument(); + + proFile.close(); + + project -> setModified(false); + } +} + +void ProjectManagerModel::saveChilds(ProjectManagerModelItem *item, QXmlStreamWriter &wStream) +{ + if (!item) + return; + + for (int i=0; ichildCount(); i++) + saveChilds(item->child(i),wStream); + + if (item->getItemType() == ProjectManagerModelItem::Project || + item->getItemType() == ProjectManagerModelItem::Filter) + return; + + wStream.writeStartElement(TAG_FILE); + QStringList filterPath = item->objectName().split(SEPARATOR); + filterPath.pop_back(); + filterPath.pop_front(); + if (filterPath.count()) + wStream.writeAttribute(TAG_ATTR_FILTER,filterPath.join(SEPARATOR)); + wStream.writeAttribute(TAG_ATTR_PATH,item->getFilePath()); + + wStream.writeEndElement(); +} + +void ProjectManagerModel::insertItem(const QString shownName, const QString filePath, ProjectManagerModelItem::ItemType type) +{ + QStringList path = shownName.split(SEPARATOR); + + path.pop_back(); + + ProjectManagerModelItem* neededFilter = getPath(path,rootItem); + + if (!neededFilter) + return; + + beginInsertRows(createIndex(0,0,neededFilter), + neededFilter->childCount(), + neededFilter->childCount()+1); + + addChild(shownName,filePath,type,rootItem); + + endInsertRows(); +} + +void ProjectManagerModel::insertProject(ProjectManagerModelItem *item) +{ + beginInsertRows(QModelIndex(), + 0, + 1); + + rootItem -> appendChild(item); + + endInsertRows(); +} + +void ProjectManagerModel::removeItem(ProjectManagerModelItem *item) +{ + if (item==NULL) + return; + QModelIndex index = createIndex(0,0,item); + if (index.isValid()) + { + beginRemoveRows(index,0,item->childCount()); + + item->parent()->removeChild(item); + + endRemoveRows(); + } +} + +void ProjectManagerModel::removeItem(QString itemObjectName) +{ + if (itemObjectName.isNull() || itemObjectName.isEmpty()) + return; + + if (ProjectManagerModelItem* item = getRootItem()->findChild(itemObjectName)) + { + QModelIndex index = createIndex(0,0,item); + if (index.isValid()) + { + beginRemoveRows(index,0,item->childCount()); + + item->parent()->removeChild(item); + + endRemoveRows(); + } + } +} + +Qt::ItemFlags ProjectManagerModel::flags(const QModelIndex &index) const +{ + if (!index.isValid()) + return 0; + + if (ProjectManagerModelItem* item = getItem(index)) + switch (item->getItemType()) + { + case ProjectManagerModelItem::Project: + return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsDropEnabled; + case ProjectManagerModelItem::Filter: + return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled; + case ProjectManagerModelItem::File: + return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsDragEnabled; + case ProjectManagerModelItem::Unknown: + return Qt::ItemIsEnabled; + } + + return 0; +} + +QVariant ProjectManagerModel::headerData(int section, Qt::Orientation orientation, + int role) const +{ + if (orientation == Qt::Horizontal && role == Qt::DisplayRole) + return rootItem->data(section); + + return QVariant(); +} + +QModelIndex ProjectManagerModel::index(int row, int column, const QModelIndex &parent) + const +{ + if (!hasIndex(row, column, parent)) + return QModelIndex(); + + ProjectManagerModelItem *parentItem; + + if (!parent.isValid()) + parentItem = rootItem; + else + parentItem = getItem(parent); + + if (ProjectManagerModelItem *childItem = parentItem->child(row)) + return createIndex(row, column, childItem); + + return QModelIndex(); +} + +QModelIndex ProjectManagerModel::parent(const QModelIndex &index) const +{ + if (!index.isValid()) + return QModelIndex(); + + if (ProjectManagerModelItem *parentItem = getItem(index)->parent()) + { + if (parentItem == rootItem) + return QModelIndex(); + return createIndex(parentItem->row(), 0, parentItem); + } + + return QModelIndex(); +} + +int ProjectManagerModel::rowCount(const QModelIndex &parent) const +{ + ProjectManagerModelItem *parentItem; + + if (parent.column() > 0) + return 0; + + if (!parent.isValid()) + parentItem = rootItem; + else + parentItem = getItem(parent); + + return parentItem->childCount(); +} + +ProjectManagerModelItem* ProjectManagerModel::getItem(const QModelIndex &index) const +{ + if (index.isValid()) + if (ProjectManagerModelItem* item = static_cast(index.internalPointer())) + return item; + + return NULL; +} + +ProjectManagerModelItem* ProjectManagerModel::getRootItem() +{ + return rootItem; +} + +ProjectManagerModelItem* ProjectManagerModel::getItemByFilePath(QString filePath, ProjectManagerModelItem *parent) +{ + if (parent) + { + for (int i=0; ichildCount(); i++) + { + if (filePath == parent->child(i)->getFilePath()) + return parent->child(i); + + if (ProjectManagerModelItem* item = getItemByFilePath(filePath,parent->child(i))) + return item; + } + } + return NULL; +} + +ProjectManagerModelItem* ProjectManagerModel::addChild(const QString shownName, const QString filePath, + ProjectManagerModelItem::ItemType type, ProjectManagerModelItem* rootItem) +{ + ProjectManagerModelItem* item = NULL; + QStringList path = shownName.split(SEPARATOR); + QString name = path.last(); + + if (ProjectManagerModelItem* existingChild = getPath(QStringList(shownName.split(SEPARATOR).first()),rootItem) -> findChild(shownName)) + return existingChild; + + path.pop_back(); + + if (ProjectManagerModelItem* neededFilter = getPath(path,rootItem)) + { + item = new ProjectManagerModelItem(name,filePath,type,neededFilter); + item -> setObjectName(shownName); + neededFilter -> appendChild(item); + } + + return item; +} + +ProjectManagerModelItem* ProjectManagerModel::getPath(QStringList path, ProjectManagerModelItem *parent) +{ + if (path.isEmpty()) + return parent; + + QString neededItemObjectName = path.first(); + + if (!neededItemObjectName.isEmpty()) + { + if (!parent->objectName().isEmpty()) + neededItemObjectName.push_front(parent->objectName()+SEPARATOR); + if (ProjectManagerModelItem* item = parent -> findChild(neededItemObjectName)) + { + path.pop_front(); + return getPath(path, item); + } else + { + QString relativeDirPath; + if (parent -> getItemType() == ProjectManagerModelItem::Project) + relativeDirPath = path.first(); + else + relativeDirPath = parent->getAbsoluteSourcesDir().relativeFilePath(QFileInfo(parent->getAbsoluteFilePath(),path.first()).absoluteFilePath()); + + ProjectManagerModelItem* newItem = new ProjectManagerModelItem(path.first(),relativeDirPath,ProjectManagerModelItem::Filter,parent); + newItem -> setObjectName(neededItemObjectName); + parent -> appendChild(newItem); + path.pop_front(); + return getPath(path,newItem); + } + } + return parent; +} + +QModelIndex ProjectManagerModel::getParentModelIndex(ProjectManagerModelItem* item) +{ + if (item->parent()) + return createIndex(0,0,item->parent()); + return QModelIndex(); +} + +ProjectManagerModelItem::ProjectManagerModelItem(QObject *parent): + QObject(parent), m_isModified(false) +{ + parentItem = NULL; +} + +ProjectManagerModelItem::ProjectManagerModelItem(QString shownName, QString filePath, ItemType type, ProjectManagerModelItem *parent): + QObject(parent), m_isModified(false) +{ + parentItem = parent; + + setObjectName(shownName); + + this -> shownName = shownName; + this -> filePath = filePath; + this -> type = type; +} + +ProjectManagerModelItem::~ProjectManagerModelItem() +{ + qDeleteAll(childItems); +} + +void ProjectManagerModelItem::appendChild(ProjectManagerModelItem *item) +{ + if (getProjectItem()) + getProjectItem()->setModified(true); + childItems.append(item); +} + +void ProjectManagerModelItem::removeChild(ProjectManagerModelItem *child) +{ + if (!child) + return; + + childItems.removeOne(child); + for (int i=0; i< child -> childCount(); i++) + child->removeChild(child->child(i)); + child->setObjectName(""); + + if (getProjectItem()) + getProjectItem()->setModified(true); +} + +ProjectManagerModelItem *ProjectManagerModelItem::child(int row) +{ + return childItems.value(row); +} + +int ProjectManagerModelItem::childCount() const +{ + return childItems.count(); +} + +int ProjectManagerModelItem::columnCount() const +{ + return 1; +} + +QVariant ProjectManagerModelItem::data(int column) const +{ + return shownName; +} + +ProjectManagerModelItem *ProjectManagerModelItem::parent() +{ + return parentItem; +} + +ProjectManagerModelItem* ProjectManagerModelItem::getProjectItem() +{ + ProjectManagerModelItem* projectItem = this; + while (projectItem && projectItem -> type != ProjectManagerModelItem::Project) + projectItem = projectItem->parent(); + + return projectItem; +} + +void ProjectManagerModelItem::setFilePath(QString filePath) +{ + this->filePath = filePath; +} + +QString ProjectManagerModelItem::getAbsoluteFilePath() +{ + switch(type) + { + case Project: + return QFileInfo(filePath).absoluteFilePath(); + case Filter: + case File: + return QFileInfo(getAbsoluteSourcesDir().absolutePath(),filePath).absoluteFilePath(); + default: + return QString(); + } +} + +QString ProjectManagerModelItem::getAbsoluteFileDir() +{ + if (this->getItemType() == Project) + return QFileInfo(getAbsoluteFilePath()).absoluteDir().absolutePath(); + if (this->getItemType() != Filter) + return QFileInfo(getAbsoluteFilePath()).absoluteDir().absolutePath(); + else + return getAbsoluteFilePath(); +} + +QDir ProjectManagerModelItem::getAbsoluteSourcesDir() +{ + return QDir(QFileInfo(this->getProjectItem()->getAbsoluteFileDir(),"sources").absoluteFilePath()); +} + +int ProjectManagerModelItem::row() const +{ + if (parentItem) + return parentItem->childItems.indexOf(const_cast(this)); + + return 1; +} diff --git a/sources/kbe/projectmanagermodel.h b/sources/kbe/projectmanagermodel.h new file mode 100644 index 0000000..74ed0c9 --- /dev/null +++ b/sources/kbe/projectmanagermodel.h @@ -0,0 +1,203 @@ +#ifndef PROJECTMANAGERTREEVIEW_H +#define PROJECTMANAGERTREEVIEW_H + +#include +#include +#include + +#include + +#define SEPARATOR "/" + +class QXmlStreamWriter; +class QModelIndex; +class QDir; + +class ProjectManagerModelItem: public QObject +{ + Q_OBJECT + +public: + /* Types of item */ + enum ItemType { + Unknown, + Project, + Filter, + File + }; + + Q_ENUMS(ItemType) + + ProjectManagerModelItem(QObject* parent=0); + ProjectManagerModelItem(QString shownName, QString filePath, ItemType type, ProjectManagerModelItem *parent = 0); + ~ProjectManagerModelItem(); + + /*! Appends child in childItems list + * @param child Item which will be appeded + */ + void appendChild(ProjectManagerModelItem *child); + + /*! Removes child from childItems list + * @param child Item which will be removed + */ + void removeChild(ProjectManagerModelItem* child); + + ProjectManagerModelItem* child(int row); + int childCount() const; + int columnCount() const; + QVariant data(int column) const; + int row() const; + + //! Returns item's parent + ProjectManagerModelItem* parent(); + + //! Returns project item which contains this item + ProjectManagerModelItem* getProjectItem(); + + //! Returns absolute file path of current item + QString getAbsoluteFilePath(); + + //! Returns absolute path to directory which contains current item + QString getAbsoluteFileDir(); + + //! Returns absolute directory to directory which contains sources of project + QDir getAbsoluteSourcesDir(); + + ItemType getItemType() const { return type; } + QString getFilePath() const { return filePath; } + void setFilePath(QString filePath); + QString getName() const { return shownName.toString(); } + void setName(QString name) { shownName = name; } + bool isModified() const { return m_isModified; } + void setModified(bool val) { m_isModified = val; } + +private: + //! Flag which indicates that item is modified + bool m_isModified; + + //! Pointer to parent + ProjectManagerModelItem *parentItem; + //! List of item's child + QList childItems; + + //Object name contains full path to item and shown name + + //! Name which will be shown in view + QVariant shownName; + //! Relative(for files) or Absolute(for projects) path + QString filePath; + //! Type of item + ItemType type; +}; + + + +class ProjectManagerModel : public QAbstractItemModel +{ + Q_OBJECT + +public: + ProjectManagerModel(QObject *parent); + ~ProjectManagerModel(); + + /*! Adds child to model + * @param shownName Item's name which contain all filters and project name. Finally will be shown name without adds + * @param filePath Relative(for files) or Absolute(for projects) path to real file + * @param type Item's type + * @param rootItem Model's root item + */ + ProjectManagerModelItem* addChild(const QString shownName, const QString filePath, ProjectManagerModelItem::ItemType type, ProjectManagerModelItem* rootItem); + + /*! Removes item from model + * @param item which will be removed from model + */ + void removeItem(ProjectManagerModelItem* item); + + /*! Removes item from model by objectName + * @param itemObjectName Item's objectName + */ + void removeItem(QString itemObjectName); + + /*! Inserts item to model + * @param shownName Item's name which contain all filters and project name. Finally will be shown name without adds + * @param filePath Relative(for files) or Absolute(for projects) path to real file + * @param type Item's type + */ + void insertItem(const QString shownName, const QString filePath, ProjectManagerModelItem::ItemType type); + + /*! Inserts project item to model + * @param item Project item which will be inserted in model + */ + void insertProject(ProjectManagerModelItem* item); + + + //! Returns model's root item + ProjectManagerModelItem* getRootItem(); + + /*! Returns item of parent by filePath + * @param filePath Path to item's file on local storage + * @param parent item which seek to item + */ + ProjectManagerModelItem* getItemByFilePath(QString filePath, ProjectManagerModelItem* parent); + + + /*! Returns QModelIndex of item's parent + * @param item which parent is needed + */ + QModelIndex getParentModelIndex(ProjectManagerModelItem* item); + + + /*! Loads project to model by filePath + * @param filePath Path to project file + */ + void loadProject(QString filePath); + + /*! Saves project from model + * @param project Project which will be saved + * @param filePath Path to file in which will be saved project + */ + void saveProject(ProjectManagerModelItem* project,QString filePath=0); + + QStringList mimeTypes() const; + QMimeData* mimeData(const QModelIndexList &indexes) const; + bool dropMimeData(const QMimeData *data, + Qt::DropAction action, int row, int column, const QModelIndex &parent); + Qt::DropActions supportedDropActions() const; + + //! Converts index to PrijectManagerModelItem + ProjectManagerModelItem* getItem(const QModelIndex &index) const; + + QVariant data(const QModelIndex &index, int role) const; + Qt::ItemFlags flags(const QModelIndex &index) const; + QVariant headerData(int section, Qt::Orientation orientation, + int role = Qt::DisplayRole) const; + QModelIndex index(int row, int column, + const QModelIndex &parent = QModelIndex()) const; + QModelIndex parent(const QModelIndex &index) const; + int rowCount(const QModelIndex &parent = QModelIndex()) const; + int columnCount(const QModelIndex &parent = QModelIndex()) const; + QModelIndexList getPersistentIndexList() const; + +private: + + /*! Recoursivly saves item with childs to stream + * @param item Item which be saved + * @param wStream Stream in which item will be saved + */ + void saveChilds(ProjectManagerModelItem* item, QXmlStreamWriter& wStream); + + + /*! Creates path(filters) in model and returns pointer for tale + * @param path Path which will be created in model + * @param parent Item which will be used to find or create next filter + * \return Pointer to last created item (path's tale) + */ + ProjectManagerModelItem* getPath(QStringList path, ProjectManagerModelItem *parent); + +private: + //! Model's root item + ProjectManagerModelItem *rootItem; + +}; + +#endif // PROJECTMANAGERTREEVIEW_H diff --git a/sources/kbe/ui_mainwindow.h b/sources/kbe/ui_mainwindow.h index 12d5b29..987c5ba 100644 --- a/sources/kbe/ui_mainwindow.h +++ b/sources/kbe/ui_mainwindow.h @@ -1,7 +1,7 @@ /******************************************************************************** ** Form generated from reading UI file 'mainwindow.ui' ** -** Created: Thu Dec 19 22:34:30 2013 +** Created: Thu 1. May 18:57:02 2014 ** by: Qt User Interface Compiler version 4.8.1 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! @@ -41,6 +41,11 @@ class Ui_MainWindow QAction *actionClose; QAction *actionFeedback; QAction *actionGuide; + QAction *actionView_ProjectManager; + QAction *actionNew_Project; + QAction *actionOpen_Project; + QAction *actionSave_Project; + QAction *actionClose_Project; QWidget *centralWidget; QMenuBar *menuBar; QMenu *menuFile; @@ -88,6 +93,16 @@ class Ui_MainWindow actionGuide = new QAction(MainWindow); actionGuide->setObjectName(QString::fromUtf8("actionGuide")); actionGuide->setEnabled(false); + actionView_ProjectManager = new QAction(MainWindow); + actionView_ProjectManager->setObjectName(QString::fromUtf8("actionView_ProjectManager")); + actionNew_Project = new QAction(MainWindow); + actionNew_Project->setObjectName(QString::fromUtf8("actionNew_Project")); + actionOpen_Project = new QAction(MainWindow); + actionOpen_Project->setObjectName(QString::fromUtf8("actionOpen_Project")); + actionSave_Project = new QAction(MainWindow); + actionSave_Project->setObjectName(QString::fromUtf8("actionSave_Project")); + actionClose_Project = new QAction(MainWindow); + actionClose_Project->setObjectName(QString::fromUtf8("actionClose_Project")); centralWidget = new QWidget(MainWindow); centralWidget->setObjectName(QString::fromUtf8("centralWidget")); MainWindow->setCentralWidget(centralWidget); @@ -112,9 +127,12 @@ class Ui_MainWindow menuBar->addAction(menuView->menuAction()); menuBar->addAction(menuHelp->menuAction()); menuFile->addAction(actionNew); + menuFile->addAction(actionNew_Project); menuFile->addAction(actionOpen); + menuFile->addAction(actionOpen_Project); menuFile->addAction(actionSave); menuFile->addAction(actionSave_as); + menuFile->addAction(actionSave_Project); menuFile->addAction(actionSave_all); menuFile->addSeparator(); menuFile->addAction(menuExport->menuAction()); @@ -122,6 +140,7 @@ class Ui_MainWindow menuFile->addSeparator(); menuFile->addAction(actionClose); menuFile->addAction(actionClose_All); + menuFile->addAction(actionClose_Project); menuFile->addAction(actionClose_Others); menuFile->addSeparator(); menuFile->addAction(actionExit); @@ -130,6 +149,7 @@ class Ui_MainWindow menuHelp->addAction(actionAbout_Qt); menuHelp->addAction(actionFeedback); menuHelp->addAction(actionGuide); + menuView->addAction(actionView_ProjectManager); retranslateUi(MainWindow); @@ -163,6 +183,11 @@ class Ui_MainWindow actionClose->setShortcut(QApplication::translate("MainWindow", "Ctrl+W", 0, QApplication::UnicodeUTF8)); actionFeedback->setText(QApplication::translate("MainWindow", "Feedback", 0, QApplication::UnicodeUTF8)); actionGuide->setText(QApplication::translate("MainWindow", "Guide", 0, QApplication::UnicodeUTF8)); + actionView_ProjectManager->setText(QApplication::translate("MainWindow", "Project Manager", 0, QApplication::UnicodeUTF8)); + actionNew_Project->setText(QApplication::translate("MainWindow", "New Project", 0, QApplication::UnicodeUTF8)); + actionOpen_Project->setText(QApplication::translate("MainWindow", "Open Project", 0, QApplication::UnicodeUTF8)); + actionSave_Project->setText(QApplication::translate("MainWindow", "Save Project", 0, QApplication::UnicodeUTF8)); + actionClose_Project->setText(QApplication::translate("MainWindow", "Close Project", 0, QApplication::UnicodeUTF8)); menuFile->setTitle(QApplication::translate("MainWindow", "File", 0, QApplication::UnicodeUTF8)); menuExport->setTitle(QApplication::translate("MainWindow", "Export", 0, QApplication::UnicodeUTF8)); menuHelp->setTitle(QApplication::translate("MainWindow", "Help", 0, QApplication::UnicodeUTF8)); From dfc61c5c7f6c2d1e0be4142289fb76ff8165e86b Mon Sep 17 00:00:00 2001 From: mikluke Date: Wed, 14 May 2014 17:34:06 +0300 Subject: [PATCH 30/71] #8 Removed debug code --- sources/kbe/projectmanager.cpp | 3 --- sources/kbe/projectmanagermodel.cpp | 4 ---- 2 files changed, 7 deletions(-) diff --git a/sources/kbe/projectmanager.cpp b/sources/kbe/projectmanager.cpp index 852f29a..1045ff8 100644 --- a/sources/kbe/projectmanager.cpp +++ b/sources/kbe/projectmanager.cpp @@ -14,8 +14,6 @@ #include #include -#include - ProjectManagerDockWidget* ProjectManagerDockWidget::mInstance = 0; ProjectManagerDockWidget::ProjectManagerDockWidget(QWidget *parent) : @@ -485,7 +483,6 @@ void ProjectManagerView::onAddFilter() } QDir sourcesDir = item->getAbsoluteSourcesDir(); - qDebug() << sourcesDir.absolutePath(); if (!sourcesDir.exists()) if (! QDir(item->getProjectItem()->getAbsoluteFileDir()).mkdir("sources")) { diff --git a/sources/kbe/projectmanagermodel.cpp b/sources/kbe/projectmanagermodel.cpp index dae0efb..63c708f 100644 --- a/sources/kbe/projectmanagermodel.cpp +++ b/sources/kbe/projectmanagermodel.cpp @@ -11,8 +11,6 @@ #include #include -#include - #define MIME_FORMAT "application/kbe.project.item.list" #define TAG_PROJECT "KBEProject" @@ -151,11 +149,9 @@ bool ProjectManagerModel::dropMimeData(const QMimeData *data, if (QFile::copy(newItem->getFilePath(),newAbsoluteFilePath)) { - qDebug() << newItem->getFilePath(); QFile::remove(newItem->getFilePath()); removeItem(lastName); insertItem(shownName,filePath,newItem->getItemType()); - } } return true; From 5aa072e0e95ce5bc392ece73956b44d414c53d66 Mon Sep 17 00:00:00 2001 From: Denis Koronchik Date: Thu, 15 May 2014 11:20:00 +0300 Subject: [PATCH 31/71] code re-factoring - improve code style; - update license headers; - done issue #356 --- .gitignore | 2 + BUGS | 2 +- INSTALL | 2 +- README | 2 +- docs/codingstandards.html | 2 +- sources/kbe/basewindow.cpp | 2 +- sources/kbe/basewindow.h | 2 +- sources/kbe/config.cpp | 2 +- sources/kbe/config.h | 2 +- sources/kbe/extendedtabwidget.cpp | 2 +- sources/kbe/extendedtabwidget.h | 2 +- sources/kbe/guidedialog.cpp | 2 +- sources/kbe/guidedialog.h | 2 +- sources/kbe/interfaces/editorinterface.h | 2 +- sources/kbe/interfaces/plugininterface.h | 2 +- sources/kbe/kbe.pro | 10 +- sources/kbe/main.cpp | 2 +- sources/kbe/mainwindow.cpp | 32 +-- sources/kbe/mainwindow.h | 7 +- sources/kbe/newfiledialog.cpp | 2 +- sources/kbe/platform.h | 2 +- sources/kbe/pluginmanager.cpp | 2 +- sources/kbe/pluginmanager.h | 2 +- sources/kbe/projectmanagerdockwidget.cpp | 62 ++++ sources/kbe/projectmanagerdockwidget.h | 48 ++++ sources/kbe/projectmanagermodel.cpp | 174 +++++++----- sources/kbe/projectmanagermodel.h | 59 ++-- ...jectmanager.cpp => projectmanagerview.cpp} | 267 +++++++++--------- ...{projectmanager.h => projectmanagerview.h} | 58 ++-- sources/kbe/version.h | 2 +- sources/plugins/m4scp/m4scpblockdata.h | 2 +- sources/plugins/m4scp/m4scpcodeanalyzer.cpp | 2 +- sources/plugins/m4scp/m4scpcodeanalyzer.h | 2 +- sources/plugins/m4scp/m4scpcodecompleter.cpp | 2 +- sources/plugins/m4scp/m4scpcodecompleter.h | 2 +- sources/plugins/m4scp/m4scpcodeeditor.cpp | 2 +- sources/plugins/m4scp/m4scpcodeeditor.h | 2 +- sources/plugins/m4scp/m4scpplugin.cpp | 2 +- sources/plugins/m4scp/m4scpplugin.h | 2 +- sources/plugins/m4scp/m4scpsyntax.cpp | 2 +- sources/plugins/m4scp/m4scpsyntax.h | 2 +- .../plugins/m4scp/m4scpsyntaxhighlighter.cpp | 2 +- .../plugins/m4scp/m4scpsyntaxhighlighter.h | 2 +- sources/plugins/m4scp/m4scpwindow.cpp | 2 +- sources/plugins/m4scp/m4scpwindow.h | 2 +- sources/plugins/scg/arrangers/scgarranger.cpp | 2 +- sources/plugins/scg/arrangers/scgarranger.h | 2 +- .../plugins/scg/commands/scgbasecommand.cpp | 2 +- sources/plugins/scg/commands/scgbasecommand.h | 2 +- .../scgcommandchangeincedentobject.cpp | 2 +- .../commands/scgcommandchangeincedentobject.h | 2 +- .../plugins/scg/commands/scgcommandclone.cpp | 2 +- .../plugins/scg/commands/scgcommandclone.h | 2 +- .../scg/commands/scgcommandcontentchange.cpp | 2 +- .../scg/commands/scgcommandcontentchange.h | 2 +- .../commands/scgcommandcontentvisibility.cpp | 2 +- .../commands/scgcommandcontentvisibility.h | 2 +- .../scg/commands/scgcommandcreatebus.cpp | 2 +- .../scg/commands/scgcommandcreatebus.h | 2 +- .../scg/commands/scgcommandcreatecontour.cpp | 2 +- .../scg/commands/scgcommandcreatecontour.h | 2 +- .../scg/commands/scgcommandcreatenode.cpp | 2 +- .../scg/commands/scgcommandcreatenode.h | 2 +- .../scg/commands/scgcommandcreatepair.cpp | 2 +- .../scg/commands/scgcommandcreatepair.h | 2 +- .../scg/commands/scgcommanddeletecontour.cpp | 2 +- .../scg/commands/scgcommanddeletecontour.h | 2 +- .../scg/commands/scgcommandidtfmove.cpp | 2 +- .../plugins/scg/commands/scgcommandidtfmove.h | 2 +- .../plugins/scg/commands/scgcommandinsert.cpp | 2 +- .../plugins/scg/commands/scgcommandinsert.h | 2 +- .../commands/scgcommandminimizecontour.cpp | 2 +- .../scg/commands/scgcommandminimizecontour.h | 2 +- .../scg/commands/scgcommandobjectdelete.cpp | 2 +- .../scg/commands/scgcommandobjectdelete.h | 2 +- .../commands/scgcommandobjectidtfchange.cpp | 2 +- .../scg/commands/scgcommandobjectidtfchange.h | 2 +- .../scg/commands/scgcommandobjectmove.cpp | 2 +- .../scg/commands/scgcommandobjectmove.h | 2 +- .../commands/scgcommandobjecttypechange.cpp | 2 +- .../scg/commands/scgcommandobjecttypechange.h | 2 +- .../scg/commands/scgcommandpointmove.cpp | 2 +- .../scg/commands/scgcommandpointmove.h | 2 +- .../scg/commands/scgcommandpointschange.cpp | 2 +- .../scg/commands/scgcommandpointschange.h | 2 +- .../commands/scgcommandremovebreakpoints.cpp | 2 +- .../commands/scgcommandremovebreakpoints.h | 2 +- .../commands/scgcommandselectedobjectmove.cpp | 2 +- .../commands/scgcommandselectedobjectmove.h | 2 +- .../scg/commands/scgcommandswappairorient.cpp | 2 +- .../scg/commands/scgcommandswappairorient.h | 2 +- sources/plugins/scg/gwf/gwffileloader.cpp | 2 +- sources/plugins/scg/gwf/gwffileloader.h | 2 +- sources/plugins/scg/gwf/gwffilewriter.cpp | 2 +- sources/plugins/scg/gwf/gwffilewriter.h | 2 +- .../plugins/scg/gwf/gwfobjectinforeader.cpp | 2 +- sources/plugins/scg/gwf/gwfobjectinforeader.h | 2 +- sources/plugins/scg/gwf/gwfstreamwriter.cpp | 2 +- sources/plugins/scg/gwf/gwfstreamwriter.h | 2 +- sources/plugins/scg/modes/scgbusmode.cpp | 2 +- sources/plugins/scg/modes/scgbusmode.h | 2 +- sources/plugins/scg/modes/scgclonemode.cpp | 2 +- sources/plugins/scg/modes/scgclonemode.h | 2 +- sources/plugins/scg/modes/scgcontourmode.cpp | 2 +- sources/plugins/scg/modes/scgcontourmode.h | 2 +- sources/plugins/scg/modes/scginsertmode.cpp | 2 +- sources/plugins/scg/modes/scginsertmode.h | 2 +- sources/plugins/scg/modes/scgmode.cpp | 2 +- sources/plugins/scg/modes/scgmode.h | 2 +- sources/plugins/scg/modes/scgpairmode.cpp | 2 +- sources/plugins/scg/modes/scgpairmode.h | 2 +- sources/plugins/scg/modes/scgselectmode.cpp | 2 +- sources/plugins/scg/modes/scgselectmode.h | 2 +- .../plugins/scg/scgabstractobjectbuilder.cpp | 2 +- .../plugins/scg/scgabstractobjectbuilder.h | 2 +- sources/plugins/scg/scgalphabet.cpp | 2 +- sources/plugins/scg/scgalphabet.h | 2 +- sources/plugins/scg/scgbus.cpp | 2 +- sources/plugins/scg/scgbus.h | 2 +- sources/plugins/scg/scgcontent.cpp | 2 +- sources/plugins/scg/scgcontent.h | 2 +- .../plugins/scg/scgcontentchangedialog.cpp | 2 +- sources/plugins/scg/scgcontentchangedialog.h | 2 +- sources/plugins/scg/scgcontentdialog.cpp | 2 +- sources/plugins/scg/scgcontentdialog.h | 2 +- sources/plugins/scg/scgcontentfactory.cpp | 2 +- sources/plugins/scg/scgcontentfactory.h | 2 +- sources/plugins/scg/scgcontentimage.cpp | 2 +- sources/plugins/scg/scgcontentimage.h | 2 +- sources/plugins/scg/scgcontentnumeric.cpp | 2 +- sources/plugins/scg/scgcontentnumeric.h | 2 +- sources/plugins/scg/scgcontentstring.cpp | 2 +- sources/plugins/scg/scgcontentstring.h | 2 +- sources/plugins/scg/scgcontentvideo.cpp | 2 +- sources/plugins/scg/scgcontentvideo.h | 2 +- sources/plugins/scg/scgcontentviewer.cpp | 2 +- sources/plugins/scg/scgcontentviewer.h | 2 +- sources/plugins/scg/scgcontour.cpp | 2 +- sources/plugins/scg/scgcontour.h | 2 +- .../plugins/scg/scgdefaultobjectbuilder.cpp | 2 +- sources/plugins/scg/scgdefaultobjectbuilder.h | 2 +- sources/plugins/scg/scgexportimage.cpp | 2 +- sources/plugins/scg/scgexportimage.h | 2 +- sources/plugins/scg/scgfilewriterimage.cpp | 2 +- sources/plugins/scg/scgfilewriterimage.h | 2 +- sources/plugins/scg/scgfindwidget.cpp | 2 +- sources/plugins/scg/scgfindwidget.h | 2 +- sources/plugins/scg/scglayoutmanager.cpp | 2 +- sources/plugins/scg/scglayoutmanager.h | 2 +- sources/plugins/scg/scgminimap.cpp | 2 +- sources/plugins/scg/scgminimap.h | 2 +- sources/plugins/scg/scgnode.cpp | 2 +- sources/plugins/scg/scgnode.h | 2 +- sources/plugins/scg/scgnodetextitem.cpp | 2 +- sources/plugins/scg/scgnodetextitem.h | 2 +- sources/plugins/scg/scgobject.cpp | 2 +- sources/plugins/scg/scgobject.h | 2 +- sources/plugins/scg/scgobjectsinfo.cpp | 2 +- sources/plugins/scg/scgobjectsinfo.h | 2 +- sources/plugins/scg/scgobjectsinfodata.cpp | 2 +- sources/plugins/scg/scgobjectsinfodata.h | 2 +- sources/plugins/scg/scgpair.cpp | 2 +- sources/plugins/scg/scgpair.h | 2 +- sources/plugins/scg/scgplugin.cpp | 2 +- sources/plugins/scg/scgplugin.h | 2 +- sources/plugins/scg/scgpointobject.cpp | 2 +- sources/plugins/scg/scgpointobject.h | 2 +- sources/plugins/scg/scgscene.cpp | 2 +- sources/plugins/scg/scgscene.h | 2 +- .../plugins/scg/scgtemplateobjectbuilder.cpp | 2 +- .../plugins/scg/scgtemplateobjectbuilder.h | 2 +- sources/plugins/scg/scgtextitem.cpp | 2 +- sources/plugins/scg/scgtextitem.h | 2 +- sources/plugins/scg/scgundoview.cpp | 2 +- sources/plugins/scg/scgundoview.h | 2 +- sources/plugins/scg/scgundoviewmodel.cpp | 2 +- sources/plugins/scg/scgundoviewmodel.h | 2 +- sources/plugins/scg/scgview.cpp | 2 +- sources/plugins/scg/scgview.h | 2 +- sources/plugins/scg/scgwindow.cpp | 2 +- sources/plugins/scg/scgwindow.h | 2 +- sources/plugins/scg/select/scgselect.cpp | 2 +- sources/plugins/scg/select/scgselect.h | 2 +- .../scg/select/scgselectinputoutput.cpp | 2 +- .../plugins/scg/select/scgselectinputoutput.h | 2 +- .../plugins/scg/select/scgselectsubgraph.cpp | 2 +- .../plugins/scg/select/scgselectsubgraph.h | 2 +- sources/plugins/scn/scneditorscene.cpp | 2 +- sources/plugins/scn/scneditorscene.h | 2 +- sources/plugins/scn/scnfieldglobalidtf.cpp | 2 +- sources/plugins/scn/scnfieldglobalidtf.h | 2 +- sources/plugins/scn/scnfielditem.cpp | 2 +- sources/plugins/scn/scnfielditem.h | 2 +- sources/plugins/scn/scnplugin.cpp | 2 +- sources/plugins/scn/scnplugin.h | 2 +- sources/plugins/scn/scnwindow.cpp | 2 +- sources/plugins/scn/scnwindow.h | 2 +- .../scsabstracthighlightingrule.cpp | 2 +- .../scsabstracthighlightingrule.h | 2 +- .../scshighlightingrulespool.cpp | 2 +- .../scshighlightingrulespool.h | 2 +- .../scsmultilinecommenthighlightingrule.cpp | 2 +- .../scsmultilinecommenthighlightingrule.h | 2 +- .../scsmultilinehighlightingrule.cpp | 2 +- .../scsmultilinehighlightingrule.h | 2 +- .../scsstdhighlightingrule.cpp | 2 +- .../scsstdhighlightingrule.h | 2 +- sources/plugins/scs/scscodeanalyzer.cpp | 2 +- sources/plugins/scs/scscodeanalyzer.h | 2 +- sources/plugins/scs/scscodecompleter.cpp | 2 +- sources/plugins/scs/scscodecompleter.h | 2 +- sources/plugins/scs/scscodeeditor.cpp | 2 +- sources/plugins/scs/scscodeeditor.h | 2 +- sources/plugins/scs/scscodeerroranalyzer.h | 2 +- sources/plugins/scs/scserrortablewidget.h | 2 +- sources/plugins/scs/scserrortablewidgetitem.h | 2 +- sources/plugins/scs/scsfindwidget.h | 2 +- .../plugins/scs/scsparser/scsasynchparser.cpp | 2 +- .../plugins/scs/scsparser/scsasynchparser.h | 2 +- .../plugins/scs/scsparser/scscparserdefs.c | 2 +- .../plugins/scs/scsparser/scscparserdefs.h | 2 +- .../scs/scsparser/scsparserexception.cpp | 2 +- .../scs/scsparser/scsparserexception.h | 2 +- .../scs/scsparser/scsparserwrapper.cpp | 2 +- .../plugins/scs/scsparser/scsparserwrapper.h | 2 +- sources/plugins/scs/scsplugin.cpp | 2 +- sources/plugins/scs/scsplugin.h | 2 +- sources/plugins/scs/scssyntaxhighlighter.cpp | 2 +- sources/plugins/scs/scssyntaxhighlighter.h | 2 +- sources/plugins/scs/scswindow.cpp | 2 +- sources/plugins/scs/scswindow.h | 2 +- sources/updater/main.cpp | 2 +- sources/updater/updatedownloader.cpp | 2 +- sources/updater/updatedownloader.h | 2 +- sources/updater/updateextractor.cpp | 2 +- sources/updater/updateextractor.h | 2 +- sources/updater/updateinstaller.cpp | 2 +- sources/updater/updateinstaller.h | 2 +- sources/updater/updatewindow.cpp | 2 +- sources/updater/updatewindow.h | 2 +- tools/update_generator.py | 2 +- 241 files changed, 674 insertions(+), 507 deletions(-) create mode 100644 .gitignore create mode 100644 sources/kbe/projectmanagerdockwidget.cpp create mode 100644 sources/kbe/projectmanagerdockwidget.h rename sources/kbe/{projectmanager.cpp => projectmanagerview.cpp} (66%) rename sources/kbe/{projectmanager.h => projectmanagerview.h} (61%) diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3c48abc --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +all-build-desktop/* +*.qm \ No newline at end of file diff --git a/BUGS b/BUGS index 9d9410a..d1c8c8b 100644 --- a/BUGS +++ b/BUGS @@ -5,7 +5,7 @@ list of known bugs. This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/INSTALL b/INSTALL index b0a214f..66afb47 100644 --- a/INSTALL +++ b/INSTALL @@ -4,7 +4,7 @@ Please see readme.html in the docs folder for full instructions. This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/README b/README index f1c92b5..681b167 100644 --- a/README +++ b/README @@ -4,7 +4,7 @@ Please read readme.html in the docs folder. This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/docs/codingstandards.html b/docs/codingstandards.html index 8ac9ced..7f88c1b 100644 --- a/docs/codingstandards.html +++ b/docs/codingstandards.html @@ -24,7 +24,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/kbe/basewindow.cpp b/sources/kbe/basewindow.cpp index 807e51c..8f15c9e 100644 --- a/sources/kbe/basewindow.cpp +++ b/sources/kbe/basewindow.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/kbe/basewindow.h b/sources/kbe/basewindow.h index 63ac45f..cdaec2a 100644 --- a/sources/kbe/basewindow.h +++ b/sources/kbe/basewindow.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/kbe/config.cpp b/sources/kbe/config.cpp index 5c973ef..f3563af 100644 --- a/sources/kbe/config.cpp +++ b/sources/kbe/config.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/kbe/config.h b/sources/kbe/config.h index e03c41b..48c3689 100644 --- a/sources/kbe/config.h +++ b/sources/kbe/config.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/kbe/extendedtabwidget.cpp b/sources/kbe/extendedtabwidget.cpp index bce98e7..dd698ed 100644 --- a/sources/kbe/extendedtabwidget.cpp +++ b/sources/kbe/extendedtabwidget.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/kbe/extendedtabwidget.h b/sources/kbe/extendedtabwidget.h index 0767b9f..41e6c5b 100644 --- a/sources/kbe/extendedtabwidget.h +++ b/sources/kbe/extendedtabwidget.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/kbe/guidedialog.cpp b/sources/kbe/guidedialog.cpp index b2e48b2..fd0c1fd 100644 --- a/sources/kbe/guidedialog.cpp +++ b/sources/kbe/guidedialog.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/kbe/guidedialog.h b/sources/kbe/guidedialog.h index b9c963d..473b6e2 100644 --- a/sources/kbe/guidedialog.h +++ b/sources/kbe/guidedialog.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/kbe/interfaces/editorinterface.h b/sources/kbe/interfaces/editorinterface.h index 5ab0e01..75bceb4 100644 --- a/sources/kbe/interfaces/editorinterface.h +++ b/sources/kbe/interfaces/editorinterface.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/kbe/interfaces/plugininterface.h b/sources/kbe/interfaces/plugininterface.h index 0f14780..eb4c455 100644 --- a/sources/kbe/interfaces/plugininterface.h +++ b/sources/kbe/interfaces/plugininterface.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/kbe/kbe.pro b/sources/kbe/kbe.pro index 12b1b70..0d8b1a3 100644 --- a/sources/kbe/kbe.pro +++ b/sources/kbe/kbe.pro @@ -16,8 +16,9 @@ SOURCES += \ pluginmanager.cpp \ guidedialog.cpp \ newfiledialog.cpp \ - projectmanager.cpp \ - projectmanagermodel.cpp + projectmanagerview.cpp \ + projectmanagermodel.cpp \ + projectmanagerdockwidget.cpp HEADERS += version.h \ platform.h \ @@ -29,8 +30,9 @@ HEADERS += version.h \ interfaces/editorinterface.h \ guidedialog.h \ newfiledialog.h \ - projectmanager.h \ - projectmanagermodel.h + projectmanagerview.h \ + projectmanagermodel.h \ + projectmanagerdockwidget.h FORMS += mainwindow.ui diff --git a/sources/kbe/main.cpp b/sources/kbe/main.cpp index dc1b0fb..b41e8ee 100644 --- a/sources/kbe/main.cpp +++ b/sources/kbe/main.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/kbe/mainwindow.cpp b/sources/kbe/mainwindow.cpp index faa06e8..32402d6 100644 --- a/sources/kbe/mainwindow.cpp +++ b/sources/kbe/mainwindow.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -78,15 +78,15 @@ MainWindow::MainWindow(QWidget *parent) : connect(mTabWidget, SIGNAL(currentChanged(int)), this, SLOT(updateMenu())); /*creating project manager widget */ - ProjectManagerDockWidget::instance() -> setWindowTitle(tr("Project Manager")); + ProjectManagerDockWidget::instance()->setWindowTitle(tr("Project Manager")); ProjectManagerDockWidget::instance()->setObjectName("Project Name"); addDockWidget(Qt::LeftDockWidgetArea,ProjectManagerDockWidget::instance()); if (ProjectManagerView* prView = ProjectManagerDockWidget::instance()->getTreeView()) { connect(prView, SIGNAL(openFile(QString)), this, SLOT(fileOpen(QString))); - connect(prView, SIGNAL(event(ProjectManagerView::ProjectManagerEvent)), - this, SLOT(acceptProjectManagerEvent(ProjectManagerView::ProjectManagerEvent))); + connect(prView, SIGNAL(event(ProjectManagerView::eProjectManagerEvent)), + this, SLOT(acceptProjectManagerEvent(ProjectManagerView::eProjectManagerEvent))); } @@ -808,7 +808,7 @@ void MainWindow::closeEvent(QCloseEvent *event) // close project if (ProjectManagerView* pmView = ProjectManagerDockWidget::instance()->getTreeView()) - if (!pmView -> onProjectClose()) + if (!pmView->onProjectClose()) { event->ignore(); return; @@ -817,28 +817,28 @@ void MainWindow::closeEvent(QCloseEvent *event) saveLayout(); } -void MainWindow::acceptProjectManagerEvent(ProjectManagerView::ProjectManagerEvent event) +void MainWindow::acceptProjectManagerEvent(ProjectManagerView::eProjectManagerEvent event) { switch (event) { case ProjectManagerView::ProjectCreated: case ProjectManagerView::ProjectOpened: - ui->actionNew_Project -> setEnabled(false); - ui->actionOpen_Project -> setEnabled(false); - ui->actionSave_Project -> setEnabled(false); - ui->actionClose_Project -> setEnabled(true); + ui->actionNew_Project->setEnabled(false); + ui->actionOpen_Project->setEnabled(false); + ui->actionSave_Project->setEnabled(false); + ui->actionClose_Project->setEnabled(true); break; case ProjectManagerView::ProjectSaved: - ui->actionSave_Project -> setEnabled(false); + ui->actionSave_Project->setEnabled(false); break; case ProjectManagerView::ProjectClosed: - ui->actionNew_Project -> setEnabled(true); - ui->actionOpen_Project -> setEnabled(true); - ui->actionSave_Project -> setEnabled(false); - ui->actionClose_Project -> setEnabled(false); + ui->actionNew_Project->setEnabled(true); + ui->actionOpen_Project->setEnabled(true); + ui->actionSave_Project->setEnabled(false); + ui->actionClose_Project->setEnabled(false); break; case ProjectManagerView::ProjectChanged: - ui->actionSave_Project -> setEnabled(true); + ui->actionSave_Project->setEnabled(true); break; case ProjectManagerView::DefaultEvent: break; diff --git a/sources/kbe/mainwindow.h b/sources/kbe/mainwindow.h index ab460be..fe7c190 100644 --- a/sources/kbe/mainwindow.h +++ b/sources/kbe/mainwindow.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -27,7 +27,8 @@ along with OSTIS. If not, see . #include #include #include "extendedtabwidget.h" -#include "projectmanager.h" +#include "projectmanagerdockwidget.h" +#include "projectmanagerview.h" #include "interfaces/editorinterface.h" namespace Ui { @@ -213,7 +214,7 @@ public slots: void closeEvent(QCloseEvent *event); //! Accepts Project Managers events. - void acceptProjectManagerEvent(ProjectManagerView::ProjectManagerEvent); + void acceptProjectManagerEvent(ProjectManagerView::eProjectManagerEvent evt); }; #endif // MAINWINDOW_H diff --git a/sources/kbe/newfiledialog.cpp b/sources/kbe/newfiledialog.cpp index 6ffc21b..21c0d23 100644 --- a/sources/kbe/newfiledialog.cpp +++ b/sources/kbe/newfiledialog.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/kbe/platform.h b/sources/kbe/platform.h index 0814716..1b079d0 100644 --- a/sources/kbe/platform.h +++ b/sources/kbe/platform.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/kbe/pluginmanager.cpp b/sources/kbe/pluginmanager.cpp index 4f3ed9d..5f14645 100644 --- a/sources/kbe/pluginmanager.cpp +++ b/sources/kbe/pluginmanager.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/kbe/pluginmanager.h b/sources/kbe/pluginmanager.h index c25a59c..413cb35 100644 --- a/sources/kbe/pluginmanager.h +++ b/sources/kbe/pluginmanager.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/kbe/projectmanagerdockwidget.cpp b/sources/kbe/projectmanagerdockwidget.cpp new file mode 100644 index 0000000..7f816c0 --- /dev/null +++ b/sources/kbe/projectmanagerdockwidget.cpp @@ -0,0 +1,62 @@ +/* +----------------------------------------------------------------------------- +This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) +For the latest info, see http://www.ostis.net + +Copyright (c) 2010-2014 OSTIS + +OSTIS 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 3 of the License, or +(at your option) any later version. + +OSTIS is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with OSTIS. If not, see . +----------------------------------------------------------------------------- +*/ + +#include "projectmanagerdockwidget.h" +#include "projectmanagerview.h" + +#include + +ProjectManagerDockWidget* ProjectManagerDockWidget::mInstance = 0; + +ProjectManagerDockWidget::ProjectManagerDockWidget(QWidget *parent) + : QDockWidget(parent) +{ + mTreeView = new ProjectManagerView(this); + + this->setFeatures(QDockWidget::DockWidgetVerticalTitleBar); + + QFile file(":/media/stylesheets/projectmanager.qss"); + file.open(QFile::ReadOnly); + QString styleSheet = QLatin1String(file.readAll()); + mTreeView->setStyleSheet(styleSheet); + + setWidget(mTreeView); +} + +ProjectManagerDockWidget::~ProjectManagerDockWidget() +{ + Q_ASSERT(mInstance != 0); + mInstance = 0; +} + +ProjectManagerDockWidget* ProjectManagerDockWidget::instance() +{ + if (!mInstance) + mInstance = new ProjectManagerDockWidget(); + + return mInstance; +} + +ProjectManagerView* ProjectManagerDockWidget::getTreeView() +{ + return mTreeView; +} diff --git a/sources/kbe/projectmanagerdockwidget.h b/sources/kbe/projectmanagerdockwidget.h new file mode 100644 index 0000000..f88f427 --- /dev/null +++ b/sources/kbe/projectmanagerdockwidget.h @@ -0,0 +1,48 @@ +/* +----------------------------------------------------------------------------- +This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) +For the latest info, see http://www.ostis.net + +Copyright (c) 2010-2014 OSTIS + +OSTIS 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 3 of the License, or +(at your option) any later version. + +OSTIS is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with OSTIS. If not, see . +----------------------------------------------------------------------------- +*/ + +#ifndef PROJECTMANAGERDOCKWIDGET_H +#define PROJECTMANAGERDOCKWIDGET_H + +#include + +class ProjectManagerView; + +class ProjectManagerDockWidget : public QDockWidget +{ + Q_OBJECT +public: + explicit ProjectManagerDockWidget(QWidget *parent = 0); + virtual ~ProjectManagerDockWidget(); + + static ProjectManagerDockWidget* instance(); + + ProjectManagerView* getTreeView(); +private: + static ProjectManagerDockWidget* mInstance; + + //! Content of this widget + ProjectManagerView *mTreeView; +}; + + +#endif diff --git a/sources/kbe/projectmanagermodel.cpp b/sources/kbe/projectmanagermodel.cpp index 63c708f..7547729 100644 --- a/sources/kbe/projectmanagermodel.cpp +++ b/sources/kbe/projectmanagermodel.cpp @@ -1,3 +1,25 @@ +/* +----------------------------------------------------------------------------- +This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) +For the latest info, see http://www.ostis.net + +Copyright (c) 2010-2014 OSTIS + +OSTIS 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 3 of the License, or +(at your option) any later version. + +OSTIS is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with OSTIS. If not, see . +----------------------------------------------------------------------------- +*/ + #include "projectmanagermodel.h" #include @@ -22,12 +44,12 @@ ProjectManagerModel::ProjectManagerModel(QObject *parent) : QAbstractItemModel(parent) { - rootItem = new ProjectManagerModelItem(); + mRootItem = new ProjectManagerModelItem(); } ProjectManagerModel::~ProjectManagerModel() { - delete rootItem; + delete mRootItem; } int ProjectManagerModel::columnCount(const QModelIndex &parent) const @@ -35,7 +57,7 @@ int ProjectManagerModel::columnCount(const QModelIndex &parent) const if (parent.isValid()) return static_cast(parent.internalPointer())->columnCount(); else - return rootItem->columnCount(); + return mRootItem->columnCount(); } QModelIndexList ProjectManagerModel::getPersistentIndexList() const @@ -85,7 +107,7 @@ QMimeData *ProjectManagerModel::mimeData(const QModelIndexList &indexes) const QString objectName = item->objectName(); QString shownName = item->getName(); QString filePath = item->getAbsoluteFilePath(); - ProjectManagerModelItem::ItemType type = item->getItemType(); + ProjectManagerModelItem::eItemType type = item->getItemType(); stream << objectName << shownName << filePath << type; urlList.append(QUrl::fromLocalFile(filePath)); @@ -111,7 +133,7 @@ bool ProjectManagerModel::dropMimeData(const QMimeData *data, { QByteArray encodedData = data->data(MIME_FORMAT); QDataStream stream(&encodedData, QIODevice::ReadOnly); - QList< QPair > newItems; + QList< QPair > newItems; while (!stream.atEnd()) { @@ -119,19 +141,19 @@ bool ProjectManagerModel::dropMimeData(const QMimeData *data, QString shownName; QString absoluteFilePath; int n_itemType; - ProjectManagerModelItem::ItemType itemType; + ProjectManagerModelItem::eItemType itemType; stream >> lastObjectName; stream >> shownName; stream >> absoluteFilePath; stream >> n_itemType; - itemType = static_cast(n_itemType); + itemType = static_cast(n_itemType); - ProjectManagerModelItem* newItem = new ProjectManagerModelItem(shownName,absoluteFilePath,itemType); + ProjectManagerModelItem* newItem = new ProjectManagerModelItem(shownName, absoluteFilePath, itemType); QString lastPath(lastObjectName); - newItems << QPair(newItem,lastPath); + newItems << QPair(newItem,lastPath); } for (int i=0; igetAbsoluteFileDir(), newItem->getName()).absoluteFilePath(); - if (QFile::copy(newItem->getFilePath(),newAbsoluteFilePath)) + if (QFile::copy(newItem->getFilePath(), newAbsoluteFilePath)) { QFile::remove(newItem->getFilePath()); removeItem(lastName); - insertItem(shownName,filePath,newItem->getItemType()); + insertItem(shownName, filePath, newItem->getItemType()); } } return true; @@ -175,7 +197,7 @@ void ProjectManagerModel::loadProject(QString filePath) while (!rStream.atEnd() && !rStream.hasError()) { rStream.readNextStartElement(); - if (rStream.name()==TAG_PROJECT && rStream.isStartElement()) + if (rStream.name() == TAG_PROJECT && rStream.isStartElement()) { if (projectItem) { @@ -185,17 +207,16 @@ void ProjectManagerModel::loadProject(QString filePath) QString shownName = rStream.attributes().value(TAG_ATTR_NAME).toString(); QString fileName = proFile.fileName(); - if (rootItem->findChild(shownName)) + if (mRootItem->findChild(shownName)) return; - projectItem = new ProjectManagerModelItem(shownName, fileName, - ProjectManagerModelItem::Project, rootItem); + projectItem = new ProjectManagerModelItem(shownName, fileName, ProjectManagerModelItem::Project, mRootItem); projectItem->setObjectName(shownName); insertProject(projectItem); } - if (rStream.name()==TAG_FILE && rStream.isStartElement()) + if (rStream.name() == TAG_FILE && rStream.isStartElement()) { QString fileName = rStream.attributes().value(TAG_ATTR_PATH).toString(); QString filter = rStream.attributes().value(TAG_ATTR_FILTER).toString(); @@ -205,7 +226,7 @@ void ProjectManagerModel::loadProject(QString filePath) QString newObjectName = projectItem->objectName()+ filter + SEPARATOR + fileName.split(SEPARATOR).last(); - addChild(newObjectName, fileName, ProjectManagerModelItem::File, rootItem); + addChild(newObjectName, fileName, ProjectManagerModelItem::File, mRootItem); } } projectItem->setModified(false); @@ -229,14 +250,14 @@ void ProjectManagerModel::saveProject(ProjectManagerModelItem *project, QString wStream.writeStartElement(TAG_PROJECT); wStream.writeAttribute(TAG_ATTR_NAME, project->getName()); - saveChilds(project,wStream); + saveChilds(project, wStream); wStream.writeEndElement(); wStream.writeEndDocument(); proFile.close(); - project -> setModified(false); + project->setModified(false); } } @@ -245,63 +266,63 @@ void ProjectManagerModel::saveChilds(ProjectManagerModelItem *item, QXmlStreamWr if (!item) return; - for (int i=0; ichildCount(); i++) + for (int i = 0; i < item->childCount(); i++) saveChilds(item->child(i),wStream); if (item->getItemType() == ProjectManagerModelItem::Project || - item->getItemType() == ProjectManagerModelItem::Filter) + item->getItemType() == ProjectManagerModelItem::Filter) + { return; + } wStream.writeStartElement(TAG_FILE); QStringList filterPath = item->objectName().split(SEPARATOR); filterPath.pop_back(); filterPath.pop_front(); + if (filterPath.count()) - wStream.writeAttribute(TAG_ATTR_FILTER,filterPath.join(SEPARATOR)); - wStream.writeAttribute(TAG_ATTR_PATH,item->getFilePath()); + wStream.writeAttribute(TAG_ATTR_FILTER, filterPath.join(SEPARATOR)); + + wStream.writeAttribute(TAG_ATTR_PATH, item->getFilePath()); wStream.writeEndElement(); } -void ProjectManagerModel::insertItem(const QString shownName, const QString filePath, ProjectManagerModelItem::ItemType type) +void ProjectManagerModel::insertItem(const QString shownName, const QString filePath, ProjectManagerModelItem::eItemType type) { QStringList path = shownName.split(SEPARATOR); path.pop_back(); - ProjectManagerModelItem* neededFilter = getPath(path,rootItem); + ProjectManagerModelItem* neededFilter = getPath(path, mRootItem); if (!neededFilter) return; - beginInsertRows(createIndex(0,0,neededFilter), - neededFilter->childCount(), - neededFilter->childCount()+1); - - addChild(shownName,filePath,type,rootItem); + beginInsertRows(createIndex(0, 0, neededFilter), neededFilter->childCount(), neededFilter->childCount() + 1); + addChild(shownName,filePath,type,mRootItem); endInsertRows(); } void ProjectManagerModel::insertProject(ProjectManagerModelItem *item) { - beginInsertRows(QModelIndex(), - 0, - 1); + beginInsertRows(QModelIndex(), 0, 1); - rootItem -> appendChild(item); + mRootItem->appendChild(item); endInsertRows(); } void ProjectManagerModel::removeItem(ProjectManagerModelItem *item) { - if (item==NULL) + if (item == NULL) return; - QModelIndex index = createIndex(0,0,item); + + QModelIndex index = createIndex(0, 0, item); if (index.isValid()) { - beginRemoveRows(index,0,item->childCount()); + beginRemoveRows(index, 0, item->childCount()); item->parent()->removeChild(item); @@ -316,10 +337,10 @@ void ProjectManagerModel::removeItem(QString itemObjectName) if (ProjectManagerModelItem* item = getRootItem()->findChild(itemObjectName)) { - QModelIndex index = createIndex(0,0,item); + QModelIndex index = createIndex(0, 0, item); if (index.isValid()) { - beginRemoveRows(index,0,item->childCount()); + beginRemoveRows(index, 0, item->childCount()); item->parent()->removeChild(item); @@ -349,11 +370,10 @@ Qt::ItemFlags ProjectManagerModel::flags(const QModelIndex &index) const return 0; } -QVariant ProjectManagerModel::headerData(int section, Qt::Orientation orientation, - int role) const +QVariant ProjectManagerModel::headerData(int section, Qt::Orientation orientation, int role) const { if (orientation == Qt::Horizontal && role == Qt::DisplayRole) - return rootItem->data(section); + return mRootItem->data(section); return QVariant(); } @@ -367,7 +387,7 @@ QModelIndex ProjectManagerModel::index(int row, int column, const QModelIndex &p ProjectManagerModelItem *parentItem; if (!parent.isValid()) - parentItem = rootItem; + parentItem = mRootItem; else parentItem = getItem(parent); @@ -384,8 +404,9 @@ QModelIndex ProjectManagerModel::parent(const QModelIndex &index) const if (ProjectManagerModelItem *parentItem = getItem(index)->parent()) { - if (parentItem == rootItem) + if (parentItem == mRootItem) return QModelIndex(); + return createIndex(parentItem->row(), 0, parentItem); } @@ -400,7 +421,7 @@ int ProjectManagerModel::rowCount(const QModelIndex &parent) const return 0; if (!parent.isValid()) - parentItem = rootItem; + parentItem = mRootItem; else parentItem = getItem(parent); @@ -410,15 +431,17 @@ int ProjectManagerModel::rowCount(const QModelIndex &parent) const ProjectManagerModelItem* ProjectManagerModel::getItem(const QModelIndex &index) const { if (index.isValid()) + { if (ProjectManagerModelItem* item = static_cast(index.internalPointer())) return item; + } - return NULL; + return 0; } ProjectManagerModelItem* ProjectManagerModel::getRootItem() { - return rootItem; + return mRootItem; } ProjectManagerModelItem* ProjectManagerModel::getItemByFilePath(QString filePath, ProjectManagerModelItem *parent) @@ -437,23 +460,22 @@ ProjectManagerModelItem* ProjectManagerModel::getItemByFilePath(QString filePath return NULL; } -ProjectManagerModelItem* ProjectManagerModel::addChild(const QString shownName, const QString filePath, - ProjectManagerModelItem::ItemType type, ProjectManagerModelItem* rootItem) +ProjectManagerModelItem* ProjectManagerModel::addChild(const QString shownName, const QString filePath, ProjectManagerModelItem::eItemType type, ProjectManagerModelItem* rootItem) { ProjectManagerModelItem* item = NULL; QStringList path = shownName.split(SEPARATOR); QString name = path.last(); - if (ProjectManagerModelItem* existingChild = getPath(QStringList(shownName.split(SEPARATOR).first()),rootItem) -> findChild(shownName)) + if (ProjectManagerModelItem* existingChild = getPath(QStringList(shownName.split(SEPARATOR).first()),rootItem)->findChild(shownName)) return existingChild; path.pop_back(); if (ProjectManagerModelItem* neededFilter = getPath(path,rootItem)) { - item = new ProjectManagerModelItem(name,filePath,type,neededFilter); - item -> setObjectName(shownName); - neededFilter -> appendChild(item); + item = new ProjectManagerModelItem(name, filePath, type, neededFilter); + item->setObjectName(shownName); + neededFilter->appendChild(item); } return item; @@ -470,21 +492,21 @@ ProjectManagerModelItem* ProjectManagerModel::getPath(QStringList path, ProjectM { if (!parent->objectName().isEmpty()) neededItemObjectName.push_front(parent->objectName()+SEPARATOR); - if (ProjectManagerModelItem* item = parent -> findChild(neededItemObjectName)) + if (ProjectManagerModelItem* item = parent->findChild(neededItemObjectName)) { path.pop_front(); return getPath(path, item); } else { QString relativeDirPath; - if (parent -> getItemType() == ProjectManagerModelItem::Project) + if (parent->getItemType() == ProjectManagerModelItem::Project) relativeDirPath = path.first(); else relativeDirPath = parent->getAbsoluteSourcesDir().relativeFilePath(QFileInfo(parent->getAbsoluteFilePath(),path.first()).absoluteFilePath()); - ProjectManagerModelItem* newItem = new ProjectManagerModelItem(path.first(),relativeDirPath,ProjectManagerModelItem::Filter,parent); - newItem -> setObjectName(neededItemObjectName); - parent -> appendChild(newItem); + ProjectManagerModelItem* newItem = new ProjectManagerModelItem(path.first(), relativeDirPath, ProjectManagerModelItem::Filter, parent); + newItem->setObjectName(neededItemObjectName); + parent->appendChild(newItem); path.pop_front(); return getPath(path,newItem); } @@ -495,26 +517,30 @@ ProjectManagerModelItem* ProjectManagerModel::getPath(QStringList path, ProjectM QModelIndex ProjectManagerModel::getParentModelIndex(ProjectManagerModelItem* item) { if (item->parent()) - return createIndex(0,0,item->parent()); + return createIndex(0, 0, item->parent()); + return QModelIndex(); } -ProjectManagerModelItem::ProjectManagerModelItem(QObject *parent): - QObject(parent), m_isModified(false) + +// ----------------------------------------- +ProjectManagerModelItem::ProjectManagerModelItem(QObject *parent) + : QObject(parent) + , mIsModified(false) { parentItem = NULL; } -ProjectManagerModelItem::ProjectManagerModelItem(QString shownName, QString filePath, ItemType type, ProjectManagerModelItem *parent): - QObject(parent), m_isModified(false) +ProjectManagerModelItem::ProjectManagerModelItem(QString shownName, QString filePath, eItemType type, ProjectManagerModelItem *parent): + QObject(parent), mIsModified(false) { parentItem = parent; setObjectName(shownName); - this -> shownName = shownName; - this -> filePath = filePath; - this -> type = type; + this->mShownName = shownName; + this->mFilePath = filePath; + this->mItemType = type; } ProjectManagerModelItem::~ProjectManagerModelItem() @@ -535,7 +561,7 @@ void ProjectManagerModelItem::removeChild(ProjectManagerModelItem *child) return; childItems.removeOne(child); - for (int i=0; i< child -> childCount(); i++) + for (int i = 0; i < child->childCount(); i++) child->removeChild(child->child(i)); child->setObjectName(""); @@ -560,7 +586,7 @@ int ProjectManagerModelItem::columnCount() const QVariant ProjectManagerModelItem::data(int column) const { - return shownName; + return mShownName; } ProjectManagerModelItem *ProjectManagerModelItem::parent() @@ -571,7 +597,7 @@ ProjectManagerModelItem *ProjectManagerModelItem::parent() ProjectManagerModelItem* ProjectManagerModelItem::getProjectItem() { ProjectManagerModelItem* projectItem = this; - while (projectItem && projectItem -> type != ProjectManagerModelItem::Project) + while (projectItem && projectItem->mItemType != ProjectManagerModelItem::Project) projectItem = projectItem->parent(); return projectItem; @@ -579,18 +605,18 @@ ProjectManagerModelItem* ProjectManagerModelItem::getProjectItem() void ProjectManagerModelItem::setFilePath(QString filePath) { - this->filePath = filePath; + this->mFilePath = filePath; } QString ProjectManagerModelItem::getAbsoluteFilePath() { - switch(type) + switch(mItemType) { case Project: - return QFileInfo(filePath).absoluteFilePath(); + return QFileInfo(mFilePath).absoluteFilePath(); case Filter: case File: - return QFileInfo(getAbsoluteSourcesDir().absolutePath(),filePath).absoluteFilePath(); + return QFileInfo(getAbsoluteSourcesDir().absolutePath(),mFilePath).absoluteFilePath(); default: return QString(); } @@ -608,7 +634,7 @@ QString ProjectManagerModelItem::getAbsoluteFileDir() QDir ProjectManagerModelItem::getAbsoluteSourcesDir() { - return QDir(QFileInfo(this->getProjectItem()->getAbsoluteFileDir(),"sources").absoluteFilePath()); + return QDir(QFileInfo(this->getProjectItem()->getAbsoluteFileDir(), "sources").absoluteFilePath()); } int ProjectManagerModelItem::row() const diff --git a/sources/kbe/projectmanagermodel.h b/sources/kbe/projectmanagermodel.h index 74ed0c9..38b20f2 100644 --- a/sources/kbe/projectmanagermodel.h +++ b/sources/kbe/projectmanagermodel.h @@ -1,5 +1,27 @@ -#ifndef PROJECTMANAGERTREEVIEW_H -#define PROJECTMANAGERTREEVIEW_H +/* +----------------------------------------------------------------------------- +This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) +For the latest info, see http://www.ostis.net + +Copyright (c) 2010-2014 OSTIS + +OSTIS 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 3 of the License, or +(at your option) any later version. + +OSTIS is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with OSTIS. If not, see . +----------------------------------------------------------------------------- +*/ + +#ifndef PROJECTMANAGERMODEL_H +#define PROJECTMANAGERMODEL_H #include #include @@ -19,17 +41,18 @@ class ProjectManagerModelItem: public QObject public: /* Types of item */ - enum ItemType { + enum eItemType + { Unknown, Project, Filter, File }; - Q_ENUMS(ItemType) + Q_ENUMS(eItemType) ProjectManagerModelItem(QObject* parent=0); - ProjectManagerModelItem(QString shownName, QString filePath, ItemType type, ProjectManagerModelItem *parent = 0); + ProjectManagerModelItem(QString shownName, QString filePath, eItemType type, ProjectManagerModelItem *parent = 0); ~ProjectManagerModelItem(); /*! Appends child in childItems list @@ -63,17 +86,17 @@ class ProjectManagerModelItem: public QObject //! Returns absolute directory to directory which contains sources of project QDir getAbsoluteSourcesDir(); - ItemType getItemType() const { return type; } - QString getFilePath() const { return filePath; } + eItemType getItemType() const { return mItemType; } + QString getFilePath() const { return mFilePath; } void setFilePath(QString filePath); - QString getName() const { return shownName.toString(); } - void setName(QString name) { shownName = name; } - bool isModified() const { return m_isModified; } - void setModified(bool val) { m_isModified = val; } + QString getName() const { return mShownName.toString(); } + void setName(QString name) { mShownName = name; } + bool isModified() const { return mIsModified; } + void setModified(bool val) { mIsModified = val; } private: //! Flag which indicates that item is modified - bool m_isModified; + bool mIsModified; //! Pointer to parent ProjectManagerModelItem *parentItem; @@ -83,11 +106,11 @@ class ProjectManagerModelItem: public QObject //Object name contains full path to item and shown name //! Name which will be shown in view - QVariant shownName; + QVariant mShownName; //! Relative(for files) or Absolute(for projects) path - QString filePath; + QString mFilePath; //! Type of item - ItemType type; + eItemType mItemType; }; @@ -106,7 +129,7 @@ class ProjectManagerModel : public QAbstractItemModel * @param type Item's type * @param rootItem Model's root item */ - ProjectManagerModelItem* addChild(const QString shownName, const QString filePath, ProjectManagerModelItem::ItemType type, ProjectManagerModelItem* rootItem); + ProjectManagerModelItem* addChild(const QString shownName, const QString filePath, ProjectManagerModelItem::eItemType type, ProjectManagerModelItem* rootItem); /*! Removes item from model * @param item which will be removed from model @@ -123,7 +146,7 @@ class ProjectManagerModel : public QAbstractItemModel * @param filePath Relative(for files) or Absolute(for projects) path to real file * @param type Item's type */ - void insertItem(const QString shownName, const QString filePath, ProjectManagerModelItem::ItemType type); + void insertItem(const QString shownName, const QString filePath, ProjectManagerModelItem::eItemType type); /*! Inserts project item to model * @param item Project item which will be inserted in model @@ -196,7 +219,7 @@ class ProjectManagerModel : public QAbstractItemModel private: //! Model's root item - ProjectManagerModelItem *rootItem; + ProjectManagerModelItem *mRootItem; }; diff --git a/sources/kbe/projectmanager.cpp b/sources/kbe/projectmanagerview.cpp similarity index 66% rename from sources/kbe/projectmanager.cpp rename to sources/kbe/projectmanagerview.cpp index 1045ff8..1bee6e2 100644 --- a/sources/kbe/projectmanager.cpp +++ b/sources/kbe/projectmanagerview.cpp @@ -1,4 +1,27 @@ -#include "projectmanager.h" +/* +----------------------------------------------------------------------------- +This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) +For the latest info, see http://www.ostis.net + +Copyright (c) 2010-2014 OSTIS + +OSTIS 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 3 of the License, or +(at your option) any later version. + +OSTIS is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with OSTIS. If not, see . +----------------------------------------------------------------------------- +*/ + +#include "projectmanagerview.h" +#include "projectmanagermodel.h" #include "pluginmanager.h" #include "newfiledialog.h" @@ -14,44 +37,15 @@ #include #include -ProjectManagerDockWidget* ProjectManagerDockWidget::mInstance = 0; - -ProjectManagerDockWidget::ProjectManagerDockWidget(QWidget *parent) : - QDockWidget(parent) -{ - treeView = new ProjectManagerView(this); - - this->setFeatures(QDockWidget::DockWidgetVerticalTitleBar); - - QFile file(":/media/stylesheets/projectmanager.qss"); - file.open(QFile::ReadOnly); - QString styleSheet = QLatin1String(file.readAll()); - treeView->setStyleSheet(styleSheet); - setWidget(treeView); -} -ProjectManagerDockWidget::~ProjectManagerDockWidget() +ProjectManagerView::ProjectManagerView(QWidget *parent) + : QTreeView(parent) { - Q_ASSERT(mInstance != 0); - mInstance = 0; -} + mModel = new ProjectManagerModel(this); + setModel(mModel); -ProjectManagerDockWidget* ProjectManagerDockWidget::instance() -{ - if (!mInstance) - mInstance = new ProjectManagerDockWidget(); - - return mInstance; -} - -ProjectManagerView::ProjectManagerView(QWidget *parent) : - QTreeView(parent) -{ - model = new ProjectManagerModel(this); - setModel(model); - - header() -> close(); + header()->close(); setContextMenuPolicy(Qt::CustomContextMenu); @@ -60,14 +54,13 @@ ProjectManagerView::ProjectManagerView(QWidget *parent) : setDragDropMode(QAbstractItemView::InternalMove); setDropIndicatorShown(true); - this->connect(this,SIGNAL(customContextMenuRequested(QPoint)), - SLOT(onContextMenuRequested(QPoint))); + connect(this,SIGNAL(customContextMenuRequested(QPoint)), SLOT(onContextMenuRequested(QPoint))); } void ProjectManagerView::onContextMenuRequested(QPoint mousePoint) { - ProjectManagerModelItem* item = model -> getItem(currentIndex()); + ProjectManagerModelItem* item = mModel->getItem(currentIndex()); createContextMenu(item); } @@ -83,60 +76,60 @@ void ProjectManagerView::createContextMenu(ProjectManagerModelItem* item) case ProjectManagerModelItem::Project: { #ifndef Q_OS_LINUX - menu -> addAction(QIcon(), tr("Show in explorer"), this, SLOT(onShowInExplorer())); - menu -> addSeparator(); + menu->addAction(QIcon(), tr("Show in explorer"), this, SLOT(onShowInExplorer())); + menu->addSeparator(); #endif - menu -> addAction(QIcon(":/media/icons/document-save.png"), tr("Save project"), this, SLOT(onProjectSave())); - menu -> addAction(QIcon(":/media/icons/window-close.png"), tr("Close Project"),this,SLOT(onProjectClose())); + menu->addAction(QIcon(":/media/icons/document-save.png"), tr("Save project"), this, SLOT(onProjectSave())); + menu->addAction(QIcon(":/media/icons/window-close.png"), tr("Close Project"),this,SLOT(onProjectClose())); - menu -> addSeparator(); + menu->addSeparator(); } case ProjectManagerModelItem::Filter: { - menu -> addAction(QIcon(":/media/icons/pm-add.png"), tr("Add File"),this,SLOT(onAddFile())); - menu -> addAction(QIcon(":/media/icons/pm-add.png"), tr("Add Existing Files"), this, SLOT(onAddExistingFiles())); - menu -> addAction(QIcon(":/media/icons/pm-add.png"), tr("Add Filter"), this, SLOT(onAddFilter())); + menu->addAction(QIcon(":/media/icons/pm-add.png"), tr("Add File"),this,SLOT(onAddFile())); + menu->addAction(QIcon(":/media/icons/pm-add.png"), tr("Add Existing Files"), this, SLOT(onAddExistingFiles())); + menu->addAction(QIcon(":/media/icons/pm-add.png"), tr("Add Filter"), this, SLOT(onAddFilter())); - menu -> addSeparator(); + menu->addSeparator(); - menu -> addAction(QIcon(), tr("Rename"), this, SLOT(onRename())); - QMenu* delMenu = menu -> addMenu(QIcon(), tr("Delete")); - delMenu -> addAction(QIcon(), tr("Delete From Project"),this,SLOT(onRemove())); - delMenu -> addAction(QIcon(), tr("Delete Permanently"),this,SLOT(onRemovePermanently())); + menu->addAction(QIcon(), tr("Rename"), this, SLOT(onRename())); + QMenu* delMenu = menu->addMenu(QIcon(), tr("Delete")); + delMenu->addAction(QIcon(), tr("Delete From Project"),this,SLOT(onRemove())); + delMenu->addAction(QIcon(), tr("Delete Permanently"),this,SLOT(onRemovePermanently())); - menu -> addSeparator(); + menu->addSeparator(); - menu -> addAction(QIcon(":/media/icons/pm-expand.png"),tr("Expand All"),this,SLOT(expandAll())); - menu -> addAction(QIcon(":/media/icons/pm-collapse.png"),tr("Collapse All"),this,SLOT(collapseAll())); + menu->addAction(QIcon(":/media/icons/pm-expand.png"),tr("Expand All"),this,SLOT(expandAll())); + menu->addAction(QIcon(":/media/icons/pm-collapse.png"),tr("Collapse All"),this,SLOT(collapseAll())); break; } case ProjectManagerModelItem::File: { - menu -> setDefaultAction(menu -> addAction(QIcon(), tr("Open file"),this,SLOT(onOpenFile()))); + menu->setDefaultAction(menu->addAction(QIcon(), tr("Open file"),this,SLOT(onOpenFile()))); #ifdef Q_OS_WIN - menu -> addAction(QIcon(), tr("Show in explorer"), this, SLOT(onShowInExplorer())); + menu->addAction(QIcon(), tr("Show in explorer"), this, SLOT(onShowInExplorer())); #endif - menu -> addSeparator(); + menu->addSeparator(); - menu -> addAction(QIcon(), tr("Rename"), this, SLOT(onFileRename())); - QMenu* delMenu = menu -> addMenu(QIcon(), tr("Delete")); - delMenu -> addAction(QIcon(), tr("Delete From Project"),this,SLOT(onRemove())); - delMenu -> addAction(QIcon(), tr("Delete Permanently"),this,SLOT(onRemovePermanently())); + menu->addAction(QIcon(), tr("Rename"), this, SLOT(onFileRename())); + QMenu* delMenu = menu->addMenu(QIcon(), tr("Delete")); + delMenu->addAction(QIcon(), tr("Delete From Project"),this,SLOT(onRemove())); + delMenu->addAction(QIcon(), tr("Delete Permanently"),this,SLOT(onRemovePermanently())); - menu -> addSeparator(); - menu -> addAction(QIcon(), tr("Properties"), this, SLOT(onPropertiesShow())); + menu->addSeparator(); + menu->addAction(QIcon(), tr("Properties"), this, SLOT(onPropertiesShow())); } } else { - menu -> addAction(QIcon(":/media/icons/pm-expand.png"),tr("Expand All"),this,SLOT(expandAll())); - menu -> addAction(QIcon(":/media/icons/pm-collapse.png"),tr("Collapse All"),this,SLOT(collapseAll())); + menu->addAction(QIcon(":/media/icons/pm-expand.png"),tr("Expand All"),this,SLOT(expandAll())); + menu->addAction(QIcon(":/media/icons/pm-collapse.png"),tr("Collapse All"),this,SLOT(collapseAll())); - menu -> addSeparator(); + menu->addSeparator(); - menu -> addAction(QIcon(":/media/icons/window-close.png"),tr("Close Project"),this,SLOT(onProjectClose())); + menu->addAction(QIcon(":/media/icons/window-close.png"),tr("Close Project"),this,SLOT(onProjectClose())); } menu->exec(QCursor::pos()); } @@ -144,18 +137,18 @@ void ProjectManagerView::createContextMenu(ProjectManagerModelItem* item) void ProjectManagerView::mouseDoubleClickEvent(QMouseEvent *event) { - ProjectManagerModelItem* item = model->getItem(indexAt(event->pos())); + ProjectManagerModelItem* item = mModel->getItem(indexAt(event->pos())); QTreeView::mouseDoubleClickEvent(event); if (item && item->getItemType() == ProjectManagerModelItem::File) { if (!QFile::exists(item->getAbsoluteFilePath())) { - QString filter = item -> getAbsoluteFilePath().split(SEPARATOR).last(); + QString filter = item->getAbsoluteFilePath().split(SEPARATOR).last(); filter.append(" ("+filter+");;"); filter.append(tr("Any file") + " (*." + item->getAbsoluteFilePath().split(".").last() + ")"); QString existingFileForReplace = QFileDialog::getOpenFileName(this, tr("File not found"), item->getAbsoluteFileDir(), - filter,0,QFileDialog::DontUseNativeDialog); + filter, 0, QFileDialog::DontUseNativeDialog); if (existingFileForReplace.isNull()) return; else @@ -166,7 +159,7 @@ void ProjectManagerView::mouseDoubleClickEvent(QMouseEvent *event) tr("\" instead \"") + item->getFilePath() + "\"", QMessageBox::Yes|QMessageBox::No); if (reply == QMessageBox::Yes) { - if (item -> getName() != QFileInfo(existingFileForReplace).fileName()) + if (item->getName() != QFileInfo(existingFileForReplace).fileName()) { item->setObjectName(item->parent()->objectName() + SEPARATOR + QFileInfo(existingFileForReplace).fileName()); item->setName(QFileInfo(existingFileForReplace).fileName()); @@ -189,13 +182,15 @@ void ProjectManagerView::updateTreeView() { QModelIndexList list; - Q_FOREACH (QModelIndex index, model->getPersistentIndexList()) + foreach (QModelIndex index, mModel->getPersistentIndexList()) + { if (isExpanded(index)) list << index; + } reset(); - Q_FOREACH (QModelIndex index, list) + foreach (QModelIndex index, list) if (index.isValid()) expand(index); } @@ -229,7 +224,7 @@ void ProjectManagerView::onProjectNew() QString absPath = projectFileInfo.absoluteFilePath(); QDir parentDir = projectFileInfo.absoluteDir(); - if (model->getRootItem()->findChild(name)) + if (mModel->getRootItem()->findChild(name)) { QMessageBox::warning(this,tr("Adding project error"),name+" "+tr("already exists")); return onProjectNew(); @@ -241,11 +236,11 @@ void ProjectManagerView::onProjectNew() parentDir = QDir(absPath); parentDir.mkdir("sources"); - ProjectManagerModelItem* project = new ProjectManagerModelItem(name,QFileInfo(absPath,name+".kbpro").absoluteFilePath(), + ProjectManagerModelItem* project = new ProjectManagerModelItem(name, QFileInfo(absPath, name + ".kbpro").absoluteFilePath(), ProjectManagerModelItem::Project, - model->getRootItem()); - model->insertProject(project); - model->saveProject(project, QFileInfo(absPath,name+".kbpro").absoluteFilePath()); + mModel->getRootItem()); + mModel->insertProject(project); + mModel->saveProject(project, QFileInfo(absPath, name + ".kbpro").absoluteFilePath()); emit event(ProjectCreated); } else @@ -257,7 +252,7 @@ void ProjectManagerView::onProjectNew() void ProjectManagerView::onProjectSave() { - if (ProjectManagerModelItem* rootItem = model->getRootItem()) + if (ProjectManagerModelItem* rootItem = mModel->getRootItem()) for (int i=0; i< rootItem->childCount(); i++) { QString fileName = rootItem->child(0)->getAbsoluteFilePath(); @@ -265,14 +260,14 @@ void ProjectManagerView::onProjectSave() if (rootItem->child(i)->getFilePath().isEmpty() || !QFile::exists(fileName)) { fileName = QFileDialog::getSaveFileName(this, tr("Project file not found"), - QDir::current().absolutePath(),rootItem->child(i)->getName()+"(*.kbpro)", + QDir::current().absolutePath(), rootItem->child(i)->getName() + "(*.kbpro)", 0,QFileDialog::DontUseNativeDialog); if (fileName.isEmpty()) continue; rootItem->child(i)->setFilePath(fileName); } - model->saveProject(rootItem->child(i),fileName); + mModel->saveProject(rootItem->child(i), fileName); emit event(ProjectSaved); } } @@ -281,7 +276,7 @@ void ProjectManagerView::onProjectSave() bool ProjectManagerView::onProjectClose() { - if (ProjectManagerModelItem* rootItem = model->getRootItem()) + if (ProjectManagerModelItem* rootItem = mModel->getRootItem()) while (rootItem->childCount()) { ProjectManagerModelItem* item = rootItem->child(0); @@ -301,21 +296,21 @@ bool ProjectManagerView::onProjectClose() if (item->getFilePath().isEmpty() || !QFile::exists(fileName)) { fileName = QFileDialog::getSaveFileName(this, tr("Project file not found"), - QDir::current().absolutePath(),item->getName()+("(*.kbpro)"), - 0,QFileDialog::DontUseNativeDialog); + QDir::current().absolutePath(), item->getName()+("(*.kbpro)"), + 0, QFileDialog::DontUseNativeDialog); if (fileName.isEmpty()) return false; item->setFilePath(fileName); } - model->saveProject(item,item->getAbsoluteFilePath()); + mModel->saveProject(item, item->getAbsoluteFilePath()); } case QMessageBox::No: break; } } - model->removeItem(item); + mModel->removeItem(item); } emit event(ProjectClosed); return true; @@ -324,11 +319,11 @@ bool ProjectManagerView::onProjectClose() void ProjectManagerView::onProjectOpen() { QString fileName = QFileDialog::getOpenFileName(this, tr("Choose project file"), - QDir::current().absolutePath(),tr("KBE project file")+("(*.kbpro)"), + QDir::current().absolutePath(), tr("KBE project file") + ("(*.kbpro)"), 0,QFileDialog::DontUseNativeDialog); if (!fileName.isEmpty()) { - model->loadProject(fileName); + mModel->loadProject(fileName); emit event(ProjectOpened); } } @@ -338,11 +333,11 @@ void ProjectManagerView::onRemove() { if (!currentIndex().isValid()) return; - ProjectManagerModelItem* item = model->getItem(currentIndex()); + ProjectManagerModelItem* item = mModel->getItem(currentIndex()); if (item && item->getItemType() != ProjectManagerModelItem::Project) { - model->removeItem(item); + mModel->removeItem(item); emit event(ProjectChanged); } } @@ -353,7 +348,7 @@ void ProjectManagerView::onRemovePermanently() if (!currentIndex().isValid()) return; - if (ProjectManagerModelItem* item = model->getItem(currentIndex())) + if (ProjectManagerModelItem* item = mModel->getItem(currentIndex())) switch (item->getItemType()) { case ProjectManagerModelItem::File: @@ -381,7 +376,7 @@ void ProjectManagerView::permanentRemoveTree(ProjectManagerModelItem *item) QFile::remove(item->getAbsoluteFilePath()); case ProjectManagerModelItem::Filter: - model->removeItem(item); + mModel->removeItem(item); } } @@ -391,10 +386,10 @@ void ProjectManagerView::renameItem(ProjectManagerModelItem *item, QString newNa { if (item && item->parent()) { - QString objName = item -> objectName(); - QString itemName = item -> getName(); - objName.replace(objName.length()-itemName.length(),itemName.length(), newName); - item -> setName(newName); + QString objName = item->objectName(); + QString itemName = item->getName(); + objName.replace(objName.length() - itemName.length(), itemName.length(), newName); + item->setName(newName); } } @@ -403,23 +398,26 @@ QString ProjectManagerView::onRename() { if (!currentIndex().isValid()) return QString(); - ProjectManagerModelItem* item = model->getItem(currentIndex()); + + ProjectManagerModelItem* item = mModel->getItem(currentIndex()); QString itemName(item->getName()); bool isAccepted = true; - QString newName = QInputDialog::getText(this,tr("Rename"),tr("Please type new name for ")+itemName, - QLineEdit::Normal,itemName,&isAccepted,Qt::Dialog); + QString newName = QInputDialog::getText(this, tr("Rename"), tr("Please type new name for ") + itemName, + QLineEdit::Normal, itemName, &isAccepted, Qt::Dialog); if (isAccepted && !newName.isEmpty() && newName != itemName) { - if (item->parent() && item->parent()->findChild(item->parent()->objectName()+"/"+newName)) + if (item->parent() && item->parent()->findChild(item->parent()->objectName() + "/"+newName)) { - QMessageBox::warning(this,tr("Rename error"),item->parent()->getName()+ " " + tr("already has") + " " + newName); + QMessageBox::warning(this, tr("Rename error"), item->parent()->getName() + " " + tr("already has") + " " + newName); return onRename(); } + emit event(ProjectChanged); - if (item -> getItemType() <= ProjectManagerModelItem::Filter) - renameItem(item,newName); + + if (item->getItemType() <= ProjectManagerModelItem::Filter) + renameItem(item, newName); return newName; } else @@ -432,7 +430,7 @@ void ProjectManagerView::onFileRename() if (!currentIndex().isValid()) return; - ProjectManagerModelItem* item = model->getItem(currentIndex()); + ProjectManagerModelItem* item = mModel->getItem(currentIndex()); QString newName = onRename(); @@ -440,7 +438,7 @@ void ProjectManagerView::onFileRename() if (!currentFileInfo.exists()) { - QMessageBox::critical(this,tr("Rename critical error"),tr("File not found on storage: ") + currentFileInfo.absoluteFilePath()); + QMessageBox::critical(this, tr("Rename critical error"), tr("File not found on storage: ") + currentFileInfo.absoluteFilePath()); return; } @@ -448,16 +446,16 @@ void ProjectManagerView::onFileRename() if (newFile.exists()) { - QMessageBox::warning(this,tr("Rename error"),newName + tr(" already exists in ") + currentFileInfo.absolutePath()); + QMessageBox::warning(this, tr("Rename error"), newName + tr(" already exists in ") + currentFileInfo.absolutePath()); onFileRename(); return; } - if (!QFile::rename(currentFileInfo.absoluteFilePath(),newFile.absoluteFilePath())) - QMessageBox::critical(this,tr("Rename critical error"),tr("Unknown error")); + if (!QFile::rename(currentFileInfo.absoluteFilePath(), newFile.absoluteFilePath())) + QMessageBox::critical(this, tr("Rename critical error"), tr("Unknown error")); else { - renameItem(item,newName); + renameItem(item, newName); emit event(ProjectChanged); } } @@ -468,17 +466,17 @@ void ProjectManagerView::onAddFilter() if (!currentIndex().isValid()) return; - ProjectManagerModelItem* item = model->getItem(currentIndex()); + ProjectManagerModelItem* item = mModel->getItem(currentIndex()); bool isAccepted = true; - QString name = QInputDialog::getText(this,tr("Add new filter"),tr("Please type name of new filter in") + " " + item->getName(), - QLineEdit::Normal, QString(),&isAccepted,Qt::Dialog); + QString name = QInputDialog::getText(this, tr("Add new filter"), tr("Please type name of new filter in") + " " + item->getName(), + QLineEdit::Normal, QString(), &isAccepted,Qt::Dialog); if (isAccepted && !name.isEmpty()) { QString fullName = item->objectName() + SEPARATOR + name; if (item->parent() && item->parent()->findChild(fullName)) { - QMessageBox::warning(this,tr("Adding filter error"),item->parent()->getName() + " " + tr("already has") + " " + name); + QMessageBox::warning(this, tr("Adding filter error"), item->parent()->getName() + " " + tr("already has") + " " + name); return onAddFilter(); } @@ -494,10 +492,10 @@ void ProjectManagerView::onAddFilter() localStorageDirsList.removeFirst(); QString localStorageDirPath = localStorageDirsList.join(SEPARATOR); - if (sourcesDir.mkpath(localStorageDirPath) || QDir(QFileInfo(sourcesDir.absolutePath(),localStorageDirPath).absolutePath()).exists()) + if (sourcesDir.mkpath(localStorageDirPath) || QDir(QFileInfo(sourcesDir.absolutePath(), localStorageDirPath).absolutePath()).exists()) { - model->insertItem(fullName,localStorageDirPath,ProjectManagerModelItem::Filter); + mModel->insertItem(fullName, localStorageDirPath, ProjectManagerModelItem::Filter); emit event(ProjectChanged); if (!isExpanded(currentIndex())) @@ -516,17 +514,17 @@ void ProjectManagerView::onAddExistingFiles() if (!currentIndex().isValid()) return; - ProjectManagerModelItem* filterItem = model->getItem(currentIndex()); + ProjectManagerModelItem* filterItem = mModel->getItem(currentIndex()); QString filterDirectory; if (filterItem->getItemType()==ProjectManagerModelItem::Project) filterDirectory = filterItem->getAbsoluteSourcesDir().absolutePath(); else filterDirectory = filterItem->getAbsoluteFileDir(); - QStringList files = QFileDialog::getOpenFileNames(this,tr("Add existing files"), + QStringList files = QFileDialog::getOpenFileNames(this, tr("Add existing files"), filterDirectory, PluginManager::instance()->openFilters(), - 0,QFileDialog::DontUseNativeDialog); + 0, QFileDialog::DontUseNativeDialog); QStringList errors; Q_FOREACH(QString filePath, files) { @@ -547,11 +545,11 @@ void ProjectManagerView::onAddExistingFiles() QString relativeFilePath = filterItem->getAbsoluteSourcesDir().relativeFilePath(absoluteFilePath); QString shownName = filterItem->getProjectItem()->objectName() + SEPARATOR + relativeFilePath; - if (ProjectManagerModelItem* findedItem = model->getItemByFilePath( relativeFilePath, filterItem->getProjectItem())) - errors.append( relativeFilePath + " " + tr("already exists in project as") + " " + findedItem->objectName()); + if (ProjectManagerModelItem* findedItem = mModel->getItemByFilePath( relativeFilePath, filterItem->getProjectItem())) + errors.append(relativeFilePath + " " + tr("already exists in project as") + " " + findedItem->objectName()); else { - model->insertItem(shownName,relativeFilePath,ProjectManagerModelItem::File); + mModel->insertItem(shownName, relativeFilePath, ProjectManagerModelItem::File); emit event(ProjectChanged); } @@ -562,7 +560,7 @@ void ProjectManagerView::onAddExistingFiles() updateTreeView(); if (!errors.isEmpty()) - QMessageBox::warning(this,tr("Add existing files error"),tr("Adding has some errors:") + "\n" + errors.join("\n")); + QMessageBox::warning(this, tr("Add existing files error"), tr("Adding has some errors:") + "\n" + errors.join("\n")); } @@ -570,10 +568,10 @@ void ProjectManagerView::onAddFile() { if (!currentIndex().isValid()) return; - ProjectManagerModelItem* item = model->getItem(currentIndex()); + ProjectManagerModelItem* item = mModel->getItem(currentIndex()); QString selectedFilter; - QString absoluteFilePath = QFileDialog::getSaveFileName(this,tr("Add file"), + QString absoluteFilePath = QFileDialog::getSaveFileName(this, tr("Add file"), item->getAbsoluteFileDir(), PluginManager::instance()->openFilters(), &selectedFilter, @@ -599,13 +597,14 @@ void ProjectManagerView::onAddFile() QString shownName = item->getProjectItem()->objectName() + SEPARATOR + relativeFilePath; - if (ProjectManagerModelItem* findedItem = model->getItemByFilePath( relativeFilePath, item->getProjectItem())) - model->removeItem(findedItem); + if (ProjectManagerModelItem* findedItem = mModel->getItemByFilePath( relativeFilePath, item->getProjectItem())) + mModel->removeItem(findedItem); - model->insertItem(shownName,relativeFilePath,ProjectManagerModelItem::File); + mModel->insertItem(shownName, relativeFilePath, ProjectManagerModelItem::File); if (!isExpanded(currentIndex())) setExpanded(currentIndex(), true); + updateTreeView(); emit event(ProjectChanged); @@ -615,17 +614,17 @@ void ProjectManagerView::onAddFile() void ProjectManagerView::onOpenFile() { - ProjectManagerModelItem* item = model->getItem(currentIndex()); + ProjectManagerModelItem* item = mModel->getItem(currentIndex()); if (item && item->getItemType() == ProjectManagerModelItem::File) { if (!QFile::exists(item->getAbsoluteFilePath())) { - QString filter = item -> getAbsoluteFilePath().split(SEPARATOR).last(); + QString filter = item->getAbsoluteFilePath().split(SEPARATOR).last(); filter.append(" ("+filter+");;"); filter.append(tr("Any file") + " (*." + item->getAbsoluteFilePath().split(".").last() + ")"); QString existingFileForReplace = QFileDialog::getOpenFileName(this, tr("File not found"), item->getAbsoluteFileDir(), - filter,0,QFileDialog::DontUseNativeDialog); + filter, 0, QFileDialog::DontUseNativeDialog); if (existingFileForReplace.isNull()) return; else @@ -636,7 +635,7 @@ void ProjectManagerView::onOpenFile() tr("\" instead \"") + item->getFilePath() + "\"", QMessageBox::Yes|QMessageBox::No); if (reply == QMessageBox::Yes) { - if (item -> getName() != QFileInfo(existingFileForReplace).fileName()) + if (item->getName() != QFileInfo(existingFileForReplace).fileName()) { item->setObjectName(item->parent()->objectName() + SEPARATOR + QFileInfo(existingFileForReplace).fileName()); item->setName(QFileInfo(existingFileForReplace).fileName()); @@ -661,7 +660,7 @@ void ProjectManagerView::onShowInExplorer() QString pathIn; if (!currentIndex().isValid()) return; - ProjectManagerModelItem* item = model->getItem(currentIndex()); + ProjectManagerModelItem* item = mModel->getItem(currentIndex()); if (item && !item->getFilePath().isEmpty()) pathIn = item->getAbsoluteFilePath(); else @@ -710,12 +709,12 @@ void ProjectManagerView::onPropertiesShow() { if (!currentIndex().isValid()) return; - if (ProjectManagerModelItem* item = model->getItem(currentIndex())) + if (ProjectManagerModelItem* item = mModel->getItem(currentIndex())) { QStringList properties; properties << tr("Item:") + "\t\t" + item->objectName(); properties << tr("File:") + "\t\t" + item->getAbsoluteFilePath(); properties << tr("Size:") + "\t\t" + QString::number(QFileInfo(item->getAbsoluteFilePath()).size()) << "bytes"; - QMessageBox::information(this,tr("Properties"),properties.join("\n")); + QMessageBox::information(this, tr("Properties"), properties.join("\n")); } } diff --git a/sources/kbe/projectmanager.h b/sources/kbe/projectmanagerview.h similarity index 61% rename from sources/kbe/projectmanager.h rename to sources/kbe/projectmanagerview.h index 6bd5cdc..da9f53c 100644 --- a/sources/kbe/projectmanager.h +++ b/sources/kbe/projectmanagerview.h @@ -1,39 +1,42 @@ -#ifndef PROJECTMANAGER_H -#define PROJECTMANAGER_H +/* +----------------------------------------------------------------------------- +This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) +For the latest info, see http://www.ostis.net -#include -#include +Copyright (c) 2010-2014 OSTIS -#include "projectmanagermodel.h" +OSTIS 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 3 of the License, or +(at your option) any later version. -class QMouseEvent; -class ProjectManagerView; -class ProjectManagerModel; -class ProjectManagerModelItem; +OSTIS is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. -class ProjectManagerDockWidget : public QDockWidget -{ - Q_OBJECT -public: - explicit ProjectManagerDockWidget(QWidget *parent = 0); - virtual ~ProjectManagerDockWidget(); +You should have received a copy of the GNU General Public License +along with OSTIS. If not, see . +----------------------------------------------------------------------------- +*/ - static ProjectManagerDockWidget* instance(); +#ifndef PROJECTMANAGERVIEW_H +#define PROJECTMANAGERVIEW_H - ProjectManagerView* getTreeView() { return treeView; } -private: - static ProjectManagerDockWidget* mInstance; +#include + +class QMouseEvent; +class ProjectManagerModel; +class ProjectManagerModelItem; - //! Content of this widget - ProjectManagerView *treeView; -}; class ProjectManagerView : public QTreeView { Q_OBJECT public: - enum ProjectManagerEvent { + enum eProjectManagerEvent + { DefaultEvent, ProjectCreated, ProjectOpened, @@ -41,7 +44,8 @@ class ProjectManagerView : public QTreeView ProjectClosed, ProjectChanged }; - Q_ENUMS(ProjectManagerEvent) + + Q_ENUMS(eProjectManagerEvent) explicit ProjectManagerView(QWidget *parent = 0); @@ -71,7 +75,7 @@ public slots: /*! This signal will send when ProjectManager modified(or managed) project. * @param Filename */ - void event(ProjectManagerView::ProjectManagerEvent); + void event(ProjectManagerView::eProjectManagerEvent); private: /*! Changes item name @@ -91,7 +95,7 @@ public slots: void createContextMenu(ProjectManagerModelItem* item); //! QTreeView::mousePressEvent with feature that item's focus will be removed if click occured on empty area - void mousePressEvent(QMouseEvent*); + void mousePressEvent(QMouseEvent *event); //! Opens file if double clicked item's type is file void mouseDoubleClickEvent(QMouseEvent *event); @@ -99,7 +103,7 @@ public slots: void updateTreeView(); private: - ProjectManagerModel* model; + ProjectManagerModel* mModel; }; #endif // PROJECTMANAGER_H diff --git a/sources/kbe/version.h b/sources/kbe/version.h index dfc6ce3..99b48d1 100644 --- a/sources/kbe/version.h +++ b/sources/kbe/version.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/m4scp/m4scpblockdata.h b/sources/plugins/m4scp/m4scpblockdata.h index d8c66f4..c6af4a4 100644 --- a/sources/plugins/m4scp/m4scpblockdata.h +++ b/sources/plugins/m4scp/m4scpblockdata.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/m4scp/m4scpcodeanalyzer.cpp b/sources/plugins/m4scp/m4scpcodeanalyzer.cpp index c140926..e3f9369 100644 --- a/sources/plugins/m4scp/m4scpcodeanalyzer.cpp +++ b/sources/plugins/m4scp/m4scpcodeanalyzer.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/m4scp/m4scpcodeanalyzer.h b/sources/plugins/m4scp/m4scpcodeanalyzer.h index 5c81f1d..7770125 100644 --- a/sources/plugins/m4scp/m4scpcodeanalyzer.h +++ b/sources/plugins/m4scp/m4scpcodeanalyzer.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/m4scp/m4scpcodecompleter.cpp b/sources/plugins/m4scp/m4scpcodecompleter.cpp index d77c135..c9bb861 100644 --- a/sources/plugins/m4scp/m4scpcodecompleter.cpp +++ b/sources/plugins/m4scp/m4scpcodecompleter.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/m4scp/m4scpcodecompleter.h b/sources/plugins/m4scp/m4scpcodecompleter.h index cb00daf..ffb21f4 100644 --- a/sources/plugins/m4scp/m4scpcodecompleter.h +++ b/sources/plugins/m4scp/m4scpcodecompleter.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/m4scp/m4scpcodeeditor.cpp b/sources/plugins/m4scp/m4scpcodeeditor.cpp index 6f944c7..4289807 100644 --- a/sources/plugins/m4scp/m4scpcodeeditor.cpp +++ b/sources/plugins/m4scp/m4scpcodeeditor.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/m4scp/m4scpcodeeditor.h b/sources/plugins/m4scp/m4scpcodeeditor.h index 493f0e4..6994a8c 100644 --- a/sources/plugins/m4scp/m4scpcodeeditor.h +++ b/sources/plugins/m4scp/m4scpcodeeditor.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/m4scp/m4scpplugin.cpp b/sources/plugins/m4scp/m4scpplugin.cpp index 5e415e6..925adfb 100644 --- a/sources/plugins/m4scp/m4scpplugin.cpp +++ b/sources/plugins/m4scp/m4scpplugin.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/m4scp/m4scpplugin.h b/sources/plugins/m4scp/m4scpplugin.h index 4070fb9..859eb21 100644 --- a/sources/plugins/m4scp/m4scpplugin.h +++ b/sources/plugins/m4scp/m4scpplugin.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/m4scp/m4scpsyntax.cpp b/sources/plugins/m4scp/m4scpsyntax.cpp index 38dfa22..e663f94 100644 --- a/sources/plugins/m4scp/m4scpsyntax.cpp +++ b/sources/plugins/m4scp/m4scpsyntax.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/m4scp/m4scpsyntax.h b/sources/plugins/m4scp/m4scpsyntax.h index c3a1585..17b9535 100644 --- a/sources/plugins/m4scp/m4scpsyntax.h +++ b/sources/plugins/m4scp/m4scpsyntax.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/m4scp/m4scpsyntaxhighlighter.cpp b/sources/plugins/m4scp/m4scpsyntaxhighlighter.cpp index c32854e..5363956 100644 --- a/sources/plugins/m4scp/m4scpsyntaxhighlighter.cpp +++ b/sources/plugins/m4scp/m4scpsyntaxhighlighter.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/m4scp/m4scpsyntaxhighlighter.h b/sources/plugins/m4scp/m4scpsyntaxhighlighter.h index 32c6b68..78e199f 100644 --- a/sources/plugins/m4scp/m4scpsyntaxhighlighter.h +++ b/sources/plugins/m4scp/m4scpsyntaxhighlighter.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/m4scp/m4scpwindow.cpp b/sources/plugins/m4scp/m4scpwindow.cpp index 329e394..eb3973f 100644 --- a/sources/plugins/m4scp/m4scpwindow.cpp +++ b/sources/plugins/m4scp/m4scpwindow.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/m4scp/m4scpwindow.h b/sources/plugins/m4scp/m4scpwindow.h index f6e2425..73181c7 100644 --- a/sources/plugins/m4scp/m4scpwindow.h +++ b/sources/plugins/m4scp/m4scpwindow.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/arrangers/scgarranger.cpp b/sources/plugins/scg/arrangers/scgarranger.cpp index 8ca6105..7591fb1 100644 --- a/sources/plugins/scg/arrangers/scgarranger.cpp +++ b/sources/plugins/scg/arrangers/scgarranger.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/arrangers/scgarranger.h b/sources/plugins/scg/arrangers/scgarranger.h index ae2343a..6064db1 100644 --- a/sources/plugins/scg/arrangers/scgarranger.h +++ b/sources/plugins/scg/arrangers/scgarranger.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/commands/scgbasecommand.cpp b/sources/plugins/scg/commands/scgbasecommand.cpp index 367c5b2..3ab3bf1 100644 --- a/sources/plugins/scg/commands/scgbasecommand.cpp +++ b/sources/plugins/scg/commands/scgbasecommand.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/commands/scgbasecommand.h b/sources/plugins/scg/commands/scgbasecommand.h index b574c0a..8840f00 100644 --- a/sources/plugins/scg/commands/scgbasecommand.h +++ b/sources/plugins/scg/commands/scgbasecommand.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/commands/scgcommandchangeincedentobject.cpp b/sources/plugins/scg/commands/scgcommandchangeincedentobject.cpp index 33dfdc4..b7cbd56 100644 --- a/sources/plugins/scg/commands/scgcommandchangeincedentobject.cpp +++ b/sources/plugins/scg/commands/scgcommandchangeincedentobject.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/commands/scgcommandchangeincedentobject.h b/sources/plugins/scg/commands/scgcommandchangeincedentobject.h index 4c790e5..fef323d 100644 --- a/sources/plugins/scg/commands/scgcommandchangeincedentobject.h +++ b/sources/plugins/scg/commands/scgcommandchangeincedentobject.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/commands/scgcommandclone.cpp b/sources/plugins/scg/commands/scgcommandclone.cpp index c95de0f..835d63a 100644 --- a/sources/plugins/scg/commands/scgcommandclone.cpp +++ b/sources/plugins/scg/commands/scgcommandclone.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/commands/scgcommandclone.h b/sources/plugins/scg/commands/scgcommandclone.h index ee520ef..5766584 100644 --- a/sources/plugins/scg/commands/scgcommandclone.h +++ b/sources/plugins/scg/commands/scgcommandclone.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/commands/scgcommandcontentchange.cpp b/sources/plugins/scg/commands/scgcommandcontentchange.cpp index 3120349..f7dc4f2 100644 --- a/sources/plugins/scg/commands/scgcommandcontentchange.cpp +++ b/sources/plugins/scg/commands/scgcommandcontentchange.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/commands/scgcommandcontentchange.h b/sources/plugins/scg/commands/scgcommandcontentchange.h index 1db360e..69caf98 100644 --- a/sources/plugins/scg/commands/scgcommandcontentchange.h +++ b/sources/plugins/scg/commands/scgcommandcontentchange.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/commands/scgcommandcontentvisibility.cpp b/sources/plugins/scg/commands/scgcommandcontentvisibility.cpp index 3e889fe..d814f23 100644 --- a/sources/plugins/scg/commands/scgcommandcontentvisibility.cpp +++ b/sources/plugins/scg/commands/scgcommandcontentvisibility.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/commands/scgcommandcontentvisibility.h b/sources/plugins/scg/commands/scgcommandcontentvisibility.h index 96d7940..79be2e3 100644 --- a/sources/plugins/scg/commands/scgcommandcontentvisibility.h +++ b/sources/plugins/scg/commands/scgcommandcontentvisibility.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/commands/scgcommandcreatebus.cpp b/sources/plugins/scg/commands/scgcommandcreatebus.cpp index d16478c..d96a91b 100644 --- a/sources/plugins/scg/commands/scgcommandcreatebus.cpp +++ b/sources/plugins/scg/commands/scgcommandcreatebus.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/commands/scgcommandcreatebus.h b/sources/plugins/scg/commands/scgcommandcreatebus.h index 91d01c5..2472b10 100644 --- a/sources/plugins/scg/commands/scgcommandcreatebus.h +++ b/sources/plugins/scg/commands/scgcommandcreatebus.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/commands/scgcommandcreatecontour.cpp b/sources/plugins/scg/commands/scgcommandcreatecontour.cpp index a225994..68ef92e 100644 --- a/sources/plugins/scg/commands/scgcommandcreatecontour.cpp +++ b/sources/plugins/scg/commands/scgcommandcreatecontour.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/commands/scgcommandcreatecontour.h b/sources/plugins/scg/commands/scgcommandcreatecontour.h index f59794a..a16cdd9 100644 --- a/sources/plugins/scg/commands/scgcommandcreatecontour.h +++ b/sources/plugins/scg/commands/scgcommandcreatecontour.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/commands/scgcommandcreatenode.cpp b/sources/plugins/scg/commands/scgcommandcreatenode.cpp index 4b3cc47..f52da88 100644 --- a/sources/plugins/scg/commands/scgcommandcreatenode.cpp +++ b/sources/plugins/scg/commands/scgcommandcreatenode.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/commands/scgcommandcreatenode.h b/sources/plugins/scg/commands/scgcommandcreatenode.h index c9ba7d5..b258d29 100644 --- a/sources/plugins/scg/commands/scgcommandcreatenode.h +++ b/sources/plugins/scg/commands/scgcommandcreatenode.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/commands/scgcommandcreatepair.cpp b/sources/plugins/scg/commands/scgcommandcreatepair.cpp index 4e9f46c..64b8403 100644 --- a/sources/plugins/scg/commands/scgcommandcreatepair.cpp +++ b/sources/plugins/scg/commands/scgcommandcreatepair.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/commands/scgcommandcreatepair.h b/sources/plugins/scg/commands/scgcommandcreatepair.h index cd6e6da..e120fa8 100644 --- a/sources/plugins/scg/commands/scgcommandcreatepair.h +++ b/sources/plugins/scg/commands/scgcommandcreatepair.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/commands/scgcommanddeletecontour.cpp b/sources/plugins/scg/commands/scgcommanddeletecontour.cpp index d18ebfc..c2cee0c 100644 --- a/sources/plugins/scg/commands/scgcommanddeletecontour.cpp +++ b/sources/plugins/scg/commands/scgcommanddeletecontour.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/commands/scgcommanddeletecontour.h b/sources/plugins/scg/commands/scgcommanddeletecontour.h index 4ac07c6..792d2b7 100644 --- a/sources/plugins/scg/commands/scgcommanddeletecontour.h +++ b/sources/plugins/scg/commands/scgcommanddeletecontour.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/commands/scgcommandidtfmove.cpp b/sources/plugins/scg/commands/scgcommandidtfmove.cpp index f9196bc..919f067 100644 --- a/sources/plugins/scg/commands/scgcommandidtfmove.cpp +++ b/sources/plugins/scg/commands/scgcommandidtfmove.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/commands/scgcommandidtfmove.h b/sources/plugins/scg/commands/scgcommandidtfmove.h index 0a95548..a9499b5 100644 --- a/sources/plugins/scg/commands/scgcommandidtfmove.h +++ b/sources/plugins/scg/commands/scgcommandidtfmove.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/commands/scgcommandinsert.cpp b/sources/plugins/scg/commands/scgcommandinsert.cpp index d13a3e6..2b0e576 100644 --- a/sources/plugins/scg/commands/scgcommandinsert.cpp +++ b/sources/plugins/scg/commands/scgcommandinsert.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/commands/scgcommandinsert.h b/sources/plugins/scg/commands/scgcommandinsert.h index 69cf18e..1bebc47 100644 --- a/sources/plugins/scg/commands/scgcommandinsert.h +++ b/sources/plugins/scg/commands/scgcommandinsert.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/commands/scgcommandminimizecontour.cpp b/sources/plugins/scg/commands/scgcommandminimizecontour.cpp index 508e843..ecb2ae0 100644 --- a/sources/plugins/scg/commands/scgcommandminimizecontour.cpp +++ b/sources/plugins/scg/commands/scgcommandminimizecontour.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/commands/scgcommandminimizecontour.h b/sources/plugins/scg/commands/scgcommandminimizecontour.h index 91e8e88..b83645e 100644 --- a/sources/plugins/scg/commands/scgcommandminimizecontour.h +++ b/sources/plugins/scg/commands/scgcommandminimizecontour.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/commands/scgcommandobjectdelete.cpp b/sources/plugins/scg/commands/scgcommandobjectdelete.cpp index 9ad68f8..060b6d0 100644 --- a/sources/plugins/scg/commands/scgcommandobjectdelete.cpp +++ b/sources/plugins/scg/commands/scgcommandobjectdelete.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/commands/scgcommandobjectdelete.h b/sources/plugins/scg/commands/scgcommandobjectdelete.h index a54bdd9..debc0b4 100644 --- a/sources/plugins/scg/commands/scgcommandobjectdelete.h +++ b/sources/plugins/scg/commands/scgcommandobjectdelete.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/commands/scgcommandobjectidtfchange.cpp b/sources/plugins/scg/commands/scgcommandobjectidtfchange.cpp index ecf06e5..3aa6953 100644 --- a/sources/plugins/scg/commands/scgcommandobjectidtfchange.cpp +++ b/sources/plugins/scg/commands/scgcommandobjectidtfchange.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/commands/scgcommandobjectidtfchange.h b/sources/plugins/scg/commands/scgcommandobjectidtfchange.h index 8b2172e..3454787 100644 --- a/sources/plugins/scg/commands/scgcommandobjectidtfchange.h +++ b/sources/plugins/scg/commands/scgcommandobjectidtfchange.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/commands/scgcommandobjectmove.cpp b/sources/plugins/scg/commands/scgcommandobjectmove.cpp index 183d7e4..f5a8b90 100644 --- a/sources/plugins/scg/commands/scgcommandobjectmove.cpp +++ b/sources/plugins/scg/commands/scgcommandobjectmove.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/commands/scgcommandobjectmove.h b/sources/plugins/scg/commands/scgcommandobjectmove.h index 77ad012..341dc66 100644 --- a/sources/plugins/scg/commands/scgcommandobjectmove.h +++ b/sources/plugins/scg/commands/scgcommandobjectmove.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/commands/scgcommandobjecttypechange.cpp b/sources/plugins/scg/commands/scgcommandobjecttypechange.cpp index 9ff62c3..bba4305 100644 --- a/sources/plugins/scg/commands/scgcommandobjecttypechange.cpp +++ b/sources/plugins/scg/commands/scgcommandobjecttypechange.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/commands/scgcommandobjecttypechange.h b/sources/plugins/scg/commands/scgcommandobjecttypechange.h index bcb8883..01695ad 100644 --- a/sources/plugins/scg/commands/scgcommandobjecttypechange.h +++ b/sources/plugins/scg/commands/scgcommandobjecttypechange.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/commands/scgcommandpointmove.cpp b/sources/plugins/scg/commands/scgcommandpointmove.cpp index 25df8c5..12c7fca 100644 --- a/sources/plugins/scg/commands/scgcommandpointmove.cpp +++ b/sources/plugins/scg/commands/scgcommandpointmove.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/commands/scgcommandpointmove.h b/sources/plugins/scg/commands/scgcommandpointmove.h index 70bd64f..31d3a7e 100644 --- a/sources/plugins/scg/commands/scgcommandpointmove.h +++ b/sources/plugins/scg/commands/scgcommandpointmove.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/commands/scgcommandpointschange.cpp b/sources/plugins/scg/commands/scgcommandpointschange.cpp index 1e1e6fa..d00d899 100644 --- a/sources/plugins/scg/commands/scgcommandpointschange.cpp +++ b/sources/plugins/scg/commands/scgcommandpointschange.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/commands/scgcommandpointschange.h b/sources/plugins/scg/commands/scgcommandpointschange.h index 7decbf7..9a91219 100644 --- a/sources/plugins/scg/commands/scgcommandpointschange.h +++ b/sources/plugins/scg/commands/scgcommandpointschange.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/commands/scgcommandremovebreakpoints.cpp b/sources/plugins/scg/commands/scgcommandremovebreakpoints.cpp index 009395c..6a588fb 100644 --- a/sources/plugins/scg/commands/scgcommandremovebreakpoints.cpp +++ b/sources/plugins/scg/commands/scgcommandremovebreakpoints.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/commands/scgcommandremovebreakpoints.h b/sources/plugins/scg/commands/scgcommandremovebreakpoints.h index a21fd7c..068f242 100644 --- a/sources/plugins/scg/commands/scgcommandremovebreakpoints.h +++ b/sources/plugins/scg/commands/scgcommandremovebreakpoints.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/commands/scgcommandselectedobjectmove.cpp b/sources/plugins/scg/commands/scgcommandselectedobjectmove.cpp index 95b4b0b..457c03f 100644 --- a/sources/plugins/scg/commands/scgcommandselectedobjectmove.cpp +++ b/sources/plugins/scg/commands/scgcommandselectedobjectmove.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/commands/scgcommandselectedobjectmove.h b/sources/plugins/scg/commands/scgcommandselectedobjectmove.h index e2a510b..bfdf01f 100644 --- a/sources/plugins/scg/commands/scgcommandselectedobjectmove.h +++ b/sources/plugins/scg/commands/scgcommandselectedobjectmove.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/commands/scgcommandswappairorient.cpp b/sources/plugins/scg/commands/scgcommandswappairorient.cpp index 8a237b2..7648d1f 100644 --- a/sources/plugins/scg/commands/scgcommandswappairorient.cpp +++ b/sources/plugins/scg/commands/scgcommandswappairorient.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/commands/scgcommandswappairorient.h b/sources/plugins/scg/commands/scgcommandswappairorient.h index e26d176..d72f7bb 100644 --- a/sources/plugins/scg/commands/scgcommandswappairorient.h +++ b/sources/plugins/scg/commands/scgcommandswappairorient.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/gwf/gwffileloader.cpp b/sources/plugins/scg/gwf/gwffileloader.cpp index fc99848..448a9a0 100644 --- a/sources/plugins/scg/gwf/gwffileloader.cpp +++ b/sources/plugins/scg/gwf/gwffileloader.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/gwf/gwffileloader.h b/sources/plugins/scg/gwf/gwffileloader.h index 33c7858..eae6799 100644 --- a/sources/plugins/scg/gwf/gwffileloader.h +++ b/sources/plugins/scg/gwf/gwffileloader.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/gwf/gwffilewriter.cpp b/sources/plugins/scg/gwf/gwffilewriter.cpp index 7bed561..c963d84 100644 --- a/sources/plugins/scg/gwf/gwffilewriter.cpp +++ b/sources/plugins/scg/gwf/gwffilewriter.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/gwf/gwffilewriter.h b/sources/plugins/scg/gwf/gwffilewriter.h index ae2f567..0cdf9c0 100644 --- a/sources/plugins/scg/gwf/gwffilewriter.h +++ b/sources/plugins/scg/gwf/gwffilewriter.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/gwf/gwfobjectinforeader.cpp b/sources/plugins/scg/gwf/gwfobjectinforeader.cpp index 01e6235..67a1cab 100644 --- a/sources/plugins/scg/gwf/gwfobjectinforeader.cpp +++ b/sources/plugins/scg/gwf/gwfobjectinforeader.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/gwf/gwfobjectinforeader.h b/sources/plugins/scg/gwf/gwfobjectinforeader.h index d4cf2cf..7bf29a6 100644 --- a/sources/plugins/scg/gwf/gwfobjectinforeader.h +++ b/sources/plugins/scg/gwf/gwfobjectinforeader.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/gwf/gwfstreamwriter.cpp b/sources/plugins/scg/gwf/gwfstreamwriter.cpp index f58c249..bbb0009 100644 --- a/sources/plugins/scg/gwf/gwfstreamwriter.cpp +++ b/sources/plugins/scg/gwf/gwfstreamwriter.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/gwf/gwfstreamwriter.h b/sources/plugins/scg/gwf/gwfstreamwriter.h index a71411c..68645f9 100644 --- a/sources/plugins/scg/gwf/gwfstreamwriter.h +++ b/sources/plugins/scg/gwf/gwfstreamwriter.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/modes/scgbusmode.cpp b/sources/plugins/scg/modes/scgbusmode.cpp index 7e931f5..3d15544 100644 --- a/sources/plugins/scg/modes/scgbusmode.cpp +++ b/sources/plugins/scg/modes/scgbusmode.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/modes/scgbusmode.h b/sources/plugins/scg/modes/scgbusmode.h index e8fa982..1c7164a 100644 --- a/sources/plugins/scg/modes/scgbusmode.h +++ b/sources/plugins/scg/modes/scgbusmode.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/modes/scgclonemode.cpp b/sources/plugins/scg/modes/scgclonemode.cpp index 3f431f4..f16fff8 100644 --- a/sources/plugins/scg/modes/scgclonemode.cpp +++ b/sources/plugins/scg/modes/scgclonemode.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/modes/scgclonemode.h b/sources/plugins/scg/modes/scgclonemode.h index 4d4e5ec..454df40 100644 --- a/sources/plugins/scg/modes/scgclonemode.h +++ b/sources/plugins/scg/modes/scgclonemode.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/modes/scgcontourmode.cpp b/sources/plugins/scg/modes/scgcontourmode.cpp index da0c455..929977a 100644 --- a/sources/plugins/scg/modes/scgcontourmode.cpp +++ b/sources/plugins/scg/modes/scgcontourmode.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/modes/scgcontourmode.h b/sources/plugins/scg/modes/scgcontourmode.h index c2a4a4f..1fb07b4 100644 --- a/sources/plugins/scg/modes/scgcontourmode.h +++ b/sources/plugins/scg/modes/scgcontourmode.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/modes/scginsertmode.cpp b/sources/plugins/scg/modes/scginsertmode.cpp index 2d23dc8..bf9927a 100644 --- a/sources/plugins/scg/modes/scginsertmode.cpp +++ b/sources/plugins/scg/modes/scginsertmode.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/modes/scginsertmode.h b/sources/plugins/scg/modes/scginsertmode.h index 7027385..99236f4 100644 --- a/sources/plugins/scg/modes/scginsertmode.h +++ b/sources/plugins/scg/modes/scginsertmode.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/modes/scgmode.cpp b/sources/plugins/scg/modes/scgmode.cpp index 93daba2..4ce1f28 100644 --- a/sources/plugins/scg/modes/scgmode.cpp +++ b/sources/plugins/scg/modes/scgmode.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/modes/scgmode.h b/sources/plugins/scg/modes/scgmode.h index 9e4c3f0..ba21379 100644 --- a/sources/plugins/scg/modes/scgmode.h +++ b/sources/plugins/scg/modes/scgmode.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/modes/scgpairmode.cpp b/sources/plugins/scg/modes/scgpairmode.cpp index 4d5eb49..a4e704e 100644 --- a/sources/plugins/scg/modes/scgpairmode.cpp +++ b/sources/plugins/scg/modes/scgpairmode.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/modes/scgpairmode.h b/sources/plugins/scg/modes/scgpairmode.h index cfad341..3699ec4 100644 --- a/sources/plugins/scg/modes/scgpairmode.h +++ b/sources/plugins/scg/modes/scgpairmode.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/modes/scgselectmode.cpp b/sources/plugins/scg/modes/scgselectmode.cpp index 520fe5a..0e83f61 100644 --- a/sources/plugins/scg/modes/scgselectmode.cpp +++ b/sources/plugins/scg/modes/scgselectmode.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/modes/scgselectmode.h b/sources/plugins/scg/modes/scgselectmode.h index ff9e1d0..a2c731c 100644 --- a/sources/plugins/scg/modes/scgselectmode.h +++ b/sources/plugins/scg/modes/scgselectmode.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/scgabstractobjectbuilder.cpp b/sources/plugins/scg/scgabstractobjectbuilder.cpp index 26c1e0c..a1a1452 100644 --- a/sources/plugins/scg/scgabstractobjectbuilder.cpp +++ b/sources/plugins/scg/scgabstractobjectbuilder.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/scgabstractobjectbuilder.h b/sources/plugins/scg/scgabstractobjectbuilder.h index 2dc7b47..2d6dd3f 100644 --- a/sources/plugins/scg/scgabstractobjectbuilder.h +++ b/sources/plugins/scg/scgabstractobjectbuilder.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/scgalphabet.cpp b/sources/plugins/scg/scgalphabet.cpp index f11a4b6..1d4c871 100644 --- a/sources/plugins/scg/scgalphabet.cpp +++ b/sources/plugins/scg/scgalphabet.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/scgalphabet.h b/sources/plugins/scg/scgalphabet.h index 0b45e0f..0685626 100644 --- a/sources/plugins/scg/scgalphabet.h +++ b/sources/plugins/scg/scgalphabet.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/scgbus.cpp b/sources/plugins/scg/scgbus.cpp index e3e82eb..f6989be 100644 --- a/sources/plugins/scg/scgbus.cpp +++ b/sources/plugins/scg/scgbus.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/scgbus.h b/sources/plugins/scg/scgbus.h index 98799b0..fd7cfef 100644 --- a/sources/plugins/scg/scgbus.h +++ b/sources/plugins/scg/scgbus.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/scgcontent.cpp b/sources/plugins/scg/scgcontent.cpp index 2656a55..154a232 100644 --- a/sources/plugins/scg/scgcontent.cpp +++ b/sources/plugins/scg/scgcontent.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/scgcontent.h b/sources/plugins/scg/scgcontent.h index 530ef7a..32f6693 100644 --- a/sources/plugins/scg/scgcontent.h +++ b/sources/plugins/scg/scgcontent.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/scgcontentchangedialog.cpp b/sources/plugins/scg/scgcontentchangedialog.cpp index d7d5b8e..d009bb2 100644 --- a/sources/plugins/scg/scgcontentchangedialog.cpp +++ b/sources/plugins/scg/scgcontentchangedialog.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/scgcontentchangedialog.h b/sources/plugins/scg/scgcontentchangedialog.h index f05d2d6..cf30c9c 100644 --- a/sources/plugins/scg/scgcontentchangedialog.h +++ b/sources/plugins/scg/scgcontentchangedialog.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/scgcontentdialog.cpp b/sources/plugins/scg/scgcontentdialog.cpp index 5d26ba3..7fcdb43 100644 --- a/sources/plugins/scg/scgcontentdialog.cpp +++ b/sources/plugins/scg/scgcontentdialog.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/scgcontentdialog.h b/sources/plugins/scg/scgcontentdialog.h index 65e329a..40f6260 100644 --- a/sources/plugins/scg/scgcontentdialog.h +++ b/sources/plugins/scg/scgcontentdialog.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/scgcontentfactory.cpp b/sources/plugins/scg/scgcontentfactory.cpp index e68ee07..9116740 100644 --- a/sources/plugins/scg/scgcontentfactory.cpp +++ b/sources/plugins/scg/scgcontentfactory.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/scgcontentfactory.h b/sources/plugins/scg/scgcontentfactory.h index d72a4c5..bdc3a84 100644 --- a/sources/plugins/scg/scgcontentfactory.h +++ b/sources/plugins/scg/scgcontentfactory.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/scgcontentimage.cpp b/sources/plugins/scg/scgcontentimage.cpp index 449b4f5..31b9433 100644 --- a/sources/plugins/scg/scgcontentimage.cpp +++ b/sources/plugins/scg/scgcontentimage.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/scgcontentimage.h b/sources/plugins/scg/scgcontentimage.h index 3cde5f5..9521ab9 100644 --- a/sources/plugins/scg/scgcontentimage.h +++ b/sources/plugins/scg/scgcontentimage.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/scgcontentnumeric.cpp b/sources/plugins/scg/scgcontentnumeric.cpp index 05775b8..be67379 100644 --- a/sources/plugins/scg/scgcontentnumeric.cpp +++ b/sources/plugins/scg/scgcontentnumeric.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/scgcontentnumeric.h b/sources/plugins/scg/scgcontentnumeric.h index 72cc418..50b1251 100644 --- a/sources/plugins/scg/scgcontentnumeric.h +++ b/sources/plugins/scg/scgcontentnumeric.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/scgcontentstring.cpp b/sources/plugins/scg/scgcontentstring.cpp index 2e0280d..c35295e 100644 --- a/sources/plugins/scg/scgcontentstring.cpp +++ b/sources/plugins/scg/scgcontentstring.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/scgcontentstring.h b/sources/plugins/scg/scgcontentstring.h index ecebe07..fd7fc88 100644 --- a/sources/plugins/scg/scgcontentstring.h +++ b/sources/plugins/scg/scgcontentstring.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/scgcontentvideo.cpp b/sources/plugins/scg/scgcontentvideo.cpp index d54cba2..27ba0cf 100644 --- a/sources/plugins/scg/scgcontentvideo.cpp +++ b/sources/plugins/scg/scgcontentvideo.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/scgcontentvideo.h b/sources/plugins/scg/scgcontentvideo.h index 5c659bb..4bb0fa8 100644 --- a/sources/plugins/scg/scgcontentvideo.h +++ b/sources/plugins/scg/scgcontentvideo.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/scgcontentviewer.cpp b/sources/plugins/scg/scgcontentviewer.cpp index a966e5c..814e6a7 100644 --- a/sources/plugins/scg/scgcontentviewer.cpp +++ b/sources/plugins/scg/scgcontentviewer.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/scgcontentviewer.h b/sources/plugins/scg/scgcontentviewer.h index e9e7aa9..bd49f46 100644 --- a/sources/plugins/scg/scgcontentviewer.h +++ b/sources/plugins/scg/scgcontentviewer.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/scgcontour.cpp b/sources/plugins/scg/scgcontour.cpp index 2cec386..4effd13 100644 --- a/sources/plugins/scg/scgcontour.cpp +++ b/sources/plugins/scg/scgcontour.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/scgcontour.h b/sources/plugins/scg/scgcontour.h index 9e30b56..27a4b18 100644 --- a/sources/plugins/scg/scgcontour.h +++ b/sources/plugins/scg/scgcontour.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/scgdefaultobjectbuilder.cpp b/sources/plugins/scg/scgdefaultobjectbuilder.cpp index 7df5017..e58b4f6 100644 --- a/sources/plugins/scg/scgdefaultobjectbuilder.cpp +++ b/sources/plugins/scg/scgdefaultobjectbuilder.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/scgdefaultobjectbuilder.h b/sources/plugins/scg/scgdefaultobjectbuilder.h index e8a9088..8e111aa 100644 --- a/sources/plugins/scg/scgdefaultobjectbuilder.h +++ b/sources/plugins/scg/scgdefaultobjectbuilder.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/scgexportimage.cpp b/sources/plugins/scg/scgexportimage.cpp index e49f1e6..28d3436 100644 --- a/sources/plugins/scg/scgexportimage.cpp +++ b/sources/plugins/scg/scgexportimage.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/scgexportimage.h b/sources/plugins/scg/scgexportimage.h index 46fae89..4be83dd 100644 --- a/sources/plugins/scg/scgexportimage.h +++ b/sources/plugins/scg/scgexportimage.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/scgfilewriterimage.cpp b/sources/plugins/scg/scgfilewriterimage.cpp index 3af3c17..b11d860 100644 --- a/sources/plugins/scg/scgfilewriterimage.cpp +++ b/sources/plugins/scg/scgfilewriterimage.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/scgfilewriterimage.h b/sources/plugins/scg/scgfilewriterimage.h index a9096a9..ae7cdb1 100644 --- a/sources/plugins/scg/scgfilewriterimage.h +++ b/sources/plugins/scg/scgfilewriterimage.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/scgfindwidget.cpp b/sources/plugins/scg/scgfindwidget.cpp index 7831e9d..361a893 100644 --- a/sources/plugins/scg/scgfindwidget.cpp +++ b/sources/plugins/scg/scgfindwidget.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/scgfindwidget.h b/sources/plugins/scg/scgfindwidget.h index effa0a7..7d60215 100644 --- a/sources/plugins/scg/scgfindwidget.h +++ b/sources/plugins/scg/scgfindwidget.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/scglayoutmanager.cpp b/sources/plugins/scg/scglayoutmanager.cpp index c3ccd51..c85a680 100644 --- a/sources/plugins/scg/scglayoutmanager.cpp +++ b/sources/plugins/scg/scglayoutmanager.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/scglayoutmanager.h b/sources/plugins/scg/scglayoutmanager.h index 586f361..bfccb7c 100644 --- a/sources/plugins/scg/scglayoutmanager.h +++ b/sources/plugins/scg/scglayoutmanager.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/scgminimap.cpp b/sources/plugins/scg/scgminimap.cpp index f68fb1b..3c7759c 100644 --- a/sources/plugins/scg/scgminimap.cpp +++ b/sources/plugins/scg/scgminimap.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/scgminimap.h b/sources/plugins/scg/scgminimap.h index cf2829a..d16aeac 100644 --- a/sources/plugins/scg/scgminimap.h +++ b/sources/plugins/scg/scgminimap.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/scgnode.cpp b/sources/plugins/scg/scgnode.cpp index fd1aab4..b4d2e7f 100644 --- a/sources/plugins/scg/scgnode.cpp +++ b/sources/plugins/scg/scgnode.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/scgnode.h b/sources/plugins/scg/scgnode.h index e54a3e7..3fab27a 100644 --- a/sources/plugins/scg/scgnode.h +++ b/sources/plugins/scg/scgnode.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/scgnodetextitem.cpp b/sources/plugins/scg/scgnodetextitem.cpp index 5e58046..75d1fe8 100644 --- a/sources/plugins/scg/scgnodetextitem.cpp +++ b/sources/plugins/scg/scgnodetextitem.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/scgnodetextitem.h b/sources/plugins/scg/scgnodetextitem.h index 79e6a71..0903035 100644 --- a/sources/plugins/scg/scgnodetextitem.h +++ b/sources/plugins/scg/scgnodetextitem.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/scgobject.cpp b/sources/plugins/scg/scgobject.cpp index e88482d..493b0dc 100644 --- a/sources/plugins/scg/scgobject.cpp +++ b/sources/plugins/scg/scgobject.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/scgobject.h b/sources/plugins/scg/scgobject.h index 9f06a1f..ed060c2 100644 --- a/sources/plugins/scg/scgobject.h +++ b/sources/plugins/scg/scgobject.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/scgobjectsinfo.cpp b/sources/plugins/scg/scgobjectsinfo.cpp index e63b3ba..e12a156 100644 --- a/sources/plugins/scg/scgobjectsinfo.cpp +++ b/sources/plugins/scg/scgobjectsinfo.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/scgobjectsinfo.h b/sources/plugins/scg/scgobjectsinfo.h index 6dce6de..5686bd8 100644 --- a/sources/plugins/scg/scgobjectsinfo.h +++ b/sources/plugins/scg/scgobjectsinfo.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/scgobjectsinfodata.cpp b/sources/plugins/scg/scgobjectsinfodata.cpp index 8e0d123..7f1a280 100644 --- a/sources/plugins/scg/scgobjectsinfodata.cpp +++ b/sources/plugins/scg/scgobjectsinfodata.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/scgobjectsinfodata.h b/sources/plugins/scg/scgobjectsinfodata.h index d5e3fc1..b4a15c5 100644 --- a/sources/plugins/scg/scgobjectsinfodata.h +++ b/sources/plugins/scg/scgobjectsinfodata.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/scgpair.cpp b/sources/plugins/scg/scgpair.cpp index 4214070..f187da4 100644 --- a/sources/plugins/scg/scgpair.cpp +++ b/sources/plugins/scg/scgpair.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/scgpair.h b/sources/plugins/scg/scgpair.h index dd71976..7d3b6ac 100644 --- a/sources/plugins/scg/scgpair.h +++ b/sources/plugins/scg/scgpair.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/scgplugin.cpp b/sources/plugins/scg/scgplugin.cpp index 90680a0..881c6f9 100644 --- a/sources/plugins/scg/scgplugin.cpp +++ b/sources/plugins/scg/scgplugin.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/scgplugin.h b/sources/plugins/scg/scgplugin.h index ae744a2..64acff7 100644 --- a/sources/plugins/scg/scgplugin.h +++ b/sources/plugins/scg/scgplugin.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/scgpointobject.cpp b/sources/plugins/scg/scgpointobject.cpp index a20160c..71fc7f7 100644 --- a/sources/plugins/scg/scgpointobject.cpp +++ b/sources/plugins/scg/scgpointobject.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/scgpointobject.h b/sources/plugins/scg/scgpointobject.h index f962a8e..83f09da 100644 --- a/sources/plugins/scg/scgpointobject.h +++ b/sources/plugins/scg/scgpointobject.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/scgscene.cpp b/sources/plugins/scg/scgscene.cpp index a42848a..eb8cf52 100644 --- a/sources/plugins/scg/scgscene.cpp +++ b/sources/plugins/scg/scgscene.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/scgscene.h b/sources/plugins/scg/scgscene.h index 978d3a4..676f7b7 100644 --- a/sources/plugins/scg/scgscene.h +++ b/sources/plugins/scg/scgscene.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/scgtemplateobjectbuilder.cpp b/sources/plugins/scg/scgtemplateobjectbuilder.cpp index 82d6d02..18ebe4d 100644 --- a/sources/plugins/scg/scgtemplateobjectbuilder.cpp +++ b/sources/plugins/scg/scgtemplateobjectbuilder.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/scgtemplateobjectbuilder.h b/sources/plugins/scg/scgtemplateobjectbuilder.h index 45e7941..b9410f9 100644 --- a/sources/plugins/scg/scgtemplateobjectbuilder.h +++ b/sources/plugins/scg/scgtemplateobjectbuilder.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/scgtextitem.cpp b/sources/plugins/scg/scgtextitem.cpp index d0bbc76..64fcc89 100644 --- a/sources/plugins/scg/scgtextitem.cpp +++ b/sources/plugins/scg/scgtextitem.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/scgtextitem.h b/sources/plugins/scg/scgtextitem.h index 0a6b94d..46f61fd 100644 --- a/sources/plugins/scg/scgtextitem.h +++ b/sources/plugins/scg/scgtextitem.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/scgundoview.cpp b/sources/plugins/scg/scgundoview.cpp index d2bd86b..96d0006 100644 --- a/sources/plugins/scg/scgundoview.cpp +++ b/sources/plugins/scg/scgundoview.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/scgundoview.h b/sources/plugins/scg/scgundoview.h index 517d215..38f1f43 100644 --- a/sources/plugins/scg/scgundoview.h +++ b/sources/plugins/scg/scgundoview.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/scgundoviewmodel.cpp b/sources/plugins/scg/scgundoviewmodel.cpp index 999e40b..36237f4 100644 --- a/sources/plugins/scg/scgundoviewmodel.cpp +++ b/sources/plugins/scg/scgundoviewmodel.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/scgundoviewmodel.h b/sources/plugins/scg/scgundoviewmodel.h index 95a692e..8bca792 100644 --- a/sources/plugins/scg/scgundoviewmodel.h +++ b/sources/plugins/scg/scgundoviewmodel.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/scgview.cpp b/sources/plugins/scg/scgview.cpp index a35c162..ac70593 100644 --- a/sources/plugins/scg/scgview.cpp +++ b/sources/plugins/scg/scgview.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/scgview.h b/sources/plugins/scg/scgview.h index 347f006..381d369 100644 --- a/sources/plugins/scg/scgview.h +++ b/sources/plugins/scg/scgview.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/scgwindow.cpp b/sources/plugins/scg/scgwindow.cpp index fda64ea..b36bc62 100644 --- a/sources/plugins/scg/scgwindow.cpp +++ b/sources/plugins/scg/scgwindow.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/scgwindow.h b/sources/plugins/scg/scgwindow.h index 1ddc422..c33d81f 100644 --- a/sources/plugins/scg/scgwindow.h +++ b/sources/plugins/scg/scgwindow.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/select/scgselect.cpp b/sources/plugins/scg/select/scgselect.cpp index 5656e3c..afd71b8 100644 --- a/sources/plugins/scg/select/scgselect.cpp +++ b/sources/plugins/scg/select/scgselect.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/select/scgselect.h b/sources/plugins/scg/select/scgselect.h index b7c1ddf..ac4a648 100644 --- a/sources/plugins/scg/select/scgselect.h +++ b/sources/plugins/scg/select/scgselect.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/select/scgselectinputoutput.cpp b/sources/plugins/scg/select/scgselectinputoutput.cpp index 866729c..e3d4305 100644 --- a/sources/plugins/scg/select/scgselectinputoutput.cpp +++ b/sources/plugins/scg/select/scgselectinputoutput.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/select/scgselectinputoutput.h b/sources/plugins/scg/select/scgselectinputoutput.h index 98b380f..786dac2 100644 --- a/sources/plugins/scg/select/scgselectinputoutput.h +++ b/sources/plugins/scg/select/scgselectinputoutput.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/select/scgselectsubgraph.cpp b/sources/plugins/scg/select/scgselectsubgraph.cpp index bc07fcd..1d2dc5a 100644 --- a/sources/plugins/scg/select/scgselectsubgraph.cpp +++ b/sources/plugins/scg/select/scgselectsubgraph.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scg/select/scgselectsubgraph.h b/sources/plugins/scg/select/scgselectsubgraph.h index 1afc811..e441bb4 100644 --- a/sources/plugins/scg/select/scgselectsubgraph.h +++ b/sources/plugins/scg/select/scgselectsubgraph.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scn/scneditorscene.cpp b/sources/plugins/scn/scneditorscene.cpp index ede3cca..531a13c 100644 --- a/sources/plugins/scn/scneditorscene.cpp +++ b/sources/plugins/scn/scneditorscene.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scn/scneditorscene.h b/sources/plugins/scn/scneditorscene.h index bad4d71..565d0ba 100644 --- a/sources/plugins/scn/scneditorscene.h +++ b/sources/plugins/scn/scneditorscene.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scn/scnfieldglobalidtf.cpp b/sources/plugins/scn/scnfieldglobalidtf.cpp index fb968bd..ebade18 100644 --- a/sources/plugins/scn/scnfieldglobalidtf.cpp +++ b/sources/plugins/scn/scnfieldglobalidtf.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scn/scnfieldglobalidtf.h b/sources/plugins/scn/scnfieldglobalidtf.h index 30635ba..29cfa37 100644 --- a/sources/plugins/scn/scnfieldglobalidtf.h +++ b/sources/plugins/scn/scnfieldglobalidtf.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scn/scnfielditem.cpp b/sources/plugins/scn/scnfielditem.cpp index 3f7b478..1ad75dc 100644 --- a/sources/plugins/scn/scnfielditem.cpp +++ b/sources/plugins/scn/scnfielditem.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scn/scnfielditem.h b/sources/plugins/scn/scnfielditem.h index d33b91b..f337e10 100644 --- a/sources/plugins/scn/scnfielditem.h +++ b/sources/plugins/scn/scnfielditem.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scn/scnplugin.cpp b/sources/plugins/scn/scnplugin.cpp index d54b336..3a0af2e 100644 --- a/sources/plugins/scn/scnplugin.cpp +++ b/sources/plugins/scn/scnplugin.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scn/scnplugin.h b/sources/plugins/scn/scnplugin.h index 10f1dd0..c46efd4 100644 --- a/sources/plugins/scn/scnplugin.h +++ b/sources/plugins/scn/scnplugin.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scn/scnwindow.cpp b/sources/plugins/scn/scnwindow.cpp index 2eea918..95f4d20 100644 --- a/sources/plugins/scn/scnwindow.cpp +++ b/sources/plugins/scn/scnwindow.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scn/scnwindow.h b/sources/plugins/scn/scnwindow.h index 01dc53d..2a5875e 100644 --- a/sources/plugins/scn/scnwindow.h +++ b/sources/plugins/scn/scnwindow.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scs/highlightingrules/scsabstracthighlightingrule.cpp b/sources/plugins/scs/highlightingrules/scsabstracthighlightingrule.cpp index 97c7c56..c8f098d 100644 --- a/sources/plugins/scs/highlightingrules/scsabstracthighlightingrule.cpp +++ b/sources/plugins/scs/highlightingrules/scsabstracthighlightingrule.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scs/highlightingrules/scsabstracthighlightingrule.h b/sources/plugins/scs/highlightingrules/scsabstracthighlightingrule.h index 04e8cd2..6bb28c7 100644 --- a/sources/plugins/scs/highlightingrules/scsabstracthighlightingrule.h +++ b/sources/plugins/scs/highlightingrules/scsabstracthighlightingrule.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scs/highlightingrules/scshighlightingrulespool.cpp b/sources/plugins/scs/highlightingrules/scshighlightingrulespool.cpp index 9e5a635..86ec816 100644 --- a/sources/plugins/scs/highlightingrules/scshighlightingrulespool.cpp +++ b/sources/plugins/scs/highlightingrules/scshighlightingrulespool.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scs/highlightingrules/scshighlightingrulespool.h b/sources/plugins/scs/highlightingrules/scshighlightingrulespool.h index 84a62a8..d9e4fbb 100644 --- a/sources/plugins/scs/highlightingrules/scshighlightingrulespool.h +++ b/sources/plugins/scs/highlightingrules/scshighlightingrulespool.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scs/highlightingrules/scsmultilinecommenthighlightingrule.cpp b/sources/plugins/scs/highlightingrules/scsmultilinecommenthighlightingrule.cpp index 4dd8d49..4055922 100644 --- a/sources/plugins/scs/highlightingrules/scsmultilinecommenthighlightingrule.cpp +++ b/sources/plugins/scs/highlightingrules/scsmultilinecommenthighlightingrule.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scs/highlightingrules/scsmultilinecommenthighlightingrule.h b/sources/plugins/scs/highlightingrules/scsmultilinecommenthighlightingrule.h index dbff816..920c9bb 100644 --- a/sources/plugins/scs/highlightingrules/scsmultilinecommenthighlightingrule.h +++ b/sources/plugins/scs/highlightingrules/scsmultilinecommenthighlightingrule.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scs/highlightingrules/scsmultilinehighlightingrule.cpp b/sources/plugins/scs/highlightingrules/scsmultilinehighlightingrule.cpp index dd226a0..c24b149 100644 --- a/sources/plugins/scs/highlightingrules/scsmultilinehighlightingrule.cpp +++ b/sources/plugins/scs/highlightingrules/scsmultilinehighlightingrule.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scs/highlightingrules/scsmultilinehighlightingrule.h b/sources/plugins/scs/highlightingrules/scsmultilinehighlightingrule.h index e17e435..b01dfb4 100644 --- a/sources/plugins/scs/highlightingrules/scsmultilinehighlightingrule.h +++ b/sources/plugins/scs/highlightingrules/scsmultilinehighlightingrule.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scs/highlightingrules/scsstdhighlightingrule.cpp b/sources/plugins/scs/highlightingrules/scsstdhighlightingrule.cpp index 80d72ab..58669cc 100644 --- a/sources/plugins/scs/highlightingrules/scsstdhighlightingrule.cpp +++ b/sources/plugins/scs/highlightingrules/scsstdhighlightingrule.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scs/highlightingrules/scsstdhighlightingrule.h b/sources/plugins/scs/highlightingrules/scsstdhighlightingrule.h index af9e846..2c49906 100644 --- a/sources/plugins/scs/highlightingrules/scsstdhighlightingrule.h +++ b/sources/plugins/scs/highlightingrules/scsstdhighlightingrule.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scs/scscodeanalyzer.cpp b/sources/plugins/scs/scscodeanalyzer.cpp index aac0c55..08c8058 100644 --- a/sources/plugins/scs/scscodeanalyzer.cpp +++ b/sources/plugins/scs/scscodeanalyzer.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scs/scscodeanalyzer.h b/sources/plugins/scs/scscodeanalyzer.h index b5f485d..9ee5876 100644 --- a/sources/plugins/scs/scscodeanalyzer.h +++ b/sources/plugins/scs/scscodeanalyzer.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scs/scscodecompleter.cpp b/sources/plugins/scs/scscodecompleter.cpp index 5df2b11..5631350 100644 --- a/sources/plugins/scs/scscodecompleter.cpp +++ b/sources/plugins/scs/scscodecompleter.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scs/scscodecompleter.h b/sources/plugins/scs/scscodecompleter.h index 51fdb7e..b898e53 100644 --- a/sources/plugins/scs/scscodecompleter.h +++ b/sources/plugins/scs/scscodecompleter.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scs/scscodeeditor.cpp b/sources/plugins/scs/scscodeeditor.cpp index 31a92a7..8442cb8 100644 --- a/sources/plugins/scs/scscodeeditor.cpp +++ b/sources/plugins/scs/scscodeeditor.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scs/scscodeeditor.h b/sources/plugins/scs/scscodeeditor.h index ec26802..157cf30 100644 --- a/sources/plugins/scs/scscodeeditor.h +++ b/sources/plugins/scs/scscodeeditor.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scs/scscodeerroranalyzer.h b/sources/plugins/scs/scscodeerroranalyzer.h index 4adc7b9..406ed12 100644 --- a/sources/plugins/scs/scscodeerroranalyzer.h +++ b/sources/plugins/scs/scscodeerroranalyzer.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scs/scserrortablewidget.h b/sources/plugins/scs/scserrortablewidget.h index dcc0853..d249986 100644 --- a/sources/plugins/scs/scserrortablewidget.h +++ b/sources/plugins/scs/scserrortablewidget.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scs/scserrortablewidgetitem.h b/sources/plugins/scs/scserrortablewidgetitem.h index 91e00df..02a1b48 100644 --- a/sources/plugins/scs/scserrortablewidgetitem.h +++ b/sources/plugins/scs/scserrortablewidgetitem.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scs/scsfindwidget.h b/sources/plugins/scs/scsfindwidget.h index 329899e..42e41c3 100644 --- a/sources/plugins/scs/scsfindwidget.h +++ b/sources/plugins/scs/scsfindwidget.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scs/scsparser/scsasynchparser.cpp b/sources/plugins/scs/scsparser/scsasynchparser.cpp index 1cbd1ac..cbab719 100644 --- a/sources/plugins/scs/scsparser/scsasynchparser.cpp +++ b/sources/plugins/scs/scsparser/scsasynchparser.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scs/scsparser/scsasynchparser.h b/sources/plugins/scs/scsparser/scsasynchparser.h index 211d963..dc4f7de 100644 --- a/sources/plugins/scs/scsparser/scsasynchparser.h +++ b/sources/plugins/scs/scsparser/scsasynchparser.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scs/scsparser/scscparserdefs.c b/sources/plugins/scs/scsparser/scscparserdefs.c index 6e49178..e579606 100644 --- a/sources/plugins/scs/scsparser/scscparserdefs.c +++ b/sources/plugins/scs/scsparser/scscparserdefs.c @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scs/scsparser/scscparserdefs.h b/sources/plugins/scs/scsparser/scscparserdefs.h index 8a45e10..e814b04 100644 --- a/sources/plugins/scs/scsparser/scscparserdefs.h +++ b/sources/plugins/scs/scsparser/scscparserdefs.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scs/scsparser/scsparserexception.cpp b/sources/plugins/scs/scsparser/scsparserexception.cpp index 716e856..533228c 100644 --- a/sources/plugins/scs/scsparser/scsparserexception.cpp +++ b/sources/plugins/scs/scsparser/scsparserexception.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scs/scsparser/scsparserexception.h b/sources/plugins/scs/scsparser/scsparserexception.h index 646a9b9..801a7fb 100644 --- a/sources/plugins/scs/scsparser/scsparserexception.h +++ b/sources/plugins/scs/scsparser/scsparserexception.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scs/scsparser/scsparserwrapper.cpp b/sources/plugins/scs/scsparser/scsparserwrapper.cpp index 9739b65..7a68567 100644 --- a/sources/plugins/scs/scsparser/scsparserwrapper.cpp +++ b/sources/plugins/scs/scsparser/scsparserwrapper.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scs/scsparser/scsparserwrapper.h b/sources/plugins/scs/scsparser/scsparserwrapper.h index 313e6b4..6800908 100644 --- a/sources/plugins/scs/scsparser/scsparserwrapper.h +++ b/sources/plugins/scs/scsparser/scsparserwrapper.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scs/scsplugin.cpp b/sources/plugins/scs/scsplugin.cpp index 3f24c71..2ae3d7e 100644 --- a/sources/plugins/scs/scsplugin.cpp +++ b/sources/plugins/scs/scsplugin.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scs/scsplugin.h b/sources/plugins/scs/scsplugin.h index eee63e2..019b9af 100644 --- a/sources/plugins/scs/scsplugin.h +++ b/sources/plugins/scs/scsplugin.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scs/scssyntaxhighlighter.cpp b/sources/plugins/scs/scssyntaxhighlighter.cpp index 4085922..f6adf3b 100644 --- a/sources/plugins/scs/scssyntaxhighlighter.cpp +++ b/sources/plugins/scs/scssyntaxhighlighter.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scs/scssyntaxhighlighter.h b/sources/plugins/scs/scssyntaxhighlighter.h index 243dc64..10df524 100644 --- a/sources/plugins/scs/scssyntaxhighlighter.h +++ b/sources/plugins/scs/scssyntaxhighlighter.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scs/scswindow.cpp b/sources/plugins/scs/scswindow.cpp index 86e4015..6622319 100644 --- a/sources/plugins/scs/scswindow.cpp +++ b/sources/plugins/scs/scswindow.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/plugins/scs/scswindow.h b/sources/plugins/scs/scswindow.h index 8829bd4..32783bc 100644 --- a/sources/plugins/scs/scswindow.h +++ b/sources/plugins/scs/scswindow.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/updater/main.cpp b/sources/updater/main.cpp index 304130d..6fa5249 100644 --- a/sources/updater/main.cpp +++ b/sources/updater/main.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/updater/updatedownloader.cpp b/sources/updater/updatedownloader.cpp index 4690a35..c791df1 100644 --- a/sources/updater/updatedownloader.cpp +++ b/sources/updater/updatedownloader.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/updater/updatedownloader.h b/sources/updater/updatedownloader.h index 7e0a3fb..ac44497 100644 --- a/sources/updater/updatedownloader.h +++ b/sources/updater/updatedownloader.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/updater/updateextractor.cpp b/sources/updater/updateextractor.cpp index 0882be1..b07dac7 100644 --- a/sources/updater/updateextractor.cpp +++ b/sources/updater/updateextractor.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/updater/updateextractor.h b/sources/updater/updateextractor.h index d0ffc46..00bb938 100644 --- a/sources/updater/updateextractor.h +++ b/sources/updater/updateextractor.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/updater/updateinstaller.cpp b/sources/updater/updateinstaller.cpp index a85d221..e3fcde9 100644 --- a/sources/updater/updateinstaller.cpp +++ b/sources/updater/updateinstaller.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/updater/updateinstaller.h b/sources/updater/updateinstaller.h index a1ff670..30f39dd 100644 --- a/sources/updater/updateinstaller.h +++ b/sources/updater/updateinstaller.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/updater/updatewindow.cpp b/sources/updater/updatewindow.cpp index e93af59..7a8fdd2 100644 --- a/sources/updater/updatewindow.cpp +++ b/sources/updater/updatewindow.cpp @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sources/updater/updatewindow.h b/sources/updater/updatewindow.h index 6f82910..b6f8c34 100644 --- a/sources/updater/updatewindow.h +++ b/sources/updater/updatewindow.h @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tools/update_generator.py b/tools/update_generator.py index 31d5d97..921fa54 100644 --- a/tools/update_generator.py +++ b/tools/update_generator.py @@ -3,7 +3,7 @@ This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net -Copyright (c) 2010 OSTIS +Copyright (c) 2010-2014 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by From edfd52a369776c9f8141ff7c317181e78fb0baa5 Mon Sep 17 00:00:00 2001 From: asvitenkov Date: Fri, 21 Nov 2014 16:43:21 +0300 Subject: [PATCH 32/71] #341 fixed kbe crash --- .../scg/commands/scgcommandidtfmove.cpp | 12 +++++--- .../plugins/scg/commands/scgcommandidtfmove.h | 4 +-- sources/plugins/scg/scgbus.cpp | 2 +- .../plugins/scg/scgdefaultobjectbuilder.cpp | 2 +- sources/plugins/scg/scgnode.cpp | 9 +++--- sources/plugins/scg/scgnode.h | 7 +++-- sources/plugins/scg/scgnodetextitem.cpp | 27 ++++++++++++----- sources/plugins/scg/scgnodetextitem.h | 21 +++++++++----- sources/plugins/scg/scgobject.cpp | 13 ++++++++- sources/plugins/scg/scgobject.h | 4 +++ sources/plugins/scg/scgpair.cpp | 2 +- sources/plugins/scg/scgscene.cpp | 4 +-- sources/plugins/scg/scgtextitem.cpp | 29 +++++++++++++++++++ sources/plugins/scg/scgtextitem.h | 9 ++++++ 14 files changed, 110 insertions(+), 35 deletions(-) diff --git a/sources/plugins/scg/commands/scgcommandidtfmove.cpp b/sources/plugins/scg/commands/scgcommandidtfmove.cpp index 919f067..f95f53f 100644 --- a/sources/plugins/scg/commands/scgcommandidtfmove.cpp +++ b/sources/plugins/scg/commands/scgcommandidtfmove.cpp @@ -23,16 +23,18 @@ along with OSTIS. If not, see . #include "scgcommandidtfmove.h" #include "scgtextitem.h" -SCgCommandIdtfMove::SCgCommandIdtfMove(SCgTextItem *idtf, +SCgCommandIdtfMove::SCgCommandIdtfMove(SCgObject *obj, SCgScene *scene, const QPointF& oldPosition, const QPointF& newPosition, QUndoCommand *parent) : SCgBaseCommand(scene, 0, parent) - , mIdtfItem(idtf) + , mObject(obj) , mOldPosition(oldPosition) , mNewPosition(newPosition) { + Q_ASSERT(obj); + setText(QObject::tr("Move identifier")); } @@ -42,12 +44,14 @@ SCgCommandIdtfMove::~SCgCommandIdtfMove() void SCgCommandIdtfMove::redo() { - mIdtfItem->setPos(mNewPosition); + if (mObject) + mObject->setIdtfPos(mNewPosition); SCgBaseCommand::redo(); } void SCgCommandIdtfMove::undo() { - mIdtfItem->setPos(mOldPosition); + if (mObject) + mObject->setIdtfPos(mOldPosition); SCgBaseCommand::undo(); } diff --git a/sources/plugins/scg/commands/scgcommandidtfmove.h b/sources/plugins/scg/commands/scgcommandidtfmove.h index a9499b5..cc17786 100644 --- a/sources/plugins/scg/commands/scgcommandidtfmove.h +++ b/sources/plugins/scg/commands/scgcommandidtfmove.h @@ -39,7 +39,7 @@ class SCgCommandIdtfMove : public SCgBaseCommand * @param newPosition Position of the identifier after moving * @param parent Pointer to parent's undo command */ - explicit SCgCommandIdtfMove(SCgTextItem *idtf, + explicit SCgCommandIdtfMove(SCgObject *obj, SCgScene *scene, const QPointF& oldPosition, const QPointF& newPosition, @@ -55,7 +55,7 @@ class SCgCommandIdtfMove : public SCgBaseCommand private: //! Item that store object's identifier - SCgTextItem *mIdtfItem; + SCgObject *mObject; //! Position before moving QPointF mOldPosition; //! Position after moving diff --git a/sources/plugins/scg/scgbus.cpp b/sources/plugins/scg/scgbus.cpp index f6989be..5c7c5b8 100644 --- a/sources/plugins/scg/scgbus.cpp +++ b/sources/plugins/scg/scgbus.cpp @@ -120,7 +120,7 @@ void SCgBus::updateShape() // update text position if (mTextItem) - mTextItem->setPos((mPoints.at(0) + mPoints.at(1)) / 2.f); + mTextItem->setTextPos((mPoints.at(0) + mPoints.at(1)) / 2.f); } void SCgBus::objectDelete(SCgObject *object) diff --git a/sources/plugins/scg/scgdefaultobjectbuilder.cpp b/sources/plugins/scg/scgdefaultobjectbuilder.cpp index e58b4f6..d2a1e7f 100644 --- a/sources/plugins/scg/scgdefaultobjectbuilder.cpp +++ b/sources/plugins/scg/scgdefaultobjectbuilder.cpp @@ -178,7 +178,7 @@ void DefaultSCgObjectBuilder::buildNode(SCgNodeInfo* info) if (!node->contentData().isNull() && info->contentVisible()) node->showContent(); setObjectInfo(node, info); - node->setIdtfPos((SCgNode::eIdentifierPosition)info->idtfPos()); + node->setIdtfPos((SCgNode::IdentifierPosition)info->idtfPos()); } } diff --git a/sources/plugins/scg/scgnode.cpp b/sources/plugins/scg/scgnode.cpp index b4d2e7f..cbac6ee 100644 --- a/sources/plugins/scg/scgnode.cpp +++ b/sources/plugins/scg/scgnode.cpp @@ -379,6 +379,7 @@ void SCgNode::setIdtfValue(const QString &idtf) mTextItem->setZValue(7); mTextItem->setDefaultTextColor(scg_cfg_get_value_color(scg_text_element_color_normal)); } + mTextItem->setPlainText(mIdtfValue); } else if (mTextItem) @@ -390,7 +391,7 @@ void SCgNode::setIdtfValue(const QString &idtf) positionChanged(); } -SCgNode::eIdentifierPosition SCgNode::idtfPos() const +SCgNode::IdentifierPosition SCgNode::idtfPos() const { if (!mTextItem) return DEFAULT_IDTF_POS; @@ -399,13 +400,13 @@ SCgNode::eIdentifierPosition SCgNode::idtfPos() const Q_CHECK_PTR(pItem); if (pItem) - return pItem->textPos(); + return pItem->nodeTextPos(); return DEFAULT_IDTF_POS; } -void SCgNode::setIdtfPos(eIdentifierPosition pos) +void SCgNode::setIdtfPos(IdentifierPosition pos) { if (!mTextItem) return; @@ -414,5 +415,5 @@ void SCgNode::setIdtfPos(eIdentifierPosition pos) Q_CHECK_PTR(pItem); if (pItem) - pItem->setTextPos(pos); + pItem->setNodeTextPos(pos); } diff --git a/sources/plugins/scg/scgnode.h b/sources/plugins/scg/scgnode.h index 3fab27a..da72f47 100644 --- a/sources/plugins/scg/scgnode.h +++ b/sources/plugins/scg/scgnode.h @@ -43,7 +43,8 @@ friend class SCgBus; BottomLeft, TopLeft, TopRight - } eIdentifierPosition; + } IdentifierPosition; + /*! Type for qgraphicsitem_cast */ int type() const { return Type; } @@ -52,8 +53,8 @@ friend class SCgBus; void setIdtfValue(const QString &idtf); - void setIdtfPos(eIdentifierPosition pos); - eIdentifierPosition idtfPos() const; + void setIdtfPos(IdentifierPosition pos); + IdentifierPosition idtfPos() const; QRectF boundingRect() const; diff --git a/sources/plugins/scg/scgnodetextitem.cpp b/sources/plugins/scg/scgnodetextitem.cpp index 75d1fe8..f19758e 100644 --- a/sources/plugins/scg/scgnodetextitem.cpp +++ b/sources/plugins/scg/scgnodetextitem.cpp @@ -24,7 +24,7 @@ along with OSTIS. If not, see . #include "scgnodetextitem.h" -SCgNodeTextItem::SCgNodeTextItem(const QString &str, SCgNode* parent, SCgNode::eIdentifierPosition idtfPos, QGraphicsScene* scene ) +SCgNodeTextItem::SCgNodeTextItem(const QString &str, SCgNode* parent, SCgNode::IdentifierPosition idtfPos, QGraphicsScene* scene ) : SCgTextItem(str,(QGraphicsItem*)parent,scene) , mTextPos(idtfPos) { @@ -34,7 +34,7 @@ SCgNodeTextItem::SCgNodeTextItem(const QString &str, SCgNode* parent, SCgNode::e } -SCgNodeTextItem::SCgNodeTextItem(SCgNode *parent, SCgNode::eIdentifierPosition idtfPos, QGraphicsScene *scene) +SCgNodeTextItem::SCgNodeTextItem(SCgNode *parent, SCgNode::IdentifierPosition idtfPos, QGraphicsScene *scene) : SCgTextItem((QGraphicsItem*)parent, scene) , mTextPos(idtfPos) { @@ -52,11 +52,11 @@ void SCgNodeTextItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event) { if ((flags() & QGraphicsItem::ItemIsMovable) != 0) - setTextPos(posToIdtfPos(mapToParent(event->pos()))); + setNodeTextPos(posToIdtfPos(mapToParent(event->pos()))); } -void SCgNodeTextItem::setTextPos(SCgNode::eIdentifierPosition pos) +void SCgNodeTextItem::setNodeTextPos(SCgNode::IdentifierPosition pos) { if (mTextPos != pos) { @@ -65,9 +65,9 @@ void SCgNodeTextItem::setTextPos(SCgNode::eIdentifierPosition pos) } } -SCgNode::eIdentifierPosition SCgNodeTextItem::posToIdtfPos(const QPointF &point) const +SCgNode::IdentifierPosition SCgNodeTextItem::posToIdtfPos(const QPointF &point) const { - SCgNode::eIdentifierPosition idtfPos = SCgNode::BottomRight; + SCgNode::IdentifierPosition idtfPos = SCgNode::BottomRight; qreal x = point.x(); qreal y = point.y(); @@ -96,7 +96,7 @@ SCgNode::eIdentifierPosition SCgNodeTextItem::posToIdtfPos(const QPointF &point) } -void SCgNodeTextItem::updateTextPos(SCgNode::eIdentifierPosition pos) +void SCgNodeTextItem::updateTextPos(SCgNode::IdentifierPosition pos) { QRectF rect = boundingRect(); QRectF parentRect = mParentItem->boundingRect(); @@ -118,7 +118,18 @@ void SCgNodeTextItem::updateTextPos(SCgNode::eIdentifierPosition pos) setSelected(false); } -SCgNode::eIdentifierPosition SCgNodeTextItem::textPos() const +SCgNode::IdentifierPosition SCgNodeTextItem::nodeTextPos() const { return mTextPos; } + +void SCgNodeTextItem::setTextPos(const QPointF &pos) +{ + setNodeTextPos(posToIdtfPos(pos)); +} + +void SCgNodeTextItem::setPlainText(const QString &text) +{ + SCgTextItem::setPlainText(text); + updateTextPos(mTextPos); +} diff --git a/sources/plugins/scg/scgnodetextitem.h b/sources/plugins/scg/scgnodetextitem.h index 0903035..ee066f6 100644 --- a/sources/plugins/scg/scgnodetextitem.h +++ b/sources/plugins/scg/scgnodetextitem.h @@ -38,22 +38,27 @@ class SCgNodeTextItem : public SCgTextItem //! Object type enum { Type = UserType + 9 }; - explicit SCgNodeTextItem(const QString &str, SCgNode* parent, SCgNode::eIdentifierPosition idtfPos = SCgNode::BottomRight, QGraphicsScene* scene = 0); - explicit SCgNodeTextItem(SCgNode* parent, SCgNode::eIdentifierPosition idtfPos = SCgNode::BottomRight, QGraphicsScene* scene = 0); + explicit SCgNodeTextItem(const QString &str, SCgNode* parent, SCgNode::IdentifierPosition idtfPos = SCgNode::BottomRight, QGraphicsScene* scene = 0); + explicit SCgNodeTextItem(SCgNode* parent, SCgNode::IdentifierPosition idtfPos = SCgNode::BottomRight, QGraphicsScene* scene = 0); virtual ~SCgNodeTextItem(); //! Return a type of graphics item as integer virtual int type() const { return Type; } + + void setTextPos(const QPointF &pos); + + void setPlainText(const QString &text); + protected: - virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event); + virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event); - void setTextPos(SCgNode::eIdentifierPosition pos); - SCgNode::eIdentifierPosition textPos() const; + void setNodeTextPos(SCgNode::IdentifierPosition pos); + SCgNode::IdentifierPosition nodeTextPos() const; - void updateTextPos(SCgNode::eIdentifierPosition pos); - SCgNode::eIdentifierPosition posToIdtfPos(const QPointF &point) const; + void updateTextPos(SCgNode::IdentifierPosition pos); + SCgNode::IdentifierPosition posToIdtfPos(const QPointF &point) const; - SCgNode::eIdentifierPosition mTextPos; + SCgNode::IdentifierPosition mTextPos; SCgNode *mParentItem; }; diff --git a/sources/plugins/scg/scgobject.cpp b/sources/plugins/scg/scgobject.cpp index 493b0dc..88c218f 100644 --- a/sources/plugins/scg/scgobject.cpp +++ b/sources/plugins/scg/scgobject.cpp @@ -231,7 +231,8 @@ void SCgObject::setIdtfValue(const QString &idtf) //scene()->addItem(mTextItem); } mTextItem->setPlainText(mIdtfValue); - } else if (mTextItem) + } + else if (mTextItem) { delete mTextItem; mTextItem = 0; @@ -305,3 +306,13 @@ void SCgObject::undel(SCgScene *scene) scene->addItem(this); } + +void SCgObject::setIdtfPos(const QPointF &pos) +{ + mTextItem->setTextPos(pos); +} + +QPointF SCgObject::idtfPos() const +{ + return mTextItem->textPos(); +} diff --git a/sources/plugins/scg/scgobject.h b/sources/plugins/scg/scgobject.h index ed060c2..0c83c1d 100644 --- a/sources/plugins/scg/scgobject.h +++ b/sources/plugins/scg/scgobject.h @@ -106,6 +106,10 @@ Q_INTERFACES(QGraphicsItem) void setBoundingBoxVisible(bool value); //! Check if bounding box is visible bool isBoundingBoxVisible() const; + + virtual void setIdtfPos(const QPointF &pos); + QPointF idtfPos() const; + ////////////////////////// /* Working with types */ public: diff --git a/sources/plugins/scg/scgpair.cpp b/sources/plugins/scg/scgpair.cpp index f187da4..94cbecd 100644 --- a/sources/plugins/scg/scgpair.cpp +++ b/sources/plugins/scg/scgpair.cpp @@ -114,7 +114,7 @@ void SCgPair::updateShape() { Q_ASSERT(mPoints.size() > 1); QPointF text_pos = (mPoints[0] + mPoints[1]) / 2.f; - mTextItem->setPos(text_pos); + mTextItem->setTextPos(text_pos); } } diff --git a/sources/plugins/scg/scgscene.cpp b/sources/plugins/scg/scgscene.cpp index eb8cf52..fd3df93 100644 --- a/sources/plugins/scg/scgscene.cpp +++ b/sources/plugins/scg/scgscene.cpp @@ -593,12 +593,12 @@ SCgBaseCommand* SCgScene::moveSelectedCommand(const ItemUndoInfo& undoInfo, SCgB else if (item->type() == SCgTextItem::Type || item->type() == SCgNodeTextItem::Type) { if(!cmd) - cmd = new SCgCommandIdtfMove(static_cast(item), + cmd = new SCgCommandIdtfMove(static_cast(item->parentItem()), this, it.value().first.second, it.value().second.second); else - new SCgCommandIdtfMove(static_cast(item), + new SCgCommandIdtfMove(static_cast(item->parentItem()), this, it.value().first.second, it.value().second.second); diff --git a/sources/plugins/scg/scgtextitem.cpp b/sources/plugins/scg/scgtextitem.cpp index 64fcc89..c97746e 100644 --- a/sources/plugins/scg/scgtextitem.cpp +++ b/sources/plugins/scg/scgtextitem.cpp @@ -106,3 +106,32 @@ void SCgTextItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) QGraphicsTextItem::mouseReleaseEvent(event); } +void SCgTextItem::setTextPos(const QPointF &pos) +{ + setPos(pos); +} + +QPointF SCgTextItem::textPos() const +{ + return QGraphicsTextItem::pos(); +} + +void SCgTextItem::setPos(const QPointF &pos) +{ + QGraphicsTextItem::setPos(pos); +} + +void SCgTextItem::setPos(qreal x, qreal y) +{ + QGraphicsTextItem::setPos(x,y); +} + +QPointF SCgTextItem::pos() const +{ + return QGraphicsTextItem::pos(); +} + +void SCgTextItem::setPlainText(const QString &text) +{ + QGraphicsTextItem::setPlainText(text); +} diff --git a/sources/plugins/scg/scgtextitem.h b/sources/plugins/scg/scgtextitem.h index 46f61fd..45e3527 100644 --- a/sources/plugins/scg/scgtextitem.h +++ b/sources/plugins/scg/scgtextitem.h @@ -64,12 +64,21 @@ class SCgTextItem : public QGraphicsTextItem //! Return a type of graphics item as integer virtual int type() const { return Type; } + + virtual void setTextPos(const QPointF &pos); + QPointF textPos() const; + + virtual void setPlainText(const QString &text); + protected: virtual void hoverEnterEvent(QGraphicsSceneHoverEvent *event); virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent *event); virtual void mousePressEvent(QGraphicsSceneMouseEvent *event); virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event); virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); + void setPos(const QPointF &pos); + void setPos(qreal x, qreal y); + QPointF pos() const; }; #endif // SCGTEXTITEM_H From 7b504f7cce34ab12815959c5b00fadc4cbbf56b0 Mon Sep 17 00:00:00 2001 From: Morozov Date: Thu, 18 Dec 2014 14:46:29 +0300 Subject: [PATCH 33/71] [scg] The transparence of contour was changed (#329) --- sources/plugins/scg/scgcontour.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/plugins/scg/scgcontour.cpp b/sources/plugins/scg/scgcontour.cpp index 4effd13..c9152d0 100644 --- a/sources/plugins/scg/scgcontour.cpp +++ b/sources/plugins/scg/scgcontour.cpp @@ -33,7 +33,7 @@ along with OSTIS. If not, see . #include SCgContour::SCgContour() : - mColorBack(QColor(250, 250, 250, 224)) + mColorBack(QColor(250, 250, 250, 164)) { setFlag(QGraphicsItem::ItemIsMovable, true); //setFlag(QGraphicsItem::ItemClipsChildrenToShape, true); From 9d431c8bfec784f133551aa30a1ad8097e2370a3 Mon Sep 17 00:00:00 2001 From: Morozov Date: Thu, 18 Dec 2014 22:58:56 +0300 Subject: [PATCH 34/71] [scg] Added tooltip to Alignment and Selection buttons(#305) --- sources/plugins/scg/scgwindow.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sources/plugins/scg/scgwindow.cpp b/sources/plugins/scg/scgwindow.cpp index b36bc62..6b93064 100644 --- a/sources/plugins/scg/scgwindow.cpp +++ b/sources/plugins/scg/scgwindow.cpp @@ -231,6 +231,7 @@ void SCgWindow::createToolBar() QToolButton *alignButton = new QToolButton(mToolBar); alignButton->setIcon(findIcon("tool-align.png")); alignButton->setPopupMode(QToolButton::InstantPopup); + alignButton->setToolTip(tr("Alignment")); mToolBar->addWidget(alignButton); //Grid alignment @@ -273,6 +274,7 @@ void SCgWindow::createToolBar() QToolButton *selectButton = new QToolButton(mToolBar); selectButton->setIcon(findIcon("tool-select-group.png")); selectButton->setPopupMode(QToolButton::InstantPopup); + selectButton->setToolTip(tr("Selection group")); mToolBar->addWidget(selectButton); // input/output selection From bd78d46a58f6ee7f1c92964f9c2d8367424641b7 Mon Sep 17 00:00:00 2001 From: Denis Koronchik Date: Sun, 22 Feb 2015 11:36:17 +0300 Subject: [PATCH 35/71] [m4scp] Remove m4scp plugin (#359) --- .gitignore | 4 +- sources/all.pro | 3 +- sources/plugins/CMakeLists.txt | 1 - sources/plugins/m4scp/CMakeLists.txt | 64 --- sources/plugins/m4scp/m4scp.pro | 43 -- sources/plugins/m4scp/m4scp.qrc | 10 - sources/plugins/m4scp/m4scpblockdata.h | 62 --- sources/plugins/m4scp/m4scpcodeanalyzer.cpp | 32 -- sources/plugins/m4scp/m4scpcodeanalyzer.h | 41 -- sources/plugins/m4scp/m4scpcodecompleter.cpp | 137 ------- sources/plugins/m4scp/m4scpcodecompleter.h | 50 --- sources/plugins/m4scp/m4scpcodeeditor.cpp | 383 ------------------ sources/plugins/m4scp/m4scpcodeeditor.h | 111 ----- sources/plugins/m4scp/m4scpplugin.cpp | 82 ---- sources/plugins/m4scp/m4scpplugin.h | 67 --- sources/plugins/m4scp/m4scpsyntax.cpp | 106 ----- sources/plugins/m4scp/m4scpsyntax.h | 61 --- .../plugins/m4scp/m4scpsyntaxhighlighter.cpp | 204 ---------- .../plugins/m4scp/m4scpsyntaxhighlighter.h | 53 --- sources/plugins/m4scp/m4scpwindow.cpp | 201 --------- sources/plugins/m4scp/m4scpwindow.h | 112 ----- .../plugins/m4scp/media/icons/attribute.png | Bin 665 -> 0 bytes .../plugins/m4scp/media/icons/mime_type.png | Bin 1364 -> 0 bytes sources/plugins/m4scp/media/icons/ordinal.png | Bin 389 -> 0 bytes .../plugins/m4scp/media/icons/procedure.png | Bin 748 -> 0 bytes .../m4scp/media/translations/m4scp_en_EN.ts | 29 -- .../m4scp/media/translations/m4scp_ru_RU.ts | 29 -- 27 files changed, 4 insertions(+), 1881 deletions(-) delete mode 100644 sources/plugins/m4scp/CMakeLists.txt delete mode 100644 sources/plugins/m4scp/m4scp.pro delete mode 100644 sources/plugins/m4scp/m4scp.qrc delete mode 100644 sources/plugins/m4scp/m4scpblockdata.h delete mode 100644 sources/plugins/m4scp/m4scpcodeanalyzer.cpp delete mode 100644 sources/plugins/m4scp/m4scpcodeanalyzer.h delete mode 100644 sources/plugins/m4scp/m4scpcodecompleter.cpp delete mode 100644 sources/plugins/m4scp/m4scpcodecompleter.h delete mode 100644 sources/plugins/m4scp/m4scpcodeeditor.cpp delete mode 100644 sources/plugins/m4scp/m4scpcodeeditor.h delete mode 100644 sources/plugins/m4scp/m4scpplugin.cpp delete mode 100644 sources/plugins/m4scp/m4scpplugin.h delete mode 100644 sources/plugins/m4scp/m4scpsyntax.cpp delete mode 100644 sources/plugins/m4scp/m4scpsyntax.h delete mode 100644 sources/plugins/m4scp/m4scpsyntaxhighlighter.cpp delete mode 100644 sources/plugins/m4scp/m4scpsyntaxhighlighter.h delete mode 100644 sources/plugins/m4scp/m4scpwindow.cpp delete mode 100644 sources/plugins/m4scp/m4scpwindow.h delete mode 100644 sources/plugins/m4scp/media/icons/attribute.png delete mode 100644 sources/plugins/m4scp/media/icons/mime_type.png delete mode 100644 sources/plugins/m4scp/media/icons/ordinal.png delete mode 100644 sources/plugins/m4scp/media/icons/procedure.png delete mode 100644 sources/plugins/m4scp/media/translations/m4scp_en_EN.ts delete mode 100644 sources/plugins/m4scp/media/translations/m4scp_ru_RU.ts diff --git a/.gitignore b/.gitignore index 3c48abc..d666dd5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ +build-*/* all-build-desktop/* -*.qm \ No newline at end of file +*.qm +*.user diff --git a/sources/all.pro b/sources/all.pro index ff65ef0..3d54d35 100644 --- a/sources/all.pro +++ b/sources/all.pro @@ -7,8 +7,7 @@ CONFIG += ordered DESTDIR = ./bin -SUBDIRS = plugins/m4scp \ - plugins/scg \ +SUBDIRS = plugins/scg \ #plugins/scn \ plugins/scs \ kbe diff --git a/sources/plugins/CMakeLists.txt b/sources/plugins/CMakeLists.txt index 5c9c9aa..863ab69 100644 --- a/sources/plugins/CMakeLists.txt +++ b/sources/plugins/CMakeLists.txt @@ -2,6 +2,5 @@ OPTION (BUILD_SHARED_LIBS "Build shared libraries." ON) set(PLUGINS_DIR ${PROJECT_ROOT_DIR}/plugins) -add_subdirectory(m4scp) add_subdirectory(scg) add_subdirectory(scs) diff --git a/sources/plugins/m4scp/CMakeLists.txt b/sources/plugins/m4scp/CMakeLists.txt deleted file mode 100644 index d6e4e85..0000000 --- a/sources/plugins/m4scp/CMakeLists.txt +++ /dev/null @@ -1,64 +0,0 @@ -set (PROJECT m4scp) - -set (M4SCP_DIR ${PLUGINS_DIR}/m4scp) -set (M4SCP_MEDIA_DIR ${M4SCP_DIR}/media) - -set (HEADERS - m4scpwindow.h - m4scpsyntaxhighlighter.h - m4scpsyntax.h - m4scpcodeeditor.h - m4scpcodecompleter.h - m4scpplugin.h - m4scpcodeanalyzer.h - m4scpblockdata.h -) - -set (SOURCES - m4scpwindow.cpp - m4scpsyntaxhighlighter.cpp - m4scpsyntax.cpp - m4scpcodeeditor.cpp - m4scpcodecompleter.cpp - m4scpplugin.cpp - m4scpcodeanalyzer.cpp -) - -set (RESOURCES - m4scp.qrc - ) - -set (TRANSLATIONS - ${M4SCP_MEDIA_DIR}/translations/m4scp_en_EN.ts - ${M4SCP_MEDIA_DIR}/translations/m4scp_ru_RU.ts - ) - -project (${PROJECT}) - -FOREACH (TRANSLATION ${TRANSLATIONS}) - execute_process(COMMAND lrelease-qt4 ${TRANSLATION}) -ENDFOREACH(TRANSLATION) - -include_directories(./) -include_directories(${PROJECT_ROOT_DIR}/kbe) - -include (${QT_USE_FILE}) -qt4_add_resources (QRC_SOURCES ${RESOURCES}) -qt4_wrap_cpp (MOC_SOURCES ${HEADERS}) - -if (MSVC) - add_definitions (/W3) -elseif (CMAKE_COMPILER_IS_GNUCXX) - add_definitions (-Wall) -else () - message ("Unknown compiler") -endif () - -source_group ("Header Files" FILES ${HEADERS}) -source_group ("Source Files" FILES ${SOURCES}) -source_group ("Generated Files" FILES ${MOC_SOURCES}) -source_group ("Resource Files" FILES ${QRC_SOURCES}) - -add_library (${PROJECT} ${HEADERS} ${SOURCES} ${MOC_SOURCES} ${QRC_SOURCES}) - -target_link_libraries (${PROJECT} ${QT_LIBRARIES}) diff --git a/sources/plugins/m4scp/m4scp.pro b/sources/plugins/m4scp/m4scp.pro deleted file mode 100644 index 55c1f2e..0000000 --- a/sources/plugins/m4scp/m4scp.pro +++ /dev/null @@ -1,43 +0,0 @@ - -TARGET = $$qtLibraryTarget(m4scp) -TEMPLATE = lib -INCLUDEPATH += ../../kbe - -DESTDIR = ../../bin/plugins - -CONFIG += plugin - -OBJECTS_DIR = obj -MOC_DIR = moc - - -HEADERS += \ - m4scpwindow.h \ - m4scpsyntaxhighlighter.h \ - m4scpsyntax.h \ - m4scpcodeeditor.h \ - m4scpcodecompleter.h \ - m4scpplugin.h \ - m4scpcodeanalyzer.h \ - m4scpblockdata.h - -SOURCES += \ - m4scpwindow.cpp \ - m4scpsyntaxhighlighter.cpp \ - m4scpsyntax.cpp \ - m4scpcodeeditor.cpp \ - m4scpcodecompleter.cpp \ - m4scpplugin.cpp \ - m4scpcodeanalyzer.cpp - -RESOURCES += \ - m4scp.qrc - -TRANSLATIONS += media/translations/m4scp_en_EN.ts \ - media/translations/m4scp_ru_RU.ts - -lrelease.input = TRANSLATIONS -lrelease.output = ${QMAKE_FILE_IN_PATH}/${QMAKE_FILE_IN_BASE}.qm -lrelease.commands = $$[QT_INSTALL_BINS]/lrelease ${QMAKE_FILE_IN} -qm ${QMAKE_FILE_IN_PATH}/${QMAKE_FILE_IN_BASE}.qm -lrelease.CONFIG += no_link target_predeps -QMAKE_EXTRA_COMPILERS += lrelease diff --git a/sources/plugins/m4scp/m4scp.qrc b/sources/plugins/m4scp/m4scp.qrc deleted file mode 100644 index 6cc3095..0000000 --- a/sources/plugins/m4scp/m4scp.qrc +++ /dev/null @@ -1,10 +0,0 @@ - - - media/icons/attribute.png - media/icons/ordinal.png - media/icons/procedure.png - media/icons/mime_type.png - media/translations/m4scp_en_EN.qm - media/translations/m4scp_ru_RU.qm - - diff --git a/sources/plugins/m4scp/m4scpblockdata.h b/sources/plugins/m4scp/m4scpblockdata.h deleted file mode 100644 index c6af4a4..0000000 --- a/sources/plugins/m4scp/m4scpblockdata.h +++ /dev/null @@ -1,62 +0,0 @@ -/* ------------------------------------------------------------------------------ -This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) -For the latest info, see http://www.ostis.net - -Copyright (c) 2010-2014 OSTIS - -OSTIS 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 3 of the License, or -(at your option) any later version. - -OSTIS is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with OSTIS. If not, see . ------------------------------------------------------------------------------ -*/ - -#ifndef BLOCKDATA_H -#define BLOCKDATA_H - -#include - -class BlockData : public QTextBlockUserData -{ -public: - inline BlockData(): - foldingLevel(0), - folded(false), - breackPoint(false) - {} - - ~BlockData(){} - - static BlockData* data(QTextBlock block) - { - BlockData *data=static_cast(block.userData()); - if(!data && block.isValid()){ - data= new BlockData(); - block.setUserData(data); - } - return data; - } - - inline void setFoldingLevel(int le) {foldingLevel = le;} - inline int getFoldingLevel() const {return foldingLevel;} - - inline void setFolded (bool f) {folded=f;} - inline bool isFolded() const {return folded;} - -private: - int foldingLevel; - bool folded; - - bool breackPoint; -}; - -#endif // BLOCKDATA_H diff --git a/sources/plugins/m4scp/m4scpcodeanalyzer.cpp b/sources/plugins/m4scp/m4scpcodeanalyzer.cpp deleted file mode 100644 index e3f9369..0000000 --- a/sources/plugins/m4scp/m4scpcodeanalyzer.cpp +++ /dev/null @@ -1,32 +0,0 @@ -/* ------------------------------------------------------------------------------ -This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) -For the latest info, see http://www.ostis.net - -Copyright (c) 2010-2014 OSTIS - -OSTIS 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 3 of the License, or -(at your option) any later version. - -OSTIS is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with OSTIS. If not, see . ------------------------------------------------------------------------------ -*/ - -#include "m4scpcodeanalyzer.h" - -M4SCpCodeAnalyzer::M4SCpCodeAnalyzer(QObject *parent) : - QObject(parent) -{ -} - -M4SCpCodeAnalyzer::~M4SCpCodeAnalyzer() -{ -} diff --git a/sources/plugins/m4scp/m4scpcodeanalyzer.h b/sources/plugins/m4scp/m4scpcodeanalyzer.h deleted file mode 100644 index 7770125..0000000 --- a/sources/plugins/m4scp/m4scpcodeanalyzer.h +++ /dev/null @@ -1,41 +0,0 @@ -/* ------------------------------------------------------------------------------ -This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) -For the latest info, see http://www.ostis.net - -Copyright (c) 2010-2014 OSTIS - -OSTIS 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 3 of the License, or -(at your option) any later version. - -OSTIS is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with OSTIS. If not, see . ------------------------------------------------------------------------------ -*/ - -#ifndef M4SCPCODEANALYZER_H -#define M4SCPCODEANALYZER_H - -#include - -class M4SCpCodeAnalyzer : public QObject -{ - Q_OBJECT -public: - explicit M4SCpCodeAnalyzer(QObject *parent = 0); - virtual ~M4SCpCodeAnalyzer(); - -signals: - -public slots: - -}; - -#endif // M4SCPCODEANALYZER_H diff --git a/sources/plugins/m4scp/m4scpcodecompleter.cpp b/sources/plugins/m4scp/m4scpcodecompleter.cpp deleted file mode 100644 index c9bb861..0000000 --- a/sources/plugins/m4scp/m4scpcodecompleter.cpp +++ /dev/null @@ -1,137 +0,0 @@ -/* ------------------------------------------------------------------------------ -This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) -For the latest info, see http://www.ostis.net - -Copyright (c) 2010-2014 OSTIS - -OSTIS 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 3 of the License, or -(at your option) any later version. - -OSTIS is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with OSTIS. If not, see . ------------------------------------------------------------------------------ -*/ - -#include "m4scpcodecompleter.h" -#include "m4scpsyntax.h" -#include "m4scpplugin.h" -#include "m4scpwindow.h" - -#include -#include - -M4SCpCodeCompleter::M4SCpCodeCompleter(QObject *parent) : - QCompleter(parent) -{ - QStandardItemModel *_mItemModel = new QStandardItemModel(parent); - setModel(_mItemModel); - popup()->setIconSize(QSize(16, 16)); -} - -M4SCpCodeCompleter::~M4SCpCodeCompleter() -{ -} - -void M4SCpCodeCompleter::initDictionary() -{ - QStandardItemModel *mod = static_cast(model()); - QStringList words; - words << M4SCpSyntax::attributes(); - - foreach(QString str, words) { - QStandardItem *item = new QStandardItem( - M4SCpWindow::findIcon("attribute.png"), - str); - mod->appendRow(item); - } - words.clear(); - words << M4SCpSyntax::ordinals(); - foreach(QString str, words) { - QStandardItem *item = new QStandardItem( - M4SCpWindow::findIcon("ordinal.png"), - str); - mod->appendRow(item); - } - - QMap templatesMap; - words.clear(); - words << M4SCpSyntax::operators(); - foreach(QString str, words) - templatesMap.insert(str, str); - - // create templates - templatesMap["program"] = "program(,\n[[\n\t// constants\n]],\n[{\n\t// variables\n}])\n\n\nreturn()\nend()"; - templatesMap["procedure"] = "procedure(,\n[[\n\t// constants\n]],\n[{\n\t// variables\n}],\n{[\n\t//parameters\n]})\n\nreturn()\nend()"; - templatesMap["return"] = "return()\n"; - templatesMap["end"] = "end()\n"; - - templatesMap["sys_set_event_handler"] = "sys_set_event_handler([\n\t1_: fixed_: , // event\n\t2_: fixed_: , //procedure\n\t3_: fixed_: //pattern\n])\n"; - templatesMap["sys_get_location"] = "sys_get_location([\n\t1_: fixed_: ,// sc-element\n\t2_: assign_: //segment\n])\n"; - templatesMap["sys_open_segment"] = "sys_open_segment([1_: fixed_: ])\n"; - templatesMap["sys_open_segment_uri"] = "sys_open_segment_uri([\n\t1_: fixed_: ,\n\t2_: assign_: \n])\n"; - templatesMap["sys_set_default_segment"] = "sys_set_default_segment([1_: fixed_: ])\n"; - templatesMap["sys_get_default_segment"] = "sys_get_default_segment([1_: assign_: ])\n"; - templatesMap["sys_spin_segment"] = "sys_spin_segment([\n\t1_: fixed_: ,\n\t2_: assign_: \n\t])\n"; - templatesMap["sys_close_segment"] = "sys_close_segment([1_: fixed_: ])\n"; - templatesMap["sys_search"] = "sys_search([\n\t1_: fixed_: ,\t// search pattern\n\t2_: fixed_: {\t// set of search result pairs\n\t\t{1_: , 2_: }\n\t},\n\t3_: fixed_: {\t// set of pairs that consisted of input parameters\n\t\t{1_: , 2_: }\n\t},\n\t4_: \t// result set\n])\n"; - templatesMap["sys_gen"] = "sys_gen([\n\t1_: fixed_: ,\t// pattern generation\n\t2_: fixed_: {\t// set of search result pairs\n\t\t{1_: , 2_: }\n\t},\n\t3_: fixed_: {\t// set of pairs that consisted of input parameters\n\t\t{1_: , 2_: }\n\t},\n\t4_: \t// result set\n])\n"; - - templatesMap["print"] = "print([1_: fixed_: ])\n"; - templatesMap["printEl"] = "printEl([1_: fixed_: ])\n"; - templatesMap["printNl"] = "printNl([1_: fixed_: ])\n"; - - templatesMap["searchElStr3"] = "searchElStr3([\n\t1_: ,\n\t2_: ,\n\t3_: \n], ,)\n"; - templatesMap["searchElStr5"] = "searchElStr5([\n\t1_: ,\n\t2_: ,\n\t3_: ,\n\t4_: ,\n\t5_: \n], ,)\n"; - templatesMap["searchSetStr3"] = "searchSetStr3([\n\t1_: ,\n\t2_: ,\n\t3_: ,\n\tset1_: ,\n\tset2_: ,\n\tset3_: \n], ,)\n"; - templatesMap["searchSetStr5"] = "searchSetStr5([\n\t1_: ,\n\t2_: ,\n\t3_: ,\n\t4_: ,\n\t5_: ,\n\tset1_: ,\n\tset2_: ,\n\tset3_: ,\n\tset4_: ,\n\tset5_: \n], ,)\n"; - - templatesMap["genEl"] = "genEl([1_: assign_: ])\n"; - templatesMap["genElStr3"] = "genElStr3([\n\t1_: ,\n\t2_: ,\n\t3_: \n])\n"; - templatesMap["genElStr5"] = "genElStr5([\n\t1_: ,\n\t2_: ,\n\t3_: ,\n\t4_: ,\n\t5_: \n])\n"; - - templatesMap["eraseEl"] = "eraseEl([1_: fixed_: ])\n"; - templatesMap["eraseElStr3"] = "eraseElStr3([\n\t1_: fixed_: ,\n\t2_: assign_: f_: ,\n\t3_: fixed_: \n])\n"; - templatesMap["eraseElStr5"] = "eraseElStr5([\n\t1_: fixed_: ,\n\t2_: assign_: ,\n\t3_: fixed_: ,\n\t4_: assign_: f_: ,\n\t5_: fixed_: \n])\n"; - - templatesMap["selectYStr3"] = "selectYStr3([\n\t1_: ,\n\t2_: ,\n\t3_: ,\n\tset1_: ,\n\tset2_: ,\n\tset3_: \n], ,)\n"; - templatesMap["selectNStr3"] = "selectNStr3([\n\t1_: ,\n\t2_: ,\n\t3_: ,\n\tset1_: ,\n\tset2_: ,\n\tset3_: \n], ,)\n"; - templatesMap["selectYStr5"] = "selectYStr5([\n\t1_: ,\n\t2_: ,\n\t3_: ,\n\t4_: ,\n\t5_: ,\n\tset1_: ,\n\tset2_: ,\n\tset3_: ,\n\tset4_: ,\n\tset5_: \n], ,)\n"; - templatesMap["selectNStr5"] = "selectNStr5([\n\t1_: ,\n\t2_: ,\n\t3_: ,\n\t4_: ,\n\t5_: ,\n\tset1_: ,\n\tset2_: ,\n\tset3_: ,\n\tset4_: ,\n\tset5_: \n], ,)\n"; - - templatesMap["ifType"] = "ifType([\n\t1_: \n], ,)\n"; - templatesMap["ifEq"] = "ifEq([\n\t1_: fixed_: ,\n\t2_: fixed_: \n], ,)\n"; - templatesMap["ifCoin"] = "ifCoin([\n\t1_: ,\n\t2_: \n], ,)\n"; - templatesMap["ifGr"] = "ifGr([\n\t1_: fixed_: \n\t2_: fixed_: \n], , )\n"; - templatesMap["ifFormCount"] = "ifFormCount([\n\t1_: fixed_: ,\n\t2_: fixed_: \n], ,)\n"; - templatesMap["ifVarAssign"] = "ifVarAssign([\n\t1_: fixed_: \n], ,)\n"; - - templatesMap["add"] = "add([\n\t1_: assign_: ,\t// result\n\t2_: fixed_: ,\n\t3_: fixed_: \n])\n"; - templatesMap["sub"] = "sub([\n\t1_: assign_: ,\t// result\n\t2_: fixed_: ,\n\t3_: fixed_: \n])\n"; - templatesMap["mult"] = "mult([\n\t1_: assign_: ,\t// result\n\t2_: fixed_: ,\n\t3_: fixed_: \n])\n"; - templatesMap["div"] = "div([\n\t1_: assign_: ,\t// result\n\t2_: fixed_: ,\n\t3_: fixed_: \n])\n"; - templatesMap["pow"] = "pow([\n\t1_: assign_: ,\t// result\n\t2_: fixed_: ,\n\t3_: fixed_: \n])\n"; - - templatesMap["callReturn"] = "callReturn([\n\t1_: fixed_: ,\n\t2_: fixed_: {[\n\t\t1_: fixed_: \n\t\t]}\n])"; - - templatesMap["label"] = "label()\n"; - - QMap::iterator it = templatesMap.begin(); - for (; it != templatesMap.end(); ++it) { - QStandardItem *item = new QStandardItem( - M4SCpWindow::findIcon("procedure.png"), - it.key()); - mod->appendRow(item); - QModelIndex index = mod->indexFromItem(item); - mod->setData(index, QVariant(it.value()), Qt::UserRole); - mod->setData(index, QVariant(it.value()), Qt::ToolTipRole); - } -} - diff --git a/sources/plugins/m4scp/m4scpcodecompleter.h b/sources/plugins/m4scp/m4scpcodecompleter.h deleted file mode 100644 index ffb21f4..0000000 --- a/sources/plugins/m4scp/m4scpcodecompleter.h +++ /dev/null @@ -1,50 +0,0 @@ -/* ------------------------------------------------------------------------------ -This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) -For the latest info, see http://www.ostis.net - -Copyright (c) 2010-2014 OSTIS - -OSTIS 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 3 of the License, or -(at your option) any later version. - -OSTIS is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with OSTIS. If not, see . ------------------------------------------------------------------------------ -*/ - -#ifndef M4SCPCODECOMPLETER_H -#define M4SCPCODECOMPLETER_H - -#include -//#include - -class M4SCpCodeCompleter : public QCompleter -{ - Q_OBJECT -public: - explicit M4SCpCodeCompleter(QObject *parent = 0); - virtual ~M4SCpCodeCompleter(); - - /*! Initialize complete dictionary. - * This function must be call manualy, after completer creation - */ - void initDictionary(); - -private: - - -signals: - -public slots: - -}; - -#endif // M4SCPCODECOMPLETER_H diff --git a/sources/plugins/m4scp/m4scpcodeeditor.cpp b/sources/plugins/m4scp/m4scpcodeeditor.cpp deleted file mode 100644 index 4289807..0000000 --- a/sources/plugins/m4scp/m4scpcodeeditor.cpp +++ /dev/null @@ -1,383 +0,0 @@ -/* ------------------------------------------------------------------------------ -This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) -For the latest info, see http://www.ostis.net - -Copyright (c) 2010-2014 OSTIS - -OSTIS 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 3 of the License, or -(at your option) any later version. - -OSTIS is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with OSTIS. If not, see . ------------------------------------------------------------------------------ -*/ - -#include "m4scpcodeeditor.h" -#include "m4scpblockdata.h" -#include "m4scpcodecompleter.h" -#include "m4scpsyntax.h" - -#include -#include -#include -#include -#include - -M4SCpCodeEditor::M4SCpCodeEditor(QWidget *parent) : - QPlainTextEdit(parent), - startSelectionBlockNumber(-1), - endSelectionBlockNumber(-1), - lineNumberAreaVisible(true), - foldAreaVisible(true), - mCompleter(0) - -{ - setLineWrapMode(QPlainTextEdit::NoWrap); - extraArea = new ExtraArea(this); - - connect(this, SIGNAL(blockCountChanged(int)), this, SLOT(updateExtraAreaWidth())); - connect(this, SIGNAL(updateRequest(QRect,int)), this, SLOT(updateExtraArea(QRect,int))); - connect(this, SIGNAL(selectionChanged()), this, SLOT(changeSelection())); - connect(this, SIGNAL(textChanged()),this,SLOT(updateBlockLevels())); - - updateExtraAreaWidth(); - - // create auto completer - mCompleter = new M4SCpCodeCompleter(this); - mCompleter->initDictionary(); - mCompleter->setWidget(this); - mCompleter->setCompletionMode(QCompleter::PopupCompletion); - mCompleter->setCaseSensitivity(Qt::CaseSensitive); - mCompleter->setModelSorting(QCompleter::CaseInsensitivelySortedModel); - - connect(mCompleter, SIGNAL(activated(QModelIndex)), this, SLOT(insertCompletion(QModelIndex))); -} - -M4SCpCodeEditor::~M4SCpCodeEditor() -{ - delete extraArea; - delete mCompleter; -} - -int M4SCpCodeEditor::extraAreaWidth() -{ - int digits = 1; - int max = qMax(1, blockCount()); - while (max >= 10) { - max /= 10; - ++digits; - } - - int space = lineNumberAreaVisible ? 3 + fontMetrics().width(QLatin1Char('9')) * digits : 0; - - space += foldAreaVisible ? foldAreaWidht: 0; - - return space; -} - -void M4SCpCodeEditor::updateExtraAreaWidth() -{ - setViewportMargins(extraAreaWidth(), 0, 0, 0); -} - -void M4SCpCodeEditor::updateExtraArea(const QRect &rect, int dy) -{ - if (dy) - extraArea->scroll(0, dy); - else - extraArea->update(0, rect.y(), extraArea->width(), rect.height()); - - if (rect.contains(viewport()->rect())) - updateExtraAreaWidth(); -} - -QString M4SCpCodeEditor::textUnderCursor() -{ - QTextCursor tc = textCursor(); - tc.movePosition(QTextCursor::WordLeft, QTextCursor::KeepAnchor); - - return tc.selectedText(); -} - -void M4SCpCodeEditor::resizeEvent(QResizeEvent *e) -{ - QPlainTextEdit::resizeEvent(e); - - QRect cr = contentsRect(); - extraArea->setGeometry(QRect(cr.left(), cr.top(), extraAreaWidth(), cr.height())); -} - -void M4SCpCodeEditor::keyPressEvent(QKeyEvent *e) -{ - if ((e->modifiers() == Qt::ControlModifier && e->key() == Qt::Key_Tab) - || e->key() == Qt::Key_Backtab) - { - e->ignore(); - return; - } - - if(BlockData::data(textCursor().block())->isFolded() && e->key()==Qt::Key_Return) - { - moveCursor(QTextCursor::PreviousBlock,QTextCursor::MoveAnchor); - QPlainTextEdit::keyPressEvent(e); - return; - } - - if (e->modifiers() == Qt::ShiftModifier && - (e->key() == Qt::Key_PageDown || e->key() == Qt::Key_PageUp)) - { - QPlainTextEdit::keyPressEvent(e); - emit selectionChanged(); - e->accept(); - return; - } - if (mCompleter->popup()->isVisible()) - { - if (e->key() == Qt::Key_Escape || - e->key() == Qt::Key_Enter || - e->key() == Qt::Key_Return || - e->key() == Qt::Key_Tab || - e->key() == Qt::Key_Backtab) - { - e->ignore(); - return; - } - } - - bool isShortcut = (e->modifiers() == Qt::ControlModifier && e->key() == Qt::Key_Space); - if (!isShortcut) - QPlainTextEdit::keyPressEvent(e); - - bool ctrlOrShift = e->modifiers() == Qt::ControlModifier || e->modifiers() == Qt::ShiftModifier; - if (ctrlOrShift && e->text().isEmpty()) - return; - - bool hasModifier = ((e->modifiers() != Qt::NoModifier) && !ctrlOrShift); - - QString completionPrefix = textUnderCursor(); - - if (!isShortcut && (hasModifier || - e->text().isEmpty() || - completionPrefix.length() < 1 || - M4SCpSyntax::eow().contains(e->text().right(1)))) - { - mCompleter->popup()->hide(); - return; - } - - if (completionPrefix != mCompleter->completionPrefix()) - { - mCompleter->setCompletionPrefix(completionPrefix); - mCompleter->popup()->setCurrentIndex(mCompleter->completionModel()->index(0, 0)); - } - - QRect cr = cursorRect(); - cr.setWidth(mCompleter->popup()->sizeHintForColumn(0) + - mCompleter->popup()->verticalScrollBar()->sizeHint().width()); - mCompleter->complete(cr); -} - -void M4SCpCodeEditor::extraAreaPaintEvent(QPaintEvent *event) -{ - - QPainter painter(extraArea); - painter.fillRect(event->rect(), Qt::lightGray); - - QTextBlock block = firstVisibleBlock(); - BlockData *blockData; - - int level=0,curLevel; - int top = (int) blockBoundingGeometry(block).translated(contentOffset()).top(); - - int bottom = top + (int) blockBoundingRect(block).height(); - while (block.isValid() && top <= event->rect().bottom()) { - - blockData=BlockData::data(block); - - if (block.isVisible() && bottom >= event->rect().top()) { - - if(lineNumberAreaVisible){ - - QString number = QString::number(block.blockNumber() + 1); - painter.setPen(Qt::black); - if (block.blockNumber() <= endSelectionBlockNumber && - block.blockNumber() >= startSelectionBlockNumber && - startSelectionBlockNumber != -1 && endSelectionBlockNumber != -1) { - painter.setBackground(QBrush(Qt::darkGray)); - painter.setBackgroundMode(Qt::OpaqueMode); - } - else { - painter.setBackground(QBrush(Qt::lightGray)); - painter.setBackgroundMode(Qt::OpaqueMode); - } - painter.drawText(0, top, extraArea->width()- (foldAreaVisible ? foldAreaWidht :0), fontMetrics().height(), - Qt::AlignRight, number); - } - - if(foldAreaVisible){ - curLevel=blockData->getFoldingLevel(); - int x=extraAreaWidth()-foldAreaWidht; - if(curLevel>level){ - drawIcon(&painter,x, top+2, blockData->isFolded() ); - }else - if(curLevel>0) - painter.drawLine(x+7,top,x+7,bottom); - if(curLevel0 && block.previous().isVisible()){ - painter.drawLine(x+7,top,x+foldAreaWidht,top); - } - level=curLevel; - } - } - - block = block.next(); - top = bottom; - bottom = top + blockBoundingRect(block).height(); - } -} - -void M4SCpCodeEditor::insertCompletion(QModelIndex index) -{ - QTextCursor tc = textCursor(); - - QString templ = mCompleter->completionModel()->data(index, Qt::UserRole).toString(); - if (templ.isEmpty()) templ = mCompleter->completionModel()->data(index, Qt::DisplayRole).toString(); - quint32 extra = templ.length() - mCompleter->completionPrefix().length(); - tc.movePosition(QTextCursor::Left); - tc.movePosition(QTextCursor::EndOfWord); - tc.insertText(templ.right(extra)); - setTextCursor(tc); -} - - -void M4SCpCodeEditor::changeSelection() { - QTextCursor cur = textCursor(); - startSelectionBlockNumber = document()->findBlock(cur.selectionStart()).blockNumber(); - endSelectionBlockNumber = document()->findBlock(cur.selectionEnd() - 1).blockNumber(); - if (cur.selection().isEmpty()) { - startSelectionBlockNumber = -1; - endSelectionBlockNumber = -1; - } -} - -void M4SCpCodeEditor::updateBlockLevels() -{ - //TODO redefine this method in analyzer - - QString text; - int i, level=0; - for(QTextBlock it=document()->begin();it!=document()->end();it=it.next()){ - text=it.text(); - for(i=0;i0) { - level--; - } - } - BlockData::data(it)->setFoldingLevel(level); - } -} - -QRect M4SCpCodeEditor::drawIcon(QPainter *painter, int x,int y, bool folded) -{ - - QRect iconRect(x+1,y+1,12,12); - - painter->drawRect(iconRect); - painter->drawLine(x+3,y+7,x+11,y+7); - - if(folded){ - painter->drawLine(x+7,y+3,x+7,y+11); - } - - return iconRect; -} - -void M4SCpCodeEditor::foldOrUnfold(int blockNumber) -{ - QTextBlock block=document()->findBlockByNumber(blockNumber); - BlockData *bd=BlockData::data(block); - - int level,curLevel; - - level=curLevel=bd->getFoldingLevel(); - if(!level) return; - bool state=bd->isFolded(); - - while(block.previous().isValid()) - { - bd=BlockData::data(block.previous()); - curLevel=bd->getFoldingLevel(); - if(level>curLevel) break; - block = block.previous(); - } - - curLevel=level; - BlockData::data(block)->setFolded(!state); - - while (block.next().isValid()) - { - block=block.next(); - bd=BlockData::data(block); - curLevel=bd->getFoldingLevel(); - - if(curLevellevel) - { - if(BlockData::data(block.previous())->getFoldingLevel() >= curLevel - && bd->isFolded()) - continue; - }else - bd->setFolded(!state); - - block.setLineCount(state ? 1 : 0 ); - block.setVisible(state); - } - if(!state) moveCursorFromFoldedBlocks(); -} - -void M4SCpCodeEditor::moveCursorFromFoldedBlocks() -{ - QTextCursor cursor= textCursor(); - QTextBlock block=cursor.block(); - - if(block.isVisible()) - return; - - while(!block.isVisible()) - { - block=block.previous(); - moveCursor(QTextCursor::PreviousBlock,QTextCursor::MoveAnchor); - } -} - -void M4SCpCodeEditor::extraAreaMousePressEvent(QMouseEvent *event) -{ - - QTextCursor cursor=cursorForPosition(QPoint(0, event->pos().y())); - if(event->pos().x() > (extraArea->width()-foldAreaWidht) && foldAreaVisible ) - { - - foldOrUnfold(cursor.blockNumber()); - viewport()->update(); - extraArea->update(); - } - if(event->pos().x() < (extraArea->width() - (foldAreaVisible ? foldAreaWidht : 0)) && lineNumberAreaVisible ) - { - setTextCursor(cursor); - moveCursor(QTextCursor::EndOfBlock,QTextCursor::KeepAnchor); - } - -} - diff --git a/sources/plugins/m4scp/m4scpcodeeditor.h b/sources/plugins/m4scp/m4scpcodeeditor.h deleted file mode 100644 index 6994a8c..0000000 --- a/sources/plugins/m4scp/m4scpcodeeditor.h +++ /dev/null @@ -1,111 +0,0 @@ -/* ------------------------------------------------------------------------------ -This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) -For the latest info, see http://www.ostis.net - -Copyright (c) 2010-2014 OSTIS - -OSTIS 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 3 of the License, or -(at your option) any later version. - -OSTIS is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with OSTIS. If not, see . ------------------------------------------------------------------------------ -*/ - -#ifndef M4SCPCODEEDITOR_H -#define M4SCPCODEEDITOR_H - -#include -#include - -class M4SCpCodeCompleter; - -class ExtraArea; - -class M4SCpCodeEditor : public QPlainTextEdit -{ - Q_OBJECT -public: - explicit M4SCpCodeEditor(QWidget *parent = 0); - virtual ~M4SCpCodeEditor(); - - void extraAreaPaintEvent(QPaintEvent *event); - void extraAreaMousePressEvent(QMouseEvent *event); - int extraAreaWidth(); - -protected: - //! Return text under cursor - QString textUnderCursor(); - - - void resizeEvent(QResizeEvent *event); - void keyPressEvent(QKeyEvent *e); - -private slots: - void updateExtraAreaWidth(); - void updateExtraArea(const QRect &, int); - void updateBlockLevels(); - - //! Slot to insert completion - void insertCompletion(QModelIndex index); - - void changeSelection(); - -private: - ExtraArea *extraArea; - - int startSelectionBlockNumber; - int endSelectionBlockNumber; - - bool lineNumberAreaVisible; - - bool foldAreaVisible; - const static int foldAreaWidht=15; - - //! Pointer to code completer - M4SCpCodeCompleter *mCompleter; - - QRect drawIcon(QPainter *, int y,int height, bool folded); - void foldOrUnfold (int blockNumber); - void moveCursorFromFoldedBlocks(); -}; - -class ExtraArea : public QWidget -{ -public: - ExtraArea(M4SCpCodeEditor *editor) : QWidget(editor) { - codeEditor = editor; - } - - QSize sizeHint() const { - return QSize(codeEditor->extraAreaWidth(), 0); - } - - - -protected: - void paintEvent(QPaintEvent *event) { - codeEditor->extraAreaPaintEvent(event); - } - void mousePressEvent(QMouseEvent *event){ - codeEditor->extraAreaMousePressEvent( event); - } - -private: - M4SCpCodeEditor *codeEditor; - - - int startSelectionBlockNumber; - int endSelectionBlockNumber; -}; - - -#endif // M4SCPCODEEDITOR_H diff --git a/sources/plugins/m4scp/m4scpplugin.cpp b/sources/plugins/m4scp/m4scpplugin.cpp deleted file mode 100644 index 925adfb..0000000 --- a/sources/plugins/m4scp/m4scpplugin.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* ------------------------------------------------------------------------------ -This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) -For the latest info, see http://www.ostis.net - -Copyright (c) 2010-2014 OSTIS - -OSTIS 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 3 of the License, or -(at your option) any later version. - -OSTIS is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with OSTIS. If not, see . ------------------------------------------------------------------------------ -*/ - -#include "m4scpplugin.h" -#include "m4scpsyntax.h" -#include "m4scpwindow.h" - -#include -#include -#include -#include - -Q_EXPORT_PLUGIN2(m4scp, M4SCpPlugin) - -M4SCpPlugin::M4SCpPlugin(QObject *parent) : - QObject(parent), - mTranslator(0) -{ - mTranslator = new QTranslator(this); - mTranslator->load(":/m4scp/media/translations/m4scp_" + QLocale::system().name()); -} - -M4SCpPlugin::~M4SCpPlugin() -{ - delete mTranslator; -} - -const QString& M4SCpPlugin::name() const -{ - static QString name = "m4scp"; - return name; -} - -const QString& M4SCpPlugin::version() const -{ - static QString version = "0.1.0"; - return version; -} - -const QList& M4SCpPlugin::interfaces() const -{ - return mInterfaces; -} - -void M4SCpPlugin::initialize() -{ - M4SCpSyntax::initialize(); - - mInterfaces.push_back(new M4SCpWindowFactory(this)); - - qApp->installTranslator(mTranslator); -} - -void M4SCpPlugin::shutdown() -{ - QObject *obj = 0; - foreach(obj, mInterfaces) - delete obj; - - mInterfaces.clear(); - - qApp->removeTranslator(mTranslator); -} diff --git a/sources/plugins/m4scp/m4scpplugin.h b/sources/plugins/m4scp/m4scpplugin.h deleted file mode 100644 index 859eb21..0000000 --- a/sources/plugins/m4scp/m4scpplugin.h +++ /dev/null @@ -1,67 +0,0 @@ -/* ------------------------------------------------------------------------------ -This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) -For the latest info, see http://www.ostis.net - -Copyright (c) 2010-2014 OSTIS - -OSTIS 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 3 of the License, or -(at your option) any later version. - -OSTIS is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with OSTIS. If not, see . ------------------------------------------------------------------------------ -*/ - -#ifndef M4SCPPLUGIN_H -#define M4SCPPLUGIN_H - -#include - -#include "interfaces/plugininterface.h" - -class QTranslator; - -class M4SCpPlugin : public QObject, public PluginInterface -{ - Q_OBJECT - Q_INTERFACES(PluginInterface) - -public: - explicit M4SCpPlugin(QObject *parent = 0); - virtual ~M4SCpPlugin(); - - static QString mediaPath(); - -protected: - //! @copydoc PluginInterface::name - const QString& name() const; - //! @copydoc PluginInterface::version - const QString& version() const; - //! @copydoc PluginInterface::interfaces - const QList& interfaces() const; - //! @copydoc PluginInterface::initialize - void initialize(); - //! @copydoc PluginInterface::shutdown - void shutdown(); - -private: - //! List of interfaces - QList mInterfaces; - //! Pointer to plugin translator - QTranslator *mTranslator; - -signals: - -public slots: - -}; - -#endif // M4SCPPLUGIN_H diff --git a/sources/plugins/m4scp/m4scpsyntax.cpp b/sources/plugins/m4scp/m4scpsyntax.cpp deleted file mode 100644 index e663f94..0000000 --- a/sources/plugins/m4scp/m4scpsyntax.cpp +++ /dev/null @@ -1,106 +0,0 @@ -/* ------------------------------------------------------------------------------ -This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) -For the latest info, see http://www.ostis.net - -Copyright (c) 2010-2014 OSTIS - -OSTIS 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 3 of the License, or -(at your option) any later version. - -OSTIS is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with OSTIS. If not, see . ------------------------------------------------------------------------------ -*/ - -#include "m4scpsyntax.h" - -QStringList M4SCpSyntax::mOperatorsList = QStringList(); -QStringList M4SCpSyntax::mAttributesList = QStringList(); -QStringList M4SCpSyntax::mOrdinalsList = QStringList(); - -QString M4SCpSyntax::mEndOfWord = "~!@#$%^&*()_+{}|:\"<>?,./;'[]\\-="; // end of word - -void M4SCpSyntax::initialize() -{ - mOperatorsList.clear(); - mOperatorsList - << "add" << "add_to_queue" << "call" - << "contAssign" << "contErase" << "div" - << "eraseElStr3" << "eraseElStr5" << "eraseSetStr3" - << "genElStr3" << "genElStr5" << "gsub" - << "idtfErase" << "idtfMove" << "ifCoin" - << "ifFormCont" << "ifFormIdtf" << "ifGr" - << "ifNumber" << "ifString" << "ifType" - << "init" << "mult" << "nop" - << "print" << "printEl" << "printNl" - << "program" << "programSCP" << "return" - << "searchElStr5"<< "searchSetStr3"<< "searchSetStr5" - << "selectNStr5" << "selectYStr3" << "selectYStr5" - << "callReturn" << "eraseEl" << "genEl" - << "idtfAssign" << "ifEq" << "ifGrEq" - << "ifVarAssign" << "pow" << "procedure" - << "searchElStr3"<<"selectNStr3" << "sub" - - << "sys_close_segment" << "sys_create_segment" - << "sys_get_default_segment" << "sys_get_location" - << "sys_open_dir_uri" << "sys_open_segment" - << "sys_send_message" << "sys_set_default_segment" - << "sys_spin_segment" << "sys_unlink" - << "varAssign" << "varErase" - << "wait_erase_element" << "wait_gen_input_arc" - << "wait_input_arc" << "wait_output_arc" - << "end" << "wait_recieve_message" - << "sys_get_autosegment" << "sys_open_dir" - << "sys_open_segment_uri" << "sys_set_event_handler" - << "sys_wait" << "waitReturn" - << "wait_gen_output_arc" << "label"; - - - mOrdinalsList.clear(); - mOrdinalsList - << "1_" << "2_" << "3_" << "4_" << "5_" - << "7_" << "8_" << "9_" << "set1_" << "set2_" - << "set4_" << "set5_" << "set6_" << "set7_" << "set8_" - << "6_" << "set3_" << "set9_" ; - - - mAttributesList.clear(); - mAttributesList - << "arc_" << "const_" << "else_" << "segc_9_" - << "fuz_" << "goto_" << "in_" << "segc_4_" - << "metavar_" << "neg_" << "node_" << "out_" - << "prm_" << "segc_1_" << "segc_2_"<< "segc_3_" - << "segc_5_" << "segc_6_" << "segc_7_"<< "segc_8_" - << "then_" << "undf_" << "var_" <<"elem_" - << "f_" << "init_" << "pos_" << "assign_" - << "fixed_" << "f_"; -} - -const QStringList& M4SCpSyntax::operators() -{ - return mOperatorsList; -} - -const QStringList& M4SCpSyntax::attributes() -{ - return mAttributesList; -} - -const QStringList& M4SCpSyntax::ordinals() -{ - return mOrdinalsList; -} - - -const QString& M4SCpSyntax::eow() -{ - return mEndOfWord; -} diff --git a/sources/plugins/m4scp/m4scpsyntax.h b/sources/plugins/m4scp/m4scpsyntax.h deleted file mode 100644 index 17b9535..0000000 --- a/sources/plugins/m4scp/m4scpsyntax.h +++ /dev/null @@ -1,61 +0,0 @@ -/* ------------------------------------------------------------------------------ -This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) -For the latest info, see http://www.ostis.net - -Copyright (c) 2010-2014 OSTIS - -OSTIS 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 3 of the License, or -(at your option) any later version. - -OSTIS is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with OSTIS. If not, see . ------------------------------------------------------------------------------ -*/ - -#ifndef M4SCPSYNTAX_H -#define M4SCPSYNTAX_H - -#include - -/*! This class contains lists of all keywords - */ -class M4SCpSyntax -{ -public: - //! Initialize keyword lists - static void initialize(); - - //! Return list of operators - static const QStringList& operators(); - - //! Return list of attributes - static const QStringList& attributes(); - - //! Return list of ordinals - static const QStringList& ordinals(); - - //! Get last symbols for words - static const QString& eow(); - -protected: - //! List of all m4scp operators - static QStringList mOperatorsList; - //! List of all m4scp attributes - static QStringList mAttributesList; - //! List of all m4scp ordinals - static QStringList mOrdinalsList; - - //! Symbols that used as end of word - static QString mEndOfWord; - -}; - -#endif // M4SCPSYNTAX_H diff --git a/sources/plugins/m4scp/m4scpsyntaxhighlighter.cpp b/sources/plugins/m4scp/m4scpsyntaxhighlighter.cpp deleted file mode 100644 index 5363956..0000000 --- a/sources/plugins/m4scp/m4scpsyntaxhighlighter.cpp +++ /dev/null @@ -1,204 +0,0 @@ -/* ------------------------------------------------------------------------------ -This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) -For the latest info, see http://www.ostis.net - -Copyright (c) 2010-2014 OSTIS - -OSTIS 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 3 of the License, or -(at your option) any later version. - -OSTIS is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with OSTIS. If not, see . ------------------------------------------------------------------------------ -*/ - -#include "m4scpsyntaxhighlighter.h" -#include -#include - -M4SCpSyntaxHighlighter::M4SCpSyntaxHighlighter(QTextDocument *parent) - : QSyntaxHighlighter(parent) -{ - createSCpOperatorFormat(); - createSCpAttributesFormat(); - createSCpOriginsFormat(); - createBracketsFormat(); - createOthersFormat(); -} - -void M4SCpSyntaxHighlighter::highlightBlock(const QString &text) -{ - foreach (const M4SCpHighlightingRule &rule, highlightingRules) { - QRegExp expression(rule.pattern); - int index = expression.indexIn(text); - while (index >= 0) { - int length = expression.matchedLength(); - setFormat(index,length, rule.format); - index = expression.indexIn(text, index + length); - } - setCurrentBlockState(0); - int startIndex = 0; - if (previousBlockState() != 1) - startIndex = commentStartExpression.indexIn(text); - while (startIndex >= 0) { - int endIndex = commentEndExpression.indexIn(text, startIndex); - int commentLength; - if (endIndex == -1) { - setCurrentBlockState(1); - commentLength = text.length() - startIndex; - } else { - commentLength = endIndex - startIndex - + commentEndExpression.matchedLength(); - } - setFormat(startIndex, commentLength, multiLineCommentFormat); - startIndex = commentStartExpression.indexIn(text, startIndex + commentLength); - } - } -} - -void M4SCpSyntaxHighlighter::createSCpOperatorFormat() -{ - QTextCharFormat m4scpOperatorFormat; - m4scpOperatorFormat.setForeground(Qt::blue); - - QStringList m4scpOperators; - m4scpOperators - << "\\badd\\b" << "\\badd_to_queue\\b" << "\\bcall\\b" - << "\\bcontAssign\\b" << "\\bcontErase\\b" << "\\bdiv\\b" - << "\\beraseElStr3\\b" << "\\beraseElStr5\\b" << "\\beraseSetStr3\\b" - << "\\bgenElStr3\\b" << "\\bgenElStr5\\b" << "\\bgsub\\b" - << "\\bidtfErase\\b" << "\\bidtfMove\\b" << "\\bifCoin\\b" - << "\\bifFormCont\\b" << "\\bifFormIdtf\\b" << "\\bifGr\\b" - << "\\bifNumber\\b" << "\\bifString\\b" << "\\bifType\\b" - << "\\binit\\b" << "\\bmult\\b" << "\\bnop\\b" - << "\\bprint\\b" << "\\bprintEl\\b" << "\\bprintNl\\b" - << "\\bprogram\\b" << "\\bprogramSCP\\b" << "\\breturn\\b" - << "\\bsearchElStr5\\b"<< "\\bsearchSetStr3\\b"<< "\\bsearchSetStr5\\b" - << "\\bselectNStr5\\b" << "\\bselectYStr3\\b" << "\\bselectYStr5\\b" - << "\\bcallReturn\\b" << "\\beraseEl\\b" << "\\bgenEl\\b" - << "\\bidtfAssign\\b" << "\\bifEq\\b" << "\\bifGrEq\\b" - << "\\bifVarAssign\\b" << "\\bpow\\b" << "\\bprocedure\\b" - << "\\bsearchElStr3\\b"<<"\\bselectNStr3\\b" << "\\bsub\\b" - - << "\\bsys_close_segment\\b" << "\\bsys_create_segment\\b" - << "\\bsys_get_default_segment\\b" << "\\bsys_get_location\\b" - << "\\bsys_open_dir_uri\\b" << "\\bsys_open_segment\\b" - << "\\bsys_send_message\\b" << "\\bsys_set_default_segment\\b" - << "\\bsys_spin_segment\\b" << "\\bsys_unlink\\b" - << "\\bvarAssign\\b" << "\\bvarErase\\b" - << "\\bwait_erase_element\\b" << "\\bwait_gen_input_arc\\b" - << "\\bwait_input_arc\\b" << "\\bwait_output_arc\\b" - << "\\bend\\b" << "\\bwait_recieve_message\\b" - << "\\bsys_get_autosegment\\b" << "\\bsys_open_dir\\b" - << "\\bsys_open_segment_uri\\b" << "\\bsys_set_event_handler\\b" - << "\\bsys_wait\\b" << "\\bwaitReturn\\b" - << "\\bwait_gen_output_arc\\b"; - - M4SCpHighlightingRule rule; - saveFormat(m4scpOperatorFormat,m4scpOperators); - QTextCharFormat labelFormat; - QBrush brush = QBrush(qRgb(255, 0, 128)); - labelFormat.setForeground(brush); - rule.pattern = QRegExp("\\label\\b"); - rule.format = labelFormat; - highlightingRules.append(rule); -} - -void M4SCpSyntaxHighlighter::createSCpOriginsFormat() -{ - QStringList m4scpOrdinals; - m4scpOrdinals - << "\\b1_\\b" << "\\b2_\\b" << "\\b3_\\b" << "\\b4_\\b" << "\\b5_\\b" - << "\\b7_\\b" << "\\b8_\\b" << "\\b9_\\b" << "\\bset1_\\b" << "\\bset2_\\b" - << "\\bset4_\\b" << "\\bset5_" << "\\bset6_" << "\\bset7_\\b" << "\\bset8_\\b" - << "\\b6_\\b" << "\\bset3_\\b" << "\\bset9_\\b" ; - - QTextCharFormat m4scpOrdinalsFormat; - //m4scpOrdinalsFormat.setFontWeight(QFont::Bold); - m4scpOrdinalsFormat.setForeground(Qt::black); - - saveFormat(m4scpOrdinalsFormat, m4scpOrdinals); -} - -void M4SCpSyntaxHighlighter::createSCpAttributesFormat() -{ - QStringList m4scpAttributes; - m4scpAttributes - << "\\barc_\\b" << "\\bconst_\\b" << "\\belse_\\b" << "\\bsegc_9_\\b" - << "\\bfuz_\\b" << "\\bgoto_\\b" << "\\bin_\\b" << "\\bsegc_4_\\b" - << "\\bmetavar_\\b" << "\\bneg_\\b" << "\\bnode_\\b" << "\\bout_\\b" - << "\\bprm_\\b" << "\\bsegc_1_\\b" << "\\bsegc_2_\\b"<< "\\bsegc_3_\\b" - << "\\bsegc_5_\\b" << "\\bsegc_6_\\b" << "\\bsegc_7_\\b"<< "\\bsegc_8_\\b" - << "\\bthen_\\b" << "\\bundf_\\b" << "\\bvar_\\b" <<"\\belem_\\b" - << "\\bf_\\b" << "\\binit_\\b" << "\\bpos_\\b"; - QTextCharFormat m4scpAttributesFormat; - m4scpAttributesFormat.setForeground(QBrush(qRgb(255, 128, 64))); - - saveFormat(m4scpAttributesFormat, m4scpAttributes); - m4scpAttributes.clear(); - - m4scpAttributes<< "\\bassign_\\b" << "\\bfixed_\\b"<< "\\bf_\\b"; - m4scpAttributesFormat.setForeground(Qt::red); - saveFormat(m4scpAttributesFormat, m4scpAttributes); - } - -void M4SCpSyntaxHighlighter::saveFormat(QTextCharFormat format,QStringList patterns) -{ - M4SCpHighlightingRule rule; - foreach (const QString &pattern, patterns) { - rule.pattern = QRegExp(pattern); - rule.format = format; - highlightingRules.append(rule); - } -} -void M4SCpSyntaxHighlighter::createBracketsFormat() -{ - QTextCharFormat bracketsFormat; - QBrush brush = QBrush(qRgb(0, 64, 0)); - bracketsFormat.setForeground(brush); - //bracketsFormat.setFontWeight(QFont::Bold); - M4SCpHighlightingRule rule; - - rule.pattern = QRegExp("[])[(){}]"); - rule.format = bracketsFormat; - highlightingRules.append(rule); -} -void M4SCpSyntaxHighlighter::createOthersFormat() -{ - M4SCpHighlightingRule rule; - QTextCharFormat quotationFormat; - quotationFormat.setForeground(QBrush(QColor(0, 128, 0))); - rule.pattern = QRegExp("\".*\""); - rule.format = quotationFormat; - highlightingRules.append(rule); - - QTextCharFormat includeFormat; - includeFormat.setForeground(Qt::blue); - rule.pattern = QRegExp("#include"); - rule.format = includeFormat; - highlightingRules.append(rule); - - QTextCharFormat comaFormat; - comaFormat.setForeground(Qt::black); - rule.pattern = QRegExp("[,;:]"); - rule.format = comaFormat; - highlightingRules.append(rule); - - QTextCharFormat singleLineCommentFormat; - singleLineCommentFormat.setForeground(Qt::darkGray); - rule.pattern = QRegExp("//[^\n]*"); - rule.format = singleLineCommentFormat; - highlightingRules.append(rule); - - multiLineCommentFormat.setForeground(Qt::darkGray); - commentStartExpression = QRegExp("/\\*"); - commentEndExpression = QRegExp("\\*/"); -} diff --git a/sources/plugins/m4scp/m4scpsyntaxhighlighter.h b/sources/plugins/m4scp/m4scpsyntaxhighlighter.h deleted file mode 100644 index 78e199f..0000000 --- a/sources/plugins/m4scp/m4scpsyntaxhighlighter.h +++ /dev/null @@ -1,53 +0,0 @@ -/* ------------------------------------------------------------------------------ -This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) -For the latest info, see http://www.ostis.net - -Copyright (c) 2010-2014 OSTIS - -OSTIS 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 3 of the License, or -(at your option) any later version. - -OSTIS is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with OSTIS. If not, see . ------------------------------------------------------------------------------ -*/ - -#ifndef M4SCPSYNTAXHIGHLIGHTER_H -#define M4SCPSYNTAXHIGHLIGHTER_H - -#include - -class M4SCpSyntaxHighlighter : public QSyntaxHighlighter -{ -public: - M4SCpSyntaxHighlighter(QTextDocument *parent = 0); - void highlightBlock(const QString &text); - struct M4SCpHighlightingRule - { - QRegExp pattern; - QTextCharFormat format; - }; -private: - void createSCpOperatorFormat(); - void createSCpAttributesFormat(); - void createSCpOriginsFormat(); - void createOthersFormat(); - void createBracketsFormat(); - - void saveFormat(QTextCharFormat format, QStringList patterns); -private: - QVector highlightingRules; - QTextCharFormat multiLineCommentFormat; - QRegExp commentStartExpression; - QRegExp commentEndExpression; -}; - -#endif // M4SCPSYNTAXHIGHLIGHTER_H diff --git a/sources/plugins/m4scp/m4scpwindow.cpp b/sources/plugins/m4scp/m4scpwindow.cpp deleted file mode 100644 index eb3973f..0000000 --- a/sources/plugins/m4scp/m4scpwindow.cpp +++ /dev/null @@ -1,201 +0,0 @@ -/* ------------------------------------------------------------------------------ -This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) -For the latest info, see http://www.ostis.net - -Copyright (c) 2010-2014 OSTIS - -OSTIS 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 3 of the License, or -(at your option) any later version. - -OSTIS is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with OSTIS. If not, see . ------------------------------------------------------------------------------ -*/ - -#include "m4scpwindow.h" -#include "m4scpcodeeditor.h" -#include "m4scpsyntaxhighlighter.h" -#include "m4scpplugin.h" - -#include "config.h" - -#include -#include -#include -#include -#include -#include -#include - - -M4SCpWindow::M4SCpWindow(const QString& _windowTitle, QWidget *parent): - QWidget(parent), - mEditor(0), - mHighlighter(0), - mIsSaved(false) -{ - mEditor = new M4SCpCodeEditor(); - QFont font("Arial", 11); - font.setStyleHint(QFont::Serif); - mEditor->setFont(font); - mEditor->setPalette(QPalette(QPalette::Background, Qt::white)); - mEditor->setTabStopWidth(20); - - mHighlighter = new M4SCpSyntaxHighlighter(mEditor->document()); - QVBoxLayout *layout = new QVBoxLayout(); - layout->addWidget(mEditor); - setLayout(layout); - - connect(mEditor, SIGNAL(textChanged()), this, SLOT(textChanged())); -} - -M4SCpWindow::~M4SCpWindow() -{ - delete mHighlighter; - delete mEditor; -} - -QWidget* M4SCpWindow::widget() -{ - return this; -} - -QToolBar* M4SCpWindow::toolBar() -{ - return 0; -} - -QList M4SCpWindow::widgetsForDocks() -{ - return QList(); -} - -QStringList M4SCpWindow::supportedFormatsExt() const -{ - QStringList res; - res << "m4scp"; - return res; -} - -bool M4SCpWindow::loadFromFile(const QString &fileName) -{ - // read data from file - QFile fileIn(fileName); - - if (!fileIn.open(QIODevice::ReadOnly | QIODevice::Text)) - { - QMessageBox::warning(0, tr("Error"), - tr("Can't open file %1:\n%2.") - .arg(fileName) - .arg(fileIn.errorString())); - return false; - } - - QTextStream in(&fileIn); - mEditor->document()->setPlainText(in.readAll()); - fileIn.close(); - - mFileName = fileName; - setWindowTitle(mFileName + "[*]"); - mIsSaved = true; - - emitEvent(EditorObserverInterface::ContentLoaded); - - return true; -} - - -bool M4SCpWindow::saveToFile(const QString &fileName) -{ - QFile fileOut(fileName); - if (!fileOut.open(QFile::WriteOnly | QFile::Text)) - { - QMessageBox::warning(0, tr("error"), - tr("Can't save file %1:\n%2.") - .arg(fileName) - .arg(fileOut.errorString())); - return false; - } - QTextStream out(&fileOut); - out << mEditor->document()->toPlainText(); - fileOut.close(); - - mFileName = fileName; - setWindowTitle(mFileName + "[*]"); - mIsSaved = true; - - emitEvent(EditorObserverInterface::ContentSaved); - - return true; -} - -bool M4SCpWindow::isSaved() const -{ - return mIsSaved; -} - -void M4SCpWindow::_update() -{ - -} - -QIcon M4SCpWindow::icon() const -{ - return findIcon("mime_type.png"); -} - -QIcon M4SCpWindow::findIcon(const QString &iconName) -{ - return QIcon(":/m4scp/media/icons/" + iconName); -} - -void M4SCpWindow::textChanged() -{ - mIsSaved = false; - emitEvent(EditorObserverInterface::ContentChanged); -} - - -// --------------- -M4SCpWindowFactory::M4SCpWindowFactory(QObject *parent) : - QObject(parent) -{ - -} - -M4SCpWindowFactory::~M4SCpWindowFactory() -{ - -} - -const QString& M4SCpWindowFactory::name() const -{ - static QString name = "m4scp"; - return name; -} - -EditorInterface* M4SCpWindowFactory::createInstance() -{ - return new M4SCpWindow(""); -} - -QStringList M4SCpWindowFactory::supportedFormatsExt() -{ - QStringList list; - list << "m4scp"; - - return list; -} - -QIcon M4SCpWindowFactory::icon() const -{ - return M4SCpWindow::findIcon("mime_type.png"); -} diff --git a/sources/plugins/m4scp/m4scpwindow.h b/sources/plugins/m4scp/m4scpwindow.h deleted file mode 100644 index 73181c7..0000000 --- a/sources/plugins/m4scp/m4scpwindow.h +++ /dev/null @@ -1,112 +0,0 @@ -/* ------------------------------------------------------------------------------ -This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) -For the latest info, see http://www.ostis.net - -Copyright (c) 2010-2014 OSTIS - -OSTIS 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 3 of the License, or -(at your option) any later version. - -OSTIS is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with OSTIS. If not, see . ------------------------------------------------------------------------------ -*/ - -#ifndef M4SCPWINDOW_H -#define M4SCPWINDOW_H - -#include "interfaces/editorinterface.h" - -#include - -class M4SCpCodeEditor; -class M4SCpSyntaxHighlighter; -class QIcon; - -class M4SCpWindow : public QWidget, - public EditorInterface - -{ - Q_OBJECT - Q_INTERFACES(EditorInterface) -public: - explicit M4SCpWindow(const QString& _windowTitle, QWidget *parent = 0); - ~M4SCpWindow(); - - //! @copydoc EditorInterface::widget - QWidget* widget(); - //! @copydoc EditorInterface::toolBar - QToolBar* toolBar(); - //! @copydoc EditorInterface::widgetsForDocks - QList widgetsForDocks(); - //! @copydoc EditorInterface::supportedFormatsExt - QStringList supportedFormatsExt() const; - //! @copydoc EditorInterface::isSaved - bool isSaved() const; - - /*! Load content from file. - @param fileName Name of file. - - @return If file loaded, then return true, else - false. - */ - bool loadFromFile(const QString &fileName); - - /*! Save content to file. - @param fileName Name of file. - - @return If file saved, then return true, else - false. - */ - - bool saveToFile(const QString &fileName); - - /*! Update window imideately - */ - void _update(); - - /*! Get icon specified for window type - */ - QIcon icon() const; - - static QIcon findIcon(const QString &iconName); - -private: - - M4SCpCodeEditor *mEditor; - M4SCpSyntaxHighlighter *mHighlighter; - bool mIsSaved; - -private slots: - //! Slot that recieve content changing - void textChanged(); - -}; - -class M4SCpWindowFactory : public QObject, - public EditorFactoryInterface -{ - Q_OBJECT - Q_INTERFACES(EditorFactoryInterface) - -public: - explicit M4SCpWindowFactory(QObject *parent = 0); - virtual ~M4SCpWindowFactory(); - - //! @copydoc EditorFactoryInterface::name - const QString& name() const; - //! @copydoc EditorFactoryInterface::createInstance - EditorInterface* createInstance(); - //! @copydoc EditorFactoryInterface::supportedFormatsExt - QStringList supportedFormatsExt(); - //! @copydoc EditorFactoryInterface::icon - QIcon icon() const; -}; - -#endif // M4SCPWINDOW_H diff --git a/sources/plugins/m4scp/media/icons/attribute.png b/sources/plugins/m4scp/media/icons/attribute.png deleted file mode 100644 index e8a602da7b17a323b2c9afe3d8aac62cb717a0b8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 665 zcmV;K0%rY*P)W2MxECPn{*ELdZ1op0xyVpxzDdhz3h^YVPo^S(T97!Wp}{CC5s zOO0&MCbYN{*S_u5sKy(UFm7-Lr)M|odnZ1F`|tp z;QLC~;7ZS9V!0QqC_yL9nVW1CJTMZN4M(R$+ zOTZBsFr_4h`&3JNv0I_O8fwI~`z}0v3|$@I8UFpf@&;uE8s7DoF&~bRfJhmzX*a6< zs}(O~Kx~cpZxH}pS*S{qZRPWYW?G`zW8AQcn3#1@S*BcNV6f!zir{5lPjYZSt>eR~E27PJ0+es0y~s0ch&nN;M*NkCc% zXiQ#beHkC&om4IpK8qPut?)aNVjs<%39&#|d3=N1!OZi|I!ONj#Vr@M%?lVEC`+Fg zAQwL{?FfzVoB-$9WC=Ju7r^r86-w*!nR~wgLM67#gs;7-00000NkvXXu0mjfgI^=` diff --git a/sources/plugins/m4scp/media/icons/mime_type.png b/sources/plugins/m4scp/media/icons/mime_type.png deleted file mode 100644 index e067ed5173273259e114192a06b3fc95d50f6614..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1364 zcmV-a1*`grP)AM@(Z~Soi^5wNqg<-%sc81ZB137|o4usLwIXLIwM*WT)oV6}V%-`GF+rKnlzWgbQqTdDQyj)$X zZtm>tY;3)FQ7jgV2*VJ$Tn=FvLMeqX3=xJQq?C|SLI?pNL<)e2V6BBQ21%0O^z;;3 zYs7JkIF6yUPVXCy#zL)D{dQ+(=QpkOOTjtMUzoe_)i8?W>gp zk|e=!I7F+}LZ{O~c8v4p`xs-4GbR9>{rKQSXM9;}XAVR}NRkA`7%;|gczB3cuU;WZ zl1bGOAqWD@&(EV+EJ7)TR;vX9W25OZF>P>{3h2y(AOK@5z4zJZcDv|yyHh1Er9{16 zN4;K07>01pA&%n_HSg&e17NL%)_RO*4~&RX3IL$f>EQVIcxr|g7Z)D0HP=wD=|M?e6s@ z8A6P`1^`e>K}v}ziYESxq6k6=7-Q1KYAOJ4rBVsyav9s(+t}LL!qUf= zN}1{)yATl(wAN$w@B0Cy^jT|>O~C{JAp{l{7I5?CO>oZ9>2&bs%^N&<@&r$xKE>+l zDsJDtJ*E>M$XAKAHgzvTt#zt_nG^^iP$(4AC09y`#l=Nbt5uXrB|Llf46RlR_wL=B zpdnkf*}&eDBtaBK9~Pkp5QZTJg8`mDe~xCeiGIJ2TCIk=ckg0-eI2DzDWxHs0c$Os za}$BR`?Z8-Q4jb-mGXwkQj4>as0?s*v5Mwj;XM!vkr4$}NevE#ugM$McA0I<0g*c9( zluDP!=;aF@zBAv)%sn-Me=`TWkMf061f8 zE(n6El(G^8yZ|u%(GmX@2uh4GgCt2h&bd7RQTA&{jQn$a6Qmdbn33C$Jo~@>H}($^ WX>~im1D{v`0000OW%^N^ox0}MJJ@O#dCdMskq^A9kwxXrIWcrSi_3?zrw0R6UmLLRf9 z9xK}R`oI6&r}tpuA*){AE8G3%KS)ly_Kpx%1N2(%MMSTD`Mq%KtN(tpp59Y0xFL-s zCmpcp**%b4#M0;AfpQTj2Iw~2WeZ>a{A1;gH$Vl?eyiqOGe&o+X8A2+kX-4em;VE2 zKK`hXbcGGY1?t5&BSPmt{hqbz#ea{!2lwRTE=eQFNqbLybPpsKH1pASpj-sjFi=dn zB4pce=UD3Er~h4B?!v>sYto~887rRu2g%7rUlhU{3o;QG_$|wC9`o+J2ag5+DGxu` j)ZRG;k{c;WnG_5FM|sxYY1FNa00000NkvXXu0mjf#+s`M diff --git a/sources/plugins/m4scp/media/icons/procedure.png b/sources/plugins/m4scp/media/icons/procedure.png deleted file mode 100644 index 0f9ed4d48301ffdce04cdb17dbf8acbad8372d11..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 748 zcmVrG{ z$cl-P=->hx6#}NAmbP5myY~I>{qOhtLMa7Y{qE64eE#g}(xpY)TeQ8l?;Upi4EuP3 zj9qNwYy4OP^j-JLi)W5q`snr30AQZ_=_2*h-J^Uqwd^<9gC_@m_YruehOwSPa9@O%#PST ztn>RnbQXoQ3&2p_*N2(YI zkrMO}==(rnxsJAW59QQs0L07JZk*~;x_q%%{cN7dr3j%I4jC^oS!R20 zp-X8Kpw211iFbazd*AM1?Vu^zTr_Qvx?Y!ieJR$aQy;v2#^ddUoYEFRo!j>1ci(tn z{K@;T0)Sj-bCEg}zP!0%dBFa`LT=k_fI7GB{l`yczPWYR>anra$&%HTk?G3F@#Ue> zFdEg-dzaUZYPNRv<+lA7pzgcw+uL{UoxOeM-g%tFNu0n5OqYg(!P3&eWMyo1vh4Ri e9{q`*0R9JiiaRV3rbYDt0000 - - - - M4SCpWindow - - - Error - - - - - Can't open file %1: -%2. - - - - - error - - - - - Can't save file %1: -%2. - - - - diff --git a/sources/plugins/m4scp/media/translations/m4scp_ru_RU.ts b/sources/plugins/m4scp/media/translations/m4scp_ru_RU.ts deleted file mode 100644 index fc2ccaa..0000000 --- a/sources/plugins/m4scp/media/translations/m4scp_ru_RU.ts +++ /dev/null @@ -1,29 +0,0 @@ - - - - - M4SCpWindow - - - Error - Ошибка - - - - Can't open file %1: -%2. - Не удается открыть файл %1: %2 - - - - error - ошибка - - - - Can't save file %1: -%2. - Не удается сохранить файл %1: %2 - - - From 38fbd49bac3026ef3dcbe02cb11dc6ffad843269 Mon Sep 17 00:00:00 2001 From: Denis Koronchik Date: Sun, 22 Feb 2015 20:24:20 +0300 Subject: [PATCH 36/71] [common] Cleanup code. Port to qt5 (#296) --- sources/kbe/interfaces/editorinterface.h | 10 +- sources/kbe/interfaces/plugininterface.h | 2 +- sources/kbe/kbe.pro | 2 +- sources/kbe/main.cpp | 2 +- sources/kbe/mainwindow.cpp | 4 + sources/kbe/mainwindow.ui | 3 +- sources/kbe/projectmanagerview.cpp | 61 ++- sources/kbe/ui_mainwindow.h | 205 ---------- .../scg/arrangers/scgarrangerenergybased.cpp | 19 +- .../commands/scgcommandremovebreakpoints.cpp | 6 +- .../commands/scgcommandremovebreakpoints.h | 2 +- sources/plugins/scg/gwf/gwffileloader.h | 1 + sources/plugins/scg/modes/scginsertmode.cpp | 11 +- sources/plugins/scg/modes/scgmode.cpp | 6 +- sources/plugins/scg/scg.pro | 5 +- .../plugins/scg/scgabstractobjectbuilder.cpp | 2 +- .../plugins/scg/scgabstractobjectbuilder.h | 2 +- sources/plugins/scg/scgbus.cpp | 12 +- sources/plugins/scg/scgcontour.cpp | 30 +- .../plugins/scg/scgdefaultobjectbuilder.cpp | 5 +- sources/plugins/scg/scgfilewriterimage.cpp | 32 +- sources/plugins/scg/scgfindwidget.cpp | 13 +- sources/plugins/scg/scgminimap.cpp | 3 + sources/plugins/scg/scgnode.cpp | 11 +- sources/plugins/scg/scgnode.h | 2 +- sources/plugins/scg/scgnodetextitem.cpp | 8 +- sources/plugins/scg/scgnodetextitem.h | 4 +- sources/plugins/scg/scgobject.cpp | 16 +- sources/plugins/scg/scgobject.h | 2 +- sources/plugins/scg/scgpair.cpp | 8 +- sources/plugins/scg/scgplugin.cpp | 10 +- sources/plugins/scg/scgplugin.h | 1 + sources/plugins/scg/scgplugin.json | 3 + sources/plugins/scg/scgpointgraphicsitem.cpp | 2 + sources/plugins/scg/scgpointobject.cpp | 15 +- sources/plugins/scg/scgpointobject.h | 2 +- sources/plugins/scg/scgscene.cpp | 54 ++- sources/plugins/scg/scgscene.h | 2 + .../plugins/scg/scgtemplateobjectbuilder.cpp | 2 +- sources/plugins/scg/scgtextitem.cpp | 8 +- sources/plugins/scg/scgtextitem.h | 6 +- sources/plugins/scg/scgundoviewmodel.cpp | 3 +- sources/plugins/scg/scgview.cpp | 8 +- sources/plugins/scg/scgwindow.cpp | 35 +- sources/plugins/scn/media/icons/add.png | Bin 10217 -> 0 bytes sources/plugins/scn/scn.pro | 30 -- sources/plugins/scn/scn.qrc | 5 - sources/plugins/scn/scneditorscene.cpp | 382 ------------------ sources/plugins/scn/scneditorscene.h | 129 ------ sources/plugins/scn/scnfieldglobalidtf.cpp | 68 ---- sources/plugins/scn/scnfieldglobalidtf.h | 63 --- sources/plugins/scn/scnfielditem.cpp | 177 -------- sources/plugins/scn/scnfielditem.h | 129 ------ sources/plugins/scn/scninputdialog.cpp | 60 --- sources/plugins/scn/scninputdialog.h | 36 -- sources/plugins/scn/scnplugin.cpp | 66 --- sources/plugins/scn/scnplugin.h | 56 --- sources/plugins/scn/scnwindow.cpp | 152 ------- sources/plugins/scn/scnwindow.h | 100 ----- sources/plugins/scs/scs.pro | 4 + sources/plugins/scs/scserrortablewidget.cpp | 8 - .../plugins/scs/scsparser/scsasynchparser.cpp | 1 + sources/plugins/scs/scsplugin.cpp | 2 - sources/plugins/scs/scsplugin.h | 1 + sources/plugins/scs/scsplugin.json | 3 + sources/plugins/scs/scswindow.cpp | 1 - 66 files changed, 242 insertions(+), 1871 deletions(-) delete mode 100644 sources/kbe/ui_mainwindow.h create mode 100644 sources/plugins/scg/scgplugin.json delete mode 100644 sources/plugins/scn/media/icons/add.png delete mode 100644 sources/plugins/scn/scn.pro delete mode 100644 sources/plugins/scn/scn.qrc delete mode 100644 sources/plugins/scn/scneditorscene.cpp delete mode 100644 sources/plugins/scn/scneditorscene.h delete mode 100644 sources/plugins/scn/scnfieldglobalidtf.cpp delete mode 100644 sources/plugins/scn/scnfieldglobalidtf.h delete mode 100644 sources/plugins/scn/scnfielditem.cpp delete mode 100644 sources/plugins/scn/scnfielditem.h delete mode 100644 sources/plugins/scn/scninputdialog.cpp delete mode 100644 sources/plugins/scn/scninputdialog.h delete mode 100644 sources/plugins/scn/scnplugin.cpp delete mode 100644 sources/plugins/scn/scnplugin.h delete mode 100644 sources/plugins/scn/scnwindow.cpp delete mode 100644 sources/plugins/scn/scnwindow.h create mode 100644 sources/plugins/scs/scsplugin.json diff --git a/sources/kbe/interfaces/editorinterface.h b/sources/kbe/interfaces/editorinterface.h index 75bceb4..d44a301 100644 --- a/sources/kbe/interfaces/editorinterface.h +++ b/sources/kbe/interfaces/editorinterface.h @@ -119,13 +119,13 @@ class EditorInterface @brief Calls when window made active (selected in main window tab). @param window Pointer to main window */ - virtual void activate(QMainWindow *window) { mIsActivated = true; } + virtual void activate(QMainWindow *window) { Q_UNUSED(window); mIsActivated = true; } /*! Window deactivation. @brief Calls whne window made inactive (selected other window in main window tab) @param window Pointer to main window */ - virtual void deactivate(QMainWindow *window) { mIsActivated = false; } + virtual void deactivate(QMainWindow *window) { Q_UNUSED(window); mIsActivated = false; } /*! Check if window is activated */ @@ -177,10 +177,10 @@ class EditorFactoryInterface Q_DECLARE_INTERFACE(EditorInterface, - "com.OSTIS.kbe.EditorInterface/1.0") + "com.OSTIS.kbe.EditorInterface") Q_DECLARE_INTERFACE(EditorFactoryInterface, - "com.OSTIS.kbe.EditorFactoryInterface/1.0") + "com.OSTIS.kbe.EditorFactoryInterface") Q_DECLARE_INTERFACE(EditorObserverInterface, - "com.OSTIS.kbe.EditorObserverInterface/1.0") + "com.OSTIS.kbe.EditorObserverInterface") #endif // WINDOWINTERFACE_H diff --git a/sources/kbe/interfaces/plugininterface.h b/sources/kbe/interfaces/plugininterface.h index eb4c455..e3e0b2c 100644 --- a/sources/kbe/interfaces/plugininterface.h +++ b/sources/kbe/interfaces/plugininterface.h @@ -50,6 +50,6 @@ class PluginInterface }; Q_DECLARE_INTERFACE(PluginInterface, - "com.OSTIS.kbe.PluginInterface/1.0") + "com.OSTIS.kbe.PluginInterface") #endif // PLUGIN_H diff --git a/sources/kbe/kbe.pro b/sources/kbe/kbe.pro index 0d8b1a3..57b30bc 100644 --- a/sources/kbe/kbe.pro +++ b/sources/kbe/kbe.pro @@ -4,7 +4,7 @@ DESTDIR = ../bin -QT += xml +QT += xml widgets TEMPLATE = app diff --git a/sources/kbe/main.cpp b/sources/kbe/main.cpp index b41e8ee..10eae70 100644 --- a/sources/kbe/main.cpp +++ b/sources/kbe/main.cpp @@ -26,7 +26,7 @@ along with OSTIS. If not, see . #include "mainwindow.h" #include "guidedialog.h" -#include +#include #include #include #include diff --git a/sources/kbe/mainwindow.cpp b/sources/kbe/mainwindow.cpp index 32402d6..3f834e1 100644 --- a/sources/kbe/mainwindow.cpp +++ b/sources/kbe/mainwindow.cpp @@ -49,6 +49,7 @@ along with OSTIS. If not, see . #include #include #include +#include MainWindow* MainWindow::mInstance = 0; @@ -216,6 +217,8 @@ void MainWindow::createActions() void MainWindow::updateEvent(EditorInterface *editor, EditEvents event) { + Q_UNUSED(editor); + switch(event) { case ContentChanged: @@ -666,6 +669,7 @@ void MainWindow::changeEvent(QEvent *event) void MainWindow::showEvent(QShowEvent *event) { + Q_UNUSED(event); } void MainWindow::updateDockWidgets(bool visible) diff --git a/sources/kbe/mainwindow.ui b/sources/kbe/mainwindow.ui index d642efb..da902f4 100644 --- a/sources/kbe/mainwindow.ui +++ b/sources/kbe/mainwindow.ui @@ -20,7 +20,7 @@ 0 0 600 - 21 + 25 @@ -69,6 +69,7 @@ View + diff --git a/sources/kbe/projectmanagerview.cpp b/sources/kbe/projectmanagerview.cpp index 1bee6e2..e762984 100644 --- a/sources/kbe/projectmanagerview.cpp +++ b/sources/kbe/projectmanagerview.cpp @@ -60,6 +60,7 @@ ProjectManagerView::ProjectManagerView(QWidget *parent) void ProjectManagerView::onContextMenuRequested(QPoint mousePoint) { + Q_UNUSED(mousePoint); ProjectManagerModelItem* item = mModel->getItem(currentIndex()); createContextMenu(item); } @@ -348,17 +349,23 @@ void ProjectManagerView::onRemovePermanently() if (!currentIndex().isValid()) return; - if (ProjectManagerModelItem* item = mModel->getItem(currentIndex())) - switch (item->getItemType()) - { - case ProjectManagerModelItem::File: - if (QFile::remove(item->getAbsoluteFilePath())) - onRemove(); - break; - case ProjectManagerModelItem::Filter: - permanentRemoveTree(item); - emit event(ProjectChanged); - } + ProjectManagerModelItem* item = mModel->getItem(currentIndex()); + if (item == 0) + return; + + switch (item->getItemType()) + { + case ProjectManagerModelItem::File: + if (QFile::remove(item->getAbsoluteFilePath())) + onRemove(); + break; + case ProjectManagerModelItem::Filter: + permanentRemoveTree(item); + emit event(ProjectChanged); + + default: + break; + } } @@ -372,11 +379,16 @@ void ProjectManagerView::permanentRemoveTree(ProjectManagerModelItem *item) switch (item->getItemType()) { - case ProjectManagerModelItem::File: - QFile::remove(item->getAbsoluteFilePath()); + case ProjectManagerModelItem::File: + QFile::remove(item->getAbsoluteFilePath()); + break; - case ProjectManagerModelItem::Filter: - mModel->removeItem(item); + case ProjectManagerModelItem::Filter: + mModel->removeItem(item); + break; + + default: + break; } } @@ -666,7 +678,7 @@ void ProjectManagerView::onShowInExplorer() else return; - #ifdef defined(Q_OS_WIN) + #if defined(Q_OS_WIN) const QString explorer = "explorer"; QString param; if (!QFileInfo(pathIn).isDir()) @@ -686,22 +698,6 @@ void ProjectManagerView::onShowInExplorer() QProcess::execute("/usr/bin/osascript", scriptArgs); #endif -// Todo: opening file in filemanager for Linux -/*#else - const QFileInfo fileInfo(pathIn); - const QString folder = fileInfo.absoluteFilePath(); - const QString app = Utils::UnixUtils::fileBrowser(Core::ICore::instance()->settings()); - QProcess browserProc; - const QString browserArgs = Utils::UnixUtils::substituteFileBrowserParameters(app, folder); - if (debug) - qDebug() << browserArgs; - bool success = browserProc.startDetached(browserArgs); - const QString error = QString::fromLocal8Bit(browserProc.readAllStandardError()); - success = success && error.isEmpty(); - if (!success) - showGraphicalShellError(this, app, error); - #endif -*/ } @@ -709,6 +705,7 @@ void ProjectManagerView::onPropertiesShow() { if (!currentIndex().isValid()) return; + if (ProjectManagerModelItem* item = mModel->getItem(currentIndex())) { QStringList properties; diff --git a/sources/kbe/ui_mainwindow.h b/sources/kbe/ui_mainwindow.h deleted file mode 100644 index 987c5ba..0000000 --- a/sources/kbe/ui_mainwindow.h +++ /dev/null @@ -1,205 +0,0 @@ -/******************************************************************************** -** Form generated from reading UI file 'mainwindow.ui' -** -** Created: Thu 1. May 18:57:02 2014 -** by: Qt User Interface Compiler version 4.8.1 -** -** WARNING! All changes made in this file will be lost when recompiling UI file! -********************************************************************************/ - -#ifndef UI_MAINWINDOW_H -#define UI_MAINWINDOW_H - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -class Ui_MainWindow -{ -public: - QAction *actionNew; - QAction *actionOpen; - QAction *actionSave; - QAction *actionSave_as; - QAction *actionExit; - QAction *actionAbout; - QAction *actionImport; - QAction *actionTo_image; - QAction *actionAbout_Qt; - QAction *actionSave_all; - QAction *actionClose_All; - QAction *actionClose_Others; - QAction *actionClose; - QAction *actionFeedback; - QAction *actionGuide; - QAction *actionView_ProjectManager; - QAction *actionNew_Project; - QAction *actionOpen_Project; - QAction *actionSave_Project; - QAction *actionClose_Project; - QWidget *centralWidget; - QMenuBar *menuBar; - QMenu *menuFile; - QMenu *menuExport; - QMenu *menuHelp; - QMenu *menuView; - QStatusBar *statusBar; - - void setupUi(QMainWindow *MainWindow) - { - if (MainWindow->objectName().isEmpty()) - MainWindow->setObjectName(QString::fromUtf8("MainWindow")); - MainWindow->resize(600, 400); - actionNew = new QAction(MainWindow); - actionNew->setObjectName(QString::fromUtf8("actionNew")); - actionOpen = new QAction(MainWindow); - actionOpen->setObjectName(QString::fromUtf8("actionOpen")); - actionSave = new QAction(MainWindow); - actionSave->setObjectName(QString::fromUtf8("actionSave")); - actionSave_as = new QAction(MainWindow); - actionSave_as->setObjectName(QString::fromUtf8("actionSave_as")); - actionExit = new QAction(MainWindow); - actionExit->setObjectName(QString::fromUtf8("actionExit")); - actionAbout = new QAction(MainWindow); - actionAbout->setObjectName(QString::fromUtf8("actionAbout")); - actionImport = new QAction(MainWindow); - actionImport->setObjectName(QString::fromUtf8("actionImport")); - actionImport->setEnabled(false); - actionTo_image = new QAction(MainWindow); - actionTo_image->setObjectName(QString::fromUtf8("actionTo_image")); - actionAbout_Qt = new QAction(MainWindow); - actionAbout_Qt->setObjectName(QString::fromUtf8("actionAbout_Qt")); - actionSave_all = new QAction(MainWindow); - actionSave_all->setObjectName(QString::fromUtf8("actionSave_all")); - actionClose_All = new QAction(MainWindow); - actionClose_All->setObjectName(QString::fromUtf8("actionClose_All")); - actionClose_All->setShortcutContext(Qt::WindowShortcut); - actionClose_Others = new QAction(MainWindow); - actionClose_Others->setObjectName(QString::fromUtf8("actionClose_Others")); - actionClose = new QAction(MainWindow); - actionClose->setObjectName(QString::fromUtf8("actionClose")); - actionClose->setShortcutContext(Qt::WindowShortcut); - actionFeedback = new QAction(MainWindow); - actionFeedback->setObjectName(QString::fromUtf8("actionFeedback")); - actionGuide = new QAction(MainWindow); - actionGuide->setObjectName(QString::fromUtf8("actionGuide")); - actionGuide->setEnabled(false); - actionView_ProjectManager = new QAction(MainWindow); - actionView_ProjectManager->setObjectName(QString::fromUtf8("actionView_ProjectManager")); - actionNew_Project = new QAction(MainWindow); - actionNew_Project->setObjectName(QString::fromUtf8("actionNew_Project")); - actionOpen_Project = new QAction(MainWindow); - actionOpen_Project->setObjectName(QString::fromUtf8("actionOpen_Project")); - actionSave_Project = new QAction(MainWindow); - actionSave_Project->setObjectName(QString::fromUtf8("actionSave_Project")); - actionClose_Project = new QAction(MainWindow); - actionClose_Project->setObjectName(QString::fromUtf8("actionClose_Project")); - centralWidget = new QWidget(MainWindow); - centralWidget->setObjectName(QString::fromUtf8("centralWidget")); - MainWindow->setCentralWidget(centralWidget); - menuBar = new QMenuBar(MainWindow); - menuBar->setObjectName(QString::fromUtf8("menuBar")); - menuBar->setGeometry(QRect(0, 0, 600, 21)); - menuFile = new QMenu(menuBar); - menuFile->setObjectName(QString::fromUtf8("menuFile")); - menuExport = new QMenu(menuFile); - menuExport->setObjectName(QString::fromUtf8("menuExport")); - menuExport->setEnabled(false); - menuHelp = new QMenu(menuBar); - menuHelp->setObjectName(QString::fromUtf8("menuHelp")); - menuView = new QMenu(menuBar); - menuView->setObjectName(QString::fromUtf8("menuView")); - MainWindow->setMenuBar(menuBar); - statusBar = new QStatusBar(MainWindow); - statusBar->setObjectName(QString::fromUtf8("statusBar")); - MainWindow->setStatusBar(statusBar); - - menuBar->addAction(menuFile->menuAction()); - menuBar->addAction(menuView->menuAction()); - menuBar->addAction(menuHelp->menuAction()); - menuFile->addAction(actionNew); - menuFile->addAction(actionNew_Project); - menuFile->addAction(actionOpen); - menuFile->addAction(actionOpen_Project); - menuFile->addAction(actionSave); - menuFile->addAction(actionSave_as); - menuFile->addAction(actionSave_Project); - menuFile->addAction(actionSave_all); - menuFile->addSeparator(); - menuFile->addAction(menuExport->menuAction()); - menuFile->addAction(actionImport); - menuFile->addSeparator(); - menuFile->addAction(actionClose); - menuFile->addAction(actionClose_All); - menuFile->addAction(actionClose_Project); - menuFile->addAction(actionClose_Others); - menuFile->addSeparator(); - menuFile->addAction(actionExit); - menuExport->addAction(actionTo_image); - menuHelp->addAction(actionAbout); - menuHelp->addAction(actionAbout_Qt); - menuHelp->addAction(actionFeedback); - menuHelp->addAction(actionGuide); - menuView->addAction(actionView_ProjectManager); - - retranslateUi(MainWindow); - - QMetaObject::connectSlotsByName(MainWindow); - } // setupUi - - void retranslateUi(QMainWindow *MainWindow) - { - MainWindow->setWindowTitle(QApplication::translate("MainWindow", "MainWindow", 0, QApplication::UnicodeUTF8)); - actionNew->setText(QApplication::translate("MainWindow", "New", 0, QApplication::UnicodeUTF8)); - actionNew->setShortcut(QApplication::translate("MainWindow", "Ctrl+N", 0, QApplication::UnicodeUTF8)); - actionOpen->setText(QApplication::translate("MainWindow", "Open", 0, QApplication::UnicodeUTF8)); - actionOpen->setShortcut(QApplication::translate("MainWindow", "Ctrl+O", 0, QApplication::UnicodeUTF8)); - actionSave->setText(QApplication::translate("MainWindow", "Save", 0, QApplication::UnicodeUTF8)); - actionSave->setShortcut(QApplication::translate("MainWindow", "Ctrl+S", 0, QApplication::UnicodeUTF8)); - actionSave_as->setText(QApplication::translate("MainWindow", "Save as", 0, QApplication::UnicodeUTF8)); - actionSave_as->setShortcut(QString()); - actionExit->setText(QApplication::translate("MainWindow", "Exit", 0, QApplication::UnicodeUTF8)); - actionExit->setShortcut(QApplication::translate("MainWindow", "Ctrl+Q", 0, QApplication::UnicodeUTF8)); - actionAbout->setText(QApplication::translate("MainWindow", "About ...", 0, QApplication::UnicodeUTF8)); - actionAbout->setShortcut(QApplication::translate("MainWindow", "F1", 0, QApplication::UnicodeUTF8)); - actionImport->setText(QApplication::translate("MainWindow", "Import", 0, QApplication::UnicodeUTF8)); - actionTo_image->setText(QApplication::translate("MainWindow", "Image", 0, QApplication::UnicodeUTF8)); - actionAbout_Qt->setText(QApplication::translate("MainWindow", "About Qt ...", 0, QApplication::UnicodeUTF8)); - actionSave_all->setText(QApplication::translate("MainWindow", "Save all", 0, QApplication::UnicodeUTF8)); - actionSave_all->setShortcut(QApplication::translate("MainWindow", "Ctrl+Shift+S", 0, QApplication::UnicodeUTF8)); - actionClose_All->setText(QApplication::translate("MainWindow", "Close All", 0, QApplication::UnicodeUTF8)); - actionClose_All->setShortcut(QApplication::translate("MainWindow", "Ctrl+Shift+W", 0, QApplication::UnicodeUTF8)); - actionClose_Others->setText(QApplication::translate("MainWindow", "Close Others", 0, QApplication::UnicodeUTF8)); - actionClose->setText(QApplication::translate("MainWindow", "Close", 0, QApplication::UnicodeUTF8)); - actionClose->setShortcut(QApplication::translate("MainWindow", "Ctrl+W", 0, QApplication::UnicodeUTF8)); - actionFeedback->setText(QApplication::translate("MainWindow", "Feedback", 0, QApplication::UnicodeUTF8)); - actionGuide->setText(QApplication::translate("MainWindow", "Guide", 0, QApplication::UnicodeUTF8)); - actionView_ProjectManager->setText(QApplication::translate("MainWindow", "Project Manager", 0, QApplication::UnicodeUTF8)); - actionNew_Project->setText(QApplication::translate("MainWindow", "New Project", 0, QApplication::UnicodeUTF8)); - actionOpen_Project->setText(QApplication::translate("MainWindow", "Open Project", 0, QApplication::UnicodeUTF8)); - actionSave_Project->setText(QApplication::translate("MainWindow", "Save Project", 0, QApplication::UnicodeUTF8)); - actionClose_Project->setText(QApplication::translate("MainWindow", "Close Project", 0, QApplication::UnicodeUTF8)); - menuFile->setTitle(QApplication::translate("MainWindow", "File", 0, QApplication::UnicodeUTF8)); - menuExport->setTitle(QApplication::translate("MainWindow", "Export", 0, QApplication::UnicodeUTF8)); - menuHelp->setTitle(QApplication::translate("MainWindow", "Help", 0, QApplication::UnicodeUTF8)); - menuView->setTitle(QApplication::translate("MainWindow", "View", 0, QApplication::UnicodeUTF8)); - } // retranslateUi - -}; - -namespace Ui { - class MainWindow: public Ui_MainWindow {}; -} // namespace Ui - -QT_END_NAMESPACE - -#endif // UI_MAINWINDOW_H diff --git a/sources/plugins/scg/arrangers/scgarrangerenergybased.cpp b/sources/plugins/scg/arrangers/scgarrangerenergybased.cpp index b417018..2755d4d 100644 --- a/sources/plugins/scg/arrangers/scgarrangerenergybased.cpp +++ b/sources/plugins/scg/arrangers/scgarrangerenergybased.cpp @@ -13,15 +13,15 @@ #include #include -//------------------------------------------------------------------------------ + SCgEnergyBasedArranger::SCgEnergyBasedArranger(QObject *parent) - : SCgArranger(parent) - , mDialog(0) - , mSpringRate(1) - , mSpringLength(100) - , mRepulsionFactor(10000) - , mFakeRepulsionFactor(500) - , mShiftFactor(0.3) + : SCgArranger(parent) + , mDialog(0) + , mSpringRate(1) + , mSpringLength(100) + , mRepulsionFactor(10000) + , mFakeRepulsionFactor(500) + , mShiftFactor(0.3) { mNodes.clear(); mTimerId = 0; @@ -162,8 +162,7 @@ void SCgEnergyBasedArranger::timerEvent(QTimerEvent *event) Parameters parameters(mSpringRateSpinBox->value(), mSpringLengthSpinBox->value(), mRepulsionFactorSpinBox->value(), mFakeRepulsionFactorSpinBox->value()); - QFuture future = QtConcurrent::mapped(mNodes, SCgForceCalculator(mNodes, - mPairs, mBusses, parameters)); + QFuture future = QtConcurrent::mapped(mNodes, SCgForceCalculator(mNodes, mPairs, mBusses, parameters)); mFutureWatcher.setFuture(future); } //------------------------------------------------------------------------------ diff --git a/sources/plugins/scg/commands/scgcommandremovebreakpoints.cpp b/sources/plugins/scg/commands/scgcommandremovebreakpoints.cpp index 6a588fb..2642ed8 100644 --- a/sources/plugins/scg/commands/scgcommandremovebreakpoints.cpp +++ b/sources/plugins/scg/commands/scgcommandremovebreakpoints.cpp @@ -25,13 +25,11 @@ along with OSTIS. If not, see . #include "scgcommandremovebreakpoints.h" -SCgCommandRemoveBreakPoints::SCgCommandRemoveBreakPoints(SCgScene *scene, - SCgPair *pair, - QUndoCommand *parent) +SCgCommandRemoveBreakPoints::SCgCommandRemoveBreakPoints(SCgScene *scene, SCgPair *pair, QUndoCommand *parent) : SCgBaseCommand(scene, pair, parent) - , mOldPoints(pair->scenePoints()) , mOldBeginDot(pair->beginDot()) , mOldEndDot(pair->endDot()) + , mOldPoints(pair->scenePoints()) { setText(QObject::tr("Remove pair's break points")); } diff --git a/sources/plugins/scg/commands/scgcommandremovebreakpoints.h b/sources/plugins/scg/commands/scgcommandremovebreakpoints.h index 068f242..1e6d423 100644 --- a/sources/plugins/scg/commands/scgcommandremovebreakpoints.h +++ b/sources/plugins/scg/commands/scgcommandremovebreakpoints.h @@ -44,8 +44,8 @@ class SCgCommandRemoveBreakPoints : public SCgBaseCommand void undo(); private: - double mOldEndDot; double mOldBeginDot; + double mOldEndDot; QVector mOldPoints; }; diff --git a/sources/plugins/scg/gwf/gwffileloader.h b/sources/plugins/scg/gwf/gwffileloader.h index eae6799..5dcc0af 100644 --- a/sources/plugins/scg/gwf/gwffileloader.h +++ b/sources/plugins/scg/gwf/gwffileloader.h @@ -28,6 +28,7 @@ along with OSTIS. If not, see . #include #include #include +#include class SCgScene; class SCgObject; diff --git a/sources/plugins/scg/modes/scginsertmode.cpp b/sources/plugins/scg/modes/scginsertmode.cpp index bf9927a..41302c9 100644 --- a/sources/plugins/scg/modes/scginsertmode.cpp +++ b/sources/plugins/scg/modes/scginsertmode.cpp @@ -25,10 +25,12 @@ along with OSTIS. If not, see . #include "gwf/gwfobjectinforeader.h" #include "scgtemplateobjectbuilder.h" #include "scgwindow.h" + #include #include #include #include +#include SCgInsertMode::SCgInsertMode(SCgScene* parent): SCgMode(parent), @@ -94,7 +96,7 @@ void SCgInsertMode::activate() } const QMimeData* data = QApplication::clipboard()->mimeData(); - if(data->hasFormat(SCgWindow::SupportedPasteMimeType)) + if (data->hasFormat(SCgWindow::SupportedPasteMimeType)) { QDomDocument document; @@ -103,7 +105,7 @@ void SCgInsertMode::activate() // Read document GwfObjectInfoReader reader; - if (! reader.read(document)) + if (!reader.read(document)) return; //Place objects to scene @@ -113,8 +115,10 @@ void SCgInsertMode::activate() QList list = objectBuilder.objects(); QList withoutChilds; foreach(SCgObject* obj, list) + { if (!obj->parentItem()) withoutChilds.append(obj); + } if(!withoutChilds.empty()) { @@ -126,7 +130,8 @@ void SCgInsertMode::activate() mInsertedObjectGroup->setOpacity(0.5); } } - else mScene->setEditMode(mScene->previousMode()); + else + mScene->setEditMode(mScene->previousMode()); } diff --git a/sources/plugins/scg/modes/scgmode.cpp b/sources/plugins/scg/modes/scgmode.cpp index 4ce1f28..583241c 100644 --- a/sources/plugins/scg/modes/scgmode.cpp +++ b/sources/plugins/scg/modes/scgmode.cpp @@ -82,7 +82,7 @@ void SCgMode::mousePress(QGraphicsSceneMouseEvent* event) void SCgMode::mouseDoubleClick(QGraphicsSceneMouseEvent *event) { - + Q_UNUSED(event); } QPointF SCgMode::degreeAlign(const QLineF& l) @@ -124,7 +124,7 @@ void SCgMode::mouseMove(QGraphicsSceneMouseEvent *event) void SCgMode::mouseRelease(QGraphicsSceneMouseEvent *event) { - + Q_UNUSED(event); } void SCgMode::startLineCreation(const QPointF &point) @@ -342,5 +342,5 @@ void SCgMode::keyPress(QKeyEvent *event) void SCgMode::keyRelease(QKeyEvent *event) { - + Q_UNUSED(event); } diff --git a/sources/plugins/scg/scg.pro b/sources/plugins/scg/scg.pro index 528d715..794441e 100644 --- a/sources/plugins/scg/scg.pro +++ b/sources/plugins/scg/scg.pro @@ -1,4 +1,4 @@ -QT += xml +QT += xml widgets concurrent TARGET = $$qtLibraryTarget(scg) TEMPLATE = lib @@ -182,3 +182,6 @@ lrelease.output = ${QMAKE_FILE_IN_PATH}/${QMAKE_FILE_IN_BASE}.qm lrelease.commands = $$[QT_INSTALL_BINS]/lrelease ${QMAKE_FILE_IN} -qm ${QMAKE_FILE_IN_PATH}/${QMAKE_FILE_IN_BASE}.qm lrelease.CONFIG += no_link target_predeps QMAKE_EXTRA_COMPILERS += lrelease + +OTHER_FILES += \ + scgplugin.json diff --git a/sources/plugins/scg/scgabstractobjectbuilder.cpp b/sources/plugins/scg/scgabstractobjectbuilder.cpp index a1a1452..c40b921 100644 --- a/sources/plugins/scg/scgabstractobjectbuilder.cpp +++ b/sources/plugins/scg/scgabstractobjectbuilder.cpp @@ -23,7 +23,7 @@ along with OSTIS. If not, see . #include "scgabstractobjectbuilder.h" -AbstractSCgObjectBuilder::AbstractSCgObjectBuilder(QGraphicsScene* scene) +AbstractSCgObjectBuilder::AbstractSCgObjectBuilder() { } diff --git a/sources/plugins/scg/scgabstractobjectbuilder.h b/sources/plugins/scg/scgabstractobjectbuilder.h index 2d6dd3f..f7148bc 100644 --- a/sources/plugins/scg/scgabstractobjectbuilder.h +++ b/sources/plugins/scg/scgabstractobjectbuilder.h @@ -37,7 +37,7 @@ class AbstractSCgObjectBuilder { public: //! NOTE: @param scene is not used in this context. - AbstractSCgObjectBuilder(QGraphicsScene* scene); + AbstractSCgObjectBuilder(); virtual ~AbstractSCgObjectBuilder(); typedef QList ObjectInfoList; diff --git a/sources/plugins/scg/scgbus.cpp b/sources/plugins/scg/scgbus.cpp index 5c7c5b8..2fabc64 100644 --- a/sources/plugins/scg/scgbus.cpp +++ b/sources/plugins/scg/scgbus.cpp @@ -125,7 +125,9 @@ void SCgBus::updateShape() void SCgBus::objectDelete(SCgObject *object) { - if (mOwner) mOwner->setBus(0); + Q_UNUSED(object); + if (mOwner) + mOwner->setBus(0); } void SCgBus::del(QList &delList) @@ -144,6 +146,7 @@ void SCgBus::undel(SCgScene *scene) QPointF SCgBus::cross(const QPointF &from, float dot) const { + Q_UNUSED(from); // get sector num int s = (int)dot; // get relative pos in sector @@ -152,8 +155,10 @@ QPointF SCgBus::cross(const QPointF &from, float dot) const Q_ASSERT(mPoints.size() > 1); // calculating position - if (s >= mPoints.size() - 1) s = mPoints.size() - 2; - if (s < 0) s = 0; + if (s >= mPoints.size() - 1) + s = mPoints.size() - 2; + if (s < 0) + s = 0; return mapToScene(mPoints[s] + (mPoints[s+1] - mPoints[s]) * ds); } @@ -219,6 +224,7 @@ bool SCgBus::isAcceptable(SCgObject* obj, SCgPointObject::IncidentRole role) con void SCgBus::changeIncidentObject(SCgObject* obj, const QPointF& point, SCgPointObject::IncidentRole role) { + Q_UNUSED(point); if (isAcceptable(obj, role)) setOwner(static_cast(obj)); } diff --git a/sources/plugins/scg/scgcontour.cpp b/sources/plugins/scg/scgcontour.cpp index c9152d0..e6b6eb6 100644 --- a/sources/plugins/scg/scgcontour.cpp +++ b/sources/plugins/scg/scgcontour.cpp @@ -106,7 +106,9 @@ void SCgContour::minimize() SCgPointObject::PointFVector SCgContour::minimizedPoints() const { - // Collect items which is a scgObject: + PointFVector newPoints; + + // Collect items which is a scgObject QSet scgObjects; foreach(QGraphicsItem* item, childItems()) { @@ -131,25 +133,22 @@ SCgPointObject::PointFVector SCgContour::minimizedPoints() const maxX = firstObj->mapToScene(firstObjRect.bottomRight()).x(); maxY = firstObj->mapToScene(firstObjRect.bottomRight()).y(); - for (++it; it != scgObjects.end(); ++it) { + for (++it; it != scgObjects.end(); ++it) + { SCgObject *obj = *it; QRectF objRect = obj->boundingRect(); QPointF topLeft = obj->mapToScene(objRect.topLeft()); QPointF bottomRight = obj->mapToScene(objRect.bottomRight()); - if (topLeft.x() < minX) { + if (topLeft.x() < minX) minX = topLeft.x(); - } - if (topLeft.y() < minY) { + if (topLeft.y() < minY) minY = topLeft.y(); - } - if (bottomRight.x() > maxX) { + if (bottomRight.x() > maxX) maxX = bottomRight.x(); - } - if (bottomRight.y() > maxY) { + if (bottomRight.y() > maxY) maxY = bottomRight.y(); - } } // Increase distance from borders: @@ -159,12 +158,11 @@ SCgPointObject::PointFVector SCgContour::minimizedPoints() const maxY += borderDistance; // Remove all points and set only 4 corner points: - PointFVector newPoints; newPoints << QPointF(minX, minY) << QPointF(maxX, minY) << QPointF(maxX, maxY) << QPointF(minX, maxY); - - return newPoints; } + + return newPoints; } void SCgContour::updateShape() @@ -241,7 +239,7 @@ void SCgContour::updateConnected() void SCgContour::objectDelete(SCgObject *object) { - + Q_UNUSED(object); } void SCgContour::del(QList &delList) @@ -260,6 +258,8 @@ void SCgContour::del(QList &delList) QPointF SCgContour::cross(const QPointF &from, float dot) const { + Q_UNUSED(dot); + QRectF bound = QPolygonF(mPoints).boundingRect(); QPointF p(bound.center()); @@ -294,7 +294,7 @@ QPointF SCgContour::cross(const QPointF &from, float dot) const float SCgContour::dotPos(const QPointF &point) const { - // we doesn't need dot position for contour + Q_UNUSED(point); return 0.f; } diff --git a/sources/plugins/scg/scgdefaultobjectbuilder.cpp b/sources/plugins/scg/scgdefaultobjectbuilder.cpp index d2a1e7f..bd1652c 100644 --- a/sources/plugins/scg/scgdefaultobjectbuilder.cpp +++ b/sources/plugins/scg/scgdefaultobjectbuilder.cpp @@ -30,8 +30,9 @@ along with OSTIS. If not, see . #include "scgcontour.h" #include "scgpair.h" -DefaultSCgObjectBuilder::DefaultSCgObjectBuilder(QGraphicsScene* scene):AbstractSCgObjectBuilder(scene), - mScene(scene) +DefaultSCgObjectBuilder::DefaultSCgObjectBuilder(QGraphicsScene* scene) + : AbstractSCgObjectBuilder() + , mScene(scene) { } diff --git a/sources/plugins/scg/scgfilewriterimage.cpp b/sources/plugins/scg/scgfilewriterimage.cpp index b11d860..54ed981 100644 --- a/sources/plugins/scg/scgfilewriterimage.cpp +++ b/sources/plugins/scg/scgfilewriterimage.cpp @@ -39,32 +39,18 @@ bool SCgFileWriterImage::save(QString file_name, QObject *input) SCgScene *scene = qobject_cast(input); QSize sz = scene->itemsBoundingRect().size().toSize(); - QRect rect = scene->itemsBoundingRect().toRect(); QString isSVG = file_name.mid(file_name.length()-3); - /* if(isSVG=="svg"){ - QSvgGenerator generator; - generator.setFileName(file_name); - generator.setSize(sz); - generator.setViewBox(rect); - //generator.setTitle(tr("SVG image for GWF")); - generator.setDescription(tr("An SVG drawing created by Knowledge base Editor.")); - QPainter painter(&generator); - painter.setRenderHint(QPainter::Antialiasing,true); - scene->render(&painter,QRect(QPoint(0,0), sz),scene->itemsBoundingRect()); - return true; - } - else*/{ - QImage img(sz,QImage::Format_ARGB32_Premultiplied); - if (!img.isNull()) - { - QPainter painter(&img); - painter.setRenderHint(QPainter::Antialiasing, true); - painter.eraseRect(QRect(QPoint(0,0),sz)); - scene->renderToImage(&painter, QRect(QPoint(0,0), sz), scene->itemsBoundingRect()); - return img.save(file_name); - } + QImage img(sz,QImage::Format_ARGB32_Premultiplied); + if (!img.isNull()) + { + QPainter painter(&img); + painter.setRenderHint(QPainter::Antialiasing, true); + painter.eraseRect(QRect(QPoint(0,0),sz)); + scene->renderToImage(&painter, QRect(QPoint(0,0), sz), scene->itemsBoundingRect()); + return img.save(file_name); } + return false; } diff --git a/sources/plugins/scg/scgfindwidget.cpp b/sources/plugins/scg/scgfindwidget.cpp index 361a893..59add50 100644 --- a/sources/plugins/scg/scgfindwidget.cpp +++ b/sources/plugins/scg/scgfindwidget.cpp @@ -130,20 +130,12 @@ void SCgFindWidget::setTextWrappedVisible(bool visible) void SCgFindWidget::hideEvent(QHideEvent* event) { -// if (!event->spontaneous()) -// qApp->setPalette(mAppPalette); + Q_UNUSED(event); } void SCgFindWidget::showEvent(QShowEvent* event) { -// if (!event->spontaneous()) { -// QPalette p = mAppPalette; -// p.setColor(QPalette::Inactive, QPalette::Highlight, -// p.color(QPalette::Active, QPalette::Highlight)); -// p.setColor(QPalette::Inactive, QPalette::HighlightedText, -// p.color(QPalette::Active, QPalette::HighlightedText)); -// qApp->setPalette(p); -// } + Q_UNUSED(event); } void SCgFindWidget::updateButtons() @@ -155,6 +147,7 @@ void SCgFindWidget::updateButtons() void SCgFindWidget::caseSensitivityChanged(int val) { + Q_UNUSED(val); emit find(mFindLine->text()); } diff --git a/sources/plugins/scg/scgminimap.cpp b/sources/plugins/scg/scgminimap.cpp index 3c7759c..a156dfc 100644 --- a/sources/plugins/scg/scgminimap.cpp +++ b/sources/plugins/scg/scgminimap.cpp @@ -85,6 +85,8 @@ bool SCgMinimap::eventFilter(QObject* watched, QEvent* event) void SCgMinimap::updateViewedArea(int val) { + Q_UNUSED(val); + QPointF topLeft = mapFromScene(mView->mapToScene(0,0)); QPointF bottomRight = mapFromScene(mView->mapToScene(mView->viewport()->width(),mView->viewport()->height())); QRectF sceneR = mView->sceneRect(); @@ -126,5 +128,6 @@ void SCgMinimap::sceneRectChanged(const QRectF &rect) void SCgMinimap::drawBackground ( QPainter * painter, const QRectF & rect ) { + Q_UNUSED(rect); painter->drawRect(mView->sceneRect()); } diff --git a/sources/plugins/scg/scgnode.cpp b/sources/plugins/scg/scgnode.cpp index cbac6ee..c80b0ab 100644 --- a/sources/plugins/scg/scgnode.cpp +++ b/sources/plugins/scg/scgnode.cpp @@ -36,8 +36,8 @@ along with OSTIS. If not, see . #define DEFAULT_IDTF_POS BottomRight -SCgNode::SCgNode(QGraphicsItem *parent, QGraphicsScene *scene) : - SCgObject(parent, scene), +SCgNode::SCgNode(QGraphicsItem *parent) : + SCgObject(parent), SCgContent(), mStructType(SCgAlphabet::StructUnknown), mIsContentVisible(false), @@ -155,7 +155,9 @@ void SCgNode::positionChanged() void SCgNode::objectDelete(SCgObject *object) { - if (mBus) mBus->setOwner(0); + Q_UNUSED(object); + if (mBus) + mBus->setOwner(0); } void SCgNode::del(QList &delList) @@ -181,6 +183,8 @@ void SCgNode::undel(SCgScene* scene) QPointF SCgNode::cross(const QPointF &from, float dot) const { + Q_UNUSED(dot); + QPointF p(0.f, 0.f); if (!mIsContentVisible) @@ -218,6 +222,7 @@ QPointF SCgNode::cross(const QPointF &from, float dot) const float SCgNode::dotPos(const QPointF &point) const { + Q_UNUSED(point); return 0.f; } diff --git a/sources/plugins/scg/scgnode.h b/sources/plugins/scg/scgnode.h index da72f47..46fd064 100644 --- a/sources/plugins/scg/scgnode.h +++ b/sources/plugins/scg/scgnode.h @@ -49,7 +49,7 @@ friend class SCgBus; */ int type() const { return Type; } - explicit SCgNode(QGraphicsItem *parent = 0, QGraphicsScene *scene = 0); + explicit SCgNode(QGraphicsItem *parent = 0); void setIdtfValue(const QString &idtf); diff --git a/sources/plugins/scg/scgnodetextitem.cpp b/sources/plugins/scg/scgnodetextitem.cpp index f19758e..8f80737 100644 --- a/sources/plugins/scg/scgnodetextitem.cpp +++ b/sources/plugins/scg/scgnodetextitem.cpp @@ -24,8 +24,8 @@ along with OSTIS. If not, see . #include "scgnodetextitem.h" -SCgNodeTextItem::SCgNodeTextItem(const QString &str, SCgNode* parent, SCgNode::IdentifierPosition idtfPos, QGraphicsScene* scene ) - : SCgTextItem(str,(QGraphicsItem*)parent,scene) +SCgNodeTextItem::SCgNodeTextItem(const QString &str, SCgNode* parent, SCgNode::IdentifierPosition idtfPos) + : SCgTextItem(str,(QGraphicsItem*)parent) , mTextPos(idtfPos) { Q_CHECK_PTR(parent); @@ -34,8 +34,8 @@ SCgNodeTextItem::SCgNodeTextItem(const QString &str, SCgNode* parent, SCgNode::I } -SCgNodeTextItem::SCgNodeTextItem(SCgNode *parent, SCgNode::IdentifierPosition idtfPos, QGraphicsScene *scene) - : SCgTextItem((QGraphicsItem*)parent, scene) +SCgNodeTextItem::SCgNodeTextItem(SCgNode *parent, SCgNode::IdentifierPosition idtfPos) + : SCgTextItem((QGraphicsItem*)parent) , mTextPos(idtfPos) { Q_CHECK_PTR(parent); diff --git a/sources/plugins/scg/scgnodetextitem.h b/sources/plugins/scg/scgnodetextitem.h index ee066f6..f321940 100644 --- a/sources/plugins/scg/scgnodetextitem.h +++ b/sources/plugins/scg/scgnodetextitem.h @@ -38,8 +38,8 @@ class SCgNodeTextItem : public SCgTextItem //! Object type enum { Type = UserType + 9 }; - explicit SCgNodeTextItem(const QString &str, SCgNode* parent, SCgNode::IdentifierPosition idtfPos = SCgNode::BottomRight, QGraphicsScene* scene = 0); - explicit SCgNodeTextItem(SCgNode* parent, SCgNode::IdentifierPosition idtfPos = SCgNode::BottomRight, QGraphicsScene* scene = 0); + explicit SCgNodeTextItem(const QString &str, SCgNode* parent, SCgNode::IdentifierPosition idtfPos = SCgNode::BottomRight); + explicit SCgNodeTextItem(SCgNode* parent, SCgNode::IdentifierPosition idtfPos = SCgNode::BottomRight); virtual ~SCgNodeTextItem(); //! Return a type of graphics item as integer diff --git a/sources/plugins/scg/scgobject.cpp b/sources/plugins/scg/scgobject.cpp index 88c218f..4b18613 100644 --- a/sources/plugins/scg/scgobject.cpp +++ b/sources/plugins/scg/scgobject.cpp @@ -37,13 +37,13 @@ along with OSTIS. If not, see . #include #include -SCgObject::SCgObject(QGraphicsItem *parent, QGraphicsScene *scene) : - QGraphicsItem(parent, scene), - mConstType(SCgAlphabet::ConstUnknown), - mIsBoundingBoxVisible(false), - mTextItem(0), - mIsDead(false), - mParentChanging(false) +SCgObject::SCgObject(QGraphicsItem *parent) + : QGraphicsItem(parent) + , mConstType(SCgAlphabet::ConstUnknown) + , mIsBoundingBoxVisible(false) + , mTextItem(0) + , mIsDead(false) + , mParentChanging(false) { mColor = scg_cfg_get_value_color(scg_key_element_color_normal); @@ -75,6 +75,8 @@ bool SCgObject::isSCgPointObjectType(int type) void SCgObject::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { + Q_UNUSED(widget); + Q_UNUSED(option); if (mIsBoundingBoxVisible) { QPen pen(QBrush(Qt::red, Qt::SolidPattern), 1.f, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin); diff --git a/sources/plugins/scg/scgobject.h b/sources/plugins/scg/scgobject.h index 0c83c1d..796dd6f 100644 --- a/sources/plugins/scg/scgobject.h +++ b/sources/plugins/scg/scgobject.h @@ -40,7 +40,7 @@ Q_INTERFACES(QGraphicsItem) enum { Type = UserType + 1 }; virtual int type() const = 0; - explicit SCgObject(QGraphicsItem *parent = 0, QGraphicsScene *scene = 0); + explicit SCgObject(QGraphicsItem *parent = 0); virtual ~SCgObject(); //! Check if type is an scg-object type diff --git a/sources/plugins/scg/scgpair.cpp b/sources/plugins/scg/scgpair.cpp index 94cbecd..3c504aa 100644 --- a/sources/plugins/scg/scgpair.cpp +++ b/sources/plugins/scg/scgpair.cpp @@ -174,6 +174,8 @@ QVariant SCgPair::itemChange(GraphicsItemChange change, const QVariant &value) QPointF SCgPair::cross(const QPointF &from, float dot) const { + Q_UNUSED(from); + // get sector num int s = (int)dot; // get relative pos in sector @@ -182,8 +184,10 @@ QPointF SCgPair::cross(const QPointF &from, float dot) const Q_ASSERT(mPoints.size() > 1); // calculating position - if (s >= mPoints.size() - 1) s = mPoints.size() - 2; - if (s < 0) s = 0; + if (s >= mPoints.size() - 1) + s = mPoints.size() - 2; + if (s < 0) + s = 0; return mapToScene(mPoints[s] + (mPoints[s+1] - mPoints[s]) * ds); } diff --git a/sources/plugins/scg/scgplugin.cpp b/sources/plugins/scg/scgplugin.cpp index 881c6f9..791578f 100644 --- a/sources/plugins/scg/scgplugin.cpp +++ b/sources/plugins/scg/scgplugin.cpp @@ -39,14 +39,12 @@ along with OSTIS. If not, see . #include #include -Q_EXPORT_PLUGIN2(scg, SCgPlugin) - -SCgPlugin::SCgPlugin(QObject *parent) : - QObject(parent), - mTranslator(0) +SCgPlugin::SCgPlugin(QObject *parent) + : QObject(parent) + , mTranslator(0) { mTranslator = new QTranslator(this); - bool res = mTranslator->load(":/scg/media/translations/scg_" + QLocale::system().name() + ".qm"); + mTranslator->load(":/scg/media/translations/scg_" + QLocale::system().name() + ".qm"); } SCgPlugin::~SCgPlugin() diff --git a/sources/plugins/scg/scgplugin.h b/sources/plugins/scg/scgplugin.h index 64acff7..2c54417 100644 --- a/sources/plugins/scg/scgplugin.h +++ b/sources/plugins/scg/scgplugin.h @@ -33,6 +33,7 @@ class SCgPlugin : public QObject, { Q_OBJECT Q_INTERFACES(PluginInterface) + Q_PLUGIN_METADATA(IID "com.OSTIS.kbe.PluginInterface" FILE "scgplugin.json") public: explicit SCgPlugin(QObject *parent = 0); diff --git a/sources/plugins/scg/scgplugin.json b/sources/plugins/scg/scgplugin.json new file mode 100644 index 0000000..1f08067 --- /dev/null +++ b/sources/plugins/scg/scgplugin.json @@ -0,0 +1,3 @@ +{ + "Version": [0, 2, 0] +} diff --git a/sources/plugins/scg/scgpointgraphicsitem.cpp b/sources/plugins/scg/scgpointgraphicsitem.cpp index d4c3e59..57f87cf 100644 --- a/sources/plugins/scg/scgpointgraphicsitem.cpp +++ b/sources/plugins/scg/scgpointgraphicsitem.cpp @@ -50,6 +50,8 @@ QPainterPath SCgPointGraphicsItem::shape() const void SCgPointGraphicsItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { + Q_UNUSED(widget); + Q_UNUSED(option); painter->setBrush(QBrush(mColor)); painter->drawPath(mShape); } diff --git a/sources/plugins/scg/scgpointobject.cpp b/sources/plugins/scg/scgpointobject.cpp index 71fc7f7..21613b1 100644 --- a/sources/plugins/scg/scgpointobject.cpp +++ b/sources/plugins/scg/scgpointobject.cpp @@ -26,8 +26,8 @@ along with OSTIS. If not, see . #include //////////////////////////////////////////////////////////////////////////////////////////////////// -SCgPointObject::SCgPointObject(QGraphicsItem *parent, QGraphicsScene *scene) : - SCgObject(parent, scene) +SCgPointObject::SCgPointObject(QGraphicsItem *parent) + : SCgObject(parent) { } @@ -87,20 +87,20 @@ void SCgPointObject::changePointPosition(int pointIndex, const QPointF& newPos) void SCgPointObject::setPoints(const PointFVector &points) { - if(points.size() < 2) + if (points.size() < 2) return; mPoints = points; - for (quint32 idx = 0; idx < mPoints.size(); idx++) + for (int idx = 0; idx < mPoints.size(); ++idx) mPoints[idx] = mapFromScene(mPoints[idx]); - ////////////////////////////////////////////////// + // update points if they're displayed if(!mPointItems.empty()) { destroyPointObjects(); createPointObjects(); } - /////////////////////////////////////////////////// + positionChanged(); } @@ -175,6 +175,9 @@ bool SCgPointObject::isAcceptable(SCgObject *obj, SCgPointObject::IncidentRole r void SCgPointObject::changeIncidentObject(SCgObject *obj, const QPointF &point, SCgPointObject::IncidentRole role) { + Q_UNUSED(point); + Q_UNUSED(obj); + Q_UNUSED(role); Q_ASSERT_X(obj != 0, "void SCgPointObject::changeIncidentObject(SCgObject *obj, const QPointF &point, SCgPointObject::IncidentRole role)", "obj is null"); diff --git a/sources/plugins/scg/scgpointobject.h b/sources/plugins/scg/scgpointobject.h index 83f09da..d27a766 100644 --- a/sources/plugins/scg/scgpointobject.h +++ b/sources/plugins/scg/scgpointobject.h @@ -39,7 +39,7 @@ class SCgPointObject : public SCgObject }; virtual int type() const = 0; - explicit SCgPointObject(QGraphicsItem *parent = 0, QGraphicsScene *scene = 0); + explicit SCgPointObject(QGraphicsItem *parent = 0); virtual ~SCgPointObject(); typedef QVector PointFVector; diff --git a/sources/plugins/scg/scgscene.cpp b/sources/plugins/scg/scgscene.cpp index fd3df93..9c41704 100644 --- a/sources/plugins/scg/scgscene.cpp +++ b/sources/plugins/scg/scgscene.cpp @@ -72,6 +72,7 @@ along with OSTIS. If not, see . #include #include #include +#include SCgScene::SCgScene(QUndoStack *undoStack, QObject *parent) : QGraphicsScene(parent), @@ -91,9 +92,6 @@ SCgScene::SCgScene(QUndoStack *undoStack, QObject *parent) : mSceneModes[Mode_Clone] = new SCgCloneMode(this); setEditMode(Mode_Select); - // grid foreground - //setBackgroundBrush(QBrush(QColor(204, 255, 204, 164), Qt::CrossPattern)); - // connect(this, SIGNAL(selectionChanged()), this, SLOT(ensureSelectedItemVisible())); } SCgScene::~SCgScene() @@ -816,6 +814,7 @@ bool topToBottomleftToRightSortingPredicate(SCgObject* it1, SCgObject* it2) return isAbove || (isLeft && haveSameY); } + SCgObject* SCgScene::find(const QString &ttf, FindFlags flg) { if(ttf.isEmpty()) @@ -830,7 +829,7 @@ SCgObject* SCgScene::find(const QString &ttf, FindFlags flg) } if(list.isEmpty()) - return false; + return 0; //for providing the same order in different calls of this function //we sort itemList by scene positions of items. @@ -838,7 +837,7 @@ SCgObject* SCgScene::find(const QString &ttf, FindFlags flg) QList::const_iterator beginIt = list.begin(); //Finds item (rather iterator), that lies closer to mCursor. From this position find process begins. - while( true ) + while (true) { SCgObject *curr = *beginIt; bool isRight = curr->sceneBoundingRect().x() >= mCursor.x(); @@ -864,7 +863,8 @@ SCgObject* SCgScene::find(const QString &ttf, FindFlags flg) else return 0; } - }else if (flg & FindForward) + } + else if (flg & FindForward) return 0; else --beginIt; @@ -875,20 +875,19 @@ SCgObject* SCgScene::find(const QString &ttf, FindFlags flg) QList::const_iterator it = beginIt; while(true) { - if( (*it)->idtfValue().startsWith(ttf, flg & CaseSensitive - ? Qt::CaseSensitive - : Qt::CaseInsensitive) ) + if( (*it)->idtfValue().startsWith(ttf, ((flg & CaseSensitive) ? Qt::CaseSensitive : Qt::CaseInsensitive))) { result = *it; break; } - if(flg & FindForward) + if (flg & FindForward) { ++it; if(it == list.end()) break; - }else + } + else { if(it == list.begin()) break; @@ -899,22 +898,29 @@ SCgObject* SCgScene::find(const QString &ttf, FindFlags flg) return result; } -void SCgScene::dropEvent(QGraphicsSceneDragDropEvent *event) { +void SCgScene::dropEvent(QGraphicsSceneDragDropEvent *event) +{ // get only the first file QString fileName = event->mimeData()->urls().at(0).toLocalFile(); QString ext = fileName.mid(fileName.lastIndexOf(".") + 1); QMap ext2MIME = SCgContentFactory::registeredExtentions2MIME(); QList list = ext2MIME.keys(); - if (list.contains(ext)) { + if (list.contains(ext)) + { QGraphicsItem *item = itemAt(event->scenePos()); SCgContour *parentContour = 0; SCgNode *node = 0; // check if we have a contour object under cursor - if (!item) createNodeCommand(event->scenePos(), 0); - else if (item->type() == SCgContour::Type) { + if (!item) + { + createNodeCommand(event->scenePos(), 0); + } + else if (item->type() == SCgContour::Type) + { parentContour = dynamic_cast(item); createNodeCommand(event->scenePos(), parentContour); } + item = itemAt(event->scenePos()); // check item we have a proxy widget under cursor if (item->type() == QGraphicsProxyWidget::Type) item = item->parentItem(); @@ -922,12 +928,11 @@ void SCgScene::dropEvent(QGraphicsSceneDragDropEvent *event) { QString MIMEType = ext2MIME.value(ext).first; SCgContent::ContType cType = ext2MIME.value(ext).second; QFile file(fileName); - if (file.open(QFile::ReadOnly)) { + if (file.open(QFile::ReadOnly)) changeContentDataCommand(node, SCgContent::ContInfo(QVariant(file.readAll()), MIMEType, fileName, cType)); - } - else QMessageBox::information(0, - tr("File opening error"), - file.errorString()); + else + QMessageBox::information(0, tr("File opening error"), file.errorString()); + event->acceptProposedAction(); } else { @@ -938,7 +943,14 @@ void SCgScene::dropEvent(QGraphicsSceneDragDropEvent *event) { } } -void SCgScene::ensureSelectedItemVisible() { +void SCgScene::ensureSelectedItemVisible() +{ if (!selectedItems().isEmpty()) views().at(0)->ensureVisible(selectedItems().at(0)); } + +QGraphicsItem* SCgScene::itemAt(const QPointF & point) const +{ + Q_ASSERT(views().size() > 0); + return QGraphicsScene::itemAt(point, views().first()->transform()); +} diff --git a/sources/plugins/scg/scgscene.h b/sources/plugins/scg/scgscene.h index 676f7b7..82cf2b8 100644 --- a/sources/plugins/scg/scgscene.h +++ b/sources/plugins/scg/scgscene.h @@ -377,6 +377,8 @@ Q_OBJECT */ void cloneCommand(QList itemList, SCgContour* parent); + QGraphicsItem* itemAt(const QPointF & point) const; + private: QVector mSceneModes; //! Current edit mode diff --git a/sources/plugins/scg/scgtemplateobjectbuilder.cpp b/sources/plugins/scg/scgtemplateobjectbuilder.cpp index 18ebe4d..468d3e4 100644 --- a/sources/plugins/scg/scgtemplateobjectbuilder.cpp +++ b/sources/plugins/scg/scgtemplateobjectbuilder.cpp @@ -28,7 +28,7 @@ along with OSTIS. If not, see . #include "scgbus.h" TemplateSCgObjectsBuilder::TemplateSCgObjectsBuilder(QGraphicsScene* scene) : - AbstractSCgObjectBuilder(scene) + AbstractSCgObjectBuilder() { mDecoratedBuilder = new DefaultSCgObjectBuilder(scene); } diff --git a/sources/plugins/scg/scgtextitem.cpp b/sources/plugins/scg/scgtextitem.cpp index c97746e..8412819 100644 --- a/sources/plugins/scg/scgtextitem.cpp +++ b/sources/plugins/scg/scgtextitem.cpp @@ -24,8 +24,8 @@ along with OSTIS. If not, see . #include "scgconfig.h" #include -SCgTextItem::SCgTextItem(const QString &str, QGraphicsItem *parent, QGraphicsScene *scene) : - QGraphicsTextItem(str, parent, scene) +SCgTextItem::SCgTextItem(const QString &str, QGraphicsItem *parent) + : QGraphicsTextItem(str, parent) { setFlags(QGraphicsItem::ItemIsSelectable | QGraphicsItem::ItemIsFocusable); @@ -33,8 +33,8 @@ SCgTextItem::SCgTextItem(const QString &str, QGraphicsItem *parent, QGraphicsSce setAcceptHoverEvents(true); } -SCgTextItem::SCgTextItem(QGraphicsItem *parent, QGraphicsScene *scene) : - QGraphicsTextItem(parent, scene) +SCgTextItem::SCgTextItem(QGraphicsItem *parent) + : QGraphicsTextItem(parent) { setFlags(QGraphicsItem::ItemIsSelectable | QGraphicsItem::ItemIsFocusable); diff --git a/sources/plugins/scg/scgtextitem.h b/sources/plugins/scg/scgtextitem.h index 45e3527..8650cdc 100644 --- a/sources/plugins/scg/scgtextitem.h +++ b/sources/plugins/scg/scgtextitem.h @@ -39,16 +39,14 @@ class SCgTextItem : public QGraphicsTextItem * @brief Constructor. All parameters are passed to QGraphicsTextItem's constructor * @param str String that contains * @param parent Pointer to the parent graphics item - * @param scene Pointer to the graphics scene that contains current item */ - explicit SCgTextItem(const QString &str, QGraphicsItem* parent = 0, QGraphicsScene* scene = 0); + explicit SCgTextItem(const QString &str, QGraphicsItem* parent = 0); /** * @brief Constructor. All parameters are passed to QGraphicsTextItem's constructor * @param parent Pointer to the parent graphics item - * @param scene Pointer to the graphics scene that contains current item */ - explicit SCgTextItem(QGraphicsItem* parent = 0, QGraphicsScene* scene = 0); + explicit SCgTextItem(QGraphicsItem* parent = 0); //! Destructor virtual ~SCgTextItem(); diff --git a/sources/plugins/scg/scgundoviewmodel.cpp b/sources/plugins/scg/scgundoviewmodel.cpp index 36237f4..d5179a3 100644 --- a/sources/plugins/scg/scgundoviewmodel.cpp +++ b/sources/plugins/scg/scgundoviewmodel.cpp @@ -79,7 +79,8 @@ void SCgUndoViewModel::stackDestroyed(QObject *obj) void SCgUndoViewModel::stackChanged() { - reset(); + beginResetModel(); + endResetModel(); m_sel_model->setCurrentIndex(selectedIndex(), QItemSelectionModel::ClearAndSelect); } diff --git a/sources/plugins/scg/scgview.cpp b/sources/plugins/scg/scgview.cpp index ac70593..3cb6c18 100644 --- a/sources/plugins/scg/scgview.cpp +++ b/sources/plugins/scg/scgview.cpp @@ -175,6 +175,8 @@ void SCgView::createActions() void SCgView::updateActionsState(int idx) { + Q_UNUSED(idx); + mContextObject = 0; QList items = scene()->selectedItems(); @@ -587,9 +589,9 @@ void SCgView::updateSceneRect(const QRectF& rect) if(isSceneRectControlled) { QPointF topLeft = mapToScene(0,0); - QPointF bottomRight = mapToScene(viewport()->width(),viewport()->height()); - QRectF vis(topLeft,bottomRight); - QRectF result = rect.adjusted(-100,-100,100,100).unite(vis).unite(sceneRect()); + QPointF bottomRight = mapToScene(viewport()->width(), viewport()->height()); + QRectF vis(topLeft, bottomRight); + QRectF result = rect.adjusted(-100, -100, 100, 100).united(vis).united(sceneRect()); setSceneRect(result); emit sceneRectChanged(result); diff --git a/sources/plugins/scg/scgwindow.cpp b/sources/plugins/scg/scgwindow.cpp index 6b93064..0b3f453 100644 --- a/sources/plugins/scg/scgwindow.cpp +++ b/sources/plugins/scg/scgwindow.cpp @@ -72,23 +72,23 @@ const int SCgWindow::mScaleChangeStep = 25; const qreal SCgWindow::minScale = 0.20; const qreal SCgWindow::maxScale = 9.99; -SCgWindow::SCgWindow(const QString& _windowTitle, QWidget *parent) : - QWidget(parent), - mView(0), - mScene(0), - mZoomFactorLine(0), - mMinimap(0), - mUndoView(0), - mFindWidget(0), - mToolBar(0), - mUndoStack(0), -// mViewMenu(0), - mEditMenu(0), - mActionUndo(0), - mActionRedo(0), - mActionFind(0)//, -// mActionMinMap(0) -{ +SCgWindow::SCgWindow(const QString& _windowTitle, QWidget *parent) + : QWidget(parent) + , mView(0) + , mScene(0) + , mZoomFactorLine(0) + , mMinimap(0) + , mUndoView(0) + , mFindWidget(0) + , mToolBar(0) + , mUndoStack(0) + , mEditMenu(0) + , mActionUndo(0) + , mActionRedo(0) + , mActionFind(0) +{ + Q_UNUSED(_windowTitle); + mUndoStack = new QUndoStack(this); ///////////////////////////////////////////////// //Creating main environment @@ -709,6 +709,7 @@ void SCgWindow::deleteMenu() void SCgWindow::stackCleanStateChanged(bool value) { + Q_UNUSED(value); emitEvent(EditorObserverInterface::ContentChanged); } diff --git a/sources/plugins/scn/media/icons/add.png b/sources/plugins/scn/media/icons/add.png deleted file mode 100644 index fa153f49b59312fc70cc9c7b868db0384447414e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 10217 zcmX9^c|4Tg+kR#vyDX7xsZd0+g&0C5)sSR2%36pLvdxVBt4L8HF{C2dqD8hDiLxuQ zBxaCxEMplnW__Q2@BA|}=X2)1?{i((dCr-0oiw|PXG8?$1OWgLu{mpX2>>AAM+mTs z4}5dKUFHV>YBe@i7MJh-UMX;^&|GvR@!mGlC+9J-59WLJX7-OVj_+-|%V(shwsAHJ zP$Y^e`@ki>UrMTXo^HLDloa*dQt>WuSldeQqN4c0vtBCJ_UWO3wF<7MT|(C&SBC-Q zU0uxy8>g>UmA6|ut#BI}mRQ4)ZlKWzgA4T0PjRNUcrn9R(zavCH`&Gg&PI&HjhM|_PZfX>#pDL4H10wY{v3l}goHn| zKLAQlS8{J5e7P(7W>v zws%KGP}>`^^jF$Vn_ogm8pZwHXY3^r;m{+1|AsT3$SX$0O?kV?++>@XJ3+`@vzztN zI|;w|!@B)kn1{nm9IJwB1dyLNBKt_acj=>1*3V_r zHb)eBF!2fYP$V(~g_*v!9262RhGdh`?D1WUZl$2LpqXKQMGLcn>B)lTf)(4fovOtt zH(p>Yul-ir>S2ayvH>LKBTwdL>=r3uAx zL3x4HFcH7G2tbNRl{Awz@UQ7~;u|qwOkZESN*bMtsusetBUBB4@3qm*T zTn7j#QI<7KV|BvPe>g$n*ljR!sbT{L;iQ$L&)X93Ar?#s6Ij0{^vHt^xR7PnD_(1} z{IX`ZVD%UUn2J=}N+vLRgu=7m3AYoB|3b19-U3mE!f>J7KTUJ|(q-uBS}5+4D327g)XGN5O*uo9lGjfGO*Bvatg@!HXyrsA8%uQRX+B ziIUm6I1ecUf||r@PEwqj?)cH0TXTF_a~g`$|BB2k-@TAcLmg$<%5ZAWf!dk-&CA|T zdn!?1c-v?}Up<0~wO%?oLG$Z`N|7aoT@0L_qo!^$7Op@#bpdUZzJv zh$CF=76`~F97c?HAx%t(m2H}~`oEK|NxQ!Xegw#OhXCr%4{7b*%y$t;XzZ|6HMD3- z+IozCLH8eckAC@M7i^L(5MG0I*sJbh&redSH5eUF9#&An!M<->%ccoDJ^lPl0qGD! z?g${K?^^Db_@Pz1m-)xBKncTVfJ&$RPd;}59ZiZmJAnvsHv`IYP zq>HH-L2#lvN?ryGT2{ZsTG*w?bERC6^?jKD_Otwe9mGyry&CSbF1=OY&k=1M0r4zr zBP3K1E>UUQcrfSv9-Y!I=BdWD@=X(dJjgSUk?m>TR$fGTOv_FL87}&9N9Q3wyHtuj zYXW&T}xg$Tkvsy-;Cxsw~lesMSCs~kY7>s|UH=6%Ypyn+-z z0hR~o{TzlI3KC@;z3^Tt0xM14C!}({3{Yo_j6iA6X{O7V^Brolo(S_9ctVuq!}h0G zUl$~V(Oqq+TyUfeTJz%+F-?=;KaBn#POdQ7kNGP{$RRtXD=m$ED0qut0*Hv^Vd8`f z_i_YMn&Crn2mlMcp=1unj<_HXF@`qGoTos+IeX>qy8`}w+X+Wfnt34^F`D9kcmm^9vBm~3oFUN;KExc4Tm+M~3ryW?q zs54%IL#o5%hg!mJ-rv+OCaVg^57vxn<>~sYl z8ml1wj|Xyf22eAwQGJ|ZveE*?>LWl!i6Hk(rNX$*-6SE#(Q(&UH=n%qB5;}&Uj$Sb zahllJ;gI*N-DE?;!+!$Yw+cT2a2@?PcmGGh#W~2a@u^5x4CyppnUXrRqe7*1D1#)6 zjNze_IHiAOCr4nT1`?XkZk7nIIt9UD1Tn3MHu7`;#CJMLQ>f)!_}deQ~D# zoL9)7`w~Iw{A7TPO`zc;TcexV5!@PZ6+greHphx7L)Zyg*r4IaNsL|1LfKplDA;Hv z+#pfAoNn@+X%@NX5&{eg5PkFjBL(*Urv!~gQu#%2di{pxw)HQ_a?f`6d*G@Qil9XX zMYkae2CP_3Y?dqOCf(+rLXO1%b*@GI(O790bPmJ;q{+h07vt&MtSvv1qj_rD6PA=z z{_mkIZ~@R0hN)K3K~~fvNW-LoD4_HlaOXnKiD?01k+I*O1ME&sY|@0<*m`k_w_{xO z{BK0%d*?Ya~_Ke0a z?okPx@j@bB@)gFceZfFU_Dt}3*j(Wh+Gbcyqx~`r>$5yb6o-oB?Ha1q*9fZe@`)$0 zy_QIC#TiC8i>QiE=arwTK`RfiS6tB07Ukp-L~WUoS~$QZ%gmM-H{RRhRHF=BcKYjv zXR|*D84@DPnzjpOVAVxGTGv3tWBePbOVG^{R zriq0%qK4iNCY55?yg2KhE)pI#=92_*?CQkp{}>}vDy-8wrflRIn-+qd>Ye9}H%l;^ zV(k*uL-S#>fNbmn3p4xwJG6jMX`ss8IP!osC5?9a!Elo8*d_cFxfw=(ls2MR4J)5#nh!|rH8URlyz%3V8CMeDe0OsZ#hY2bw@6~8^{o|lQ^GxXIl+c6sP-2D^}YoeNLwnVvew|$m0wPOmC)4Q5#{tRzy z-o1`oGF;M>=M-WN8fd%KskY8Ncu8e- zpB)d&9Zwx7vu3>6-t%S_(Hopje?Z;-E$`E5_$^!fxr>C=|bo@hXAnD?a(g%vG&s}#e8F&?Ph?47)<13`(kTI-xC3y3Eb zy)R32Q`~RxpHA^n;p2W-hg2+=?mj*|9TsITUQP-V;X>8ZQ5jL(04bR2Otb8@@A{0- zeAtx`ki8<3ANu)hW*IG`jz+E~)%b^gJAUop`=3JtpNbovI*%*8hr76qNU!Oj16HE8D^EE&peNu<>0NNgJf!Uh#kf_jLGkXx9zaXL*lm@lu>*G#DAVeX9F%XYjhFsc zayXQ(7-1GFQWAE+eTN(q8cH|#*hgTc0&KOC{m!x%EPx{W-Z)|NtrmLAym8;k>W{ z(7r(9pwS34>D8jZ!2r>5>y{~JMuOs~eCMkCHR_~>tb6l+tvI`Z;gVbt(|KR9q8oyH zek~q%m4hgMDY|6e2k~20nAK&J1|c6+jFB+2`AGKAuHypRm4(aWely{G$VzRtRyY0# zW&CtZJK1eP^_-CDtEA=xeK^cC7-3RlfDdjQ9P)&o~4G2m@+!6kE!-pmRgypf8(h+r$YV61#Ns#G^gerpTu zH;akInaQSOFH2rsnFYG*?p`&GV zs4G+Whj%;@*1EQ@EI2^5lTN<7RfhJk3BEwwK7FW;cQYb@Gxj+y%a9Xm!re_ZbeW;y zkVW0#iu&o-PFOr0PAd7hCLisVC-H1Z(gnIn+Li#Ifqft8a(&Z+3=Ir?OK2ruLB?Y1tmzqm#?Z--)y0Z8kUM< zN@r6QFdB?MO@SWqYfn~S#cC*E_8~v&>GqyPd)@zHkH7k~(x)H6dNj#wWC>1%6G8_2 zqiT*CF1Smx?R(7*b}`?DV>B5pV}0)pKXU}BOXqcM6_tlMA*=Q9ukLs6fp{S3qoxIo`CHoj&c z^J#R24O>q-%YZXrHcaTFrVg=mT#(vxIalYBcRr=RaE^V{r2ZS()}e5XkaRZq?Ma|* zYFbH@ug=?Ah*!wj!IjS}U|pul=Y%ts$CNVe507=Qjl6nDv!`BE5Y9}5z%)9o@PlyV z$wqccc2^iI=ov46@At9(Rmo9UEP7!g&rI98JUaT3n~>;bOZmjs<*-*9F@Wq-sE%@u zWvQbe?$+(l#HX(Nun#moUb)IKUBXn~R`q$&|BR^Qwx;W6H{ZT2L8<5&m0swbw@jK? z+ZCJBtcLFPS1h^aX*OSHw39o$9Cio}dnSa4@2ZY(Jq*YFxI5D|ltHMkBFsNTTTN&m z{rXZeE+}xjT9S=`S+{<_ecE1Bz~8p}?xVLnbxj3V;!8MrytY{~TJRT8DktrWe;MHZ zYoDy>xvND{i#nl4yYRPVLl@6K_T#~aN%JBp&OD!R!h9%xrM$)Q3);f-ah|D$JInm0 zvuT}~k%#XIhC!8O5glRnwRmn$(BSlwfvPs1Ge-02Q}C3-+oj1=Y;pg zb7|KM*3qs4>F%@ee2TY=9MW@)0HbKzC#q7E9O-Q#_5FOv@LfDTe0@t`OR|&PuKwg#Ui0UgF917`G{@8A@0`C@42=3lI)b==>P@t;gaKuIma}XZn`=pWhkHRQPtz zcm(;C8RV_(7GlU?KXa8Xy&f=C_sknKn}UcCS^Yd?Y9K;UP*O_{jc^*zk<+4uJn49jRf0Vdx& za`v6ZQx8tz&@z_CZhYVcxCkG-HmY5=J_4SAO*QKv*qfrOg#e)eRx-f@$lHr!ey|Z1aUg6hj{kQ1~+d?r9JN&l4jdbI9hYNwtyC)Xq}?s?i_CsIMH4Dger?Z%y2WV-#v`1 zS()0tzM0oq7ft)`3JmKM26uNM@KY^|OF!gFN$CjJ zhmN4V-43g9lJvMfH|!+Es>7el50mOv@ji$ShmJe0qy2)%zm`a2jPMv& zNr?!x;hB83P&*{M?~)g3IUvX@=;fOj~V6ysXs zbIU=Ddid7`tHxX@tLyr$kzuQ+Zc=J!3T(GC`)lW1B_VJ%A9x7UFUQZG{cm13q1Jx5xZGP%{Sn)r&c|r`YB(C$p=fKcO%&ayv7C9e$JJq<_9%g;7%5qQ>aU!%6YQ z;$`@fO>leE9WJtM9&z&G`B^TX8Lxppt1)zR2H}@Nvha?z9w$pgl1aqZOv?Di&0nxS z*@^<EXSklKOIKd^ac@(UikJdRm|LI8Cg;_01exx& z&lq!I#^n8!=mS}Pdy3a2Cu|d}HR*@CxKf22u?M&1<)t(7{G`VSalFG_%=_l6fw`dw zD!+eRR`3B?_JC00rM|3{FOV7?->0pZG9fkYS07&22CDYUtrMI&>_81ZTw5Z76RaGg z$4N*P7?H=^8qS0u|9(+kdlRo?xR)j=@gvJC{OW&;K-XITFnd$e|Ic_qLS^`eW30#% z%k#C|tSUk`lWu&zUX&VBCHL3loVc)AGK{dqN=grEMyk4Y^c?B8;K9CPGT!P-= zYOT*Dd@z-aANXx`eEr+Uk&dcWMV}LjGSK=Y0}bn$e*X^i5enhn)l;|IP#QQ=86`o!^xkN}N{g_rgNS7%?CU~0@ zpC|ytt=9cO(Ra1#oX64ug;V{B##uXC)cXMS6Pm}X%W$v%FEZ{g-)WgogN8h>5U#J$ zOaUu9+a)gW2?sHZzMZonHB6|x`XwbL@x%HY1gr4y^xaN!Ip6DF8xHqFM~6kI08)yn zJZeKdVF*=h*cBuK0aAHe27p)W+AHlGs*L__@DGP9K;jJZxL-2Vu*-GY7|Ih3rz&)Z zw^CEu{WY`9mB9IZ{aWbW<1%}Fg~YR;zcchZ+4JSf+sp}-{oh-tS*fv)QDZTyzXB-u zrqz&J$M^4P;^qZ$?(duSw)DKcJm&Cdh*5>FCSO5Ujr?H^2j-fcfXnP~yRlpM2?%9v zCF`B=R)jDm`Zi;mbiNK4e&~1NL&2l$6hP;gt%v_%#VG9Lx0Ivbn*^!<*usN=1_csIFid#R1JCmcxaUz^c ztfVL4T8DR;IB9*z_xe#FH+~M{x*+bCeE-B$<@<5Zl0}as&6__TA3%gX=g-k1vr`rG z^$qdZUTs#)5cO6#Hky%!`;n>y1(tcgkj&pler#s_$xA(%{4MM`vNeDy!FH4yV`O|P zRET`w zOyp{}oPW!VQl-K9`nY(;`w{p3R3TMam&uv4ckh0me`%wCexd&Ay_a3r6G`dItu5rb zB&tzWr;(Xf!gRoSoe4wpqZ^&AD>EiM>Z}uCqnl92`yCe99fYj% z0@YDhvfC{#L@YWP@gn892qy4F5%KD&>x0@*?o-pg3`v8x`jwXfAF9*xo{se%;f3Dc z*kYoh{^P&aFm@D-y#)M)+9}jMs-~0xt+-OJQBy)tJ<7O`B<@maOKMM9sB;HdP2U+2~ih1$a0RS=fwZAL~0>=hu5fts-R{k_+_`w0JQ4 z8L$-vKKOZg9NtLjsfLo(fRYA|U?=y*dBq!?e z#53u(g9-Waz+P0@khj+szf>%ttd_vB67AvYG$*{4dF)P}fnh140|~Hza<>aIMZ2}& zf2c9<1pwEJLrsWSX^2af*6;hv@G)c;Q>}tERbNxOGg0>{{>fVyH9=_)d0*zt*)sK^ z8b~r)3rLYHx>$>?r=597%SopRX~)c^F!jGphdxQc?;6FZ?!hf&1U|?0S4A6yZ=-@a zY3wT@@3bNs>LveB)o+jj@7%q8qhd%Ysh6I)B>moVShMk-&dWs^y-#TH}GyoxafD{qxSzfiBD^w|m4{R+ZCR$~RBAF3iq04M+QFRcvljx{qyr`Mu~^R7a2V*VC>o#}dgxtsgkB~^Iv#9@z$K(|hxJ(FUGQEm_+4DHQgbh} z?kV4`G4#n9)I-jz2d6+pHj|VkBo@13q~2ThYOCL5zu^OilLS*3W?OE}wsh{p2LFAl z0ydq%iC*UxH|85A8F0^5f~HGK`$dz==7X&4g{Yr>*zyh~qczumhQw3^;nAT*>r+qf z;BWU~vpVnzVD&>Iry*JHM>O_b6OyBg^>RbCFPDR!-Xb!ML+Ah1aJ{?ztWF!|f9S%~ z#aUueo7!cEbCg;CusxeH)+E(N*iq}_URnRK3`YC$MzSVyQF36`XdYb$GIBa|o1}LC zx7u!-QpxVx==0l7M*lMy2i|eS^dZxQ2?tpkJ0Jx2Pr^NRQmwpshf}zEEYSO8l%SyM zov`Jici4ln%)x)LcYAKekaV@*aWVt1Fj|}(A<{rQ34b)JUrtbgg_>mlf2aMD@!8m* zZDc({xtDsdn`;c(gGE0U77_#FZyvwtv)TXVU^!@vl>@u`FX-*41loOlG!QonQUwdyktNT!vzwFs~BH#cw-g)p}iMZT)ynXVAR>-Mm!dy$~CRCo?+ z!$B$b*sAd=R(nAqm5HCA@CK#`j-%L0VbJx2$~VYp>iF1HiwnQ!{qu15hexH-kO~dJe|IFF!lA?=+zwHFe ztU$)TyEm-~6O)4M2SghwSP^glavII+Q#IR)%ssXRkj}QS+uD6(tdN& zZs1=x$gw-8r+#RHcof?>fD^6_K@f}w?=GkcL9E%8uWr&OaCAppOBir@5rp_8Sq*X4 z61-qC0{MMx5PZIPiGU&l-!C)z%iiXF5|Hq`R#6NMj0XF%?0O)>1d&jrBe8jaTDiXUn_YFH;7gOED8Qq>0s^9t^9^^6ETGR7@ z*0kL6u#|ZUbA7T&v332^!RxzrRkp8^n(uXTEdT8kMz~u!SblRp826sd(|CZ1VaUj6$`GF{69$V@4{2>gDn=g>y-<^MLynbXMqGX|4s z=eqUt=-5blJ~~=}_%aqWl&(lZGwLq!-K+v#N;@5S;Whs|l|b+4^~Y?Ke)?yI1k}^Y^2|CR?@a>@E7Z+ZG{|>* z_Z)ur6jn!)-uX*g=j61oyOcOTLskge>}H9rTPyZPIN{B?B2XoHVUUt80olyT4IMrB zOhv3&5Kyo$0(&XO=NX435)9qmXDtwpfXETc;9jApt)6AjJ!NsIK(V^rWuQu4Cj_e4 z$s{-RU{u-uzaY75hPo})aPu<|aNT$>E+xX#I=74O)vjDBUYg&|qQI~oQovtiipwyb zlqUOqtoG;D9Rb`Eo6Wdl|E~L7*bUJ$NBM8nU6+6k?mo;0E%~GH3*^DQi3EW=2ynh4 lQ$-j-&J5iQ#Th*0cy|DA>DPrc@CqMbV|~%8>XcW){{bMfRp$Tz diff --git a/sources/plugins/scn/scn.pro b/sources/plugins/scn/scn.pro deleted file mode 100644 index 149b81a..0000000 --- a/sources/plugins/scn/scn.pro +++ /dev/null @@ -1,30 +0,0 @@ - -TARGET = $$qtLibraryTarget(scn) -TEMPLATE = lib -INCLUDEPATH += ../../kbe - -DESTDIR = ../../bin/plugins - -CONFIG += plugin - -OBJECTS_DIR = obj -MOC_DIR = moc - -RESOURCES += \ - scn.qrc - -HEADERS += \ - scnplugin.h \ - scnwindow.h \ - scneditorscene.h \ - scnfielditem.h \ - scnfieldglobalidtf.h \ - scninputdialog.h - -SOURCES += \ - scnplugin.cpp \ - scnwindow.cpp \ - scneditorscene.cpp \ - scnfielditem.cpp \ - scnfieldglobalidtf.cpp \ - scninputdialog.cpp diff --git a/sources/plugins/scn/scn.qrc b/sources/plugins/scn/scn.qrc deleted file mode 100644 index 709c037..0000000 --- a/sources/plugins/scn/scn.qrc +++ /dev/null @@ -1,5 +0,0 @@ - - - media/icons/add.png - - diff --git a/sources/plugins/scn/scneditorscene.cpp b/sources/plugins/scn/scneditorscene.cpp deleted file mode 100644 index 531a13c..0000000 --- a/sources/plugins/scn/scneditorscene.cpp +++ /dev/null @@ -1,382 +0,0 @@ -/* ------------------------------------------------------------------------------ -This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) -For the latest info, see http://www.ostis.net - -Copyright (c) 2010-2014 OSTIS - -OSTIS 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 3 of the License, or -(at your option) any later version. - -OSTIS is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with OSTIS. If not, see . ------------------------------------------------------------------------------ -*/ - -#include "scneditorscene.h" -#include "scnfielditem.h" -#include "scnfieldglobalidtf.h" - -#include -#include -#include - -SCnEditorScene::SCnEditorScene(QObject *parent) : - QGraphicsScene(parent), - mLevelOffset(30), - mLevelDistance(10) -{ - SCnFieldItem *pitem = new SCnFieldGlobalIdtf(this); - pitem->setValue("test"); - appendField(pitem); - - for (quint32 i = 0; i < 5; i++) - { - SCnFieldItem *item = new SCnFieldGlobalIdtf(pitem); - item->setValue(QString("test %1").arg(i)); - item->setParentItem(pitem); - - for (quint32 j = 0; j < 5; j++) - { - SCnFieldItem *jitem = new SCnFieldGlobalIdtf(item); - jitem->setValue(QString("test %1_%2").arg(i).arg(j)); - jitem->setParentItem(item); - } - } - - inputDialog = new SCnInputDialog(); - connect(inputDialog, SIGNAL(textRecieved(QString)), this, SLOT(setTextForSelectedField(QString))); -} - -SCnEditorScene::~SCnEditorScene() -{ - foreach(SCnFieldItem *item, mFields) - delete item; - mFields.clear(); -} - -SCnFieldItem* SCnEditorScene::appendField(SCnFieldItem *field, SCnFieldItem *afterField) -{ - if (field->mEditorScene != 0) - field->mEditorScene->removeField(field); - - field->mEditorScene = this; - - if (afterField != 0) - { - bool inserted = false; - FieldItems::iterator it; - for (it = mFields.begin(); it != mFields.end(); ++it) - { - if (*it == afterField) - { - mFields.insert(it + 1, field); - inserted = true; - break; - } - } - - if (!inserted) - mFields.push_back(field); - }else - mFields.push_back(field); - - addItem(field); - updateFieldsPositions(); - - return field; -} - -void SCnEditorScene::removeField(SCnFieldItem *field) -{ - if (!mFields.contains(field)) - { - SCnFieldItem* parent = parentField(field); - removeItem(field); - - delete field; - - while (parent) - { - parent->updateOnChilds(); - parent = parentField(parent); - } - - updateFieldsPositions(); - } -} - -void SCnEditorScene::removeAllFields() -{ - SCnFieldItem *field = 0; - foreach(field, mFields) - delete field; - mFields.clear(); -} - -SCnFieldItem* SCnEditorScene::nextField(SCnFieldItem *field, bool withLevelChange) -{ - SCnFieldItem *nextField = 0; - bool prevFieldComingFlag = false; - QGraphicsItem *parentItem = field->parentItem(); - if (!parentItem) - return 0; - QList items = withLevelChange - ? this->items() - : parentItem->childItems(); - foreach(QGraphicsItem *item, items) - { - if (nextField->isSCnFieldType(item->type())) - { - nextField = static_cast(item); - if (prevFieldComingFlag) - return nextField; - if (nextField == field) - prevFieldComingFlag = true; - } - } - return 0; -} - -SCnFieldItem* SCnEditorScene::prevField(SCnFieldItem *field, bool withLevelChange) -{ - SCnFieldItem *prevField; - SCnFieldItem *nextField = 0; - QGraphicsItem *parentItem = field->parentItem(); - if (!parentItem) - return 0; - QList items = withLevelChange - ? this->items() - : parentItem->childItems(); - foreach (QGraphicsItem *item, items) - { - if (nextField->isSCnFieldType(item->type())) - { - prevField = nextField; - nextField = static_cast(item); - if (nextField == field) - return prevField; - } - } - return 0; -} - -SCnFieldItem* SCnEditorScene::parentField(SCnFieldItem *field) -{ - SCnFieldItem *parentField = 0; - QGraphicsItem *parentItem = field->parentItem(); - if (parentItem && field->isSCnFieldType(parentItem->type())) - { - parentField = static_cast(parentItem); - } - return parentField; -} - -SCnFieldItem* SCnEditorScene::childField(SCnFieldItem *field) -{ - SCnFieldItem *childField = 0; - QGraphicsItem *firstChildItem = 0; - QList childItems = field->childItems(); - if (!childItems.isEmpty()) - { - firstChildItem = childItems.first(); - if (field->isSCnFieldType(firstChildItem->type())) - { - childField = static_cast(firstChildItem); - } - } - return childField; -} - -void SCnEditorScene::selectField(SCnFieldItem *field) -{ - if (field) - { - unselectItems(); - field->setSelected(true); - views().first()->centerOn(field); - } -} - -void SCnEditorScene::unselectItems() -{ - QList items = selectedItems(); - QGraphicsItem *item = 0; - foreach(item, items) - item->setSelected(false); -} - -void SCnEditorScene::updateFieldsPositions() -{ - SCnFieldItem *field = 0; - qreal y_offset = 40.f; - qreal max_width = 0.f; - foreach(field, mFields) - { - QRectF rect = field->boundingRect(); - // calculate new position - QPointF pos; - pos.setX(20); - pos.setY(y_offset); - - y_offset += mLevelDistance + rect.height(); - - qreal w = rect.width(); - max_width = qMax(w, max_width); - - field->setPos(pos); - } - - // setup new bounding box for scene - setSceneRect(0, 0, max_width, y_offset); -} - -void SCnEditorScene::itemChanged(SCnFieldItem *field, SCnFieldItem::ChangeType changeType) -{ - switch (changeType) - { - case SCnFieldItem::StateChanged: - case SCnFieldItem::BoundChanged: - updateFieldsPositions(); - }; -} - -void SCnEditorScene::keyPressEvent(QKeyEvent *event) -{ - QList selected = selectedItems(); - if (selected.size() == 1) - { - SCnFieldItem *field = static_cast(selected.first()); - if (field) - { - SCnFieldItem::FieldState state = field->state(); - if (state == SCnFieldItem::StateSelected) - { - if (event->key() == Qt::Key_Down) - { - if (event->modifiers() & Qt::ShiftModifier) - { - moveFieldDown(field); - } - else - { - selectField(nextField(field, false)); - } - } - else if (event->key() == Qt::Key_Up) - { - if (event->modifiers() & Qt::ShiftModifier) - { - moveFieldUp(field); - } - else - { - selectField(prevField(field, false)); - } - } - else if (event->key() == Qt::Key_Left) - { - selectField(parentField(field)); - } - else if (event->key() == Qt::Key_Right) - { - selectField(childField(field)); - } - else if (event->key() == Qt::Key_Enter) - { - //field->startEdit(); - inputDialog->show(); - inputDialog->setExistingText(field->value()); - } - else if (event->key() == Qt::Key_Insert) - { - insertField(field); - } - else if (event->key() == Qt::Key_Delete) - { - removeField(field); - } - } - else if (state == SCnFieldItem::StateEdit) - { - if (event->key() == Qt::Key_Enter) - { - field->applyEdit(); - } - else if (event->key() == Qt::Key_Escape) - { - field->cancelEdit(); - } - } - } - } - - QGraphicsScene::keyPressEvent(event); -} - -void SCnEditorScene::moveFieldUp(SCnFieldItem *field) -{ - SCnFieldItem *previous = prevField(field, false); - if (previous) - { - swapFields(field, previous); - //field->stackBefore(previous); - } -} - -void SCnEditorScene::moveFieldDown(SCnFieldItem *field) -{ - SCnFieldItem *next = nextField(field, false); - if (next) - { - swapFields(field, next); - //next->stackBefore(field); - } -} - -void SCnEditorScene::swapFields(SCnFieldItem *field_1, SCnFieldItem *field_2) -{ - QGraphicsItem *parent = field_1->parentItem(); - if (parent == field_2->parentItem()) - { - QList *children = &parent->childItems(); - int index_1 = children->indexOf(field_1); - int index_2 = children->indexOf(field_2); - if (index_1 >= 0 && index_2 >= 0) - { - children->swap(index_1, index_2); - static_cast(parent)->updateOnChilds(); - updateFieldsPositions(); - } - } -} - -void SCnEditorScene::insertField(SCnFieldItem *field) -{ - SCnFieldItem *item = new SCnFieldGlobalIdtf(field); - item->setValue("new field"); - item->setParentItem(field); - while (field) - { - field->updateOnChilds(); - field = parentField(field); - } - updateFieldsPositions(); -} - -void SCnEditorScene::setTextForSelectedField(const QString &text) -{ - QList selected = selectedItems(); - if (selected.size() == 1) - { - SCnFieldItem *field = static_cast(selected.first()); - field->setValue(text); - } -} diff --git a/sources/plugins/scn/scneditorscene.h b/sources/plugins/scn/scneditorscene.h deleted file mode 100644 index 565d0ba..0000000 --- a/sources/plugins/scn/scneditorscene.h +++ /dev/null @@ -1,129 +0,0 @@ -/* ------------------------------------------------------------------------------ -This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) -For the latest info, see http://www.ostis.net - -Copyright (c) 2010-2014 OSTIS - -OSTIS 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 3 of the License, or -(at your option) any later version. - -OSTIS is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with OSTIS. If not, see . ------------------------------------------------------------------------------ -*/ - -#ifndef SCNEDITOR_H -#define SCNEDITOR_H - -#include "scnfielditem.h" -#include "scninputdialog.h" - -#include -#include - -class SCnEditorScene : public QGraphicsScene -{ - Q_OBJECT -public: - explicit SCnEditorScene(QObject *parent = 0); - virtual ~SCnEditorScene(); - - /*! Append new scn-field after specified \p afterField - * @param field Pointer to appended scn-field - * @param afterField Pointer to item, to insert new field after this one. - * If \p afterField pointer is null, then new field will be added to the end - * @return Return pointer to appended new field - */ - SCnFieldItem* appendField(SCnFieldItem *field, SCnFieldItem *afterField = 0); - - /*! Remove specified field from scene and destroy it. - * @param field Pointer to field that need to be removed - */ - void removeField(SCnFieldItem *field); - - /*! Get pointer to field, that located after specified \p field - * @param field Pointer to scn-field for get next - * @param withLevelChange true, if level changing allowed - * @return Return pointer to scn-field, that located after \p field. - * If \p field is a first field, then return 0 - */ - SCnFieldItem* nextField(SCnFieldItem *field, bool withLevelChange); - - /*! Get pointer to field, that located before specified \p field - * @param field Pointer to scn-field for get previous - * @param withLevelChange true, if level changing allowed - * @return Return pointer to scn-field, that located before \p field - * If \p field is a last field, then return 0 - */ - SCnFieldItem* prevField(SCnFieldItem *field, bool withLevelChange); - - /*! - * @param field Pointer to scn-field for get parent - * @return Return pointer to parent scn-field - * If \p field is the root field, then return 0 - */ - SCnFieldItem* parentField(SCnFieldItem *field); - - /*! - * @param field Pointer to scn-field for get child - * @return Return pointer to the first child scn-field - * If \p field is a leaf field, then return 0 - */ - SCnFieldItem* childField(SCnFieldItem *field); - - - //! Select specified \p field - void selectField(SCnFieldItem *field); - //! Move up specified \p field - void moveFieldUp(SCnFieldItem *field); - //! Move down specified \p field - void moveFieldDown(SCnFieldItem *field); - //! Swap specified \p field_1 with specified \p field_2 - void swapFields(SCnFieldItem *field_1, SCnFieldItem *field_2); - //! Add new field as child of \p field - void insertField(SCnFieldItem *field); - -private: - //! Unselect all selected items - void unselectItems(); - - //! Recalculate all fields positions - void updateFieldsPositions(); - -protected: - void keyPressEvent(QKeyEvent *event); - //void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *mouseEvent); - - //! Remove all fields from scene - void removeAllFields(); - -public: - //! Nofification about item change - void itemChanged(SCnFieldItem *field, SCnFieldItem::ChangeType changeType); - -protected: - typedef QVector FieldItems; - FieldItems mFields; - //! Level horizontal offset in pixels - quint32 mLevelOffset; - //! Vertical distance between fields - quint32 mLevelDistance; - - //! Dialog for input SCn-text - SCnInputDialog *inputDialog; - -signals: - -public slots: - void setTextForSelectedField(const QString &text); -}; - -#endif // SCNEDITOR_H diff --git a/sources/plugins/scn/scnfieldglobalidtf.cpp b/sources/plugins/scn/scnfieldglobalidtf.cpp deleted file mode 100644 index ebade18..0000000 --- a/sources/plugins/scn/scnfieldglobalidtf.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* ------------------------------------------------------------------------------ -This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) -For the latest info, see http://www.ostis.net - -Copyright (c) 2010-2014 OSTIS - -OSTIS 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 3 of the License, or -(at your option) any later version. - -OSTIS is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with OSTIS. If not, see . ------------------------------------------------------------------------------ -*/ - -#include "scnfieldglobalidtf.h" - -#include -#include -#include - -SCnFieldGlobalIdtf::SCnFieldGlobalIdtf(QObject *parent) : - SCnFieldItem(parent) -{ - mFont = QFont("Arial", 14); - mFont.setBold(true); - mFont.setItalic(true); -} - -SCnFieldGlobalIdtf::~SCnFieldGlobalIdtf() -{ - -} - -qreal SCnFieldGlobalIdtf::childsOffset() const -{ - QFontMetrics fm(mFont); - return fm.boundingRect(mValue).height() + 10; -} - -QRectF SCnFieldGlobalIdtf::boundingRect() const -{ - QFontMetrics fm(mFont); - QRectF textRect = fm.boundingRect(mValue); - - QRectF childRect = childrenBoundingRect(); - - return textRect.united(childRect).adjusted(-10, -10, 20, 20); -} - -void SCnFieldGlobalIdtf::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) -{ - SCnFieldItem::paint(painter, option, widget); - - // draw value - painter->setPen(QColor(0, 0, 0, 200)); - - painter->setFont(mFont); - painter->drawText(5, 5, mValue); -} - diff --git a/sources/plugins/scn/scnfieldglobalidtf.h b/sources/plugins/scn/scnfieldglobalidtf.h deleted file mode 100644 index 29cfa37..0000000 --- a/sources/plugins/scn/scnfieldglobalidtf.h +++ /dev/null @@ -1,63 +0,0 @@ -/* ------------------------------------------------------------------------------ -This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) -For the latest info, see http://www.ostis.net - -Copyright (c) 2010-2014 OSTIS - -OSTIS 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 3 of the License, or -(at your option) any later version. - -OSTIS is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with OSTIS. If not, see . ------------------------------------------------------------------------------ -*/ - -#ifndef SCNFIELDGLOBALIDTF_H -#define SCNFIELDGLOBALIDTF_H - -#include "scnfielditem.h" - -#include - -class SCnFieldGlobalIdtf : public SCnFieldItem -{ - Q_OBJECT -public: - explicit SCnFieldGlobalIdtf(QObject *parent = 0); - virtual ~SCnFieldGlobalIdtf(); - - enum { Type = UserType + 2 }; - int type() const { return Type; } - -protected: - QRectF boundingRect() const; - void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); - - //! @copydoc SCnFieldItem::isSubitemsPossible - bool isSubitemsPossible() const { return true; } - //! @copydoc SCnFieldItem::canBeRoot - bool canBeRoot() const {return true; } - //! @copydoc SCnFieldItem::canBeAtZeroLevel - bool canBeAtZeroLevel() const { return true; } - //! @copydoc SCnFieldItem::childsOffset - qreal childsOffset() const; - -private: - //! Used font - QFont mFont; - -signals: - -public slots: - -}; - -#endif // SCNFIELDGLOBALIDTF_H diff --git a/sources/plugins/scn/scnfielditem.cpp b/sources/plugins/scn/scnfielditem.cpp deleted file mode 100644 index 1ad75dc..0000000 --- a/sources/plugins/scn/scnfielditem.cpp +++ /dev/null @@ -1,177 +0,0 @@ -/* ------------------------------------------------------------------------------ -This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) -For the latest info, see http://www.ostis.net - -Copyright (c) 2010-2014 OSTIS - -OSTIS 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 3 of the License, or -(at your option) any later version. - -OSTIS is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with OSTIS. If not, see . ------------------------------------------------------------------------------ -*/ - -#include "scnfielditem.h" -#include "scneditorscene.h" - -// change to item that has biggest Type value -#include "scnfieldglobalidtf.h" - -#include -#include -#include -#include -#include -#include - -SCnFieldItem::SCnFieldItem(QObject *parent) : - QObject(parent), - QGraphicsItem(), - mState(StateNormal), - mEditorScene(0) -{ - setFlags(QGraphicsItem::ItemIsSelectable - | QGraphicsItem::ItemIsFocusable - | QGraphicsItem::ItemSendsGeometryChanges); - setAcceptHoverEvents(true); - -} - -SCnFieldItem::~SCnFieldItem() -{ - -} - -bool SCnFieldItem::isSCnFieldType(int type) -{ - return (type >= Type) && (type <= SCnFieldGlobalIdtf::Type); -} - -void SCnFieldItem::setValue(const QString &value) -{ - mValue = value; - changed(this, ValueChanged); -} - -void SCnFieldItem::updateOnChilds() -{ - qreal offset = childsOffset(); - QGraphicsItem *child = 0; - QList _childItems = childItems(); - - foreach(child, _childItems) - { - if (!isSCnFieldType(child->type())) return; // skip non scn-fields - SCnFieldItem *item = static_cast(child); - - item->setPos(30, offset); - offset += 10 + item->boundingRect().height(); - } - -} - -QRectF SCnFieldItem::boundingRect() const -{ - return QRectF(0, 0, 100, 30); -} - -void SCnFieldItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) -{ - QColor brushColor = QColor(240, 240, 240, 220); - - switch (mState) - { - case StateHighlight: - brushColor = QColor(186, 217, 156, 180); - break; - - case StateEdit: - brushColor = QColor(144, 173, 146, 180); - break; - - case StateSelected: - brushColor = QColor(157, 201, 94, 180); - break; - - default: - break; - }; - - QBrush brush(brushColor); - QPen pen(brush, 5.f, Qt::DashLine); - - painter->setPen(pen); - painter->setBrush(brush); - - QRectF rect = boundingRect().adjusted(5, 5, -5, -5); - - painter->drawRoundedRect(rect, 10.f, 10.f); -} - -QVariant SCnFieldItem::itemChange(GraphicsItemChange change, const QVariant &value) -{ - if (change == ItemSelectedHasChanged) - { - if (!value.toBool()) - mState = StateNormal; - else - { - if (mState != StateEdit) - mState = StateSelected; - } - - update(); - } - - if (change == ItemChildAddedChange || change == ItemChildRemovedChange) - { - updateOnChilds(); - } - - return QGraphicsItem::itemChange(change, value); -} - -void SCnFieldItem::hoverEnterEvent(QGraphicsSceneHoverEvent *event) -{ - if (mState != StateEdit && mState != StateSelected) - mState = StateHighlight; - update(); -} - -void SCnFieldItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) -{ - if (mState == StateHighlight) - mState = StateNormal; - update(); -} - -void SCnFieldItem::startEdit() -{ - mState = StateEdit; - update(); -} - -void SCnFieldItem::applyEdit() -{ - -} - -void SCnFieldItem::cancelEdit() -{ - -} - -void SCnFieldItem::changed(SCnFieldItem *field, SCnFieldItem::ChangeType changeType) -{ - if (mEditorScene != 0) - mEditorScene->itemChanged(field, changeType); -} diff --git a/sources/plugins/scn/scnfielditem.h b/sources/plugins/scn/scnfielditem.h deleted file mode 100644 index f337e10..0000000 --- a/sources/plugins/scn/scnfielditem.h +++ /dev/null @@ -1,129 +0,0 @@ -/* ------------------------------------------------------------------------------ -This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) -For the latest info, see http://www.ostis.net - -Copyright (c) 2010-2014 OSTIS - -OSTIS 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 3 of the License, or -(at your option) any later version. - -OSTIS is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with OSTIS. If not, see . ------------------------------------------------------------------------------ -*/ - -#ifndef SCNFIELDITEM_H -#define SCNFIELDITEM_H - -#include -#include - -class SCnEditorScene; - -class SCnFieldItem : public QObject, - public QGraphicsItem -{ - Q_OBJECT - Q_INTERFACES(QGraphicsItem) - - friend class SCnEditorScene; - -protected: - explicit SCnFieldItem(QObject *parent = 0); - virtual ~SCnFieldItem(); - -public: - enum ChangeType - { - ParentChanged, - ValueChanged, - StateChanged, - BoundChanged - }; - - enum FieldState - { - StateNormal = 0, - StateHighlight, - StateEdit, - StateSelected - }; - - enum { Type = UserType + 1 }; - - int type() const { return Type; } - - //! Check if specified item type is an scn field item - static bool isSCnFieldType(int type); - -public: - //! Return true, if field is empty; otherwise - return flase - bool isEmpty() const { return mValue.isEmpty(); } - //! Return true, if this field is possible to has subitems - virtual bool isSubitemsPossible() const = 0; - //! Return true, if this field can be a root - virtual bool canBeRoot() const = 0; - //! Return true, if this field can be at first level - virtual bool canBeAtZeroLevel() const = 0; - //! Return y offset for first child item - virtual qreal childsOffset() const = 0; - //! Update on childs changed. Called when any child changed, or added/removed - virtual void updateOnChilds(); - - //! Return current state - FieldState state() const { return mState; } - - /*! Set new value for field - * @param value New value - */ - void setValue(const QString &value); - //! Return field value - const QString& value() const { return mValue; } - -protected: - virtual QRectF boundingRect() const; - virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); - virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value); - - // hover events - void hoverEnterEvent(QGraphicsSceneHoverEvent *event); - void hoverLeaveEvent(QGraphicsSceneHoverEvent *event); - -private: - /*! Function to notify scene about item change - * @param field Pointer to changed scn-field - * @param changeType Changes type - */ - void changed(SCnFieldItem *field, ChangeType changeType); - -protected: - FieldState mState; - - //! Pointer to scene, that controls field - SCnEditorScene *mEditorScene; - //! Attribute value - QString mAttribute; - //! Field value - QString mValue; - -signals: - - -public slots: - //! Starts edit field value - void startEdit(); - //! Applies entered text for field attribute / value - void applyEdit(); - //! Cancel edit without any changes - void cancelEdit(); -}; - -#endif // SCNFIELDITEM_H diff --git a/sources/plugins/scn/scninputdialog.cpp b/sources/plugins/scn/scninputdialog.cpp deleted file mode 100644 index 0c81801..0000000 --- a/sources/plugins/scn/scninputdialog.cpp +++ /dev/null @@ -1,60 +0,0 @@ -#include "scninputdialog.h" - -SCnInputDialog::SCnInputDialog(QWidget *parent) : - QDialog(parent) -{ - lineEdit = new QLineEdit(); - lineEdit->setFocus(); - - okButton = new QPushButton("OK"); - cancelButton = new QPushButton("Cancel"); - - gridLayout = new QGridLayout(); - gridLayout->addWidget(lineEdit, 0, 0, 1, 1); - gridLayout->addWidget(okButton, 1, 0, 1, 1); - gridLayout->addWidget(cancelButton, 1, 1, 1, 1); - - this -> setLayout(gridLayout); - this -> setWindowTitle("Input SCn Dialog"); - - connect(okButton, SIGNAL(clicked()), this, SLOT(okButtonClicked())); - connect(cancelButton, SIGNAL(clicked()), this, SLOT(cancelButtonClicked())); -} - -void SCnInputDialog::setExistingText(const QString &text) -{ - lineEdit->setText(text); -} - -void SCnInputDialog::okButtonClicked() -{ - QString SCnText = SCnInputDialog::convertFromCommonTextToSCn(lineEdit->text()); - emit textRecieved(SCnText); - lineEdit->clear(); - this->close(); -} - -void SCnInputDialog::cancelButtonClicked() -{ - lineEdit->clear(); - this->close(); -} - -QString SCnInputDialog::convertFromCommonTextToSCn(const QString &commonText) -{ - QString scnText(commonText); - scnText.replace("∀", QChar(8704)); // for all, U+2200 ISOtech - scnText.replace("∃", QChar(8707)); // there exists, U+2203 ISOtech - scnText.replace("∅", QChar(8709)); // empty set = null set = diameter, U+2205 ISOamso - scnText.replace("->", QChar(8712)); // element of, U+2208 ISOtech - scnText.replace("-|>", QChar(8713)); // not an element of, U+2209 ISOtech - scnText.replace("!=", QChar(8800)); // not equal to, U+2260 ISOtech - scnText.replace(">=", QChar(8805)); // greater-than or equal to, U+2265 ISOtech - scnText.replace("<=", QChar(8804)); // less-than or equal to, U+2264 ISOtech - scnText.replace("⊂", QChar(8834)); // subset of, U+2282 ISOtech - scnText.replace("⊃", QChar(8835)); // superset of, U+2283 ISOtech - scnText.replace("⊄", QChar(8836)); // not a subset of, U+2284 ISOamsn - scnText.replace("⊆", QChar(8838)); // subset of or equal to, U+2286 ISOtech - scnText.replace("⊇", QChar(8839)); // superset of or equal to, U+2287 ISOtech - return scnText; -} diff --git a/sources/plugins/scn/scninputdialog.h b/sources/plugins/scn/scninputdialog.h deleted file mode 100644 index c6437dc..0000000 --- a/sources/plugins/scn/scninputdialog.h +++ /dev/null @@ -1,36 +0,0 @@ -#ifndef SCNINPUTDIALOG_H -#define SCNINPUTDIALOG_H - -#include -#include -#include -#include - -class SCnInputDialog : public QDialog -{ - Q_OBJECT -public: - explicit SCnInputDialog(QWidget *parent = 0); - - //! Set text of selected field - void setExistingText(const QString &text); - - static QString convertFromCommonTextToSCn(const QString &commonText); -private: - QLineEdit *lineEdit; - QPushButton *okButton; - QPushButton *cancelButton; - QGridLayout *gridLayout; - -signals: - //! Give entered text after ok-button press - void textRecieved(const QString &text); - -public slots: - //! Ok button handler - void okButtonClicked(); - //! Cancel button handler - void cancelButtonClicked(); -}; - -#endif // SCNINPUTDIALOG_H diff --git a/sources/plugins/scn/scnplugin.cpp b/sources/plugins/scn/scnplugin.cpp deleted file mode 100644 index 3a0af2e..0000000 --- a/sources/plugins/scn/scnplugin.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/* ------------------------------------------------------------------------------ -This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) -For the latest info, see http://www.ostis.net - -Copyright (c) 2010-2014 OSTIS - -OSTIS 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 3 of the License, or -(at your option) any later version. - -OSTIS is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with OSTIS. If not, see . ------------------------------------------------------------------------------ -*/ - -#include "scnplugin.h" -#include "scnwindow.h" - -Q_EXPORT_PLUGIN2(scn, SCnPlugin) - -SCnPlugin::SCnPlugin(QObject *parent) : - QObject(parent) -{ -} - -SCnPlugin::~SCnPlugin() -{ -} - -const QString& SCnPlugin::name() const -{ - static QString name = "scn"; - return name; -} - -const QString& SCnPlugin::version() const -{ - static QString version = "0.1.0"; - return version; -} - -const QList& SCnPlugin::interfaces() const -{ - return mInterfaces; -} - -void SCnPlugin::initialize() -{ - mInterfaces.push_back(new SCnWindowFactory(this)); -} - -void SCnPlugin::shutdown() -{ - - QObject *interface = 0; - foreach(interface, mInterfaces) - delete interface; - mInterfaces.clear(); -} diff --git a/sources/plugins/scn/scnplugin.h b/sources/plugins/scn/scnplugin.h deleted file mode 100644 index c46efd4..0000000 --- a/sources/plugins/scn/scnplugin.h +++ /dev/null @@ -1,56 +0,0 @@ -/* ------------------------------------------------------------------------------ -This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) -For the latest info, see http://www.ostis.net - -Copyright (c) 2010-2014 OSTIS - -OSTIS 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 3 of the License, or -(at your option) any later version. - -OSTIS is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with OSTIS. If not, see . ------------------------------------------------------------------------------ -*/ - -#ifndef SCNPLUGIN_H -#define SCNPLUGIN_H - -#include -#include "interfaces/plugininterface.h" - -class SCnPlugin : public QObject, - public PluginInterface -{ - Q_OBJECT - Q_INTERFACES(PluginInterface) - -public: - explicit SCnPlugin(QObject *parent = 0); - virtual ~SCnPlugin(); - - //! @copydoc PluginInterface::name - const QString& name() const; - //! @copydoc PluginInterface::version - const QString& version() const; - //! @copydoc PluginInterface::interfaces - const QList& interfaces() const; - //! @copydoc PluginInterface::initialize - void initialize(); - //! @copydoc PluginInterface::shutdown - void shutdown(); - -protected: - //! List of provided by plugin interfaces - QList mInterfaces; - -}; - -#endif // SCNPLUGIN_H diff --git a/sources/plugins/scn/scnwindow.cpp b/sources/plugins/scn/scnwindow.cpp deleted file mode 100644 index 95f4d20..0000000 --- a/sources/plugins/scn/scnwindow.cpp +++ /dev/null @@ -1,152 +0,0 @@ -/* ------------------------------------------------------------------------------ -This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) -For the latest info, see http://www.ostis.net - -Copyright (c) 2010-2014 OSTIS - -OSTIS 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 3 of the License, or -(at your option) any later version. - -OSTIS is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with OSTIS. If not, see . ------------------------------------------------------------------------------ -*/ - -#include "scnwindow.h" -#include "scneditorscene.h" - -#include -#include - -SCnWindow::SCnWindow(QWidget *parent) : - QWidget(parent), - mIsSaved(false), - mEditorScene(0), - mEditorView(0) -{ - mEditorView = new QGraphicsView(this); - mEditorScene = new SCnEditorScene(); - //mEditorScene->setSceneRect(QRectF(0, 0, 1024, 768)); - - mEditorView->setResizeAnchor(QGraphicsView::NoAnchor); - mEditorView->setAlignment(Qt::AlignLeft | Qt::AlignTop); - mEditorView->setScene(mEditorScene); - - - mEditorView->setCacheMode(QGraphicsView::CacheNone);//CacheBackground); - mEditorView->setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate); - mEditorView->setRenderHint(QPainter::Antialiasing); - mEditorView->setTransformationAnchor(QGraphicsView::AnchorUnderMouse); - mEditorView->setResizeAnchor(QGraphicsView::NoAnchor); - mEditorView->setOptimizationFlag(QGraphicsView::DontAdjustForAntialiasing); - - mEditorView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - //mEditorView->setDragMode(QGraphicsView::RubberBandDrag); - - if (!mEditorScene->items().empty()) - mEditorView->centerOn(mEditorScene->items().first()); - - QVBoxLayout *layout = new QVBoxLayout(this); - layout->addWidget(mEditorView); - - setLayout(layout); -} - -SCnWindow::~SCnWindow() -{ - -} - -QWidget* SCnWindow::widget() -{ - return this; -} - -QToolBar* SCnWindow::toolBar() -{ - return 0; -} - -QList SCnWindow::widgetsForDocks() -{ - return QList(); -} - -bool SCnWindow::isSaved() const -{ - return mIsSaved; -} - -void SCnWindow::_update() -{ - -} - -QIcon SCnWindow::icon() const -{ - return QIcon(); -} - -bool SCnWindow::loadFromFile(const QString &fileName) -{ - EditorInterface::loadFromFile(fileName); - - return false; -} - -bool SCnWindow::saveToFile(const QString &fileName) -{ - EditorInterface::saveToFile(fileName); - - return false; -} - -QStringList SCnWindow::supportedFormatsExt() const -{ - QStringList res; - res << "scns"; - return res; -} - -QIcon SCnWindow::findIcon(const QString &iconName) -{ - return QIcon(":/media/icons/" + iconName); -} - -// --------------------- -SCnWindowFactory::SCnWindowFactory(QObject *parent) : - QObject(parent) -{ - -} - -SCnWindowFactory::~SCnWindowFactory() -{ - -} - -const QString& SCnWindowFactory::name() const -{ - static QString name = "scn"; - return name; -} - -EditorInterface* SCnWindowFactory::createInstance() -{ - return new SCnWindow(); -} - -QStringList SCnWindowFactory::supportedFormatsExt() -{ - QStringList res; - res << "scns"; - return res; -} diff --git a/sources/plugins/scn/scnwindow.h b/sources/plugins/scn/scnwindow.h deleted file mode 100644 index 2a5875e..0000000 --- a/sources/plugins/scn/scnwindow.h +++ /dev/null @@ -1,100 +0,0 @@ -/* ------------------------------------------------------------------------------ -This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) -For the latest info, see http://www.ostis.net - -Copyright (c) 2010-2014 OSTIS - -OSTIS 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 3 of the License, or -(at your option) any later version. - -OSTIS is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with OSTIS. If not, see . ------------------------------------------------------------------------------ -*/ - -#ifndef SCNWINDOW_H -#define SCNWINDOW_H - -#include -#include "interfaces/editorinterface.h" - -class SCnEditorScene; -class QGraphicsView; - -class SCnWindow : public QWidget, - public EditorInterface -{ - Q_OBJECT - Q_INTERFACES(EditorInterface) - -public: - explicit SCnWindow(QWidget *parent = 0); - virtual ~SCnWindow(); - - //! @copydoc EditorInterface::widget - QWidget* widget(); - //! @copydoc EditorInterface::toolBar - QToolBar* toolBar(); - //! @copydoc EditorInterface::widgetsForDocks - QList widgetsForDocks(); - //! @copydoc EditorInterface::isSaved - bool isSaved() const; - //! @copydoc EditorInterface::_update - void _update(); - //! @copydoc EditorInterface::icon - QIcon icon() const; - //! @copydoc EditorInterface::supportedFormatsExt - QStringList supportedFormatsExt() const; - - //! @copydoc EditorInterface::loadFromFile - bool loadFromFile(const QString &fileName); - //! @copydoc EditorInterface::saveToFile - bool saveToFile(const QString &fileName); - - //! Return icon by name - static QIcon findIcon(const QString &iconName); - -protected: - //! Saved flag - bool mIsSaved; - //! Pointer to editor scene - SCnEditorScene *mEditorScene; - //! Pointer to editor view - QGraphicsView *mEditorView; - -signals: - -public slots: - -}; - - -/*! Factory for scn-windows - */ -class SCnWindowFactory : public QObject, - public EditorFactoryInterface -{ - Q_OBJECT - Q_INTERFACES(EditorFactoryInterface) - -public: - explicit SCnWindowFactory(QObject *parent = 0); - virtual ~SCnWindowFactory(); - - //! @copydoc SCnWindowFactory::name - const QString& name() const; - //! @copydoc SCnWindowFactory::createInstance - EditorInterface* createInstance(); - //! @copydoc SCnWindowFactory::supportedFormatsExt - QStringList supportedFormatsExt(); -}; - -#endif // SCNWINDOW_H diff --git a/sources/plugins/scs/scs.pro b/sources/plugins/scs/scs.pro index adf1042..b3f3175 100644 --- a/sources/plugins/scs/scs.pro +++ b/sources/plugins/scs/scs.pro @@ -1,3 +1,4 @@ +QT += concurrent widgets TARGET = $$qtLibraryTarget(scs) TEMPLATE = lib @@ -76,4 +77,7 @@ SOURCES += \ scssyntaxhighlighter.cpp \ scscodecompleter.cpp +OTHER_FILES += \ + scsplugin.json + diff --git a/sources/plugins/scs/scserrortablewidget.cpp b/sources/plugins/scs/scserrortablewidget.cpp index 6c22969..a7161bb 100644 --- a/sources/plugins/scs/scserrortablewidget.cpp +++ b/sources/plugins/scs/scserrortablewidget.cpp @@ -15,22 +15,14 @@ SCsErrorTableWidget::SCsErrorTableWidget(QWidget *parent) : setRowCount(0); setColumnCount(2); - verticalHeader()->setResizeMode(QHeaderView::Fixed); - - QHeaderView *header = new QHeaderView(Qt::Horizontal); - header->setResizeMode(QHeaderView::Fixed); this->setHorizontalHeader(header); setMinimumWidth(200); - this->horizontalHeader()->setMovable(false); hide(); } - - - void SCsErrorTableWidget::doubleClickAtCell(int row, int col) { if(item(row,0)->type() != ERROR_TABLE_WIDGET_ITEM_TYPE) diff --git a/sources/plugins/scs/scsparser/scsasynchparser.cpp b/sources/plugins/scs/scsparser/scsasynchparser.cpp index cbab719..abe33c8 100644 --- a/sources/plugins/scs/scsparser/scsasynchparser.cpp +++ b/sources/plugins/scs/scsparser/scsasynchparser.cpp @@ -24,6 +24,7 @@ along with OSTIS. If not, see . #include "scsparserwrapper.h" #include +#include QSharedPointer parseExceptionsFn(const QString &text) { diff --git a/sources/plugins/scs/scsplugin.cpp b/sources/plugins/scs/scsplugin.cpp index 2ae3d7e..deacade 100644 --- a/sources/plugins/scs/scsplugin.cpp +++ b/sources/plugins/scs/scsplugin.cpp @@ -25,8 +25,6 @@ along with OSTIS. If not, see . #include -Q_EXPORT_PLUGIN2(scs, SCsPlugin) - SCsPlugin::SCsPlugin(QObject *parent) : QObject(parent) { diff --git a/sources/plugins/scs/scsplugin.h b/sources/plugins/scs/scsplugin.h index 019b9af..cbce43c 100644 --- a/sources/plugins/scs/scsplugin.h +++ b/sources/plugins/scs/scsplugin.h @@ -31,6 +31,7 @@ class SCsPlugin : public QObject, public PluginInterface { Q_OBJECT Q_INTERFACES(PluginInterface) + Q_PLUGIN_METADATA(IID "com.OSTIS.kbe.PluginInterface" FILE "scsplugin.json") public: explicit SCsPlugin(QObject *parent = 0); diff --git a/sources/plugins/scs/scsplugin.json b/sources/plugins/scs/scsplugin.json new file mode 100644 index 0000000..8c277fd --- /dev/null +++ b/sources/plugins/scs/scsplugin.json @@ -0,0 +1,3 @@ +{ + "Version": [0, 1, 0] +} diff --git a/sources/plugins/scs/scswindow.cpp b/sources/plugins/scs/scswindow.cpp index 6622319..0a874d1 100644 --- a/sources/plugins/scs/scswindow.cpp +++ b/sources/plugins/scs/scswindow.cpp @@ -48,7 +48,6 @@ SCsWindow::SCsWindow(const QString& _windowTitle, QWidget *parent) QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8")); - QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8")); mErrorTable = new SCsErrorTableWidget(this); From 27f72b597f381a82ee053f0efa7cfc717943ce01 Mon Sep 17 00:00:00 2001 From: Denis Koronchik Date: Sun, 22 Feb 2015 21:51:49 +0300 Subject: [PATCH 37/71] [launchpad] Fixed packaging --- .gitignore | 2 ++ tools/DEBIAN/changelog | 1 + tools/DEBIAN/control | 10 +++++----- tools/launchpad/control | 6 +++--- tools/launchpad/rules | 2 +- tools/make-deb.sh | 4 ++-- tools/make-launchpad.sh | 2 +- 7 files changed, 15 insertions(+), 12 deletions(-) diff --git a/.gitignore b/.gitignore index d666dd5..50360c7 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,5 @@ build-*/* all-build-desktop/* *.qm *.user + +sources/kbe/ui_mainwindow.h diff --git a/tools/DEBIAN/changelog b/tools/DEBIAN/changelog index b87bd16..b4e2a89 100644 --- a/tools/DEBIAN/changelog +++ b/tools/DEBIAN/changelog @@ -6,6 +6,7 @@ kbe (0.3.1-ubuntu) unstable; urgency=low * Fixed plugin loading on linux * Fixed dock widget positions save/load * Fixed main window title + * Port code to use qt5 * scg. Added load/save of content state * scg. Added command to show/hide all contents diff --git a/tools/DEBIAN/control b/tools/DEBIAN/control index 7bf5328..9c8700c 100644 --- a/tools/DEBIAN/control +++ b/tools/DEBIAN/control @@ -1,12 +1,12 @@ Package: kbe -Version: 0.3.0 +Version: 0.3.1 Section: science Priority: optional -Architecture: amd64 -Installed-Size: 21812 -Depends: libc6 (>= 2.3), libgcc1 (>= 1:4.1.1), libqt4-svg (>= 4:4.5.3), libqt4-xml (>= 4:4.5.3), libqt4-xmlpatterns (>= 4:4.5.3), libqtcore4 (>= 4:4.7.0~beta1), libqtgui4 (>= 4:4.7.0~beta1) +Architecture: i386 +Installed-Size: 2064 +Depends: libc6 (>= 2.3), libgcc1 (>= 1:4.1.1), libqt5xml5, libqt5core5, libqt5gui5 Maintainer: Nikita Grishko Homepage: https://github.com/deniskoronchik/kbe Description: KBE - Knowledge Base source Editor. This is a specialized tool that allow to create knowledge bases for intelligent systems based on OSTIS technology. - It include such extensions as SCg-code editor (graphical editor of semantic networks), m4scp editor (editor of scp programs that used to process knowledges), scs editor (string representation of semantic networks) + It include such extensions as SCg-code editor (graphical editor of semantic networks), scs editor (string representation of semantic networks) diff --git a/tools/launchpad/control b/tools/launchpad/control index fede038..a3195d6 100644 --- a/tools/launchpad/control +++ b/tools/launchpad/control @@ -3,11 +3,11 @@ Section: science Priority: optional Maintainer: Denis Koronchik , Nikita Grishko Homepage: https://github.com/deniskoronchik/kbe -Build-Depends: debhelper (>= 8.0.0), cdbs, libqt4-dev, qt4-qmake, libantlr3c-dev +Build-Depends: debhelper (>= 8.0.0), cdbs, qtbase5-dev, qt5-qmake, qt5-default, libantlr3c-dev Package: kbe Architecture: i386 -Depends: libc6 (>= 2.3), libgcc1 (>= 1:4.1.1), libqt4-svg (>= 4:4.5.3), libqt4-xml (>= 4:4.5.3), libqt4-xmlpatterns (>= 4:4.5.3), libqtcore4 (>= 4:4.7.0~beta1), libqtgui4 (>= 4:4.7.0~beta1), libantlr3c-3.2-0 +Depends: libc6 (>= 2.3), libgcc1 (>= 1:4.1.1), libqt5xml5, libqt5core5a, libqt5gui5, libantlr3c-3.2-0 Description: KBE - Knowledge Base source Editor This is a specialized tool that allow to create knowledge bases for intelligent systems based on OSTIS technology. - It include such extensions as SCg-code editor (graphical editor of semantic networks), m4scp editor (editor of scp programs that used to process knowledges), scs editor (string representation of semantic networks) + It include such extensions as SCg-code editor (graphical editor of semantic networks), scs editor (string representation of semantic networks) diff --git a/tools/launchpad/rules b/tools/launchpad/rules index 1c2f79e..a0fb08e 100755 --- a/tools/launchpad/rules +++ b/tools/launchpad/rules @@ -14,6 +14,6 @@ include /usr/share/cdbs/1/rules/debhelper.mk include /usr/share/cdbs/1/class/qmake.mk # Add here any variable or target overrides you need. -QMAKE=qmake-qt4 +QMAKE=qmake CFLAGS=-O3 CXXFLAGS=-O3 diff --git a/tools/make-deb.sh b/tools/make-deb.sh index 50ba932..7fdde2e 100755 --- a/tools/make-deb.sh +++ b/tools/make-deb.sh @@ -21,7 +21,7 @@ install_all_dependencies_if_not_yet_installed() echo -en "\033[37;1;41mCheck dependencies...\033[0m\n" install_dependency_if_not_yet_installed md5deep install_dependency_if_not_yet_installed gcc - install_dependency_if_not_yet_installed qt4-dev-tools + install_dependency_if_not_yet_installed qt5-dev-tools install_dependency_if_not_yet_installed make install_dependency_if_not_yet_installed fakeroot install_dependency_if_not_yet_installed libantlr3c-dev @@ -33,7 +33,7 @@ build_source_files() sed -i 's/Config::pathPlugins = root_dir;/Config::pathPlugins = "\/usr\/lib\/kbe";/' kbe/main.cpp sed -i 's/Config::pathPlugins.cd("plugins");/\/\/Config::pathPlugins.cd("plugins");/' kbe/main.cpp sed '/updater/d' all.pro > all_linux.pro - qmake-qt4 all_linux.pro + qmake all_linux.pro make } diff --git a/tools/make-launchpad.sh b/tools/make-launchpad.sh index 468bcd7..9690ac6 100755 --- a/tools/make-launchpad.sh +++ b/tools/make-launchpad.sh @@ -82,7 +82,7 @@ push_bzr_repo() fi bzr branch lp:kbe kbe_bzr if [ -d "kbe_bzr" ]; then - REVNO=`bzr revno kbe_bzr` + REVNO=`bzr revno lp:kbe` let REVNO+=1 mv kbe_bzr/.bzr .bzr rm -r kbe_bzr From b624132653b8c9848ee26d6ec9ce60b3cd4c90ac Mon Sep 17 00:00:00 2001 From: Denis Koronchik Date: Mon, 9 Mar 2015 21:44:04 +0300 Subject: [PATCH 38/71] [launchpad] Add missed dependencies (#385, #386) --- tools/DEBIAN/control | 2 +- tools/launchpad/control | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/DEBIAN/control b/tools/DEBIAN/control index 9c8700c..15a7915 100644 --- a/tools/DEBIAN/control +++ b/tools/DEBIAN/control @@ -4,7 +4,7 @@ Section: science Priority: optional Architecture: i386 Installed-Size: 2064 -Depends: libc6 (>= 2.3), libgcc1 (>= 1:4.1.1), libqt5xml5, libqt5core5, libqt5gui5 +Depends: libc6 (>= 2.3), libgcc1 (>= 1:4.1.1), libqt5xml5, libqt5core5, libqt5gui5, libqt5concurrent5, libqt5widgets5 Maintainer: Nikita Grishko Homepage: https://github.com/deniskoronchik/kbe Description: KBE - Knowledge Base source Editor. diff --git a/tools/launchpad/control b/tools/launchpad/control index a3195d6..61f2335 100644 --- a/tools/launchpad/control +++ b/tools/launchpad/control @@ -7,7 +7,7 @@ Build-Depends: debhelper (>= 8.0.0), cdbs, qtbase5-dev, qt5-qmake, qt5-default, Package: kbe Architecture: i386 -Depends: libc6 (>= 2.3), libgcc1 (>= 1:4.1.1), libqt5xml5, libqt5core5a, libqt5gui5, libantlr3c-3.2-0 +Depends: libc6 (>= 2.3), libgcc1 (>= 1:4.1.1), libqt5xml5, libqt5core5a, libqt5gui5, libqt5widgets5, libqt5concurrent5, libantlr3c-3.2-0 Description: KBE - Knowledge Base source Editor This is a specialized tool that allow to create knowledge bases for intelligent systems based on OSTIS technology. It include such extensions as SCg-code editor (graphical editor of semantic networks), scs editor (string representation of semantic networks) From 8e37f5e929b822de19a7fd76758dfa847b9aa36c Mon Sep 17 00:00:00 2001 From: Denis Koronchik Date: Sat, 28 Mar 2015 20:41:06 +0300 Subject: [PATCH 39/71] [win32] Fix compilation of scs plugin --- .gitignore | 1 + depends/antlr3c/antlr3.h | 56 ++ depends/antlr3c/antlr3baserecognizer.h | 371 ++++++++++ depends/antlr3c/antlr3basetree.h | 143 ++++ depends/antlr3c/antlr3basetreeadaptor.h | 152 +++++ depends/antlr3c/antlr3bitset.h | 119 ++++ depends/antlr3c/antlr3collections.h | 513 ++++++++++++++ depends/antlr3c/antlr3commontoken.h | 367 ++++++++++ depends/antlr3c/antlr3commontree.h | 167 +++++ depends/antlr3c/antlr3commontreeadaptor.h | 70 ++ depends/antlr3c/antlr3commontreenodestream.h | 336 ++++++++++ depends/antlr3c/antlr3convertutf.h | 176 +++++ depends/antlr3c/antlr3cyclicdfa.h | 97 +++ depends/antlr3c/antlr3debugeventlistener.h | 398 +++++++++++ depends/antlr3c/antlr3defs.h | 632 ++++++++++++++++++ depends/antlr3c/antlr3encodings.h | 38 ++ depends/antlr3c/antlr3errors.h | 53 ++ depends/antlr3c/antlr3exception.h | 218 ++++++ depends/antlr3c/antlr3filestream.h | 50 ++ depends/antlr3c/antlr3input.h | 281 ++++++++ depends/antlr3c/antlr3interfaces.h | 239 +++++++ depends/antlr3c/antlr3intstream.h | 205 ++++++ depends/antlr3c/antlr3lexer.h | 193 ++++++ depends/antlr3c/antlr3memory.h | 36 + depends/antlr3c/antlr3parser.h | 93 +++ depends/antlr3c/antlr3parsetree.h | 85 +++ depends/antlr3c/antlr3recognizersharedstate.h | 218 ++++++ depends/antlr3c/antlr3rewritestreams.h | 180 +++++ depends/antlr3c/antlr3string.h | 272 ++++++++ depends/antlr3c/antlr3tokenstream.h | 303 +++++++++ depends/antlr3c/antlr3treeparser.h | 81 +++ sources/plugins/scs/scs.pro | 15 +- 32 files changed, 6156 insertions(+), 2 deletions(-) create mode 100644 depends/antlr3c/antlr3.h create mode 100644 depends/antlr3c/antlr3baserecognizer.h create mode 100644 depends/antlr3c/antlr3basetree.h create mode 100644 depends/antlr3c/antlr3basetreeadaptor.h create mode 100644 depends/antlr3c/antlr3bitset.h create mode 100644 depends/antlr3c/antlr3collections.h create mode 100644 depends/antlr3c/antlr3commontoken.h create mode 100644 depends/antlr3c/antlr3commontree.h create mode 100644 depends/antlr3c/antlr3commontreeadaptor.h create mode 100644 depends/antlr3c/antlr3commontreenodestream.h create mode 100644 depends/antlr3c/antlr3convertutf.h create mode 100644 depends/antlr3c/antlr3cyclicdfa.h create mode 100644 depends/antlr3c/antlr3debugeventlistener.h create mode 100644 depends/antlr3c/antlr3defs.h create mode 100644 depends/antlr3c/antlr3encodings.h create mode 100644 depends/antlr3c/antlr3errors.h create mode 100644 depends/antlr3c/antlr3exception.h create mode 100644 depends/antlr3c/antlr3filestream.h create mode 100644 depends/antlr3c/antlr3input.h create mode 100644 depends/antlr3c/antlr3interfaces.h create mode 100644 depends/antlr3c/antlr3intstream.h create mode 100644 depends/antlr3c/antlr3lexer.h create mode 100644 depends/antlr3c/antlr3memory.h create mode 100644 depends/antlr3c/antlr3parser.h create mode 100644 depends/antlr3c/antlr3parsetree.h create mode 100644 depends/antlr3c/antlr3recognizersharedstate.h create mode 100644 depends/antlr3c/antlr3rewritestreams.h create mode 100644 depends/antlr3c/antlr3string.h create mode 100644 depends/antlr3c/antlr3tokenstream.h create mode 100644 depends/antlr3c/antlr3treeparser.h diff --git a/.gitignore b/.gitignore index 50360c7..d00e891 100644 --- a/.gitignore +++ b/.gitignore @@ -2,5 +2,6 @@ build-*/* all-build-desktop/* *.qm *.user +*.user.* sources/kbe/ui_mainwindow.h diff --git a/depends/antlr3c/antlr3.h b/depends/antlr3c/antlr3.h new file mode 100644 index 0000000..2ead975 --- /dev/null +++ b/depends/antlr3c/antlr3.h @@ -0,0 +1,56 @@ +#ifndef _ANTLR3_H +#define _ANTLR3_H + +// [The "BSD licence"] +// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC +// http://www.temporal-wave.com +// http://www.linkedin.com/in/jimidle +// +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. The name of the author may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif diff --git a/depends/antlr3c/antlr3baserecognizer.h b/depends/antlr3c/antlr3baserecognizer.h new file mode 100644 index 0000000..0a269d4 --- /dev/null +++ b/depends/antlr3c/antlr3baserecognizer.h @@ -0,0 +1,371 @@ +/** \file + * Defines the basic structure to support recognizing by either a lexer, + * parser, or tree parser. + * \addtogroup ANTLR3_BASE_RECOGNIZER + * @{ + */ +#ifndef _ANTLR3_BASERECOGNIZER_H +#define _ANTLR3_BASERECOGNIZER_H + +// [The "BSD licence"] +// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC +// http://www.temporal-wave.com +// http://www.linkedin.com/in/jimidle +// +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. The name of the author may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include +#include +#include +#include +#include +#include +#include +#include + +/** Type indicator for a lexer recognizer + */ +#define ANTLR3_TYPE_LEXER 0x0001 + +/** Type indicator for a parser recognizer + */ +#define ANTLR3_TYPE_PARSER 0x0002 + +/** Type indicator for a tree parser recognizer + */ +#define ANTLR3_TYPE_TREE_PARSER 0x0004 + +#ifdef __cplusplus +extern "C" { +#endif + +/** \brief Base tracking context structure for all types of + * recognizers. + */ +typedef struct ANTLR3_BASE_RECOGNIZER_struct +{ + /// Whatever super structure is providing this interface needs a pointer to itself + /// so that this can be passed back to it whenever the api functions + /// are called back from here. + /// + void * super; + + /// Indicates the type of recognizer that we are an instance of. + /// The programmer may set this to anything of course, but the default + /// implementations of the interface only really understand the built in + /// types, so new error handlers etc would probably be required to as well. + /// + /// Valid types are: + /// + /// - #ANTLR3_TYPE_LEXER + /// - #ANTLR3_TYPE_PARSER + /// - #ANTLR3_TYPE_TREE_PARSER + /// + ANTLR3_UINT32 type; + + /// A pointer to the shared recognizer state, such that multiple + /// recognizers can use the same inputs streams and so on (in + /// the case of grammar inheritance for instance. + /// + pANTLR3_RECOGNIZER_SHARED_STATE state; + + /// If set to something other than NULL, then this structure is + /// points to an instance of the debugger interface. In general, the + /// debugger is only referenced internally in recovery/error operations + /// so that it does not cause overhead by having to check this pointer + /// in every function/method + /// + pANTLR3_DEBUG_EVENT_LISTENER debugger; + + + /// Pointer to a function that matches the current input symbol + /// against the supplied type. the function causes an error if a + /// match is not found and the default implementation will also + /// attempt to perform one token insertion or deletion if that is + /// possible with the input stream. You can override the default + /// implementation by installing a pointer to your own function + /// in this interface after the recognizer has initialized. This can + /// perform different recovery options or not recover at all and so on. + /// To ignore recovery altogether, see the comments in the default + /// implementation of this function in antlr3baserecognizer.c + /// + /// Note that errors are signalled by setting the error flag below + /// and creating a new exception structure and installing it in the + /// exception pointer below (you can chain these if you like and handle them + /// in some customized way). + /// + void * (*match) (struct ANTLR3_BASE_RECOGNIZER_struct * recognizer, + ANTLR3_UINT32 ttype, pANTLR3_BITSET_LIST follow); + + /// Pointer to a function that matches the next token/char in the input stream + /// regardless of what it actually is. + /// + void (*matchAny) (struct ANTLR3_BASE_RECOGNIZER_struct * recognizer); + + /// Pointer to a function that decides if the token ahead of the current one is the + /// one we were loking for, in which case the curernt one is very likely extraneous + /// and can be reported that way. + /// + ANTLR3_BOOLEAN + (*mismatchIsUnwantedToken) (struct ANTLR3_BASE_RECOGNIZER_struct * recognizer, pANTLR3_INT_STREAM input, ANTLR3_UINT32 ttype); + + /// Pointer to a function that decides if the current token is one that can logically + /// follow the one we were looking for, in which case the one we were looking for is + /// probably missing from the input. + /// + ANTLR3_BOOLEAN + (*mismatchIsMissingToken) (struct ANTLR3_BASE_RECOGNIZER_struct * recognizer, pANTLR3_INT_STREAM input, pANTLR3_BITSET_LIST follow); + + /** Pointer to a function that works out what to do when a token mismatch + * occurs, so that Tree parsers can behave differently to other recognizers. + */ + void (*mismatch) (struct ANTLR3_BASE_RECOGNIZER_struct * recognizer, + ANTLR3_UINT32 ttype, pANTLR3_BITSET_LIST follow); + + /** Pointer to a function to call to report a recognition problem. You may override + * this function with your own function, but refer to the standard implementation + * in antlr3baserecognizer.c for guidance. The function should recognize whether + * error recovery is in force, so that it does not print out more than one error messages + * for the same error. From the java comments in BaseRecognizer.java: + * + * This method sets errorRecovery to indicate the parser is recovering + * not parsing. Once in recovery mode, no errors are generated. + * To get out of recovery mode, the parser must successfully match + * a token (after a resync). So it will go: + * + * 1. error occurs + * 2. enter recovery mode, report error + * 3. consume until token found in resynch set + * 4. try to resume parsing + * 5. next match() will reset errorRecovery mode + */ + void (*reportError) (struct ANTLR3_BASE_RECOGNIZER_struct * recognizer); + + /** Pointer to a function that is called to display a recognition error message. You may + * override this function independently of (*reportError)() above as that function calls + * this one to do the actual exception printing. + */ + void (*displayRecognitionError) (struct ANTLR3_BASE_RECOGNIZER_struct * recognizer, pANTLR3_UINT8 * tokenNames); + + /// Get number of recognition errors (lexer, parser, tree parser). Each + /// recognizer tracks its own number. So parser and lexer each have + /// separate count. Does not count the spurious errors found between + /// an error and next valid token match + /// + /// \see reportError() + /// + ANTLR3_UINT32 + (*getNumberOfSyntaxErrors) (struct ANTLR3_BASE_RECOGNIZER_struct * recognizer); + + /** Pointer to a function that recovers from an error found in the input stream. + * Generally, this will be a #ANTLR3_EXCEPTION_NOVIABLE_ALT but it could also + * be from a mismatched token that the (*match)() could not recover from. + */ + void (*recover) (struct ANTLR3_BASE_RECOGNIZER_struct * recognizer); + + /** Pointer to a function that is a hook to listen to token consumption during error recovery. + * This is mainly used by the debug parser to send events to the listener. + */ + void (*beginResync) (struct ANTLR3_BASE_RECOGNIZER_struct * recognizer); + + /** Pointer to a function that is a hook to listen to token consumption during error recovery. + * This is mainly used by the debug parser to send events to the listener. + */ + void (*endResync) (struct ANTLR3_BASE_RECOGNIZER_struct * recognizer); + + /** Pointer to a function that is a hook to listen to token consumption during error recovery. + * This is mainly used by the debug parser to send events to the listener. + */ + void (*beginBacktrack) (struct ANTLR3_BASE_RECOGNIZER_struct * recognizer, ANTLR3_UINT32 level); + + /** Pointer to a function that is a hook to listen to token consumption during error recovery. + * This is mainly used by the debug parser to send events to the listener. + */ + void (*endBacktrack) (struct ANTLR3_BASE_RECOGNIZER_struct * recognizer, ANTLR3_UINT32 level, ANTLR3_BOOLEAN successful); + + /** Pointer to a function to computer the error recovery set for the current rule. + * \see antlr3ComputeErrorRecoverySet() for details. + */ + pANTLR3_BITSET (*computeErrorRecoverySet) (struct ANTLR3_BASE_RECOGNIZER_struct * recognizer); + + /** Pointer to a function that computes the context-sensitive FOLLOW set for the + * current rule. + * \see antlr3ComputeCSRuleFollow() for details. + */ + pANTLR3_BITSET (*computeCSRuleFollow) (struct ANTLR3_BASE_RECOGNIZER_struct * recognizer); + + /** Pointer to a function to combine follow bitsets. + * \see antlr3CombineFollows() for details. + */ + pANTLR3_BITSET (*combineFollows) (struct ANTLR3_BASE_RECOGNIZER_struct * recognizer, + ANTLR3_BOOLEAN exact); + + /** Pointer to a function that recovers from a mismatched token in the input stream. + * \see antlr3RecoverMismatch() for details. + */ + void * (*recoverFromMismatchedToken) + (struct ANTLR3_BASE_RECOGNIZER_struct * recognizer, + ANTLR3_UINT32 ttype, + pANTLR3_BITSET_LIST follow); + + /** Pointer to a function that recovers from a mismatched set in the token stream, in a similar manner + * to (*recoverFromMismatchedToken) + */ + void * (*recoverFromMismatchedSet) (struct ANTLR3_BASE_RECOGNIZER_struct * recognizer, + pANTLR3_BITSET_LIST follow); + + /** Pointer to common routine to handle single token insertion for recovery functions. + */ + ANTLR3_BOOLEAN (*recoverFromMismatchedElement) + (struct ANTLR3_BASE_RECOGNIZER_struct * recognizer, + pANTLR3_BITSET_LIST follow); + + /** Pointer to function that consumes input until the next token matches + * the given token. + */ + void (*consumeUntil) (struct ANTLR3_BASE_RECOGNIZER_struct * recognizer, + ANTLR3_UINT32 tokenType); + + /** Pointer to function that consumes input until the next token matches + * one in the given set. + */ + void (*consumeUntilSet) (struct ANTLR3_BASE_RECOGNIZER_struct * recognizer, + pANTLR3_BITSET set); + + /** Pointer to function that returns an ANTLR3_LIST of the strings that identify + * the rules in the parser that got you to this point. Can be overridden by installing your + * own function set. + * + * \todo Document how to override invocation stack functions. + */ + pANTLR3_STACK (*getRuleInvocationStack) (struct ANTLR3_BASE_RECOGNIZER_struct * recognizer); + pANTLR3_STACK (*getRuleInvocationStackNamed) (struct ANTLR3_BASE_RECOGNIZER_struct * recognizer, + pANTLR3_UINT8 name); + + /** Pointer to a function that converts an ANLR3_LIST of tokens to an ANTLR3_LIST of + * string token names. As this is mostly used in string template processing it may not be useful + * in the C runtime. + */ + pANTLR3_HASH_TABLE (*toStrings) (struct ANTLR3_BASE_RECOGNIZER_struct * recognizer, + pANTLR3_HASH_TABLE); + + /** Pointer to a function to return whether the rule has parsed input starting at the supplied + * start index before. If the rule has not parsed input starting from the supplied start index, + * then it will return ANTLR3_MEMO_RULE_UNKNOWN. If it has parsed from the suppled start point + * then it will return the point where it last stopped parsing after that start point. + */ + ANTLR3_MARKER (*getRuleMemoization) (struct ANTLR3_BASE_RECOGNIZER_struct * recognizer, + ANTLR3_INTKEY ruleIndex, + ANTLR3_MARKER ruleParseStart); + + /** Pointer to function that determines whether the rule has parsed input at the current index + * in the input stream + */ + ANTLR3_BOOLEAN (*alreadyParsedRule) (struct ANTLR3_BASE_RECOGNIZER_struct * recognizer, + ANTLR3_MARKER ruleIndex); + + /** Pointer to function that records whether the rule has parsed the input at a + * current position successfully or not. + */ + void (*memoize) (struct ANTLR3_BASE_RECOGNIZER_struct * recognizer, + ANTLR3_MARKER ruleIndex, + ANTLR3_MARKER ruleParseStart); + + /// Pointer to a function that returns the current input symbol. + /// The is placed into any label for the associated token ref; e.g., x=ID. Token + /// and tree parsers need to return different objects. Rather than test + /// for input stream type or change the IntStream interface, I use + /// a simple method to ask the recognizer to tell me what the current + /// input symbol is. + /// + /// This is ignored for lexers and the lexer implementation of this + /// function should return NULL. + /// + void * (*getCurrentInputSymbol) ( struct ANTLR3_BASE_RECOGNIZER_struct * recognizer, + pANTLR3_INT_STREAM istream); + + /// Conjure up a missing token during error recovery. + /// + /// The recognizer attempts to recover from single missing + /// symbols. But, actions might refer to that missing symbol. + /// For example, x=ID {f($x);}. The action clearly assumes + /// that there has been an identifier matched previously and that + /// $x points at that token. If that token is missing, but + /// the next token in the stream is what we want we assume that + /// this token is missing and we keep going. Because we + /// have to return some token to replace the missing token, + /// we have to conjure one up. This method gives the user control + /// over the tokens returned for missing tokens. Mostly, + /// you will want to create something special for identifier + /// tokens. For literals such as '{' and ',', the default + /// action in the parser or tree parser works. It simply creates + /// a CommonToken of the appropriate type. The text will be the token. + /// If you change what tokens must be created by the lexer, + /// override this method to create the appropriate tokens. + /// + void * (*getMissingSymbol) ( struct ANTLR3_BASE_RECOGNIZER_struct * recognizer, + pANTLR3_INT_STREAM istream, + pANTLR3_EXCEPTION e, + ANTLR3_UINT32 expectedTokenType, + pANTLR3_BITSET_LIST follow); + + /** Pointer to a function that returns whether the supplied grammar function + * will parse the current input stream or not. This is the way that syntactic + * predicates are evaluated. Unlike java, C is perfectly happy to invoke code + * via a pointer to a function (hence that's what all the ANTLR3 C interfaces + * do. + */ + ANTLR3_BOOLEAN (*synpred) ( struct ANTLR3_BASE_RECOGNIZER_struct * recognizer, void * ctx, + void (*predicate)(void * ctx)); + + /** Pointer to a function that can construct a generic exception structure + * with such information as the input stream can provide. + */ + void (*exConstruct) (struct ANTLR3_BASE_RECOGNIZER_struct * recognizer); + + /** Reset the recognizer + */ + void (*reset) (struct ANTLR3_BASE_RECOGNIZER_struct * recognizer); + + /** Pointer to a function that knows how to free the resources of a base recognizer. + */ + void (*free) (struct ANTLR3_BASE_RECOGNIZER_struct * recognizer); + +} + ANTLR3_BASE_RECOGNIZER; + +#ifdef __cplusplus +} +#endif + +#include +#include +#include + +/// @} +/// + +#endif /* _ANTLR3_BASERECOGNIZER_H */ + diff --git a/depends/antlr3c/antlr3basetree.h b/depends/antlr3c/antlr3basetree.h new file mode 100644 index 0000000..023c4c2 --- /dev/null +++ b/depends/antlr3c/antlr3basetree.h @@ -0,0 +1,143 @@ +/// \file +/// Definition of the ANTLR3 base tree. +/// + +#ifndef _ANTLR3_BASE_TREE_H +#define _ANTLR3_BASE_TREE_H + +// [The "BSD licence"] +// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC +// http://www.temporal-wave.com +// http://www.linkedin.com/in/jimidle +// +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. The name of the author may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/// A generic tree implementation with no payload. You must subclass to +/// actually have any user data. ANTLR v3 uses a list of children approach +/// instead of the child-sibling approach in v2. A flat tree (a list) is +/// an empty node whose children represent the list. An empty (as in it does not +/// have payload itself), but non-null node is called "nil". +/// +typedef struct ANTLR3_BASE_TREE_struct +{ + + /// Implementers of this interface sometimes require a pointer to their selves. + /// + void * super; + + /// Generic void pointer allows the grammar programmer to attach any structure they + /// like to a tree node, in many cases saving the need to create their own tree + /// and tree adaptors. ANTLR does not use this pointer, but will copy it for you and so on. + /// + void * u; + + /// The list of all the children that belong to this node. They are not part of the node + /// as they belong to the common tree node that implements this. + /// + pANTLR3_VECTOR children; + + /// This is used to store the current child index position while descending + /// and ascending trees as the tree walk progresses. + /// + ANTLR3_MARKER savedIndex; + + /// A string factory to produce strings for toString etc + /// + pANTLR3_STRING_FACTORY strFactory; + + /// A pointer to a function that returns the common token pointer + /// for the payload in the supplied tree. + /// + pANTLR3_COMMON_TOKEN (*getToken) (struct ANTLR3_BASE_TREE_struct * tree); + + void (*addChild) (struct ANTLR3_BASE_TREE_struct * tree, void * child); + + void (*addChildren) (struct ANTLR3_BASE_TREE_struct * tree, pANTLR3_LIST kids); + + void (*createChildrenList) (struct ANTLR3_BASE_TREE_struct * tree); + + void * (*deleteChild) (struct ANTLR3_BASE_TREE_struct * tree, ANTLR3_UINT32 i); + + void (*replaceChildren) (struct ANTLR3_BASE_TREE_struct * parent, ANTLR3_INT32 startChildIndex, ANTLR3_INT32 stopChildIndex, struct ANTLR3_BASE_TREE_struct * t); + + void * (*dupNode) (struct ANTLR3_BASE_TREE_struct * dupNode); + + void * (*dupTree) (struct ANTLR3_BASE_TREE_struct * tree); + + ANTLR3_UINT32 (*getCharPositionInLine) (struct ANTLR3_BASE_TREE_struct * tree); + + void * (*getChild) (struct ANTLR3_BASE_TREE_struct * tree, ANTLR3_UINT32 i); + + void (*setChildIndex) (struct ANTLR3_BASE_TREE_struct * tree, ANTLR3_INT32 ); + + ANTLR3_INT32 (*getChildIndex) (struct ANTLR3_BASE_TREE_struct * tree ); + + ANTLR3_UINT32 (*getChildCount) (struct ANTLR3_BASE_TREE_struct * tree); + + struct ANTLR3_BASE_TREE_struct * (*getParent) (struct ANTLR3_BASE_TREE_struct * tree); + + void (*setParent) (struct ANTLR3_BASE_TREE_struct * tree, struct ANTLR3_BASE_TREE_struct * parent); + + ANTLR3_UINT32 (*getType) (struct ANTLR3_BASE_TREE_struct * tree); + + void * (*getFirstChildWithType) (struct ANTLR3_BASE_TREE_struct * tree, ANTLR3_UINT32 type); + + ANTLR3_UINT32 (*getLine) (struct ANTLR3_BASE_TREE_struct * tree); + + pANTLR3_STRING (*getText) (struct ANTLR3_BASE_TREE_struct * tree); + + ANTLR3_BOOLEAN (*isNilNode) (struct ANTLR3_BASE_TREE_struct * tree); + + void (*setChild) (struct ANTLR3_BASE_TREE_struct * tree, ANTLR3_UINT32 i, void * child); + + pANTLR3_STRING (*toStringTree) (struct ANTLR3_BASE_TREE_struct * tree); + + pANTLR3_STRING (*toString) (struct ANTLR3_BASE_TREE_struct * tree); + + void (*freshenPACIndexesAll) (struct ANTLR3_BASE_TREE_struct * tree); + + void (*freshenPACIndexes) (struct ANTLR3_BASE_TREE_struct * tree, ANTLR3_UINT32 offset); + + void (*reuse) (struct ANTLR3_BASE_TREE_struct * tree); + + void (*free) (struct ANTLR3_BASE_TREE_struct * tree); + +} + ANTLR3_BASE_TREE; + +#ifdef __cplusplus +} +#endif + + +#endif diff --git a/depends/antlr3c/antlr3basetreeadaptor.h b/depends/antlr3c/antlr3basetreeadaptor.h new file mode 100644 index 0000000..bf9a72a --- /dev/null +++ b/depends/antlr3c/antlr3basetreeadaptor.h @@ -0,0 +1,152 @@ +/** \file + * Definition of the ANTLR3 base tree adaptor. + */ + +#ifndef _ANTLR3_BASE_TREE_ADAPTOR_H +#define _ANTLR3_BASE_TREE_ADAPTOR_H + +// [The "BSD licence"] +// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC +// http://www.temporal-wave.com +// http://www.linkedin.com/in/jimidle +// +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. The name of the author may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include +#include +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct ANTLR3_BASE_TREE_ADAPTOR_struct +{ + /** Pointer to any enclosing structure/interface that + * contains this structure. + */ + void * super; + + /** We need a string factory for creating imaginary tokens, we take this + * from the stream we are supplied to walk. + */ + pANTLR3_STRING_FACTORY strFactory; + + /* And we also need a token factory for creating imaginary tokens + * this is also taken from the input source. + */ + pANTLR3_TOKEN_FACTORY tokenFactory; + + /// If set to something other than NULL, then this structure is + /// points to an instance of the debugger interface. In general, the + /// debugger is only referenced internally in recovery/error operations + /// so that it does not cause overhead by having to check this pointer + /// in every function/method + /// + pANTLR3_DEBUG_EVENT_LISTENER debugger; + + void * (*nilNode) (struct ANTLR3_BASE_TREE_ADAPTOR_struct * adaptor); + + + void * (*dupTree) (struct ANTLR3_BASE_TREE_ADAPTOR_struct * adaptor, void * tree); + void * (*dupTreeTT) (struct ANTLR3_BASE_TREE_ADAPTOR_struct * adaptor, void * t, void * tree); + + void (*addChild) (struct ANTLR3_BASE_TREE_ADAPTOR_struct * adaptor, void * t, void * child); + void (*addChildToken) (struct ANTLR3_BASE_TREE_ADAPTOR_struct * adaptor, void * t, pANTLR3_COMMON_TOKEN child); + void (*setParent) (struct ANTLR3_BASE_TREE_ADAPTOR_struct * adaptor, void * child, void * parent); + void * (*getParent) (struct ANTLR3_BASE_TREE_ADAPTOR_struct * adaptor, void * child); + + void * (*errorNode) (struct ANTLR3_BASE_TREE_ADAPTOR_struct * adaptor, pANTLR3_TOKEN_STREAM tnstream, pANTLR3_COMMON_TOKEN startToken, pANTLR3_COMMON_TOKEN stopToken, pANTLR3_EXCEPTION e); + ANTLR3_BOOLEAN (*isNilNode) (struct ANTLR3_BASE_TREE_ADAPTOR_struct * adaptor, void * t); + + void * (*becomeRoot) (struct ANTLR3_BASE_TREE_ADAPTOR_struct * adaptor, void * newRoot, void * oldRoot); + + void * (*rulePostProcessing) (struct ANTLR3_BASE_TREE_ADAPTOR_struct * adaptor, void * root); + + void * (*becomeRootToken) (struct ANTLR3_BASE_TREE_ADAPTOR_struct * adaptor, void * newRoot, void * oldRoot); + + void * (*create) (struct ANTLR3_BASE_TREE_ADAPTOR_struct * adaptor, pANTLR3_COMMON_TOKEN payload); + void * (*createTypeToken) (struct ANTLR3_BASE_TREE_ADAPTOR_struct * adaptor, ANTLR3_UINT32 tokenType, pANTLR3_COMMON_TOKEN fromToken); + void * (*createTypeTokenText) (struct ANTLR3_BASE_TREE_ADAPTOR_struct * adaptor, ANTLR3_UINT32 tokenType, pANTLR3_COMMON_TOKEN fromToken, pANTLR3_UINT8 text); + void * (*createTypeText) (struct ANTLR3_BASE_TREE_ADAPTOR_struct * adaptor, ANTLR3_UINT32 tokenType, pANTLR3_UINT8 text); + + void * (*dupNode) (struct ANTLR3_BASE_TREE_ADAPTOR_struct * adaptor, void * treeNode); + + ANTLR3_UINT32 (*getType) (struct ANTLR3_BASE_TREE_ADAPTOR_struct * adaptor, void * t); + + void (*setType) (struct ANTLR3_BASE_TREE_ADAPTOR_struct * adaptor, void * t, ANTLR3_UINT32 type); + + pANTLR3_STRING (*getText) (struct ANTLR3_BASE_TREE_ADAPTOR_struct * adaptor, void * t); + + void (*setText) (struct ANTLR3_BASE_TREE_ADAPTOR_struct * adaptor, pANTLR3_STRING t); + void (*setText8) (struct ANTLR3_BASE_TREE_ADAPTOR_struct * adaptor, pANTLR3_UINT8 t); + + void * (*getChild) (struct ANTLR3_BASE_TREE_ADAPTOR_struct * adaptor, void * t, ANTLR3_UINT32 i); + void (*setChild) (struct ANTLR3_BASE_TREE_ADAPTOR_struct * adaptor, void * t, ANTLR3_UINT32 i, void * child); + void (*deleteChild) (struct ANTLR3_BASE_TREE_ADAPTOR_struct * adaptor, void * t, ANTLR3_UINT32 i); + void (*setChildIndex) (struct ANTLR3_BASE_TREE_ADAPTOR_struct * adaptor, void * t, ANTLR3_UINT32 i); + ANTLR3_INT32 (*getChildIndex) (struct ANTLR3_BASE_TREE_ADAPTOR_struct * adaptor, void * t); + + ANTLR3_UINT32 (*getChildCount) (struct ANTLR3_BASE_TREE_ADAPTOR_struct * adaptor, void *); + + ANTLR3_UINT32 (*getUniqueID) (struct ANTLR3_BASE_TREE_ADAPTOR_struct * adaptor, void *); + + pANTLR3_COMMON_TOKEN (*createToken) (struct ANTLR3_BASE_TREE_ADAPTOR_struct * adaptor, ANTLR3_UINT32 tokenType, pANTLR3_UINT8 text); + pANTLR3_COMMON_TOKEN (*createTokenFromToken) (struct ANTLR3_BASE_TREE_ADAPTOR_struct * adaptor, pANTLR3_COMMON_TOKEN fromToken); + pANTLR3_COMMON_TOKEN (*getToken) (struct ANTLR3_BASE_TREE_ADAPTOR_struct * adaptor, void * t); + + void (*setTokenBoundaries) (struct ANTLR3_BASE_TREE_ADAPTOR_struct * adaptor, void * t, pANTLR3_COMMON_TOKEN startToken, pANTLR3_COMMON_TOKEN stopToken); + + ANTLR3_MARKER (*getTokenStartIndex) (struct ANTLR3_BASE_TREE_ADAPTOR_struct * adaptor, void * t); + + ANTLR3_MARKER (*getTokenStopIndex) (struct ANTLR3_BASE_TREE_ADAPTOR_struct * adaptor, void * t); + + void (*setDebugEventListener)(struct ANTLR3_BASE_TREE_ADAPTOR_struct * adaptor, pANTLR3_DEBUG_EVENT_LISTENER debugger); + + /// Produce a DOT (see graphviz freeware suite) from a base tree + /// + pANTLR3_STRING (*makeDot) (struct ANTLR3_BASE_TREE_ADAPTOR_struct * adaptor, void * theTree); + + /// Replace from start to stop child index of parent with t, which might + /// be a list. Number of children may be different + /// after this call. + /// + /// If parent is null, don't do anything; must be at root of overall tree. + /// Can't replace whatever points to the parent externally. Do nothing. + /// + void (*replaceChildren) (struct ANTLR3_BASE_TREE_ADAPTOR_struct * adaptor, void * parent, ANTLR3_INT32 startChildIndex, ANTLR3_INT32 stopChildIndex, void * t); + + void (*free) (struct ANTLR3_BASE_TREE_ADAPTOR_struct * adaptor); + +} + ANTLR3_TREE_ADAPTOR, *pANTLR3_TREE_ADAPTOR; +#ifdef __cplusplus +} +#endif + +#endif diff --git a/depends/antlr3c/antlr3bitset.h b/depends/antlr3c/antlr3bitset.h new file mode 100644 index 0000000..7d816ab --- /dev/null +++ b/depends/antlr3c/antlr3bitset.h @@ -0,0 +1,119 @@ +/** + * \file + * Defines the basic structures of an ANTLR3 bitset. this is a C version of the + * cut down Bitset class provided with the java version of antlr 3. + * + * + */ +#ifndef _ANTLR3_BITSET_H +#define _ANTLR3_BITSET_H + +// [The "BSD licence"] +// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC +// http://www.temporal-wave.com +// http://www.linkedin.com/in/jimidle +// +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. The name of the author may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include +#include + +/** How many bits in the elements + */ +#define ANTLR3_BITSET_BITS 64 + +/** How many bits in a nible of bits + */ +#define ANTLR3_BITSET_NIBBLE 4 + +/** log2 of ANTLR3_BITSET_BITS 2^ANTLR3_BITSET_LOG_BITS = ANTLR3_BITSET_BITS + */ +#define ANTLR3_BITSET_LOG_BITS 6 + +/** We will often need to do a mod operator (i mod nbits). + * For powers of two, this mod operation is the + * same as: + * - (i & (nbits-1)). + * + * Since mod is relatively slow, we use an easily + * precomputed mod mask to do the mod instead. + */ +#define ANTLR3_BITSET_MOD_MASK ANTLR3_BITSET_BITS - 1 + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct ANTLR3_BITSET_LIST_struct +{ + /// Pointer to the allocated array of bits for this bit set, which + /// is an array of 64 bit elements (of the architecture). If we find a + /// machine/C compiler that does not know anything about 64 bit values + /// then it should be easy enough to produce a 32 bit (or less) version + /// of the bitset code. Note that the pointer here may be static if laid down + /// by the code generation, and it must be copied if it is to be manipulated + /// to perform followset calculations. + /// + pANTLR3_BITWORD bits; + + /// Length of the current bit set in ANTLR3_UINT64 units. + /// + ANTLR3_UINT32 length; +} + ANTLR3_BITSET_LIST; + +typedef struct ANTLR3_BITSET_struct +{ + /// The actual bits themselves + /// + ANTLR3_BITSET_LIST blist; + + pANTLR3_BITSET (*clone) (struct ANTLR3_BITSET_struct * inSet); + pANTLR3_BITSET (*bor) (struct ANTLR3_BITSET_struct * bitset1, struct ANTLR3_BITSET_struct * bitset2); + void (*borInPlace) (struct ANTLR3_BITSET_struct * bitset, struct ANTLR3_BITSET_struct * bitset2); + ANTLR3_UINT32 (*size) (struct ANTLR3_BITSET_struct * bitset); + void (*add) (struct ANTLR3_BITSET_struct * bitset, ANTLR3_INT32 bit); + void (*grow) (struct ANTLR3_BITSET_struct * bitset, ANTLR3_INT32 newSize); + ANTLR3_BOOLEAN (*equals) (struct ANTLR3_BITSET_struct * bitset1, struct ANTLR3_BITSET_struct * bitset2); + ANTLR3_BOOLEAN (*isMember) (struct ANTLR3_BITSET_struct * bitset, ANTLR3_UINT32 bit); + ANTLR3_UINT32 (*numBits) (struct ANTLR3_BITSET_struct * bitset); + void (*remove) (struct ANTLR3_BITSET_struct * bitset, ANTLR3_UINT32 bit); + ANTLR3_BOOLEAN (*isNilNode) (struct ANTLR3_BITSET_struct * bitset); + pANTLR3_INT32 (*toIntList) (struct ANTLR3_BITSET_struct * bitset); + + void (*free) (struct ANTLR3_BITSET_struct * bitset); + + +} + ANTLR3_BITSET; + +#ifdef __cplusplus +} +#endif + + + +#endif + diff --git a/depends/antlr3c/antlr3collections.h b/depends/antlr3c/antlr3collections.h new file mode 100644 index 0000000..7c73e36 --- /dev/null +++ b/depends/antlr3c/antlr3collections.h @@ -0,0 +1,513 @@ +#ifndef ANTLR3COLLECTIONS_H +#define ANTLR3COLLECTIONS_H + +// [The "BSD licence"] +// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC +// http://www.temporal-wave.com +// http://www.linkedin.com/in/jimidle +// +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. The name of the author may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include +#include + +#define ANTLR3_HASH_TYPE_INT 0 /**< Indicates the hashed file has integer keys */ +#define ANTLR3_HASH_TYPE_STR 1 /**< Indicates the hashed file has numeric keys */ + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct ANTLR3_HASH_KEY_struct +{ + ANTLR3_UINT8 type; /**< One of ##ANTLR3_HASH_TYPE_INT or ##ANTLR3_HASH_TYPE_STR */ + + union + { + pANTLR3_UINT8 sKey; /**< Used if type is ANTLR3_HASH_TYPE_STR */ + ANTLR3_INTKEY iKey; /**< used if type is ANTLR3_HASH_TYPE_INT */ + } + key; + +} ANTLR3_HASH_KEY, *pANTLR3_HASH_KEY; + +/** Internal structure representing an element in a hash bucket. + * Stores the original key so that duplicate keys can be rejected + * if necessary, and contains function can be supported. If the hash key + * could be unique I would have invented the perfect compression algorithm ;-) + */ +typedef struct ANTLR3_HASH_ENTRY_struct +{ + /** Key that created this particular entry + */ + ANTLR3_HASH_KEY keybase; + + /** Pointer to the data for this particular entry + */ + void * data; + + /** Pointer to routine that knows how to release the memory + * structure pointed at by data. If this is NULL then we assume + * that the data pointer does not need to be freed when the entry + * is deleted from the table. + */ + void (ANTLR3_CDECL *free)(void * data); + + /** Pointer to the next entry in this bucket if there + * is one. Sometimes different keys will hash to the same bucket (especially + * if the number of buckets is small). We could implement dual hashing algorithms + * to minimize this, but that seems over the top for what this is needed for. + */ + struct ANTLR3_HASH_ENTRY_struct * nextEntry; +} + ANTLR3_HASH_ENTRY; + +/** Internal structure of a hash table bucket, which tracks + * all keys that hash to the same bucket. + */ +typedef struct ANTLR3_HASH_BUCKET_struct +{ + /** Pointer to the first entry in the bucket (if any, it + * may be NULL). Duplicate entries are chained from + * here. + */ + pANTLR3_HASH_ENTRY entries; + +} + ANTLR3_HASH_BUCKET; + +/** Structure that tracks a hash table + */ +typedef struct ANTLR3_HASH_TABLE_struct +{ + /** Indicates whether the table allows duplicate keys + */ + int allowDups; + + /** Number of buckets available in this table + */ + ANTLR3_UINT32 modulo; + + /** Points to the memory where the array of buckets + * starts. + */ + pANTLR3_HASH_BUCKET buckets; + + /** How many elements currently exist in the table. + */ + ANTLR3_UINT32 count; + + /** Whether the hash table should strdup the keys it is given or not. + */ + ANTLR3_BOOLEAN doStrdup; + + /** Pointer to function to completely delete this table + */ + void (*free) (struct ANTLR3_HASH_TABLE_struct * table); + + /* String keyed hashtable functions */ + void (*del) (struct ANTLR3_HASH_TABLE_struct * table, void * key); + pANTLR3_HASH_ENTRY (*remove) (struct ANTLR3_HASH_TABLE_struct * table, void * key); + void * (*get) (struct ANTLR3_HASH_TABLE_struct * table, void * key); + ANTLR3_INT32 (*put) (struct ANTLR3_HASH_TABLE_struct * table, void * key, void * element, void (ANTLR3_CDECL *freeptr)(void *)); + + /* Integer based hash functions */ + void (*delI) (struct ANTLR3_HASH_TABLE_struct * table, ANTLR3_INTKEY key); + pANTLR3_HASH_ENTRY (*removeI) (struct ANTLR3_HASH_TABLE_struct * table, ANTLR3_INTKEY key); + void * (*getI) (struct ANTLR3_HASH_TABLE_struct * table, ANTLR3_INTKEY key); + ANTLR3_INT32 (*putI) (struct ANTLR3_HASH_TABLE_struct * table, ANTLR3_INTKEY key, void * element, void (ANTLR3_CDECL *freeptr)(void *)); + + ANTLR3_UINT32 (*size) (struct ANTLR3_HASH_TABLE_struct * table); +} + ANTLR3_HASH_TABLE; + + +/** Internal structure representing an enumeration of a table. + * This is returned by antlr3Enumeration() + * Allows the programmer to traverse the table in hash order without + * knowing what is in the actual table. + * + * Note that it is up to the caller to ensure that the table + * structure does not change in the hash bucket that is currently being + * enumerated as this structure just tracks the next pointers in the + * bucket series. + */ +typedef struct ANTLR3_HASH_ENUM_struct +{ + /* Pointer to the table we are enumerating + */ + pANTLR3_HASH_TABLE table; + + /* Bucket we are currently enumerating (if NULL then we are done) + */ + ANTLR3_UINT32 bucket; + + /* Next entry to return, if NULL, then move to next bucket if any + */ + pANTLR3_HASH_ENTRY entry; + + /* Interface + */ + int (*next) (struct ANTLR3_HASH_ENUM_struct * en, pANTLR3_HASH_KEY *key, void ** data); + void (*free) (struct ANTLR3_HASH_ENUM_struct * table); +} + ANTLR3_HASH_ENUM; + +/** Structure that represents a LIST collection + */ +typedef struct ANTLR3_LIST_struct +{ + /** Hash table that is storing the list elements + */ + pANTLR3_HASH_TABLE table; + + void (*free) (struct ANTLR3_LIST_struct * list); + void (*del) (struct ANTLR3_LIST_struct * list, ANTLR3_INTKEY key); + void * (*get) (struct ANTLR3_LIST_struct * list, ANTLR3_INTKEY key); + void * (*remove) (struct ANTLR3_LIST_struct * list, ANTLR3_INTKEY key); + ANTLR3_INT32 (*add) (struct ANTLR3_LIST_struct * list, void * element, void (ANTLR3_CDECL *freeptr)(void *)); + ANTLR3_INT32 (*put) (struct ANTLR3_LIST_struct * list, ANTLR3_INTKEY key, void * element, void (ANTLR3_CDECL *freeptr)(void *)); + ANTLR3_UINT32 (*size) (struct ANTLR3_LIST_struct * list); + +} + ANTLR3_LIST; + +/** Structure that represents a Stack collection + */ +typedef struct ANTLR3_STACK_struct +{ + /** List that supports the stack structure + */ + pANTLR3_VECTOR vector; + + /** Used for quick access to the top of the stack + */ + void * top; + void (*free) (struct ANTLR3_STACK_struct * stack); + void * (*pop) (struct ANTLR3_STACK_struct * stack); + void * (*get) (struct ANTLR3_STACK_struct * stack, ANTLR3_INTKEY key); + ANTLR3_BOOLEAN (*push) (struct ANTLR3_STACK_struct * stack, void * element, void (ANTLR3_CDECL *freeptr)(void *)); + ANTLR3_UINT32 (*size) (struct ANTLR3_STACK_struct * stack); + void * (*peek) (struct ANTLR3_STACK_struct * stack); + +} + ANTLR3_STACK; + +/* Structure that represents a vector element + */ +typedef struct ANTLR3_VECTOR_ELEMENT_struct +{ + void * element; + void (ANTLR3_CDECL *freeptr)(void *); +} + ANTLR3_VECTOR_ELEMENT, *pANTLR3_VECTOR_ELEMENT; + +#define ANTLR3_VECTOR_INTERNAL_SIZE 16 +/* Structure that represents a vector collection. A vector is a simple list + * that contains a pointer to the element and a pointer to a function that + * that can free the element if it is removed. It auto resizes but does not + * use hash techniques as it is referenced by a simple numeric index. It is not a + * sparse list, so if any element is deleted, then the ones following are moved + * down in memory and the count is adjusted. + */ +typedef struct ANTLR3_VECTOR_struct +{ + /** Array of pointers to vector elements + */ + pANTLR3_VECTOR_ELEMENT elements; + + /** Number of entries currently in the list; + */ + ANTLR3_UINT32 count; + + /** Many times, a vector holds just a few nodes in an AST and it + * is too much overhead to malloc the space for elements so + * at the expense of a few bytes of memory, we hold the first + * few elements internally. It means we must copy them when + * we grow beyond this initial size, but that is less overhead than + * the malloc/free callas we would otherwise require. + */ + ANTLR3_VECTOR_ELEMENT internal[ANTLR3_VECTOR_INTERNAL_SIZE]; + + /** Indicates if the structure was made by a factory, in which + * case only the factory can free the memory for the actual vector, + * though the vector free function is called and will recurse through its + * entries calling any free pointers for each entry. + */ + ANTLR3_BOOLEAN factoryMade; + + /** Total number of entries in elements at any point in time + */ + ANTLR3_UINT32 elementsSize; + + void (ANTLR3_CDECL *free) (struct ANTLR3_VECTOR_struct * vector); + void (*del) (struct ANTLR3_VECTOR_struct * vector, ANTLR3_UINT32 entry); + void * (*get) (struct ANTLR3_VECTOR_struct * vector, ANTLR3_UINT32 entry); + void * (*remove) (struct ANTLR3_VECTOR_struct * vector, ANTLR3_UINT32 entry); + void (*clear) (struct ANTLR3_VECTOR_struct * vector); + ANTLR3_BOOLEAN (*swap) (struct ANTLR3_VECTOR_struct *, ANTLR3_UINT32 entry1, ANTLR3_UINT32 entry2); + ANTLR3_UINT32 (*add) (struct ANTLR3_VECTOR_struct * vector, void * element, void (ANTLR3_CDECL *freeptr)(void *)); + ANTLR3_UINT32 (*set) (struct ANTLR3_VECTOR_struct * vector, ANTLR3_UINT32 entry, void * element, void (ANTLR3_CDECL *freeptr)(void *), ANTLR3_BOOLEAN freeExisting); + ANTLR3_UINT32 (*size) (struct ANTLR3_VECTOR_struct * vector); +} + ANTLR3_VECTOR; + +/** Default vector pool size if otherwise unspecified + */ +#define ANTLR3_FACTORY_VPOOL_SIZE 256 + +/** Structure that tracks vectors in a vector and auto deletes the vectors + * in the vector factory when closed. + */ +typedef struct ANTLR3_VECTOR_FACTORY_struct +{ + + /** List of all vector pools allocated so far + */ + pANTLR3_VECTOR *pools; + + /** Count of the vector pools allocated so far (current active pool) + */ + ANTLR3_INT32 thisPool; + + /** The next vector available in the pool + */ + ANTLR3_UINT32 nextVector; + + /** Trick to quickly initialize a new vector via memcpy and not a function call + */ + ANTLR3_VECTOR unTruc; + + /** Consumers from the factory can release a factory produced vector + * back to the factory so that it may be reused (and thus conserve memory) + * by another caller. The available vectors are stored here. Note that + * the only vectors avaible in the free chain are produced by this factory, so they + * need not be explicitly freed when the factory is closed. + */ + pANTLR3_STACK freeStack; + + /** Function to close the vector factory + */ + void (*close) (struct ANTLR3_VECTOR_FACTORY_struct * factory); + + /** Function to supply a new vector + */ + pANTLR3_VECTOR (*newVector) (struct ANTLR3_VECTOR_FACTORY_struct * factory); + + /// Function to return a vector to the factory for reuse + /// + void (*returnVector) (struct ANTLR3_VECTOR_FACTORY_struct * factory, pANTLR3_VECTOR vector); + +} +ANTLR3_VECTOR_FACTORY; + + +/* -------------- TRIE Interfaces ---------------- */ + + +/** Structure that holds the payload entry in an ANTLR3_INT_TRIE or ANTLR3_STRING_TRIE + */ +typedef struct ANTLR3_TRIE_ENTRY_struct +{ + ANTLR3_UINT32 type; + void (ANTLR3_CDECL *freeptr)(void *); + union + { + ANTLR3_INTKEY intVal; + void * ptr; + } data; + + struct ANTLR3_TRIE_ENTRY_struct * next; /* Allows duplicate entries for same key in insertion order */ +} +ANTLR3_TRIE_ENTRY, * pANTLR3_TRIE_ENTRY; + + +/** Structure that defines an element/node in an ANTLR3_INT_TRIE + */ +typedef struct ANTLR3_INT_TRIE_NODE_struct +{ + ANTLR3_UINT32 bitNum; /**< This is the left/right bit index for traversal along the nodes */ + ANTLR3_INTKEY key; /**< This is the actual key that the entry represents if it is a terminal node */ + pANTLR3_TRIE_ENTRY buckets; /**< This is the data bucket(s) that the key indexes, which may be NULL */ + struct ANTLR3_INT_TRIE_NODE_struct * leftN; /**< Pointer to the left node from here when sKey & bitNum = 0 */ + struct ANTLR3_INT_TRIE_NODE_struct * rightN; /**< Pointer to the right node from here when sKey & bitNum, = 1 */ +} + ANTLR3_INT_TRIE_NODE, * pANTLR3_INT_TRIE_NODE; + +/** Structure that defines an ANTLR3_INT_TRIE. For this particular implementation, + * as you might expect, the key is turned into a "string" by looking at bit(key, depth) + * of the integer key. Using 64 bit keys gives us a depth limit of 64 (or bit 0..63) + * and potentially a huge trie. This is the algorithm for a Patricia Trie. + * Note also that this trie [can] accept multiple entries for the same key and is + * therefore a kind of elastic bucket patricia trie. + * + * If you find this code useful, please feel free to 'steal' it for any purpose + * as covered by the BSD license under which ANTLR is issued. You can cut the code + * but as the ANTLR library is only about 50K (Windows Vista), you might find it + * easier to just link the library. Please keep all comments and licenses and so on + * in any version of this you create of course. + * + * Jim Idle. + * + */ +typedef struct ANTLR3_INT_TRIE_struct +{ + pANTLR3_INT_TRIE_NODE root; /* Root node of this integer trie */ + pANTLR3_INT_TRIE_NODE current; /* Used to traverse the TRIE with the next() method */ + ANTLR3_UINT32 count; /* Current entry count */ + ANTLR3_BOOLEAN allowDups; /* Whether this trie accepts duplicate keys */ + + + pANTLR3_TRIE_ENTRY (*get) (struct ANTLR3_INT_TRIE_struct * trie, ANTLR3_INTKEY key); + ANTLR3_BOOLEAN (*del) (struct ANTLR3_INT_TRIE_struct * trie, ANTLR3_INTKEY key); + ANTLR3_BOOLEAN (*add) (struct ANTLR3_INT_TRIE_struct * trie, ANTLR3_INTKEY key, ANTLR3_UINT32 type, ANTLR3_INTKEY intVal, void * data, void (ANTLR3_CDECL *freeptr)(void *)); + void (*free) (struct ANTLR3_INT_TRIE_struct * trie); + +} + ANTLR3_INT_TRIE; + +/** + * A topological sort system that given a set of dependencies of a node m on node n, + * can sort them in dependency order. This is a generally useful utility object + * that does not care what the things are it is sorting. Generally the set + * to be sorted will be numeric indexes into some other structure such as an ANTLR3_VECTOR. + * I have provided a sort method that given ANTLR3_VECTOR as an input will sort + * the vector entries in place, as well as a sort method that just returns an + * array of the sorted noded indexes, in case you are not sorting ANTLR3_VECTORS but + * some set of your own device. + * + * Of the two main algorithms that could be used, I chose to use the depth first + * search for unvisited nodes as a) This runs in linear time, and b) it is what + * we used in the ANTLR Tool to perform a topological sort of the input grammar files + * based on their dependencies. + */ +typedef struct ANTLR3_TOPO_struct +{ + /** + * A vector of vectors of edges, built by calling the addEdge method() + * to indicate that node number n depends on node number m. Each entry in the vector + * contains a bitset, which has a bit index set for each node upon which the + * entry node depends. + */ + pANTLR3_BITSET * edges; + + /** + * A vector used to build up the sorted output order. Note that + * as the vector contains UINT32 then the maximum node index is + * 'limited' to 2^32, as nodes should be zero based. + */ + pANTLR3_UINT32 sorted; + + /** + * A vector used to detect cycles in the edge dependecies. It is used + * as a stack and each time we descend a node to one of its edges we + * add the node into this stack. If we find a node that we have already + * visited in the stack, then it means there wasa cycle such as 9->8->1->9 + * as the only way a node can be on the stack is if we are currently + * descnding from it as we remove it from the stack as we exit from + * descending its dependencies + */ + pANTLR3_UINT32 cycle; + + /** + * A flag that indicates the algorithm found a cycle in the edges + * such as 9->8->1->9 + * If this flag is set after you have called one of the sort routines + * then the detected cycle will be contained in the cycle array and + * cycleLimit will point to the one after the last entry in the cycle. + */ + ANTLR3_BOOLEAN hasCycle; + + /** + * A watermark used to accumulate potential cycles in the cycle array. + * This should be zero when we are done. Check hasCycle after calling one + * of the sort methods and if it is ANTLR3_TRUE then you can find the cycle + * in cycle[0]...cycle[cycleMark-1] + */ + ANTLR3_UINT32 cycleMark; + + /** + * One more than the largest node index that is contained in edges/sorted. + */ + ANTLR3_UINT32 limit; + + /** + * The set of visited nodes as determined by a set entry in + * the bitmap. + */ + pANTLR3_BITSET visited; + + /** + * A method that adds an edge from one node to another. An edge + * of n -> m indicates that node n is dependent on node m. Note that + * while building these edges, it is perfectly OK to add nodes out of + * sequence. So, if you have edges: + * + * 3 -> 0 + * 2 -> 1 + * 1 -> 3 + * + * The you can add them in that order and so add node 3 before nodes 2 and 1 + * + */ + void (*addEdge) (struct ANTLR3_TOPO_struct * topo, ANTLR3_UINT32 edge, ANTLR3_UINT32 dependency); + + + /** + * A method that returns a pointer to an array of sorted node indexes. + * The array is sorted in topological sorted order. Note that the array + * is only as large as the largest node index you created an edge for. This means + * that if you had an input of 32 nodes, but that largest node with an edge + * was 16, then the returned array will be the sorted order of the first 16 + * nodes and the last 16 nodes of your array are basically fine as they are + * as they had no dependencies and do not need any particular sort order. + * + * NB: If the structure that contains the array is freed, then the sorted + * array will be freed too so you should use the value of limit to + * make a long term copy of this array if you do not want to keep the topo + * structure around as well. + */ + pANTLR3_UINT32 (*sortToArray) (struct ANTLR3_TOPO_struct * topo); + + /** + * A method that sorts the supplied ANTLR3_VECTOR in place based + * on the previously supplied edge data. + */ + void (*sortVector) (struct ANTLR3_TOPO_struct * topo, pANTLR3_VECTOR v); + + /** + * A method to free this structure and any associated memory. + */ + void (*free) (struct ANTLR3_TOPO_struct * topo); +} + ANTLR3_TOPO; + +#ifdef __cplusplus +} +#endif + +#endif + + diff --git a/depends/antlr3c/antlr3commontoken.h b/depends/antlr3c/antlr3commontoken.h new file mode 100644 index 0000000..c48068e --- /dev/null +++ b/depends/antlr3c/antlr3commontoken.h @@ -0,0 +1,367 @@ +/** \file + * \brief Defines the interface for a common token. + * + * All token streams should provide their tokens using an instance + * of this common token. A custom pointer is provided, wher you may attach + * a further structure to enhance the common token if you feel the need + * to do so. The C runtime will assume that a token provides implementations + * of the interface functions, but all of them may be rplaced by your own + * implementation if you require it. + */ +#ifndef _ANTLR3_COMMON_TOKEN_H +#define _ANTLR3_COMMON_TOKEN_H + +// [The "BSD licence"] +// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC +// http://www.temporal-wave.com +// http://www.linkedin.com/in/jimidle +// +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. The name of the author may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include + +/** How many tokens to allocate at once in the token factory + */ +#define ANTLR3_FACTORY_POOL_SIZE 1024 + +/* Base token types, which all lexer/parser tokens come after in sequence. + */ + +/** Indicator of an invalid token + */ +#define ANTLR3_TOKEN_INVALID 0 + +#define ANTLR3_EOR_TOKEN_TYPE 1 + +/** Imaginary token type to cause a traversal of child nodes in a tree parser + */ +#define ANTLR3_TOKEN_DOWN 2 + +/** Imaginary token type to signal the end of a stream of child nodes. + */ +#define ANTLR3_TOKEN_UP 3 + +/** First token that can be used by users/generated code + */ + +#define ANTLR3_MIN_TOKEN_TYPE ANTLR3_TOKEN_UP + 1 + +/** End of file token + */ +#define ANTLR3_TOKEN_EOF (ANTLR3_CHARSTREAM_EOF & 0xFFFFFFFF) + +/** Default channel for a token + */ +#define ANTLR3_TOKEN_DEFAULT_CHANNEL 0 + +/** Reserved channel number for a HIDDEN token - a token that + * is hidden from the parser. + */ +#define HIDDEN 99 + +#ifdef __cplusplus +extern "C" { +#endif + +// Indicates whether this token is carrying: +// +// State | Meaning +// ------+-------------------------------------- +// 0 | Nothing (neither rewrite text, nor setText) +// 1 | char * to user supplied rewrite text +// 2 | pANTLR3_STRING because of setText or similar action +// +#define ANTLR3_TEXT_NONE 0 +#define ANTLR3_TEXT_CHARP 1 +#define ANTLR3_TEXT_STRING 2 + +/** The definition of an ANTLR3 common token structure, which all implementations + * of a token stream should provide, installing any further structures in the + * custom pointer element of this structure. + * + * \remark + * Token streams are in essence provided by lexers or other programs that serve + * as lexers. + */ +typedef struct ANTLR3_COMMON_TOKEN_struct +{ + /** The actual type of this token + */ + ANTLR3_UINT32 type; + + /** Indicates that a token was produced from the token factory and therefore + * the the freeToken() method should not do anything itself because + * token factory is responsible for deleting it. + */ + ANTLR3_BOOLEAN factoryMade; + + /// A string factory that we can use if we ever need the text of a token + /// and need to manufacture a pANTLR3_STRING + /// + pANTLR3_STRING_FACTORY strFactory; + + /** The line number in the input stream where this token was derived from + */ + ANTLR3_UINT32 line; + + /** The offset into the input stream that the line in which this + * token resides starts. + */ + void * lineStart; + + /** The character position in the line that this token was derived from + */ + ANTLR3_INT32 charPosition; + + /** The virtual channel that this token exists in. + */ + ANTLR3_UINT32 channel; + + /** Pointer to the input stream that this token originated in. + */ + pANTLR3_INPUT_STREAM input; + + /** What the index of this token is, 0, 1, .., n-2, n-1 tokens + */ + ANTLR3_MARKER index; + + /** The character offset in the input stream where the text for this token + * starts. + */ + ANTLR3_MARKER start; + + /** The character offset in the input stream where the text for this token + * stops. + */ + ANTLR3_MARKER stop; + + /// Indicates whether this token is carrying: + /// + /// State | Meaning + /// ------+-------------------------------------- + /// 0 | Nothing (neither rewrite text, nor setText) + /// 1 | char * to user supplied rewrite text + /// 2 | pANTLR3_STRING because of setText or similar action + /// + /// Affects the union structure tokText below + /// (uses 32 bit so alignment is always good) + /// + ANTLR3_UINT32 textState; + + union + { + /// Pointer that is used when the token just has a pointer to + /// a char *, such as when a rewrite of an imaginary token supplies + /// a string in the grammar. No sense in constructing a pANTLR3_STRING just + /// for that, as mostly the text will not be accessed - if it is, then + /// we will build a pANTLR3_STRING for it a that point. + /// + pANTLR3_UCHAR chars; + + /// Some token types actually do carry around their associated text, hence + /// (*getText)() will return this pointer if it is not NULL + /// + pANTLR3_STRING text; + } + tokText; + + /** Because it is a bit more of a hassle to override an ANTLR3_COMMON_TOKEN + * as the standard structure for a token, a number of user programmable + * elements are allowed in a token. This is one of them. + */ + ANTLR3_UINT32 user1; + + /** Because it is a bit more of a hassle to override an ANTLR3_COMMON_TOKEN + * as the standard structure for a token, a number of user programmable + * elements are allowed in a token. This is one of them. + */ + ANTLR3_UINT32 user2; + + /** Because it is a bit more of a hassle to override an ANTLR3_COMMON_TOKEN + * as the standard structure for a token, a number of user programmable + * elements are allowed in a token. This is one of them. + */ + ANTLR3_UINT32 user3; + + /** Pointer to a custom element that the ANTLR3 programmer may define and install + */ + void * custom; + + /** Pointer to a function that knows how to free the custom structure when the + * token is destroyed. + */ + void (*freeCustom)(void * custom); + + /* ============================== + * API + */ + + /** Pointer to function that returns the text pointer of a token, use + * toString() if you want a pANTLR3_STRING version of the token. + */ + pANTLR3_STRING (*getText)(struct ANTLR3_COMMON_TOKEN_struct * token); + + /** Pointer to a function that 'might' be able to set the text associated + * with a token. Imaginary tokens such as an ANTLR3_CLASSIC_TOKEN may actually + * do this, however many tokens such as ANTLR3_COMMON_TOKEN do not actaully have + * strings associated with them but just point into the current input stream. These + * tokens will implement this function with a function that errors out (probably + * drastically. + */ + void (*setText)(struct ANTLR3_COMMON_TOKEN_struct * token, pANTLR3_STRING text); + + /** Pointer to a function that 'might' be able to set the text associated + * with a token. Imaginary tokens such as an ANTLR3_CLASSIC_TOKEN may actually + * do this, however many tokens such as ANTLR3_COMMON_TOKEN do not actully have + * strings associated with them but just point into the current input stream. These + * tokens will implement this function with a function that errors out (probably + * drastically. + */ + void (*setText8)(struct ANTLR3_COMMON_TOKEN_struct * token, pANTLR3_UINT8 text); + + /** Pointer to a function that returns the token type of this token + */ + ANTLR3_UINT32 (*getType)(struct ANTLR3_COMMON_TOKEN_struct * token); + + /** Pointer to a function that sets the type of this token + */ + void (*setType)(struct ANTLR3_COMMON_TOKEN_struct * token, ANTLR3_UINT32 ttype); + + /** Pointer to a function that gets the 'line' number where this token resides + */ + ANTLR3_UINT32 (*getLine)(struct ANTLR3_COMMON_TOKEN_struct * token); + + /** Pointer to a function that sets the 'line' number where this token reside + */ + void (*setLine)(struct ANTLR3_COMMON_TOKEN_struct * token, ANTLR3_UINT32 line); + + /** Pointer to a function that gets the offset in the line where this token exists + */ + ANTLR3_INT32 (*getCharPositionInLine) (struct ANTLR3_COMMON_TOKEN_struct * token); + + /** Pointer to a function that sets the offset in the line where this token exists + */ + void (*setCharPositionInLine) (struct ANTLR3_COMMON_TOKEN_struct * token, ANTLR3_INT32 pos); + + /** Pointer to a function that gets the channel that this token was placed in (parsers + * can 'tune' to these channels. + */ + ANTLR3_UINT32 (*getChannel) (struct ANTLR3_COMMON_TOKEN_struct * token); + + /** Pointer to a function that sets the channel that this token should belong to + */ + void (*setChannel) (struct ANTLR3_COMMON_TOKEN_struct * token, ANTLR3_UINT32 channel); + + /** Pointer to a function that returns an index 0...n-1 of the token in the token + * input stream. + */ + ANTLR3_MARKER (*getTokenIndex) (struct ANTLR3_COMMON_TOKEN_struct * token); + + /** Pointer to a function that can set the token index of this token in the token + * input stream. + */ + void (*setTokenIndex) (struct ANTLR3_COMMON_TOKEN_struct * token, ANTLR3_MARKER); + + /** Pointer to a function that gets the start index in the input stream for this token. + */ + ANTLR3_MARKER (*getStartIndex) (struct ANTLR3_COMMON_TOKEN_struct * token); + + /** Pointer to a function that sets the start index in the input stream for this token. + */ + void (*setStartIndex) (struct ANTLR3_COMMON_TOKEN_struct * token, ANTLR3_MARKER index); + + /** Pointer to a function that gets the stop index in the input stream for this token. + */ + ANTLR3_MARKER (*getStopIndex) (struct ANTLR3_COMMON_TOKEN_struct * token); + + /** Pointer to a function that sets the stop index in the input stream for this token. + */ + void (*setStopIndex) (struct ANTLR3_COMMON_TOKEN_struct * token, ANTLR3_MARKER index); + + /** Pointer to a function that returns this token as a text representation that can be + * printed with embedded control codes such as \n replaced with the printable sequence "\\n" + * This also yields a string structure that can be used more easily than the pointer to + * the input stream in certain situations. + */ + pANTLR3_STRING (*toString) (struct ANTLR3_COMMON_TOKEN_struct * token); +} + ANTLR3_COMMON_TOKEN; + +/** \brief ANTLR3 Token factory interface to create lots of tokens efficiently + * rather than creating and freeing lots of little bits of memory. + */ +typedef struct ANTLR3_TOKEN_FACTORY_struct +{ + /** Pointers to the array of tokens that this factory has produced so far + */ + pANTLR3_COMMON_TOKEN *pools; + + /** Current pool tokens we are allocating from + */ + ANTLR3_INT32 thisPool; + + /** Maximum pool count we have available + */ + ANTLR3_INT32 maxPool; + + /** The next token to throw out from the pool, will cause a new pool allocation + * if this exceeds the available tokenCount + */ + ANTLR3_UINT32 nextToken; + + /** Trick to initialize tokens and their API quickly, we set up this token when the + * factory is created, then just copy the memory it uses into the new token. + */ + ANTLR3_COMMON_TOKEN unTruc; + + /** Pointer to an input stream that is using this token factory (may be NULL) + * which will be assigned to the tokens automatically. + */ + pANTLR3_INPUT_STREAM input; + + /** Pointer to a function that returns a new token + */ + pANTLR3_COMMON_TOKEN (*newToken) (struct ANTLR3_TOKEN_FACTORY_struct * factory); + + /** Pointer to a function that resets the factory so you can reuse the pools it + * has laready allocated + */ + void (*reset) (struct ANTLR3_TOKEN_FACTORY_struct * factory); + + /** Pointer to a function that changes teh curent inptu stream so that + * new tokens are created with reference to their originating text. + */ + void (*setInputStream) (struct ANTLR3_TOKEN_FACTORY_struct * factory, pANTLR3_INPUT_STREAM input); + /** Pointer to a function the destroys the factory + */ + void (*close) (struct ANTLR3_TOKEN_FACTORY_struct * factory); +} + ANTLR3_TOKEN_FACTORY; + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/depends/antlr3c/antlr3commontree.h b/depends/antlr3c/antlr3commontree.h new file mode 100644 index 0000000..1516ecc --- /dev/null +++ b/depends/antlr3c/antlr3commontree.h @@ -0,0 +1,167 @@ +/** Interface for an ANTLR3 common tree which is what gets + * passed around by the AST producing parser. + */ + +#ifndef _ANTLR3_COMMON_TREE_H +#define _ANTLR3_COMMON_TREE_H + +// [The "BSD licence"] +// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC +// http://www.temporal-wave.com +// http://www.linkedin.com/in/jimidle +// +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. The name of the author may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct ANTLR3_COMMON_TREE_struct +{ + + /// Not used by ANTLR, but if a super structure is created above + /// this structure, it can be used to point to the start of the super + /// structure, where additional data and function pointers can be stored. + /// + void * super; + + /// Start token index that encases this tree + /// + ANTLR3_MARKER startIndex; + + /// End token that encases this tree + /// + ANTLR3_MARKER stopIndex; + + /// A single token, this is the payload for the tree + /// + pANTLR3_COMMON_TOKEN token; + + /// Points to the node that has this node as a child. + /// If this is NULL, then this is the root node. + /// + pANTLR3_COMMON_TREE parent; + + /// What index is this particular node in the child list it + /// belongs to? + /// + ANTLR3_INT32 childIndex; + + /// Pointer to the tree factory that manufactured this + /// token. This can be used by duplication methods and so on + /// to manufacture another auto-tracked common tree structure + /// + pANTLR3_ARBORETUM factory; + + /// An encapsulated BASE TREE structure (NOT a pointer) + /// that performs a lot of the dirty work of node management + /// To this we add just a few functions that are specific to the + /// payload. You can further abstract common tree so long + /// as you always have a baseTree pointer in the top structure + /// and copy it from the next one down. + /// So, lets say we have a structure JIMS_TREE. + /// It needs an ANTLR3_BASE_TREE that will support all the + /// general tree duplication stuff. + /// It needs a ANTLR3_COMMON_TREE structure embedded or completely + /// provides the equivalent interface. + /// It provides it's own methods and data. + /// To create a new one of these, the function provided to + /// the tree adaptor (see comments there) should allocate the + /// memory for a new JIMS_TREE structure, then call + /// antlr3InitCommonTree() + /// antlr3BaseTreeNew() + /// The interfaces for BASE_TREE and COMMON_TREE will then + /// be initialized. You then call and you can override them or just init + /// JIMS_TREE (note that the base tree in common tree will be ignored) + /// just the top level base tree is used). Codegen will take care of the rest. + /// + ANTLR3_BASE_TREE baseTree; + +} + ANTLR3_COMMON_TREE; + +/// \brief ANTLR3 Tree factory interface to create lots of trees efficiently +/// rather than creating and freeing lots of little bits of memory. +/// +typedef struct ANTLR3_ARBORETUM_struct +{ + /// Pointers to the array of tokens that this factory has produced so far + /// + pANTLR3_COMMON_TREE *pools; + + /// Current pool tokens we are allocating from + /// + ANTLR3_INT32 thisPool; + + /// The next token to throw out from the pool, will cause a new pool allocation + /// if this exceeds the available tokenCount + /// + ANTLR3_UINT32 nextTree; + + /// Trick to initialize tokens and their API quickly, we set up this token when the + /// factory is created, then just copy the memory it uses into the new token. + /// + ANTLR3_COMMON_TREE unTruc; + + /// Pointer to a vector factory that is used to create child list vectors + /// for any child nodes that need them. This means that we auto track the + /// vectors and auto free them when we close the factory. It also means + /// that all rewriting trees can use the same tree factory and the same + /// vector factory and we do not dup any nodes unless we must do so + /// explicitly because of context such as an empty rewrite stream and + /// ->IMAGINARY[ID] so on. This makes memory tracking much simpler and + /// tempts no errors. + /// + pANTLR3_VECTOR_FACTORY vFactory; + + /// A resuse stack for reclaiming Nil nodes that were used in rewrites + /// and are now dead. The nilNode() method will eat one of these before + /// creating a new node. + /// + pANTLR3_STACK nilStack; + + /// Pointer to a function that returns a new tree + /// + pANTLR3_BASE_TREE (*newTree) (struct ANTLR3_ARBORETUM_struct * factory); + pANTLR3_BASE_TREE (*newFromTree) (struct ANTLR3_ARBORETUM_struct * factory, pANTLR3_COMMON_TREE tree); + pANTLR3_BASE_TREE (*newFromToken) (struct ANTLR3_ARBORETUM_struct * factory, pANTLR3_COMMON_TOKEN token); + + /// Pointer to a function the destroys the factory + /// + void (*close) (struct ANTLR3_ARBORETUM_struct * factory); +} + ANTLR3_ARBORETUM; + +#ifdef __cplusplus +} +#endif + +#endif + + diff --git a/depends/antlr3c/antlr3commontreeadaptor.h b/depends/antlr3c/antlr3commontreeadaptor.h new file mode 100644 index 0000000..4827997 --- /dev/null +++ b/depends/antlr3c/antlr3commontreeadaptor.h @@ -0,0 +1,70 @@ +/** \file + * Definition of the ANTLR3 common tree adaptor. + */ + +#ifndef _ANTLR3_COMMON_TREE_ADAPTOR_H +#define _ANTLR3_COMMON_TREE_ADAPTOR_H + +// [The "BSD licence"] +// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC +// http://www.temporal-wave.com +// http://www.linkedin.com/in/jimidle +// +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. The name of the author may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include +#include +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct ANTLR3_COMMON_TREE_ADAPTOR_struct +{ + /** Any enclosing structure/class can use this pointer to point to its own interface. + */ + void * super; + + /** Base interface implementation, embedded structure + */ + ANTLR3_TREE_ADAPTOR baseAdaptor; + + /** Tree factory for producing new nodes as required without needing to track + * memory allocation per node. + */ + pANTLR3_ARBORETUM arboretum; + +} + ANTLR3_COMMON_TREE_ADAPTOR; + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/depends/antlr3c/antlr3commontreenodestream.h b/depends/antlr3c/antlr3commontreenodestream.h new file mode 100644 index 0000000..beb0534 --- /dev/null +++ b/depends/antlr3c/antlr3commontreenodestream.h @@ -0,0 +1,336 @@ +/// \file +/// Definition of the ANTLR3 common tree node stream. +/// + +#ifndef _ANTLR3_COMMON_TREE_NODE_STREAM__H +#define _ANTLR3_COMMON_TREE_NODE_STREAM__H + +// [The "BSD licence"] +// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC +// http://www.temporal-wave.com +// http://www.linkedin.com/in/jimidle +// +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. The name of the author may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include +#include +#include +#include +#include +#include + +/// Token buffer initial size settings ( will auto increase) +/// +#define DEFAULT_INITIAL_BUFFER_SIZE 100 +#define INITIAL_CALL_STACK_SIZE 10 + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct ANTLR3_TREE_NODE_STREAM_struct +{ + /// Any interface that implements this interface (is a + /// super structure containing this structure), may store the pointer + /// to itself here in the super pointer, which is not used by + /// the tree node stream. This will point to an implementation + /// of ANTLR3_COMMON_TREE_NODE_STREAM in this case. + /// + pANTLR3_COMMON_TREE_NODE_STREAM ctns; + + /// All input streams implement the ANTLR3_INT_STREAM interface... + /// + pANTLR3_INT_STREAM istream; + + /// Get tree node at current input pointer + i ahead where i=1 is next node. + /// i<0 indicates nodes in the past. So LT(-1) is previous node, but + /// implementations are not required to provide results for k < -1. + /// LT(0) is undefined. For i>=n, return null. + /// Return NULL for LT(0) and any index that results in an absolute address + /// that is negative (beyond the start of the list). + /// + /// This is analogous to the LT() method of the TokenStream, but this + /// returns a tree node instead of a token. Makes code gen identical + /// for both parser and tree grammars. :) + /// + pANTLR3_BASE_TREE (*_LT) (struct ANTLR3_TREE_NODE_STREAM_struct * tns, ANTLR3_INT32 k); + + /// Where is this stream pulling nodes from? This is not the name, but + /// the object that provides node objects. + /// + pANTLR3_BASE_TREE (*getTreeSource) (struct ANTLR3_TREE_NODE_STREAM_struct * tns); + + /// What adaptor can tell me how to interpret/navigate nodes and + /// trees. E.g., get text of a node. + /// + pANTLR3_BASE_TREE_ADAPTOR (*getTreeAdaptor) (struct ANTLR3_TREE_NODE_STREAM_struct * tns); + + /// As we flatten the tree, we use UP, DOWN nodes to represent + /// the tree structure. When debugging we need unique nodes + /// so we have to instantiate new ones. When doing normal tree + /// parsing, it's slow and a waste of memory to create unique + /// navigation nodes. Default should be false; + /// + void (*setUniqueNavigationNodes) (struct ANTLR3_TREE_NODE_STREAM_struct * tns, ANTLR3_BOOLEAN uniqueNavigationNodes); + + pANTLR3_STRING (*toString) (struct ANTLR3_TREE_NODE_STREAM_struct * tns); + + /// Return the text of all nodes from start to stop, inclusive. + /// If the stream does not buffer all the nodes then it can still + /// walk recursively from start until stop. You can always return + /// null or "" too, but users should not access $ruleLabel.text in + /// an action of course in that case. + /// + pANTLR3_STRING (*toStringSS) (struct ANTLR3_TREE_NODE_STREAM_struct * tns, pANTLR3_BASE_TREE start, pANTLR3_BASE_TREE stop); + + /// Return the text of all nodes from start to stop, inclusive, into the + /// supplied buffer. + /// If the stream does not buffer all the nodes then it can still + /// walk recursively from start until stop. You can always return + /// null or "" too, but users should not access $ruleLabel.text in + /// an action of course in that case. + /// + void (*toStringWork) (struct ANTLR3_TREE_NODE_STREAM_struct * tns, pANTLR3_BASE_TREE start, pANTLR3_BASE_TREE stop, pANTLR3_STRING buf); + + /// Release up any and all space the the interface allocate, including for this structure. + /// + void (*free) (struct ANTLR3_TREE_NODE_STREAM_struct * tns); + + /// Get a tree node at an absolute index i; 0..n-1. + /// If you don't want to buffer up nodes, then this method makes no + /// sense for you. + /// + pANTLR3_BASE_TREE (*get) (struct ANTLR3_TREE_NODE_STREAM_struct * tns, ANTLR3_INT32 i); + + // REWRITING TREES (used by tree parser) + + /// Replace from start to stop child index of parent with t, which might + /// be a list. Number of children may be different + /// after this call. The stream is notified because it is walking the + /// tree and might need to know you are monkeying with the underlying + /// tree. Also, it might be able to modify the node stream to avoid + /// restreaming for future phases. + /// + /// If parent is null, don't do anything; must be at root of overall tree. + /// Can't replace whatever points to the parent externally. Do nothing. + /// + void (*replaceChildren) (struct ANTLR3_TREE_NODE_STREAM_struct * tns, pANTLR3_BASE_TREE parent, ANTLR3_INT32 startChildIndex, ANTLR3_INT32 stopChildIndex, pANTLR3_BASE_TREE t); + +} + ANTLR3_TREE_NODE_STREAM; + +typedef struct ANTLR3_COMMON_TREE_NODE_STREAM_struct +{ + /// Any interface that implements this interface (is a + /// super structure containing this structure), may store the pointer + /// to itself here in the super pointer, which is not used by + /// the common tree node stream. + /// + void * super; + + /// Pointer to the tree node stream interface + /// + pANTLR3_TREE_NODE_STREAM tnstream; + + /// String factory for use by anything that wishes to create strings + /// such as a tree representation or some copy of the text etc. + /// + pANTLR3_STRING_FACTORY stringFactory; + + /// Dummy tree node that indicates a descent into a child + /// tree. Initialized by a call to create a new interface. + /// + ANTLR3_COMMON_TREE DOWN; + + /// Dummy tree node that indicates a descent up to a parent + /// tree. Initialized by a call to create a new interface. + /// + ANTLR3_COMMON_TREE UP; + + /// Dummy tree node that indicates the termination point of the + /// tree. Initialized by a call to create a new interface. + /// + ANTLR3_COMMON_TREE EOF_NODE; + + /// Dummy node that is returned if we need to indicate an invalid node + /// for any reason. + /// + ANTLR3_COMMON_TREE INVALID_NODE; + + /// The complete mapping from stream index to tree node. + /// This buffer includes pointers to DOWN, UP, and EOF nodes. + /// It is built upon ctor invocation. The elements are type + /// Object as we don't what the trees look like. + /// + /// Load upon first need of the buffer so we can set token types + /// of interest for reverseIndexing. Slows us down a wee bit to + /// do all of the if p==-1 testing everywhere though, though in C + /// you won't really be able to measure this. + /// + /// Must be freed when the tree node stream is torn down. + /// + pANTLR3_VECTOR nodes; + + /// If set to ANTLR3_TRUE then the navigation nodes UP, DOWN are + /// duplicated rather than reused within the tree. + /// + ANTLR3_BOOLEAN uniqueNavigationNodes; + + /// Which tree are we navigating ? + /// + pANTLR3_BASE_TREE root; + + /// Pointer to tree adaptor interface that manipulates/builds + /// the tree. + /// + pANTLR3_BASE_TREE_ADAPTOR adaptor; + + /// As we walk down the nodes, we must track parent nodes so we know + /// where to go after walking the last child of a node. When visiting + /// a child, push current node and current index (current index + /// is first stored in the tree node structure to avoid two stacks. + /// + pANTLR3_STACK nodeStack; + + /// The current index into the nodes vector of the current tree + /// we are parsing and possibly rewriting. + /// + ANTLR3_INT32 p; + + /// Which node are we currently visiting? + /// + pANTLR3_BASE_TREE currentNode; + + /// Which node did we last visit? Used for LT(-1) + /// + pANTLR3_BASE_TREE previousNode; + + /// Which child are we currently visiting? If -1 we have not visited + /// this node yet; next consume() request will set currentIndex to 0. + /// + ANTLR3_INT32 currentChildIndex; + + /// What node index did we just consume? i=0..n-1 for n node trees. + /// IntStream.next is hence 1 + this value. Size will be same. + /// + ANTLR3_MARKER absoluteNodeIndex; + + /// Buffer tree node stream for use with LT(i). This list grows + /// to fit new lookahead depths, but consume() wraps like a circular + /// buffer. + /// + pANTLR3_BASE_TREE * lookAhead; + + /// Number of elements available in the lookahead buffer at any point in + /// time. This is the current size of the array. + /// + ANTLR3_UINT32 lookAheadLength; + + /// lookAhead[head] is the first symbol of lookahead, LT(1). + /// + ANTLR3_UINT32 head; + + /// Add new lookahead at lookahead[tail]. tail wraps around at the + /// end of the lookahead buffer so tail could be less than head. + /// + ANTLR3_UINT32 tail; + + /// Calls to mark() may be nested so we have to track a stack of + /// them. The marker is an index into this stack. Index 0 is + /// the first marker. This is a List + /// + pANTLR3_VECTOR markers; + + // INTERFACE + // + void (*fill) (struct ANTLR3_COMMON_TREE_NODE_STREAM_struct * ctns, ANTLR3_INT32 k); + + void (*addLookahead) (struct ANTLR3_COMMON_TREE_NODE_STREAM_struct * ctns, pANTLR3_BASE_TREE node); + + ANTLR3_BOOLEAN (*hasNext) (struct ANTLR3_COMMON_TREE_NODE_STREAM_struct * ctns); + + pANTLR3_BASE_TREE (*next) (struct ANTLR3_COMMON_TREE_NODE_STREAM_struct * ctns); + + pANTLR3_BASE_TREE (*handleRootnode) (struct ANTLR3_COMMON_TREE_NODE_STREAM_struct * ctns); + + pANTLR3_BASE_TREE (*visitChild) (struct ANTLR3_COMMON_TREE_NODE_STREAM_struct * ctns, ANTLR3_UINT32 child); + + void (*addNavigationNode) (struct ANTLR3_COMMON_TREE_NODE_STREAM_struct * ctns, ANTLR3_UINT32 ttype); + + pANTLR3_BASE_TREE (*newDownNode) (struct ANTLR3_COMMON_TREE_NODE_STREAM_struct * ctns); + + pANTLR3_BASE_TREE (*newUpNode) (struct ANTLR3_COMMON_TREE_NODE_STREAM_struct * ctns); + + void (*walkBackToMostRecentNodeWithUnvisitedChildren) + (struct ANTLR3_COMMON_TREE_NODE_STREAM_struct * ctns); + + ANTLR3_BOOLEAN (*hasUniqueNavigationNodes) (struct ANTLR3_COMMON_TREE_NODE_STREAM_struct * ctns); + + ANTLR3_UINT32 (*getLookaheadSize) (struct ANTLR3_COMMON_TREE_NODE_STREAM_struct * ctns); + + void (*push) (struct ANTLR3_COMMON_TREE_NODE_STREAM_struct * ctns, ANTLR3_INT32 index); + + ANTLR3_INT32 (*pop) (struct ANTLR3_COMMON_TREE_NODE_STREAM_struct * ctns); + + void (*reset) (struct ANTLR3_COMMON_TREE_NODE_STREAM_struct * ctns); + + void (*free) (struct ANTLR3_COMMON_TREE_NODE_STREAM_struct * ctns); + + /// Indicates whether this node stream was derived from a prior + /// node stream to be used by a rewriting tree parser for instance. + /// If this flag is set to ANTLR3_TRUE, then when this stream is + /// closed it will not free the root tree as this tree always + /// belongs to the origniating node stream. + /// + ANTLR3_BOOLEAN isRewriter; + +} + ANTLR3_COMMON_TREE_NODE_STREAM; + +/** This structure is used to save the state information in the treenodestream + * when walking ahead with cyclic DFA or for syntactic predicates, + * we need to record the state of the tree node stream. This + * class wraps up the current state of the CommonTreeNodeStream. + * Calling mark() will push another of these on the markers stack. + */ +typedef struct ANTLR3_TREE_WALK_STATE_struct +{ + ANTLR3_UINT32 currentChildIndex; + ANTLR3_MARKER absoluteNodeIndex; + pANTLR3_BASE_TREE currentNode; + pANTLR3_BASE_TREE previousNode; + ANTLR3_UINT32 nodeStackSize; + pANTLR3_BASE_TREE * lookAhead; + ANTLR3_UINT32 lookAheadLength; + ANTLR3_UINT32 tail; + ANTLR3_UINT32 head; +} + ANTLR3_TREE_WALK_STATE; + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/depends/antlr3c/antlr3convertutf.h b/depends/antlr3c/antlr3convertutf.h new file mode 100644 index 0000000..79cc82c --- /dev/null +++ b/depends/antlr3c/antlr3convertutf.h @@ -0,0 +1,176 @@ +/* + * Copyright 2001-2004 Unicode, Inc. + * + * Disclaimer + * + * This source code is provided as is by Unicode, Inc. No claims are + * made as to fitness for any particular purpose. No warranties of any + * kind are expressed or implied. The recipient agrees to determine + * applicability of information provided. If this file has been + * purchased on magnetic or optical media from Unicode, Inc., the + * sole remedy for any claim will be exchange of defective media + * within 90 days of receipt. + * + * Limitations on Rights to Redistribute This Code + * + * Unicode, Inc. hereby grants the right to freely use the information + * supplied in this file in the creation of products supporting the + * Unicode Standard, and to make copies of this file in any form + * for internal or external distribution as long as this notice + * remains attached. + */ + +/* --------------------------------------------------------------------- + + Conversions between UTF32, UTF-16, and UTF-8. Header file. + + Several functions are included here, forming a complete set of + conversions between the three formats. UTF-7 is not included + here, but is handled in a separate source file. + + Each of these routines takes pointers to input buffers and output + buffers. The input buffers are const. + + Each routine converts the text between *sourceStart and sourceEnd, + putting the result into the buffer between *targetStart and + targetEnd. Note: the end pointers are *after* the last item: e.g. + *(sourceEnd - 1) is the last item. + + The return result indicates whether the conversion was successful, + and if not, whether the problem was in the source or target buffers. + (Only the first encountered problem is indicated.) + + After the conversion, *sourceStart and *targetStart are both + updated to point to the end of last text successfully converted in + the respective buffers. + + Input parameters: + sourceStart - pointer to a pointer to the source buffer. + The contents of this are modified on return so that + it points at the next thing to be converted. + targetStart - similarly, pointer to pointer to the target buffer. + sourceEnd, targetEnd - respectively pointers to the ends of the + two buffers, for overflow checking only. + + These conversion functions take a ConversionFlags argument. When this + flag is set to strict, both irregular sequences and isolated surrogates + will cause an error. When the flag is set to lenient, both irregular + sequences and isolated surrogates are converted. + + Whether the flag is strict or lenient, all illegal sequences will cause + an error return. This includes sequences such as: , , + or in UTF-8, and values above 0x10FFFF in UTF-32. Conformant code + must check for illegal sequences. + + When the flag is set to lenient, characters over 0x10FFFF are converted + to the replacement character; otherwise (when the flag is set to strict) + they constitute an error. + + Output parameters: + The value "sourceIllegal" is returned from some routines if the input + sequence is malformed. When "sourceIllegal" is returned, the source + value will point to the illegal value that caused the problem. E.g., + in UTF-8 when a sequence is malformed, it points to the start of the + malformed sequence. + + Author: Mark E. Davis, 1994. + Rev History: Rick McGowan, fixes & updates May 2001. + Fixes & updates, Sept 2001. + +------------------------------------------------------------------------ */ + +/* --------------------------------------------------------------------- + The following 4 definitions are compiler-specific. + The C standard does not guarantee that wchar_t has at least + 16 bits, so wchar_t is no less portable than unsigned short! + All should be unsigned values to avoid sign extension during + bit mask & shift operations. +------------------------------------------------------------------------ */ + + +// Changes for ANTLR3 - Jim Idle, January 2008. +// builtin types defined for Unicode types changed to +// aliases for the types that are system determined by +// ANTLR at compile time. +// +// typedef unsigned long UTF32; /* at least 32 bits */ +// typedef unsigned short UTF16; /* at least 16 bits */ +// typedef unsigned char UTF8; /* typically 8 bits */ +// typedef unsigned char Boolean; /* 0 or 1 */ + +#ifndef _ANTLR3_CONVERTUTF_H +#define _ANTLR3_CONVERTUTF_H + +#include + +typedef ANTLR3_UINT32 UTF32; /* at least 32 bits */ +typedef ANTLR3_UINT16 UTF16; /* at least 16 bits */ +typedef ANTLR3_UINT8 UTF8; /* typically 8 bits */ + +/* Some fundamental constants */ +#define UNI_REPLACEMENT_CHAR (UTF32)0x0000FFFD +#define UNI_MAX_BMP (UTF32)0x0000FFFF +#define UNI_MAX_UTF16 (UTF32)0x0010FFFF +#define UNI_MAX_UTF32 (UTF32)0x7FFFFFFF +#define UNI_MAX_LEGAL_UTF32 (UTF32)0x0010FFFF + +#define UNI_SUR_HIGH_START (UTF32)0xD800 +#define UNI_SUR_HIGH_END (UTF32)0xDBFF +#define UNI_SUR_LOW_START (UTF32)0xDC00 +#define UNI_SUR_LOW_END (UTF32)0xDFFF +#define false ANTLR3_FALSE +#define true ANTLR3_TRUE +#define halfShift ((UTF32)10) +#define halfBase ((UTF32)0x0010000UL) +#define halfMask ((UTF32)0x3FFUL) + +typedef enum { + conversionOK, /* conversion successful */ + sourceExhausted, /* partial character in source, but hit end */ + targetExhausted, /* insuff. room in target for conversion */ + sourceIllegal /* source sequence is illegal/malformed */ +} ConversionResult; + +typedef enum { + strictConversion = 0, + lenientConversion +} ConversionFlags; + +/* This is for C++ and does no harm in C */ +#ifdef __cplusplus +extern "C" { +#endif + +ConversionResult ConvertUTF8toUTF16 ( + const UTF8** sourceStart, const UTF8* sourceEnd, + UTF16** targetStart, UTF16* targetEnd, ConversionFlags flags); + +ConversionResult ConvertUTF16toUTF8 ( + const UTF16** sourceStart, const UTF16* sourceEnd, + UTF8** targetStart, UTF8* targetEnd, ConversionFlags flags); + +ConversionResult ConvertUTF8toUTF32 ( + const UTF8** sourceStart, const UTF8* sourceEnd, + UTF32** targetStart, UTF32* targetEnd, ConversionFlags flags); + +ConversionResult ConvertUTF32toUTF8 ( + const UTF32** sourceStart, const UTF32* sourceEnd, + UTF8** targetStart, UTF8* targetEnd, ConversionFlags flags); + +ConversionResult ConvertUTF16toUTF32 ( + const UTF16** sourceStart, const UTF16* sourceEnd, + UTF32** targetStart, UTF32* targetEnd, ConversionFlags flags); + +ConversionResult ConvertUTF32toUTF16 ( + const UTF32** sourceStart, const UTF32* sourceEnd, + UTF16** targetStart, UTF16* targetEnd, ConversionFlags flags); + +ANTLR3_BOOLEAN isLegalUTF8Sequence(const UTF8 *source, const UTF8 *sourceEnd); + +#ifdef __cplusplus +} +#endif + +#endif + +/* --------------------------------------------------------------------- */ diff --git a/depends/antlr3c/antlr3cyclicdfa.h b/depends/antlr3c/antlr3cyclicdfa.h new file mode 100644 index 0000000..78708a0 --- /dev/null +++ b/depends/antlr3c/antlr3cyclicdfa.h @@ -0,0 +1,97 @@ +/// Definition of a cyclic dfa structure such that it can be +/// initialized at compile time and have only a single +/// runtime function that can deal with all cyclic dfa +/// structures and show Java how it is done ;-) +/// +#ifndef ANTLR3_CYCLICDFA_H +#define ANTLR3_CYCLICDFA_H + +// [The "BSD licence"] +// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC +// http://www.temporal-wave.com +// http://www.linkedin.com/in/jimidle +// +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. The name of the author may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include +#include + +#ifdef __cplusplus +extern "C" { + +// If this header file is included as part of a generated recognizer that +// is being compiled as if it were C++, and this is Windows, then the const elements +// of the structure cause the C++ compiler to (rightly) point out that +// there can be no instantiation of the structure because it needs a constructor +// that can initialize the data, however these structures are not +// useful for C++ as they are pre-generated and static in the recognizer. +// So, we turn off those warnings, which are only at /W4 anyway. +// +#ifdef ANTLR3_WINDOWS +#pragma warning (push) +#pragma warning (disable : 4510) +#pragma warning (disable : 4512) +#pragma warning (disable : 4610) +#endif +#endif + +typedef struct ANTLR3_CYCLIC_DFA_struct +{ + /// Decision number that a particular static structure + /// represents. + /// + const ANTLR3_INT32 decisionNumber; + + /// What this decision represents + /// + const pANTLR3_UCHAR description; + + ANTLR3_INT32 (*specialStateTransition) (void * ctx, pANTLR3_BASE_RECOGNIZER recognizer, pANTLR3_INT_STREAM is, struct ANTLR3_CYCLIC_DFA_struct * dfa, ANTLR3_INT32 s); + + ANTLR3_INT32 (*specialTransition) (void * ctx, pANTLR3_BASE_RECOGNIZER recognizer, pANTLR3_INT_STREAM is, struct ANTLR3_CYCLIC_DFA_struct * dfa, ANTLR3_INT32 s); + + ANTLR3_INT32 (*predict) (void * ctx, pANTLR3_BASE_RECOGNIZER recognizer, pANTLR3_INT_STREAM is, struct ANTLR3_CYCLIC_DFA_struct * dfa); + + const ANTLR3_INT32 * const eot; + const ANTLR3_INT32 * const eof; + const ANTLR3_INT32 * const min; + const ANTLR3_INT32 * const max; + const ANTLR3_INT32 * const accept; + const ANTLR3_INT32 * const special; + const ANTLR3_INT32 * const * const transition; + +} + ANTLR3_CYCLIC_DFA; + +typedef ANTLR3_INT32 (*CDFA_SPECIAL_FUNC) (void * , pANTLR3_BASE_RECOGNIZER , pANTLR3_INT_STREAM , struct ANTLR3_CYCLIC_DFA_struct * , ANTLR3_INT32); + +#ifdef __cplusplus +} +#ifdef ANTLR3_WINDOWS +#pragma warning (pop) +#endif +#endif + +#endif diff --git a/depends/antlr3c/antlr3debugeventlistener.h b/depends/antlr3c/antlr3debugeventlistener.h new file mode 100644 index 0000000..c9cd6ce --- /dev/null +++ b/depends/antlr3c/antlr3debugeventlistener.h @@ -0,0 +1,398 @@ +/** + * \file + * The definition of all debugging events that a recognizer can trigger. + * + * \remark + * From the java implementation by Terence Parr... + * I did not create a separate AST debugging interface as it would create + * lots of extra classes and DebugParser has a dbg var defined, which makes + * it hard to change to ASTDebugEventListener. I looked hard at this issue + * and it is easier to understand as one monolithic event interface for all + * possible events. Hopefully, adding ST debugging stuff won't be bad. Leave + * for future. 4/26/2006. + */ + +#ifndef ANTLR3_DEBUG_EVENT_LISTENER_H +#define ANTLR3_DEBUG_EVENT_LISTENER_H + +// [The "BSD licence"] +// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC +// http://www.temporal-wave.com +// http://www.linkedin.com/in/jimidle +// +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. The name of the author may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include +#include +#include + + +/// Default debugging port +/// +#define DEFAULT_DEBUGGER_PORT 0xBFCC; + +#ifdef __cplusplus +extern "C" { +#endif + +/** The ANTLR3 debugging interface for communicating with ANLTR Works. Function comments + * mostly taken from the Java version. + */ +typedef struct ANTLR3_DEBUG_EVENT_LISTENER_struct +{ + /// The port number which the debug listener should listen on for a connection + /// + ANTLR3_UINT32 port; + + /// The socket structure we receive after a successful accept on the serverSocket + /// + SOCKET socket; + + /** The version of the debugging protocol supported by the providing + * instance of the debug event listener. + */ + int PROTOCOL_VERSION; + + /// The name of the grammar file that we are debugging + /// + pANTLR3_STRING grammarFileName; + + /// Indicates whether we have already connected or not + /// + ANTLR3_BOOLEAN initialized; + + /// Used to serialize the values of any particular token we need to + /// send back to the debugger. + /// + pANTLR3_STRING tokenString; + + + /// Allows the debug event system to access the adapter in use + /// by the recognizer, if this is a tree parser of some sort. + /// + pANTLR3_BASE_TREE_ADAPTOR adaptor; + + /// Wait for a connection from the debugger and initiate the + /// debugging session. + /// + ANTLR3_BOOLEAN (*handshake) (pANTLR3_DEBUG_EVENT_LISTENER delboy); + + /** The parser has just entered a rule. No decision has been made about + * which alt is predicted. This is fired AFTER init actions have been + * executed. Attributes are defined and available etc... + */ + void (*enterRule) (pANTLR3_DEBUG_EVENT_LISTENER delboy, const char * grammarFileName, const char * ruleName); + + /** Because rules can have lots of alternatives, it is very useful to + * know which alt you are entering. This is 1..n for n alts. + */ + void (*enterAlt) (pANTLR3_DEBUG_EVENT_LISTENER delboy, int alt); + + /** This is the last thing executed before leaving a rule. It is + * executed even if an exception is thrown. This is triggered after + * error reporting and recovery have occurred (unless the exception is + * not caught in this rule). This implies an "exitAlt" event. + */ + void (*exitRule) (pANTLR3_DEBUG_EVENT_LISTENER delboy, const char * grammarFileName, const char * ruleName); + + /** Track entry into any (...) subrule other EBNF construct + */ + void (*enterSubRule) (pANTLR3_DEBUG_EVENT_LISTENER delboy, int decisionNumber); + + void (*exitSubRule) (pANTLR3_DEBUG_EVENT_LISTENER delboy, int decisionNumber); + + /** Every decision, fixed k or arbitrary, has an enter/exit event + * so that a GUI can easily track what LT/consume events are + * associated with prediction. You will see a single enter/exit + * subrule but multiple enter/exit decision events, one for each + * loop iteration. + */ + void (*enterDecision) (pANTLR3_DEBUG_EVENT_LISTENER delboy, int decisionNumber); + + void (*exitDecision) (pANTLR3_DEBUG_EVENT_LISTENER delboy, int decisionNumber); + + /** An input token was consumed; matched by any kind of element. + * Trigger after the token was matched by things like match(), matchAny(). + */ + void (*consumeToken) (pANTLR3_DEBUG_EVENT_LISTENER delboy, pANTLR3_COMMON_TOKEN t); + + /** An off-channel input token was consumed. + * Trigger after the token was matched by things like match(), matchAny(). + * (unless of course the hidden token is first stuff in the input stream). + */ + void (*consumeHiddenToken) (pANTLR3_DEBUG_EVENT_LISTENER delboy, pANTLR3_COMMON_TOKEN t); + + /** Somebody (anybody) looked ahead. Note that this actually gets + * triggered by both LA and LT calls. The debugger will want to know + * which Token object was examined. Like consumeToken, this indicates + * what token was seen at that depth. A remote debugger cannot look + * ahead into a file it doesn't have so LT events must pass the token + * even if the info is redundant. + */ + void (*LT) (pANTLR3_DEBUG_EVENT_LISTENER delboy, int i, pANTLR3_COMMON_TOKEN t); + + /** The parser is going to look arbitrarily ahead; mark this location, + * the token stream's marker is sent in case you need it. + */ + void (*mark) (pANTLR3_DEBUG_EVENT_LISTENER delboy, ANTLR3_MARKER marker); + + /** After an arbitrarily long lookahead as with a cyclic DFA (or with + * any backtrack), this informs the debugger that stream should be + * rewound to the position associated with marker. + */ + void (*rewind) (pANTLR3_DEBUG_EVENT_LISTENER delboy, ANTLR3_MARKER marker); + + /** Rewind to the input position of the last marker. + * Used currently only after a cyclic DFA and just + * before starting a sem/syn predicate to get the + * input position back to the start of the decision. + * Do not "pop" the marker off the state. mark(i) + * and rewind(i) should balance still. + */ + void (*rewindLast) (pANTLR3_DEBUG_EVENT_LISTENER delboy); + + void (*beginBacktrack) (pANTLR3_DEBUG_EVENT_LISTENER delboy, int level); + + void (*endBacktrack) (pANTLR3_DEBUG_EVENT_LISTENER delboy, int level, ANTLR3_BOOLEAN successful); + + /** To watch a parser move through the grammar, the parser needs to + * inform the debugger what line/charPos it is passing in the grammar. + * For now, this does not know how to switch from one grammar to the + * other and back for island grammars etc... + * + * This should also allow breakpoints because the debugger can stop + * the parser whenever it hits this line/pos. + */ + void (*location) (pANTLR3_DEBUG_EVENT_LISTENER delboy, int line, int pos); + + /** A recognition exception occurred such as NoViableAltException. I made + * this a generic event so that I can alter the exception hierarchy later + * without having to alter all the debug objects. + * + * Upon error, the stack of enter rule/subrule must be properly unwound. + * If no viable alt occurs it is within an enter/exit decision, which + * also must be rewound. Even the rewind for each mark must be unwound. + * In the Java target this is pretty easy using try/finally, if a bit + * ugly in the generated code. The rewind is generated in DFA.predict() + * actually so no code needs to be generated for that. For languages + * w/o this "finally" feature (C++?), the target implementor will have + * to build an event stack or something. + * + * Across a socket for remote debugging, only the RecognitionException + * data fields are transmitted. The token object or whatever that + * caused the problem was the last object referenced by LT. The + * immediately preceding LT event should hold the unexpected Token or + * char. + * + * Here is a sample event trace for grammar: + * + * b : C ({;}A|B) // {;} is there to prevent A|B becoming a set + * | D + * ; + * + * The sequence for this rule (with no viable alt in the subrule) for + * input 'c c' (there are 3 tokens) is: + * + * commence + * LT(1) + * enterRule b + * location 7 1 + * enter decision 3 + * LT(1) + * exit decision 3 + * enterAlt1 + * location 7 5 + * LT(1) + * consumeToken [c/<4>,1:0] + * location 7 7 + * enterSubRule 2 + * enter decision 2 + * LT(1) + * LT(1) + * recognitionException NoViableAltException 2 1 2 + * exit decision 2 + * exitSubRule 2 + * beginResync + * LT(1) + * consumeToken [c/<4>,1:1] + * LT(1) + * endResync + * LT(-1) + * exitRule b + * terminate + */ + void (*recognitionException) (pANTLR3_DEBUG_EVENT_LISTENER delboy, pANTLR3_EXCEPTION e); + + /** Indicates the recognizer is about to consume tokens to resynchronize + * the parser. Any consume events from here until the recovered event + * are not part of the parse--they are dead tokens. + */ + void (*beginResync) (pANTLR3_DEBUG_EVENT_LISTENER delboy); + + /** Indicates that the recognizer has finished consuming tokens in order + * to resynchronize. There may be multiple beginResync/endResync pairs + * before the recognizer comes out of errorRecovery mode (in which + * multiple errors are suppressed). This will be useful + * in a gui where you want to probably grey out tokens that are consumed + * but not matched to anything in grammar. Anything between + * a beginResync/endResync pair was tossed out by the parser. + */ + void (*endResync) (pANTLR3_DEBUG_EVENT_LISTENER delboy); + + /** A semantic predicate was evaluate with this result and action text + */ + void (*semanticPredicate) (pANTLR3_DEBUG_EVENT_LISTENER delboy, ANTLR3_BOOLEAN result, const char * predicate); + + /** Announce that parsing has begun. Not technically useful except for + * sending events over a socket. A GUI for example will launch a thread + * to connect and communicate with a remote parser. The thread will want + * to notify the GUI when a connection is made. ANTLR parsers + * trigger this upon entry to the first rule (the ruleLevel is used to + * figure this out). + */ + void (*commence) (pANTLR3_DEBUG_EVENT_LISTENER delboy); + + /** Parsing is over; successfully or not. Mostly useful for telling + * remote debugging listeners that it's time to quit. When the rule + * invocation level goes to zero at the end of a rule, we are done + * parsing. + */ + void (*terminate) (pANTLR3_DEBUG_EVENT_LISTENER delboy); + + /// Retrieve acknowledge response from the debugger. in fact this + /// response is never used at the moment. So we just read whatever + /// is in the socket buffer and throw it away. + /// + void (*ack) (pANTLR3_DEBUG_EVENT_LISTENER delboy); + + // T r e e P a r s i n g + + /** Input for a tree parser is an AST, but we know nothing for sure + * about a node except its type and text (obtained from the adaptor). + * This is the analog of the consumeToken method. The ID is usually + * the memory address of the node. + * If the type is UP or DOWN, then + * the ID is not really meaningful as it's fixed--there is + * just one UP node and one DOWN navigation node. + * + * Note that unlike the Java version, the node type of the C parsers + * is always fixed as pANTLR3_BASE_TREE because all such structures + * contain a super pointer to their parent, which is generally COMMON_TREE and within + * that there is a super pointer that can point to a user type that encapsulates it. + * Almost akin to saying that it is an interface pointer except we don't need to + * know what the interface is in full, just those bits that are the base. + * @param t + */ + void (*consumeNode) (pANTLR3_DEBUG_EVENT_LISTENER delboy, pANTLR3_BASE_TREE t); + + /** The tree parser looked ahead. If the type is UP or DOWN, + * then the ID is not really meaningful as it's fixed--there is + * just one UP node and one DOWN navigation node. + */ + void (*LTT) (pANTLR3_DEBUG_EVENT_LISTENER delboy, int i, pANTLR3_BASE_TREE t); + + + // A S T E v e n t s + + /** A nil was created (even nil nodes have a unique ID... + * they are not "null" per se). As of 4/28/2006, this + * seems to be uniquely triggered when starting a new subtree + * such as when entering a subrule in automatic mode and when + * building a tree in rewrite mode. + * + * If you are receiving this event over a socket via + * RemoteDebugEventSocketListener then only t.ID is set. + */ + void (*nilNode) (pANTLR3_DEBUG_EVENT_LISTENER delboy, pANTLR3_BASE_TREE t); + + /** If a syntax error occurs, recognizers bracket the error + * with an error node if they are building ASTs. This event + * notifies the listener that this is the case + */ + void (*errorNode) (pANTLR3_DEBUG_EVENT_LISTENER delboy, pANTLR3_BASE_TREE t); + + /** Announce a new node built from token elements such as type etc... + * + * If you are receiving this event over a socket via + * RemoteDebugEventSocketListener then only t.ID, type, text are + * set. + */ + void (*createNode) (pANTLR3_DEBUG_EVENT_LISTENER delboy, pANTLR3_BASE_TREE t); + + /** Announce a new node built from an existing token. + * + * If you are receiving this event over a socket via + * RemoteDebugEventSocketListener then only node.ID and token.tokenIndex + * are set. + */ + void (*createNodeTok) (pANTLR3_DEBUG_EVENT_LISTENER delboy, pANTLR3_BASE_TREE node, pANTLR3_COMMON_TOKEN token); + + /** Make a node the new root of an existing root. See + * + * Note: the newRootID parameter is possibly different + * than the TreeAdaptor.becomeRoot() newRoot parameter. + * In our case, it will always be the result of calling + * TreeAdaptor.becomeRoot() and not root_n or whatever. + * + * The listener should assume that this event occurs + * only when the current subrule (or rule) subtree is + * being reset to newRootID. + * + * If you are receiving this event over a socket via + * RemoteDebugEventSocketListener then only IDs are set. + * + * @see org.antlr.runtime.tree.TreeAdaptor.becomeRoot() + */ + void (*becomeRoot) (pANTLR3_DEBUG_EVENT_LISTENER delboy, pANTLR3_BASE_TREE newRoot, pANTLR3_BASE_TREE oldRoot); + + /** Make childID a child of rootID. + * + * If you are receiving this event over a socket via + * RemoteDebugEventSocketListener then only IDs are set. + * + * @see org.antlr.runtime.tree.TreeAdaptor.addChild() + */ + void (*addChild) (pANTLR3_DEBUG_EVENT_LISTENER delboy, pANTLR3_BASE_TREE root, pANTLR3_BASE_TREE child); + + /** Set the token start/stop token index for a subtree root or node. + * + * If you are receiving this event over a socket via + * RemoteDebugEventSocketListener then only t.ID is set. + */ + void (*setTokenBoundaries) (pANTLR3_DEBUG_EVENT_LISTENER delboy, pANTLR3_BASE_TREE t, ANTLR3_MARKER tokenStartIndex, ANTLR3_MARKER tokenStopIndex); + + /// Free up the resources allocated to this structure + /// + void (*free) (pANTLR3_DEBUG_EVENT_LISTENER delboy); + +} + ANTLR3_DEBUG_EVENT_LISTENER; + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/depends/antlr3c/antlr3defs.h b/depends/antlr3c/antlr3defs.h new file mode 100644 index 0000000..2435b02 --- /dev/null +++ b/depends/antlr3c/antlr3defs.h @@ -0,0 +1,632 @@ +/** \file + * Basic type and constant definitions for ANTLR3 Runtime. + */ +#ifndef _ANTLR3DEFS_H +#define _ANTLR3DEFS_H + +// [The "BSD licence"] +// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC +// http://www.temporal-wave.com +// http://www.linkedin.com/in/jimidle +// +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. The name of the author may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +/* Following are for generated code, they are not referenced internally!!! + */ +#if !defined(ANTLR3_HUGE) && !defined(ANTLR3_AVERAGE) && !defined(ANTLR3_SMALL) +#define ANTLR3_AVERAGE +#endif + +#ifdef ANTLR3_HUGE +#ifndef ANTLR3_SIZE_HINT +#define ANTLR3_SIZE_HINT 2049 +#endif +#ifndef ANTLR3_LIST_SIZE_HINT +#define ANTLR3_LIST_SIZE_HINT 127 +#endif +#endif + +#ifdef ANTLR3_AVERAGE +#ifndef ANTLR3_SIZE_HINT +#define ANTLR3_SIZE_HINT 1025 +#define ANTLR3_LIST_SIZE_HINT 63 +#endif +#endif + +#ifdef ANTLR3_SMALL +#ifndef ANTLR3_SIZE_HINT +#define ANTLR3_SIZE_HINT 211 +#define ANTLR3_LIST_SIZE_HINT 31 +#endif +#endif + +// Definitions that indicate the encoding scheme character streams and strings etc +// +/// Indicates Big Endian for encodings where this makes sense +/// +#define ANTLR3_BE 1 + +/// Indicates Little Endian for encoidngs where this makes sense +/// +#define ANTLR3_LE 2 + +/// General latin-1 or other 8 bit encoding scheme such as straight ASCII +/// +#define ANTLR3_ENC_8BIT 4 + +/// UTF-8 encoding scheme +/// +#define ANTLR3_ENC_UTF8 8 + +/// UTF-16 encoding scheme (which also covers UCS2 as that does not have surrogates) +/// +#define ANTLR3_ENC_UTF16 16 +#define ANTLR3_ENC_UTF16BE 16 + ANTLR3_BE +#define ANTLR3_ENC_UTF16LE 16 + ANTLR3_LE + +/// UTF-32 encoding scheme (basically straight 32 bit) +/// +#define ANTLR3_ENC_UTF32 32 +#define ANTLR3_ENC_UTF32BE 32 + ANTLR3_BE +#define ANTLR3_ENC_UTF32LE 32 + ANTLR3_LE + +/// Input is 8 bit EBCDIC (which we convert to 8 bit ASCII on the fly +/// +#define ANTLR3_ENC_EBCDIC 64 + +/* Common definitions come first + */ +#include + +/* Work out what operating system/compiler this is. We just do this once + * here and use an internal symbol after this. + */ +#ifdef _WIN64 + +# ifndef ANTLR3_WINDOWS +# define ANTLR3_WINDOWS +# endif +# define ANTLR3_WIN64 +# define ANTLR3_USE_64BIT + +#else + +#ifdef _WIN32 +# ifndef ANTLR3_WINDOWS +# define ANTLR3_WINDOWS +# endif + +#define ANTLR3_WIN32 +#endif + +#endif + +#ifdef ANTLR3_WINDOWS + +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif + +/* Allow VC 8 (vs2005) and above to use 'secure' versions of various functions such as sprintf + */ +#ifndef _CRT_SECURE_NO_DEPRECATE +#define _CRT_SECURE_NO_DEPRECATE +#endif + +#include +#include +#include +#include +#include +#include +#include + +#define ANTLR3_API __declspec(dllexport) +#define ANTLR3_CDECL __cdecl +#define ANTLR3_FASTCALL __fastcall + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef __MINGW32__ +// Standard Windows types +// +typedef INT32 ANTLR3_CHAR, *pANTLR3_CHAR; +typedef UINT32 ANTLR3_UCHAR, *pANTLR3_UCHAR; + +typedef INT8 ANTLR3_INT8, *pANTLR3_INT8; +typedef INT16 ANTLR3_INT16, *pANTLR3_INT16; +typedef INT32 ANTLR3_INT32, *pANTLR3_INT32; +typedef INT64 ANTLR3_INT64, *pANTLR3_INT64; +typedef UINT8 ANTLR3_UINT8, *pANTLR3_UINT8; +typedef UINT16 ANTLR3_UINT16, *pANTLR3_UINT16; +typedef UINT32 ANTLR3_UINT32, *pANTLR3_UINT32; +typedef UINT64 ANTLR3_UINT64, *pANTLR3_UINT64; +typedef UINT64 ANTLR3_BITWORD, *pANTLR3_BITWORD; +typedef UINT8 ANTLR3_BOOLEAN, *pANTLR3_BOOLEAN; + +#else +// Mingw uses stdint.h and fails to define standard Microsoft typedefs +// such as UINT16, hence we must use stdint.h for Mingw. +// +#include +typedef int32_t ANTLR3_CHAR, *pANTLR3_CHAR; +typedef uint32_t ANTLR3_UCHAR, *pANTLR3_UCHAR; + +typedef int8_t ANTLR3_INT8, *pANTLR3_INT8; +typedef int16_t ANTLR3_INT16, *pANTLR3_INT16; +typedef int32_t ANTLR3_INT32, *pANTLR3_INT32; +typedef int64_t ANTLR3_INT64, *pANTLR3_INT64; + +typedef uint8_t ANTLR3_UINT8, *pANTLR3_UINT8; +typedef uint16_t ANTLR3_UINT16, *pANTLR3_UINT16; +typedef uint32_t ANTLR3_UINT32, *pANTLR3_UINT32; +typedef uint64_t ANTLR3_UINT64, *pANTLR3_UINT64; +typedef uint64_t ANTLR3_BITWORD, *pANTLR3_BITWORD; + +typedef uint8_t ANTLR3_BOOLEAN, *pANTLR3_BOOLEAN; + +#endif + + + +#define ANTLR3_UINT64_LIT(lit) lit##ULL + +#define ANTLR3_INLINE __inline + +typedef FILE * ANTLR3_FDSC; +typedef struct stat ANTLR3_FSTAT_STRUCT; + +#ifdef ANTLR3_USE_64BIT +#define ANTLR3_FUNC_PTR(ptr) (void *)((ANTLR3_UINT64)(ptr)) +#define ANTLR3_UINT64_CAST(ptr) (ANTLR3_UINT64)(ptr)) +#define ANTLR3_UINT32_CAST(ptr) (ANTLR3_UINT32)((ANTLR3_UINT64)(ptr)) +typedef ANTLR3_INT64 ANTLR3_MARKER; +typedef ANTLR3_UINT64 ANTLR3_INTKEY; +#else +#define ANTLR3_FUNC_PTR(ptr) (void *)((ANTLR3_UINT32)(ptr)) +#define ANTLR3_UINT64_CAST(ptr) (ANTLR3_UINT64)((ANTLR3_UINT32)(ptr)) +#define ANTLR3_UINT32_CAST(ptr) (ANTLR3_UINT32)(ptr) +typedef ANTLR3_INT32 ANTLR3_MARKER; +typedef ANTLR3_UINT32 ANTLR3_INTKEY; +#endif + +#ifdef ANTLR3_WIN32 +#endif + +#ifdef ANTLR3_WIN64 +#endif + + +typedef int ANTLR3_SALENT; // Type used for size of accept structure +typedef struct sockaddr_in ANTLR3_SOCKADDRT, * pANTLR3_SOCKADDRT; // Type used for socket address declaration +typedef struct sockaddr ANTLR3_SOCKADDRC, * pANTLR3_SOCKADDRC; // Type used for cast on accept() + +#define ANTLR3_CLOSESOCKET closesocket + +#ifdef __cplusplus +} +#endif + +/* Warnings that are over-zealous such as complaining about strdup, we + * can turn off. + */ + +/* Don't complain about "deprecated" functions such as strdup + */ +#pragma warning( disable : 4996 ) + +#else + +/* Include configure generated header file + */ +#include + +#include + +#if HAVE_STDINT_H +# include +#endif + +#if HAVE_SYS_TYPES_H +# include +#endif + +#if HAVE_SYS_STAT_H +# include +#endif + +#if STDC_HEADERS +# include +# include +# include +#else +# if HAVE_STDLIB_H +# include +# endif +# if HAVE_STDARG_H +# include +# endif +#endif + +#if HAVE_STRING_H +# if !STDC_HEADERS && HAVE_MEMORY_H +# include +# endif +# include +#endif + +#if HAVE_STRINGS_H +# include +#endif + +#if HAVE_INTTYPES_H +# include +#endif + +#if HAVE_UNISTD_H +# include +#endif + +#ifdef HAVE_NETINET_IN_H +#include +#endif + +#ifdef HAVE_SOCKET_H +# include +#else +# if HAVE_SYS_SOCKET_H +# include +# endif +#endif + +#ifdef HAVE_NETINET_TCP_H +#include +#endif + +#ifdef HAVE_ARPA_NAMESER_H +#include /* DNS HEADER struct */ +#endif + +#ifdef HAVE_NETDB_H +#include +#endif + + +#ifdef HAVE_SYS_RESOLVE_H +#include +#endif + +#ifdef HAVE_RESOLVE_H +#include +#endif + + +#ifdef HAVE_MALLOC_H +# include +#else +# ifdef HAVE_SYS_MALLOC_H +# include +# endif +#endif + +#ifdef HAVE_CTYPE_H +# include +#endif + +/* Some platforms define a macro, index() in string.h. AIX is + * one of these for instance. We must get rid of that definition + * as we use ->index all over the place. defining macros like this in system header + * files is a really bad idea, but I doubt that IBM will listen to me ;-) + */ +#ifdef index +#undef index +#endif + +#define _stat stat + +// SOCKET not defined on Unix +// +typedef int SOCKET; + +#define ANTLR3_API +#define ANTLR3_CDECL +#define ANTLR3_FASTCALL + +#ifdef __hpux + + // HPUX is always different usually for no good reason. Tru64 should have kicked it + // into touch and everyone knows it ;-) + // + typedef struct sockaddr_in ANTLR3_SOCKADDRT, * pANTLR3_SOCKADDRT; // Type used for socket address declaration + typedef void * pANTLR3_SOCKADDRC; // Type used for cast on accept() + typedef int ANTLR3_SALENT; + +#else + +# if defined(_AIX) || __GNUC__ > 3 + + typedef socklen_t ANTLR3_SALENT; + +# else + + typedef size_t ANTLR3_SALENT; + +# endif + + typedef struct sockaddr_in ANTLR3_SOCKADDRT, * pANTLR3_SOCKADDRT; // Type used for socket address declaration + typedef struct sockaddr * pANTLR3_SOCKADDRC; // Type used for cast on accept() + +#endif + +#define INVALID_SOCKET ((SOCKET)-1) +#define ANTLR3_CLOSESOCKET close + +#ifdef __cplusplus +extern "C" { +#endif + +/* Inherit type definitions for autoconf + */ +typedef int32_t ANTLR3_CHAR, *pANTLR3_CHAR; +typedef uint32_t ANTLR3_UCHAR, *pANTLR3_UCHAR; + +typedef int8_t ANTLR3_INT8, *pANTLR3_INT8; +typedef int16_t ANTLR3_INT16, *pANTLR3_INT16; +typedef int32_t ANTLR3_INT32, *pANTLR3_INT32; +typedef int64_t ANTLR3_INT64, *pANTLR3_INT64; + +typedef uint8_t ANTLR3_UINT8, *pANTLR3_UINT8; +typedef uint16_t ANTLR3_UINT16, *pANTLR3_UINT16; +typedef uint32_t ANTLR3_UINT32, *pANTLR3_UINT32; +typedef uint64_t ANTLR3_UINT64, *pANTLR3_UINT64; +typedef uint64_t ANTLR3_BITWORD, *pANTLR3_BITWORD; + +typedef uint32_t ANTLR3_BOOLEAN, *pANTLR3_BOOLEAN; + +#define ANTLR3_INLINE inline +#define ANTLR3_API + +typedef FILE * ANTLR3_FDSC; +typedef struct stat ANTLR3_FSTAT_STRUCT; + +#ifdef ANTLR3_USE_64BIT +#define ANTLR3_FUNC_PTR(ptr) (void *)((ANTLR3_UINT64)(ptr)) +#define ANTLR3_UINT64_CAST(ptr) (ANTLR3_UINT64)(ptr)) +#define ANTLR3_UINT32_CAST(ptr) (ANTLR3_UINT32)((ANTLR3_UINT64)(ptr)) +typedef ANTLR3_INT64 ANTLR3_MARKER; +typedef ANTLR3_UINT64 ANTLR3_INTKEY; +#else +#define ANTLR3_FUNC_PTR(ptr) (void *)((ANTLR3_UINT32)(ptr)) +#define ANTLR3_UINT64_CAST(ptr) (ANTLR3_UINT64)((ANTLR3_UINT32)(ptr)) +#define ANTLR3_UINT32_CAST(ptr) (ANTLR3_UINT32)(ptr) +typedef ANTLR3_INT32 ANTLR3_MARKER; +typedef ANTLR3_UINT32 ANTLR3_INTKEY; +#endif +#define ANTLR3_UINT64_LIT(lit) lit##ULL + +#ifdef __cplusplus +} +#endif + +#endif + +#ifdef ANTLR3_USE_64BIT +#define ANTLR3_TRIE_DEPTH 63 +#else +#define ANTLR3_TRIE_DEPTH 31 +#endif +/* Pre declare the typedefs for all the interfaces, then + * they can be inter-dependant and we will let the linker + * sort it out for us. + */ +#include + +// Include the unicode.org conversion library header. +// +#include + +/* Prototypes + */ +#ifndef ANTLR3_MALLOC +/// Default definition of ANTLR3_MALLOC. You can override this before including +/// antlr3.h if you wish to use your own implementation. +/// +#define ANTLR3_MALLOC(request) malloc ((size_t)(request)) +#endif + +#ifndef ANTLR3_CALLOC +/// Default definition of ANTLR3_CALLOC. You can override this before including +/// antlr3.h if you wish to use your own implementation. +/// +#define ANTLR3_CALLOC(numEl, elSize) calloc (numEl, (size_t)(elSize)) +#endif + +#ifndef ANTLR3_REALLOC +/// Default definition of ANTLR3_REALLOC. You can override this before including +/// antlr3.h if you wish to use your own implementation. +/// +#define ANTLR3_REALLOC(current, request) realloc ((void *)(current), (size_t)(request)) +#endif +#ifndef ANTLR3_FREE +/// Default definition of ANTLR3_FREE. You can override this before including +/// antlr3.h if you wish to use your own implementation. +/// +#define ANTLR3_FREE(ptr) free ((void *)(ptr)) +#endif +#ifndef ANTLR3_FREE_FUNC +/// Default definition of ANTLR3_FREE_FUNC. You can override this before including +/// antlr3.h if you wish to use your own implementation. +/// +#define ANTLR3_FREE_FUNC free +#endif +#ifndef ANTLR3_STRDUP +/// Default definition of ANTLR3_STRDUP. You can override this before including +/// antlr3.h if you wish to use your own implementation. +/// +#define ANTLR3_STRDUP(instr) (pANTLR3_UINT8)(strdup ((const char *)(instr))) +#endif +#ifndef ANTLR3_MEMCPY +/// Default definition of ANTLR3_MEMCPY. You can override this before including +/// antlr3.h if you wish to use your own implementation. +/// +#define ANTLR3_MEMCPY(target, source, size) memcpy((void *)(target), (const void *)(source), (size_t)(size)) +#endif +#ifndef ANTLR3_MEMMOVE +/// Default definition of ANTLR3_MEMMOVE. You can override this before including +/// antlr3.h if you wish to use your own implementation. +/// +#define ANTLR3_MEMMOVE(target, source, size) memmove((void *)(target), (const void *)(source), (size_t)(size)) +#endif +#ifndef ANTLR3_MEMSET +/// Default definition of ANTLR3_MEMSET. You can override this before including +/// antlr3.h if you wish to use your own implementation. +/// +#define ANTLR3_MEMSET(target, byte, size) memset((void *)(target), (int)(byte), (size_t)(size)) +#endif + +#ifndef ANTLR3_PRINTF +/// Default definition of printf, set this to something other than printf before including antlr3.h +/// if your system does not have a printf. Note that you can define this to be // +/// without harming the runtime. +/// +#define ANTLR3_PRINTF printf +#endif + +#ifndef ANTLR3_FPRINTF +/// Default definition of fprintf, set this to something other than fprintf before including antlr3.h +/// if your system does not have a fprintf. Note that you can define this to be // +/// without harming the runtime. +/// +#define ANTLR3_FPRINTF fprintf +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +ANTLR3_API pANTLR3_INT_TRIE antlr3IntTrieNew (ANTLR3_UINT32 depth); + +ANTLR3_API pANTLR3_BITSET antlr3BitsetNew (ANTLR3_UINT32 numBits); +ANTLR3_API pANTLR3_BITSET antlr3BitsetOf (ANTLR3_INT32 bit, ...); +ANTLR3_API pANTLR3_BITSET antlr3BitsetList (pANTLR3_HASH_TABLE list); +ANTLR3_API pANTLR3_BITSET antlr3BitsetCopy (pANTLR3_BITSET_LIST blist); +ANTLR3_API pANTLR3_BITSET antlr3BitsetLoad (pANTLR3_BITSET_LIST blist); +ANTLR3_API void antlr3BitsetSetAPI (pANTLR3_BITSET bitset); + + +ANTLR3_API pANTLR3_BASE_RECOGNIZER antlr3BaseRecognizerNew (ANTLR3_UINT32 type, ANTLR3_UINT32 sizeHint, pANTLR3_RECOGNIZER_SHARED_STATE state); +ANTLR3_API void antlr3RecognitionExceptionNew (pANTLR3_BASE_RECOGNIZER recognizer); +ANTLR3_API void antlr3MTExceptionNew (pANTLR3_BASE_RECOGNIZER recognizer); +ANTLR3_API void antlr3MTNExceptionNew (pANTLR3_BASE_RECOGNIZER recognizer); +ANTLR3_API pANTLR3_HASH_TABLE antlr3HashTableNew (ANTLR3_UINT32 sizeHint); +ANTLR3_API ANTLR3_UINT32 antlr3Hash (void * key, ANTLR3_UINT32 keylen); +ANTLR3_API pANTLR3_HASH_ENUM antlr3EnumNew (pANTLR3_HASH_TABLE table); +ANTLR3_API pANTLR3_LIST antlr3ListNew (ANTLR3_UINT32 sizeHint); +ANTLR3_API pANTLR3_VECTOR_FACTORY antlr3VectorFactoryNew (ANTLR3_UINT32 sizeHint); +ANTLR3_API pANTLR3_VECTOR antlr3VectorNew (ANTLR3_UINT32 sizeHint); +ANTLR3_API pANTLR3_STACK antlr3StackNew (ANTLR3_UINT32 sizeHint); +ANTLR3_API void antlr3SetVectorApi (pANTLR3_VECTOR vector, ANTLR3_UINT32 sizeHint); +ANTLR3_API ANTLR3_UCHAR antlr3c8toAntlrc (ANTLR3_INT8 inc); +ANTLR3_API pANTLR3_TOPO antlr3TopoNew(); + +ANTLR3_API pANTLR3_EXCEPTION antlr3ExceptionNew (ANTLR3_UINT32 exception, void * name, void * message, ANTLR3_BOOLEAN freeMessage); + + +ANTLR3_API pANTLR3_INPUT_STREAM antlr3FileStreamNew (pANTLR3_UINT8 fileName, ANTLR3_UINT32 encoding); +ANTLR3_API pANTLR3_INPUT_STREAM antlr3StringStreamNew (pANTLR3_UINT8 data, ANTLR3_UINT32 encoding, ANTLR3_UINT32 size, pANTLR3_UINT8 name); + +ANTLR3_API pANTLR3_INT_STREAM antlr3IntStreamNew (void); + +ANTLR3_API pANTLR3_STRING_FACTORY antlr3StringFactoryNew (ANTLR3_UINT32 encoding); + +ANTLR3_API pANTLR3_COMMON_TOKEN antlr3CommonTokenNew (ANTLR3_UINT32 ttype); +ANTLR3_API pANTLR3_TOKEN_FACTORY antlr3TokenFactoryNew (pANTLR3_INPUT_STREAM input); +ANTLR3_API void antlr3SetTokenAPI (pANTLR3_COMMON_TOKEN token); + +ANTLR3_API pANTLR3_LEXER antlr3LexerNewStream (ANTLR3_UINT32 sizeHint, pANTLR3_INPUT_STREAM input, pANTLR3_RECOGNIZER_SHARED_STATE state); +ANTLR3_API pANTLR3_LEXER antlr3LexerNew (ANTLR3_UINT32 sizeHint, pANTLR3_RECOGNIZER_SHARED_STATE state); +ANTLR3_API pANTLR3_PARSER antlr3ParserNewStreamDbg (ANTLR3_UINT32 sizeHint, pANTLR3_TOKEN_STREAM tstream, pANTLR3_DEBUG_EVENT_LISTENER dbg, pANTLR3_RECOGNIZER_SHARED_STATE state); +ANTLR3_API pANTLR3_PARSER antlr3ParserNewStream (ANTLR3_UINT32 sizeHint, pANTLR3_TOKEN_STREAM tstream, pANTLR3_RECOGNIZER_SHARED_STATE state); +ANTLR3_API pANTLR3_PARSER antlr3ParserNew (ANTLR3_UINT32 sizeHint, pANTLR3_RECOGNIZER_SHARED_STATE state); + +ANTLR3_API pANTLR3_COMMON_TOKEN_STREAM antlr3CommonTokenStreamSourceNew (ANTLR3_UINT32 hint, pANTLR3_TOKEN_SOURCE source); +ANTLR3_API pANTLR3_COMMON_TOKEN_STREAM antlr3CommonTokenStreamNew (ANTLR3_UINT32 hint); +ANTLR3_API pANTLR3_COMMON_TOKEN_STREAM antlr3CommonTokenDebugStreamSourceNew (ANTLR3_UINT32 hint, pANTLR3_TOKEN_SOURCE source, pANTLR3_DEBUG_EVENT_LISTENER debugger); + +ANTLR3_API pANTLR3_BASE_TREE_ADAPTOR ANTLR3_TREE_ADAPTORNew (pANTLR3_STRING_FACTORY strFactory); +ANTLR3_API pANTLR3_BASE_TREE_ADAPTOR ANTLR3_TREE_ADAPTORDebugNew (pANTLR3_STRING_FACTORY strFactory, pANTLR3_DEBUG_EVENT_LISTENER debugger); +ANTLR3_API pANTLR3_COMMON_TREE antlr3CommonTreeNew (void); +ANTLR3_API pANTLR3_COMMON_TREE antlr3CommonTreeNewFromTree (pANTLR3_COMMON_TREE tree); +ANTLR3_API pANTLR3_COMMON_TREE antlr3CommonTreeNewFromToken (pANTLR3_COMMON_TOKEN tree); +ANTLR3_API pANTLR3_ARBORETUM antlr3ArboretumNew (pANTLR3_STRING_FACTORY factory); +ANTLR3_API void antlr3SetCTAPI (pANTLR3_COMMON_TREE tree); +ANTLR3_API pANTLR3_BASE_TREE antlr3BaseTreeNew (pANTLR3_BASE_TREE tree); + +ANTLR3_API void antlr3BaseTreeAdaptorInit (pANTLR3_BASE_TREE_ADAPTOR adaptor, pANTLR3_DEBUG_EVENT_LISTENER debugger); + +ANTLR3_API pANTLR3_TREE_PARSER antlr3TreeParserNewStream (ANTLR3_UINT32 sizeHint, pANTLR3_COMMON_TREE_NODE_STREAM ctnstream, pANTLR3_RECOGNIZER_SHARED_STATE state); + +ANTLR3_API ANTLR3_INT32 antlr3dfaspecialTransition (void * ctx, pANTLR3_BASE_RECOGNIZER rec, pANTLR3_INT_STREAM is, pANTLR3_CYCLIC_DFA dfa, ANTLR3_INT32 s); +ANTLR3_API ANTLR3_INT32 antlr3dfaspecialStateTransition (void * ctx, pANTLR3_BASE_RECOGNIZER rec, pANTLR3_INT_STREAM is, pANTLR3_CYCLIC_DFA dfa, ANTLR3_INT32 s); +ANTLR3_API ANTLR3_INT32 antlr3dfapredict (void * ctx, pANTLR3_BASE_RECOGNIZER rec, pANTLR3_INT_STREAM is, pANTLR3_CYCLIC_DFA cdfa); + +ANTLR3_API pANTLR3_COMMON_TREE_NODE_STREAM antlr3CommonTreeNodeStreamNewTree (pANTLR3_BASE_TREE tree, ANTLR3_UINT32 hint); +ANTLR3_API pANTLR3_COMMON_TREE_NODE_STREAM antlr3CommonTreeNodeStreamNew (pANTLR3_STRING_FACTORY strFactory, ANTLR3_UINT32 hint); +ANTLR3_API pANTLR3_COMMON_TREE_NODE_STREAM antlr3UnbufTreeNodeStreamNewTree (pANTLR3_BASE_TREE tree, ANTLR3_UINT32 hint); +ANTLR3_API pANTLR3_COMMON_TREE_NODE_STREAM antlr3UnbufTreeNodeStreamNew (pANTLR3_STRING_FACTORY strFactory, ANTLR3_UINT32 hint); +ANTLR3_API pANTLR3_COMMON_TREE_NODE_STREAM antlr3CommonTreeNodeStreamNewStream (pANTLR3_COMMON_TREE_NODE_STREAM inStream); +ANTLR3_API pANTLR3_TREE_NODE_STREAM antlr3TreeNodeStreamNew (); +ANTLR3_API void fillBufferExt (pANTLR3_COMMON_TOKEN_STREAM tokenStream); + +ANTLR3_API pANTLR3_REWRITE_RULE_TOKEN_STREAM + antlr3RewriteRuleTOKENStreamNewAE (pANTLR3_BASE_TREE_ADAPTOR adaptor, pANTLR3_BASE_RECOGNIZER rec, pANTLR3_UINT8 description); +ANTLR3_API pANTLR3_REWRITE_RULE_TOKEN_STREAM + antlr3RewriteRuleTOKENStreamNewAEE (pANTLR3_BASE_TREE_ADAPTOR adaptor, pANTLR3_BASE_RECOGNIZER rec, pANTLR3_UINT8 description, void * oneElement); +ANTLR3_API pANTLR3_REWRITE_RULE_TOKEN_STREAM + antlr3RewriteRuleTOKENStreamNewAEV (pANTLR3_BASE_TREE_ADAPTOR adaptor, pANTLR3_BASE_RECOGNIZER rec, pANTLR3_UINT8 description, pANTLR3_VECTOR vector); + +ANTLR3_API pANTLR3_REWRITE_RULE_NODE_STREAM + antlr3RewriteRuleNODEStreamNewAE (pANTLR3_BASE_TREE_ADAPTOR adaptor, pANTLR3_BASE_RECOGNIZER rec, pANTLR3_UINT8 description); +ANTLR3_API pANTLR3_REWRITE_RULE_NODE_STREAM + antlr3RewriteRuleNODEStreamNewAEE (pANTLR3_BASE_TREE_ADAPTOR adaptor, pANTLR3_BASE_RECOGNIZER rec, pANTLR3_UINT8 description, void * oneElement); +ANTLR3_API pANTLR3_REWRITE_RULE_NODE_STREAM + antlr3RewriteRuleNODEStreamNewAEV (pANTLR3_BASE_TREE_ADAPTOR adaptor, pANTLR3_BASE_RECOGNIZER rec, pANTLR3_UINT8 description, pANTLR3_VECTOR vector); + +ANTLR3_API pANTLR3_REWRITE_RULE_SUBTREE_STREAM + antlr3RewriteRuleSubtreeStreamNewAE (pANTLR3_BASE_TREE_ADAPTOR adaptor, pANTLR3_BASE_RECOGNIZER rec, pANTLR3_UINT8 description); +ANTLR3_API pANTLR3_REWRITE_RULE_SUBTREE_STREAM + antlr3RewriteRuleSubtreeStreamNewAEE(pANTLR3_BASE_TREE_ADAPTOR adaptor, pANTLR3_BASE_RECOGNIZER rec, pANTLR3_UINT8 description, void * oneElement); +ANTLR3_API pANTLR3_REWRITE_RULE_SUBTREE_STREAM + antlr3RewriteRuleSubtreeStreamNewAEV(pANTLR3_BASE_TREE_ADAPTOR adaptor, pANTLR3_BASE_RECOGNIZER rec, pANTLR3_UINT8 description, pANTLR3_VECTOR vector); + +ANTLR3_API pANTLR3_DEBUG_EVENT_LISTENER antlr3DebugListenerNew(); + +#ifdef __cplusplus +} +#endif + +#endif /* _ANTLR3DEFS_H */ diff --git a/depends/antlr3c/antlr3encodings.h b/depends/antlr3c/antlr3encodings.h new file mode 100644 index 0000000..f706735 --- /dev/null +++ b/depends/antlr3c/antlr3encodings.h @@ -0,0 +1,38 @@ +#ifndef _ANTLR3_ENCODINGS_H +#define _ANTLR3_ENCODINGS_H + +// [The "BSD licence"] +// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC +// http://www.temporal-wave.com +// http://www.linkedin.com/in/jimidle +// +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. The name of the author may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include + + + +#endif + diff --git a/depends/antlr3c/antlr3errors.h b/depends/antlr3c/antlr3errors.h new file mode 100644 index 0000000..4419ee3 --- /dev/null +++ b/depends/antlr3c/antlr3errors.h @@ -0,0 +1,53 @@ +#ifndef _ANTLR3ERRORS_H +#define _ANTLR3ERRORS_H + +// [The "BSD licence"] +// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC +// http://www.temporal-wave.com +// http://www.linkedin.com/in/jimidle +// +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. The name of the author may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#define ANTLR3_SUCCESS 0 +#define ANTLR3_FAIL 1 + +#define ANTLR3_TRUE 1 +#define ANTLR3_FALSE 0 + +/** Indicates end of character stream and is an invalid Unicode code point. */ +#define ANTLR3_CHARSTREAM_EOF 0xFFFFFFFF + +/** Indicates memoizing on a rule failed. + */ +#define MEMO_RULE_FAILED 0xFFFFFFFE +#define MEMO_RULE_UNKNOWN 0xFFFFFFFF + + +#define ANTLR3_ERR_BASE 0 +#define ANTLR3_ERR_NOMEM (ANTLR3_ERR_BASE + 1) +#define ANTLR3_ERR_NOFILE (ANTLR3_ERR_BASE + 2) +#define ANTLR3_ERR_HASHDUP (ANTLR3_ERR_BASE + 3) + +#endif /* _ANTLR3ERRORS_H */ diff --git a/depends/antlr3c/antlr3exception.h b/depends/antlr3c/antlr3exception.h new file mode 100644 index 0000000..8fab8da --- /dev/null +++ b/depends/antlr3c/antlr3exception.h @@ -0,0 +1,218 @@ +/** \file + * Contains the definition of a basic ANTLR3 exception structure created + * by a recognizer when errors are found/predicted. + */ +#ifndef _ANTLR3_EXCEPTION_H +#define _ANTLR3_EXCEPTION_H + +// [The "BSD licence"] +// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC +// http://www.temporal-wave.com +// http://www.linkedin.com/in/jimidle +// +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. The name of the author may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include + +/** Indicates that the recognizer received a token + * in the input that was not predicted. + */ +#define ANTLR3_RECOGNITION_EXCEPTION 1 + +/** Name of exception #ANTLR3_RECOGNITION_EXCEPTION + */ +#define ANTLR3_RECOGNITION_EX_NAME "org.antlr.runtime.RecognitionException" + +/** Indicates that the recognizer was expecting one token and found a + * a different one. + */ +#define ANTLR3_MISMATCHED_TOKEN_EXCEPTION 2 + +/** Name of #ANTLR3_MISMATCHED_TOKEN_EXCEPTION + */ +#define ANTLR3_MISMATCHED_EX_NAME "org.antlr.runtime.MismatchedTokenException" + +/** Recognizer could not find a valid alternative from the input + */ +#define ANTLR3_NO_VIABLE_ALT_EXCEPTION 3 + +/** Name of #ANTLR3_NO_VIABLE_ALT_EXCEPTION + */ +#define ANTLR3_NO_VIABLE_ALT_NAME "org.antlr.runtime.NoViableAltException" + +/* Character in a set was not found + */ +#define ANTLR3_MISMATCHED_SET_EXCEPTION 4 + +/* Name of #ANTLR3_MISMATCHED_SET_EXCEPTION + */ +#define ANTLR3_MISMATCHED_SET_NAME "org.antlr.runtime.MismatchedSetException" + +/* A rule predicting at least n elements found less than that, + * such as: WS: " "+; + */ +#define ANTLR3_EARLY_EXIT_EXCEPTION 5 + +/* Name of #ANTLR3_EARLY_EXIT_EXCEPTION + */ +#define ANTLR3_EARLY_EXIT_NAME "org.antlr.runtime.EarlyExitException" + +#define ANTLR3_FAILED_PREDICATE_EXCEPTION 6 +#define ANTLR3_FAILED_PREDICATE_NAME "org.antlr.runtime.FailedPredicateException" + +#define ANTLR3_MISMATCHED_TREE_NODE_EXCEPTION 7 +#define ANTLR3_MISMATCHED_TREE_NODE_NAME "org.antlr.runtime.MismatchedTreeNodeException" + +#define ANTLR3_REWRITE_EARLY_EXCEPTION 8 +#define ANTLR3_REWRITE_EARLY_EXCEPTION_NAME "org.antlr.runtime.tree.RewriteEarlyExitException" + +#define ANTLR3_UNWANTED_TOKEN_EXCEPTION 9 +#define ANTLR3_UNWANTED_TOKEN_EXCEPTION_NAME "org.antlr.runtime.UnwantedTokenException" + +#define ANTLR3_MISSING_TOKEN_EXCEPTION 10 +#define ANTLR3_MISSING_TOKEN_EXCEPTION_NAME "org.antlr.runtime.MissingTokenException" + +#ifdef __cplusplus +extern "C" { +#endif + +/** Base structure for an ANTLR3 exception tracker + */ +typedef struct ANTLR3_EXCEPTION_struct +{ + /// Set to one of the exception type defines: + /// + /// - #ANTLR3_RECOGNITION_EXCEPTION + /// - #ANTLR3_MISMATCHED_TOKEN_EXCEPTION + /// - #ANTLR3_NO_VIABLE_ALT_EXCEPTION + /// - #ANTLR3_MISMATCHED_SET_EXCEPTION + /// - #ANTLR3_EARLY_EXIT_EXCEPTION + /// - #ANTLR3_FAILED_PREDICATE_EXCEPTION + /// - #ANTLR3_EARLY_EXIT_EXCEPTION + /// + ANTLR3_UINT32 type; + + /** The string name of the exception + */ + void * name; + + /** The printable message that goes with this exception, in your preferred + * encoding format. ANTLR just uses ASCII by default but you can ignore these + * messages or convert them to another format or whatever of course. They are + * really internal messages that you then decide how to print out in a form that + * the users of your product will understand, as they are unlikely to know what + * to do with "Recognition exception at: [[TOK_GERUND..... " ;-) + */ + void * message; + + /** Name of the file/input source for reporting. Note that this may be NULL!! + */ + pANTLR3_STRING streamName; + + /** If set to ANTLR3_TRUE, this indicates that the message element of this structure + * should be freed by calling ANTLR3_FREE() when the exception is destroyed. + */ + ANTLR3_BOOLEAN freeMessage; + + /** Indicates the index of the 'token' we were looking at when the + * exception occurred. + */ + ANTLR3_MARKER index; + + /** Indicates what the current token/tree was when the error occurred. Since not + * all input streams will be able to retrieve the nth token, we track it here + * instead. This is for parsers, and even tree parsers may set this. + */ + void * token; + + /** Indicates the token we were expecting to see next when the error occurred + */ + ANTLR3_UINT32 expecting; + + /** Indicates a set of tokens that we were expecting to see one of when the + * error occurred. It is a following bitset list, so you can use load it and use ->toIntList() on it + * to generate an array of integer tokens that it represents. + */ + pANTLR3_BITSET_LIST expectingSet; + + /** If this is a tree parser exception then the node is set to point to the node + * that caused the issue. + */ + void * node; + + /** The current character when an error occurred - for lexers. + */ + ANTLR3_UCHAR c; + + /** Track the line at which the error occurred in case this is + * generated from a lexer. We need to track this since the + * unexpected char doesn't carry the line info. + */ + ANTLR3_UINT32 line; + + /** Character position in the line where the error occurred. + */ + ANTLR3_INT32 charPositionInLine; + + /** decision number for NVE + */ + ANTLR3_UINT32 decisionNum; + + /** State for NVE + */ + ANTLR3_UINT32 state; + + /** Rule name for failed predicate exception + */ + void * ruleName; + + /** Pointer to the next exception in the chain (if any) + */ + struct ANTLR3_EXCEPTION_struct * nextException; + + /** Pointer to the input stream that this exception occurred in. + */ + pANTLR3_INT_STREAM input; + + /** Pointer for you, the programmer to add anything you like to an exception. + */ + void * custom; + + /** Pointer to a routine that is called to free the custom exception structure + * when the exception is destroyed. Set to NULL if nothing should be done. + */ + void (*freeCustom) (void * custom); + void (*print) (struct ANTLR3_EXCEPTION_struct * ex); + void (*freeEx) (struct ANTLR3_EXCEPTION_struct * ex); + +} + ANTLR3_EXCEPTION; + +#ifdef __cplusplus +} +#endif + + +#endif diff --git a/depends/antlr3c/antlr3filestream.h b/depends/antlr3c/antlr3filestream.h new file mode 100644 index 0000000..b06eb45 --- /dev/null +++ b/depends/antlr3c/antlr3filestream.h @@ -0,0 +1,50 @@ +#ifndef _ANTLR3_FILESTREAM_H +#define _ANTLR3_FILESTREAM_H + +// [The "BSD licence"] +// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC +// http://www.temporal-wave.com +// http://www.linkedin.com/in/jimidle +// +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. The name of the author may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +ANTLR3_API ANTLR3_FDSC antlr3Fopen (pANTLR3_UINT8 filename, const char * mode); +ANTLR3_API void antlr3Fclose (ANTLR3_FDSC fd); + +ANTLR3_API ANTLR3_UINT32 antlr3Fsize (pANTLR3_UINT8 filename); +ANTLR3_API ANTLR3_UINT32 antlr3read8Bit (pANTLR3_INPUT_STREAM input, pANTLR3_UINT8 fileName); +ANTLR3_API ANTLR3_UINT32 antlr3Fread (ANTLR3_FDSC fdsc, ANTLR3_UINT32 count, void * data); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/depends/antlr3c/antlr3input.h b/depends/antlr3c/antlr3input.h new file mode 100644 index 0000000..3b01ae6 --- /dev/null +++ b/depends/antlr3c/antlr3input.h @@ -0,0 +1,281 @@ +/** \file + * Defines the basic structures used to manipulate character + * streams from any input source. Any character size and encoding + * can in theory be used, so long as a set of functinos is provided that + * can return a 32 bit Integer representation of their characters amd efficiently mark and revert + * to specific offsets into their input streams. + */ +#ifndef _ANTLR3_INPUT_H +#define _ANTLR3_INPUT_H + +// [The "BSD licence"] +// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC +// http://www.temporal-wave.com +// http://www.linkedin.com/in/jimidle +// +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. The name of the author may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + + + +/// Master context structure for an ANTLR3 C runtime based input stream. +/// \ingroup apistructures +/// +typedef struct ANTLR3_INPUT_STREAM_struct +{ + /** Interfaces that provide streams must all provide + * a generic ANTLR3_INT_STREAM interface and an ANTLR3_INPUT_STREAM + * is no different. + */ + pANTLR3_INT_STREAM istream; + + /** Whatever super structure is providing the INPUT stream needs a pointer to itself + * so that this can be passed back to it whenever the api functions + * are called back from this interface. + */ + void * super; + + /** Pointer the start of the input string, characters may be + * taken as offsets from here and in original input format encoding. + */ + void * data; + + /** Indicates if the data pointer was allocated by us, and so should be freed + * when the stream dies. + */ + int isAllocated; + + /** String factory for this input stream + */ + pANTLR3_STRING_FACTORY strFactory; + + + /** Pointer to the next character to be consumed from the input data + * This is cast to point at the encoding of the original file that + * was read by the functions installed as pointer in this input stream + * context instance at file/string/whatever load time. + */ + void * nextChar; + + /** Number of characters that can be consumed at this point in time. + * Mostly this is just what is left in the pre-read buffer, but if the + * input source is a stream such as a socket or something then we may + * call special read code to wait for more input. + */ + ANTLR3_UINT32 sizeBuf; + + /** The line number we are traversing in the input file. This gets incremented + * by a newline() call in the lexer grammar actions. + */ + ANTLR3_UINT32 line; + + /** Pointer into the input buffer where the current line + * started. + */ + void * currentLine; + + /** The offset within the current line of the current character + */ + ANTLR3_INT32 charPositionInLine; + + /** Tracks how deep mark() calls are nested + */ + ANTLR3_UINT32 markDepth; + + /** List of mark() points in the input stream + */ + pANTLR3_VECTOR markers; + + /** File name string, set to pointer to memory if + * you set it manually as it will be free()d + */ + pANTLR3_STRING fileName; + + /** File number, needs to be set manually to some file index of your devising. + */ + ANTLR3_UINT32 fileNo; + + /* API */ + + + /** Pointer to function that closes the input stream + */ + void (*close) (struct ANTLR3_INPUT_STREAM_struct * input); + void (*free) (struct ANTLR3_INPUT_STREAM_struct * input); + + /** Pointer to function that resets the input stream + */ + void (*reset) (struct ANTLR3_INPUT_STREAM_struct * input); + + /** Pointer to a function that reuses and resets an input stream by + * supplying a new 'source' + */ + void (*reuse) (struct ANTLR3_INPUT_STREAM_struct * input, pANTLR3_UINT8 inString, ANTLR3_UINT32 size, pANTLR3_UINT8 name); + + /** + * Pointer to function that installs a version of LA that always + * returns upper case. Only valid for character streams and creates a case + * insensitive lexer if the lexer tokens are described in upper case. The + * tokens will preserve case in the token text. + */ + void (*setUcaseLA) (pANTLR3_INPUT_STREAM input, ANTLR3_BOOLEAN flag); + + /** Pointer to function to return input stream element at 1 based + * offset from nextChar. Same as _LA for char stream, but token + * streams etc. have one of these that does other stuff of course. + */ + void * (*_LT) (struct ANTLR3_INPUT_STREAM_struct * input, ANTLR3_INT32 lt); + + /** Pointer to function to return the total size of the input buffer. For streams + * this may be just the total we have available so far. This means of course that + * the input stream must be careful to accumulate enough input so that any backtracking + * can be satisfied. + */ + ANTLR3_UINT32 (*size) (struct ANTLR3_INPUT_STREAM_struct * input); + + /** Pointer to function to return a substring of the input stream. String is returned in allocated + * memory and is in same encoding as the input stream itself, NOT internal ANTLR3_UCHAR form. + */ + pANTLR3_STRING (*substr) (struct ANTLR3_INPUT_STREAM_struct * input, ANTLR3_MARKER start, ANTLR3_MARKER stop); + + /** Pointer to function to return the current line number in the input stream + */ + ANTLR3_UINT32 (*getLine) (struct ANTLR3_INPUT_STREAM_struct * input); + + /** Pointer to function to return the current line buffer in the input stream + * The pointer returned is directly into the input stream so you must copy + * it if you wish to manipulate it without damaging the input stream. Encoding + * is obviously in the same form as the input stream. + * \remark + * - Note taht this function wil lbe inaccurate if setLine is called as there + * is no way at the moment to position the input stream at a particular line + * number offset. + */ + void * (*getLineBuf) (struct ANTLR3_INPUT_STREAM_struct * input); + + /** Pointer to function to return the current offset in the current input stream line + */ + ANTLR3_UINT32 (*getCharPositionInLine) (struct ANTLR3_INPUT_STREAM_struct * input); + + /** Pointer to function to set the current line number in the input stream + */ + void (*setLine) (struct ANTLR3_INPUT_STREAM_struct * input, ANTLR3_UINT32 line); + + /** Pointer to function to set the current position in the current line. + */ + void (*setCharPositionInLine) (struct ANTLR3_INPUT_STREAM_struct * input, ANTLR3_UINT32 position); + + /** Pointer to function to override the default newline character that the input stream + * looks for to trigger the line/offset and line buffer recording information. + * \remark + * - By default the chracter '\n' will be installed as the newline trigger character. When this + * character is seen by the consume() function then the current line number is incremented and the + * current line offset is reset to 0. The Pointer for the line of input we are consuming + * is updated to point to the next character after this one in the input stream (which means it + * may become invalid if the last newline character in the file is seen (so watch out). + * - If for some reason you do not want the counters and pointers to be restee, you can set the + * chracter to some impossible character such as '\0' or whatever. + * - This is a single character only, so choose the last character in a sequence of two or more. + * - This is only a simple aid to error reporting - if you have a complicated binary input structure + * it may not be adequate, but you can always override every function in the input stream with your + * own of course, and can even write your own complete input stream set if you like. + * - It is your responsiblity to set a valid character for the input stream type. There is no point + * setting this to 0xFFFFFFFF if the input stream is 8 bit ASCII, as this will just be truncated and never + * trigger as the comparison will be (INT32)0xFF == (INT32)0xFFFFFFFF + */ + void (*SetNewLineChar) (struct ANTLR3_INPUT_STREAM_struct * input, ANTLR3_UINT32 newlineChar); + + /// Character that automatically causes an internal line count + /// increment. + /// + ANTLR3_UCHAR newlineChar; + + /// Indicates the size, in 8 bit units, of a single character. Note that + /// the C runtime does not deal with surrogates as this would be + /// slow and complicated. If this is a UTF-8 stream then this field + /// will be set to 0. Generally you are best working internally with 32 bit characters + /// as this is the most efficient. + /// + ANTLR3_UINT8 charByteSize; + + /// Indicates the encoding scheme used in this input stream + /// + ANTLR3_UINT32 encoding; +} + + ANTLR3_INPUT_STREAM; + + +/** \brief Structure for track lex input states as part of mark() + * and rewind() of lexer. + */ +typedef struct ANTLR3_LEX_STATE_struct +{ + /** Pointer to the next character to be consumed from the input data + * This is cast to point at the encoding of the original file that + * was read by the functions installed as pointer in this input stream + * context instance at file/string/whatever load time. + */ + void * nextChar; + + /** The line number we are traversing in the input file. This gets incremented + * by a newline() call in the lexer grammer actions. + */ + ANTLR3_UINT32 line; + + /** Pointer into the input buffer where the current line + * started. + */ + void * currentLine; + + /** The offset within the current line of the current character + */ + ANTLR3_INT32 charPositionInLine; + +} + ANTLR3_LEX_STATE; + +/* Prototypes + */ +void antlr38BitSetupStream (pANTLR3_INPUT_STREAM input); +void antlr3UTF16SetupStream (pANTLR3_INPUT_STREAM input, ANTLR3_BOOLEAN machineBigEndian, ANTLR3_BOOLEAN inputBigEndian); +void antlr3UTF32SetupStream (pANTLR3_INPUT_STREAM input, ANTLR3_BOOLEAN machineBigEndian, ANTLR3_BOOLEAN inputBigEndian); +void antlr3UTF8SetupStream (pANTLR3_INPUT_STREAM input); +void antlr3EBCDICSetupStream (pANTLR3_INPUT_STREAM input); +void antlr3GenericSetupStream (pANTLR3_INPUT_STREAM input); +#ifdef __cplusplus +} +#endif + +#endif /* _ANTLR3_INPUT_H */ diff --git a/depends/antlr3c/antlr3interfaces.h b/depends/antlr3c/antlr3interfaces.h new file mode 100644 index 0000000..160e04d --- /dev/null +++ b/depends/antlr3c/antlr3interfaces.h @@ -0,0 +1,239 @@ +/** \file + * Declarations for all the antlr3 C runtime interfaces/classes. This + * allows the structures that define the interfaces to contain pointers to + * each other without trying to sort out the cyclic interdependencies that + * would otherwise result. + */ +#ifndef _ANTLR3_INTERFACES_H +#define _ANTLR3_INTERFACES_H + +// [The "BSD licence"] +// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC +// http://www.temporal-wave.com +// http://www.linkedin.com/in/jimidle +// +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. The name of the author may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct ANTLR3_INT_STREAM_struct *pANTLR3_INT_STREAM; + +/// Pointer to an instantiation of the 'class' #ANTLR3_BASE_RECOGNIZER +/// \ingroup ANTLR3_BASE_RECOGNIZER +/// +typedef struct ANTLR3_BASE_RECOGNIZER_struct *pANTLR3_BASE_RECOGNIZER; +/// Pointer to an instantiation of 'class' #ANTLR3_RECOGNIZER_SHARED_STATE +/// \ingroup ANTLR3_RECOGNIZER_SHARED_STATE +/// +typedef struct ANTLR3_RECOGNIZER_SHARED_STATE_struct *pANTLR3_RECOGNIZER_SHARED_STATE; + +/// Pointer to an instantiation of 'class' #ANTLR3_BITSET_LIST +/// \ingroup ANTLR3_BITSET_LIST +/// +typedef struct ANTLR3_BITSET_LIST_struct *pANTLR3_BITSET_LIST; + +/// Pointer to an instantiation of 'class' #ANTLR3_BITSET +/// \ingroup ANTLR3_BITSET +/// +typedef struct ANTLR3_BITSET_struct *pANTLR3_BITSET; + +/// Pointer to an instantiation of 'class' #ANTLR3_TOKEN_FACTORY +/// \ingroup ANTLR3_TOKEN_FACTORY +/// +typedef struct ANTLR3_TOKEN_FACTORY_struct *pANTLR3_TOKEN_FACTORY; +/// Pointer to an instantiation of 'class' #ANTLR3_COMMON_TOKEN +/// \ingroup ANTLR3_COMMON_TOKEN +/// +typedef struct ANTLR3_COMMON_TOKEN_struct *pANTLR3_COMMON_TOKEN; + +/// Pointer to an instantiation of 'class' #ANTLR3_EXCEPTION +/// \ingroup ANTLR3_EXCEPTION +/// +typedef struct ANTLR3_EXCEPTION_struct *pANTLR3_EXCEPTION; + +/// Pointer to an instantiation of 'class' #ANTLR3_HASH_BUCKET +/// \ingroup ANTLR3_HASH_BUCKET +/// +typedef struct ANTLR3_HASH_BUCKET_struct *pANTLR3_HASH_BUCKET; +/// Pointer to an instantiation of 'class' #ANTLR3_HASH_ENTRY +/// \ingroup ANTLR3_HASH_ENTRY +/// +typedef struct ANTLR3_HASH_ENTRY_struct *pANTLR3_HASH_ENTRY; +/// Pointer to an instantiation of 'class' #ANTLR3_HASH_ENUM +/// \ingroup ANTLR3_HASH_ENUM +/// +typedef struct ANTLR3_HASH_ENUM_struct *pANTLR3_HASH_ENUM; +/// Pointer to an instantiation of 'class' #ANTLR3_HASH_TABLE +/// \ingroup ANTLR3_HASH_TABLE +/// +typedef struct ANTLR3_HASH_TABLE_struct *pANTLR3_HASH_TABLE; + +/// Pointer to an instantiation of 'class' #ANTLR3_LIST +/// \ingroup ANTLR3_LIST +/// +typedef struct ANTLR3_LIST_struct *pANTLR3_LIST; +/// Pointer to an instantiation of 'class' #ANTLR3_VECTOR_FACTORY +/// \ingroup ANTLR3_VECTOR_FACTORY +/// +typedef struct ANTLR3_VECTOR_FACTORY_struct *pANTLR3_VECTOR_FACTORY; +/// Pointer to an instantiation of 'class' #ANTLR3_VECTOR +/// \ingroup ANTLR3_VECTOR +/// +typedef struct ANTLR3_VECTOR_struct *pANTLR3_VECTOR; +/// Pointer to an instantiation of 'class' #ANTLR3_STACK +/// \ingroup ANTLR3_STACK +/// +typedef struct ANTLR3_STACK_struct *pANTLR3_STACK; + +/// Pointer to an instantiation of 'class' #ANTLR3_TOPO +/// \ingroup ANTLR3_TOPO +/// +typedef struct ANTLR3_TOPO_struct *pANTLR3_TOPO; + +/// Pointer to an instantiation of 'class' #ANTLR3_INPUT_STREAM +/// \ingroup ANTLR3_INPUT_STREAM +/// +typedef struct ANTLR3_INPUT_STREAM_struct *pANTLR3_INPUT_STREAM; +/// Pointer to an instantiation of 'class' #ANTLR3_LEX_STATE +/// \ingroup ANTLR3_LEX_STATE +/// +typedef struct ANTLR3_LEX_STATE_struct *pANTLR3_LEX_STATE; + +/// Pointer to an instantiation of 'class' #ANTLR3_STRING_FACTORY +/// \ingroup ANTLR3_STRING_FACTORY +/// +typedef struct ANTLR3_STRING_FACTORY_struct *pANTLR3_STRING_FACTORY; +/// Pointer to an instantiation of 'class' #ANTLR3_STRING +/// \ingroup ANTLR3_STRING +/// +typedef struct ANTLR3_STRING_struct *pANTLR3_STRING; + +/// Pointer to an instantiation of 'class' #ANTLR3_TOKEN_SOURCE +/// \ingroup ANTLR3_TOKEN_SOURCE +/// +typedef struct ANTLR3_TOKEN_SOURCE_struct *pANTLR3_TOKEN_SOURCE; +/// Pointer to an instantiation of 'class' #ANTLR3_TOKEN_STREAM +/// \ingroup ANTLR3_TOKEN_STREAM +/// +typedef struct ANTLR3_TOKEN_STREAM_struct *pANTLR3_TOKEN_STREAM; +/// Pointer to an instantiation of 'class' #ANTLR3_COMMON_TOKEN_STREAM +/// \ingroup ANTLR3_COMMON_TOKEN_STREAM +/// +typedef struct ANTLR3_COMMON_TOKEN_STREAM_struct *pANTLR3_COMMON_TOKEN_STREAM; + +/// Pointer to an instantiation of 'class' #ANTLR3_CYCLIC_DFA +/// \ingroup ANTLR3_CYCLIC_DFA +/// +typedef struct ANTLR3_CYCLIC_DFA_struct *pANTLR3_CYCLIC_DFA; + +/// Pointer to an instantiation of 'class' #ANTLR3_LEXER +/// \ingroup ANTLR3_LEXER +/// +typedef struct ANTLR3_LEXER_struct *pANTLR3_LEXER; +/// Pointer to an instantiation of 'class' #ANTLR3_PARSER +/// \ingroup ANTLR3_PARSER +/// +typedef struct ANTLR3_PARSER_struct *pANTLR3_PARSER; + +/// Pointer to an instantiation of 'class' #ANTLR3_BASE_TREE +/// \ingroup ANTLR3_BASE_TREE +/// +typedef struct ANTLR3_BASE_TREE_struct *pANTLR3_BASE_TREE; +/// Pointer to an instantiation of 'class' #ANTLR3_COMMON_TREE +/// \ingroup ANTLR3_COMMON_TREE +/// +typedef struct ANTLR3_COMMON_TREE_struct *pANTLR3_COMMON_TREE; +/// Pointer to an instantiation of 'class' #ANTLR3_ARBORETUM +/// \ingroup ANTLR3_ARBORETUM +/// +typedef struct ANTLR3_ARBORETUM_struct *pANTLR3_ARBORETUM; +/// Pointer to an instantiation of 'class' #ANTLR3_PARSE_TREE +/// \ingroup ANTLR3_PARSE_TREE +/// +typedef struct ANTLR3_PARSE_TREE_struct *pANTLR3_PARSE_TREE; + +/// Pointer to an instantiation of 'class' #ANTLR3_TREE_NODE_STREAM +/// \ingroup ANTLR3_TREE_NODE_STREAM +/// +typedef struct ANTLR3_TREE_NODE_STREAM_struct *pANTLR3_TREE_NODE_STREAM; +/// Pointer to an instantiation of 'class' #ANTLR3_COMMON_TREE_NODE_STREAM +/// \ingroup ANTLR3_COMMON_TREE_NODE_STREAM +/// +typedef struct ANTLR3_COMMON_TREE_NODE_STREAM_struct *pANTLR3_COMMON_TREE_NODE_STREAM; +/// Pointer to an instantiation of 'class' #ANTLR3_TREE_WALK_STATE +/// \ingroup ANTLR3_TREE_WALK_STATE +/// +typedef struct ANTLR3_TREE_WALK_STATE_struct *pANTLR3_TREE_WALK_STATE; + +/// Pointer to an instantiation of 'class' #ANTLR3_BASE_TREE_ADAPTOR +/// \ingroup ANTLR3_BASE_TREE_ADAPTOR +/// +typedef struct ANTLR3_BASE_TREE_ADAPTOR_struct *pANTLR3_BASE_TREE_ADAPTOR; +/// Pointer to an instantiation of 'class' #ANTLR3_COMMON_TREE_ADAPTOR +/// \ingroup ANTLR3_COMMON_TREE_ADAPTOR +/// +typedef struct ANTLR3_COMMON_TREE_ADAPTOR_struct *pANTLR3_COMMON_TREE_ADAPTOR; + +/// Pointer to an instantiation of 'class' #ANTLR3_TREE_PARSER +/// \ingroup ANTLR3_TREE_PARSER +/// +typedef struct ANTLR3_TREE_PARSER_struct *pANTLR3_TREE_PARSER; + +/// Pointer to an instantiation of 'class' #ANTLR3_INT_TRIE +/// \ingroup ANTLR3_INT_TRIE +/// +typedef struct ANTLR3_INT_TRIE_struct *pANTLR3_INT_TRIE; + +/// Pointer to an instantiation of 'class' #ANTLR3_REWRITE_RULE_ELEMENT_STREAM +/// \ingroup ANTLR3_REWRITE_RULE_ELEMENT_STREAM +/// +typedef struct ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct *pANTLR3_REWRITE_RULE_ELEMENT_STREAM; +/// Pointer to an instantiation of 'class' #ANTLR3_REWRITE_RULE_ELEMENT_STREAM +/// \ingroup ANTLR3_REWRITE_RULE_ELEMENT_STREAM +/// +typedef struct ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct *pANTLR3_REWRITE_RULE_TOKEN_STREAM; + +/// Pointer to an instantiation of 'class' #ANTLR3_REWRITE_RULE_SUBSTREE_STREAM +/// \ingroup ANTLR3_REWRITE_RULE_SUBTREE_STREAM +/// +typedef struct ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct *pANTLR3_REWRITE_RULE_SUBTREE_STREAM; + +/// Pointer to an instantiation of 'class' #ANTLR3_REWRITE_RULE_NODE_STREAM +/// \ingroup ANTLR3_REWRITE_RULE_NODE_STREAM +/// +typedef struct ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct *pANTLR3_REWRITE_RULE_NODE_STREAM; + +/// Pointer to an instantiation of 'class' #ANTLR3_DEBUG_EVENT_LISTENER +/// \ingroup ANTLR3_DEBUG_EVENT_LISTENER +/// +typedef struct ANTLR3_DEBUG_EVENT_LISTENER_struct *pANTLR3_DEBUG_EVENT_LISTENER; + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/depends/antlr3c/antlr3intstream.h b/depends/antlr3c/antlr3intstream.h new file mode 100644 index 0000000..21bac5b --- /dev/null +++ b/depends/antlr3c/antlr3intstream.h @@ -0,0 +1,205 @@ +/** \file + * Defines the the class interface for an antlr3 INTSTREAM. + * + * Certain functionality (such as DFAs for instance) abstract the stream of tokens + * or characters in to a steam of integers. Hence this structure should be included + * in any stream that is able to provide the output as a stream of integers (which is anything + * basically. + * + * There are no specific implementations of the methods in this interface in general. Though + * for purposes of casting and so on, it may be necesssary to implement a function with + * the signature in this interface which abstracts the base immplementation. In essence though + * the base stream provides a pointer to this interface, within which it installs its + * normal match() functions and so on. Interaces such as DFA are then passed the pANTLR3_INT_STREAM + * and can treat any input as an int stream. + * + * For instance, a lexer implements a pANTLR3_BASE_RECOGNIZER, within which there is a pANTLR3_INT_STREAM. + * However, a pANTLR3_INPUT_STREAM also provides a pANTLR3_INT_STREAM, which it has constructed from + * it's normal interface when it was created. This is then pointed at by the pANTLR_BASE_RECOGNIZER + * when it is intialized with a pANTLR3_INPUT_STREAM. + * + * Similarly if a pANTLR3_BASE_RECOGNIZER is initialized with a pANTLR3_TOKEN_STREAM, then the + * pANTLR3_INT_STREAM is taken from the pANTLR3_TOKEN_STREAM. + * + * If a pANTLR3_BASE_RECOGNIZER is initialized with a pANTLR3_TREENODE_STREAM, then guess where + * the pANTLR3_INT_STREAM comes from? + * + * Note that because the context pointer points to the actual interface structure that is providing + * the ANTLR3_INT_STREAM it is defined as a (void *) in this interface. There is no direct implementation + * of an ANTLR3_INT_STREAM (unless someone did not understand what I was doing here =;?P + */ +#ifndef _ANTLR3_INTSTREAM_H +#define _ANTLR3_INTSTREAM_H + +// [The "BSD licence"] +// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC +// http://www.temporal-wave.com +// http://www.linkedin.com/in/jimidle +// +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. The name of the author may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include +#include + +/** Type indicator for a character stream + * \remark if a custom stream is created but it can be treated as + * a char stream, then you may OR in this value to your type indicator + */ +#define ANTLR3_CHARSTREAM 0x0001 + +/** Type indicator for a Token stream + * \remark if a custom stream is created but it can be treated as + * a token stream, then you may OR in this value to your type indicator + */ +#define ANTLR3_TOKENSTREAM 0x0002 + +/** Type indicator for a common tree node stream + * \remark if a custom stream is created but it can be treated as + * a common tree node stream, then you may OR in this value to your type indicator + */ +#define ANTLR3_COMMONTREENODE 0x0004 + +/** Type mask for input stream so we can switch in the above types + * \remark DO NOT USE 0x0000 as a stream type! + */ +#define ANTLR3_INPUT_MASK 0x0007 + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct ANTLR3_INT_STREAM_struct +{ + /** Input stream type indicator. Sometimes useful for error reporting etc. + */ + ANTLR3_UINT32 type; + + /** Potentially useful in error reporting and so on, this string is + * an identification of the input source. It may be NULL, so anything + * attempting to access it needs to check this and substitute a sensible + * default. + */ + pANTLR3_STRING streamName; + + /** Pointer to the super structure that contains this interface. This + * will usually be a token stream or a tree stream. + */ + void * super; + + /** Last marker position allocated + */ + ANTLR3_MARKER lastMarker; + + // Return a string that identifies the input source + // + pANTLR3_STRING (*getSourceName) (struct ANTLR3_INT_STREAM_struct * intStream); + + /** Consume the next 'ANTR3_UINT32' in the stream + */ + void (*consume) (struct ANTLR3_INT_STREAM_struct * intStream); + + /** Get ANTLR3_UINT32 at current input pointer + i ahead where i=1 is next ANTLR3_UINT32 + */ + ANTLR3_UINT32 (*_LA) (struct ANTLR3_INT_STREAM_struct * intStream, ANTLR3_INT32 i); + + /** Tell the stream to start buffering if it hasn't already. Return + * current input position, index(), or some other marker so that + * when passed to rewind() you get back to the same spot. + * rewind(mark()) should not affect the input cursor. + */ + ANTLR3_MARKER (*mark) (struct ANTLR3_INT_STREAM_struct * intStream); + + /** Return the current input symbol index 0..n where n indicates the + * last symbol has been read. + */ + ANTLR3_MARKER (*index) (struct ANTLR3_INT_STREAM_struct * intStream); + + /** Reset the stream so that next call to index would return marker. + * The marker will usually be index() but it doesn't have to be. It's + * just a marker to indicate what state the stream was in. This is + * essentially calling release() and seek(). If there are markers + * created after this marker argument, this routine must unroll them + * like a stack. Assume the state the stream was in when this marker + * was created. + */ + void (*rewind) (struct ANTLR3_INT_STREAM_struct * intStream, ANTLR3_MARKER marker); + + /** Reset the stream to the last marker position, witouh destryoing the + * last marker position. + */ + void (*rewindLast) (struct ANTLR3_INT_STREAM_struct * intStream); + + /** You may want to commit to a backtrack but don't want to force the + * stream to keep bookkeeping objects around for a marker that is + * no longer necessary. This will have the same behavior as + * rewind() except it releases resources without the backward seek. + */ + void (*release) (struct ANTLR3_INT_STREAM_struct * intStream, ANTLR3_MARKER mark); + + /** Set the input cursor to the position indicated by index. This is + * normally used to seek ahead in the input stream. No buffering is + * required to do this unless you know your stream will use seek to + * move backwards such as when backtracking. + * + * This is different from rewind in its multi-directional + * requirement and in that its argument is strictly an input cursor (index). + * + * For char streams, seeking forward must update the stream state such + * as line number. For seeking backwards, you will be presumably + * backtracking using the mark/rewind mechanism that restores state and + * so this method does not need to update state when seeking backwards. + * + * Currently, this method is only used for efficient backtracking, but + * in the future it may be used for incremental parsing. + */ + void (*seek) (struct ANTLR3_INT_STREAM_struct * intStream, ANTLR3_MARKER index); + + /** Only makes sense for streams that buffer everything up probably, but + * might be useful to display the entire stream or for testing. + */ + ANTLR3_UINT32 (*size) (struct ANTLR3_INT_STREAM_struct * intStream); + + /** Because the indirect call, though small in individual cases can + * mount up if there are thousands of tokens (very large input streams), callers + * of size can optionally use this cached size field. + */ + ANTLR3_UINT32 cachedSize; + + /** Frees any resources that were allocated for the implementation of this + * interface. Usually this is just releasing the memory allocated + * for the structure itself, but it may of course do anything it need to + * so long as it does not stamp on anything else. + */ + void (*free) (struct ANTLR3_INT_STREAM_struct * stream); + +} + ANTLR3_INT_STREAM; + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/depends/antlr3c/antlr3lexer.h b/depends/antlr3c/antlr3lexer.h new file mode 100644 index 0000000..6cc10ef --- /dev/null +++ b/depends/antlr3c/antlr3lexer.h @@ -0,0 +1,193 @@ +/** \file + * Base interface for any ANTLR3 lexer. + * + * An ANLTR3 lexer builds from two sets of components: + * + * - The runtime components that provide common functionality such as + * traversing character streams, building tokens for output and so on. + * - The generated rules and struutre of the actual lexer, which call upon the + * runtime components. + * + * A lexer class contains a character input stream, a base recognizer interface + * (which it will normally implement) and a token source interface (which it also + * implements. The Tokensource interface is called by a token consumer (such as + * a parser, but in theory it can be anything that wants a set of abstract + * tokens in place of a raw character stream. + * + * So then, we set up a lexer in a sequence akin to: + * + * - Create a character stream (something which implements ANTLR3_INPUT_STREAM) + * and initialize it. + * - Create a lexer interface and tell it where it its input stream is. + * This will cause the creation of a base recognizer class, which it will + * override with its own implementations of some methods. The lexer creator + * can also then in turn override anything it likes. + * - The lexer token source interface is then passed to some interface that + * knows how to use it, byte calling for a next token. + * - When a next token is called, let ze lexing begin. + * + */ +#ifndef _ANTLR3_LEXER +#define _ANTLR3_LEXER + +// [The "BSD licence"] +// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC +// http://www.temporal-wave.com +// http://www.linkedin.com/in/jimidle +// +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. The name of the author may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +/* Definitions + */ +#define ANTLR3_STRING_TERMINATOR 0xFFFFFFFF + +#include +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct ANTLR3_LEXER_struct +{ + /** If there is a super structure that is implementing the + * lexer, then a pointer to it can be stored here in case + * implementing functions are overridden by this super structure. + */ + void * super; + + /** A generated lexer has an mTokens() function, which needs + * the context pointer of the generated lexer, not the base lexer interface + * this is stored here and initialized by the generated code (or manually + * if this is a manually built lexer. + */ + void * ctx; + + /** A pointer to the character stream whence this lexer is receiving + * characters. + * TODO: I may come back to this and implement charstream outside + * the input stream as per the java implementation. + */ + pANTLR3_INPUT_STREAM input; + + /** Pointer to the implementation of a base recognizer, which the lexer + * creates and then overrides with its own lexer oriented functions (the + * default implementation is parser oriented). This also contains a + * token source interface, which the lexer instance will provide to anything + * that needs it, which is anything else that implements a base recognizer, + * such as a parser. + */ + pANTLR3_BASE_RECOGNIZER rec; + + /** Pointer to a function that sets the charstream source for the lexer and + * causes it to be reset. + */ + void (*setCharStream) (struct ANTLR3_LEXER_struct * lexer, pANTLR3_INPUT_STREAM input); + + /** Pointer to a function that switches the current character input stream to + * a new one, saving the old one, which we will revert to at the end of this + * new one. + */ + void (*pushCharStream) (struct ANTLR3_LEXER_struct * lexer, pANTLR3_INPUT_STREAM input); + + /** Pointer to a function that abandons the current input stream, whether it + * is empty or not and reverts to the previous stacked input stream. + */ + void (*popCharStream) (struct ANTLR3_LEXER_struct * lexer); + + /** Pointer to a function that emits the supplied token as the next token in + * the stream. + */ + void (*emitNew) (struct ANTLR3_LEXER_struct * lexer, pANTLR3_COMMON_TOKEN token); + + /** Pointer to a function that constructs a new token from the lexer stored information + */ + pANTLR3_COMMON_TOKEN (*emit) (struct ANTLR3_LEXER_struct * lexer); + + /** Pointer to the user provided (either manually or through code generation + * function that causes the lexer rules to run the lexing rules and produce + * the next token if there iss one. This is called from nextToken() in the + * pANTLR3_TOKEN_SOURCE. Note that the input parameter for this funciton is + * the generated lexer context (stored in ctx in this interface) it is a generated + * function and expects the context to be the generated lexer. + */ + void (*mTokens) (void * ctx); + + /** Pointer to a function that attempts to match and consume the specified string from the input + * stream. Note that strings muse be passed as terminated arrays of ANTLR3_UCHAR. Strings are terminated + * with 0xFFFFFFFF, which is an invalid UTF32 character + */ + ANTLR3_BOOLEAN (*matchs) (struct ANTLR3_LEXER_struct * lexer, ANTLR3_UCHAR * string); + + /** Pointer to a function that matches and consumes the specified character from the input stream. + * The input stream is required to provide characters via LA() as UTF32 characters. The default lexer + * implementation is source encoding agnostic and so input streams do not generally need to + * override the default implmentation. + */ + ANTLR3_BOOLEAN (*matchc) (struct ANTLR3_LEXER_struct * lexer, ANTLR3_UCHAR c); + + /** Pointer to a function that matches any character in the supplied range (I suppose it could be a token range too + * but this would only be useful if the tokens were in tsome guaranteed order which is + * only going to happen with a hand crafted token set). + */ + ANTLR3_BOOLEAN (*matchRange) (struct ANTLR3_LEXER_struct * lexer, ANTLR3_UCHAR low, ANTLR3_UCHAR high); + + /** Pointer to a function that matches the next token/char in the input stream + * regardless of what it actaully is. + */ + void (*matchAny) (struct ANTLR3_LEXER_struct * lexer); + + /** Pointer to a function that recovers from an error found in the input stream. + * Generally, this will be a #ANTLR3_EXCEPTION_NOVIABLE_ALT but it could also + * be from a mismatched token that the (*match)() could not recover from. + */ + void (*recover) (struct ANTLR3_LEXER_struct * lexer); + + /** Pointer to function to return the current line number in the input stream + */ + ANTLR3_UINT32 (*getLine) (struct ANTLR3_LEXER_struct * lexer); + ANTLR3_MARKER (*getCharIndex) (struct ANTLR3_LEXER_struct * lexer); + ANTLR3_UINT32 (*getCharPositionInLine)(struct ANTLR3_LEXER_struct * lexer); + + /** Pointer to function to return the text so far for the current token being generated + */ + pANTLR3_STRING (*getText) (struct ANTLR3_LEXER_struct * lexer); + + + /** Pointer to a function that knows how to free the resources of a lexer + */ + void (*free) (struct ANTLR3_LEXER_struct * lexer); + +} + ANTLR3_LEXER; + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/depends/antlr3c/antlr3memory.h b/depends/antlr3c/antlr3memory.h new file mode 100644 index 0000000..5e2d4c9 --- /dev/null +++ b/depends/antlr3c/antlr3memory.h @@ -0,0 +1,36 @@ +#ifndef _ANTLR3MEMORY_H +#define _ANTLR3MEMORY_H + +// [The "BSD licence"] +// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC +// http://www.temporal-wave.com +// http://www.linkedin.com/in/jimidle +// +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. The name of the author may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include + + +#endif /* _ANTLR3MEMORY_H */ diff --git a/depends/antlr3c/antlr3parser.h b/depends/antlr3c/antlr3parser.h new file mode 100644 index 0000000..95b7d18 --- /dev/null +++ b/depends/antlr3c/antlr3parser.h @@ -0,0 +1,93 @@ +/** \file + * Base implementation of an ANTLR3 parser. + * + * + */ +#ifndef _ANTLR3_PARSER_H +#define _ANTLR3_PARSER_H + +// [The "BSD licence"] +// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC +// http://www.temporal-wave.com +// http://www.linkedin.com/in/jimidle +// +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. The name of the author may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** This is the main interface for an ANTLR3 parser. + */ +typedef struct ANTLR3_PARSER_struct +{ + /** All superstructure implementers of this interface require a pointer to their selves, + * which they can reference using the super pointer here. + */ + void * super; + + /** A pointer to the base recognizer, where most of the parser functions actually + * live because they are shared between parser and tree parser and this is the + * easier way than copying the interface all over the place. Macros hide this + * for the generated code so it is easier on the eye (though not the debugger ;-). + */ + pANTLR3_BASE_RECOGNIZER rec; + + /** A provider of a tokenstream interface, for the parser to consume + * tokens from. + */ + pANTLR3_TOKEN_STREAM tstream; + + /** A pointer to a function that installs a debugger object (it also + * installs the debugging versions of the parser methods. This means that + * a non debug parser incurs no overhead because of the debugging stuff. + */ + void (*setDebugListener) (struct ANTLR3_PARSER_struct * parser, pANTLR3_DEBUG_EVENT_LISTENER dbg); + + /** A pointer to a function that installs a token stream + * for the parser. + */ + void (*setTokenStream) (struct ANTLR3_PARSER_struct * parser, pANTLR3_TOKEN_STREAM); + + /** A pointer to a function that returns the token stream for this + * parser. + */ + pANTLR3_TOKEN_STREAM (*getTokenStream) (struct ANTLR3_PARSER_struct * parser); + + /** Pointer to a function that knows how to free resources of an ANTLR3 parser. + */ + void (*free) (struct ANTLR3_PARSER_struct * parser); + +} + ANTLR3_PARSER; + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/depends/antlr3c/antlr3parsetree.h b/depends/antlr3c/antlr3parsetree.h new file mode 100644 index 0000000..0e8c157 --- /dev/null +++ b/depends/antlr3c/antlr3parsetree.h @@ -0,0 +1,85 @@ +/** \file + * Abstraction of Common tree to provide payload and string representation of node. + * + * \todo May not need this in the end + */ + +#ifndef ANTLR3_PARSETREE_H +#define ANTLR3_PARSETREE_H + +// [The "BSD licence"] +// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC +// http://www.temporal-wave.com +// http://www.linkedin.com/in/jimidle +// +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. The name of the author may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct ANTLR3_PARSE_TREE_struct +{ + /** Any interface that implements methods in this interface + * may need to point back to itself using this pointer to its + * super structure. + */ + void * super; + + /** The payload that the parse tree node passes around + */ + void * payload; + + /** An encapsulated BASE TREE strcuture (NOT a pointer) + * that perfoms a lot of the dirty work of node management + */ + ANTLR3_BASE_TREE baseTree; + + /** How to dup this node + */ + pANTLR3_BASE_TREE (*dupNode) (struct ANTLR3_PARSE_TREE_struct * tree); + + /** Return the type of this node + */ + ANTLR3_UINT32 (*getType) (struct ANTLR3_PARSE_TREE_struct * tree); + + /** Return the string representation of the payload (must be installed + * when the payload is added and point to a function that knwos how to + * manifest a pANTLR3_STRING from a node. + */ + pANTLR3_STRING (*toString) (struct ANTLR3_PARSE_TREE_struct * payload); + + void (*free) (struct ANTLR3_PARSE_TREE_struct * tree); + +} + ANTLR3_PARSE_TREE; + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/depends/antlr3c/antlr3recognizersharedstate.h b/depends/antlr3c/antlr3recognizersharedstate.h new file mode 100644 index 0000000..9e024d8 --- /dev/null +++ b/depends/antlr3c/antlr3recognizersharedstate.h @@ -0,0 +1,218 @@ +/** \file + * While the C runtime does not need to model the state of + * multiple lexers and parsers in the same way as the Java runtime does + * it is no overhead to reflect that model. In fact the + * C runtime has always been able to share recognizer state. + * + * This 'class' therefore defines all the elements of a recognizer + * (either lexer, parser or tree parser) that are need to + * track the current recognition state. Multiple recognizers + * may then share this state, for instance when one grammar + * imports another. + */ + +#ifndef _ANTLR3_RECOGNIZER_SHARED_STATE_H +#define _ANTLR3_RECOGNIZER_SHARED_STATE_H + +// [The "BSD licence"] +// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC +// http://www.temporal-wave.com +// http://www.linkedin.com/in/jimidle +// +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. The name of the author may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** All the data elements required to track the current state + * of any recognizer (lexer, parser, tree parser). + * May be share between multiple recognizers such that + * grammar inheritance is easily supported. + */ +typedef struct ANTLR3_RECOGNIZER_SHARED_STATE_struct +{ + /** If set to ANTLR3_TRUE then the recognizer has an exception + * condition (this is tested by the generated code for the rules of + * the grammar). + */ + ANTLR3_BOOLEAN error; + + /** Points to the first in a possible chain of exceptions that the + * recognizer has discovered. + */ + pANTLR3_EXCEPTION exception; + + /** Track around a hint from the creator of the recognizer as to how big this + * thing is going to get, as the actress said to the bishop. This allows us + * to tune hash tables accordingly. This might not be the best place for this + * in the end but we will see. + */ + ANTLR3_UINT32 sizeHint; + + /** Track the set of token types that can follow any rule invocation. + * Stack structure, to support: List. + */ + pANTLR3_STACK following; + + + /** This is true when we see an error and before having successfully + * matched a token. Prevents generation of more than one error message + * per error. + */ + ANTLR3_BOOLEAN errorRecovery; + + /** The index into the input stream where the last error occurred. + * This is used to prevent infinite loops where an error is found + * but no token is consumed during recovery...another error is found, + * ad nauseam. This is a failsafe mechanism to guarantee that at least + * one token/tree node is consumed for two errors. + */ + ANTLR3_MARKER lastErrorIndex; + + /** In lieu of a return value, this indicates that a rule or token + * has failed to match. Reset to false upon valid token match. + */ + ANTLR3_BOOLEAN failed; + + /** When the recognizer terminates, the error handling functions + * will have incremented this value if any error occurred (that was displayed). It can then be + * used by the grammar programmer without having to use static globals. + */ + ANTLR3_UINT32 errorCount; + + /** If 0, no backtracking is going on. Safe to exec actions etc... + * If >0 then it's the level of backtracking. + */ + ANTLR3_INT32 backtracking; + + /** ANTLR3_VECTOR of ANTLR3_LIST for rule memoizing. + * Tracks the stop token index for each rule. ruleMemo[ruleIndex] is + * the memoization table for ruleIndex. For key ruleStartIndex, you + * get back the stop token for associated rule or MEMO_RULE_FAILED. + * + * This is only used if rule memoization is on. + */ + pANTLR3_INT_TRIE ruleMemo; + + /** Pointer to an array of token names + * that are generally useful in error reporting. The generated parsers install + * this pointer. The table it points to is statically allocated as 8 bit ascii + * at parser compile time - grammar token names are thus restricted in character + * sets, which does not seem to terrible. + */ + pANTLR3_UINT8 * tokenNames; + + /** User programmable pointer that can be used for instance as a place to + * store some tracking structure specific to the grammar that would not normally + * be available to the error handling functions. + */ + void * userp; + + /** The goal of all lexer rules/methods is to create a token object. + * This is an instance variable as multiple rules may collaborate to + * create a single token. For example, NUM : INT | FLOAT ; + * In this case, you want the INT or FLOAT rule to set token and not + * have it reset to a NUM token in rule NUM. + */ + pANTLR3_COMMON_TOKEN token; + + /** The goal of all lexer rules being to create a token, then a lexer + * needs to build a token factory to create them. + */ + pANTLR3_TOKEN_FACTORY tokFactory; + + /** A lexer is a source of tokens, produced by all the generated (or + * hand crafted if you like) matching rules. As such it needs to provide + * a token source interface implementation. + */ + pANTLR3_TOKEN_SOURCE tokSource; + + /** The channel number for the current token + */ + ANTLR3_UINT32 channel; + + /** The token type for the current token + */ + ANTLR3_UINT32 type; + + /** The input line (where it makes sense) on which the first character of the current + * token resides. + */ + ANTLR3_INT32 tokenStartLine; + + /** The character position of the first character of the current token + * within the line specified by tokenStartLine + */ + ANTLR3_INT32 tokenStartCharPositionInLine; + + /** What character index in the stream did the current token start at? + * Needed, for example, to get the text for current token. Set at + * the start of nextToken. + */ + ANTLR3_MARKER tokenStartCharIndex; + + /** Text for the current token. This can be overridden by setting this + * variable directly or by using the SETTEXT() macro (preferred) in your + * lexer rules. + */ + pANTLR3_STRING text; + + /** User controlled variables that will be installed in a newly created + * token. + */ + ANTLR3_UINT32 user1, user2, user3; + void * custom; + + /** Input stream stack, which allows the C programmer to switch input streams + * easily and allow the standard nextToken() implementation to deal with it + * as this is a common requirement. + */ + pANTLR3_STACK streams; + + /// A stack of token/tree rewrite streams that are available for use + /// by a parser or tree parser that is using rewrites to generate + /// an AST. This saves each rule in the recongizer from having to + /// allocate and deallocate rewtire streams on entry and exit. As + /// the parser recurses throgh the rules it will reach a steady state + /// of the maximum number of allocated streams, which instead of + /// deallocating them at rule exit, it will place on this stack for + /// reuse. The streams are then all finally freed when this stack + /// is freed. + /// + pANTLR3_VECTOR rStreams; + +} + ANTLR3_RECOGNIZER_SHARED_STATE; + +#ifdef __cplusplus +} +#endif + +#endif + + diff --git a/depends/antlr3c/antlr3rewritestreams.h b/depends/antlr3c/antlr3rewritestreams.h new file mode 100644 index 0000000..bf83fe9 --- /dev/null +++ b/depends/antlr3c/antlr3rewritestreams.h @@ -0,0 +1,180 @@ +#ifndef ANTLR3REWRITESTREAM_H +#define ANTLR3REWRITESTREAM_H + +// [The "BSD licence"] +// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC +// http://www.temporal-wave.com +// http://www.linkedin.com/in/jimidle +// +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. The name of the author may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/// A generic list of elements tracked in an alternative to be used in +/// a -> rewrite rule. +/// +/// In the C implementation, all tree oriented streams return a pointer to +/// the same type: pANTLR3_BASE_TREE. Anything that has subclassed from this +/// still passes this type, within which there is a super pointer, which points +/// to it's own data and methods. Hence we do not need to implement this as +/// the equivalent of an abstract class, but just fill in the appropriate interface +/// as usual with this model. +/// +/// Once you start next()ing, do not try to add more elements. It will +/// break the cursor tracking I believe. +/// +/// +/// \see #pANTLR3_REWRITE_RULE_NODE_STREAM +/// \see #pANTLR3_REWRITE_RULE_ELEMENT_STREAM +/// \see #pANTLR3_REWRITE_RULE_SUBTREE_STREAM +/// +/// TODO: add mechanism to detect/puke on modification after reading from stream +/// +typedef struct ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct +{ + + /// Cursor 0..n-1. If singleElement!=NULL, cursor is 0 until you next(), + /// which bumps it to 1 meaning no more elements. + /// + ANTLR3_UINT32 cursor; + + /// Track single elements w/o creating a list. Upon 2nd add, alloc list + /// + void * singleElement; + + /// The list of tokens or subtrees we are tracking + /// + pANTLR3_VECTOR elements; + + /// Indicates whether we should free the vector or it was supplied to us + /// + ANTLR3_BOOLEAN freeElements; + + /// The element or stream description; usually has name of the token or + /// rule reference that this list tracks. Can include rulename too, but + /// the exception would track that info. + /// + void * elementDescription; + + /// Pointer to the tree adaptor in use for this stream + /// + pANTLR3_BASE_TREE_ADAPTOR adaptor; + + /// Once a node / subtree has been used in a stream, it must be dup'ed + /// from then on. Streams are reset after sub rules so that the streams + /// can be reused in future sub rules. So, reset must set a dirty bit. + /// If dirty, then next() always returns a dup. + /// + ANTLR3_BOOLEAN dirty; + + // Pointer to the recognizer shared state to which this stream belongs + // + pANTLR3_BASE_RECOGNIZER rec; + + // Methods + + /// Reset the condition of this stream so that it appears we have + /// not consumed any of its elements. Elements themselves are untouched. + /// + void (*reset) (struct ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct * stream); + + /// Add a new pANTLR3_BASE_TREE to this stream + /// + void (*add) (struct ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct * stream, void *el, void (ANTLR3_CDECL *freePtr)(void *)); + + /// Return the next element in the stream. If out of elements, throw + /// an exception unless size()==1. If size is 1, then return elements[0]. + /// + void * (*next) (struct ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct * stream); + pANTLR3_BASE_TREE (*nextTree) (struct ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct * stream); + void * (*nextToken) (struct ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct * stream); + void * (*_next) (struct ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct * stream); + + /// When constructing trees, sometimes we need to dup a token or AST + /// subtree. Dup'ing a token means just creating another AST node + /// around it. For trees, you must call the adaptor.dupTree(). + /// + void * (*dup) (struct ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct * stream, void * el); + + /// Ensure stream emits trees; tokens must be converted to AST nodes. + /// AST nodes can be passed through unmolested. + /// + pANTLR3_BASE_TREE (*toTree) (struct ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct * stream, void * el); + + /// Returns ANTLR3_TRUE if there is a next element available + /// + ANTLR3_BOOLEAN (*hasNext) (struct ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct * stream); + + /// Treat next element as a single node even if it's a subtree. + /// This is used instead of next() when the result has to be a + /// tree root node. Also prevents us from duplicating recently-added + /// children; e.g., ^(type ID)+ adds ID to type and then 2nd iteration + /// must dup the type node, but ID has been added. + /// + /// Referencing to a rule result twice is ok; dup entire tree as + /// we can't be adding trees; e.g., expr expr. + /// + pANTLR3_BASE_TREE (*nextNode) (struct ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct * stream); + + /// Number of elements available in the stream + /// + ANTLR3_UINT32 (*size) (struct ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct * stream); + + /// Returns the description string if there is one available (check for NULL). + /// + void * (*getDescription) (struct ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct * stream); + + void (*free) (struct ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct * stream); + +} + ANTLR3_REWRITE_RULE_ELEMENT_STREAM; + +/// This is an implementation of a token stream, which is basically an element +/// stream that deals with tokens only. +/// +typedef struct ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct ANTLR3_REWRITE_RULE_TOKEN_STREAM; + +/// This is an implementation of a subtree stream which is a set of trees +/// modelled as an element stream. +/// +typedef struct ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct ANTLR3_REWRITE_RULE_SUBTREE_STREAM; + +/// This is an implementation of a node stream, which is basically an element +/// stream that deals with tree nodes only. +/// +typedef struct ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct ANTLR3_REWRITE_RULE_NODE_STREAM; + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/depends/antlr3c/antlr3string.h b/depends/antlr3c/antlr3string.h new file mode 100644 index 0000000..4a96e76 --- /dev/null +++ b/depends/antlr3c/antlr3string.h @@ -0,0 +1,272 @@ +/** \file + * Simple string interface allows indiscriminate allocation of strings + * such that they can be allocated all over the place and released in + * one chunk via a string factory - saves lots of hassle in remembering what + * strings were allocated where. + */ +#ifndef _ANTLR3_STRING_H +#define _ANTLR3_STRING_H + +// [The "BSD licence"] +// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC +// http://www.temporal-wave.com +// http://www.linkedin.com/in/jimidle +// +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. The name of the author may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** Base string class tracks the allocations and provides simple string + * tracking functions. Mostly you can work directly on the string for things + * that don't reallocate it, like strchr() etc. Perhaps someone will want to provide implementations for UTF8 + * and so on. + */ +typedef struct ANTLR3_STRING_struct +{ + + /** The factory that created this string + */ + pANTLR3_STRING_FACTORY factory; + + /** Pointer to the current string value (starts at NULL unless + * the string allocator is told to create it with a pre known size. + */ + pANTLR3_UINT8 chars; + + /** Current length of the string up to and not including, the trailing '\0' + * Note that the actual allocation (->size) + * is always at least one byte more than this to accommodate trailing '\0' + */ + ANTLR3_UINT32 len; + + /** Current size of the string in bytes including the trailing '\0' + */ + ANTLR3_UINT32 size; + + /** Index of string (allocation number) in case someone wants + * to explicitly release it. + */ + ANTLR3_UINT32 index; + + /** Occasionally it is useful to know what the encoding of the string + * actually is, hence it is stored here as one the ANTLR3_ENCODING_ values + */ + ANTLR3_UINT8 encoding; + + /** Pointer to function that sets the string value to a specific string in the default encoding + * for this string. For instance, if this is 8 bit, then this function is the same as set8 + * but if the encoding is UTF16, then the pointer is assumed to point to UTF16 characters, not + * 8 bit. + */ + pANTLR3_UINT8 (*set) (struct ANTLR3_STRING_struct * string, const char * chars); + + /** Pointer to function that sets the string value to a specific 8 bit string in the default encoding + * for this string. For instance, if this is an 8 bit string, then this function is the same as set8 + * but if the encoding is UTF16, then the pointer is assumed to point to 8 bit characters that must + * be converted to UTF16 characters on the fly. + */ + pANTLR3_UINT8 (*set8) (struct ANTLR3_STRING_struct * string, const char * chars); + + /** Pointer to function adds a raw char * type pointer in the default encoding + * for this string. For instance, if this is 8 bit, then this function is the same as append8 + * but if the encoding is UTF16, then the pointer is assumed to point to UTF16 characters not + * 8 bit. + */ + pANTLR3_UINT8 (*append) (struct ANTLR3_STRING_struct * string, const char * newbit); + + /** Pointer to function adds a raw char * type pointer in the default encoding + * for this string. For instance, if this is a UTF16 string, then this function assumes the pointer + * points to 8 bit characters that must be converted on the fly. + */ + pANTLR3_UINT8 (*append8) (struct ANTLR3_STRING_struct * string, const char * newbit); + + /** Pointer to function that inserts the supplied string at the specified + * offset in the current string in the default encoding for this string. For instance, if this is an 8 + * bit string, then this is the same as insert8, but if this is a UTF16 string, then the pointer + * must point to UTF16 characters. + */ + pANTLR3_UINT8 (*insert) (struct ANTLR3_STRING_struct * string, ANTLR3_UINT32 point, const char * newbit); + + /** Pointer to function that inserts the supplied string at the specified + * offset in the current string in the default encoding for this string. For instance, if this is a UTF16 string + * then the pointer is assumed to point at 8 bit characteres that must be converted on the fly. + */ + pANTLR3_UINT8 (*insert8) (struct ANTLR3_STRING_struct * string, ANTLR3_UINT32 point, const char * newbit); + + /** Pointer to function that sets the string value to a copy of the supplied string (strings must be in the + * same encoding. + */ + pANTLR3_UINT8 (*setS) (struct ANTLR3_STRING_struct * string, struct ANTLR3_STRING_struct * chars); + + /** Pointer to function appends a copy of the characters contained in another string. Strings must be in the + * same encoding. + */ + pANTLR3_UINT8 (*appendS) (struct ANTLR3_STRING_struct * string, struct ANTLR3_STRING_struct * newbit); + + /** Pointer to function that inserts a copy of the characters in the supplied string at the specified + * offset in the current string. strings must be in the same encoding. + */ + pANTLR3_UINT8 (*insertS) (struct ANTLR3_STRING_struct * string, ANTLR3_UINT32 point, struct ANTLR3_STRING_struct * newbit); + + /** Pointer to function that inserts the supplied integer in string form at the specified + * offset in the current string. + */ + pANTLR3_UINT8 (*inserti) (struct ANTLR3_STRING_struct * string, ANTLR3_UINT32 point, ANTLR3_INT32 i); + + /** Pointer to function that adds a single character to the end of the string, in the encoding of the + * string - 8 bit, UTF16, utf-8 etc. Input is a single UTF32 (32 bits wide integer) character. + */ + pANTLR3_UINT8 (*addc) (struct ANTLR3_STRING_struct * string, ANTLR3_UINT32 c); + + /** Pointer to function that adds the stringified representation of an integer + * to the string. + */ + pANTLR3_UINT8 (*addi) (struct ANTLR3_STRING_struct * string, ANTLR3_INT32 i); + + /** Pointer to function that compares the text of a string to the supplied + * 8 bit character string and returns a result a la strcmp() + */ + ANTLR3_UINT32 (*compare8) (struct ANTLR3_STRING_struct * string, const char * compStr); + + /** Pointer to a function that compares the text of a string with the supplied character string + * (which is assumed to be in the same encoding as the string itself) and returns a result + * a la strcmp() + */ + ANTLR3_UINT32 (*compare) (struct ANTLR3_STRING_struct * string, const char * compStr); + + /** Pointer to a function that compares the text of a string with the supplied string + * (which is assumed to be in the same encoding as the string itself) and returns a result + * a la strcmp() + */ + ANTLR3_UINT32 (*compareS) (struct ANTLR3_STRING_struct * string, struct ANTLR3_STRING_struct * compStr); + + /** Pointer to a function that returns the character indexed at the supplied + * offset as a 32 bit character. + */ + ANTLR3_UCHAR (*charAt) (struct ANTLR3_STRING_struct * string, ANTLR3_UINT32 offset); + + /** Pointer to a function that returns a substring of the supplied string a la .subString(s,e) + * in the Java language. + */ + struct ANTLR3_STRING_struct * + (*subString) (struct ANTLR3_STRING_struct * string, ANTLR3_UINT32 startIndex, ANTLR3_UINT32 endIndex); + + /** Pointer to a function that returns the integer representation of any numeric characters + * at the beginning of the string + */ + ANTLR3_INT32 (*toInt32) (struct ANTLR3_STRING_struct * string); + + /** Pointer to a function that yields an 8 bit string regardless of the encoding of the supplied + * string. This is useful when you want to use the text of a token in some way that requires an 8 bit + * value, such as the key for a hashtable. The function is required to produce a usable string even + * if the text given as input has characters that do not fit in 8 bit space, it will replace them + * with some arbitrary character such as '?' + */ + struct ANTLR3_STRING_struct * + (*to8) (struct ANTLR3_STRING_struct * string); + + /// Pointer to a function that yields a UT8 encoded string of the current string, + /// regardless of the current encoding of the string. Because there is currently no UTF8 + /// handling in the string class, it creates therefore, a string that is useful only for read only + /// applications as it will not contain methods that deal with UTF8 at the moment. + /// + struct ANTLR3_STRING_struct * + (*toUTF8) (struct ANTLR3_STRING_struct * string); + +} + ANTLR3_STRING; + +/** Definition of the string factory interface, which creates and tracks + * strings for you of various shapes and sizes. + */ +typedef struct ANTLR3_STRING_FACTORY_struct +{ + /** List of all the strings that have been allocated by the factory + */ + pANTLR3_VECTOR strings; + + /* Index of next string that we allocate + */ + ANTLR3_UINT32 index; + + /** Pointer to function that manufactures an empty string + */ + pANTLR3_STRING (*newRaw) (struct ANTLR3_STRING_FACTORY_struct * factory); + + /** Pointer to function that manufactures a raw string with no text in it but space for size + * characters. + */ + pANTLR3_STRING (*newSize) (struct ANTLR3_STRING_FACTORY_struct * factory, ANTLR3_UINT32 size); + + /** Pointer to function that manufactures a string from a given pointer and length. The pointer is assumed + * to point to characters in the same encoding as the string type, hence if this is a UTF16 string the + * pointer should point to UTF16 characters. + */ + pANTLR3_STRING (*newPtr) (struct ANTLR3_STRING_FACTORY_struct * factory, pANTLR3_UINT8 string, ANTLR3_UINT32 size); + + /** Pointer to function that manufactures a string from a given pointer and length. The pointer is assumed to + * point at 8 bit characters which must be converted on the fly to the encoding of the actual string. + */ + pANTLR3_STRING (*newPtr8) (struct ANTLR3_STRING_FACTORY_struct * factory, pANTLR3_UINT8 string, ANTLR3_UINT32 size); + + /** Pointer to function that manufactures a string from a given pointer and works out the length. The pointer is + * assumed to point to characters in the same encoding as the string itself, i.e. UTF16 if a UTF16 + * string and so on. + */ + pANTLR3_STRING (*newStr) (struct ANTLR3_STRING_FACTORY_struct * factory, pANTLR3_UINT8 string); + + /** Pointer to function that manufactures a string from a given pointer and length. The pointer should + * point to 8 bit characters regardless of the actual encoding of the string. The 8 bit characters + * will be converted to the actual string encoding on the fly. + */ + pANTLR3_STRING (*newStr8) (struct ANTLR3_STRING_FACTORY_struct * factory, pANTLR3_UINT8 string); + + /** Pointer to function that deletes the string altogether + */ + void (*destroy) (struct ANTLR3_STRING_FACTORY_struct * factory, pANTLR3_STRING string); + + /** Pointer to function that returns a copy of the string in printable form without any control + * characters in it. + */ + pANTLR3_STRING (*printable)(struct ANTLR3_STRING_FACTORY_struct * factory, pANTLR3_STRING string); + + /** Pointer to function that closes the factory + */ + void (*close) (struct ANTLR3_STRING_FACTORY_struct * factory); + +} + ANTLR3_STRING_FACTORY; + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/depends/antlr3c/antlr3tokenstream.h b/depends/antlr3c/antlr3tokenstream.h new file mode 100644 index 0000000..a5137ad --- /dev/null +++ b/depends/antlr3c/antlr3tokenstream.h @@ -0,0 +1,303 @@ +/** \file + * Defines the interface for an ANTLR3 common token stream. Custom token streams should create + * one of these and then override any functions by installing their own pointers + * to implement the various functions. + */ +#ifndef _ANTLR3_TOKENSTREAM_H +#define _ANTLR3_TOKENSTREAM_H + +// [The "BSD licence"] +// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC +// http://www.temporal-wave.com +// http://www.linkedin.com/in/jimidle +// +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. The name of the author may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include +#include +#include +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** Definition of a token source, which has a pointer to a function that + * returns the next token (using a token factory if it is going to be + * efficient) and a pointer to an ANTLR3_INPUT_STREAM. This is slightly + * different to the Java interface because we have no way to implement + * multiple interfaces without defining them in the interface structure + * or casting (void *), which is too convoluted. + */ +typedef struct ANTLR3_TOKEN_SOURCE_struct +{ + /** Pointer to a function that returns the next token in the stream. + */ + pANTLR3_COMMON_TOKEN (*nextToken)(struct ANTLR3_TOKEN_SOURCE_struct * tokenSource); + + /** Whoever is providing tokens, needs to provide a string factory too + */ + pANTLR3_STRING_FACTORY strFactory; + + /** A special pre-allocated token, which signifies End Of Tokens. Because this must + * be set up with the current input index and so on, we embed the structure and + * return the address of it. It is marked as factoryMade, so that it is never + * attempted to be freed. + */ + ANTLR3_COMMON_TOKEN eofToken; + + /// A special pre-allocated token, which is returned by mTokens() if the + /// lexer rule said to just skip the generated token altogether. + /// Having this single token stops us wasting memory by have the token factory + /// actually create something that we are going to SKIP(); anyway. + /// + ANTLR3_COMMON_TOKEN skipToken; + + /** Whatever is supplying the token source interface, needs a pointer to + * itself so that this pointer can be passed to it when the nextToken + * function is called. + */ + void * super; + + /** When the token source is constructed, it is populated with the file + * name from whence the tokens were produced by the lexer. This pointer is a + * copy of the one supplied by the CharStream (and may be NULL) so should + * not be manipulated other than to copy or print it. + */ + pANTLR3_STRING fileName; +} + ANTLR3_TOKEN_SOURCE; + +/** Definition of the ANTLR3 common token stream interface. + * \remark + * Much of the documentation for this interface is stolen from Ter's Java implementation. + */ +typedef struct ANTLR3_TOKEN_STREAM_struct +{ + /** Pointer to the token source for this stream + */ + pANTLR3_TOKEN_SOURCE tokenSource; + + /** Whatever is providing this interface needs a pointer to itself + * so that this can be passed back to it whenever the api functions + * are called. + */ + void * super; + + /** All input streams implement the ANTLR3_INT_STREAM interface... + */ + pANTLR3_INT_STREAM istream; + + /// Debugger interface, is this is a debugging token stream + /// + pANTLR3_DEBUG_EVENT_LISTENER debugger; + + /// Indicates the initial stream state for dbgConsume() + /// + ANTLR3_BOOLEAN initialStreamState; + + /** Get Token at current input pointer + i ahead where i=1 is next Token. + * i<0 indicates tokens in the past. So -1 is previous token and -2 is + * two tokens ago. LT(0) is undefined. For i>=n, return Token.EOFToken. + * Return null for LT(0) and any index that results in an absolute address + * that is negative. + */ + pANTLR3_COMMON_TOKEN (*_LT) (struct ANTLR3_TOKEN_STREAM_struct * tokenStream, ANTLR3_INT32 k); + + /** Get a token at an absolute index i; 0..n-1. This is really only + * needed for profiling and debugging and token stream rewriting. + * If you don't want to buffer up tokens, then this method makes no + * sense for you. Naturally you can't use the rewrite stream feature. + * I believe DebugTokenStream can easily be altered to not use + * this method, removing the dependency. + */ + pANTLR3_COMMON_TOKEN (*get) (struct ANTLR3_TOKEN_STREAM_struct * tokenStream, ANTLR3_UINT32 i); + + /** Where is this stream pulling tokens from? This is not the name, but + * a pointer into an interface that contains a ANTLR3_TOKEN_SOURCE interface. + * The Token Source interface contains a pointer to the input stream and a pointer + * to a function that returns the next token. + */ + pANTLR3_TOKEN_SOURCE (*getTokenSource) (struct ANTLR3_TOKEN_STREAM_struct * tokenStream); + + /** Function that installs a token source for teh stream + */ + void (*setTokenSource) (struct ANTLR3_TOKEN_STREAM_struct * tokenStream, + pANTLR3_TOKEN_SOURCE tokenSource); + + /** Return the text of all the tokens in the stream, as the old tramp in + * Leeds market used to say; "Get the lot!" + */ + pANTLR3_STRING (*toString) (struct ANTLR3_TOKEN_STREAM_struct * tokenStream); + + /** Return the text of all tokens from start to stop, inclusive. + * If the stream does not buffer all the tokens then it can just + * return an empty ANTLR3_STRING or NULL; Grammars should not access $ruleLabel.text in + * an action in that case. + */ + pANTLR3_STRING (*toStringSS) (struct ANTLR3_TOKEN_STREAM_struct * tokenStream, ANTLR3_UINT32 start, ANTLR3_UINT32 stop); + + /** Because the user is not required to use a token with an index stored + * in it, we must provide a means for two token objects themselves to + * indicate the start/end location. Most often this will just delegate + * to the other toString(int,int). This is also parallel with + * the pTREENODE_STREAM->toString(Object,Object). + */ + pANTLR3_STRING (*toStringTT) (struct ANTLR3_TOKEN_STREAM_struct * tokenStream, pANTLR3_COMMON_TOKEN start, pANTLR3_COMMON_TOKEN stop); + + + /** Function that sets the token stream into debugging mode + */ + void (*setDebugListener) (struct ANTLR3_TOKEN_STREAM_struct * tokenStream, pANTLR3_DEBUG_EVENT_LISTENER debugger); + + + + /** Function that knows how to free the memory for an ANTLR3_TOKEN_STREAM + */ + void (*free) (struct ANTLR3_TOKEN_STREAM_struct * tokenStream); +} + ANTLR3_TOKEN_STREAM; + +/** Common token stream is an implementation of ANTLR_TOKEN_STREAM for the default + * parsers and recognizers. You may of course build your own implementation if + * you are so inclined. + */ +typedef struct ANTLR3_COMMON_TOKEN_STREAM_struct +{ + /** The ANTLR3_TOKEN_STREAM interface implementation, which also includes + * the intstream implementation. We could duplicate the pANTLR_INT_STREAM + * in this interface and initialize it to a copy, but this could be confusing + * it just results in one more level of indirection and I think that with + * judicial use of 'const' later, the optimizer will do decent job. + */ + pANTLR3_TOKEN_STREAM tstream; + + /** Whatever is supplying the COMMON_TOKEN_STREAM needs a pointer to itself + * so that this can be accessed by any of the API functions which it implements. + */ + void * super; + + /** Records every single token pulled from the source indexed by the token index. + * There might be more efficient ways to do this, such as referencing directly in to + * the token factory pools, but for now this is convenient and the ANTLR3_LIST is not + * a huge overhead as it only stores pointers anyway, but allows for iterations and + * so on. + */ + pANTLR3_VECTOR tokens; + + /** Override map of tokens. If a token type has an entry in here, then + * the pointer in the table points to an int, being the override channel number + * that should always be used for this token type. + */ + pANTLR3_LIST channelOverrides; + + /** Discared set. If a token has an entry in this table, then it is thrown + * away (data pointer is always NULL). + */ + pANTLR3_LIST discardSet; + + /* The channel number that this token stream is tuned to. For instance, whitespace + * is usually tuned to channel 99, which no token stream would normally tune to and + * so it is thrown away. + */ + ANTLR3_UINT32 channel; + + /** If this flag is set to ANTLR3_TRUE, then tokens that the stream sees that are not + * in the channel that this stream is tuned to, are not tracked in the + * tokens table. When set to false, ALL tokens are added to the tracking. + */ + ANTLR3_BOOLEAN discardOffChannel; + + /** The index into the tokens list of the current token (the next one that will be + * consumed. p = -1 indicates that the token list is empty. + */ + ANTLR3_INT32 p; + + /** A simple filter mechanism whereby you can tell this token stream + * to force all tokens of type ttype to be on channel. For example, + * when interpreting, we cannot exec actions so we need to tell + * the stream to force all WS and NEWLINE to be a different, ignored + * channel. + */ + void (*setTokenTypeChannel) (struct ANTLR3_COMMON_TOKEN_STREAM_struct * tokenStream, + ANTLR3_UINT32 ttype, ANTLR3_UINT32 channel); + + /** Add a particular token type to the discard set. If a token is found to belong + * to this set, then it is skipped/thrown away + */ + void (*discardTokenType) (struct ANTLR3_COMMON_TOKEN_STREAM_struct * tokenStream, ANTLR3_INT32 ttype); + + /** Signal to discard off channel tokens from here on in. + */ + void (*discardOffChannelToks)(struct ANTLR3_COMMON_TOKEN_STREAM_struct * tokenStream, ANTLR3_BOOLEAN discard); + + /** Function that returns a pointer to the ANTLR3_LIST of all tokens + * in the stream (this causes the buffer to fill if we have not get any yet) + */ + pANTLR3_VECTOR (*getTokens) (struct ANTLR3_COMMON_TOKEN_STREAM_struct * tokenStream); + + /** Function that returns all the tokens between a start and a stop index. + * TODO: This is a new list (Ack! Maybe this is a reason to have factories for LISTS and HASHTABLES etc :-( come back to this) + */ + pANTLR3_LIST (*getTokenRange) (struct ANTLR3_COMMON_TOKEN_STREAM_struct * tokenStream, ANTLR3_UINT32 start, ANTLR3_UINT32 stop); + + /** Function that returns all the tokens indicated by the specified bitset, within a range of tokens + */ + pANTLR3_LIST (*getTokensSet) (struct ANTLR3_COMMON_TOKEN_STREAM_struct * tokenStream, + ANTLR3_UINT32 start, ANTLR3_UINT32 stop, pANTLR3_BITSET types); + + /** Function that returns all the tokens indicated by being a member of the supplied List + */ + pANTLR3_LIST (*getTokensList) (struct ANTLR3_COMMON_TOKEN_STREAM_struct * tokenStream, + ANTLR3_UINT32 start, ANTLR3_UINT32 stop, pANTLR3_LIST list); + + /** Function that returns all tokens of a certain type within a range. + */ + pANTLR3_LIST (*getTokensType) (struct ANTLR3_COMMON_TOKEN_STREAM_struct * tokenStream, + ANTLR3_UINT32 start, ANTLR3_UINT32 stop, ANTLR3_UINT32 type); + + /** Function that resets the token stream so that it can be reused, but + * but that does not free up any resources, such as the token factory + * the factory pool and so on. This prevents the need to keep freeing + * and reallocating the token pools if the thing you are building is + * a multi-shot dameon or somethign like that. It is much faster to + * just reuse all the vectors. + */ + void (*reset) (struct ANTLR3_COMMON_TOKEN_STREAM_struct * tokenStream); + + /** Function that knows how to free an ANTLR3_COMMON_TOKEN_STREAM + */ + void (*free) (struct ANTLR3_COMMON_TOKEN_STREAM_struct * tokenStream); +} + ANTLR3_COMMON_TOKEN_STREAM; + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/depends/antlr3c/antlr3treeparser.h b/depends/antlr3c/antlr3treeparser.h new file mode 100644 index 0000000..8ee0e58 --- /dev/null +++ b/depends/antlr3c/antlr3treeparser.h @@ -0,0 +1,81 @@ +#ifndef ANTLR3TREEPARSER_H +#define ANTLR3TREEPARSER_H + +// [The "BSD licence"] +// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC +// http://www.temporal-wave.com +// http://www.linkedin.com/in/jimidle +// +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. The name of the author may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** Internal structure representing an element in a hash bucket. + * Stores the original key so that duplicate keys can be rejected + * if necessary, and contains function can be supported If the hash key + * could be unique I would have invented the perfect compression algorithm ;-) + */ +typedef struct ANTLR3_TREE_PARSER_struct +{ + /** Pointer to any super class + */ + void * super; + + /** A pointer to the base recognizer, where most of the parser functions actually + * live because they are shared between parser and tree parser and this is the + * easier way than copying the interface all over the place. Macros hide this + * for the generated code so it is easier on the eye (though not the debugger ;-). + */ + pANTLR3_BASE_RECOGNIZER rec; + + /** Pointer to the common tree node stream for the parser + */ + pANTLR3_COMMON_TREE_NODE_STREAM ctnstream; + + /** Set the input stream and reset the parser + */ + void (*setTreeNodeStream) (struct ANTLR3_TREE_PARSER_struct * parser, pANTLR3_COMMON_TREE_NODE_STREAM input); + + /** Return a pointer to the input stream + */ + pANTLR3_COMMON_TREE_NODE_STREAM (*getTreeNodeStream) (struct ANTLR3_TREE_PARSER_struct * parser); + + /** Pointer to a function that knows how to free resources of an ANTLR3 tree parser. + */ + void (*free) (struct ANTLR3_TREE_PARSER_struct * parser); +} + ANTLR3_TREE_PARSER; + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/sources/plugins/scs/scs.pro b/sources/plugins/scs/scs.pro index b3f3175..cb2cd49 100644 --- a/sources/plugins/scs/scs.pro +++ b/sources/plugins/scs/scs.pro @@ -15,6 +15,17 @@ unix { LIBS+= -lantlr3c } +win32 { + DEFINES += _XKEYCHECK_H + + INCLUDEPATH += $$PWD/../../../depends/antlr3c/ + !contains(QMAKE_TARGET.arch, x86_64) { + LIBS += -l$$PWD/../../../depends/antlr3c/antlr3c_x86 + } else { + LIBS += -l$$PWD/../../../depends/antlr3c/antlr3c_x86_64 + } +} + TRANSLATIONS += media/translations/scs_en_EN.ts \ media/translations/scs_ru_RU.ts @@ -41,7 +52,7 @@ HEADERS += \ scsparser/SCsCLexer.h \ scsparser/SCsCParser.h \ scsparser/scscparserdefs.h \ - scsparser/scsasynchparser.h \ + scsparser/scsasynchparser.h \ scswindow.h \ scsplugin.h \ scscodeerroranalyzer.h \ @@ -65,7 +76,7 @@ SOURCES += \ scsparser/SCsCLexer.c \ scsparser/SCsCParser.c \ scsparser/scscparserdefs.c \ - scsparser/scsasynchparser.cpp \ + scsparser/scsasynchparser.cpp \ scswindow.cpp \ scserrortablewidget.cpp \ scscodeeditor.cpp \ From 3cdd796986e585c5eccca86bbe56e65f7c448398 Mon Sep 17 00:00:00 2001 From: Denis Koronchik Date: Sat, 28 Mar 2015 20:41:35 +0300 Subject: [PATCH 40/71] [scg] Clean up code. Fix compilation on windows --- .../scg/arrangers/scgarrangerenergybased.cpp | 219 ------------------ .../scg/arrangers/scgarrangerenergybased.h | 98 -------- .../scg/arrangers/scgforcecalculator.cpp | 140 ----------- .../scg/arrangers/scgforcecalculator.h | 126 ---------- .../plugins/scg/media/TypeClonningCursor.bmp | Bin 3126 -> 0 bytes .../scg/media/icons/tool-align-energy.png | Bin 5451 -> 0 bytes sources/plugins/scg/scg.pro | 8 +- sources/plugins/scg/scg.qrc | 2 - sources/plugins/scg/scgcontour.cpp | 15 +- sources/plugins/scg/scgcontour.h | 4 +- sources/plugins/scg/scgplugin.cpp | 2 - sources/plugins/scg/scgwindow.cpp | 14 -- sources/plugins/scg/scgwindow.h | 2 - 13 files changed, 15 insertions(+), 615 deletions(-) delete mode 100644 sources/plugins/scg/arrangers/scgarrangerenergybased.cpp delete mode 100644 sources/plugins/scg/arrangers/scgarrangerenergybased.h delete mode 100644 sources/plugins/scg/arrangers/scgforcecalculator.cpp delete mode 100644 sources/plugins/scg/arrangers/scgforcecalculator.h delete mode 100644 sources/plugins/scg/media/TypeClonningCursor.bmp delete mode 100644 sources/plugins/scg/media/icons/tool-align-energy.png diff --git a/sources/plugins/scg/arrangers/scgarrangerenergybased.cpp b/sources/plugins/scg/arrangers/scgarrangerenergybased.cpp deleted file mode 100644 index 2755d4d..0000000 --- a/sources/plugins/scg/arrangers/scgarrangerenergybased.cpp +++ /dev/null @@ -1,219 +0,0 @@ -#include "scgarrangerenergybased.h" - -#include "scgforcecalculator.h" -#include "scgview.h" -#include "scgcontour.h" - -#include -#include - -#include -#include -#include -#include - -#include - -SCgEnergyBasedArranger::SCgEnergyBasedArranger(QObject *parent) - : SCgArranger(parent) - , mDialog(0) - , mSpringRate(1) - , mSpringLength(100) - , mRepulsionFactor(10000) - , mFakeRepulsionFactor(500) - , mShiftFactor(0.3) -{ - mNodes.clear(); - mTimerId = 0; - - mStopTimer = new QTimer(this); - mStopTimer->setInterval(20000); - mStopTimer->setSingleShot(true); - connect(mStopTimer, SIGNAL(timeout()), SLOT(stopTimerTimeout())); - - connect(&mFutureWatcher, SIGNAL(finished()), SLOT(forceCalculationFinished())); -} -//------------------------------------------------------------------------------ -SCgEnergyBasedArranger::~SCgEnergyBasedArranger() -{ -} -//------------------------------------------------------------------------------ -bool SCgEnergyBasedArranger::configDialog() -{ - if (!mDialog) { - createDialog(); - } - mDialog->setParent(mView->viewport(), Qt::Dialog); - bool res = mDialog->exec() == QDialog::Accepted; - - mDialog->setParent(0, Qt::Dialog); - - return res; -} -//------------------------------------------------------------------------------ -void SCgEnergyBasedArranger::startOperation() -{ - // Get selected SCgObjects: - mNodes.clear(); - mPairs.clear(); - mBusses.clear(); - mContours.clear(); - foreach (QGraphicsItem *selectedItem, mView->scene()->selectedItems()) { - if (SCgObject::isSCgObjectType(selectedItem->type())) { - if (selectedItem->type() == SCgNode::Type) { - SCgNode *node = static_cast(selectedItem); - - registerCommand(node, node->pos()); - - mNodes.append(node); - } - if (selectedItem->type() == SCgPair::Type) { - SCgPair *pair = static_cast(selectedItem); - - // Remove all pair break points: - registerCommandRemoveBreakPoints(pair); - - mPairs.insert(pair); - } else if (selectedItem->type() == SCgBus::Type) { - mBusses.insert(static_cast(selectedItem)); - } else if (selectedItem->type() == SCgContour::Type) { - SCgContour *contour = static_cast(selectedItem); - - // Minimize contour: - registerCommandMinimizeContour(contour); - - mContours.insert(contour); - } - } - } - - if (mTimerId == 0) { - mStopTimer->start(); - mTimerId = startTimer(1000 / 40); - } -} -//------------------------------------------------------------------------------ -QDialog * SCgEnergyBasedArranger::createDialog() -{ - mDialog = new QDialog(); - mDialog->setWindowTitle(tr("Energy-based Arranger Parameters")); - - - QLabel *springRateLabel = new QLabel(tr("Spring rate:"), mDialog); - mSpringRateSpinBox = new QDoubleSpinBox(mDialog); - mSpringRateSpinBox->setMaximum(100); - mSpringRateSpinBox->setValue(mSpringRate); - mSpringRateSpinBox->setToolTip(tr("Spring rate")); - - QLabel *springLengthLabel = new QLabel(tr("Spring length:"), mDialog); - mSpringLengthSpinBox = new QDoubleSpinBox(mDialog); - mSpringLengthSpinBox->setMaximum(10000); - mSpringLengthSpinBox->setValue(mSpringLength); - mSpringLengthSpinBox->setToolTip(tr("Natural spring length")); - - QLabel *repulsionFactorLabel = new QLabel(tr("Node repulsion factor:"), mDialog); - mRepulsionFactorSpinBox = new QDoubleSpinBox(mDialog); - mRepulsionFactorSpinBox->setMaximum(100000000); - mRepulsionFactorSpinBox->setValue(mRepulsionFactor); - mRepulsionFactorSpinBox->setToolTip(tr("Repulsive force factor between real nodes")); - - QLabel *fakeRepulsionFactorLabel = new QLabel(tr("Fake node repulsion factor:"), mDialog); - mFakeRepulsionFactorSpinBox = new QDoubleSpinBox(mDialog); - mFakeRepulsionFactorSpinBox->setMaximum(50000); - mFakeRepulsionFactorSpinBox->setValue(mFakeRepulsionFactor); - mFakeRepulsionFactorSpinBox->setToolTip(tr("Repulsive force factor between real and fake nodes")); - - QLabel *shiftFactorLabel = new QLabel(tr("Shift factor:")); - mShiftFactorSpinBox = new QDoubleSpinBox(mDialog); - mShiftFactorSpinBox->setMaximum(30); - mShiftFactorSpinBox->setValue(mShiftFactor); - mShiftFactorSpinBox->setToolTip(tr("Shift force factor")); - - - QFormLayout *formLayout = new QFormLayout; - formLayout->addRow(springRateLabel, mSpringRateSpinBox); - formLayout->addRow(springLengthLabel, mSpringLengthSpinBox); - formLayout->addRow(repulsionFactorLabel, mRepulsionFactorSpinBox); - formLayout->addRow(fakeRepulsionFactorLabel, mFakeRepulsionFactorSpinBox); - formLayout->addRow(shiftFactorLabel, mShiftFactorSpinBox); - - - QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok - | QDialogButtonBox::Cancel); - connect(buttonBox, SIGNAL(accepted()), mDialog, SLOT(accept())); - connect(buttonBox, SIGNAL(rejected()), mDialog, SLOT(reject())); - buttonBox->setParent(mDialog); - formLayout->addRow(buttonBox); - - mDialog->setLayout(formLayout); - return mDialog; -} -//------------------------------------------------------------------------------ -QString SCgEnergyBasedArranger::name() const -{ - return tr("Energy-based arrange"); -} -//------------------------------------------------------------------------------ -void SCgEnergyBasedArranger::timerEvent(QTimerEvent *event) -{ - Q_UNUSED(event); - - - Parameters parameters(mSpringRateSpinBox->value(), mSpringLengthSpinBox->value(), - mRepulsionFactorSpinBox->value(), - mFakeRepulsionFactorSpinBox->value()); - QFuture future = QtConcurrent::mapped(mNodes, SCgForceCalculator(mNodes, mPairs, mBusses, parameters)); - mFutureWatcher.setFuture(future); -} -//------------------------------------------------------------------------------ -void SCgEnergyBasedArranger::stopTimerTimeout() -{ - if (mTimerId != 0) { - //%qDebug() << "Timer was stopped after 20 000 ms"; - killTimer(mTimerId); - registerMoving(); - mTimerId = 0; - } -} -//------------------------------------------------------------------------------ -void SCgEnergyBasedArranger::forceCalculationFinished() -{ - const QList forces = mFutureWatcher.future().results(); - QListIterator it(forces); - qint32 index = 0; - bool objectsMoved = false; - while (it.hasNext()) { - const Force &force = it.next(); - // If force isn't nearly 0, then move node: - if (qAbs(force.mX) > 1 || qAbs(force.mY) > 1) { - mNodes.at(index)->moveBy(force.mX * mShiftFactorSpinBox->value(), - force.mY * mShiftFactorSpinBox->value()); - //%mNodes.at(index)->updateConnected();//%? - objectsMoved = true; - } - ++index; - } - - foreach (SCgContour *contour, mContours) { - contour->minimize(); - } - - if (!objectsMoved) { - killTimer(mTimerId); - //%qDebug() << "Objects aren't moving. Timer was killed."; - registerMoving(); - mTimerId = 0; - mStopTimer->stop(); - } -} -//------------------------------------------------------------------------------ -void SCgEnergyBasedArranger::registerMoving() -{ - foreach (SCgNode *node, mNodes) { - registerCommand(node, node->pos()); - } - foreach (SCgContour *contour, mContours) { - registerCommand(contour, contour->scenePoints()); - } -} -//------------------------------------------------------------------------------ diff --git a/sources/plugins/scg/arrangers/scgarrangerenergybased.h b/sources/plugins/scg/arrangers/scgarrangerenergybased.h deleted file mode 100644 index 754b445..0000000 --- a/sources/plugins/scg/arrangers/scgarrangerenergybased.h +++ /dev/null @@ -1,98 +0,0 @@ -#ifndef SCGARRANGERENERGYBASED_H -#define SCGARRANGERENERGYBASED_H - -#include "scgarranger.h" - -#include - -class QDoubleSpinBox; - -struct Force; -//------------------------------------------------------------------------------ -class SCgEnergyBasedArranger : public SCgArranger -{ - Q_OBJECT - -public: - enum - { - Type = 5 - }; - - explicit SCgEnergyBasedArranger(QObject *parent = 0); - virtual ~SCgEnergyBasedArranger(); - - //! @see SCgArranger::type(). - int type() const {return Type;} - -protected: - //! @see SCgArranger::configDialog() - bool configDialog(); - - //! @see SCgArranger::startOperation() - void startOperation(); - - //! Holds dialog window, shown to user. - //! @see SCgArrangerEnergyBased::createDialog() - QDialog *mDialog; - - //! Creates dialog for asking energy-based arrange parameters. - QDialog * createDialog(); - - //! @see SCgArranger::name - QString name() const; - - //! Recalculates forces and moves objects each 25 ms. - void timerEvent(QTimerEvent *event); - - /*! @defgroup EnergyBasedPars Energy-based arranger parameters - * @{ - */ - double mSpringRate; - double mSpringLength; - double mRepulsionFactor; - double mFakeRepulsionFactor; - double mShiftFactor; - - QDoubleSpinBox *mSpringRateSpinBox; - QDoubleSpinBox *mSpringLengthSpinBox; - QDoubleSpinBox *mRepulsionFactorSpinBox; - QDoubleSpinBox *mFakeRepulsionFactorSpinBox; - QDoubleSpinBox *mShiftFactorSpinBox; - /*! @}*/ - -private: - //! Register undo/redo commands for object moving. - void registerMoving(); - - //! Nodes which were selected during the operation start. - QList mNodes; - - //! SCgPairs which were selected during the operation start. - QSet mPairs; - - //! SCgBusses which were selected during the operation start. - QSet mBusses; - - //! SCgContours which were selected during the operation start. - QSet mContours; - - //! Timer id which calls timerEvent every 25 ms. - qint32 mTimerId; - - //! Timer which stops the arranging after 20 s. - QTimer *mStopTimer; - - //! Allows monitoring a QFuture using signals and slots. - //! @see SCgArrangerEnergyBased::forceCalculationFinished() - QFutureWatcher mFutureWatcher; - -private slots: - //! Stops the arranging. - void stopTimerTimeout(); - - //! Process results of multithread execution. - void forceCalculationFinished(); -}; -//------------------------------------------------------------------------------ -#endif // SCGARRANGERENERGYBASED_H diff --git a/sources/plugins/scg/arrangers/scgforcecalculator.cpp b/sources/plugins/scg/arrangers/scgforcecalculator.cpp deleted file mode 100644 index c9b2156..0000000 --- a/sources/plugins/scg/arrangers/scgforcecalculator.cpp +++ /dev/null @@ -1,140 +0,0 @@ -#include "scgforcecalculator.h" - -#include - -const double minDistance = 10; // Minimal distance between nodes. It's used at calculation. -// (It's influence fast leap of nodes). -//------------------------------------------------------------------------------ -SCgForceCalculator::SCgForceCalculator(const QList &nodes, - const QSet &pairs, const QSet &busses, - Parameters parameters) - : mNodes(nodes), mPairs(pairs), mBusses(busses), mParameters(parameters) -{ -} -//------------------------------------------------------------------------------ -Force SCgForceCalculator::operator()(const SCgNodeP &node) const -{ - Force force; - addInteractionWithRealNodes(node, force); - addInteractionWithPairs(node, force); - addInteractionWithFakePairNodes(node, force); - addInteractionWithFakeBusNodes(node, force); - - return force; -} -//------------------------------------------------------------------------------ -void SCgForceCalculator::addInteractionWithRealNodes(const SCgNode *node, - Force &force) const -{ - foreach (SCgNode *curNode, mNodes) { - if (curNode != node) { - // Coordinates of other node: - qreal x2 = curNode->scenePos().x(); - qreal y2 = curNode->scenePos().y(); - - // Calculate distance between nodes: - qreal x1 = node->scenePos().x(); - qreal y1 = node->scenePos().y(); - double distance = calculateDistance(x1, y1, x2, y2); - - // Add interaction force. - if (distance < minDistance) { - distance = minDistance; // Need to avoid fast leaps of nodes and devision by zero. - } - force.mX += mParameters.mRepulsionFactor * (x1 - x2) / qPow(distance, 3); - force.mY += mParameters.mRepulsionFactor * (y1 - y2) / qPow(distance, 3); - } - } -} -//------------------------------------------------------------------------------ -void SCgForceCalculator::addInteractionWithPairs(const SCgNode *node, - Force &force) const -{ - foreach (SCgObject *object, node->connectedObjects()) { - if (object->type() == SCgPair::Type) { - SCgPair *pair = static_cast(object); - - // x1, y1 - coodinates of pair end, which connected with node. - // x2, y2 - other end of pair: - qreal x1, y1, x2, y2; - if (pair->beginObject() == node) { - x2 = pair->scenePoints().last().x(); - y2 = pair->scenePoints().last().y(); - x1 = pair->scenePoints().first().x(); - y1 = pair->scenePoints().first().y(); - } else { - x2 = pair->scenePoints().first().x(); - y2 = pair->scenePoints().first().y(); - x1 = pair->scenePoints().last().x(); - y1 = pair->scenePoints().last().y(); - } - - // Calculate length of pair: - double distance = calculateDistance(x1, y1, x2, y2); - - // Add interaction force. - if (distance < minDistance) { - distance = minDistance; // Need to avoid fast leaps of nodes and devision by zero. - } - force.mX -= mParameters.mSpringRate * (distance - mParameters.mSpringLength) - * (x1 - x2) / distance; - force.mY -= mParameters.mSpringRate * (distance - mParameters.mSpringLength) - * (y1 - y2) / distance; - } - } -} -//------------------------------------------------------------------------------ -void SCgForceCalculator::addInteractionWithFakePairNodes(const SCgNode *node, - Force &force) const -{ - foreach (SCgPair *pair, mPairs) { - // Calculate coordinates of fake node (middle of the pair): - qreal fakeX = (pair->scenePoints().last().x() + pair->scenePoints().first().x()) / 2; - qreal fakeY = (pair->scenePoints().last().y() + pair->scenePoints().first().y()) / 2; - - addInteractionWithFakeNodes(node, force, fakeX, fakeY); - } -} -//------------------------------------------------------------------------------ -void SCgForceCalculator::addInteractionWithFakeBusNodes(const SCgNode *node, - Force &force) const -{ - foreach (SCgBus *bus, mBusses) { - // Calculate coordinates of fake node and add interection with this one: - // on the middle of the bus: - qreal fakeX = (bus->scenePoints().last().x() + bus->scenePoints().first().x()) / 2; - qreal fakeY = (bus->scenePoints().last().y() + bus->scenePoints().first().y()) / 2; - addInteractionWithFakeNodes(node, force, fakeX, fakeY); - // on the end of the bus: - fakeX = bus->scenePoints().last().x(); - fakeY = bus->scenePoints().last().y(); - addInteractionWithFakeNodes(node, force, fakeX, fakeY); - } -} -//------------------------------------------------------------------------------ -void SCgForceCalculator::addInteractionWithFakeNodes(const SCgNode *node, - Force &force, qreal fakeX, qreal fakeY) const -{ - // Calculate distance between the node and a fake node: - qreal nodeX = node->scenePos().x(); - qreal nodeY = node->scenePos().y(); - double distance = calculateDistance(nodeX, nodeY, fakeX, fakeY); - - // Add interaction force with the fake node: - if (distance < minDistance) { - distance = minDistance; // Need to avoid fast leaps of nodes and devision by zero. - } - force.mX += mParameters.mFakeRepulsionFactor * (nodeX - fakeX) / qPow(distance, 3); - force.mY += mParameters.mFakeRepulsionFactor * (nodeY - fakeY) / qPow(distance, 3); -} -//------------------------------------------------------------------------------ -double calculateDistance(QPointF p1, QPointF p2) -{ - return qSqrt(qPow(p2.x() - p1.x(), 2) + qPow(p2.y() - p1.y(), 2)); -} -//------------------------------------------------------------------------------ -double calculateDistance(qreal x1, qreal y1, qreal x2, qreal y2) -{ - return qSqrt(qPow(x2 - x1, 2) + qPow(y2 - y1, 2)); -} -//------------------------------------------------------------------------------ diff --git a/sources/plugins/scg/arrangers/scgforcecalculator.h b/sources/plugins/scg/arrangers/scgforcecalculator.h deleted file mode 100644 index 2445ed7..0000000 --- a/sources/plugins/scg/arrangers/scgforcecalculator.h +++ /dev/null @@ -1,126 +0,0 @@ -#ifndef FORCECALCULATOR_H -#define FORCECALCULATOR_H - -#include "scgnode.h" -#include "scgpair.h" -#include "scgbus.h" - -#include -#include - -typedef SCgNode * SCgNodeP; -//------------------------------------------------------------------------------ -//! Force are influencing object. -struct Force -{ - explicit Force(double x = 0, double y = 0) : mX(x), mY(y) {} - - //! Force along the X axis. - double mX; - //! Force along the Y axis. - double mY; -}; -//------------------------------------------------------------------------------ -//! Energy-based arranger parameters. -struct Parameters -{ - explicit Parameters(double springRate = 1, double springLength = 100, - double repulsionFactor = 10000, - double fakeRepulsionFactor = 500) - : mSpringRate(springRate), mSpringLength(springLength), - mRepulsionFactor(repulsionFactor), - mFakeRepulsionFactor(fakeRepulsionFactor) {} - - double mSpringRate; - double mSpringLength; - double mRepulsionFactor; - double mFakeRepulsionFactor; -}; -//------------------------------------------------------------------------------ -class SCgForceCalculator -{ -public: - SCgForceCalculator(const QList &nodes, - const QSet &pairs, const QSet &busses, - Parameters parameters); - - typedef Force result_type; - - //! Calculate force which influences node. - /*! - * @p node - SCgNode for that method calculate force. - * @return force which influences node. - */ - Force operator()(const SCgNodeP &node) const; - -private: - //! Add force of interaction node with other real nodes. - /*! - * @p node - SCgNode for which we calculate the force. - * @p force - current force which influences node. - */ - void addInteractionWithRealNodes(const SCgNode *node, Force &force) const; - - //! Add force which influences node because of connected pairs. - /*! - * @p node - SCgNode for which we calculate the force. - * @p force - current force which influences node. - */ - void addInteractionWithPairs(const SCgNode *node, Force &force) const; - - //! Add force of interaction node with fake nodes (they are located in middle of pairs). - /*! - * @p node - SCgNode for which we calculate the force. - * @p force - current force which influences node. - */ - void addInteractionWithFakePairNodes(const SCgNode *node, Force &force) const; - - //! Add force of interaction node with fake nodes (they are located in middle and end of busses). - /*! - * @p node - SCgNode for which we calculate the force. - * @p force - current force which influences node. - */ - void addInteractionWithFakeBusNodes(const SCgNode *node, Force &force) const; - - //! Add force of interaction node with fake node. - /*! - * @p node - SCgNode for which we calculate the force. - * @p force - current force which influences node. - * @p fakeX - X coordinate of fake node. - * @p fakeY - Y coordinate of fake node. - */ - void addInteractionWithFakeNodes(const SCgNode *node, Force &force, - qreal fakeX, qreal fakeY) const; - - //! Nodes are selected for arranging. - const QList mNodes; - - //! Pairs are selected for arranging. - const QSet mPairs; - - //! Busses are selected for arranging. - const QSet mBusses; - - //! Parameters for energe-based arranging. - Parameters mParameters; -}; -//------------------------------------------------------------------------------ -//! Calculate distance between two points. -/*! - * @p p1 - first point. - * @p p2 - second point. - * @return distance between the points. - */ -inline double calculateDistance(QPointF p1, QPointF p2); -//------------------------------------------------------------------------------ -//! Calculate distance between two points. -/*! - * @p x1 - X coordinate of the first point. - * @p y1 - Y coordinate of the first point. - * @p x2 - X coordinate of the second point. - * @p y2 - Y coordinate of the second point. - * @return distance between the points. - */ -inline double calculateDistance(qreal x1, qreal y1, qreal x2, qreal y2); -//------------------------------------------------------------------------------ -#endif // FORCECALCULATOR_H diff --git a/sources/plugins/scg/media/TypeClonningCursor.bmp b/sources/plugins/scg/media/TypeClonningCursor.bmp deleted file mode 100644 index 17851b03ab0a89c1419512d65be713ddfce76c28..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3126 zcmeIu!488k2nOJKH#>Xu=o9z=yYH>{UK3^eLx3g|+FP4+qZB@s=WCzKwRZa5Xs_Qr zm4zZ&bpL+v=0qu<7K^bKl4Jbd^!#_O)2Xh0SDZe*tiOPOMPQ8G|0 zj!72n0BZp%V?m8YKE|R8jvJsX9Jnke!=`Mk`LZSxyM6{#z1Ft{Ds$_oeA`O}Hu--> i`l?G_g`WaM;W&n67TAYogQRc4kr@*h6BrW+Pv8I~Vr^Rh diff --git a/sources/plugins/scg/media/icons/tool-align-energy.png b/sources/plugins/scg/media/icons/tool-align-energy.png deleted file mode 100644 index 340fafdedb64c0aac8b656a61cb6db417a778fe1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5451 zcmV-R6}0M!P)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D6yQljK~!i%&02R< zTW7L==bg8^SsQHAJ3YizOT7O3U7cgk8Gq-yNE+YYotfXv+JQ&SV8cYnCPfA@}@j8q<*!3d`M5^*G=m#3?f{W5F& zWlNoG9c`>^mo8dnztqvw1w+F7MsNff$(g14vf7Hey*u_@y>M-Kco>Y$%q+OhB7zFo z`0(J4EnV5^DS*et!PeE$&KrjzczFc);aQ=ya1Kkz=ZV52`Rs5;5Q{+z^COZ07}gy} zzz{)Q9o&2gej2&9zP|p(jT?wfO9?7qx2|6k@WLo$5}g_l=;sp}LYQ)a}D6Jtki6UM9B^b3lED>tJUr8?M9<}u-KenI+q?2>__(T#DIExc;Q_= z=wvD{gzb+fxw*K@r1Iwjzb)9cgrEWj6n*>l57}86o*r&Kc$|leGseZm)7jbH&SvQn zt0jy6x^(fPCGWgr_2)m^SzBYBT^KZ4IGZitaM<)v0f(0wpPZGF5hIdN0;tqL+TGjt z7OYxAPy(Afa^y%%OpMLaWlOBA-JM;W?Ce2ZVdLNkE6x++&1UvWVL9qjr9`yWj2ns zc1}xdLi{O0E?vVl=Rm6#?9-yYAb34Tp`BQ%h}P*+nbc0o_XQIB`|3+S!OCj>#-f% zw)^{$6*9R_8(UFUUZgi@)f%NzotT(xFchz7@7S?z=dP_g+ZtQ*GIL9E3(5-&#rcIQ zseU>xIX;dpg-T05F{@E|f*927u<9OE#!WZysrgT-Qn zz5DKQV2-yU6lbUBy7wRSA(Hr9K?FaN&EUx-s??;+lA_YOn);@O#`Wt~tyR8dfZR_UujvqO&e|KAJLq&N}YN{?LJ8j+C4$$13bT*4l zBw$EB;8=GTSNHgYqzAt|1e@j?AC|~6w4wO>Z!f?<+%R5ddQL@IbwO^CNFbpH2MQuM zf(UMOlu#5Y2&IPrqd>S)XjFnX(caO))!oethYewb#>VNy(NRv$t{g7^#?4z`(j1C! z9N3g;5>Dd6ci*?SE>BHPgXSoJOohhJ*B9&OhjVhYS+>;L(cZzu$sLFB_Qv~}n=Lw% zA0DZTOUla5-?Vvq&-)+M)HdP?-WV_3k)y{D#(xVuhTIjMo%{J;KOH`Jq^zVoBP}~6 zDV@h?lOi}jUjR&HFou4`l0w*3c={PX<9pMHMy@X@pP&wL_`l!Syb z$^L=cckDudneU~d7F58Ho4zjxe?M~QurylY>*ELNP4Mw>b9Z-j!($0BKEkX8yeABg zg4{dQef03bcTb+^xpJxR!grV3TRXtXp6*ybazL~s=Diaq5%MtKHbyOIJvKZvSYKBY z!4D_<`nfv0fnqT@S|B5c5*ixJh63$P@bz%>bar%cw0H8s5~Bs;ilVZ$D^@qxHj4N{ zX!C;uXpy3*m8;g=x_uWcnz6m{P@J7HO^lDmNTX@gKp0+>as>n)B%4Z>6sJu~(50yr zIv|y{me$&uDz!?Xk;u|?3AH8VImu~^KpKoN(Cp`>W>i#G_kQu!#C-evb^x0vF(_rs zV1_zcUac>yGgLGcSH(&-a$$^0tWb*Nx)^P`E)@=geQEwa0e(cXhqEW%lgJEaDTU%B<{PiiALwb(!@p%eCC+Ko)z7roA8r`;KdwNouIz|~0#-|4cL95~Ah6M!- z^Dqbm43X&N4P6M-akVlQ@~x@9t)qQSc1B@1R~)BH+O>1vq{-~5x1v`BQZ!AN8UOa} zyN3@SZC~DDC@M)#NlQpcS7>xFrfB1nbcrb$Ir)atiu&fZ^&2+s-FM)F56@n_bPZVX z@sr;!Ug|3=t4mAG%1F<-ed|7$go|a7rxU1v&6p-lW8(k}F7lYkc>lpq-}hhr{M&DO z&YeB=$;W3t`xG{3zxwj~{=TcXZ{7Iu{>z~eqiJe-X3l7WpU%RsKzHoir`5!V^CP}EMenEQ z>MJX?a=A<_4)zNGDtBIL>$1$w+rtaSuy}>Ky{_>ey-Tyl%UJ8Ik>blzdavluCL>VGQ8bAZ2t5YoSmbeCytE4Qwbyr z-Un7V#5%b6dl9tKnAV#5t?N2FJ64w$6w4zeL^r&I9|fpBJ=Z%i4z#gg8NHy+v64GL7h(2X(~&LS{v&sN(>2!sfkHx1%<^zL6o0w zpgcxZT3oSVUDxNIeK|I2nx2}US?1P^fRLZz$3m z;&j@Ga9%i{%ja=mg`Oi;tCmWlC{(%^mPqmq2%)poDqU4YEwqbWom;->{bmMy560k1 zSxC@&Y|?0c?Ehu&7iA@-332ghDXH=p8I=}HAo}=_{D|HpFDxF5Bfww+hXP?#RJ1HE zJ{e-Kt+k`Fye3|kBoanfB5k6wJUvxx)0}M*b z8PJ~|{Cx59rIW|sYinxO=j9jX=2exIujyEMV9(x9KKKwmeK|Y?ie%>4$mprRo#b)2 zR09*4gan6Tu~;gVs?+IOn_D(*?5Zp+6AOd_9zP`| zt-Jfs^XFz(giw6*z(9Z!fg6G7$z*auLP9}7K~hpuZFSv>_Kr;(H^TtBxogYD4P9_p zQC3-8Tnt}mX=wpqu^KIh$x_P|)#VlI)@^|7nzv@53_}kLVfuN5VWMEthKd$)v7fO4NW;Yd6AJ~3WY`uq;c3>twNKXmQ|Qjuzr2#@UXd! zLdNH}!ehv^J2*JFWy=<=R+};}N(Ho3A{eoPXrVxNpd=rEH&=|iyQi-&nZ*jzsI=hK zEuEViYZ_!xG3DizJw0b$ym$$w7Vep%77GA_iUgbc_wRRhc7n&`ayg653#KzcnJg}c z8v&h^Os>{w<8!hL>g$@fZQXUI=c8*^uD^ITc<095u63L8@(QY|YQFjApI~Qf45m8^ z2r6Jm93oDG^_O3M>Fw>^wQJYvHJvLu);2XSud8o?751CA>^ykr7&N;ubPc{3nJ*OZ zo4HxjT;HXBy}l?eE@A7|?Us5@3u2iZL+TR9*w`2}M5AMq6ULdL;fcYQW8)LkMiaCk z=ERwTZ$Y8{qj1l`;ndv7i&02FktnLEspTyq4}kRQbzWddC;;F(m_cB^f~NM??YsBx z|L<>uFCIS|7#tZMnJ`WOiOz#E&O2v(+z3Q3kx1xtdUJF0(9jTKXWkwvK?Mv6LJ)8i ztS}(<_xG<|yEZ2)ABK?tGBq%e3N)xtDb-qyEKdEtn#v5N5@8fGC{!g?w70hdqkJYKj`t*Wf9Dm3VeOUlyHGs7c<(Dg<~OQHFI1~NG@rL?pZhE%YF zuiCh>JEf7ZqF+=@>sKG2oFpDJsKq^&S zQgUr$Q&V$md_q!``46g(KmHhu03?gVA&3QX44LGi|A4mL#l^nlnkLL=59`>7`OPHc zPQk>Oand;T@RvuYPxch%>sbso@FWCqPfrix`M1JjAg?pn>C>m70~U+L$onkSm314| zb?w{JeeCFolP7vWckkS@clW;cPoLSkd0Sj;JfIRrM5d=^Y}l~j-o5|4!u{sS0|Yq< zWPSep`TF(iV`F3E%0E=$$)8c;qEEq>MPoK-FyFUu|ST&2_cY>GlLb* zYixXSXn6ejZ-f8(=~uvc`AYw_zMHr2+Y{{SjWdLGE9!nyze002ovPDHLkV1miE Bq3{3z diff --git a/sources/plugins/scg/scg.pro b/sources/plugins/scg/scg.pro index 794441e..f35a868 100644 --- a/sources/plugins/scg/scg.pro +++ b/sources/plugins/scg/scg.pro @@ -14,6 +14,10 @@ MOC_DIR = moc RESOURCES = scg.qrc +win32 { + DEFINES += _USE_MATH_DEFINES +} + HEADERS += \ scgwindow.h \ scgview.h \ @@ -88,10 +92,8 @@ HEADERS += \ modes/scgclonemode.h \ modes/scgbusmode.h \ commands/scgcommandswappairorient.h \ - arrangers/scgarrangerenergybased.h \ commands/scgcommandremovebreakpoints.h \ commands/scgcommandminimizecontour.h \ - arrangers/scgforcecalculator.h \ scgnodetextitem.h SOURCES += \ @@ -168,10 +170,8 @@ SOURCES += \ modes/scgclonemode.cpp \ modes/scgbusmode.cpp \ commands/scgcommandswappairorient.cpp \ - arrangers/scgarrangerenergybased.cpp \ commands/scgcommandremovebreakpoints.cpp \ commands/scgcommandminimizecontour.cpp \ - arrangers/scgforcecalculator.cpp \ scgnodetextitem.cpp TRANSLATIONS += media/translations/scg_en_EN.ts \ diff --git a/sources/plugins/scg/scg.qrc b/sources/plugins/scg/scg.qrc index 611b24f..3bc30fc 100644 --- a/sources/plugins/scg/scg.qrc +++ b/sources/plugins/scg/scg.qrc @@ -31,7 +31,5 @@ media/icons/tool-select-subgraph.png media/translations/scg_en_EN.qm media/translations/scg_ru_RU.qm - media/TypeClonningCursor.bmp - media/icons/tool-align-energy.png diff --git a/sources/plugins/scg/scgcontour.cpp b/sources/plugins/scg/scgcontour.cpp index e6b6eb6..04266b8 100644 --- a/sources/plugins/scg/scgcontour.cpp +++ b/sources/plugins/scg/scgcontour.cpp @@ -32,6 +32,9 @@ along with OSTIS. If not, see . #include #include +qreal SCgContour::CornerRadius = 20.f; +qreal SCgContour::BorderDistance = 20.f; + SCgContour::SCgContour() : mColorBack(QColor(250, 250, 250, 164)) { @@ -152,10 +155,10 @@ SCgPointObject::PointFVector SCgContour::minimizedPoints() const } // Increase distance from borders: - minX -= borderDistance; - minY -= borderDistance; - maxX += borderDistance; - maxY += borderDistance; + minX -= BorderDistance; + minY -= BorderDistance; + maxX += BorderDistance; + maxY += BorderDistance; // Remove all points and set only 4 corner points: newPoints << QPointF(minX, minY) << QPointF(maxX, minY) @@ -183,9 +186,9 @@ void SCgContour::updateShape() // In case two points are placed close to each other // we need to adjust corner radius. - qreal cornerRadiusAdjusted = cornerRadius; + qreal cornerRadiusAdjusted = CornerRadius; qreal dirLength = dir.length(); - if(dirLength < cornerRadius * 2) + if(dirLength < CornerRadius * 2) cornerRadiusAdjusted = dirLength / 2; dir.normalize(); diff --git a/sources/plugins/scg/scgcontour.h b/sources/plugins/scg/scgcontour.h index 27a4b18..4722f2f 100644 --- a/sources/plugins/scg/scgcontour.h +++ b/sources/plugins/scg/scgcontour.h @@ -102,10 +102,10 @@ class SCgContour : public SCgPointObject protected: //! Corner radius for drawing shape - static const qreal cornerRadius = 20.0; + static qreal CornerRadius; //! Distance from border to content for minimized contour: - static const qreal borderDistance = 20.0; + static qreal BorderDistance; //! Contour shape QPainterPath mShape; diff --git a/sources/plugins/scg/scgplugin.cpp b/sources/plugins/scg/scgplugin.cpp index 791578f..aef6ca4 100644 --- a/sources/plugins/scg/scgplugin.cpp +++ b/sources/plugins/scg/scgplugin.cpp @@ -33,7 +33,6 @@ along with OSTIS. If not, see . #include "arrangers/scgarrangerhorizontal.h" #include "arrangers/scgarrangertuple.h" #include "arrangers/scgarrangervertical.h" -#include "arrangers/scgarrangerenergybased.h" #include #include @@ -82,7 +81,6 @@ void SCgPlugin::initialize() SCgLayoutManager::instance().addArranger(new SCgVerticalArranger(this)); SCgLayoutManager::instance().addArranger(new SCgHorizontalArranger(this)); SCgLayoutManager::instance().addArranger(new SCgTupleArranger(this)); - SCgLayoutManager::instance().addArranger(new SCgEnergyBasedArranger(this)); qApp->installTranslator(mTranslator); } diff --git a/sources/plugins/scg/scgwindow.cpp b/sources/plugins/scg/scgwindow.cpp index 0b3f453..6aec738 100644 --- a/sources/plugins/scg/scgwindow.cpp +++ b/sources/plugins/scg/scgwindow.cpp @@ -43,7 +43,6 @@ along with OSTIS. If not, see . #include "arrangers/scgarrangerhorizontal.h" #include "arrangers/scgarrangergrid.h" #include "arrangers/scgarrangertuple.h" -#include "arrangers/scgarrangerenergybased.h" #include "select/scgselectinputoutput.h" #include "select/scgselectsubgraph.h" @@ -262,14 +261,6 @@ void SCgWindow::createToolBar() alignButton->addAction(action); connect(action, SIGNAL(triggered()), this, SLOT(onHorizontalAlignment())); - // Energy-based layout - action = new QAction(findIcon("tool-align-energy.png"), tr("Energy-based layout"), mToolBar); - action->setCheckable(false); - action->setShortcut(QKeySequence(tr("9", "Energy-based layout"))); - alignButton->addAction(action); - connect(action, SIGNAL(triggered()), this, SLOT(onEnergyBasedLayout())); - - // selection group button QToolButton *selectButton = new QToolButton(mToolBar); selectButton->setIcon(findIcon("tool-select-group.png")); @@ -429,11 +420,6 @@ void SCgWindow::onHorizontalAlignment() SCgLayoutManager::instance().arrange(mView, SCgHorizontalArranger::Type); } -void SCgWindow::onEnergyBasedLayout() -{ - SCgLayoutManager::instance().arrange(mView, SCgEnergyBasedArranger::Type); -} - void SCgWindow::onSelectInputOutput() { SCgSelectInputOutput select; diff --git a/sources/plugins/scg/scgwindow.h b/sources/plugins/scg/scgwindow.h index c33d81f..6fa90d9 100644 --- a/sources/plugins/scg/scgwindow.h +++ b/sources/plugins/scg/scgwindow.h @@ -201,8 +201,6 @@ private slots: void onVerticalAlignment(); //! Slot to handle a horizontal alignment action void onHorizontalAlignment(); - //! Slot to handle a energy-based layout action - void onEnergyBasedLayout(); //! Slot to handle select input/output action void onSelectInputOutput(); //! Slot to handle select subgraph action From 4bd50792b5f672ae2310d1643329ae87152bdf44 Mon Sep 17 00:00:00 2001 From: Denis Koronchik Date: Sat, 28 Mar 2015 21:18:46 +0300 Subject: [PATCH 41/71] [install] Fix windows installer scripts (prepare 0.3.1 installer for windows) --- .gitignore | 2 + AUTHORS | 1 + docs/changelog.html | 1 + installer/generate_nsi.bat | 1 - installer/generate_nsi.py | 4 +- installer/generate_nsi_32bit.bat | 1 + installer/install.nsi | 209 +++++++++++++++++++++++++++++++ installer/install_script.nsi_ | 57 ++------- 8 files changed, 230 insertions(+), 46 deletions(-) delete mode 100644 installer/generate_nsi.bat create mode 100644 installer/generate_nsi_32bit.bat create mode 100644 installer/install.nsi diff --git a/.gitignore b/.gitignore index d00e891..1856e64 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,5 @@ all-build-desktop/* *.user.* sources/kbe/ui_mainwindow.h + +installer/sources/* diff --git a/AUTHORS b/AUTHORS index 2db4723..fb5fec2 100644 --- a/AUTHORS +++ b/AUTHORS @@ -5,6 +5,7 @@ It's a part of OSTIS project. The full list of contributors is: Denis Koronchik +Vlad Mikitich (mikluke) Gumbar Ilya (zooner) Harkunov Evgeny (filosov) Witkowsky Dmityr (wagos) diff --git a/docs/changelog.html b/docs/changelog.html index db08493..7b4f10e 100644 --- a/docs/changelog.html +++ b/docs/changelog.html @@ -19,6 +19,7 @@

Common changes

  • Added hotkeys to switch tabs
  • Added cancel button to save file dialog on exit
  • +
  • Added projects support

    Now you can create projects like in VisualStudio, QtCreator and etc.

  • Improved new file dialog
  • Fixed plugin loading on linux
  • Fixed dock widget positions save/load
  • diff --git a/installer/generate_nsi.bat b/installer/generate_nsi.bat deleted file mode 100644 index 8af3752..0000000 --- a/installer/generate_nsi.bat +++ /dev/null @@ -1 +0,0 @@ -generate_nsi.py install_script.nsi_ install.nsi \ No newline at end of file diff --git a/installer/generate_nsi.py b/installer/generate_nsi.py index eadbf9f..f2cf1eb 100644 --- a/installer/generate_nsi.py +++ b/installer/generate_nsi.py @@ -9,7 +9,7 @@ if __name__ == "__main__": if len(sys.argv) < 3: - print "Usage setcions.py