end lines

View: New views
8 Messages — Rating Filter:   Alert me  

end lines

by Jérémy Lugagne :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Index: plugins/dockers/Plugin.cpp
===================================================================
--- plugins/dockers/Plugin.cpp (révision 1042019)
+++ plugins/dockers/Plugin.cpp (copie de travail)
@@ -25,7 +25,7 @@
 #   include "colordocker/ColorDockerFactory.h"
 #endif
 #include "shapecollection/KoShapeCollectionDocker.h"
-
+#include "shapeendlines/KoEndLinesDockerFactory.h"
 #include <KoDockRegistry.h>
 
 #include <kgenericfactory.h>
@@ -44,6 +44,7 @@
     KoDockRegistry::instance()->add(new ColorDockerFactory());
 #endif
     KoDockRegistry::instance()->add(new KoShapeCollectionDockerFactory());
+    KoDockRegistry::instance()->add(new KoEndLinesDockerFactory());
 }
 
 #include "Plugin.moc"
Index: plugins/dockers/shapeendlines/endLineStyle/endLine.xml
===================================================================
--- plugins/dockers/shapeendlines/endLineStyle/endLine.xml (révision 0)
+++ plugins/dockers/shapeendlines/endLineStyle/endLine.xml (révision 0)
@@ -0,0 +1,14 @@
+<?xml version="1.0" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
+  "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
+<lineends>
+   <draw:marker draw:name="Arrow" draw:display-name="Arrow" svg:viewBox="0 0 20 30" svg:d="m10 0-10 30h20z"/>
+   <draw:marker draw:name="Circle" draw:display-name="Circle" svg:viewBox="0 0 1131 1131" svg:d="m462 1118-102-29-102-51-93-72-72-93-51-102-29-102-13-105 13-102 29-106 51-102 72-89 93-72 102-50 102-34 106-9 101 9 106 34 98 50 93 72 72 89 51 102 29 106 13 102-13 105-29 102-51 102-72 93-93 72-98 51-106 29-101 13z"/>
+   <draw:marker draw:name="Dimension_20_Lines" draw:display-name="Dimension Lines" svg:viewBox="0 0 836 110" svg:d="m0 0h278 278 280v36 36 38h-278-278-280v-36-36z"/>
+   <draw:marker draw:name="Double_20_Arrow" draw:display-name="Double Arrow" svg:viewBox="0 0 1131 1918" svg:d="m737 1131h394l-564-1131-567 1131h398l-398 787h1131z"/>
+   <draw:marker draw:name="Line_20_Arrow" draw:display-name="Line Arrow" svg:viewBox="0 0 1122 2243" svg:d="m0 2108v17 17l12 42 30 34 38 21 43 4 29-8 30-21 25-26 13-34 343-1532 339 1520 13 42 29 34 39 21 42 4 42-12 34-30 21-42v-39-12l-4 4-440-1998-9-42-25-39-38-25-43-8-42 8-38 25-26 39-8 42z"/>
+   <draw:marker draw:name="Square" draw:display-name="Square" svg:viewBox="0 0 10 10" svg:d="m0
+0h10v10h-10z"/>
+   <draw:marker draw:name="Square_20_45" draw:display-name="Square 45" svg:viewBox="0 0 1131 1131" svg:d="m0 564 564 567 567-567-567-564z"/>
+   <draw:marker draw:name="new_shape" draw:display-name="new shape" svg:viewBox="0 0 100 150" svg:d="M 50 0 L 0 55 L 40 55 L 0 100 L 100 100 L 60 55 L 100 55 L 50 0 z"/>
+</lineends>
Index: plugins/dockers/shapeendlines/endLineStyle/CMakeLists.txt
===================================================================
--- plugins/dockers/shapeendlines/endLineStyle/CMakeLists.txt (révision 0)
+++ plugins/dockers/shapeendlines/endLineStyle/CMakeLists.txt (révision 0)
@@ -0,0 +1,3 @@
+install( FILES
+         endLine.xml
+         DESTINATION ${DATA_INSTALL_DIR}/koffice/endLineStyle)
Index: plugins/dockers/shapeendlines/KoEndLineShapeModel.h
===================================================================
--- plugins/dockers/shapeendlines/KoEndLineShapeModel.h (révision 0)
+++ plugins/dockers/shapeendlines/KoEndLineShapeModel.h (révision 0)
@@ -0,0 +1,54 @@
+/* This file is part of the KDE project
+ * Copyright (C) 2008 Alexia Allanic
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef KOENDLINESHAPEMODEL_H_
+#define KOENDLINESHAPEMODEL_H_
+
+#include <QAbstractItemModel>
+#include <QList>
+#include <QString>
+#include <QIcon>
+
+/**
+ * Struct containing the information stored in KoEndLineShape item
+ */
+struct KoEndLineShape
+{
+    KoEndLineShape()
+    {
+    };
+
+    QString id;
+    QString name;
+    QIcon icon;
+};
+
+class KoEndLineShapeModel : public QAbstractListModel
+{
+public:
+    KoEndLineShapeModel( QObject * parent = 0 );
+    ~KoEndLineShapeModel() {}
+    int rowCount(const QModelIndex &parent = QModelIndex()) const;
+    QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
+    void setShapeTemplateList(const QList<KoEndLineShape>& newlist);
+private:
+    QList<KoEndLineShape> m_shapeTemplateList;
+};
+
+#endif
\ No newline at end of file
Index: plugins/dockers/shapeendlines/KoEndLinesDockerFactory.h
===================================================================
--- plugins/dockers/shapeendlines/KoEndLinesDockerFactory.h (révision 0)
+++ plugins/dockers/shapeendlines/KoEndLinesDockerFactory.h (révision 0)
@@ -0,0 +1,38 @@
+/* This file is part of the KDE project
+   Copyright (C) 2007 Jan Hambrecht <jaham@...>
+
+   This library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public
+   License as published by the Free Software Foundation; either
+   version 2 of the License, or (at your option) any later version.
+
+   This library 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
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public License
+   along with this library; see the file COPYING.LIB.  If not, write to
+   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+*/
+
+#ifndef KOENDLINESDOCKERFACTORY_H
+#define KOENDLINESDOCKERFACTORY_H
+
+#include <KoDockFactory.h>
+#include <QtGui/QDockWidget>
+
+/// the factory which creates the shape properties docker
+class KoEndLinesDockerFactory : public KoDockFactory
+{
+public:
+    KoEndLinesDockerFactory();
+
+    virtual QString id() const;
+    virtual QDockWidget* createDockWidget();
+    virtual DockPosition defaultDockPosition() const;
+
+};
+
+#endif // KOENDLINESDOCKERFACTORY_H
Index: plugins/dockers/shapeendlines/KoShapeEndLinesDocker.cpp
===================================================================
--- plugins/dockers/shapeendlines/KoShapeEndLinesDocker.cpp (révision 0)
+++ plugins/dockers/shapeendlines/KoShapeEndLinesDocker.cpp (révision 0)
@@ -0,0 +1,189 @@
+/* This file is part of the KDE project
+   Made by Tomislav Lukman (tomislav.lukman@...)
+   Copyright (C) 2002 Tomislav Lukman <tomislav.lukman@...>
+   Copyright (C) 2002-2003 Rob Buis <buis@...>
+   Copyright (C) 2005-2006 Tim Beaulen <tbscope@...>
+   Copyright (C) 2005-2007 Thomas Zander <zander@...>
+   Copyright (C) 2005-2006 Inge Wallin <inge@...>
+   Copyright (C) 2005-2008 Jan Hambrecht <jaham@...>
+   Copyright (C) 2006 Casper Boemann <cbr@...>
+   Copyright (C) 2006 Peter Simonsson <psn@...>
+   Copyright (C) 2006 Laurent Montel <montel@...>
+   Copyright (C) 2007 Thorsten Zachmann <t.zachmann@...>
+
+   This library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public
+   License as published by the Free Software Foundation; either
+   version 2 of the License, or (at your option) any later version.
+
+   This library 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
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public License
+   along with this library; see the file COPYING.LIB.  If not, write to
+   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+*/
+
+#include "KoShapeEndLinesDocker.h"
+
+#include <KoToolManager.h>
+#include <KoCanvasBase.h>
+#include <KoCanvasController.h>
+#include <KoCanvasResourceProvider.h>
+#include <KoDockFactory.h>
+#include <KoUnitDoubleSpinBox.h>
+#include <KoShapeManager.h>
+#include <KoShapeBorderCommand.h>
+#include <KoShapeBorderModel.h>
+#include <KoSelection.h>
+#include "../shapecollection/KoCollectionItemModel.h"
+#include <KoShapeFactory.h>
+#include <KoShapeRegistry.h>
+#include <klocale.h>
+#include <KoOdfReadStore.h>
+#include <kstandarddirs.h>
+#include <KoToolManager.h>
+#include <KoShape.h>
+#include <KoSelection.h>
+#include <KoPathShape.h>
+#include <KoLineEnd.h>
+
+
+#include <QLabel>
+#include <QRadioButton>
+#include <QWidget>
+#include <QGridLayout>
+#include <QButtonGroup>
+#include <QGridLayout>
+#include <QList>
+#include <QComboBox>
+#include <QSvgRenderer>
+#include <QPixmap>
+#include <QMetaType>
+
+
+KoShapeEndLinesDocker::KoShapeEndLinesDocker()
+{
+    setWindowTitle( i18n( "End Lines" ) );
+
+    QWidget *mainWidget = new QWidget( this );
+    QGridLayout *mainLayout = new QGridLayout( mainWidget );
+
+    // Define the two QComboBox
+    m_iconW = 20;
+    m_iconH = 20;
+    m_iconSize.setHeight(m_iconH);
+    m_iconSize.setWidth(m_iconW);
+    m_beginEndLineComboBox = new QComboBox( mainWidget );
+    m_beginEndLineComboBox->setIconSize(m_iconSize);
+    
+    qRegisterMetaType<KoLineEnd>("KoLineEnd");
+
+    QPixmap qp(m_iconSize);
+    qp.fill(Qt::transparent);
+    QVariant beginNone;
+    QVariant endNone;
+    m_beginEndLineComboBox->addItem(QIcon(qp),"None", beginNone.fromValue( KoLineEnd() ) );
+    m_endEndLineComboBox = new QComboBox( mainWidget );
+    m_endEndLineComboBox->setIconSize(m_iconSize);
+    m_endEndLineComboBox->addItem(QIcon(qp),"None", beginNone.fromValue( KoLineEnd() ) );
+
+    int proportion = 3;
+    QString fileName( KStandardDirs::locate( "data","koffice/endLineStyle/endLine.xml" ) );
+    if ( ! fileName.isEmpty() ) {
+        QFile file( fileName );
+        QString errorMessage;
+        if ( KoOdfReadStore::loadAndParse( &file, m_doc, errorMessage, fileName ) ) {
+            KoXmlElement drawMarker, lineEndElement(m_doc.namedItem("lineends").toElement());
+
+            forEachElement(drawMarker, lineEndElement){
+
+                KoLineEnd temp(drawMarker.attribute("display-name"),drawMarker.attribute("d"),drawMarker.attribute("viewBox"));
+
+                QIcon drawIcon(temp.drawIcon(m_iconSize, proportion));
+                
+                QVariant beginValue;
+                QVariant endValue;
+                // add icon and label in the two QComboBox
+                m_beginEndLineComboBox->addItem( drawIcon, temp.name(), beginValue.fromValue( temp ) );
+                m_endEndLineComboBox->addItem( drawIcon, temp.name(), endValue.fromValue( temp ) );
+            }
+        }else {
+            kDebug() << "reading of endLine.xml failed:" << errorMessage;
+        }
+    }
+    else {
+        kDebug() << "endLine.xml not found";
+    }
+
+    // Add Begin to the docker
+    QLabel * beginEndLineLabel = new QLabel( i18n( "Begin :" ), mainWidget );
+    mainLayout->addWidget( beginEndLineLabel, 0, 0 );
+    mainLayout->addWidget( m_beginEndLineComboBox,0,1,1,3);
+    connect( m_beginEndLineComboBox, SIGNAL( activated( int ) ), this, SLOT( beginEndLineChanged( int ) ) );
+
+    // Add End to the docker
+    QLabel * endEndLineLabel = new QLabel( i18n( "End :" ), mainWidget );
+    mainLayout->addWidget( endEndLineLabel, 1, 0 );
+    mainLayout->addWidget( m_endEndLineComboBox,1,1,1,3);
+    connect( m_endEndLineComboBox, SIGNAL( activated( int ) ), this, SLOT( endEndLineChanged( int ) ) );
+
+
+    mainLayout->setRowStretch( 5, 1 );
+    mainLayout->setColumnStretch( 1, 1 );
+    mainLayout->setColumnStretch( 2, 1 );
+    mainLayout->setColumnStretch( 3, 1 );
+
+    setWidget( mainWidget );
+
+}
+
+KoShapeEndLinesDocker::~KoShapeEndLinesDocker()
+{
+}
+
+void KoShapeEndLinesDocker::applyChanges()
+{
+    KoCanvasController* canvasController = KoToolManager::instance()->activeCanvasController();
+    KoSelection *selection = canvasController->canvas()->shapeManager()->selection();
+    if( ! selection || ! selection->count() )
+        return;
+  
+    KoLineEnd begin ( m_beginEndLineComboBox->itemData( m_beginEndLineComboBox->currentIndex() ).value<KoLineEnd>() );
+    KoLineEnd end( m_endEndLineComboBox->itemData( m_endEndLineComboBox->currentIndex() ).value<KoLineEnd>() ) ;
+
+    KoShape* shape = selection->firstSelectedShape();
+    KoPathShape *pathShape;
+    if(pathShape = dynamic_cast<KoPathShape*>(shape)){
+        pathShape->setBeginLineEnd(begin);
+        pathShape->setEndLineEnd(end);
+    }
+}
+
+
+void KoShapeEndLinesDocker::beginEndLineChanged(int index)
+{
+    m_beginEndLineComboBox->setCurrentIndex(index);
+    m_beginEndLineCurrentName = m_beginEndLineComboBox->itemText(index);
+    applyChanges();
+}
+
+void KoShapeEndLinesDocker::endEndLineChanged(int index)
+{
+    m_endEndLineComboBox->setCurrentIndex(index);
+    m_endEndLineCurrentName = m_endEndLineComboBox->itemText(index);
+    applyChanges();
+}
+
+void KoShapeEndLinesDocker::selectionChanged()
+{
+}
+
+void KoShapeEndLinesDocker::setCanvas( KoCanvasBase *canvas )
+{
+}
+#include "KoShapeEndLinesDocker.moc"
+
Index: plugins/dockers/shapeendlines/KoShapeEndLinesDocker.h
===================================================================
--- plugins/dockers/shapeendlines/KoShapeEndLinesDocker.h (révision 0)
+++ plugins/dockers/shapeendlines/KoShapeEndLinesDocker.h (révision 0)
@@ -0,0 +1,78 @@
+/* This file is part of the KDE project
+   Made by Tomislav Lukman (tomislav.lukman@...)
+   Copyright (C) 2002 Tomislav Lukman <tomislav.lukman@...>
+   Copyright (C) 2002 Rob Buis <buis@...>
+   Copyright (C) 2004 Laurent Montel <montel@...>
+   Copyright (C) 2005-2006 Tim Beaulen <tbscope@...>
+   Copyright (C) 2005 Inge Wallin <inge@...>
+   Copyright (C) 2005 Thomas Zander <zander@...>
+   Copyright (C) 2005-2008 Jan Hambrecht <jaham@...>
+   Copyright (C) 2006 Casper Boemann <cbr@...>
+
+   This library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public
+   License as published by the Free Software Foundation; either
+   version 2 of the License, or (at your option) any later version.
+
+   This library 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
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public License
+   along with this library; see the file COPYING.LIB.  If not, write to
+   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+*/
+
+#ifndef KOSHAPEENDLINESDOCKER_H
+#define KOSHAPEENDLINESDOCKER_H
+
+#include <KoUnit.h>
+#include <KoXmlReader.h>
+#include <KoCanvasObserver.h>
+#include <QtGui/QDockWidget>
+#include <QListView>
+#include <QDockWidget>
+#include <kdebug.h>
+#include <QStringList>
+
+class KoShapeBorderModel;
+class KoCanvasController;
+class KoLineEnd;
+class QComboBox;
+
+/// A docker for setting properties of end lines
+class KoShapeEndLinesDocker : public QDockWidget, public KoCanvasObserver
+{
+    Q_OBJECT
+
+public:
+    /// Creates the end lines docker
+    KoShapeEndLinesDocker();
+    virtual ~KoShapeEndLinesDocker();
+private slots:
+    void applyChanges();
+    /// End Line has changed
+    void beginEndLineChanged(int index);
+    void endEndLineChanged(int index);
+    /// selection has changed
+    void selectionChanged();
+    /// reimplemented
+    virtual void setCanvas( KoCanvasBase *canvas );
+
+private:
+    KoXmlDocument m_doc;
+    QString m_beginEndLineCurrentName;
+    QString m_endEndLineCurrentName;
+    int m_iconW;
+    int m_iconH;
+    QSize m_iconSize;
+    QMap<QString, QString> m_pathEndLineMap;
+    QMap<QString, QString> m_viewEndLineMap;
+    QComboBox * m_beginEndLineComboBox;
+    QComboBox * m_endEndLineComboBox;
+};
+
+#endif // KOSHAPEENDLINESDOCKER_H
+
Index: plugins/dockers/shapeendlines/KoEndLineShapeModel.cpp
===================================================================
--- plugins/dockers/shapeendlines/KoEndLineShapeModel.cpp (révision 0)
+++ plugins/dockers/shapeendlines/KoEndLineShapeModel.cpp (révision 0)
@@ -0,0 +1,65 @@
+/* This file is part of the KDE project
+ * Copyright (C) 2008 Alexia Allanic
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "KoEndLineShapeModel.h"
+
+KoEndLineShapeModel::KoEndLineShapeModel( QObject * parent )
+    : QAbstractListModel( parent )
+{
+
+}
+
+int KoEndLineShapeModel::rowCount( const QModelIndex &/*parent*/ ) const
+{
+  
+}
+
+QVariant KoEndLineShapeModel::data( const QModelIndex &index, int role ) const
+{
+       if (!index.isValid() || index.row() > m_shapeTemplateList.count ())
+        return QVariant();
+
+    switch(role)
+    {
+        //case Qt::ToolTipRole:
+          //  return m_shapeTemplateList[index.row()].toolTip;
+
+        case Qt::DecorationRole:
+            return m_shapeTemplateList[index.row()].icon;
+
+        case Qt::UserRole:
+            return m_shapeTemplateList[index.row()].id;
+
+      //  case Qt::UserRole + 1:
+        //    return m_shapeTemplateList[index.row()].properties;
+
+        case Qt::DisplayRole:
+            return m_shapeTemplateList[index.row()].name;
+
+        default:
+            return QVariant();
+    }
+
+    return QVariant();
+}
+void KoEndLineShapeModel::setShapeTemplateList(const QList<KoEndLineShape>& newlist)
+{
+    m_shapeTemplateList = newlist;
+    reset();
+}
\ No newline at end of file
Index: plugins/dockers/shapeendlines/KoEndLinesDockerFactory.cpp
===================================================================
--- plugins/dockers/shapeendlines/KoEndLinesDockerFactory.cpp (révision 0)
+++ plugins/dockers/shapeendlines/KoEndLinesDockerFactory.cpp (révision 0)
@@ -0,0 +1,43 @@
+/* This file is part of the KDE project
+   Copyright (C) 2008 Jan Hambrecht <jaham@...>
+
+   This library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public
+   License as published by the Free Software Foundation; either
+   version 2 of the License, or (at your option) any later version.
+
+   This library 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
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public License
+   along with this library; see the file COPYING.LIB.  If not, write to
+   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+*/
+
+#include "KoEndLinesDockerFactory.h"
+#include "KoShapeEndLinesDocker.h"
+
+KoEndLinesDockerFactory::KoEndLinesDockerFactory()
+{
+}
+
+QString KoEndLinesDockerFactory::id() const
+{
+    return QString("End Lines");
+}
+
+QDockWidget* KoEndLinesDockerFactory::createDockWidget()
+{
+    KoShapeEndLinesDocker* widget = new KoShapeEndLinesDocker();
+    widget->setObjectName(id());
+
+    return widget;
+}
+
+KoDockFactory::DockPosition KoEndLinesDockerFactory::defaultDockPosition() const
+{
+    return DockMinimized;
+}
Index: plugins/dockers/shapeendlines/pics/triangle.svg
===================================================================
--- plugins/dockers/shapeendlines/pics/triangle.svg (révision 0)
+++ plugins/dockers/shapeendlines/pics/triangle.svg (révision 0)
@@ -0,0 +1,12 @@
+<?xml version="1.0" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
+  "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
+<svg width="4cm" height="4cm" viewBox="0 0 400 400"
+     xmlns="http://www.w3.org/2000/svg">
+  <title>Exemple triangle01- exemple simple d'un 'path'</title>
+  <desc>Un tracé dessinant un triangle</desc>
+  <rect x="1" y="1" width="398" height="398"
+        fill="none" stroke="blue" />
+  <path d="M 100 100 L 300 100 L 200 300 z"
+        fill="black" stroke="black" stroke-width="3" />
+</svg>
Index: plugins/dockers/shapeendlines/pics/CMakeLists.txt
===================================================================
--- plugins/dockers/shapeendlines/pics/CMakeLists.txt (révision 0)
+++ plugins/dockers/shapeendlines/pics/CMakeLists.txt (révision 0)
@@ -0,0 +1,5 @@
+install( FILES
+         triangle.svg
+         DESTINATION ${DATA_INSTALL_DIR}/kpresenter/pics)
+
+kde4_install_icons( ${ICON_INSTALL_DIR}   )
\ No newline at end of file
Index: plugins/dockers/CMakeLists.txt
===================================================================
--- plugins/dockers/CMakeLists.txt (révision 1042019)
+++ plugins/dockers/CMakeLists.txt (copie de travail)
@@ -46,10 +46,15 @@
     linestyleselector/LineStyleModel.cpp
     linestyleselector/LineStyleSelector.cpp
 
