BOOL
InverseSearchOptionsPage::OnInitDialog ()
{
  BOOL ret = CPropertyPage::OnInitDialog();

  try
    {
      CollectEditors ();

      int idx = 0;

      for (vector<EditorInfo>::const_iterator it = editors.begin();
	   it != editors.end();
	   ++ it, ++ idx)
	{
	  if (g_pYapConfig->inverseSearchCommandLine
	      == editors[idx].GetCommandLine().c_str())
	    {
	      commandLineIdx = idx;
	    }
	  CString str = UT_(it->name.c_str());
	  if (idx < firstCustomIdx)
	    {
	      str += T_(_T(" (auto-detected)"));
	    }
	  if (editorListBox.AddString(str) < 0)
	    {
	      UNEXPECTED_CONDITION
		("InverseSearchOptionsPage::OnInitDialog");
	    }
	}

      if (commandLineIdx >= 0)
	{
	  if (editorListBox.SetCurSel(commandLineIdx) < 0)
	    {
	      UNEXPECTED_CONDITION
		("InverseSearchOptionsPage::OnInitDialog");
	    }
	  commandLineDisplay.SetWindowText
	    (UT_(editors[commandLineIdx].GetCommandLine().c_str()));
	}
      
      EnableButtons ();
    }

  catch (const MiKTeXException & e)
    {
      ErrorDialog::DoModal (0, e);
    }

  catch (const exception & e)
    {
      ErrorDialog::DoModal (0, e);
    }

  return (ret);
}
예제 #2
0
void
SiteWizRemote::InsertColumn (/*[in]*/ int		colIdx,
			     /*[in]*/ const char *	lpszLabel,
			     /*[in]*/ const char *	lpszLongest)
{
  if (listControl.InsertColumn(colIdx,
			       UT_(lpszLabel),
			       LVCFMT_LEFT,
			       listControl.GetStringWidth(UT_(lpszLongest)),
			       colIdx)
      < 0)
    {
      FATAL_WINDOWS_ERROR ("CListCtrl::InsertColumn", 0);
    }
}
void
InverseSearchOptionsPage::OnAddEditor ()
{
  try
    {
      AddChangeEditorDialog dlg (this, editors, firstCustomIdx);
      if (dlg.DoModal() == IDOK)
	{
	  EditorInfo editorInfo = dlg.GetEditorInfo();
	  editors.push_back (editorInfo);
	  if (editorListBox.AddString(UT_(editorInfo.name.c_str())) < 0)
	    {
	      UNEXPECTED_CONDITION
		("InverseSearchOptionsPage::OnAddEditor");
	    }
	  mustWrite = true;
	}
    }
  catch (const MiKTeXException & e)
    {
      ErrorDialog::DoModal (this, e);
    }
  catch (const exception & e)
    {
      ErrorDialog::DoModal (this, e);
    }
}
void
InverseSearchOptionsPage::OnSelChangeEditor ()
{
  try
    {
      int idx = editorListBox.GetCurSel();
      if (idx >= static_cast<int>(editors.size()))
	{
	  UNEXPECTED_CONDITION
	    ("InverseSearchOptionsPage::OnSelChangeEditor");
	}
      commandLineIdx = idx;
      if (idx >= 0)
	{
	  commandLineDisplay.SetWindowText
	    (UT_(editors[idx].GetCommandLine().c_str()));
	}
      else
	{
	  commandLineDisplay.SetWindowText (_T(""));
	}
      SetModified (TRUE);
      EnableButtons ();
    }
  catch (const MiKTeXException & e)
    {
      ErrorDialog::DoModal (this, e);
    }
  catch (const exception & e)
    {
      ErrorDialog::DoModal (this, e);
    }
}
예제 #5
0
BOOL
GotoPageDialog::OnInitDialog ()
{
  BOOL ret = CDialog::OnInitDialog();
  try
    {
      for (int pageIdx = 0; pageIdx < pDviDoc->GetPageCount(); ++ pageIdx)
	{
	  pageComboBox.AddString (UT_(pDviDoc->GetPageName(pageIdx)));
	}
      if (this->pageIdx >= 0)
	{
	  MIKTEX_ASSERT (this->pageIdx < pageComboBox.GetCount());
	  if (pageComboBox.SetCurSel(this->pageIdx) < 0)
	    {
	      UNEXPECTED_CONDITION ("GotoPageDialog::OnInitDialog");
	    }
	}
    }
  catch (const MiKTeXException & e)
    {
      ErrorDialog::DoModal (0, e);
    }
  catch (const exception & e)
    {
      ErrorDialog::DoModal (0, e);
    }
  return (ret);
}
예제 #6
0
void
SiteWizRemote::SetItemText (/*[in]*/ int		itemIdx,
			    /*[in]*/ int		colIdx,
			    /*[in]*/ const char *	lpszText)
{
  if (! listControl.SetItemText(itemIdx, colIdx, UT_(lpszText)))
    {
      FATAL_WINDOWS_ERROR ("CListCtrl::SetItemText", 0);
    }
}
예제 #7
0
void
InstallPackageDialog::FormatControlText
(/*[in]*/ UINT			ctrlId,
          /*[in]*/ const char *		lpszFormat,
          /*[in]*/			...)
{
    CWnd * pWnd = GetDlgItem(ctrlId);
    if (pWnd == 0)
    {
        UNEXPECTED_CONDITION ("InstallPackageDialog::FormatControlText");
    }
    va_list marker;
    va_start (marker, lpszFormat);
    string str = Utils::FormatString(lpszFormat, marker);
    va_end (marker);
    pWnd->SetWindowText (UT_(str.c_str()));
}
예제 #8
0
void
SplitUrl (/*[in]*/ const string &	url,
	  /*[out]*/ string &		protocol,
	  /*[out]*/ string &		host)
{
  _TCHAR szProtocol[200];
  _TCHAR szHost[200];
  URL_COMPONENTS url_comp = { 0 };
  url_comp.dwStructSize = sizeof(url_comp);
  url_comp.lpszScheme = szProtocol;
  url_comp.dwSchemeLength = 200;
  url_comp.lpszHostName = szHost;
  url_comp.dwHostNameLength = 200;
  if (! InternetCrackUrl(UT_(url.c_str()), 0, 0, &url_comp))
    {
      FATAL_WINDOWS_ERROR ("InternetCrackUrl", 0);
    }
  protocol = TU_(szProtocol);
  host = TU_(szHost);
}
예제 #9
0
void
RemoteRepositoryPage::SetProgressText (/*[in]*/ const char * lpszText)
{
  if (! listControl.DeleteAllItems())
    {
      FATAL_WINDOWS_ERROR ("CListCtrl::DeleteAllItems", 0);
    }
  LV_ITEM lvitem;
  lvitem.iItem = 0;
  lvitem.mask = 0;
  lvitem.iSubItem = 0;
  if (listControl.InsertItem(&lvitem) < 0)
    {
      FATAL_WINDOWS_ERROR ("CListCtrl::InsertItem", 0);
    }
  if (! listControl.SetItemText(0, 0, UT_(lpszText)))
    {
      FATAL_WINDOWS_ERROR ("CListCtrl::SetItemText", 0);
    }
  listControl.SetItemState (0, 0, LVIS_STATEIMAGEMASK);
}
예제 #10
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);
}
예제 #11
0
SecurityOptionsPage::SecurityOptionsPage() :
  CPropertyPage(SecurityOptionsPage::IDD),
  enableShellCommands(g_pYapConfig->enableShellCommands),
  secureCommands(UT_(g_pYapConfig->secureCommands))
{
}