File indexing completed on 2024-05-05 04:03:27

0001 /***************************************************************************
0002                                cmappluginstandard.h
0003                              -------------------
0004     begin                : Mon Aug 6 2001
0005     copyright            : (C) 2001 by Kmud Developer Team
0006     email                : kmud-devel@kmud.de
0007  ***************************************************************************/
0008 
0009 /***************************************************************************
0010  *                                                                         *
0011  *   This program is free software; you can redistribute it and/or modify  *
0012  *   it under the terms of the GNU General Public License as published by  *
0013  *   the Free Software Foundation; either version 2 of the License, or     *
0014  *   (at your option) any later version.                                   *
0015  *                                                                         *
0016  ***************************************************************************/
0017 
0018 #ifndef CMAPPLUGINSTANDARD_H
0019 #define CMAPPLUGINSTANDARD_H
0020 
0021 #include <QMap>
0022 #include <list>
0023 
0024 #include "../../cmappluginbase.h"
0025 
0026 class CMapManager;
0027 
0028 /**This plugin provides the standard mapper tools and views
0029   *@author Kmud Developer Team
0030   */
0031 
0032 class CMapPluginStandard : public CMapPluginBase
0033 {
0034    Q_OBJECT
0035 public: 
0036     CMapPluginStandard(QObject *);
0037     ~CMapPluginStandard() override;
0038 
0039         QString tagName() override { return QString("standard"); }
0040 
0041     QList<CMapPropertiesPaneBase *> createPropertyPanes(elementTyp type,CMapElement *element,QWidget *parent) override;
0042 
0043     void profileChanged(void) override;
0044     /** This is called before a element is deleted
0045       * @param element The element about to be deleted */
0046     void beforeElementDeleted(CMapElement *element) override;
0047     /** This method is called after undoing a delete action
0048       * @param element The elemening being restored */
0049     void afterElementUndeleted(CMapElement *element) override;
0050     /**
0051      * This method is used to add a note or change a exsiting note
0052      * @param elemenet The element the note is for
0053      * @param note The next of the note
0054      */
0055     void addNote(CMapElement *element,QString note);
0056 
0057     /** This method is used to remove a note
0058       * @param element The note to remove
0059       */
0060     void removeNote(CMapElement *element);
0061     
0062     /**
0063      * This method is used to get a note for the given element
0064      * @param element The element to get the note of
0065      * @return The note or empty string if there is no note
0066      */
0067     QString getNote(CMapElement *element);
0068 
0069     /** This method is used to get a list of new properties for a element
0070       * It will usally be called when saving map data to file
0071       * @param element The element being saved
0072       * @param properties When method exits this should contain the new properties
0073       */
0074     void saveElementProperties(CMapElement *element,KMemConfig *properties) override;
0075 
0076     /** This method is used to update an element with the properties load from a file
0077       * It will usally be called when loading map data to file
0078       * @param element The element being loaded
0079       * @param properties The properties being loaded from the file
0080       */
0081     void loadElementProperties(CMapElement *element,KMemConfig *properties) override;
0082 
0083     /**
0084      * This is called when the map is about to be loaded from file
0085      */
0086     void loadAboutToStart() override;
0087 
0088     /**
0089      * This is called when the map is about to be saved to file
0090      */
0091     void saveAboutToStart(void) override;
0092 
0093     /**
0094      * This is called when a new map is created
0095      */
0096     void newMapCreated(void) override;
0097 
0098 
0099 private:
0100     struct DeletedElement
0101     {
0102         int type;
0103         int id;
0104         int level;
0105         QString note;
0106     };
0107 
0108     typedef std::list<DeletedElement> DeletedElementList;
0109 
0110     DeletedElementList::iterator findRoom(int level,int id,bool *found);
0111     DeletedElementList::iterator findZone(int id,bool *found);  
0112     
0113 private:
0114   QMap<CMapElement *, QString> m_noteList;
0115   DeletedElementList m_deletedElements;
0116 };
0117 
0118 #endif