+    shapeendlines/KoShapeEndLinesDocker.cpp
+    shapeendlines/KoEndLinesDockerFactory.cpp
+
     Plugin.cpp
 )
 
 add_subdirectory( strokedocker/pics )
+add_subdirectory( shapeendlines/pics )
+add_subdirectory( shapeendlines/endLineStyle )
 
 if (NOT NO_PIGMENT)
     set(kofficedockers_SRCS ${kofficedockers_SRCS}
Index: libs/flake/KoPathShape.h
===================================================================
--- libs/flake/KoPathShape.h (révision 1042019)
+++ libs/flake/KoPathShape.h (copie de travail)
@@ -28,8 +28,10 @@
 
 #include "KoShape.h"
 #include "KoPathSegment.h"
+#include "KoLineEnd.h"
 
 #define KoPathShapeId "KoPathShape"
+#define KoPathShapeEndLineSize 15
 
 class KoPathShape;
 class KoPathPoint;
@@ -429,6 +431,17 @@
      * @return the specific shape id
      */
     virtual QString pathShapeId() const;
+    /**
+     * @brief Add a line end at the begining of the path
+     * @param path the path in svg's d format attribute
+     */
+    void setBeginLineEnd(const KoLineEnd &path);
+    
+    /**
+     * @brief Add a line end at the ending of the path
+     * @param path the path in svg's d format attribute
+     */
+    void setEndLineEnd(const KoLineEnd &path);
 
     /// Returns a odf/svg string represenatation of the path data with the given matrix applied.
     QString toString(const QMatrix &matrix) const;
@@ -447,6 +460,10 @@
     KoPathShape(KoPathShapePrivate &);
 
 private:
+    KoLineEnd beginLineEnd;
+    KoLineEnd endLineEnd;
+
+
     // TODO move all the private methods to live on the d pointer object
     void map(const QMatrix &matrix);
 
Index: libs/flake/CMakeLists.txt
===================================================================
--- libs/flake/CMakeLists.txt (révision 1042019)
+++ libs/flake/CMakeLists.txt (copie de travail)
@@ -105,6 +105,7 @@
     KoFilterEffectRegistry.cpp
     KoFilterEffectConfigWidgetBase.cpp
     KoFilterEffectRenderContext.cpp
+ KoLineEnd.cpp
     commands/KoShapeGroupCommand.cpp
     commands/KoShapeAlignCommand.cpp
     commands/KoShapeBackgroundCommand.cpp
Index: libs/flake/KoPathShape.cpp
===================================================================
--- libs/flake/KoPathShape.cpp (révision 1042019)
+++ libs/flake/KoPathShape.cpp (copie de travail)
@@ -226,6 +226,26 @@
     QPainterPath path(outline());
     path.setFillRule(d->fillRule);
 
+    QPointF vector;
+    QMatrix matrix;
+    map(matrix);
+    KoPathPoint* point = m_subpaths.first()->first();
+    vector = KoLineEnd::computeAngle(point, matrix);
+    vector.setY(vector.y()*-1);
+    QLineF line(QPointF(0,0), vector);
+    float x = point->point().x()-KoPathShapeEndLineSize;
+    float y = point->point().y()-KoPathShapeEndLineSize;
+    endLineEnd.paint(painter, QRectF(QPointF(x, y), QSizeF(KoPathShapeEndLineSize, KoPathShapeEndLineSize)), ((int)line.angle()+180)%360);
+    
+    point = m_subpaths.last()->last();
+    vector = KoLineEnd::computeAngle(point, matrix);
+    vector.setY(vector.y()*-1);
+    line = QLineF(QPointF(0,0), vector);
+    x = point->point().x()-KoPathShapeEndLineSize;
+    y = point->point().y()-KoPathShapeEndLineSize;
+    beginLineEnd.paint(painter, QRectF(QPointF(x, y), QSizeF(KoPathShapeEndLineSize, KoPathShapeEndLineSize)), ((int)line.angle()+180)%360);
+
+
     if (background())
         background()->paint(painter, path);
     //paintDebug( painter );
@@ -1302,3 +1322,13 @@
 
     return outlinePath.contains(point);
 }
