LRESULT CSettingsDlg::OnClickedOK(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
{
	if(GetFocus() == GetDlgItem(IDOK))
	{
		CWindow* pWnd;
		TC_ITEM tci;
		tci.mask = TCIF_PARAM;
		int cnt = m_tab_ctrl.GetItemCount();
		for (int i = cnt - 1; i >= 0; i--)
		{ 
			m_tab_ctrl.GetItem(i, &tci);
			pWnd = (CWindow*)tci.lParam;
			if(pWnd)
			{
				pWnd->SendMessage(WM_COMMAND, MAKELONG(IDOK, 0), 0);
			}
		}	
		EndDialog(wID);
	}
	else
	{
		int nTab = m_tab_ctrl.GetCurSel(); 
		TC_ITEM tci; 
		tci.mask = TCIF_PARAM; 
		m_tab_ctrl.GetItem(nTab, &tci); 
		CWindow* pWnd = (CWindow*)tci.lParam; 
		if(pWnd)
		{
			pWnd->SendMessage(WM_COMMAND, MAKELONG(IDOK, 0), 0);
			pWnd->ShowWindow(SW_SHOW);
		}
	}

	return 0;
}
Beispiel #2
0
void CMainDlg::Log(LPCTSTR psz)
{
	CWindow wndEdit = GetDlgItem(IDC_LOG);
	int len = wndEdit.GetWindowTextLength();
	wndEdit.SendMessage(EM_SETSEL, len, len);
	wndEdit.SendMessage(EM_REPLACESEL, FALSE, reinterpret_cast<LPARAM>(psz));
}
Beispiel #3
0
LRESULT CMainDlg::OnTest(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
{
	CWindow wndEdit = GetDlgItem(IDC_LOG);
	int len = wndEdit.GetWindowTextLength();
	wndEdit.SendMessage(EM_SETSEL, 0, len);
	wndEdit.SendMessage(EM_REPLACESEL, FALSE, NULL);
	return S_OK;
}
void CMainDlg::Log(LPCTSTR psz)
{
	//CString strDebug;
	//strDebug.Format("%s\n", psz);
	
	CWindow wndEdit = GetDlgItem(IDC_LOG);
	int len = wndEdit.GetWindowTextLength();
	wndEdit.SendMessage(EM_SETSEL, len, len);
	wndEdit.SendMessage(EM_REPLACESEL, FALSE, reinterpret_cast<LPARAM>(psz));
	//wndEdit.SendMessage(EM_REPLACESEL, FALSE, reinterpret_cast<LPARAM>(strDebug.GetBuffer(strDebug.GetLength())));
}
LRESULT CSkinScrollWnd::OnVThumbTrack( UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled )
{
	if ( FALSE == ::IsWindow ( ( HWND ) lParam ) )
	{
		return 0;
	}
	CScrollBar ScrollBarWnd;
	ScrollBarWnd.Attach ( ( HWND ) lParam );
	CWindow Wnd = m_MidWnd.GetWindow ( GW_CHILD );
	INT32 nPos =  wParam ;
	m_bOperation = TRUE;
	if ( m_nPos != nPos )
	{
		Wnd.SendMessage ( WM_VSCROLL, MAKELONG ( SB_THUMBTRACK, nPos ), nPos  );
	}
	m_nPos = nPos;
	m_bOperation = FALSE;
	SCROLLINFO SInfo = { 0x00 };
	SInfo.cbSize = sizeof ( SInfo );
	SInfo.fMask = SIF_ALL;
	::GetScrollInfo ( Wnd.m_hWnd, SB_VERT, &SInfo );
	ScrollBarWnd.SetScrollInfo ( &SInfo );

	return 0;
}
//////////////////////////////////////////////////////////////////////////
// Windows Event Handler
//////////////////////////////////////////////////////////////////////////
LRESULT CSkinScrollWnd::OnHScroll ( UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled )
{
	if ( FALSE == ::IsWindow ( ( HWND ) lParam ) )
	{
		return S_OK;
	}

	CScrollBar ScrollBarWnd;

	ScrollBarWnd.Attach ( ( HWND ) lParam );

	CWindow Wnd = m_MidWnd.GetWindow ( GW_CHILD );

	INT32 nSBCode = LOWORD ( wParam );

	INT32 nPos = HIWORD ( wParam );

	m_bOperation = TRUE;
	Wnd.SendMessage ( WM_HSCROLL, MAKELONG ( nSBCode, nPos ), 0 );
	m_bOperation = FALSE;

	SCROLLINFO SInfo = { 0x00 };
	SInfo.cbSize = sizeof ( SInfo );
	SInfo.fMask = SIF_ALL;
	::GetScrollInfo ( Wnd.m_hWnd, SB_HORZ, &SInfo );
	ScrollBarWnd.SetScrollInfo ( &SInfo );

	return S_OK;
}
LRESULT CSettingsDlg::OnClickedCancel(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
{
	int nTab = m_tab_ctrl.GetCurSel();
	int lres = 1;

	if(nTab != 3)
	{
		if(_Settings.m_initial_scripts_folder != _Settings.GetScriptsFolder())
		{
			_Settings.SetScriptsFolder(_Settings.m_initial_scripts_folder, true);
		}

		CWindow* pWnd;
		TC_ITEM tci;
		tci.mask = TCIF_PARAM;
		int cnt = m_tab_ctrl.GetItemCount();
		for (int i = cnt - 1; i >= 0; i--)
		{ 
			m_tab_ctrl.GetItem(i, &tci);
			pWnd = (CWindow*)tci.lParam;
			if(pWnd)
			{
				pWnd->SendMessage(WM_COMMAND, MAKELONG(IDCANCEL, 0), 0);
			}
		}
	}
	else
	{
		TC_ITEM tci; 
		tci.mask = TCIF_PARAM;

		m_tab_ctrl.GetItem(nTab, &tci); 
		CWindow* pWnd = (CWindow*)tci.lParam; 
		if(pWnd)
		{
			lres = pWnd->SendMessage(WM_COMMAND, MAKELONG(IDCANCEL, 0), 0);
		}
	}

	if(lres)
		EndDialog(wID);

	return 0;
}
Beispiel #8
0
bool CControlPage::GetSelectedListboxText(int lboxId, string& selectedText)
{
  CWindow lbox = GetDlgItem(m_hwnd, lboxId);
  int iSelection = lbox.SendMessage(LB_GETCURSEL, 0, 0);
  if (iSelection == LB_ERR)
	return false;

  int iLength = lbox.SendMessage(LB_GETTEXTLEN, iSelection, 0);
  if (iLength == LB_ERR)
	return false;

  TCHAR* szData = new TCHAR[iLength + 1];
  int iLen2 = lbox.SendMessage(LB_GETTEXT, iSelection, (LPARAM)szData);
  if (iLen2 == LB_ERR) {
	delete[] szData;
	return false;
  }
  WinUTF8::wstring_to_UTF8string(szData, selectedText);
  delete[] szData;
  return true;

}
Beispiel #9
0
// **************************************************************************
//
// CMainWindow::TranslateAccelerator
//
// Required to forward messages to the PIEWebBrowser control (and any other
// ActiveX controls that may be added to the main window's design).
//
// **************************************************************************
BOOL CMainWindow::TranslateAccelerator(MSG* pMsg)
{
#if defined( OS_WINCE) && !defined( OS_PLATFORM_MOTCE )
	if (pMsg->message == WM_CONTEXTMENU){
		/*
		CMenuHandle menu;
		menu.LoadMenu(IDR_MAIN_MENU);
		menu = menu.GetSubMenu(0);
		return menu.TrackPopupMenu( TPM_CENTERALIGN | TPM_VERTICAL, LOWORD(pMsg->lParam), HIWORD(pMsg->lParam), m_hWnd);
		*/
		
		return TRUE;
	}

	if (m_bFullScreen && pMsg->message == WM_KEYUP && 
		(pMsg->wParam == VK_F1 ||  pMsg->wParam == VK_F2))
	        SetFullScreen(false);
#endif

    // Accelerators are only keyboard or mouse messages
    UINT uMsg = pMsg->message;
    if (!(WM_KEYFIRST   <= uMsg && uMsg <= WM_KEYLAST) &&
        !(WM_MOUSEFIRST <= uMsg && uMsg <= WM_MOUSELAST))
    {

#ifdef OS_WINCE			
        if ( uMsg == WM_HOTKEY )
        {
            int idHotKey = (int) pMsg->wParam; 
            int fuModifiers = (UINT) LOWORD(pMsg->lParam); 
            int uVirtKey = (UINT) HIWORD(pMsg->lParam);

            if ( uVirtKey == VK_ESCAPE ){
                if ( fuModifiers&MOD_KEYUP )
                    RHODESAPP().navigateBack();
                    //PostMessageW(WM_COMMAND,MAKEWPARAM(IDM_BACK,1),NULL);

                return TRUE;
            }
        }
#endif //OS_WINCE

        return FALSE;
    }

    if (NULL == m_hWnd)
    {
        return FALSE;
    }

    // Find a direct child of this window from the window that has focus.
    // This will be AtlAxWin window for the hosted control.
    CWindow control = ::GetFocus();
    if (IsChild(control) && m_hWnd != control.GetParent())
    {
        do
        {
            control = control.GetParent();
        } while (m_hWnd != control.GetParent());
    }

    // Give the control (via the AtlAxWin) a chance to translate this message
    if (control.m_hWnd && control.SendMessage(WM_FORWARDMSG, 0, (LPARAM)pMsg))
    {
        return TRUE;
    }

    // If the main window used accelerators, we could have called the global
    // ::TranslateAccelerator() function here, instead of simply returning FALSE.
    return FALSE;
}
Beispiel #10
0
void CAdvancedPage::PopulateList() {
  // Populate the controls in the dialogue box based on the relevent parameters
  for(int ii = 0; ii<sizeof(menutable)/sizeof(menuentry); ii++)
  {
    if(m_pAppSettings->GetBoolParameter(menutable[ii].paramNum)) {
      SendMessage(GetDlgItem(m_hwnd, menutable[ii].idcNum), BM_SETCHECK, BST_CHECKED, 0);
    }
    else  {
      SendMessage(GetDlgItem(m_hwnd, menutable[ii].idcNum), BM_SETCHECK, BST_UNCHECKED, 0);
    }
  }

  
  switch(m_pAppSettings->GetLongParameter(APP_LP_STYLE)) {
    case APP_STYLE_TRAD:
      SendMessage(GetDlgItem(m_hwnd, IDC_STYLE_STANDALONE), BM_SETCHECK, BST_CHECKED, 0);
      break;
    case APP_STYLE_COMPOSE:
      SendMessage(GetDlgItem(m_hwnd, IDC_STYLE_COMPOSITION), BM_SETCHECK, BST_CHECKED, 0);
      break;
    case APP_STYLE_DIRECT:
      SendMessage(GetDlgItem(m_hwnd, IDC_STYLE_DIRECT), BM_SETCHECK, BST_CHECKED, 0);
      break;
    case APP_STYLE_FULLSCREEN:
      SendMessage(GetDlgItem(m_hwnd, IDC_STYLE_FULL), BM_SETCHECK, BST_CHECKED, 0);
      break;
  }

  HWND ListBox = GetDlgItem(m_hwnd, IDC_CONTROLBOXES);
  auto CurrentControlBox = m_pAppSettings->GetStringParameter(SP_CONTROL_BOX_ID);
  // Add each string to list box and index each one
  bool SelectionSet = false;
  for (auto i = 0; i < m_ControlBoxItems.size(); i++) {
    Tstring Item;
    WinUTF8::UTF8string_to_wstring(m_ControlBoxItems[i], Item);
    if (Item.empty())
      Item = L"<default>";
    LRESULT Index = SendMessage(ListBox, LB_ADDSTRING, 0, (LPARAM)Item.c_str());
    SendMessage(ListBox, LB_SETITEMDATA, Index, (LPARAM)i);
    if (m_ControlBoxItems[i] == CurrentControlBox) {
      SendMessage(ListBox, LB_SETCURSEL, Index, 0);
      SelectionSet = true;
    }
  }
  if (SelectionSet == false) {
    SendMessage(ListBox, LB_SETCURSEL, 0, 0);
    LRESULT CurrentIndex = SendMessage(ListBox, LB_GETITEMDATA, 0, 0);
  }

 CWindow fileEncodingCb = GetDlgItem(m_hwnd, IDC_FILE_ENCODING);
 fileEncodingCb.SendMessage(CB_ADDSTRING, 0, (LPARAM)L"Windows Locale Encoding");
 fileEncodingCb.SendMessage(CB_ADDSTRING, 0, (LPARAM)L"UTF-8");
 fileEncodingCb.SendMessage(CB_ADDSTRING, 0, (LPARAM)L"Unicode little endian / UTF-16 LE");
 fileEncodingCb.SendMessage(CB_ADDSTRING, 0, (LPARAM)L"Unicode big endian / UTF-16 BE");

  switch (m_pAppSettings->GetLongParameter(APP_LP_FILE_ENCODING)) {
  case Opts::UTF8: 
    fileEncodingCb.SendMessage(CB_SETCURSEL, 1, 0);
    break;
  case Opts::UTF16LE: 
    fileEncodingCb.SendMessage(CB_SETCURSEL, 2, 0);
    break;
  case Opts::UTF16BE: 
    fileEncodingCb.SendMessage(CB_SETCURSEL, 3, 0);
    break;
  default:
    fileEncodingCb.SendMessage(CB_SETCURSEL, 0, 0);
    break;
  }
}
Beispiel #11
0
void CControlPage::PopulateList() {
  // Populate the controls in the dialogue box based on the relevent parameters
  // in m_pDasher

  SB_slider = GetDlgItem(m_hwnd, IDC_SPEEDSLIDER);

  SendMessage(SB_slider, TBM_SETPAGESIZE, 0L, 20);      // PgUp and PgDown change bitrate by reasonable amount
  SendMessage(SB_slider, TBM_SETTICFREQ, 100, 0L);
  SendMessage(SB_slider, TBM_SETRANGE, FALSE, (LPARAM)MAKELONG(10, 800));

  speedbox = GetDlgItem(m_hwnd, IDC_SPEEDVAL);

  SendMessage(SB_slider, TBM_SETPOS, TRUE, (LPARAM)m_pAppSettings->GetLongParameter(LP_MAX_BITRATE));
  _sntprintf(m_tcBuffer, 100, TEXT("%0.2f"), m_pAppSettings->GetLongParameter(LP_MAX_BITRATE) / 100.0);
  SendMessage(speedbox, WM_SETTEXT, 0, (LPARAM)m_tcBuffer);

  m_hMousePosStyle = GetDlgItem(m_hwnd, IDC_MOUSEPOS_STYLE);
  SendMessage(m_hMousePosStyle, CB_ADDSTRING, 0, (LPARAM)L"Centre circle");
  SendMessage(m_hMousePosStyle, CB_ADDSTRING, 0, (LPARAM)L"Two box");

  if (m_pAppSettings->GetBoolParameter(BP_MOUSEPOS_MODE)) {
    SendMessage(m_hMousePosStyle, CB_SETCURSEL, 1, 0);
  }
  else {
    SendMessage(m_hMousePosStyle, CB_SETCURSEL, 0, 0);
  }

  if (m_pAppSettings->GetBoolParameter(BP_MOUSEPOS_MODE) || m_pAppSettings->GetBoolParameter(BP_CIRCLE_START)) {
    SendMessage(GetDlgItem(m_hwnd, IDC_MOUSEPOS), BM_SETCHECK, BST_CHECKED, 0);
  }
  else {
    SendMessage(GetDlgItem(m_hwnd, IDC_MOUSEPOS), BM_SETCHECK, BST_UNCHECKED, 0);
  }

  // all the button checkboxes
  for (int ii = 0; ii < sizeof(menutable) / sizeof(menuentry); ii++)
  {
    if (m_pAppSettings->GetBoolParameter(menutable[ii].paramNum))
    {
      SendMessage(GetDlgItem(m_hwnd, menutable[ii].idcNum), BM_SETCHECK, BST_CHECKED, 0);
    }
    else
    {
      SendMessage(GetDlgItem(m_hwnd, menutable[ii].idcNum), BM_SETCHECK, BST_UNCHECKED, 0);
    }
  }

  // List entries:

  for (int i(0); i < sizeof(listtable) / sizeof(menuentry); ++i) {
    std::vector<std::string> vValues;
    m_pAppSettings->GetPermittedValues(listtable[i].paramNum, vValues);
    CWindow lbox = GetDlgItem(m_hwnd, listtable[i].idcNum);
    auto currentParameterValue = m_pAppSettings->GetStringParameter(listtable[i].paramNum);
    for (auto value : vValues) {
      wstring Item;
      WinUTF8::UTF8string_to_wstring(value, Item);
      int iIdx = lbox.SendMessage(LB_ADDSTRING, 0, (LPARAM)Item.c_str());

      if (value == currentParameterValue)
        lbox.SendMessage(LB_SETCURSEL, iIdx, 0);
    }
  }
  EnablePrefferencesForSelectedModule(IDC_CONTROL_LIST, IDC_BUTTON_PREFS);
  EnablePrefferencesForSelectedModule(IDC_INPUT_LIST, IDC_BUTTON_PREFS2);
}