2 * @file SetScaleDialog.h
3 * Declares the SetScaleDialog class.
8 * Copyright 2012 Joel Baxter
10 * This file is part of MeshTex.
12 * MeshTex is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation, either version 2 of the License, or
15 * (at your option) any later version.
17 * MeshTex is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with MeshTex. If not, see <http://www.gnu.org/licenses/>.
26 #if !defined(INCLUDED_SETSCALEDIALOG_H)
27 #define INCLUDED_SETSCALEDIALOG_H
29 #include "GenericDialog.h"
30 #include "MeshVisitor.h"
33 * Subclass of GenericDialog that implements the window summoned by selecting
34 * the Set S/T Scale menu entry. This window is used to control the scaling
35 * of the S and/or T texture axes.
37 * @image html setscale.png
41 class SetScaleDialog : public GenericDialog
43 private: // private types
46 * Visitor for applying the chosen scaling to a mesh.
48 class SetScaleVisitor : public MeshVisitor
52 * Encapsulation of all the arguments that can affect either the S or T
53 * texture axis. See MeshEntity::SetScale for details of how these arguments
58 * Pointer to alignment slice description; if NULL, slice 0 is assumed.
60 const MeshEntity::SliceDesignation *alignSlice;
62 * Pointer to reference slice description, including how to use the reference;
63 * NULL if no reference.
65 const MeshEntity::RefSliceDescriptor *refSlice;
67 * true if naturalScaleOrTiles is a factor of the Radiant natural scale;
68 * false if naturalScaleOrTiles is a number of tiles.
72 * Scaling determinant, interpreted according to the naturalScale parameter.
77 SetScaleVisitor(const SliceArgs *rowArgs,
78 const SliceArgs *colArgs);
80 bool Execute(MeshEntity& meshEntity) const;
82 const SliceArgs *_rowArgs;
83 const SliceArgs *_colArgs;
86 public: // public methods
88 SetScaleDialog(const std::string& key);
91 void PopulateSWidgets(float scale,
93 void PopulateTWidgets(float scale,
96 private: // private methods
98 void PopulateEntry(const char *widgetName,
101 private: // private member vars
104 * Action-less mesh visitor used purely to count the number of selected mesh
107 SmartPointer<MeshVisitor> _nullVisitor;
110 #endif // #if !defined(INCLUDED_SETSCALEDIALOG_H)