+
+void KoPathShape::setBeginLineEnd( const KoLineEnd &path )
+{
+    beginLineEnd = path;
+}
+
+void KoPathShape::setEndLineEnd( const KoLineEnd &path )
+{
+    endLineEnd = path;
+}

_______________________________________________
koffice-devel mailing list
koffice-devel@...
https://mail.kde.org/mailman/listinfo/koffice-devel

Re: end lines

by jos.van.den.oever :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Jérémy, can you put the message on the review board so that we may comment on
it more easily?

http://reviewboard.kde.org/
http://wiki.koffice.org/index.php?title=Contributing_a_Patch

Cheers,
Jos

--
Jos van den Oever, software architect
+49 391 25 19 15 53
http://kogmbh.com/legal/
_______________________________________________
koffice-devel mailing list
koffice-devel@...
https://mail.kde.org/mailman/listinfo/koffice-devel

Re: end lines

by Bugzilla from ervin@kde.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Friday 30 October 2009 15:56:51 Jos van den Oever wrote:
> Jérémy, can you put the message on the review board so that we may comment
>  on it more easily?
>
> http://reviewboard.kde.org/
> http://wiki.koffice.org/index.php?title=Contributing_a_Patch

AFAIK he tried that first but for some reasons didn't manage to get review
board accept it...

