diff options
Diffstat (limited to 'app/bin/custom.c')
-rw-r--r-- | app/bin/custom.c | 142 |
1 files changed, 54 insertions, 88 deletions
diff --git a/app/bin/custom.c b/app/bin/custom.c index 68a996b..e53372f 100644 --- a/app/bin/custom.c +++ b/app/bin/custom.c @@ -1,6 +1,6 @@ #define RENAME_H /** \file custom.c - * + * */ /* XTrkCad - Model Railroad CAD @@ -18,33 +18,13 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include <stdlib.h> -#include <stdio.h> -#ifndef WINDOWS -#include <unistd.h> -#include <dirent.h> -#endif -#include <math.h> -#include <ctype.h> -#include <string.h> -#include <time.h> -#ifdef WINDOWS -#include <io.h> -#include <windows.h> -#else -#include <sys/stat.h> -#endif -#include <stdarg.h> -#include <errno.h> - #include "cjoin.h" #include "common.h" #include "custom.h" #include "fileio.h" -#include "i18n.h" #include "misc.h" #include "track.h" #include "version.h" @@ -81,6 +61,7 @@ char * sSaveFilePattern = NULL; char * sImageFilePattern = NULL; char * sImportFilePattern = NULL; char * sDXFFilePattern = NULL; +char * sSVGFilePattern = NULL; char * sRecordFilePattern = NULL; char * sNoteFilePattern = NULL; char * sLogFilePattern = NULL; @@ -91,7 +72,6 @@ int iParamVersion = PARAMVERSION; int iMinParamVersion = MINPARAMVERSION; long lParamKey = PARAMKEY; -extern char *userLocale; EXPORT char * MakeWindowTitle( char * name ) { @@ -106,18 +86,20 @@ void InitCmdEasement( void ) { easementP = EasementInit(); } -void DoEasementRedir( void ) +void DoEasementRedir( void * unused ) { - if (easementP) + if (easementP) { easementP(NULL); + } } #ifdef STRUCTDESIGNER static addButtonCallBack_t structDesignerP; void DoStructDesignerRedir( void ) { - if (structDesignerP) + if (structDesignerP) { structDesignerP(NULL); + } } #endif @@ -139,22 +121,22 @@ BOOL_T Initialize( void ) InitTrkStruct(); InitTrkText(); InitTrkDraw(); - + InitTrkBlock(); - InitTrkSwitchMotor(); - InitTrkSignal(); - InitTrkControl(); - InitTrkSensor(); + InitTrkSwitchMotor(); + InitTrkSignal(); + InitTrkControl(); + InitTrkSensor(); InitCarDlg(); InitCmdNote(); memset( message, 0, sizeof message ); - + return TRUE; } /** - * Initialize siome localized strings for filename patterns etc. + * Initialize siome localized strings for filename patterns etc. */ void InitCustom( void ) @@ -162,67 +144,61 @@ void InitCustom( void ) char *buf = malloc(1024); /* Initialize some localized strings */ - if (sTurnoutDesignerW == NULL) - { + if (sTurnoutDesignerW == NULL) { sprintf(buf, _("%s Turnout Designer"), Product); sTurnoutDesignerW = strdup(buf); } - if (sAboutProd == NULL) - { + if (sAboutProd == NULL) { sprintf(buf, _("%s Version %s"), Product, Version); sAboutProd = strdup(buf); } - if (sSourceFilePattern == NULL) - { + if (sSourceFilePattern == NULL) { sprintf(buf, _("All %s Files (*.xtc,*.xtce)|*.xtc;*.xtce|" - "%s Trackplan (*.xtc)|*.xtc|" - "%s Extended Trackplan (*.xtce)|*.xtce|" - "All Files (*)|*"), - Product, - Product, - Product ); + "%s Trackplan (*.xtc)|*.xtc|" + "%s Extended Trackplan (*.xtce)|*.xtce|" + "All Files (*)|*"), + Product, + Product, + Product ); sSourceFilePattern = strdup(buf); } - if (sSaveFilePattern == NULL) - { + if (sSaveFilePattern == NULL) { sprintf(buf, _("%s Trackplan (*.xtc)|*.xtc|" - "%s Extended Trackplan (*.xtce)|*.xtce|" - "All Files (*)|*"), - Product, - Product ); + "%s Extended Trackplan (*.xtce)|*.xtce|" + "All Files (*)|*"), + Product, + Product ); sSaveFilePattern = strdup(buf); } - if (sImageFilePattern == NULL) - { + if (sImageFilePattern == NULL) { sprintf(buf,_("All Files (*)|*")); sImageFilePattern = strdup(buf); } - if (sImportFilePattern == NULL) - { + if (sImportFilePattern == NULL) { sprintf(buf, _("%s Import Files (*.xti)|*.xti"), Product ); sImportFilePattern = strdup(buf); } - if (sDXFFilePattern == NULL) - { + if (sDXFFilePattern == NULL) { sDXFFilePattern = strdup(_("Data Exchange Format Files (*.dxf)|*.dxf")); } - if (sRecordFilePattern == NULL) - { + if (sSVGFilePattern == NULL) { + sSVGFilePattern = strdup( + _("Scalable Vector Graphics Format Files (*.svg)|*.svg" )); + } + + if (sRecordFilePattern == NULL) { sprintf(buf, _("%s Record Files (*.xtr)|*.xtr"), Product); sRecordFilePattern = strdup(buf); } - if (sNoteFilePattern == NULL) - { + if (sNoteFilePattern == NULL) { sprintf(buf, _("%s Note Files (*.not)|*.not"), Product); sNoteFilePattern = strdup(buf); } - if (sLogFilePattern == NULL) - { + if (sLogFilePattern == NULL) { sprintf(buf, _("%s Log Files (*.log)|*.log"), Product); sLogFilePattern = strdup(buf); } - if (sPartsListFilePattern == NULL) - { + if (sPartsListFilePattern == NULL) { sprintf(buf, _("%s PartsList Files (*.txt)|*.txt"), Product); sPartsListFilePattern = strdup(buf); } @@ -234,54 +210,44 @@ void InitCustom( void ) void CleanupCustom( void ) { /* Free dynamically allocated strings */ - if (sTurnoutDesignerW) - { + if (sTurnoutDesignerW) { free(sTurnoutDesignerW); sTurnoutDesignerW = NULL; } - if (sAboutProd) - { + if (sAboutProd) { free(sAboutProd); sAboutProd = NULL; } - if (sSourceFilePattern) - { + if (sSourceFilePattern) { free(sSourceFilePattern); sSourceFilePattern = NULL; } - if (sImportFilePattern) - { + if (sImportFilePattern) { free(sImportFilePattern); sImportFilePattern = NULL; } - if (sDXFFilePattern) - { + if (sDXFFilePattern) { free(sDXFFilePattern); sDXFFilePattern = NULL; } - if (sRecordFilePattern) - { + if (sSVGFilePattern) { + free(sSVGFilePattern); + sSVGFilePattern = NULL; + } + if (sRecordFilePattern) { free(sRecordFilePattern); sRecordFilePattern = NULL; } - if (sNoteFilePattern) - { + if (sNoteFilePattern) { free(sNoteFilePattern); sNoteFilePattern = NULL; } - if (sLogFilePattern) - { + if (sLogFilePattern) { free(sLogFilePattern); sLogFilePattern = NULL; } - if (sPartsListFilePattern) - { + if (sPartsListFilePattern) { free(sPartsListFilePattern); sPartsListFilePattern = NULL; } - if (userLocale) - { - free(userLocale); - userLocale = NULL; - } } |