source: tspsg/src/globals.h @ f1fb54b9f7

0.1.3.145-beta1-symbian0.1.4.170-beta2-bb10appveyorimgbotreadme
Last change on this file since f1fb54b9f7 was f1fb54b9f7, checked in by Oleksii Serdiuk, 14 years ago

+ Added the ability to generate fractional random numbers.
+ Added "Scroll to the end of solution output after solving" option.

  • Set the accuracy for fractional numbers on output to 2 decimail places.
  • Updated translations to reflect changes.
  • Property mode set to 100644
File size: 4.0 KB
RevLine 
[e0fcac5f2c]1/*!
2 * \file globals.h
3 * \author Copyright (C) 2007-2009 Lёppa <contacts[at]oleksii[dot]name>
[aecdf994f9]4 *
5 *  $Id$
6 *  $URL$
7 *
[e0fcac5f2c]8 * \brief Contains TSPSG global defines.
9 *
10 *  <b>TSPSG: TSP Solver and Generator</b>
11 *
[aecdf994f9]12 *  This file is part of TSPSG.
13 *
14 *  TSPSG is free software: you can redistribute it and/or modify
15 *  it under the terms of the GNU General Public License as published by
16 *  the Free Software Foundation, either version 3 of the License, or
17 *  (at your option) any later version.
18 *
19 *  TSPSG is distributed in the hope that it will be useful,
20 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
21 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22 *  GNU General Public License for more details.
23 *
24 *  You should have received a copy of the GNU General Public License
25 *  along with TSPSG.  If not, see <http://www.gnu.org/licenses/>.
26 */
27
[993d5af6f6]28#ifndef GLOBALS_H
29#define GLOBALS_H
[aecdf994f9]30
[993d5af6f6]31// INCLUDES
32#include <QtCore>
33#include <QtGui>
34
[430bd7f7e9]35// Version info
36#include "version.h"
[c10297cf73]37// OS and ARCH detection
[993d5af6f6]38#include "os.h"
39
40// DEFINES
[aecdf994f9]41// Default values
[bc1b8837b6]42//! Default minimum for random numbers generation
[aecdf994f9]43#define DEF_RAND_MIN 1
[bc1b8837b6]44//! Default maximum for random numbers generation
[aecdf994f9]45#define DEF_RAND_MAX 10
[bc1b8837b6]46//! Default number of cities
[aaf2113307]47#define DEF_NUM_CITIES 5
[f1fb54b9f7]48//! Default value for generating fractional random values
49#define DEF_FRACTIONAL_RANDOM false
[1fbf016a09]50//! Default value for showing or not solution step matrices
51#define DEF_SHOW_MATRIX true
52//! Default value for using or not city limit for showing solution steps matrices
53#define DEF_USE_SHOW_MATRIX_LIMIT true
54//! Default maximum number of cities to show solution step matrices
55#define DEF_SHOW_MATRIX_CITY_LIMIT 15
[f1fb54b9f7]56//! Default for scrolling to the end of output after solving
57#define DEF_SCROLL_TO_END true
[bc1b8837b6]58//! Default font name
[aecdf994f9]59#define DEF_FONT_FAMILY "Courier New"
[bc1b8837b6]60//! Default font size
[430bd7f7e9]61#define DEF_FONT_SIZE 10
[bc1b8837b6]62//! Default font color
[aecdf994f9]63#define DEF_FONT_COLOR Qt::black
64
[bc1b8837b6]65//! Maximum available number of cities
[1fbf016a09]66#define MAX_NUM_CITIES 50
[bc1b8837b6]67//! Maximum allowed value for random generation limits
[2fb523720a]68#define MAX_RAND_VALUE 1000
69
70// Paths
[bc1b8837b6]71/*!
72 * \def PATH_I18N
73 * \brief Bath to internationalization files.
74 */
75/*!
76 * \def PATH_DOCS
77 * \brief Bath to documentation files.
78 */
[2fb523720a]79#if defined(Q_OS_LINUX) || defined(Q_OS_UNIX)
80        #define PATH_I18N "/usr/share/tspsg/i18n"
81        #define PATH_DOCS "/usr/share/doc/tspsg"
82#else
83        #define PATH_I18N "i18n"
84        #define PATH_DOCS "help"
85#endif // Q_OS_LINUX
86
[85ad815b0b]87//! TSPSG Task file signature - letters \c TSPT
[993d5af6f6]88#define TSPT quint32(0x54535054)
[bc1b8837b6]89//! TSPSG Task file version
[993d5af6f6]90#define TSPT_VERSION quint8(1)
[bc1b8837b6]91//! TSPSG Task file metadata version
[993d5af6f6]92#define TSPT_META_VERSION quint8(1)
[bc1b8837b6]93//! TSPSG Task file metadata size in bytes (incl. version)
[993d5af6f6]94#define TSPT_META_SIZE 2
[85ad815b0b]95//! ZKomModRd Task file signature - letters \c ZK
[993d5af6f6]96#define ZKT quint16(0x5A4B)
[bc1b8837b6]97//! ZKomModRd Task file version
[993d5af6f6]98#define ZKT_VERSION quint8(1)
99
[85ad815b0b]100/*!
101 * \def INFINITY
102 * \brief This value means infinity :-)
103 *
104 *  Some libraries already have \c INFINITY defined.
105 *  We need to redefine it for the \c INFINITY to always have the same value.
106 */
[bc1b8837b6]107#ifdef INFINITY
108        #undef INFINITY
[5587b87fac]109#endif
[bc1b8837b6]110#define INFINITY 1.7E+308
111//! This string represents infinite value in the table
[430bd7f7e9]112#define INFSTR "---"
[5587b87fac]113
[f1fb54b9f7]114// FUNCTIONS
115/*!
116 * \brief Checks whether \a x contains an integer value
117 * \param x A value to check
118 * \return \c true if \a x countains an integer, oherwise \c false
119 */
120inline bool isInteger(double x)
121{
122double i;
123        return (modf(x, &i) == 0.0);
124}
125
[bc1b8837b6]126// Sanity checks
[2fb523720a]127// Check that default number of cities is sane (<= MAX_NUM_CITIES)
[aaf2113307]128#if DEF_NUM_CITIES > MAX_NUM_CITIES
129        #undef DEF_NUM_CITIES
130        #define DEF_NUM_CITIES MAX_NUM_CITIES
131#endif
[2fb523720a]132// Check that maximum for random generation is sane (<= MAX_RAND_VALUE)
133#if DEF_RAND_MAX > MAX_RAND_VALUE
134        #undef DEF_RAND_MAX
135        #define DEF_RAND_MAX MAX_RAND_VALUE
136#endif
137// Check that DEF_RAND_MIN <= DEF_RAND_MAX
138#if DEF_RAND_MIN > DEF_RAND_MAX
139        #undef DEF_RAND_MIN
140        #define DEF_RAND_MIN DEF_RAND_MAX
141#endif
[aaf2113307]142
[993d5af6f6]143#endif // GLOBALS_H
Note: See TracBrowser for help on using the repository browser.