[21] | 1 | /* |
---|
[42] | 2 | * TSPSG: TSP Solver and Generator |
---|
[22] | 3 | * Copyright (C) 2007-2009 Lёppa <contacts[at]oleksii[dot]name> |
---|
[21] | 4 | * |
---|
| 5 | * $Id: globals.h 64 2009-10-20 09:40:16Z laleppa $ |
---|
| 6 | * $URL: https://tspsg.svn.sourceforge.net/svnroot/tspsg/trunk/src/globals.h $ |
---|
| 7 | * |
---|
| 8 | * This file is part of TSPSG. |
---|
| 9 | * |
---|
| 10 | * TSPSG is free software: you can redistribute it and/or modify |
---|
| 11 | * it under the terms of the GNU General Public License as published by |
---|
| 12 | * the Free Software Foundation, either version 3 of the License, or |
---|
| 13 | * (at your option) any later version. |
---|
| 14 | * |
---|
| 15 | * TSPSG is distributed in the hope that it will be useful, |
---|
| 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 18 | * GNU General Public License for more details. |
---|
| 19 | * |
---|
| 20 | * You should have received a copy of the GNU General Public License |
---|
| 21 | * along with TSPSG. If not, see <http://www.gnu.org/licenses/>. |
---|
| 22 | */ |
---|
| 23 | |
---|
[31] | 24 | #ifndef GLOBALS_H |
---|
| 25 | #define GLOBALS_H |
---|
[21] | 26 | |
---|
[64] | 27 | /*! |
---|
| 28 | * \file globals.h |
---|
| 29 | * \brief This file contains TSPSG global defines. |
---|
| 30 | */ |
---|
| 31 | |
---|
[31] | 32 | // INCLUDES |
---|
| 33 | #include <QtCore> |
---|
| 34 | #include <QtGui> |
---|
| 35 | |
---|
[42] | 36 | // Version info |
---|
| 37 | #include "version.h" |
---|
[54] | 38 | // OS and ARCH detection |
---|
[31] | 39 | #include "os.h" |
---|
| 40 | |
---|
| 41 | // DEFINES |
---|
[21] | 42 | // Default values |
---|
[64] | 43 | //! Default minimum for random numbers generation |
---|
[21] | 44 | #define DEF_RAND_MIN 1 |
---|
[64] | 45 | //! Default maximum for random numbers generation |
---|
[21] | 46 | #define DEF_RAND_MAX 10 |
---|
[64] | 47 | //! Default number of cities |
---|
[50] | 48 | #define DEF_NUM_CITIES 5 |
---|
[64] | 49 | //! Default font name |
---|
[21] | 50 | #define DEF_FONT_FAMILY "Courier New" |
---|
[64] | 51 | //! Default font size |
---|
[42] | 52 | #define DEF_FONT_SIZE 10 |
---|
[64] | 53 | //! Default font color |
---|
[21] | 54 | #define DEF_FONT_COLOR Qt::black |
---|
| 55 | |
---|
[64] | 56 | //! Maximum available number of cities |
---|
[57] | 57 | #define MAX_NUM_CITIES 30 |
---|
[64] | 58 | //! Maximum allowed value for random generation limits |
---|
[57] | 59 | #define MAX_RAND_VALUE 1000 |
---|
| 60 | |
---|
| 61 | // Paths |
---|
[64] | 62 | /*! |
---|
| 63 | * \def PATH_I18N |
---|
| 64 | * \brief Bath to internationalization files. |
---|
| 65 | */ |
---|
| 66 | /*! |
---|
| 67 | * \def PATH_DOCS |
---|
| 68 | * \brief Bath to documentation files. |
---|
| 69 | */ |
---|
[57] | 70 | #if defined(Q_OS_LINUX) || defined(Q_OS_UNIX) |
---|
| 71 | #define PATH_I18N "/usr/share/tspsg/i18n" |
---|
| 72 | #define PATH_DOCS "/usr/share/doc/tspsg" |
---|
| 73 | #else |
---|
| 74 | #define PATH_I18N "i18n" |
---|
| 75 | #define PATH_DOCS "help" |
---|
| 76 | #endif // Q_OS_LINUX |
---|
| 77 | |
---|
[64] | 78 | //! TSPSG Task file signature - letters \p TSPT |
---|
[31] | 79 | #define TSPT quint32(0x54535054) |
---|
[64] | 80 | //! TSPSG Task file version |
---|
[31] | 81 | #define TSPT_VERSION quint8(1) |
---|
[64] | 82 | //! TSPSG Task file metadata version |
---|
[31] | 83 | #define TSPT_META_VERSION quint8(1) |
---|
[64] | 84 | //! TSPSG Task file metadata size in bytes (incl. version) |
---|
[31] | 85 | #define TSPT_META_SIZE 2 |
---|
[64] | 86 | //! ZKomModRd Task file signature - letters \p ZK |
---|
[31] | 87 | #define ZKT quint16(0x5A4B) |
---|
[64] | 88 | //! ZKomModRd Task file version |
---|
[31] | 89 | #define ZKT_VERSION quint8(1) |
---|
| 90 | |
---|
[64] | 91 | // Some libraries already have INFINITY defined. |
---|
| 92 | // We need to undefine it for INFINITY to have always the same value. |
---|
| 93 | #ifdef INFINITY |
---|
| 94 | #undef INFINITY |
---|
[27] | 95 | #endif |
---|
[64] | 96 | //! This value means infinity :-) |
---|
| 97 | #define INFINITY 1.7E+308 |
---|
| 98 | //! This string represents infinite value in the table |
---|
[42] | 99 | #define INFSTR "---" |
---|
[27] | 100 | |
---|
[64] | 101 | // Sanity checks |
---|
[57] | 102 | // Check that default number of cities is sane (<= MAX_NUM_CITIES) |
---|
[50] | 103 | #if DEF_NUM_CITIES > MAX_NUM_CITIES |
---|
| 104 | #undef DEF_NUM_CITIES |
---|
| 105 | #define DEF_NUM_CITIES MAX_NUM_CITIES |
---|
| 106 | #endif |
---|
[57] | 107 | // Check that maximum for random generation is sane (<= MAX_RAND_VALUE) |
---|
| 108 | #if DEF_RAND_MAX > MAX_RAND_VALUE |
---|
| 109 | #undef DEF_RAND_MAX |
---|
| 110 | #define DEF_RAND_MAX MAX_RAND_VALUE |
---|
| 111 | #endif |
---|
| 112 | // Check that DEF_RAND_MIN <= DEF_RAND_MAX |
---|
| 113 | #if DEF_RAND_MIN > DEF_RAND_MAX |
---|
| 114 | #undef DEF_RAND_MIN |
---|
| 115 | #define DEF_RAND_MIN DEF_RAND_MAX |
---|
| 116 | #endif |
---|
[50] | 117 | |
---|
[31] | 118 | #endif // GLOBALS_H |
---|