Пример #1
0
bool wxExViMacros::SetRegister(const char name, const std::string& value)
{
  if (!isalnum(name) && !isdigit(name) && 
       name != '%' && name != '_' && name != '*' && name != '.')
  {
    return false;
  }
  
  if (name == '*')
  {
    wxExClipboardAdd(value);
    return true;
  }

  std::vector<std::string> v;
  
  // The black hole register, everything written to it is discarded.
  if (name != '_')
  {
    if (wxIsupper(name))
    {
      v.emplace_back(GetRegister(tolower(name)) + value);
    }
    else
    {
      v.emplace_back(value);
    }
  }
  
  m_Macros[std::string(1, (char)tolower(name))] = v;
  m_IsModified = true;
  
  return true;
}
Пример #2
0
void wxExGenericDirCtrl::OnCommand(wxCommandEvent& event)
{
  wxArrayString files;
  GetPaths(files);
    
  if (event.GetId() > ID_EDIT_VCS_LOWEST && 
      event.GetId() < ID_EDIT_VCS_HIGHEST)
  {
    wxExVCSExecute(m_Frame, event.GetId(), files);
  }
  else if (event.GetId() > ID_TOOL_LOWEST && event.GetId() < ID_TOOL_HIGHEST)
  {
    m_Frame->FindInFiles(files, event.GetId());
  }
  else switch (event.GetId())
  {
  case ID_TREE_COPY: 
    {
    wxBusyCursor wait;
    wxString clipboard;
    for (
#ifdef wxExUSE_CPP0X	
      auto it = files.begin();
#else
      wxArrayString::iterator it = files.begin();
#endif	  
      it != files.end();
      ++it)
    {
      clipboard += *it + wxTextFile::GetEOL();
    }
    wxExClipboardAdd(clipboard);
    }
  break;
  
  case ID_TREE_OPEN: 
    wxExOpenFiles(m_Frame, files, 0, wxDIR_FILES); // only files in this dir
  break;
  
  case ID_TREE_RUN_MAKE: 
    wxExMake(m_Frame, files[0]);
    break;
    
  default: wxFAIL;
  }
}