void FrameProcessor::timerEvent(QTimerEvent * ev) { if (ev->timerId() != _timer.timerId()) return; ShowCurrent(); }
LRESULT CItemBrowserDlg::OnSourceSelChange (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled) { ShowCurrent (); return TRUE; }
LRESULT CItemBrowserDlg::OnCbnSelchangeBrowseFor (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled) { ShowCurrent (); return TRUE; }
LRESULT CItemBrowserDlg::OnInitDialog (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled) { CString str; // // Center the dialog // CenterWindow (); // // Get the controls // m_tv = GetDlgItem (IDC_ITEMS); m_cbSource = GetDlgItem (IDC_SOURCE); m_cbBrowseFor = GetDlgItem (IDC_BROWSE_FOR); m_statBrowseFor = GetDlgItem (IDC_BROWSE_FOR_STATIC); // // Initialize browse for // switch (m_nBrowseWhat) { case Browse_What_Items: str .LoadString (IDS_BROWSE_FOR_ITEMS); m_cbBrowseFor .AddString (str); break; case Browse_What_Encounters: str .LoadString (IDS_BROWSE_FOR_ENCOUNTERS); m_cbBrowseFor .AddString (str); break; case Browse_What_Placeables: str .LoadString (IDS_BROWSE_FOR_PLACEABLES); m_cbBrowseFor .AddString (str); break; case Browse_What_EncPlace: str .LoadString (IDS_BROWSE_FOR_ENCOUNTERS); m_cbBrowseFor .AddString (str); str .LoadString (IDS_BROWSE_FOR_PLACEABLES); m_cbBrowseFor .AddString (str); break; } m_cbBrowseFor .SetCurSel (0); if (m_cbBrowseFor .GetCount () <= 1) { m_cbBrowseFor .EnableWindow (false); m_statBrowseFor .EnableWindow (false); } // // If we don't have a NWN directory, initialize // if (g_strNwnDirectory .IsEmpty ()) { // // Open the NWN registry key // CRegKey rkParent; LONG lRet = rkParent .Open (HKEY_LOCAL_MACHINE, _T ("SOFTWARE\\BioWare\\NWN\\Neverwinter"), KEY_READ); // // Read the key // if (lRet == ERROR_SUCCESS) { TCHAR szText [_MAX_PATH]; DWORD dwLen = _MAX_PATH; lRet = rkParent .QueryStringValue (_T ("Location"), szText, &dwLen); if (lRet == ERROR_SUCCESS) { g_strNwnDirectory = szText; g_strNwnDirectory += _T ("\\"); } } // // If we are still ok // if (lRet == ERROR_SUCCESS) { // // Open the key and dialog files // { CWaitCursor sWC; g_sStdLoader .Initialize (g_strNwnDirectory); g_sDialogTlkFile .Open (g_strNwnDirectory + _T ("dialog.tlk")); } // // Get the module directory // TCHAR szText [_MAX_PATH]; ::GetPrivateProfileString (_T ("Alias"), _T ("Modules"), _T (""), szText, _countof (szText), g_strNwnDirectory + _T ("nwn.ini")); if (szText [0]) { g_strNwnModuleDir = g_strNwnDirectory + szText + _T ("\\"); } } } // // If the NWN files opened // if (g_sDialogTlkFile .IsOpen ()) { CString str; // // The combo box beings with NWN // str .LoadString (IDS_NWN); m_cbSource .AddString (str); // // Get a list of the mods // CAtlArray <CString> vstr; CString strPath = g_strNwnModuleDir + "*.mod"; WIN32_FIND_DATA fileData; HANDLE hSearch = FindFirstFile (strPath, &fileData); if (hSearch != INVALID_HANDLE_VALUE) { while (true) { vstr .Add (CString (fileData .cFileName)); if (!FindNextFile (hSearch, &fileData)) break; } FindClose (hSearch); } // // Sort the list the stupid way // bool fSwapped = true; while (fSwapped) { fSwapped = false; for (int i = 0; i < ((int) vstr .GetCount ()) - 1; i++) { if (vstr [i] > vstr [i+1]) { fSwapped = true; str = vstr [i]; vstr [i] = vstr [i+1]; vstr [i+1] = str; } } } // // Add the strings // for (int i = 0; i < vstr .GetCount (); i++) m_cbSource .AddString (vstr [i]); // // Set the current selection // int nSel = 0; if (!g_strLastSelection .IsEmpty ()) { nSel = m_cbSource .FindStringExact (-1, g_strLastSelection); if (nSel < 0) nSel = 0; } m_cbSource .SetCurSel (nSel); // // Show the current data // ShowCurrent (); } // // Otherwise, display an error // else { CString str; str .LoadString (IDS_ERR_NWN_DIRECTORY); ::MessageBox (NULL, str, g_szAppName, MB_OK); } m_tv .SetFocus (); OnTVSelChanged (0, NULL, bHandled); return FALSE; }