%% options copyright owner = Dirk Krause copyright year = 2011 license = bsd %% wx-gui type = frame icon = dkicon_bitmap contents = mainSizer [wxBoxSizer mainSizer] direction = vertical contents = $space(10) contents = horizontalSizer contents = $space(10) [wxBoxSizer horizontalSizer] contents = $space(10) contents = lModifying contents = $space(10) [wxStaticText lModifying] text = sTexts[3] %% header start %% class start /** Main window for dkwxpath. */ class DkWxPathFrame : public DkWxFrame { private: /** Event table. */ DECLARE_EVENT_TABLE() protected: /** Mutex to protect access to internal data. */ wxMutex mProtectData; /** Flag: A run was already initiated. */ bool bRunning; /** Flag: Do uninstallation instead of installation. */ bool bUninstall; /** Localized texts. */ wxChar const * const *sTexts; /** Localized texts. */ dkChar const * const *dkTexts; %% class end public: /** Constructor. @param applicationName Application name. @param localizedTexts Localized texts used by object. @param dkLocalizedTexts Localized texts used by object. @param applicationHelper Application helper object. @param idMain Window ID. @param argc Number of command line arguments. @param argv Command line arguments array. */ DkWxPathFrame( wxChar const *applicationName, wxChar const * const *localizedTexts, dkChar const * const *dkLocalizedTexts, DkWxAppHelper *applicationHelper, int idMain, int argc, wxChar **argv ); /** Check whether the window can be closed. @param isLast Flag: Last windows of it's type in application. @return True to close the frame, false to keep it open. */ bool canClose(bool isLast); /** Reaction on idle event. @param event Event to process. */ void OnIdle(wxIdleEvent & event); protected: /** Check whether or not we must start the action when idle. @return True to start action, false otherwise. */ bool mustStart(); /** Process command line arguments. @param argc Number of command line arguments. @param argv Command line arguments array. */ void processArguments(int argc, wxChar **argv); }; %% header end %% module start #include "dk3conf.h" #include "dk3types.h" #include "dk3wreg.h" #include "dkwxpath.h" #include "dkicon.xpm" $!trace-include BEGIN_EVENT_TABLE(DkWxPathFrame, wxFrame) EVT_IDLE(DkWxPathFrame::OnIdle) END_EVENT_TABLE() /** Description of a context menu item. */ typedef struct { dkChar const *menuitem; /**< Context menu item text. */ dkChar const *progname; /**< Program name. */ dkChar const *arguments; /**< Program command line arguments. */ } dkwxpath_action_t; /** File suffix information. */ typedef struct { dkChar const *suffix; /**< File type suffix including the dot. */ dkChar const *classname; /**< Class name if no class assigned yet. */ dkwxpath_action_t *items; /**< Context menu items. */ } dkwxpath_filetype_t; /** Context menu items for PNG. */ static dkwxpath_action_t dkwxpath_png_actions[] = { { NULL /* 12 */ , dkT("wxbmpp.exe"), dkT("-leps.image \"%1\"") }, { NULL /* 13 */ , dkT("wxbmpp.exe"), dkT("-lpdf.image \"%1\"") }, { NULL /* 14 */ , dkT("wxbmpp.exe"), dkT("-lpdf.object \"%1\"") }, { NULL, NULL, NULL } }; /** Context menu items for JPEG. */ static dkwxpath_action_t dkwxpath_jpeg_actions[] = { { NULL /* 12 */ , dkT("wxbmpp.exe"), dkT("-leps.image \"%1\"") }, { NULL /* 13 */ , dkT("wxbmpp.exe"), dkT("-lpdf.image \"%1\"") }, { NULL, NULL, NULL } }; /** Context menu items for TIFF. */ static dkwxpath_action_t dkwxpath_tiff_actions[] = { { NULL /* 12 */ , dkT("wxbmpp.exe"), dkT("-leps.image \"%1\"") }, { NULL /* 15 */ , dkT("wxbmpp.exe"), dkT("-lpdf.document \"%1\"") }, { NULL /* 13 */ , dkT("wxbmpp.exe"), dkT("-lpdf.image \"%1\"") }, { NULL /* 14 */ , dkT("wxbmpp.exe"), dkT("-lpdf.object \"%1\"") }, { NULL /* 16 */ , dkT("wxbmpp.exe"), dkT("-lps.document \"%1\"") }, { NULL, NULL, NULL } }; /** Context menu items for PRN and PS files. */ static dkwxpath_action_t dkwxpath_ps_actions[] = { { NULL /* 17 */ , dkT("winprint.exe"), dkT("-d \"%1\"") }, { NULL /* 18 */ , dkT("winprint.exe"), dkT("\"%1\"") }, { NULL, NULL, NULL } }; /** Context menu items for directories. */ static dkwxpath_action_t dkwxpath_directory_actions[] = { { NULL /* 19 */ , dkT("wxbmpp.exe"), dkT("\"%1\"") }, { NULL /* 20 */ , dkT("wxdkct.exe"), dkT("\"%1\"") }, { NULL, NULL, NULL } }; /** File types to set up. */ static dkwxpath_filetype_t dkwxpath_filetypes[] = { { dkT(".png"), dkT("pngfile"), dkwxpath_png_actions }, { dkT(".jpg"), dkT("jpegfile"), dkwxpath_jpeg_actions}, { dkT(".jpeg"), dkT("jpegfile"), dkwxpath_jpeg_actions}, { dkT(".tif"), dkT("tifffile"), dkwxpath_tiff_actions}, { dkT(".tiff"), dkT("tifffile"), dkwxpath_tiff_actions}, { dkT(".prn"), dkT("prnfile"), dkwxpath_ps_actions}, { dkT(".ps"), dkT("psfile"), dkwxpath_ps_actions}, { NULL, NULL, NULL } }; dkChar const * const dkwxpath_noloc[] = { $!string-table macro=dkT # # 0 # \\shell # # 1 # \\command # # 2 # " # # 3 (space) # # # 4 # \\ # # 5 # Directory $!end }; #if DK3_ON_WINDOWS && ((DK3_CHAR_SIZE == 1) || (DK3_CHAR_SIZE == 2)) /** Registry key in HKLM containing system environment variables. */ static dkChar const dkwxpath_registry_key[] = { dkT("SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment") }; /** Registry value name. */ static dkChar const dkwxpath_registry_name[] = { dkT("Path") }; /** Separator of PATH components. */ static dkChar const dkwxpath_sep[] = { dkT(";") }; #endif /* if DK3_ON_WINDOWS */ #if DK3_ON_WINDOWS && ((DK3_CHAR_SIZE == 1) || (DK3_CHAR_SIZE == 2)) /** Check whether or not a directory is already contained in the PATH. @param bu Current PATH value. @param dn Directory name to check for. @return 1 on success (@a dn already contained), 0 otherwise. */ static int dk3_win_check_path(dkChar *bu, dkChar const *dn) { dkChar *pc; dkChar *pn; int back = 0; $? "+ dk3_win_check_path dn=\"%s\"", TR_STR(dn) pc = bu; while((pc) && (0 == back)) { pn = dk3str_chr(pc, dkT(';')); if(pn) { *(pn++) = dkT('\0'); } if(0 == dk3str_fncmp(pc, dn)) { back = 1; } pc = pn; } $? "- dk3_win_check_path %d", back return back; } #endif /* if DK3_ON_WINDOWS */ /** Register context menu entries. @param dn Installation directory name, bin subdirectory. @param cl Class name. @param act Actions list. @param app Application structure for diagnostics, may be NULL. */ static void dkwxpath_register_context_entries( dkChar const *dn, dkChar const *cl, dkwxpath_action_t *act, dk3_app_t *app ) { dkChar kn1[DK3_MAX_PATH]; dkChar kn2[DK3_SIZEOF(kn1,dkChar)]; dkwxpath_action_t *acp; size_t szk; size_t szv; HKEY hk; $? "+ dkwxpath_register_context_entries dn=\"%s\" cl=\"%s\"", TR_STR(dn), TR_STR(cl) acp = act; while((acp->menuitem) && (acp->progname) && (acp->arguments)) { szk = 2 + dk3str_len(cl) + dk3str_len(dkwxpath_noloc[0]) + dk3str_len(acp->menuitem) + dk3str_len(dkwxpath_noloc[1]); szv = 5 + dk3str_len(dn) + dk3str_len(acp->progname) + dk3str_len(acp->arguments); if((szk < DK3_MAX_PATH) && (szv < DK3_MAX_PATH)) { dk3str_cpy(kn1, cl); $? ". key = \"%s\"", kn1 if(dk3wreg_key_create_read(HKEY_CLASSES_ROOT, kn1, &hk, app)) { dk3wreg_key_close(hk, kn1, app); dk3str_cpy(kn1, cl); dk3str_cat(kn1, dkwxpath_noloc[0]); $? ". key = \"%s\"", kn1 if(dk3wreg_key_create_read(HKEY_CLASSES_ROOT, kn1, &hk, app)) { dk3wreg_key_close(hk, kn1, app); dk3str_cpy(kn1, cl); dk3str_cat(kn1, dkwxpath_noloc[0]); dk3str_cat(kn1, dkwxpath_noloc[4]); dk3str_cat(kn1, acp->menuitem); $? ". key = \"%s\"", kn1 if(dk3wreg_key_create_read(HKEY_CLASSES_ROOT, kn1, &hk, app)) { dk3wreg_key_close(hk, kn1, app); dk3str_cpy(kn1, cl); dk3str_cat(kn1, dkwxpath_noloc[0]); dk3str_cat(kn1, dkwxpath_noloc[4]); dk3str_cat(kn1, acp->menuitem); dk3str_cat(kn1, dkwxpath_noloc[1]); $? ". key = \"%s\"", kn1 dk3str_cpy(kn2, dkwxpath_noloc[2]); dk3str_cat(kn2, dn); dk3str_cat(kn2, dkwxpath_noloc[4]); dk3str_cat(kn2, acp->progname); dk3str_cat(kn2, dkwxpath_noloc[2]); dk3str_cat(kn2, dkwxpath_noloc[3]); dk3str_cat(kn2, acp->arguments); $? ". val = \"%s\"", kn2 if(dk3wreg_key_create_modify(HKEY_CLASSES_ROOT, kn1, &hk, app)) { (void)dk3wreg_set_sz(hk, NULL, kn2, app); $? ". set" dk3wreg_key_close(hk, kn1, app); } } } } } acp++; } $? "- dkwxpath_register_context_entries" } /** Remove context menu items. @param dn Base directory name. @param cl Class name. @param act Actions to delete. @param app Application structure for diagnostics, may be NULL. */ static void dkwxpath_unregister_context_entries( dkChar const *dn, dkChar const *cl, dkwxpath_action_t *act, dk3_app_t *app ) { dkChar kn1[DK3_MAX_PATH]; dkwxpath_action_t *acp; size_t szk; $? "+ dkwxpath_unregister_context_entries dn=\"%s\" cl=\"%s\"", TR_STR(dn), TR_STR(cl) acp = act; while((acp->menuitem) && (acp->progname) && (acp->arguments)) { szk = 2 + dk3str_len(cl) + dk3str_len(dkwxpath_noloc[0]) + dk3str_len(acp->menuitem); if(szk < DK3_MAX_PATH) { dk3str_cpy(kn1, cl); dk3str_cat(kn1, dkwxpath_noloc[0]); dk3str_cat(kn1, dkwxpath_noloc[4]); dk3str_cat(kn1, acp->menuitem); $? ". key = \"%s\"", kn1 (void)dk3wreg_key_delete(HKEY_CLASSES_ROOT, kn1, app); } acp++; } $? "- dkwxpath_unregister_context_entries" } /** Register context menus. @param dn Directory name (bin subdirectory). @param app Application structure for diagnostics, may be NULL. */ static void dkwxpath_register_context_menus(dkChar const *dn, dk3_app_t *app) { dkChar cln[DK3_MAX_PATH]; dkwxpath_filetype_t *ftp; int hcl; HKEY hk; $? "+ dkwxpath_register_context_menus dn=\"%s\"", TR_STR(dn) ftp = dkwxpath_filetypes; while((ftp->suffix) && (ftp->classname) && (ftp->items)) { $? ". suffix = \"%s\"", ftp->suffix $? ". class = \"%s\"", ftp->classname cln[0] = dkT('\0'); hcl = 0; if(dk3wreg_key_create_modify(HKEY_CLASSES_ROOT, ftp->suffix, &hk, app)) { if(dk3wreg_get_sz(hk, NULL, cln, DK3_SIZEOF(cln,dkChar), app)) { if(0 < dk3str_len(cln)) { hcl = 1; } } if(0 == hcl) { dk3wreg_set_sz(hk, NULL, ftp->classname, app); } dk3wreg_key_close(hk, ftp->suffix, app); if(hcl) { dkwxpath_register_context_entries(dn, cln, ftp->items, app); } else { dkwxpath_register_context_entries(dn, ftp->classname, ftp->items, app); } } ftp++; } dkwxpath_register_context_entries( dn, dkwxpath_noloc[5], dkwxpath_directory_actions, app ); $? "- dkwxpath_register_context_menus" } static void dkwxpath_unregister_context_menus(dkChar const *dn, dk3_app_t *app) { dkChar cln[DK3_MAX_PATH]; dkwxpath_filetype_t *ftp; int hcl; HKEY hk; $? "+ dkwxpath_unregister_context_menus dn=\"%s\"", TR_STR(dn) ftp = dkwxpath_filetypes; while((ftp->suffix) && (ftp->classname) && (ftp->items)) { $? ". suffix = \"%s\"", ftp->suffix $? ". class = \"%s\"", ftp->classname cln[0] = dkT('\0'); hcl = 0; if(dk3wreg_key_create_modify(HKEY_CLASSES_ROOT, ftp->suffix, &hk, app)) { if(dk3wreg_get_sz(hk, NULL, cln, DK3_SIZEOF(cln,dkChar), app)) { if(0 < dk3str_len(cln)) { hcl = 1; } } dk3wreg_key_close(hk, ftp->suffix, app); if(hcl) { dkwxpath_unregister_context_entries(dn, cln, ftp->items, app); } } ftp++; } dkwxpath_unregister_context_entries( dn, dkwxpath_noloc[5], dkwxpath_directory_actions, app ); $? "- dkwxpath_unregister_context_menus" } /** Ensure dn is listed in the PATH environment variable. @param dn New component to include in PATH. @return 0 on failure, 1 on success (added), 2 on success (dn already in PATH). */ static int dkwxpath_set_regentry(dkChar const *dn, dk3_app_t *app) { int back = 0; #if DK3_ON_WINDOWS && ((DK3_CHAR_SIZE == 1) || (DK3_CHAR_SIZE == 2)) dkChar b1[16 * DK3_MAX_PATH]; dkChar b2[16 * DK3_MAX_PATH]; DWORD dwType; DWORD dwSz; LONG res; size_t sl; REGSAM regsam; HKEY regkey; $? "+ dkwxpath_set_regentry dn=\"%s\"", TR_STR(dn) regsam = KEY_ALL_ACCESS; #if DK3_CHAR_SIZE == 2 res = RegOpenKeyExW( HKEY_LOCAL_MACHINE, dkwxpath_registry_key, (DWORD)0UL, regsam, ®key ); #else res = RegOpenKeyExA( HKEY_LOCAL_MACHINE, dkwxpath_registry_key, (DWORD)0UL, regsam, ®key ); #endif if(ERROR_SUCCESS == res) { $? ". reg key opened" dwType = REG_EXPAND_SZ; dwSz = (DWORD)sizeof(b1); #if DK3_CHAR_SIZE == 2 res = RegQueryValueExW( regkey, dkwxpath_registry_name, NULL, &dwType, (LPBYTE)b1, &dwSz ); #else res = RegQueryValueExA( regkey, dkwxpath_registry_name, NULL, &dwType, (LPBYTE)b1, &dwSz ); #endif if(ERROR_SUCCESS == res) { $? ". query value ok" res = 1L; #if DK3_CHAR_SIZE == 2 if(dwSz % (DWORD)2L) { $? "! not wide characters" res = 0L; } else { $? ". wide characters" dwSz = dwSz / (DWORD)2L; } #endif if(dwType != REG_SZ) { if(dwType != REG_EXPAND_SZ) { $? "! wrong value type" res = 0L; } } if(1L == res) { $? ". ok so far" if((DWORD)0L < dwSz) { $? ". have string" if(dwSz < DK3_SIZEOF(b1,dkChar)) { $? ". length ok" b1[dwSz] = dkT('\0'); dk3str_cpy(b2, b1); if(dk3_win_check_path(b2, dn)) { back = 2; } else { sl = dk3str_len(b1); sl += dk3str_len(dn); sl += 1; if(sl < DK3_SIZEOF(b2,dkChar)) { dk3str_cpy(b2, dn); dk3str_cat(b2, dkwxpath_sep); dk3str_cat(b2, b1); #if DK3_CHAR_SIZE == 2 res = RegSetValueExW( regkey, dkwxpath_registry_name, (DWORD)0L, dwType, (BYTE const *)b2, (DWORD)(2 * (1 + dk3str_len(b2))) ); #else res = RegSetValueExA( regkey, dkwxpath_registry_name, (DWORD)0L, dwType, (BYTE const *)b2, (DWORD)(1 + dk3str_len(b2)) ); #endif if(ERROR_SUCCESS == res) { back = 1; } } else { $? "! strings too long" } } } else { $? "! string too long" } } else { $? "! empty string" } } } else { $? "! failed to query value" } RegCloseKey(regkey); } else { $? "! failed to open reg key" } dkwxpath_register_context_menus(dn, app); #else /* Simulate results to test dialogs. */ #endif /* if DK3_ON_WINDOWS ... */ $? "- dkwxpath_set_regentry %d", back return back; } #if DK3_ON_WINDOWS && ((DK3_CHAR_SIZE == 2) || (DK3_CHAR_SIZE == 1)) static void dkwxpath_remove(dkChar *dp, dkChar *sp, dkChar const *dn) { dkChar *pc; dkChar *pn; bool isfirst = true; *dp = dkT('\0'); pc = sp; while(pc) { pn = dk3str_chr(pc, dkT(';')); if(pn) { *(pn++) = dkT('\0'); } if(dk3str_fncmp(pc, dn)) { if(isfirst) { isfirst = false; dk3str_cpy(dp, pc); } else { dk3str_cat(dp, dkwxpath_sep); dk3str_cat(dp, pc); } } pc = pn; } } #endif /* if DK3_ON_WINDOWS && ... */ /** Ensure dn is not listed in the PATH environment variable. @param dn Component to exclude from PATH. @return 0 on failure, 1 on success (removed), 2 on success (dn not contained). */ static int dkwxpath_unset_regentry(dkChar const *dn, dk3_app_t *app) { int back = 0; $? "+ dkwxpath_unset_regentry" #if DK3_ON_WINDOWS && ((DK3_CHAR_SIZE == 1) || (DK3_CHAR_SIZE == 2)) dkChar b1[16 * DK3_MAX_PATH]; dkChar b2[16 * DK3_MAX_PATH]; DWORD dwType; DWORD dwSz; LONG res; REGSAM regsam; HKEY regkey; regsam = KEY_ALL_ACCESS; #if DK3_CHAR_SIZE == 2 res = RegOpenKeyExW( HKEY_LOCAL_MACHINE, dkwxpath_registry_key, (DWORD)0UL, regsam, ®key ); #else res = RegOpenKeyExA( HKEY_LOCAL_MACHINE, dkwxpath_registry_key, (DWORD)0UL, regsam, ®key ); #endif if(ERROR_SUCCESS == res) { $? ". reg key open" dwType = REG_EXPAND_SZ; dwSz = (DWORD)sizeof(b1); #if DK3_CHAR_SIZE == 2 res = RegQueryValueExW( regkey, dkwxpath_registry_name, NULL, &dwType, (LPBYTE)b1, &dwSz ); #else res = RegQueryValueExA( regkey, dkwxpath_registry_name, NULL, &dwType, (LPBYTE)b1, &dwSz ); #endif if(ERROR_SUCCESS == res) { $? ". reg query" res = 1L; #if DK3_CHAR_SIZE == 2 if(dwSz % (DWORD)2L) { res = 0L; } else { dwSz = dwSz / (DWORD)2L; } #endif if(dwType != REG_SZ) { if(dwType != REG_EXPAND_SZ) { res = 0L; } } if(1L == res) { $? ". type and length ok" if((DWORD)0L < dwSz) { $? ". contents in string" if(dwSz < DK3_SIZEOF(b1,dkChar)) { b1[dwSz] = dkT('\0'); dkwxpath_remove(b2, b1, dn); #if DK3_CHAR_SIZE == 2 res = RegSetValueExW( regkey, dkwxpath_registry_name, (DWORD)0L, dwType, (BYTE const *)b2, (DWORD)(2 * (1 + dk3str_len(b2))) ); #else res = RegSetValueExA( regkey, dkwxpath_registry_name, (DWORD)0L, dwType, (BYTE const *)b2, (DWORD)(1 + dk3str_len(b2)) ); #endif if(ERROR_SUCCESS == res) { $? ". reg set" back = 1; } else { $? "! reg set" } } } else { $? "! empty string" } } else { $? "! type or length" } } else { $? "! reg query" } RegCloseKey(regkey); } else { $? "! reg key open" } dkwxpath_unregister_context_menus(dn, app); #endif $? "- dkwxpath_unset_regentry %d", back return back; } %% constructor start DkWxPathFrame::DkWxPathFrame( wxChar const *applicationName, wxChar const * const *localizedTexts, dkChar const * const *dkLocalizedTexts, DkWxAppHelper *applicationHelper, int idMain, int argc, wxChar **argv ) : DkWxFrame(applicationName, applicationHelper, NULL, idMain), mProtectData(wxMUTEX_DEFAULT) { #if defined(__WXMSW__) wxIcon dkicon_bitmap(wxT("aaaaa")); #else wxIcon dkicon_bitmap(dkicon_xpm); #endif sTexts = localizedTexts; dkTexts = dkLocalizedTexts; bRunning = false; bUninstall = false; %% constructor end restorePosition(); processArguments(argc, argv); /* Set context menu item texts */ dkwxpath_png_actions[0].menuitem = dkLocalizedTexts[12]; dkwxpath_png_actions[1].menuitem = dkLocalizedTexts[13]; dkwxpath_png_actions[2].menuitem = dkLocalizedTexts[14]; dkwxpath_jpeg_actions[0].menuitem = dkLocalizedTexts[12]; dkwxpath_jpeg_actions[1].menuitem = dkLocalizedTexts[13]; dkwxpath_tiff_actions[0].menuitem = dkLocalizedTexts[12]; dkwxpath_tiff_actions[1].menuitem = dkLocalizedTexts[15]; dkwxpath_tiff_actions[2].menuitem = dkLocalizedTexts[13]; dkwxpath_tiff_actions[3].menuitem = dkLocalizedTexts[14]; dkwxpath_tiff_actions[4].menuitem = dkLocalizedTexts[16]; dkwxpath_ps_actions[0].menuitem = dkLocalizedTexts[17]; dkwxpath_ps_actions[1].menuitem = dkLocalizedTexts[18]; dkwxpath_directory_actions[0].menuitem = dkLocalizedTexts[19]; dkwxpath_directory_actions[1].menuitem = dkLocalizedTexts[20]; } %% module end bool DkWxPathFrame::mustStart() { bool back = false; { wxMutexLocker lock(mProtectData); if(lock.IsOk()) { if(!bRunning) { back = true; bRunning = true; } } } return back; } void DkWxPathFrame::OnIdle(wxIdleEvent & event) { wxChar bindir[DK3_MAX_PATH]; dk3_app_t *app; dkChar const *dkbindir; bool doRun; bool haveBinDir; int res; haveBinDir = false; app = NULL; dkbindir = NULL; doRun = mustStart(); /* Modify PATH variable. */ if(doRun) { res = 1; #if DK3_ON_WINDOWS && ((DK3_CHAR_SIZE == 1) || (DK3_CHAR_SIZE == 2)) res = 0; app = pHelper->getApp(); if(app) { dkbindir = dk3app_get_bindir(app); if(dkbindir) { if(bUninstall) { res = dkwxpath_unset_regentry(dkbindir, app); } else { res = dkwxpath_set_regentry(dkbindir, app); } Sleep(250); } } #endif if(0 == res) { app = pHelper->getApp(); if(app) { dkbindir = dk3app_get_bindir(app); if(dkbindir) { haveBinDir = pHelper->dkToWx( bindir, DK3_SIZEOF(bindir,wxChar), dkbindir ); } } wxString msg(wxT("")); msg.Append(sTexts[6]); msg.Append(wxT("\n")); if(bUninstall) { msg.Append(sTexts[9]); msg.Append(wxT("\n")); if(haveBinDir) { msg.Append(wxT("\n")); msg.Append(bindir); msg.Append(wxT("\n")); msg.Append(wxT("\n")); } msg.Append(sTexts[10]); } else { msg.Append(sTexts[7]); msg.Append(wxT("\n")); if(haveBinDir) { msg.Append(wxT("\n")); msg.Append(bindir); msg.Append(wxT("\n")); msg.Append(wxT("\n")); } msg.Append(sTexts[8]); } msg.Append(wxT("\n")); msg.Append(sTexts[11]); wxMessageBox(msg, sTexts[5], (wxOK | wxICON_ERROR), this); } } /* Skip further event processing. */ event.Skip(); /* Close window. */ if(doRun) { Show(false); Close(); } } bool DkWxPathFrame::canClose(bool isLast) { if(isLast) { savePosition(); } return true; } static const wxCmdLineEntryDesc dkwxpath_cmd_line_desc[] = { { wxCMD_LINE_SWITCH, wxT_2("u"), wxT_2("uninstall"), wxT_2("Uninstall DK tools and libraries") }, { wxCMD_LINE_NONE } }; void DkWxPathFrame::processArguments(int argc, wxChar **argv) { wxLogNull log; int res; $? "+ DkWxPathFrame::processArguments" wxCmdLineParser parser(dkwxpath_cmd_line_desc, argc, argv); res = parser.Parse(false); if(0 == res) { $? ". arguments parsed successfully" if(parser.Found(wxT("u"))) { $? ". uninstall" bUninstall = true; } } $? "- DkWxPathFrame::processArguments" }