Regards.
--
Kévin Ottens, http://ervin.ipsquad.net

KDAB - proud patron of KDE, http://www.kdab.com


_______________________________________________
koffice-devel mailing list
koffice-devel@...
https://mail.kde.org/mailman/listinfo/koffice-devel

signature.asc (204 bytes) Download Attachment

Re: end lines

by jos.van.den.oever :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Friday 30 October 2009 05:45:09 pm Kevin Ottens wrote:
> AFAIK he tried that first but for some reasons didn't manage to get review
> board accept it...
This is a common problem which is explained on
  http://wiki.koffice.org/index.php?title=Contributing_a_Patch
The patch needs to be formatted.

Cheers,
Jos


--
Jos van den Oever, software architect
+49 391 25 19 15 53
http://kogmbh.com/legal/
_______________________________________________
koffice-devel mailing list
koffice-devel@...
https://mail.kde.org/mailman/listinfo/koffice-devel

Re: end lines

by Bugzilla from zander@kde.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks for these patches, as your mail was empty I'm going with the
assumption that you want a patch review :)
I read through your patch and noticed some issues, I'll write them below.
Some are issues that apply in general so I didn't specify all places where
its an issue, it would be good if you read through the patch to see what is
going on.

After you fixed these, please send us another patch for a second round :)
I don't have time today to actually apply the patch and test it, maybe
someone else can ? Otherwise it will be when your updated patch comes in.

