changeset 51:6afd9bcf7ef9

A few more modernizations... Get the ini file name from the __TARGET__ define. Remove some unneeded #defines. Give the functions a more neutral name.
author Brian Smith <brian@dbsoft.org>
date Mon, 09 Apr 2012 03:46:48 -0500
parents cd90dec5303d
children 2e1ea58a4692
files cc.c cc.h
diffstat 2 files changed, 8 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/cc.c	Fri Apr 06 05:53:17 2012 -0500
+++ b/cc.c	Mon Apr 09 03:46:48 2012 -0500
@@ -117,7 +117,7 @@
 	dw_window_set_pos_size(hwndFrame, x, y, width, height);
 }
 
-/* Write the logview.ini file with all of the current settings */
+/* Write the cc.ini file with all of the current settings */
 void saveconfig(void)
 {
 	FILE *f;
@@ -128,7 +128,7 @@
 
 	if(strcmp(INIDIR, ".") == 0)
 	{
-		inipath = strdup("cc.ini");
+		inipath = strdup(__TARGET__ ".ini");
 		inidir = strdup(INIDIR);
 	}
 	else
@@ -149,7 +149,7 @@
 			inidir = strdup(INIDIR);
 		}
 		strcat(inipath, DIRSEP);
-		strcat(inipath, "cc.ini");
+		strcat(inipath, __TARGET__ ".ini");
 	}
 
 	f=fopen(inipath, FOPEN_WRITE_TEXT);
@@ -220,7 +220,7 @@
 #define INI_BUFFER 256
 
 /* Generic function to parse information from a config file */
-void cc_getline(FILE *f, char *entry, char *entrydata)
+void ini_getline(FILE *f, char *entry, char *entrydata)
 {
 	char in[INI_BUFFER];
 	int z;
@@ -248,7 +248,7 @@
 	strcpy(entrydata, "");
 }
 
-/* Load the logview.ini file from disk setting all the necessary flags */
+/* Load the cc.ini file from disk setting all the necessary flags */
 void loadconfig(void)
 {
 	char *tmppath = INIDIR, *inipath, *home = dw_user_dir();
@@ -256,7 +256,7 @@
 	FILE *f;
 
 	if(strcmp(INIDIR, ".") == 0)
-		inipath = strdup("cc.ini");
+		inipath = strdup(__TARGET__ ".ini");
 	else
 	{
 		if(home && tmppath[0] == '~')
@@ -271,7 +271,7 @@
 			strcat(inipath, INIDIR);
 		}
 		strcat(inipath, DIRSEP);
-		strcat(inipath, "cc.ini");
+		strcat(inipath, __TARGET__ ".ini");
 	}
 
 	f = fopen(inipath, FOPEN_READ_TEXT);
@@ -286,7 +286,7 @@
 		{
 			int x = 0;
 			
-			cc_getline(f, entry, entrydata);
+			ini_getline(f, entry, entrydata);
 
 			/* Cycle through the possible settings */
 			while(Config[x].type)
--- a/cc.h	Fri Apr 06 05:53:17 2012 -0500
+++ b/cc.h	Mon Apr 09 03:46:48 2012 -0500
@@ -1,9 +1,5 @@
 #define MAIN_FRAME    155
 
-#define IDM_EXIT      200
-#define IDM_MINIMIZE  205
-#define IDM_PROP      231
-
 #define APP_NAME      "Control Center"
 
 #ifndef RESOURCE_IDS_ONLY