wxAcceleratorEntry_v wxKeyTextCtrl::FromString(const wxString &s, wxChar sep) { wxAcceleratorEntry_v ret, empty; int mod, key; int len = s.size(); for (int lastkey = len - 1; (lastkey = s.rfind(sep, lastkey)) != wxString::npos; lastkey--) { if (lastkey == len - 1) { // sep as accel if (!lastkey) break; if (s[lastkey - 1] == wxT('-') || s[lastkey - 1] == wxT('+') || s[lastkey - 1] == sep) continue; } if (!ParseString(s.c_str() + lastkey + 1, len - lastkey - 1, mod, key)) return empty; ret.insert(ret.begin(), wxAcceleratorEntry(mod, key)); len = lastkey; } if (!ParseString(s.c_str(), len, mod, key)) return empty; ret.insert(ret.begin(), wxAcceleratorEntry(mod, key)); return ret; }
wxGISAcceleratorTable::wxGISAcceleratorTable(wxGISApplicationBase* pApp) : bHasChanges(true) { m_AccelEntryArray.reserve(20); wxGISAppConfig oConfig = GetConfig(); if(!oConfig.IsOk()) return; wxXmlNode* pAcceleratorsNodeCU = oConfig.GetConfigNode(enumGISHKCU, pApp->GetAppName() + wxString(wxT("/accelerators"))); wxXmlNode* pAcceleratorsNodeLM = oConfig.GetConfigNode(enumGISHKLM, pApp->GetAppName() + wxString(wxT("/accelerators"))); //merge two tables m_pApp = pApp; if(!pApp) return; //TODO: merge acc tables //TODO: if user delete key - it must be mark as deleted to avoid adding it fron LM table if(pAcceleratorsNodeCU) { wxXmlNode *child = pAcceleratorsNodeCU->GetChildren(); while(child) { wxString sCmdName = child->GetAttribute(wxT("cmd_name"), NON); unsigned char nSubtype = wxAtoi(child->GetAttribute(wxT("subtype"), wxT("0"))); wxGISCommand* pCmd = m_pApp->GetCommand(sCmdName, nSubtype); if(pCmd) { wxString sFlags = child->GetAttribute(wxT("flags"), wxT("NORMAL")); wxDword Flags = GetFlags(sFlags); wxString sKey = child->GetAttribute(wxT("keycode"), wxT("A")); int nKey = GetKeyCode(sKey); Add(wxAcceleratorEntry(Flags, nKey, pCmd->GetId())); } child = child->GetNext(); } } if(pAcceleratorsNodeLM) { wxXmlNode *child = pAcceleratorsNodeLM->GetChildren(); while(child) { wxString sCmdName = child->GetAttribute(wxT("cmd_name"), NON); unsigned char nSubtype = wxAtoi(child->GetAttribute(wxT("subtype"), wxT("0"))); wxGISCommand* pCmd = m_pApp->GetCommand(sCmdName, nSubtype); if(pCmd) { wxString sFlags = child->GetAttribute(wxT("flags"), wxT("NORMAL")); wxDword Flags = GetFlags(sFlags); wxString sKey = child->GetAttribute(wxT("keycode"), wxT("A")); int nKey = GetKeyCode(sKey); Add(wxAcceleratorEntry(Flags, nKey, pCmd->GetId())); } child = child->GetNext(); } } }
wxGISAcceleratorTable::wxGISAcceleratorTable(IApplication* pApp, IGISConfig* pConf) : bHasChanges(true) { m_AccelEntryArray.reserve(20); m_pConf = pConf; wxXmlNode* pAcceleratorsNodeCU = m_pConf->GetConfigNode(enumGISHKCU, wxString(wxT("accelerators"))); wxXmlNode* pAcceleratorsNodeLM = m_pConf->GetConfigNode(enumGISHKLM, wxString(wxT("accelerators"))); //merge two tables m_pApp = pApp; if(!pApp) return; //merge acc tables //if user delete key - it must be mark as deleted to avoid adding it fron LM table if(pAcceleratorsNodeCU) { wxXmlNode *child = pAcceleratorsNodeCU->GetChildren(); while(child) { wxString sCmdName = child->GetPropVal(wxT("cmd_name"), NON); unsigned char nSubtype = wxAtoi(child->GetPropVal(wxT("subtype"), wxT("0"))); ICommand* pCmd = m_pApp->GetCommand(sCmdName, nSubtype); if(pCmd) { wxString sFlags = child->GetPropVal(wxT("flags"), wxT("NORMAL")); WXDWORD Flags = GetFlags(sFlags); wxString sKey = child->GetPropVal(wxT("keycode"), wxT("A")); int nKey = GetKeyCode(sKey); Add(wxAcceleratorEntry(Flags, nKey, pCmd->GetID())); } child = child->GetNext(); } } if(pAcceleratorsNodeLM) { wxXmlNode *child = pAcceleratorsNodeLM->GetChildren(); while(child) { wxString sCmdName = child->GetPropVal(wxT("cmd_name"), NON); unsigned char nSubtype = wxAtoi(child->GetPropVal(wxT("subtype"), wxT("0"))); ICommand* pCmd = m_pApp->GetCommand(sCmdName, nSubtype); if(pCmd) { wxString sFlags = child->GetPropVal(wxT("flags"), wxT("NORMAL")); WXDWORD Flags = GetFlags(sFlags); wxString sKey = child->GetPropVal(wxT("keycode"), wxT("A")); int nKey = GetKeyCode(sKey); Add(wxAcceleratorEntry(Flags, nKey, pCmd->GetID())); } child = child->GetNext(); } } }
wxCommandProcessor::wxCommandProcessor(int maxCommands) { m_maxNoCommands = maxCommands; #if wxUSE_MENUS m_commandEditMenu = NULL; #endif // wxUSE_MENUS #if wxUSE_ACCEL m_undoAccelerator = '\t' + wxAcceleratorEntry(wxACCEL_CTRL, 'Z').ToString(); m_redoAccelerator = '\t' + wxAcceleratorEntry(wxACCEL_CTRL, 'Y').ToString(); #endif // wxUSE_ACCEL m_lastSavedCommand = m_currentCommand = wxList::compatibility_iterator(); }
wxAcceleratorEntry wxGISAcceleratorTable::GetEntry(int cmd) { for(size_t i = 0; i < m_AccelEntryArray.size(); ++i) if(m_AccelEntryArray[i].GetCommand() == cmd) return m_AccelEntryArray[i]; return wxAcceleratorEntry(); }
wxString KeyAcceleratorCode::ToString() const { // Let's use wx's string formatter: return wxAcceleratorEntry( (cmd ? wxACCEL_CMD : 0) | (shift ? wxACCEL_SHIFT : 0) | (alt ? wxACCEL_ALT : 0), keycode ).ToString(); }
csLabelEditingDialog::csLabelEditingDialog(wxWindow* parent) { //wxLoadFromResource(this, parent, wxT("shape_label_dialog")); // Accelerators const wxAcceleratorEntry accel[] = { wxAcceleratorEntry(wxACCEL_CTRL, WXK_RETURN, wxID_OK) }; SetAcceleratorTable(wxAcceleratorTable(WXSIZEOF(accel), accel)); Centre(); wxTextCtrl* textCtrl = XRCCTRL(*this, "text", wxTextCtrl); wxASSERT(textCtrl); // textCtrl->SetAcceleratorTable(accel); textCtrl->SetFocus(); }
EVT_LISTBOX( ID_LIBVIEW_LIB_LIST, LIB_VIEW_FRAME::ClickOnLibList ) EVT_LISTBOX( ID_LIBVIEW_CMP_LIST, LIB_VIEW_FRAME::ClickOnCmpList ) EVT_LISTBOX_DCLICK( ID_LIBVIEW_CMP_LIST, LIB_VIEW_FRAME::DClickOnCmpList ) EVT_MENU( ID_SET_RELATIVE_OFFSET, LIB_VIEW_FRAME::OnSetRelativeOffset ) END_EVENT_TABLE() /* * This emulates the zoom menu entries found in the other KiCad applications. * The library viewer does not have any menus so add an accelerator table to * the main frame. */ static wxAcceleratorEntry accels[] = { wxAcceleratorEntry( wxACCEL_NORMAL, WXK_F1, ID_ZOOM_IN ), wxAcceleratorEntry( wxACCEL_NORMAL, WXK_F2, ID_ZOOM_OUT ), wxAcceleratorEntry( wxACCEL_NORMAL, WXK_F3, ID_ZOOM_REDRAW ), wxAcceleratorEntry( wxACCEL_NORMAL, WXK_F4, ID_POPUP_ZOOM_CENTER ), wxAcceleratorEntry( wxACCEL_NORMAL, WXK_HOME, ID_ZOOM_PAGE ), wxAcceleratorEntry( wxACCEL_NORMAL, WXK_SPACE, ID_SET_RELATIVE_OFFSET ) }; #define ACCEL_TABLE_CNT ( sizeof( accels ) / sizeof( wxAcceleratorEntry ) ) #define LIB_VIEW_FRAME_NAME wxT( "ViewlibFrame" ) LIB_VIEW_FRAME::LIB_VIEW_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrameType, CMP_LIBRARY* aLibrary ) : SCH_BASE_FRAME( aKiway, aParent, aFrameType, _( "Library Browser" ), wxDefaultPosition, wxDefaultSize, aFrameType==FRAME_SCH_VIEWER ?
/** * Adds entries to the browser's accelerator key table. Derived classes should call up to their parents. */ void WxBrowser::AddAcceleratorTableEntries(TArray<wxAcceleratorEntry>& Entries) { // Bind F5 to refresh. Entries.AddItem( wxAcceleratorEntry(wxACCEL_NORMAL,WXK_F5,IDM_RefreshBrowser) ); }
#define BOOLOPT(c, n, d, v) \ new_opt_desc(wxT(c), (n), d, NULL, NULL, wxT(""), 0, 0, &v) #define ENUMOPT(c, n, d, v, e) \ new_opt_desc(wxT(c), (n), d, NULL, &v, e) #define NOOPT(c, n, d) \ new_opt_desc(c, (n), d) opts_t gopts; // having the standard menu accels here means they will work even without menus const wxAcceleratorEntry default_accels[] = { wxAcceleratorEntry(wxMOD_CMD, wxT('C'), XRCID("CheatsList")), wxAcceleratorEntry(wxMOD_CMD, wxT('N'), XRCID("NextFrame")), // some ports add ctrl-q anyway, so may as well make it official // maybe make alt-f4 universal as well... // FIXME: ctrl-Q does not work on wxMSW // FIXME: esc does not work on wxMSW // this was annoying people A LOT #334 //wxAcceleratorEntry(wxMOD_NONE, WXK_ESCAPE, wxID_EXIT), // this was annoying people #298 //wxAcceleratorEntry(wxMOD_CMD, wxT('X'), wxID_EXIT), wxAcceleratorEntry(wxMOD_CMD, wxT('Q'), wxID_EXIT), // FIXME: ctrl-W does not work on wxMSW wxAcceleratorEntry(wxMOD_CMD, wxT('W'), wxID_CLOSE),
CamuleDlg::CamuleDlg( wxWindow* pParent, const wxString &title, wxPoint where, wxSize dlg_size) : wxFrame( pParent, -1, title, where, dlg_size, wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxDIALOG_NO_PARENT| wxRESIZE_BORDER|wxMINIMIZE_BOX|wxMAXIMIZE_BOX|wxCLOSE_BOX, wxT("aMule")), m_activewnd(NULL), m_transferwnd(NULL), m_serverwnd(NULL), m_sharedfileswnd(NULL), m_searchwnd(NULL), m_chatwnd(NULL), m_statisticswnd(NULL), m_kademliawnd(NULL), m_prefsDialog(NULL), m_srv_split_pos(0), m_imagelist(16,16), m_tblist(32,32), m_prefsVisible(false), m_wndToolbar(NULL), m_wndTaskbarNotifier(NULL), m_nActiveDialog(DT_NETWORKS_WND), m_is_safe_state(false), m_BlinkMessages(false), m_CurrentBlinkBitmap(24), m_last_iconizing(0), m_skinFileName(), m_clientSkinNames(CLIENT_SKIN_SIZE) { // Initialize skin names m_clientSkinNames[Client_Green_Smiley] = wxT("Transfer"); m_clientSkinNames[Client_Red_Smiley] = wxT("Connecting"); m_clientSkinNames[Client_Yellow_Smiley] = wxT("OnQueue"); m_clientSkinNames[Client_Grey_Smiley] = wxT("A4AFNoNeededPartsQueueFull"); m_clientSkinNames[Client_White_Smiley] = wxT("StatusUnknown"); m_clientSkinNames[Client_ExtendedProtocol_Smiley] = wxT("ExtendedProtocol"); m_clientSkinNames[Client_SecIdent_Smiley] = wxT("SecIdent"); m_clientSkinNames[Client_BadGuy_Smiley] = wxT("BadGuy"); m_clientSkinNames[Client_CreditsGrey_Smiley] = wxT("CreditsGrey"); m_clientSkinNames[Client_CreditsYellow_Smiley] = wxT("CreditsYellow"); m_clientSkinNames[Client_Upload_Smiley] = wxT("Upload"); m_clientSkinNames[Client_Friend_Smiley] = wxT("Friend"); m_clientSkinNames[Client_eMule_Smiley] = wxT("eMule"); m_clientSkinNames[Client_mlDonkey_Smiley] = wxT("mlDonkey"); m_clientSkinNames[Client_eDonkeyHybrid_Smiley] = wxT("eDonkeyHybrid"); m_clientSkinNames[Client_aMule_Smiley] = wxT("aMule"); m_clientSkinNames[Client_lphant_Smiley] = wxT("lphant"); m_clientSkinNames[Client_Shareaza_Smiley] = wxT("Shareaza"); m_clientSkinNames[Client_xMule_Smiley] = wxT("xMule"); m_clientSkinNames[Client_Unknown] = wxT("Unknown"); m_clientSkinNames[Client_InvalidRating_Smiley] = wxT("InvalidRatingOnFile"); m_clientSkinNames[Client_PoorRating_Smiley] = wxT("PoorRatingOnFile"); m_clientSkinNames[Client_GoodRating_Smiley] = wxT("GoodRatingOnFile"); m_clientSkinNames[Client_FairRating_Smiley] = wxT("FairRatingOnFile"); m_clientSkinNames[Client_ExcellentRating_Smiley] = wxT("ExcellentRatingOnFile"); m_clientSkinNames[Client_CommentOnly_Smiley] = wxT("CommentOnly"); m_clientSkinNames[Client_Encryption_Smiley] = wxT("Encrypted"); // wxWidgets send idle events to ALL WINDOWS by default... *SIGH* wxIdleEvent::SetMode(wxIDLE_PROCESS_SPECIFIED); wxUpdateUIEvent::SetMode(wxUPDATE_UI_PROCESS_SPECIFIED); wxInitAllImageHandlers(); Apply_Clients_Skin(); #ifdef __WINDOWS__ wxSystemOptions::SetOption(wxT("msw.remap"), 0); #endif #if !(wxCHECK_VERSION(2, 9, 0) && defined(__WXMAC__)) // this crashes on Mac with wx 2.9 SetIcon(wxICON(aMule)); #endif srand(time(NULL)); // Create new sizer and stuff a wxPanel in there. wxFlexGridSizer *s_main = new wxFlexGridSizer(1); s_main->AddGrowableCol(0); s_main->AddGrowableRow(0); wxPanel* p_cnt = new wxPanel(this, -1, wxDefaultPosition, wxDefaultSize); s_main->Add(p_cnt, 0, wxGROW|wxEXPAND, 0); muleDlg(p_cnt, false, true); SetSizer(s_main, true); m_serverwnd = new CServerWnd(p_cnt, m_srv_split_pos); AddLogLineN(wxEmptyString); AddLogLineN(wxT(" - ") + CFormat(_("This is aMule %s based on eMule.")) % GetMuleVersion()); AddLogLineN(wxT(" ") + CFormat(_("Running on %s")) % wxGetOsDescription()); AddLogLineN(wxT(" - ") + wxString(_("Visit http://www.amule.org to check if a new version is available."))); AddLogLineN(wxEmptyString); #ifdef ENABLE_IP2COUNTRY m_GeoIPavailable = true; m_IP2Country = new CIP2Country(thePrefs::GetConfigDir()); #else m_GeoIPavailable = false; #endif m_searchwnd = new CSearchDlg(p_cnt); m_transferwnd = new CTransferWnd(p_cnt); m_sharedfileswnd = new CSharedFilesWnd(p_cnt); m_statisticswnd = new CStatisticsDlg(p_cnt, theApp->m_statistics); m_chatwnd = new CChatWnd(p_cnt); m_kademliawnd = CastChild(wxT("kadWnd"), CKadDlg); m_serverwnd->Show(false); m_searchwnd->Show(false); m_transferwnd->Show(false); m_sharedfileswnd->Show(false); m_statisticswnd->Show(false); m_chatwnd->Show(false); // Create the GUI timer gui_timer=new wxTimer(this,ID_GUI_TIMER_EVENT); if (!gui_timer) { AddLogLineN(_("FATAL ERROR: Failed to create Timer")); exit(1); } // Set transfers as active window Create_Toolbar(thePrefs::VerticalToolbar()); SetActiveDialog(DT_TRANSFER_WND, m_transferwnd); m_wndToolbar->ToggleTool(ID_BUTTONDOWNLOADS, true ); bool override_where = (where != wxDefaultPosition); bool override_size = ( (dlg_size.x != DEFAULT_SIZE_X) || (dlg_size.y != DEFAULT_SIZE_Y) ); if (!LoadGUIPrefs(override_where, override_size)) { // Prefs not loaded for some reason, exit AddLogLineC(wxT("Error! Unable to load Preferences") ); return; } // Prepare the dialog, sets the splitter-position (AFTER window size is set) m_transferwnd->Prepare(); m_is_safe_state = true; // Init statistics stuff, better do it asap m_statisticswnd->Init(); m_kademliawnd->Init(); m_searchwnd->UpdateCatChoice(); if (thePrefs::UseTrayIcon()) { CreateSystray(); } Show(true); // Must we start minimized? if (thePrefs::GetStartMinimized()) { DoIconize(true); } // Set shortcut keys wxAcceleratorEntry entries[] = { wxAcceleratorEntry(wxACCEL_CTRL, wxT('Q'), wxID_EXIT) }; SetAcceleratorTable(wxAcceleratorTable(itemsof(entries), entries)); ShowED2KLinksHandler( thePrefs::GetFED2KLH() ); wxNotebook* logs_notebook = CastChild( ID_SRVLOG_NOTEBOOK, wxNotebook); wxNotebook* networks_notebook = CastChild( ID_NETNOTEBOOK, wxNotebook); wxASSERT(logs_notebook->GetPageCount() == 4); wxASSERT(networks_notebook->GetPageCount() == 2); for (uint32 i = 0; i < logs_notebook->GetPageCount(); ++i) { m_logpages[i].page = logs_notebook->GetPage(i); m_logpages[i].name = logs_notebook->GetPageText(i); } for (uint32 i = 0; i < networks_notebook->GetPageCount(); ++i) { m_networkpages[i].page = networks_notebook->GetPage(i); m_networkpages[i].name = networks_notebook->GetPageText(i); } DoNetworkRearrange(); }
wxAcceleratorEntry KeyboardShortcut::acceleratorEntry(const int id) const { return wxAcceleratorEntry(acceleratorFlags(), m_key, id); }
bool wxStEditApp::OnInit() { if (!wxApp::OnInit()) // parse command line return false; #ifdef _WX_DOCH__ wxDocManager* docManager = new wxDocManager(); wxSTEditorDocTemplate::Create(docManager); // now wxWidgets tracks all the files opened (wxDocManager::GetDocuments()) #endif SetAppName(STE_APPNAME); #if (wxVERSION_NUMBER >= 2900) SetAppDisplayName(STE_APPDISPLAYNAME); #endif wxLocaleHelper::Init(&m_locale, STE_APPNAME, m_lang); wxSTEditorOptions::SetGlobalDefaultFileName(wxString(_("unnamed")) + wxT(".txt")); // translated // Create a set of wxSTEditorOptions for your editing "system." // These options control what components will be automatically // created and/or managed for you. // Every STE window created will have its virtual function CreateOptions() called. // You can start with all the options "turned off" by using // the default constructor. // For this simple editor we'll basicly use the defaults for everything. // Note that we set it up in the wxStEditApp constructor since we adjust // it in OnCmdLineParsed() to use either a single editor or notebook. //m_steOptions = wxSTEditorOptions(STE_DEFAULT_OPTIONS, STS_DEFAULT_OPTIONS, // STN_DEFAULT_OPTIONS, STF_DEFAULT_OPTIONS); wxSTEditorOptions::RegisterIds(); // ======================================================================= // A sample of things that you might do to change the behavior // no bookmark items in menus or toolbar //m_steOptions.GetMenuManager()->SetMenuItemType(STE_MENU_BOOKMARK, false); //m_steOptions.GetMenuManager()->SetToolbarToolType(STE_MENU_BOOKMARK, false); // don't create a toolbar //m_steOptions.SetFrameOption(STF_TOOLBAR, false); // allow notebook to not have any pages //m_steOptions.SetNotebookOption(STN_ALLOW_NO_PAGES, true); // don't ask the user to save a modified document, close silently //m_steOptions.SetEditorOption(STE_QUERY_SAVE_MODIFIED, false); // Maybe we're editing only python files, set global initializers // wxSTEditorOptions::SetGlobalDefaultFileName(wxT("newfile.py")); // wxSTEditorOptions::SetGlobalDefaultFileExtensions(wxT("Python file (*.py)|*.py")); // maybe the editors that use these options are only for your ini files // m_steOptions.SetDefaultFileName(wxT("MyProgram.ini")); // Maybe you want your own special menu for the splitter? // it'll delete the old one (if there was one) and replace it with yours. // m_steOptions.SetSplitterPopupMenu(myMenu, false); // Maybe you want this editor to not use the global preferences, // create a new one, set it up the way you like it and push it onto the // options so that every new editor sharing these options will use it. // Remember, you can later detach a single editors to have them // use some other prefs/styles/langs with STE::RegisterXXX(otherXXX) // wxSTEditorPrefs myPrefs(true); // myPrefs.SetPrefBool(STE_PREF_VIEW_EOL, true); // m_steOptions.SetEditorPrefs(myPrefs); // You can do the same for the styles and langs, though the languages // are pretty generic and it probably won't be necessary. // Remember, the global versions are created to be used by a set of editors // they are created because if a user likes their editor a // certain way, you might as well make all of them look that way. // There is nothing special about them and if you want to see what the // defaults are just create a wxSTEditorPrefs/Styles/Langs(true). // etc... Ok, we set things up the way we like. // end sample code // ======================================================================= // Create a notebook to show the find results in m_steOptions.SetFrameOption(STF_CREATE_RESULT_NOTEBOOK, true); // Remove the Help menu since wxMac will pull out the wxID_ABOUT to add to // the system menu and then hide the Help menu. Later on when we add items // to the help menu, they'll be hidden too. m_steOptions.GetMenuManager()->SetMenuItems(STE_MENU_HELP_MENU, 0); // create with the readonly menuitem, not set by default since I don't think // it's generally useful, but good for debugging. m_steOptions.GetMenuManager()->SetMenuItemType(STE_MENU_EDIT_MENU, STE_MENU_EDIT_READONLY, true); m_steOptions.GetMenuManager()->SetToolbarToolType(STE_TOOLBAR_PRINT, true); m_steOptions.GetMenuManager()->SetToolbarToolType(STE_TOOLBAR_EDIT_SEARCH_CTRL, true); m_steOptions.SetNotebookOption(STN_ALPHABETICAL_TABS, false); // Ctrl+N -> append tabs to the right always m_steOptions.GetMenuManager()->GetAcceleratorArray()->Add(wxAcceleratorEntry(wxACCEL_NORMAL, WXK_HELP, ID_SHOW_HELP)); // adding 'custom' accelerator m_steOptions.GetMenuManager()->GetAcceleratorArray()->Add(wxAcceleratorHelper::GetStockAccelerator(wxID_ABOUT)); // adding 'custom' accelerator // ------------------------------------------------------------------------ m_frame = CreateMainFrame(); // ------------------------------------------------------------------------ // handle loading the files size_t n; wxArrayFileName badFileNames; wxArrayFileName fileNames = m_fileNames; // handle recursive file loading if (m_recurse_dirs && m_frame->GetEditorNotebook()) { size_t max_page_count = m_frame->GetEditorNotebook()->GetMaxPageCount(); wxArrayString recurseFileNames; for (n = 0; n < fileNames.GetCount(); n++) { wxFileName fN(fileNames[n]); fN.MakeAbsolute(); //wxPrintf(wxT("Loading file '%s' to '%s'\n"), fileNames[n].wx_str(), fN.GetFullPath().wx_str()); fflush(stdout); wxDir::GetAllFiles(fN.GetPath(), &recurseFileNames, fN.GetFullName()); // if they did wxstedit /r c:\*.* stop the insanity... if (recurseFileNames.GetCount() >= max_page_count) { wxString msg = wxString::Format(_("Opening %d files, unable to open any more."), (int)max_page_count); wxMessageBox(msg, _("Maximum number of files"), wxOK|wxICON_ERROR, m_frame); recurseFileNames.RemoveAt(max_page_count - 1, recurseFileNames.GetCount() - max_page_count); break; } } //for (n=0; n < recurseFileNames.GetCount(); n++) // { wxPrintf(wxT("Loading file '%s'\n"), recurseFileNames[n].wx_str()); fflush(stdout); } // delete all wildcards and replace them with the new files fileNames.Clear(); for (n = 0; n < recurseFileNames.GetCount(); n++) { fileNames.Add(wxFileName(recurseFileNames.Item(n))); // these are really the files to open } } // if the files have *, ? or are directories, don't try to load them for (n = 0; n < fileNames.GetCount(); n++) { if (wxIsWild(fileNames[n].GetFullPath())) { badFileNames.Add(fileNames[n]); fileNames.RemoveAt(n); n--; } else if (wxDirExists(fileNames[n].GetFullPath())) { fileNames.RemoveAt(n); n--; } } // If there are any good files left, try to load them if (fileNames.GetCount() > 0u) { if (fileNames[0].FileExists()) m_frame->GetEditor()->LoadFile( fileNames[0] ); else { // fix the path to the new file using the command line path wxFileName fn(fileNames[0]); fn.Normalize(); m_frame->GetEditor()->NewFile( fn.GetFullPath() ); } fileNames.RemoveAt(0); if (m_steOptions.HasFrameOption(STF_CREATE_NOTEBOOK) && fileNames.GetCount()) m_frame->GetEditorNotebook()->LoadFiles( &fileNames ); } //frame->ShowSidebar(false); //wxSTEditorOptions::m_path_display_format = wxPATH_UNIX; // trac.wxwidgets.org/ticket/11947 m_frame->Show(); m_frame->GetEditor()->SetFocus(); // filenames had *, ? or other junk so we didn't load them if (badFileNames.GetCount()) { wxString msg(_("There was a problem trying to load file(s):\n")); for (n = 0; n < badFileNames.GetCount(); n++) { msg += wxT("'") + badFileNames[n].GetFullPath() + wxT("'\n"); if ((n > 4) && (n < badFileNames.GetCount()-1)) { msg += wxT("..."); break; } } wxMessageBox(msg, _("Unable to load file(s)"), wxOK|wxICON_ERROR, m_frame); } return true; }