Ejemplo n.º 1
0
void CCheckEngineTabDlg::AppendErrorsList(size_t i_id, const _TSTRING& i_bc, const _TSTRING& i_description, bool i_state /* = false */)
{
 m_errors_list.InsertItem(m_list_next_item_index,_T(""));
 m_errors_list.SetItemText(m_list_next_item_index, 1, i_bc.c_str());
 m_errors_list.SetItemText(m_list_next_item_index, 2, i_description.c_str());
 m_errors_list.SetCheck(m_list_next_item_index, i_state);
 m_list_items_indexes.insert(Indexes::value_type(i_id, m_list_next_item_index));
 m_list_next_item_index++;
}
void CLogPlayerTabController::_OpenFile(const _TSTRING& fileName)
{
 HANDLE   hFile = NULL;
 static TCHAR BASED_CODE szFilter[] = _T("CSV Files (*.csv)|*.csv|All Files (*.*)|*.*||");
 CFileDialog open(TRUE, NULL, NULL, NULL, szFilter, NULL);

 if (fileName.empty() && open.DoModal() != IDOK)
  return; //пользователь передумал

 mp_log_reader->SetSeparatingSymbol(mp_settings->GetCSVSepSymbol());

 LogReader::FileError error_id;
 _TSTRING file_path = fileName.empty() ? open.GetPathName().GetBuffer(0) : fileName;
 bool result = mp_log_reader->OpenFile(file_path, error_id);
 if (false==result)
 {
  if (error_id==LogReader::FE_OPEN)
   AfxMessageBox(MLL::LoadString(IDS_LP_CANT_OPEN_FILE));
  else if (error_id==LogReader::FE_FORMAT)
  {
   AfxMessageBox(MLL::LoadString(IDS_LP_INCORRECT_FILE_FORMAT));
  }
  else
   ASSERT(0);

  mp_log_reader->CloseFile();
  return; //не можем продолжать, так как произошла ошибка
 }

 ////////////////////////////////////////////////////////////////
 mp_view->mp_LPPanelDlg->SetOpenFileButtonText(MLL::GetString(IDS_LP_CLOSE_FILE));

 //obtain file name from full path
 TCHAR stripped_name[MAX_PATH+1] = {0};
 file_path.copy(stripped_name, file_path.size());
 PathStripPath(stripped_name);

 CString string;
 string.Format(MLL::LoadString(IDS_LP_FILE_INFO_FMT_STRING), stripped_name, mp_log_reader->GetCount());
 mp_view->mp_LPPanelDlg->SetFileIndicator(string.GetBuffer(0));

 mp_view->mp_MIDeskDlg->Enable(true);
 mp_view->mp_CEDeskDlg->Enable(true);
 mp_view->mp_LMDeskDlg->Enable(true);
 mp_view->mp_LPPanelDlg->EnableAll(true);
 mp_view->mp_OScopeCtrl->EnableWindow(true);

 //инициализируем логику плеера и начинаем сразу проигрывать
 if (mp_log_reader->GetCount() > 0)
 {
  _InitPlayer();
  _Play(true);
 }
 ////////////////////////////////////////////////////////////////
}
Ejemplo n.º 3
0
bool CToolTipCtrlEx::UpdateText(CWnd* pWnd, const _TSTRING& text)
{
 TOOLINFO ti;
 ti.cbSize = sizeof (TOOLINFO);
 ti.uFlags = TTF_IDISHWND;
 ti.hwnd = pWnd->GetParent ()->GetSafeHwnd ();
 ti.uId = (UINT) pWnd->GetSafeHwnd ();
 ti.hinst = AfxGetInstanceHandle ();
 ti.lpszText = const_cast<TCHAR*>(text.c_str()); 

 return (bool)SendMessage(TTM_UPDATETIPTEXT, 0, (LPARAM) &ti);
}
Ejemplo n.º 4
0
CPropertyGridInPlaceEdit::CPropertyGridInPlaceEdit(CWnd* pParent, CRect& rect, DWORD dwStyle, UINT nID, _TSTRING sInitText, const InplaceEditParamsEx* ip_ex_params /*= NULL*/)
{
 m_sInitText     = sInitText.c_str();
 m_bExitOnArrows = FALSE;
 m_Rect = rect;  // For bizarre CE bug.

 DWORD dwEditStyle = WS_CHILD|ES_AUTOHSCROLL|dwStyle;
 CRect edit_rect;
 edit_rect = rect;

 if (NULL!=ip_ex_params && ip_ex_params->m_spin)
  edit_rect.right -= 20;

 if (!Create(dwEditStyle, edit_rect, pParent, nID))
  return;

 m_clrBack = GetSysColor(COLOR_WINDOW);
 m_clrText = GetSysColor(COLOR_WINDOWTEXT);
 m_Brush.CreateSolidBrush(m_clrBack);

 SetFont(pParent->GetFont());
 SetWindowText(m_sInitText);
 SetFocus();

 if (NULL!=ip_ex_params)
 {
  SetMode(ip_ex_params->m_mode);
  SetDecimalPlaces(ip_ex_params->m_decimal_places);
  if (ip_ex_params->m_limit_text!=-1)
   SetLimitText(ip_ex_params->m_limit_text);

  if (ip_ex_params->m_spin)
  {
   CRect spin_rect;
   spin_rect = rect;
   spin_rect.left = spin_rect.right - 20;
   m_spin.Create(WS_CHILD|WS_VISIBLE|UDS_ARROWKEYS, spin_rect, pParent, nID + 1);
   m_spin.SetBuddy(this);
   m_spin.SetRangeAndDelta(ip_ex_params->m_lower,ip_ex_params->m_upper,ip_ex_params->m_delta);

   if (ip_ex_params->m_decimal_places!=-1)
   {
    float value;
    GetValue(value);
    SetValue(value);
   }
  }
 }

 SetSel(0, -1);
 SetSel(-1, 0);
}
Ejemplo n.º 5
0
bool CToolTipCtrlEx::AddRectangle(CWnd* pWnd, const _TSTRING& text, LPCRECT pRect, UINT nIDTool)
{
 TOOLINFO ti;
 ti.cbSize = sizeof (TOOLINFO);
 ti.uFlags = TTF_SUBCLASS;
 ti.hwnd = pWnd->GetSafeHwnd ();
 ti.uId = nIDTool;
 ti.hinst = AfxGetInstanceHandle ();
 ti.lpszText = const_cast<TCHAR*>(text.c_str());
 ::CopyRect (&ti.rect, pRect);

 return (bool)SendMessage(TTM_ADDTOOL, 0, (LPARAM) &ti);
}
bool CPropertyGridDirectoryPicker::PickDirectory(_TSTRING &directory, HWND hwnd)
{
 TCHAR pszBuffer[MAX_PATH];
 pszBuffer[0] = '\0';

 // Gets the Shell's default allocator
 LPMALLOC pMalloc;
 if (::SHGetMalloc(&pMalloc) == NOERROR)
 {
  BROWSEINFO bi;
  LPITEMIDLIST pidl;

  // Get help on BROWSEINFO struct
  bi.hwndOwner = hwnd;
  bi.pidlRoot = NULL;
  bi.pszDisplayName = pszBuffer;
  bi.lpszTitle = m_strTitle.c_str();
  bi.ulFlags = BIF_RETURNFSANCESTORS | BIF_RETURNONLYFSDIRS | BIF_NEWDIALOGSTYLE ;

  // The callback function initialises the dialog with the passed value
  bi.lpfn = BrowseCallbackProc;
  bi.lParam = LPARAM(directory.c_str());

  // This next call issues the dialog box.
  if ((pidl = ::SHBrowseForFolder(&bi)) != NULL)
  {
   // Get the full path into pszBuffer
   ::SHGetPathFromIDList(pidl, pszBuffer);
   // Free the PIDL allocated by SHBrowseForFolder.
   pMalloc->Free(pidl);
  }
  // Release the shell's allocator.
  pMalloc->Release();
 }

 // get the result
 if (_tcslen(pszBuffer) != 0)
 {
  directory = pszBuffer;
  return TRUE;
 }
 return FALSE;
}
Ejemplo n.º 7
0
void CMapImpExpDlg::SetExchangeButtonCaption(const _TSTRING& i_text)
{
 m_exchange_button.SetWindowText(i_text.c_str());
}
Ejemplo n.º 8
0
void CMapImpExpDlg::SetFWDOtherListTitle(const _TSTRING& i_title)
{
 m_other_fwd_title_string = i_title.c_str();
 UpdateData(FALSE);
}
Ejemplo n.º 9
0
void CMapImpExpDlg::SetFWDCurrentListTitle(const _TSTRING& i_title)
{
 m_current_fwd_title_string = i_title.c_str();
 UpdateData(FALSE);
}
Ejemplo n.º 10
0
//"Set" methods (model => view data transfer)
void CAppSettingsDlg::SetPortName(_TSTRING i_PortName)
{
 int result = m_port_selection_combo.FindString(-1,i_PortName.c_str());
 if (result!=LB_ERR)
  m_port_number = result;
}
Ejemplo n.º 11
0
void CFirmwareTabDlg::SetFirmwareName(_TSTRING i_name)
{
 m_fw_name.SetWindowText(i_name.c_str());
}