]> Shamusworld >> Repos - ttedit/blobdiff - src/registry.cpp
Colorized Makefile. Whee!
[ttedit] / src / registry.cpp
index cbf3862727ff7f93fb487fe51aa2b0ec109a6403..576207acb3bbb5e6b500cfeea2718c1e39b75e37 100755 (executable)
@@ -1,94 +1,94 @@
-//\r
-// REGISTRY.CPP - Win32 support file\r
-// by James L. Hammons\r
-// (C) 2002 Underground Software\r
-//\r
-//   JLH = James Hammons <jlhamm@acm.org>\r
-//\r
-// Who  When        What\r
-// ---  ----------  ------------------------------------------------------------\r
-// JLH  05/16/2002  Created this file\r
-// JLH  12/10/2002  Updated InitINIFile to take a parameter so that you can open\r
-//                  an .INI file that doesn't belong to the current module\r
-//\r
-// STILL TO BE DONE:\r
-//\r
-// - Convert to wxWidgets...\r
-//\r
-\r
-#warning This file not yet converted to wxWidgets!!!\r
-\r
-#if 0\r
-#include <windows.h>\r
-#include "registry.h"\r
-\r
-// Local data\r
-\r
-static char INIPath[MAX_PATH];\r
-static char str[4096];\r
-\r
-//\r
-// Initialize the application .INI file\r
-// Returns TRUE if succesful, FALSE otherwise...\r
-//\r
-void InitINIFile(char * path/*= NULL*/)\r
-{\r
-       if (!GetModuleFileName(NULL, INIPath, MAX_PATH))\r
-               return;\r
-\r
-       if (path == NULL)\r
-       {\r
-               int len = lstrlen(INIPath);\r
-               lstrcpy(INIPath + len - 4, ".ini");\r
-       }\r
-       else\r
-       {\r
-               for(int i=lstrlen(INIPath); i>=0; i--)\r
-               {\r
-                       if (INIPath[i] == '\\')\r
-                       {\r
-                               lstrcpy(INIPath + i + 1, path);\r
-                               break;\r
-                       }\r
-               }\r
-       }\r
-}\r
-\r
-//\r
-// Write an int value to our .INI file\r
-//\r
-void SetINIInt(char * section, char * entry, int32 value)\r
-{\r
-       const char fmtStr[] = "%d";\r
-       char strVal[20];\r
-\r
-       wsprintf(strVal, fmtStr, value);\r
-       WritePrivateProfileString(section, entry, strVal, INIPath);\r
-}\r
-\r
-//\r
-// Write a string value to our .INI file\r
-//\r
-void SetINIString(char * section, char * entry, char * value)\r
-{\r
-       WritePrivateProfileString(section, entry, value, INIPath);\r
-}\r
-\r
-//\r
-// Get an int value from our .INI file\r
-//\r
-int32 GetINIInt(char * section, char * entry, int32 _default)\r
-{\r
-       return GetPrivateProfileInt(section, entry, _default, INIPath);\r
-}\r
-\r
-//\r
-// Get a string value from our .INI file\r
-//\r
-const char * GetINIString(char * section, char * entry, char * _default)\r
-{\r
-       GetPrivateProfileString(section, entry, _default, str, 4096, INIPath);\r
-\r
-       return str;\r
-}\r
-#endif\r
+//
+// REGISTRY.CPP - Win32 support file
+// by James L. Hammons
+// (C) 2002 Underground Software
+//
+//   JLH = James Hammons <jlhamm@acm.org>
+//
+// Who  When        What
+// ---  ----------  ------------------------------------------------------------
+// JLH  05/16/2002  Created this file
+// JLH  12/10/2002  Updated InitINIFile to take a parameter so that you can open
+//                  an .INI file that doesn't belong to the current module
+//
+// STILL TO BE DONE:
+//
+// - Convert to wxWidgets...
+//
+
+#warning This file not yet converted to wxWidgets!!!
+
+#if 0
+#include <windows.h>
+#include "registry.h"
+
+// Local data
+
+static char INIPath[MAX_PATH];
+static char str[4096];
+
+//
+// Initialize the application .INI file
+// Returns TRUE if succesful, FALSE otherwise...
+//
+void InitINIFile(char * path/*= NULL*/)
+{
+       if (!GetModuleFileName(NULL, INIPath, MAX_PATH))
+               return;
+
+       if (path == NULL)
+       {
+               int len = lstrlen(INIPath);
+               lstrcpy(INIPath + len - 4, ".ini");
+       }
+       else
+       {
+               for(int i=lstrlen(INIPath); i>=0; i--)
+               {
+                       if (INIPath[i] == '\\')
+                       {
+                               lstrcpy(INIPath + i + 1, path);
+                               break;
+                       }
+               }
+       }
+}
+
+//
+// Write an int value to our .INI file
+//
+void SetINIInt(char * section, char * entry, int32 value)
+{
+       const char fmtStr[] = "%d";
+       char strVal[20];
+
+       wsprintf(strVal, fmtStr, value);
+       WritePrivateProfileString(section, entry, strVal, INIPath);
+}
+
+//
+// Write a string value to our .INI file
+//
+void SetINIString(char * section, char * entry, char * value)
+{
+       WritePrivateProfileString(section, entry, value, INIPath);
+}
+
+//
+// Get an int value from our .INI file
+//
+int32 GetINIInt(char * section, char * entry, int32 _default)
+{
+       return GetPrivateProfileInt(section, entry, _default, INIPath);
+}
+
+//
+// Get a string value from our .INI file
+//
+const char * GetINIString(char * section, char * entry, char * _default)
+{
+       GetPrivateProfileString(section, entry, _default, str, 4096, INIPath);
+
+       return str;
+}
+#endif