[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    koffice/libs/flake [POSSIBLY UNSAFE]
From:       Boudewijn Rempt <boud () valdyas ! org>
Date:       2009-06-16 20:40:20
Message-ID: 1245184820.891371.7313.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 982813 by rempt:

Make flake indepenent of KoMain and KoGuiUtils

Some useful functionality that was completely flake-related
is now in flake itself, like the cup, copy and paste controllers.

In a next refactor, FlakeColor will go again :-(.

Note: I moved KoRTree from KoMain to flake, since it was used by
flake and kspread, and kspread uses flake anyway.

 M  +34 -4     CMakeLists.txt  
 A             FlakeColor.h   [License: LGPL (v2+)]
 M  +11 -11    KoCanvasController.cpp  
 M  +5 -1      KoCanvasController.h  
 A             KoCanvasObserverProvider.h   [License: LGPL (v2+)]
 M  +9 -9      KoCanvasResourceProvider.cpp  
 M  +15 -11    KoCanvasResourceProvider.h  
 A             KoCopyController.cpp   [License: LGPL (v2+)]
 A             KoCopyController.h   [License: LGPL (v2+)]
 A             KoCopyController_p.h   [License: LGPL (v2+)]
 A             KoCutController.cpp   [License: LGPL (v2+)]
 A             KoCutController.h   [License: LGPL (v2+)]
 A             KoDockFactory.h   [License: LGPL (v2+)]
 A             KoDockRegistry.cpp   [License: LGPL (v2+)]
 A             KoDockRegistry.h   [License: LGPL (v2+)]
 A             KoDpi.cpp   [License: LGPL (v2+)]
 A             KoDpi.h   KoShapePaste.h#982812 [License: LGPL (v2+)]
 M  +2 -2      KoDrag.cpp  
 A             KoGuidesData.cpp   [License: LGPL (v2+)]
 A             KoGuidesData.h   [License: LGPL (v2+)]
 A             KoPasteController.cpp   [License: LGPL (v2+)]
 A             KoPasteController.h   [License: LGPL (v2+)]
 A             KoPositionSelector.cpp   [License: LGPL (v2+)]
 A             KoPositionSelector.h   [License: LGPL (v2+)]
 A             KoRTree.h   [License: LGPL (v2+)]
 A             KoShapePainter.cpp   [License: LGPL (v2+)]
 A             KoShapePainter.h   [License: LGPL (v2+)]
 M  +0 -1      KoShapePaste.h  
 A             KoViewConverter.h   [POSSIBLY UNSAFE: system] [License: LGPL (v2+)]
 A             KoZoomHandler.cpp   [License: LGPL (v2+)]
 A             KoZoomHandler.h   [License: LGPL (v2+)]
 A             KoZoomMode.cpp   [License: LGPL (v2+)]
 A             KoZoomMode.h   [License: LGPL (v2+)]
 M  +7 -2      tools/KoCreatePathTool.cpp  


--- trunk/koffice/libs/flake/CMakeLists.txt #982812:982813
@@ -1,11 +1,14 @@
-include_directories( ${KDE4_INCLUDE_DIR} ${QT_INCLUDES} ${KOMAIN_INCLUDES} \
${PIGMENT_INCLUDES} ${OPENGL_INCLUDE_DIR}) +project(flake)
 
+include_directories( ${KDE4_INCLUDE_DIR} ${QT_INCLUDES} ${KOPROPERTIES_INCLUDES} \
${KOODF_INCLUDES} ${KOPICTURE_INCLUDES} +    ${CMAKE_SOURCE_DIR}/libs/koplugin
+)
+
 if(KDE4_BUILD_TESTS)
     # only with this definition will the FLAKE_TEST_EXPORT macro do something
     add_definitions(-DCOMPILING_TESTS)
 endif(KDE4_BUILD_TESTS)
 
-
 add_subdirectory(tests)
 add_subdirectory(pics)
 
@@ -13,9 +16,15 @@
     KoCanvasBase.cpp
     KoCanvasObserver.cpp
     KoCanvasResourceProvider.cpp
+    KoCutController.cpp
+    KoCopyController.cpp
+    KoDockRegistry.cpp
+    KoPasteController.cpp
+    KoGuidesData.cpp
     KoPathShape.cpp
     KoPathPoint.cpp
     KoPathSegment.cpp
+    KoPositionSelector.cpp
     KoSelection.cpp
     KoShape.cpp
     KoShapeContainer.cpp
@@ -23,6 +32,7 @@
     KoShapeGroup.cpp
     KoShapeManagerPaintingStrategy.cpp
     KoShapeManager.cpp
+    KoShapePainter.cpp
     KoFrameShape.cpp
     KoTool.cpp
     KoCanvasController.cpp
@@ -85,6 +95,9 @@
     KoImageData_p.cpp
     KoImageCollection.cpp
     KoOdfWorkaround.cpp
+    KoZoomHandler.cpp
+    KoZoomMode.cpp
+    KoDpi.cpp
     commands/KoShapeGroupCommand.cpp
     commands/KoShapeAlignCommand.cpp
     commands/KoShapeBackgroundCommand.cpp
@@ -161,9 +174,19 @@
 
 kde4_add_library(flake SHARED ${flake_SRCS})
 
-target_link_libraries(flake ${KDE4_KDEUI_LIBS} ${KDE4_KDE3SUPPORT_LIBS} pigmentcms)
-target_link_libraries(flake LINK_INTERFACE_LIBRARIES pigmentcms)
 
+if(HAVE_REQUIRED_LCMS_VERSION)
+	set(EXTRA_LIBS pigmentcms)
+endif(HAVE_REQUIRED_LCMS_VERSION)
+
+
+target_link_libraries(flake ${KDE4_KDEUI_LIBS}
+        			    ${KDE4_KDE3SUPPORT_LIBS} 
+                        ${EXTRA_LIBS}
+		        	    koodf kobase)
+
+target_link_libraries(flake LINK_INTERFACE_LIBRARIES ${EXTRA_LIBS} koodf kobase \
koplugin) +
 if(HAVE_OPENGL)
     target_link_libraries(flake ${OPENGL_LIBRARIES} ${QT_QTOPENGL_LIBRARY})
 endif(HAVE_OPENGL)
@@ -188,6 +211,7 @@
     KoDrag.h
     KoDragOdfSaveHelper.h
     KoFlake.h
+    KoGuidesData.h
     KoFrameShape.h
     KoImageCollection.h
     KoImageData.h
@@ -203,6 +227,7 @@
     KoShapeControllerBase.h
     KoShapeFactory.h
     KoShapeLayer.h
+    KoShapePainter.h
     KoShapeLoadingContext.h
     KoShapeOdfSaveHelper.h
     KoLoadingShapeUpdater.h
@@ -217,8 +242,13 @@
     KoToolFactory.h
     KoToolProxy.h
     KoToolRegistry.h
+    KoZoomHandler.h
+    KoZoomMode.h
+    KoDpi.h
     commands/KoShapeRenameCommand.h
+    KoViewConverter.h
     KoOdfWorkaround.h
+    KoRTree.h
     DESTINATION
     ${INCLUDE_INSTALL_DIR} COMPONENT Devel
 )
--- trunk/koffice/libs/flake/KoCanvasController.cpp #982812:982813
@@ -30,8 +30,7 @@
 #include "KoViewConverter.h"
 #include "KoCanvasBase.h"
 #include "KoCanvasObserver.h"
-#include <KoMainWindow.h>
-#include <KoView.h>
+#include "KoCanvasObserverProvider.h"
 #include "tools/KoGuidesTool.h"
 #include "KoToolManager.h"
 
@@ -408,13 +407,13 @@
 
 void KoCanvasController::setToolOptionWidgets(const QMap<QString, QWidget \
*>&widgetMap)  {
-    KoView *view=0;
+    QWidget *view=0;
     QWidget *w = this;
     while (w->parentWidget()) {
-        view = qobject_cast<KoView*>(w);
-        if(view) {
-            emit toolOptionWidgetsChanged(widgetMap, view);
-            return;
+        // XXX: This is an ugly hidden dependency
+        if (w->inherits( "KoView" )) {
+            emit toolOptionWidgetsChanged(widgetMap, w);
+            break;
         }
         w = w->parentWidget();
     }
@@ -633,14 +632,15 @@
     while (parent->parentWidget())
         parent = parent->parentWidget();
 
-    KoMainWindow *mw = dynamic_cast<KoMainWindow*>(parent);
-    if (! mw)
+    KoCanvasObserverProvider* observerProvider = \
dynamic_cast<KoCanvasObserverProvider*>(parent); +    if (!observerProvider)
         return;
 
-    foreach(QDockWidget *docker, mw->dockWidgets()) {
+    foreach(KoCanvasObserver *docker, observerProvider->canvasObservers()) {
         KoCanvasObserver *observer = dynamic_cast<KoCanvasObserver*>(docker);
-        if (observer)
+        if (observer) {
             observer->setCanvas(canvas());
+        }
     }
 }
 
--- trunk/koffice/libs/flake/KoCanvasController.h #982812:982813
@@ -162,6 +162,10 @@
     /**
      * will cause the toolOptionWidgetsChanged to be emitted and all
      * listeners to be updated to the new widget.
+     *
+     * FIXME: This doesn't belong her and it does an
+     * inherits("KoView") so it too much tied to komain
+     *
      * @param widget the widget
      */
     void setToolOptionWidgets(const QMap<QString, QWidget *> &);
@@ -289,7 +293,7 @@
     /**
      * Emit the new tool option widgets to be used with this canvas.
      */
-    void toolOptionWidgetsChanged(const QMap<QString, QWidget *> &, KoView *);
+    void toolOptionWidgetsChanged(const QMap<QString, QWidget *> &, QWidget *);
 
     /**
      * Emit the new tool option widgets to be used with this canvas.
--- trunk/koffice/libs/flake/KoCanvasResourceProvider.cpp #982812:982813
@@ -21,7 +21,7 @@
 #include "KoCanvasResourceProvider.h"
 
 #include <QVariant>
-#include <KoColor.h>
+
 #include "KoShape.h"
 #include "KoLineBorder.h"
 
@@ -66,7 +66,7 @@
         return d->resources.value(key);
 }
 
-void KoCanvasResourceProvider::setResource(int key, const KoColor & color)
+void KoCanvasResourceProvider::setResource(int key, const FlakeColor & color)
 {
     QVariant v;
     v.setValue(color);
@@ -87,35 +87,35 @@
     setResource(key, v);
 }
 
-KoColor KoCanvasResourceProvider::koColorResource(int key)
+FlakeColor KoCanvasResourceProvider::koColorResource(int key)
 {
     if (! d->resources.contains(key)) {
-        KoColor empty;
+        FlakeColor empty;
         return empty;
     }
-    return resource(key).value<KoColor>();
+    return resource(key).value<FlakeColor>();
 }
 
 
-void KoCanvasResourceProvider::setForegroundColor(const KoColor & color)
+void KoCanvasResourceProvider::setForegroundColor(const FlakeColor & color)
 {
     setResource(KoCanvasResource::ForegroundColor, color);
 }
 
-KoColor KoCanvasResourceProvider::foregroundColor()
+FlakeColor KoCanvasResourceProvider::foregroundColor()
 {
     return koColorResource(KoCanvasResource::ForegroundColor);
 }
 
 
-void KoCanvasResourceProvider::setBackgroundColor(const KoColor & color)
+void KoCanvasResourceProvider::setBackgroundColor(const FlakeColor & color)
 {
     //QVariant v;
     //v.setValue( color );
     setResource(KoCanvasResource::BackgroundColor, color);
 }
 
-KoColor KoCanvasResourceProvider::backgroundColor()
+FlakeColor KoCanvasResourceProvider::backgroundColor()
 {
     return koColorResource(KoCanvasResource::BackgroundColor);
 }
--- trunk/koffice/libs/flake/KoCanvasResourceProvider.h #982812:982813
@@ -29,7 +29,8 @@
 #include <KoID.h>
 #include "flake_export.h"
 
-class KoColor;
+#include "FlakeColor.h"
+
 class KoShape;
 class KoLineBorder;
 
@@ -93,12 +94,14 @@
      * @param value the new value for the key.
      */
     void setResource(int key, const QVariant & value);
+
     /**
-     * Set a resource of type KoColor.
+     * Set a resource of type FlakeColor.
      * @param key the integer key, based on KoCanvasResource::CanvasResource
      * @param color the new value for the key.
      */
-    void setResource(int key, const KoColor & color);
+    void setResource(int key, const FlakeColor & color);
+
     /**
      * Set a resource of type KoId.
      * @param key the integer key, based on KoCanvasResource::CanvasResource
@@ -123,21 +126,22 @@
      * Set the foregroundColor resource.
      * @param color the new foreground color
      */
-    void setForegroundColor(const KoColor & color);
+    void setForegroundColor(const FlakeColor & color);
+
     /**
      * Return the foregroundColor
      */
-    KoColor foregroundColor();
+    FlakeColor foregroundColor();
 
     /**
      * Set the backgroundColor resource.
      * @param color the new background color
      */
-    void setBackgroundColor(const KoColor & color);
+    void setBackgroundColor(const FlakeColor & color);
     /**
      * Return the backgroundColor
      */
-    KoColor backgroundColor();
+    FlakeColor backgroundColor();
 
     /**
      * Tools that provide a handle for controlling the content that the tool can \
edit can @@ -159,10 +163,10 @@
     
     /// Sets the border resource
     void setActiveBorder( const KoLineBorder &border );
-    
+
     /// Returns the border resource
     KoLineBorder activeBorder();
-    
+
     /**
      * Sets that the new unit of this canvas has changed
      * The actual unit can be obtained directly from the canvas
@@ -188,10 +192,10 @@
     qreal doubleResource(int key) const;
 
     /**
-     * Return the resource determined by param key as a KoColor.
+     * Return the resource determined by param key as a FlakeColor.
      * @param key the indentifying key for the resource.
      */
-    KoColor koColorResource(int key);
+    FlakeColor koColorResource(int key);
 
     /**
      * Return the resource determined by param key as a KoID.
--- trunk/koffice/libs/flake/KoDrag.cpp #982812:982813
@@ -32,7 +32,7 @@
 #include <KoGenStyles.h>
 #include <KoOdfWriteStore.h>
 #include <KoXmlWriter.h>
-#include <KoDocument.h>
+#include <KoOdfDocument.h>
 #include <KoEmbeddedDocumentSaver.h>
 #include "KoShapeSavingContext.h"
 
@@ -102,7 +102,7 @@
     }
 
     // Save embedded objects
-    KoDocument::SavingContext documentContext(odfStore, embeddedSaver);
+    KoOdfDocument::SavingContext documentContext(odfStore, embeddedSaver);
     if (!embeddedSaver.saveEmbeddedDocuments(documentContext)) {
         kDebug(30006) << "save embedded documents failed";
         return false;
--- trunk/koffice/libs/flake/KoShapePaste.h #982812:982813
@@ -23,7 +23,6 @@
 #include <KoOdfPaste.h>
 #include "flake_export.h"
 
-class KoDocument;
 class KoCanvasBase;
 class KoShapeContainer;
 
--- trunk/koffice/libs/flake/tools/KoCreatePathTool.cpp #982812:982813
@@ -33,10 +33,11 @@
 #include "KoShapeController.h"
 #include "KoCanvasResourceProvider.h"
 
-#include <KoColor.h>
-
 #include <QtGui/QPainter>
 
+#ifndef NO_PIGMENT
+#include <KoColor.h>
+#endif
 
 KoCreatePathTool::KoCreatePathTool(KoCanvasBase * canvas)
         : KoTool(canvas)
@@ -130,7 +131,11 @@
         m_shape = new KoPathShape();
         m_shape->setShapeId(KoPathShapeId);
         KoLineBorder * border = new \
KoLineBorder(m_canvas->resourceProvider()->activeBorder()); +#ifndef NO_PIGMENT
         border->setColor(m_canvas->resourceProvider()->foregroundColor().toQColor());
 +#else
+        border->setColor(m_canvas->resourceProvider()->foregroundColor());
+#endif
         m_shape->setBorder(border);
         m_canvas->updateCanvas(m_canvas->snapGuide()->boundingRect());
         const QPointF &point = m_canvas->snapGuide()->snap(event->point, \
event->modifiers());


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic