OSDN Git Service

グローバル変数の整理。
authorsirakaba <sirakaba@9df91469-1e22-0410-86e7-ea8537beb833>
Sat, 3 Oct 2009 07:37:50 +0000 (07:37 +0000)
committersirakaba <sirakaba@9df91469-1e22-0410-86e7-ea8537beb833>
Sat, 3 Oct 2009 07:37:50 +0000 (07:37 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/tpi/tpi@16 9df91469-1e22-0410-86e7-ea8537beb833

src/frontend/dlg_process.cpp
src/frontend/dlg_process.h
src/plugin/calLibrary/calLibrary.cpp
src/plugin/cuiWrapper/cuiWrapper.cpp

index 02e0497..763f841 100644 (file)
@@ -22,7 +22,6 @@
 #include "frontend.h"\r
 #include "dlg_process.h"\r
 \r
-bool g_fCancel = false;\r
 ProcessDialog * g_procDlg = NULL;\r
 \r
 //******************************************************************************\r
@@ -36,7 +35,7 @@ ProcessDialog::ProcessDialog(): wxDialog()
 ProcessDialog::~ProcessDialog()\r
 {\r
        g_procDlg = NULL;\r
-       g_fCancel = false;\r
+       this->fCancel = false;\r
 }\r
 \r
 //******************************************************************************\r
@@ -58,6 +57,7 @@ void ProcessDialog::OnInit(wxInitDialogEvent &)
        this->ebSource          = XRCCTRL(* this, "ebSource",     wxTextCtrl);\r
        this->ebTarget          = XRCCTRL(* this, "ebTarget",     wxTextCtrl);\r
        this->gauge             = XRCCTRL(* this, "gauge",        wxGauge);\r
+       this->fCancel           = false;\r
        g_procDlg = this;\r
 \r
        ::wxXmlResource::Get()->Unload(FE_DIR_S_XRC wxT("dlg_process.xrc"));\r
@@ -65,7 +65,7 @@ void ProcessDialog::OnInit(wxInitDialogEvent &)
 \r
 void ProcessDialog::OnBtnCancel(wxCommandEvent &)\r
 {\r
-       g_fCancel = true;\r
+       this->fCancel = true;\r
        this->Close(true);\r
 }\r
 \r
@@ -131,5 +131,5 @@ int __stdcall TPICallbackProc(unsigned int _uMsg, void * _pStructure)
                break;\r
        }\r
 \r
-       return g_fCancel ? TPI_CALLBACK_CANCEL : TPI_CALLBACK_CONTINUE;\r
+       return g_procDlg->fCancel ? TPI_CALLBACK_CANCEL : TPI_CALLBACK_CONTINUE;\r
 }\r
index a6611c9..c6d5f10 100644 (file)
@@ -27,6 +27,7 @@ public:
     wxTextCtrl* ebSource;
     wxTextCtrl* ebTarget;
     wxGauge* gauge;
+    bool fCancel;\r
 
     void OnInit(  wxInitDialogEvent &);
        void OnBtnCancel(wxCommandEvent &);
index 41a2fd1..e40c49d 100644 (file)
@@ -53,34 +53,22 @@ struct g_LibInfo
 TPI_PROC g_prProc;\r
 bool g_fCallback32bit;\r
 bool g_fExistUnicodeMode;\r
-wxString g_szAppPath;\r
 \r
 //******************************************************************************\r
 //    Entry\r
 //******************************************************************************\r
 \r
 #ifdef __LINUX__\r
-void __attribute__((constructor)) Attach(void)\r
-{\r
-       wxStandardPaths p;\r
-       g_szAppPath = wxPathOnly(p.GetExecutablePath());\r
-}\r
-\r
 void __attribute__((destructor)) Detach(void)\r
 {\r
        ::FreeLibrary(g_LibInfo.hLib);\r
+       ::FreeLibrary(g_LibInfo.hLibAlt);\r
 }\r
 #else\r
 BOOL __stdcall DllMain(HMODULE, DWORD fdwReason, void *)\r
 {\r
        switch (fdwReason)\r
        {\r
-       case DLL_PROCESS_ATTACH:\r
-       {\r
-               wxStandardPaths p;\r
-               g_szAppPath = wxPathOnly(p.GetExecutablePath());\r
-               break;\r
-       }\r
        case DLL_PROCESS_DETACH:\r
                ::FreeLibrary(g_LibInfo.hLib);\r
                break;\r
@@ -366,10 +354,6 @@ int __stdcall GetPluginInformation
        void * _pPtr\r
 )\r
 {\r
-       // \83p\83X\90Ý\92è\81BTODO : \8dí\8f\9c\81B\r
-       wxStandardPaths p;\r
-       g_szAppPath = wxPathOnly(p.GetExecutablePath());\r
-\r
        if (_pPtr == NULL)\r
        {\r
                return TPI_ERROR_D_PARAMETER;\r
@@ -387,7 +371,8 @@ int __stdcall GetPluginInformation
        case TPI_INFO_SUPPORTED_SUFFIX:\r
        {\r
                // xml\89ð\90Í\8aJ\8en\81B\r
-               wxXmlDocument config(g_szAppPath + wxT("/lib/calLibrary.xml"));\r
+               wxStandardPaths p;\r
+               wxXmlDocument config(wxPathOnly(p.GetExecutablePath()) + wxT("/lib/calLibrary.xml"));\r
                // \88ê\8bC\82É\90æ\93ª\82Ì\83\89\83C\83u\83\89\83\8a\82Ì\8fî\95ñ\82ð\8eæ\93¾\81B\r
                wxXmlNode * xmlLibrary = config.GetRoot()->GetChildren();\r
 \r
@@ -421,12 +406,9 @@ int __stdcall LoadPlugin
        wxULongLong _llSubOption\r
 )\r
 {\r
-       // \83p\83X\90Ý\92è\81B\r
-       wxStandardPaths p;\r
-       g_szAppPath = wxPathOnly(p.GetExecutablePath());\r
-\r
        // xml\89ð\90Í\8aJ\8en\81B\r
-       wxXmlDocument config(g_szAppPath + wxT("/lib/calLibrary.xml"));\r
+       wxStandardPaths p;\r
+       wxXmlDocument config(wxPathOnly(p.GetExecutablePath()) + wxT("/lib/calLibrary.xml"));\r
        if (! config.IsOk())\r
        {\r
                return TPI_ERROR_UNDEFINED;\r
index da0327d..b5af0bd 100644 (file)
@@ -47,40 +47,16 @@ struct g_LibInfo
 }      g_LibInfo;\r
 \r
 TPI_PROC g_prProc;\r
-wxString g_szAppPath;\r
 wxArrayString g_asOutput;\r
 \r
 //******************************************************************************\r
 //    Entry\r
 //******************************************************************************\r
 \r
-#ifdef __LINUX__\r
-void __attribute__((constructor)) Attach(void)\r
-{\r
-       wxStandardPaths p;\r
-//     g_szAppPath = wxPathOnly(p.GetExecutablePath());\r
-}\r
-\r
-void __attribute__((destructor)) Detach(void)\r
+BOOL __stdcall DllMain(HMODULE, DWORD, void *)\r
 {\r
-}\r
-#else\r
-BOOL __stdcall DllMain(HMODULE, DWORD fdwReason, void *)\r
-{\r
-       switch (fdwReason)\r
-       {\r
-       case DLL_PROCESS_ATTACH:\r
-       {\r
-               wxStandardPaths p;\r
-               g_szAppPath = wxPathOnly(p.GetExecutablePath());\r
-               break;\r
-       }\r
-       case DLL_PROCESS_DETACH:\r
-               break;\r
-       }\r
        return TRUE;\r
 }\r
-#endif\r
 \r
 //******************************************************************************\r
 //    Inside Functions\r
@@ -209,10 +185,6 @@ int __stdcall GetPluginInformation
        void * _pPtr\r
 )\r
 {\r
-       // \83p\83X\90Ý\92è\81BTODO : \8dí\8f\9c\81B\r
-       wxStandardPaths p;\r
-       g_szAppPath = wxPathOnly(p.GetExecutablePath());\r
-\r
        if (_pPtr == NULL)\r
        {\r
                return TPI_ERROR_D_PARAMETER;\r
@@ -230,7 +202,8 @@ int __stdcall GetPluginInformation
        case TPI_INFO_SUPPORTED_SUFFIX:\r
        {\r
                // xml\89ð\90Í\8aJ\8en\81B\r
-               wxXmlDocument config(g_szAppPath + wxT("/lib/cuiWrapper.xml"));\r
+               wxStandardPaths p;\r
+               wxXmlDocument config(wxPathOnly(p.GetExecutablePath()) + wxT("/lib/cuiWrapper.xml"));\r
                // \88ê\8bC\82É\90æ\93ª\82Ì\83\89\83C\83u\83\89\83\8a\82Ì\8fî\95ñ\82ð\8eæ\93¾\81B\r
                wxXmlNode * xmlLibrary = config.GetRoot()->GetChildren();\r
 \r
@@ -264,12 +237,9 @@ int __stdcall LoadPlugin
        wxULongLong _llSubOption\r
 )\r
 {\r
-       // \83p\83X\90Ý\92è\81B\r
-       wxStandardPaths p;\r
-       g_szAppPath = wxPathOnly(p.GetExecutablePath());\r
-\r
        // xml\89ð\90Í\8aJ\8en\81B\r
-       wxXmlDocument config(g_szAppPath + wxT("/lib/cuiWrapper.xml"));\r
+       wxStandardPaths p;\r
+       wxXmlDocument config(wxPathOnly(p.GetExecutablePath()) + wxT("/lib/cuiWrapper.xml"));\r
        if (! config.IsOk())\r
        {\r
                return TPI_ERROR_UNDEFINED;\r