Developer forums (C::B DEVELOPMENT STRICTLY!) > Development
I make a patch for portable CB, only for Win32
(1/1)
Loaden:
--- Code: ---Index: src/src/app.cpp
===================================================================
--- src/src/app.cpp (revision 6193)
+++ src/src/app.cpp (working copy)
@@ -43,6 +43,10 @@
#include <sqplus.h>
+#ifdef __WXMSW__
+#include "portable.h"
+#endif
+
#ifndef __WXMSW__
#include "prefix.h" // binreloc
#endif
Index: src/src/portable.h
===================================================================
--- src/src/portable.h (revision 0)
+++ src/src/portable.h (revision 0)
@@ -0,0 +1,42 @@
+#ifndef QP_PORTABLE_H_
+#define QP_PORTABLE_H_
+
+namespace qp
+{
+
+class Portable
+{
+public:
+ Portable()
+ {
+ wxSetEnv(_T("APPDATA"), wxGetApp().GetAppPath() + _T("\\config"));
+ SupportTempFonts();
+ }
+
+ ~Portable()
+ {
+ SupportTempFonts(false);
+ }
+
+private:
+ void SupportTempFonts(bool enable = true)
+ {
+ wxString path = wxGetApp().GetAppPath() + _T("\\config\\fonts");
+ if (wxDir::Exists(path))
+ {
+ wxString font = wxFindFirstFile(path + _T("\\*.ttf"));
+ while (!font.IsEmpty())
+ {
+ if (enable) ::AddFontResource(font);
+ else ::RemoveFontResource(font);
+ font = wxFindNextFile();
+ }
+ ::SendMessage(HWND_BROADCAST, WM_FONTCHANGE, 0, 0);
+ }
+ }
+};
+
+static Portable portable;
+
+} // namespace qp
+#endif // QP_PORTABLE_H_
--- End code ---
[attachment deleted by admin]
MortenMacFly:
--- Quote from: Loaden on March 20, 2010, 03:55:01 am ---
--- Code: ---Index: src/src/app.cpp
+ wxSetEnv(_T("APPDATA"), wxGetApp().GetAppPath() + _T("\\config"));
+ SupportTempFonts();
--- End code ---
--- End quote ---
I am sorry, but I disagree on that one. Because modifying APPDATA has serious bad side effects. Like: Every tool you run from within C::B will save it's settings into the C::B folder, too. Sorry, but this is not acceptable. Code::Blocks is portable just fine I don't see a need to do this. Also the font handling can be done without modifying APPDATA.
Navigation
[0] Message Index
Go to full version