ok, here some things;

I noticed your added your name to the copyright lines for at least one file
without an email address, please add your email too.

The patch shows one "\ No newline at end of file" Please add that line end.

In plugins/dockers/shapeendlines/KoEndLinesDockerFactory.h
How is it possible that a new file has only one copyright holder, Jan
Hambrechts, that is not you ?
The file has a comment that does not belong in this file, please add your own
copyright and change or remove the class-comment.

I see various kDebug() statements that do not have a section, they should
get an argument that makes it possible to turn off the debugs in the
kdebugdialog.

The new file plugins/dockers/shapeendlines/KoShapeEndLinesDocker.cpp
looks like its copied and modified.
Please make sure only required includes are there, I have the impression the
list is too long for this short file.
This seems to be the case for most new files, please check this for all new
files.

+void KoShapeEndLinesDocker::applyChanges()
+{
+    KoCanvasController* canvasController =
 KoToolManager::instance()->activeCanvasController();

Instead of using the singleton, please make the docker also inherit from
KoCanvasObserver

in libs/flake/KoPathShape.h you added #define KoPathShapeEndLineSize 15
since this header file is installed and used by everyone I'd like to know why
you added this define there.

in KoPathShape I see;
+    KoPathPoint* point = m_subpaths.first()->first();
you probably want to check that those 'first()' don't assert because there is
nothing there.

Also, new code in koffice/libs should follow the coding style;  
http://techbase.kde.org/Policies/Kdelibs_Coding_Style The above pasted line
should be adjusted. Please check your patch to conform to the style.

Thanks!
--
Thomas Zander
_______________________________________________
koffice-devel mailing list
koffice-devel@...
https://mail.kde.org/mailman/listinfo/koffice-devel

Re: end lines

by Jérémy Lugagne :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I didn't make all the docker, i worked on it somethink like two month after it was created so I'm working on line end draw and settings.

But I'll make the changes tomorrow's night or Monday.

Thank you for your comment and i'll try to send the patch again via the dashboard.

Regards,

Jeremy.
_______________________________________________
koffice-devel mailing list
koffice-devel@...
https://mail.kde.org/mailman/listinfo/koffice-devel

Re: end lines

by Jérémy Lugagne :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I'm doing the modifications and i don't understand this notice :

"+void KoShapeEndLinesDocker::
applyChanges()
+{
+    KoCanvasController* canvasController =
 KoToolManager::instance()->activeCanvasController();

Instead of using the singleton, please make the docker also inherit from
KoCanvasObserver."

And for the #define KoPathShapeEndLineSize 15 is to define the end line size. But i cant change it with a slider or combobox with some size in the docker.

Regards,

Jeremy


2009/10/31 Jérémy Lugagne <lugagne.jeremy@...>
Hi,

I didn't make all the docker, i worked on it somethink like two month after it was created so I'm working on line end draw and settings.

But I'll make the changes tomorrow's night or Monday.

Thank you for your comment and i'll try to send the patch again via the dashboard.

Regards,

Jeremy.


_______________________________________________
koffice-devel mailing list
koffice-devel@...
https://mail.kde.org/mailman/listinfo/koffice-devel

Re: end lines

by Bugzilla from jaham@gmx.net :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Jérémy...

On Monday 02 November 2009 14:21:21 Jérémy Lugagne wrote:

> Hi,
>
> I'm doing the modifications and i don't understand this notice :
>
> "+void KoShapeEndLinesDocker::
> applyChanges()
> +{
> +    KoCanvasController* canvasController =
>  KoToolManager::instance()->activeCanvasController();
>
> Instead of using the singleton, please make the docker also inherit from
> KoCanvasObserver."

There is an abstract interface class KoCanvasObserver which your docker is
already derived from (libs/flake/KoCanvasObserver.h). Then you automatically
get notified of canvas changes, i.e. the virtual function
setCanvas(KoCanvasBase*) gets called on your docker implementation.

>
> And for the #define KoPathShapeEndLineSize 15 is to define the end line
> size. But i cant change it with a slider or combobox with some size in the
> docker.

I think the size of the line end should a member of the KoLineEnd class (which
is entirely lissing from the patch btw). And i rather would like to have the
code which calculates the orientation of the line end in that class too, so
the path shape does not need to know about how the line end works. It only
should call a paint method on the line end class imho.

Ciao Jan
_______________________________________________
koffice-devel mailing list
koffice-devel@...
https://mail.kde.org/mailman/listinfo/koffice-devel