void
InverseSearchOptionsPage::CollectEditors ()
{
  string program;
  string arguments;

  /// free editors

  if (MakeXEmacsCommandLine(program, arguments))
    {
      editors.push_back (EditorInfo(T_("XEmacs"), program, arguments));
    }
  
  if (MakeNTEmacsCommandLine(program, arguments))
    {
      editors.push_back (EditorInfo(T_("NTEmacs"), program, arguments));
    }

  if (MakeNTEmacsClientCommandLine(program, arguments))
    {
      editors.push_back (EditorInfo(T_("NTEmacs (Single Instance)"),
				    program,
				    arguments));
    }

  if (MakeTeXnicCenterCommandLine(program, arguments))
    {
      editors.push_back (EditorInfo(T_("TeXnicCenter"), program, arguments));
    }
  
  if (MakeVisualTeXCommandLine(program, arguments))
    {
      editors.push_back (EditorInfo(T_("Visual TeX"), program, arguments));
    }
  
  /// non-free editors

  if (MakeWinEdtCommandLine(program, arguments))
    {
      editors.push_back (EditorInfo(T_("WinEdt"), program, arguments));
    }

  if (MakeLaTeXMngCommandLine(program, arguments))
    {
      editors.push_back (EditorInfo(T_("LaTeXMng"), program, arguments));
    }

  if (MakeWinTeXXPCommandLine(program, arguments))
    {
      editors.push_back (EditorInfo(T_("WinTeX XP"), program, arguments));
    }

  if (MakeWinShellCommandLine(program, arguments))
    {
      editors.push_back (EditorInfo(T_("WinShell"), program, arguments));
    }

  if (MakeLaTeXWIDECommandLine(program, arguments))
    {
      editors.push_back (EditorInfo(T_("LaTeX WIDE"), program, arguments));
    }
  
  /// user-defined

  firstCustomIdx = static_cast<int>(editors.size());
  
  for (unsigned r = SessionWrapper(true)->GetNumberOfTEXMFRoots();
       r > 0;
       -- r)
    {
      PathName editorsIni = SessionWrapper(true)->GetRootDirectory(r - 1);
      editorsIni += MIKTEX_PATH_EDITORS_INI;
      if (File::Exists(editorsIni))
	{
	  SmartPointer<Cfg> pCfg (Cfg::Create());
	  pCfg->Read (editorsIni);
	  char szName[BufferSizes::MaxCfgName];
	  for (char * lpszName =
		 pCfg->FirstKey(szName, BufferSizes::MaxCfgName);
	       lpszName != 0;
	       lpszName = pCfg->NextKey(szName, BufferSizes::MaxCfgName))
	    {
	      editors.push_back
		(EditorInfo(lpszName,
			    pCfg->GetValue(lpszName, T_("program")),
			    pCfg->GetValue(lpszName, T_("arguments"))));
	    }
	}
    }
}
Пример #2
0
bool
SessionImpl::TryGetMiKTeXUserInfo (/*[out]*/ MiKTeXUserInfo & info)
{
  static TriState haveResult = TriState::Undetermined;
  static MiKTeXUserInfo result;
  if (haveResult == TriState::Undetermined)
  {
    haveResult = TriState::False;
    string userInfoFile;
    if (! TryGetConfigValue(0, MIKTEX_REGVAL_USERINFO_FILE, userInfoFile))
    {
      return (false);
    }
    if (! File::Exists(userInfoFile))
    {
      return (false);
    }
    SmartPointer<Cfg> pcfg (Cfg::Create());
    pcfg->Read (userInfoFile, true);
    if (! pcfg->TryGetValue("user", "id", result.id))
    {
      return (false);
    }
    if (! pcfg->TryGetValue("user", "name", result.name))
    {
      return (false);
    }
    if (! pcfg->TryGetValue("user", "organization", result.organization))
    {
      result.organization = "";
    }
    if (! pcfg->TryGetValue("user", "email", result.email))
    {
      result.email = "";
    }
    string str;
    if (pcfg->TryGetValue("membership", "expirationdate", str))
    {
      int year, month, day;
      if (sscanf(str.c_str(), "%d-%d-%d", &year, &month, &day) == 3
	  && year >= 1970
	  && month >= 1 && month <= 12
	  && day >= 1 || day <= 31)
      {
	struct tm date;
	memset (&date, 0, sizeof(date));
	date.tm_year = year - 1900;
	date.tm_mon = month - 1;
	date.tm_mday = day;
	date.tm_hour = 23;
	date.tm_min = 59;
	date.tm_sec = 59;
	date.tm_isdst = -1;
	result.expirationDate = mktime(&date);
      }
    }
    if (pcfg->TryGetValue("membership", "level", str))
    {
      if (StringCompare(str.c_str(), "individual", true) == 0)
      {
	result.level = MiKTeXUserInfo::Individual;
      }
      else
      {
	result.level = atoi(str.c_str());
      }
    }
    if (pcfg->TryGetValue("membership", "role", str))
    {
      if (StringCompare(str.c_str(), "developer", true) == 0)
      {
	result.role = MiKTeXUserInfo::Developer;
      }
      else if (StringCompare(str.c_str(), "contributor", true) == 0)
      {
	result.role = MiKTeXUserInfo::Contributor;
      }
      else if (StringCompare(str.c_str(), "sponsor", true) == 0)
      {
	result.role = MiKTeXUserInfo::Sponsor;
      }
      else if (StringCompare(str.c_str(), "knownuser", true) == 0)
      {
	result.role = MiKTeXUserInfo::KnownUser;
      }
      else
      {
	result.role = atoi(str.c_str());
      }
    }
    haveResult = TriState::True;
  }
  if (haveResult == TriState::True)
  {
    info = result;
    return (true);
  }
  return (false);
}
Пример #3
0
BOOL
SetupWizard::OnInitDialog () 
{
  BOOL ret = CPropertySheet::OnInitDialog();
  try
    {
      SetIcon (AfxGetApp()->LoadIcon(IDR_MAINFRAME), TRUE);
      CStringW title;
      if (theApp.isMiKTeXDirect)
	{
	  title.Format (T_(_T("MiKTeX %s Setup (%d-bit)")),
			static_cast<LPCTSTR>(UW_(MIKTEX_FULL_VERSION_STR)),
			static_cast<int>(sizeof(void*)) * 8);
	}
      else if (theApp.pSetupService->GetOptions().IsPrefabricated)
	{
	  PathName configFile (theApp.GetLocalPackageRepository());
	  configFile += "pr.ini";
	  SmartPointer<Cfg> pConfig (Cfg::Create());
	  pConfig->Read (configFile);
	  CString prefix;
	  CString version (MIKTEXTEXT(MIKTEX_SERIES_STR));
	  version += MIKTEXTEXT('.');
	  version += UT_(pConfig->GetValue("repository", "version").c_str());
	  switch (theApp.GetPackageLevel().Get())
	    {
	    case PackageLevel::Essential:
	      prefix = T_("Essential ");
	      break;
	    case PackageLevel::Basic:
	      prefix = T_("Basic ");
	      break;
	    case PackageLevel::Complete:
	      prefix = "";
	      break;
	    default:
	      MIKTEX_ASSERT (false);
	      __assume (false);
	      break;
	    }
	  title.Format (T_(_T("%sMiKTeX %s Installer (%d-bit)")),
			static_cast<LPCTSTR>(prefix),
			static_cast<LPCTSTR>(version),
			static_cast<int>(sizeof(void*)) * 8);
	}
      else
	{
	  title.Format (T_(_T("MiKTeX %s Net Installer (%d-bit)")),
			static_cast<LPCTSTR>(UW_(MIKTEX_VERSION_STR)),
			static_cast<int>(sizeof(void*)) * 8);
	}
      SetTitle (title);
      SetActivePage (&m_License);
    }
  catch (const MiKTeXException & e)
    {
      ReportError (e);
    }
  catch (const exception & e)
    {
      ReportError (e);
    }
  return (ret);
}