~openmw/openmw/openmw-packaging2

« back to all changes in this revision

Viewing changes to apps/opencs/view/render/worldspacewidget.hpp

  • Committer: Scott Howard
  • Date: 2016-04-16 07:00:56 UTC
  • Revision ID: showard@debian.org-20160416070056-v6l5thn424is72s4
Cron update. Git hash: 1f7a547

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#ifndef OPENCS_VIEW_WORLDSPACEWIDGET_H
2
2
#define OPENCS_VIEW_WORLDSPACEWIDGET_H
3
3
 
4
 
#include <map>
5
 
 
6
4
#include <boost/shared_ptr.hpp>
7
5
 
8
6
#include <QTimer>
11
9
#include "../../model/world/tablemimedata.hpp"
12
10
 
13
11
#include "scenewidget.hpp"
14
 
#include "elements.hpp"
 
12
#include "mask.hpp"
15
13
 
16
14
namespace CSMPrefs
17
15
{
35
33
{
36
34
    class TagBase;
37
35
    class CellArrow;
 
36
    class EditMode;
38
37
 
39
38
    class WorldspaceWidget : public SceneWidget
40
39
    {
44
43
            CSVWidget::SceneToolRun *mRun;
45
44
            CSMDoc::Document& mDocument;
46
45
            unsigned int mInteractionMask;
47
 
            std::map<std::pair<Qt::MouseButton, bool>, std::string> mButtonMapping;
48
46
            CSVWidget::SceneToolMode *mEditMode;
49
47
            bool mLocked;
50
48
            std::string mDragMode;
99
97
 
100
98
            void selectDefaultNavigationMode();
101
99
 
 
100
            void centerOrbitCameraOnSelection();
 
101
 
102
102
            static DropType getDropType(const std::vector<CSMWorld::UniversalId>& data);
103
103
 
104
104
            virtual dropRequirments getDropRequirements(DropType type) const;
127
127
            /// \param elementMask Elements to be affected by the clear operation
128
128
            virtual void clearSelection (int elementMask) = 0;
129
129
 
 
130
            /// \param elementMask Elements to be affected by the select operation
 
131
            virtual void selectAll (int elementMask) = 0;
 
132
 
 
133
            // Select everything that references the same ID as at least one of the elements
 
134
            // already selected
 
135
            //
 
136
            /// \param elementMask Elements to be affected by the select operation
 
137
            virtual void selectAllWithSameParentId (int elementMask) = 0;
 
138
 
 
139
            /// Return the next intersection point with scene elements matched by
 
140
            /// \a interactionMask based on \a localPos and the camera vector.
 
141
            /// If there is no such point, instead a point "in front" of \a localPos will be
 
142
            /// returned.
 
143
            ///
 
144
            /// \param ignoreHidden ignore elements specified in interactionMask that are
 
145
            /// flagged as not visible.
 
146
            osg::Vec3f getIntersectionPoint (const QPoint& localPos,
 
147
                unsigned int interactionMask = Mask_Reference | Mask_Terrain,
 
148
                bool ignoreHidden = false) const;
 
149
 
 
150
            virtual std::string getCellId (const osg::Vec3f& point) const = 0;
 
151
 
 
152
            virtual std::vector<osg::ref_ptr<TagBase> > getSelection (unsigned int elementMask)
 
153
                const = 0;
 
154
 
 
155
            virtual std::vector<osg::ref_ptr<TagBase> > getEdited (unsigned int elementMask)
 
156
                const = 0;
 
157
 
 
158
            virtual void setSubMode (int subMode, unsigned int elementMask) = 0;
 
159
 
 
160
            /// Erase all overrides and restore the visual representation to its true state.
 
161
            virtual void reset (unsigned int elementMask) = 0;
 
162
 
 
163
            /// \note Drags will be automatically aborted when the aborting is triggered
 
164
            /// (either explicitly or implicitly) from within this class. This function only
 
165
            /// needs to be called, when the drag abort is triggered externally (e.g. from
 
166
            /// an edit mode).
 
167
            void abortDrag();
 
168
 
130
169
        protected:
131
170
 
 
171
            /// Visual elements in a scene
 
172
            /// @note do not change the enumeration values, they are used in pre-existing button file names!
 
173
            enum ButtonId
 
174
            {
 
175
                Button_Reference = 0x1,
 
176
                Button_Pathgrid = 0x2,
 
177
                Button_Water = 0x4,
 
178
                Button_Fog = 0x8,
 
179
                Button_Terrain = 0x10
 
180
            };
 
181
 
132
182
            virtual void addVisibilitySelectorButtons (CSVWidget::SceneToolToggle2 *tool);
133
183
 
134
184
            virtual void addEditModeSelectorButtons (CSVWidget::SceneToolMode *tool);
138
188
            virtual void mouseMoveEvent (QMouseEvent *event);
139
189
            virtual void mousePressEvent (QMouseEvent *event);
140
190
            virtual void mouseReleaseEvent (QMouseEvent *event);
141
 
            virtual void mouseDoubleClickEvent (QMouseEvent *event);
142
191
            virtual void wheelEvent (QWheelEvent *event);
143
192
            virtual void keyPressEvent (QKeyEvent *event);
144
193
 
145
194
            virtual void handleMouseClick (osg::ref_ptr<TagBase> tag, const std::string& button,
146
195
                bool shift);
147
196
 
 
197
             /// \return Is \a key a button mapping setting? (ignored otherwise)
 
198
            virtual bool storeMappingSetting (const CSMPrefs::Setting *setting);
 
199
 
 
200
            virtual void settingChanged (const CSMPrefs::Setting *setting);
 
201
 
 
202
            EditMode *getEditMode();
 
203
 
148
204
        private:
149
205
 
150
206
            void dragEnterEvent(QDragEnterEvent *event);
153
209
 
154
210
            void dragMoveEvent(QDragMoveEvent *event);
155
211
 
156
 
            /// \return Is \a key a button mapping setting? (ignored otherwise)
157
 
            bool storeMappingSetting (const CSMPrefs::Setting *setting);
158
 
 
159
212
            osg::ref_ptr<TagBase> mousePick (const QPoint& localPos);
160
213
 
161
 
            std::string mapButton (QMouseEvent *event);
162
 
 
163
214
            virtual std::string getStartupInstruction() = 0;
164
215
 
165
216
        private slots:
166
217
 
167
 
            void settingChanged (const CSMPrefs::Setting *setting);
168
 
 
169
 
            void selectNavigationMode (const std::string& mode);
170
 
 
171
218
            virtual void referenceableDataChanged (const QModelIndex& topLeft,
172
219
                const QModelIndex& bottomRight) = 0;
173
220