src/misc.h

changeset 487
a350c4b25133
parent 473
2a84149fe642
child 493
16766ac1bbd9
equal deleted inserted replaced
443:a70dd25dd4bb 487:a350c4b25133
1 /* 1 /*
2 * LDForge: LDraw parts authoring CAD 2 * LDForge: LDraw parts authoring CAD
3 * Copyright (C) 2013 Santeri Piippo 3 * Copyright (C) 2013 Santeri Piippo
4 * 4 *
5 * This program is free software: you can redistribute it and/or modify 5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by 6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or 7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version. 8 * (at your option) any later version.
9 * 9 *
10 * This program is distributed in the hope that it will be useful, 10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details. 13 * GNU General Public License for more details.
14 * 14 *
15 * You should have received a copy of the GNU General Public License 15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>. 16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */ 17 */
18 18
19 #ifndef MISC_H 19 #ifndef MISC_H
45 str join (initlist<StringFormatArg> vals, str delim = " "); 45 str join (initlist<StringFormatArg> vals, str delim = " ");
46 46
47 // Grid stuff 47 // Grid stuff
48 typedef struct { 48 typedef struct {
49 const char* const name; 49 const char* const name;
50 floatconfig* const confs[4]; 50 FloatConfig* const confs[4];
51 } gridinfo; 51 } gridinfo;
52 52
53 extern_cfg (int, grid); 53 extern_cfg (Int, grid);
54 static const short g_NumGrids = 3; 54 static const short g_NumGrids = 3;
55 extern const gridinfo g_GridInfo[3]; 55 extern const gridinfo g_GridInfo[3];
56 56
57 inline const gridinfo& currentGrid() { 57 inline const gridinfo& currentGrid() {
58 return g_GridInfo[grid]; 58 return g_GridInfo[grid];
92 Z, 92 Z,
93 Angle 93 Angle
94 }; 94 };
95 95
96 double snap (double value, const Grid::Config axis); 96 double snap (double value, const Grid::Config axis);
97 }; 97 }
98 98
99 // ============================================================================= 99 // =============================================================================
100 template<class T> void dataswap (T& a, T& b) { 100 template<class T> void dataswap (T& a, T& b) {
101 T c = a; 101 T c = a;
102 a = b; 102 a = b;

mercurial