// KeyDown void PopupTextView::KeyDown(const char* bytes, int32 numBytes) { bool handled = true; if (numBytes > 0) { switch (bytes[0]) { case B_ESCAPE: // revert any typing changes RevertChanges(); break; case B_TAB: { // skip BTextView implementation BView::KeyDown(bytes, numBytes); int32 next = modifiers() & B_SHIFT_KEY ? -1 : 1; ApplyChanges(next); break; } case B_RETURN: ApplyChanges(); break; default: handled = false; break; } } if (!handled) BTextView::KeyDown(bytes, numBytes); }
BOOL COXCustomizeInstanceManagerPage::OnCloseManager(BOOL bIsOk) { CWinApp* pApp=AfxGetApp(); ASSERT(pApp!=NULL); if(bIsOk) { if(!ApplyChanges()) return FALSE; if(!m_sProfileName.IsEmpty()) { pApp->WriteProfileInt(m_sProfileName, _T("MaxAllowedInstanceNumber"),m_nMaxAllowedInstanceNumber); } } else { if(!m_sProfileName.IsEmpty()) { m_nMaxAllowedInstanceNumber=pApp->GetProfileInt(m_sProfileName, _T("MaxAllowedInstanceNumber"),m_nMaxAllowedInstanceNumber); m_instanceManager.SetMaxAllowedInstances(m_nMaxAllowedInstanceNumber); } } return TRUE; }
void InputTextView::KeyDown(const char* bytes, int32 numBytes) { bool handled = true; if (numBytes > 0) { switch (bytes[0]) { case B_ESCAPE: // revert any typing changes RevertChanges(); break; case B_TAB: // skip BTextView implementation BView::KeyDown(bytes, numBytes); // fall through case B_RETURN: ApplyChanges(); break; default: handled = false; break; } } if (!handled) BTextView::KeyDown(bytes, numBytes); }
// MakeFocus void PopupTextView::MakeFocus(bool focus) { BTextView::MakeFocus(focus); if (!focus) ApplyChanges(); }
void CGUIShaderDX::Draw(unsigned int vertexCount, unsigned int startVertex) { if (!m_bCreated) return; ApplyChanges(); g_Windowing.Get3D11Context()->Draw(vertexCount, startVertex); }
BOOL COXCustomizeTrayIconPage::OnCloseManager(BOOL bIsOk) { CWinApp* pApp=AfxGetApp(); ASSERT(pApp!=NULL); if(bIsOk) { if(!ApplyChanges()) return FALSE; if(!m_sProfileName.IsEmpty()) { pApp->WriteProfileString(m_sProfileName, _T("TrayIconTooltip"),m_sIconTooltip); pApp->WriteProfileInt(m_sProfileName, _T("ShowTrayIcon"),m_bShowTrayIcon); pApp->WriteProfileInt(m_sProfileName, _T("UseRightClick"),m_bUseRightClick); pApp->WriteProfileInt(m_sProfileName, _T("UseDefaultIcon"),m_bUseDefaultIcon); pApp->WriteProfileString(m_sProfileName, _T("TrayIconSourceFileName"),m_sIconSourceFileName); pApp->WriteProfileInt(m_sProfileName, _T("IconIndexFromSourceFile"),m_nIconIndex); } } else { if(!m_sProfileName.IsEmpty()) { m_sIconTooltip=pApp->GetProfileString(m_sProfileName, _T("TrayIconTooltip"),m_sIconTooltip); m_bShowTrayIcon=pApp->GetProfileInt(m_sProfileName, _T("ShowTrayIcon"),m_bShowTrayIcon); m_bUseRightClick=pApp->GetProfileInt(m_sProfileName, _T("UseRightClick"),m_bUseRightClick); m_bUseDefaultIcon=pApp->GetProfileInt(m_sProfileName, _T("UseDefaultIcon"),m_bUseDefaultIcon); m_sIconSourceFileName=pApp->GetProfileString(m_sProfileName, _T("TrayIconSourceFileName"),m_sIconSourceFileName); m_nIconIndex=pApp->GetProfileInt(m_sProfileName, _T("IconIndexFromSourceFile"),m_nIconIndex); if(m_sIconSourceFileName.IsEmpty()) { //get the application path ::GetModuleFileName(NULL, m_sIconSourceFileName.GetBuffer(MAX_PATH),MAX_PATH); m_sIconSourceFileName.ReleaseBuffer(); } SetupTrayIcon(); } } return TRUE; }
// MouseDown void PopupTextView::MouseDown(BPoint where) { BRect bounds(Bounds()); bounds.InsetBy(-1, -1); if (!bounds.Contains(where)) ApplyChanges(); else BTextView::MouseDown(where); }
void ConfigDialog::OnOk(wxCommandEvent& event) { ApplyChanges(); if (!originalProject->Save()) wxMessageBox("Error saving project"); else event.Skip(); }
// Applies current property page values to underlying objects specified through // SetObjects STDMETHODIMP CPropertyPageEx::Apply() { assert(m_pObject); assert(m_bHasBeenActivated); // Do data transfer if (m_hwndDlg) DoTransfer(TRUE); // Ask the page to apply the changes ApplyChanges(); return NOERROR; }
/* ================ VID_MenuKey ================ */ const char *VID_MenuKey( int key ) { menuframework_s *m = s_current_menu; static const char *sound = "misc/menu1.wav"; switch ( key ) { case K_ESCAPE: ApplyChanges( 0 ); return NULL; case K_KP_UPARROW: case K_UPARROW: m->cursor--; Menu_AdjustCursor( m, -1 ); break; case K_KP_DOWNARROW: case K_DOWNARROW: m->cursor++; Menu_AdjustCursor( m, 1 ); break; case K_KP_LEFTARROW: case K_LEFTARROW: Menu_SlideItem( m, -1 ); break; case K_KP_RIGHTARROW: case K_RIGHTARROW: Menu_SlideItem( m, 1 ); break; case K_KP_ENTER: case K_ENTER: if ( !Menu_SelectItem( m ) ) ApplyChanges( NULL ); break; } return sound; }
BOOL COXCustomizeTabbedMDIPage::OnCloseManager(BOOL bIsOk) { if(bIsOk) { if(!ApplyChanges()) { return FALSE; } if(!m_sProfileName.IsEmpty()) { m_MTIClientWnd.SaveState(m_sProfileName); } } return TRUE; }
void IFaceWin::HandleMessage( Message * pcMessage ) { switch ( pcMessage->GetCode() ) { case Apply: ApplyChanges(); break; case ChangeType: ChangeIFaceType( m_pcDdmType->GetCurrentString() == MSG_IFWIN_TYPE_STATIC ? Static : DHCP ); break; case Close: SendCloseMessage(); break; } }
BOOL COXCustomizeBackgroundPage::OnCloseManager(BOOL bIsOk) { CWinApp* pApp=AfxGetApp(); ASSERT(pApp!=NULL); if(bIsOk) { if(!ApplyChanges()) return FALSE; if(!m_sProfileName.IsEmpty()) { pApp->WriteProfileInt(m_sProfileName,_T("PaintBackground"), m_bPaintBackground); pApp->WriteProfileInt(m_sProfileName,_T("OnlyClientArea"), m_bOnlyClientArea); pApp->WriteProfileString(m_sProfileName,_T("ImageFileName"), m_sFilename); pApp->WriteProfileInt(m_sProfileName,_T("PaintType"),m_nAlign); pApp->WriteProfileInt(m_sProfileName,_T("BackgroundColor"),m_clrBack); pApp->WriteProfileInt(m_sProfileName,_T("UseDefaultImage"), m_bUseDefaultImage); } } else { if(!m_sProfileName.IsEmpty()) { m_bPaintBackground=pApp->GetProfileInt(m_sProfileName, _T("PaintBackground"),m_bPaintBackground); m_bOnlyClientArea=pApp->GetProfileInt(m_sProfileName, _T("OnlyClientArea"),m_bOnlyClientArea); m_sFilename=pApp->GetProfileString(m_sProfileName, _T("ImageFileName"),m_sFilename); m_nAlign=(int)pApp->GetProfileInt(m_sProfileName, _T("PaintType"),m_nAlign); m_clrBack=pApp->GetProfileInt(m_sProfileName, _T("BackgroundColor"),m_clrBack); m_bUseDefaultImage=pApp->GetProfileInt(m_sProfileName, _T("UseDefaultImage"),m_bUseDefaultImage); SetupBackgroundPainting(); } } return TRUE; }
const char *VID_MenuKey( int key ) { menuframework_t *m = s_current_menu; static const char *insound = "misc/menu1.wav"; static const char *movesound = "misc/menu2.wav"; // NeVo static const char *exitsound = "misc/menu3.wav"; // NeVo const char *sound = NULL; switch ( key ) { case K_ESCAPE: M_PopMenu(); // NeVo return exitsound; // NeVo break; case K_KP_UPARROW: case K_UPARROW: m->cursor--; Menu_AdjustCursor( m, -1 ); sound = movesound; break; case K_KP_DOWNARROW: case K_DOWNARROW: m->cursor++; Menu_AdjustCursor( m, 1 ); sound = movesound; break; case K_KP_LEFTARROW: case K_LEFTARROW: Menu_SlideItem( m, -1 ); sound = movesound; break; case K_KP_RIGHTARROW: case K_RIGHTARROW: Menu_SlideItem( m, 1 ); sound = movesound; break; case K_KP_ENTER: case K_ENTER: if ( !Menu_SelectItem( m ) ) ApplyChanges( NULL ); sound = movesound; break; } return sound; }
static INT_PTR CALLBACK TlenVoiceOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { TlenProtocol *proto = (TlenProtocol *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); switch (msg) { case WM_INITDIALOG: { TranslateDialogDefault(hwndDlg); proto = (TlenProtocol *)lParam; SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)proto); SendDlgItemMessage(hwndDlg, IDC_VOICE_POLICY, CB_ADDSTRING, 0, (LPARAM)TranslateT("Always ask me")); SendDlgItemMessage(hwndDlg, IDC_VOICE_POLICY, CB_ADDSTRING, 0, (LPARAM)TranslateT("Accept invitations from authorized contacts")); SendDlgItemMessage(hwndDlg, IDC_VOICE_POLICY, CB_ADDSTRING, 0, (LPARAM)TranslateT("Accept all invitations")); SendDlgItemMessage(hwndDlg, IDC_VOICE_POLICY, CB_ADDSTRING, 0, (LPARAM)TranslateT("Ignore invitations from unauthorized contacts")); SendDlgItemMessage(hwndDlg, IDC_VOICE_POLICY, CB_ADDSTRING, 0, (LPARAM)TranslateT("Ignore all invitation")); SendDlgItemMessage(hwndDlg, IDC_VOICE_POLICY, CB_SETCURSEL, proto->tlenOptions.voiceChatPolicy, 0); TlenVoiceBuildInDeviceList(proto, GetDlgItem(hwndDlg, IDC_VOICE_DEVICE_IN)); TlenVoiceBuildOutDeviceList(proto, GetDlgItem(hwndDlg, IDC_VOICE_DEVICE_OUT)); return TRUE; } case WM_COMMAND: switch (LOWORD(wParam)) { case IDC_VOICE_POLICY: case IDC_VOICE_DEVICE_IN: case IDC_VOICE_DEVICE_OUT: if (HIWORD(wParam) == CBN_SELCHANGE) MarkChanges(2, hwndDlg); break; } break; case WM_NOTIFY: switch (((LPNMHDR) lParam)->code) { case PSN_APPLY: { db_set_w(NULL, proto->m_szModuleName, "VoiceChatPolicy", (WORD) SendDlgItemMessage(hwndDlg, IDC_VOICE_POLICY, CB_GETCURSEL, 0, 0)); db_set_w(NULL, proto->m_szModuleName, "VoiceDeviceIn", (WORD) SendDlgItemMessage(hwndDlg, IDC_VOICE_DEVICE_IN, CB_GETCURSEL, 0, 0)); db_set_w(NULL, proto->m_szModuleName, "VoiceDeviceOut", (WORD) SendDlgItemMessage(hwndDlg, IDC_VOICE_DEVICE_OUT, CB_GETCURSEL, 0, 0)); ApplyChanges(proto, 2); return TRUE; } } break; } return FALSE; }
BOOL COXCustomizeSplashWindowPage::OnCloseManager(BOOL bIsOk) { if(bIsOk) { if(!ApplyChanges()) return FALSE; if(!m_sProfileName.IsEmpty()) { CWinApp* pApp=AfxGetApp(); ASSERT(pApp!=NULL); pApp->WriteProfileInt(m_sProfileName, _T("DisplaySplashWindow"),m_bDisplaySplashWindow); pApp->WriteProfileInt(m_sProfileName, _T("SplashWindow_Interruptable"),m_bInterruptable); pApp->WriteProfileInt(m_sProfileName, _T("SplashWindowShowDelay"),m_nShowDelay); pApp->WriteProfileInt(m_sProfileName, _T("TransparentColorPoint_CoordX"),m_nXCoord); pApp->WriteProfileInt(m_sProfileName, _T("TransparentColorPoint_CoordY"),m_nYCoord); pApp->WriteProfileInt(m_sProfileName, _T("TransparentColorType"),m_nTransparentColorType); pApp->WriteProfileInt(m_sProfileName, _T("UseDefaultImage"),m_bUseDefaultImage); pApp->WriteProfileInt(m_sProfileName, _T("SplashWindowShowInfinitely"),m_bShowInfinitely); pApp->WriteProfileString(m_sProfileName, _T("SplashImageFileName"),m_sSplashImageFileName); pApp->WriteProfileInt(m_sProfileName, _T("TransparentColor"),m_clrTransparent); pApp->WriteProfileInt(m_sProfileName, _T("ColorTolerance"),m_nTolerance); } } else { if(!m_sProfileName.IsEmpty()) { } } return TRUE; }
BOOL COXCustomizeShortkeysPage::OnCloseManager(BOOL bIsOk) { CWinApp* pApp=AfxGetApp(); ASSERT(pApp!=NULL); if(bIsOk) { if(!ApplyChanges()) return FALSE; m_shortkeysOrganizer.SaveState(m_sProfileName); } else { if(!m_sProfileName.IsEmpty()) { m_shortkeysOrganizer.LoadState(m_sProfileName); } } return TRUE; }
void CGUIShaderDX::DrawQuad(Vertex& v1, Vertex& v2, Vertex& v3, Vertex& v4) { if (!m_bCreated) return; ApplyChanges(); ID3D11DeviceContext* pContext = g_Windowing.Get3D11Context(); // update vertex buffer D3D11_MAPPED_SUBRESOURCE resource; if (SUCCEEDED(pContext->Map(m_pVertexBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &resource))) { // we are using strip topology Vertex vertices[4] = { v2, v3, v1, v4 }; memcpy(resource.pData, &vertices, sizeof(Vertex) * 4); pContext->Unmap(m_pVertexBuffer, 0); // Draw primitives pContext->Draw(4, 0); } }
void CDialogSound::OnDblclkTreeSounds(NMHDR* pNMHDR, LRESULT* pResult) { *pResult = 0; CPoint pt; GetCursorPos( &pt ); treeSounds.ScreenToClient( &pt ); HTREEITEM item = treeSounds.HitTest( pt ); if (item) { DWORD dw = treeSounds.GetItemData( item ); if ( dw == SOUNDS || dw == INUSESOUNDS ) { if ( !treeSounds.ItemHasChildren( item ) ) { strShader = treeSounds.GetItemText( item ); UpdateData( FALSE ); ApplyChanges( false, ( dw == SOUNDS ) ); } } else if ( dw == WAVES ) { strShader = RebuildItemName( "Wave Files", item ); UpdateData( FALSE ); OnBtnApply(); } } *pResult = 0; }
void CDialogSound::OnBtnApply() { ApplyChanges(); }
void CSyncherDialog::OnCbnEditchangeSourcedestination() { m_source_destinations.UpdateWindow(); ApplyChanges(); }
static INT_PTR CALLBACK TlenPopupsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { TlenProtocol *proto = (TlenProtocol *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); switch (msg) { case WM_INITDIALOG: { BYTE delayMode; proto = (TlenProtocol *)lParam; SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)proto); TranslateDialogDefault(hwndDlg); CheckDlgButton(hwndDlg, IDC_ENABLEPOPUP, db_get_b(NULL, proto->m_szModuleName, "MailPopupEnabled", TRUE)); SendDlgItemMessage(hwndDlg, IDC_COLORBKG, CPM_SETCOLOUR, 0, db_get_dw(NULL, proto->m_szModuleName, "MailPopupBack", POPUP_DEFAULT_COLORBKG)); SendDlgItemMessage(hwndDlg, IDC_COLORTXT, CPM_SETCOLOUR, 0, db_get_dw(NULL, proto->m_szModuleName, "MailPopupText", POPUP_DEFAULT_COLORTXT)); SetDlgItemInt(hwndDlg, IDC_DELAY, db_get_dw(NULL, proto->m_szModuleName, "MailPopupDelay", 4), FALSE); delayMode = db_get_b(NULL, proto->m_szModuleName, "MailPopupDelayMode", 0); if (delayMode == 1) { CheckDlgButton(hwndDlg, IDC_DELAY_CUSTOM, TRUE); } else if (delayMode == 2) { CheckDlgButton(hwndDlg, IDC_DELAY_PERMANENT, TRUE); } else { CheckDlgButton(hwndDlg, IDC_DELAY_POPUP, TRUE); } return TRUE; } case WM_COMMAND: switch (LOWORD(wParam)) { case IDC_COLORTXT: case IDC_COLORBKG: case IDC_ENABLEPOPUP: case IDC_DELAY: case IDC_DELAY_POPUP: case IDC_DELAY_CUSTOM: case IDC_DELAY_PERMANENT: MarkChanges(8, hwndDlg); break; case IDC_PREVIEW: { int delay; TCHAR title[256]; if (IsDlgButtonChecked(hwndDlg, IDC_DELAY_POPUP)) { delay=0; } else if (IsDlgButtonChecked(hwndDlg, IDC_DELAY_PERMANENT)) { delay=-1; } else { delay=GetDlgItemInt(hwndDlg, IDC_DELAY, NULL, FALSE); } mir_sntprintf(title, SIZEOF(title), TranslateT("%S mail"), proto->m_szModuleName); MailPopupPreview((DWORD) SendDlgItemMessage(hwndDlg,IDC_COLORBKG,CPM_GETCOLOUR,0,0), (DWORD) SendDlgItemMessage(hwndDlg,IDC_COLORTXT,CPM_GETCOLOUR,0,0), title, _T("From: [email protected]\nSubject: test"), delay); } } break; case WM_NOTIFY: switch (((LPNMHDR) lParam)->code) { case PSN_APPLY: { BYTE delayMode; db_set_b(NULL, proto->m_szModuleName, "MailPopupEnabled", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_ENABLEPOPUP)); db_set_dw(NULL, proto->m_szModuleName, "MailPopupBack", (DWORD) SendDlgItemMessage(hwndDlg,IDC_COLORBKG,CPM_GETCOLOUR,0,0)); db_set_dw(NULL, proto->m_szModuleName, "MailPopupText", (DWORD) SendDlgItemMessage(hwndDlg,IDC_COLORTXT,CPM_GETCOLOUR,0,0)); db_set_dw(NULL, proto->m_szModuleName, "MailPopupDelay", (DWORD) GetDlgItemInt(hwndDlg,IDC_DELAY, NULL, FALSE)); delayMode=0; if (IsDlgButtonChecked(hwndDlg, IDC_DELAY_CUSTOM)) { delayMode=1; } else if (IsDlgButtonChecked(hwndDlg, IDC_DELAY_PERMANENT)) { delayMode=2; } db_set_b(NULL, proto->m_szModuleName, "MailPopupDelayMode", delayMode); ApplyChanges(proto, 8); return TRUE; } } break; } return FALSE; }
static INT_PTR CALLBACK TlenAdvOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { char text[256]; BOOL bChecked; TlenProtocol *proto = (TlenProtocol *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); switch (msg) { case WM_INITDIALOG: { DBVARIANT dbv; proto = (TlenProtocol *)lParam; SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)proto); TranslateDialogDefault(hwndDlg); if (!db_get_ts(NULL, proto->m_szModuleName, "LoginServer", &dbv)) { SetDlgItemText(hwndDlg, IDC_EDIT_LOGIN_SERVER, dbv.ptszVal); db_free(&dbv); } else SetDlgItemText(hwndDlg, IDC_EDIT_LOGIN_SERVER, _T("tlen.pl")); EnableWindow(GetDlgItem(hwndDlg, IDC_HOST), TRUE); EnableWindow(GetDlgItem(hwndDlg, IDC_HOSTPORT), TRUE); if (!db_get_ts(NULL, proto->m_szModuleName, "ManualHost", &dbv)) { SetDlgItemText(hwndDlg, IDC_HOST, dbv.ptszVal); db_free(&dbv); } else SetDlgItemText(hwndDlg, IDC_HOST, _T("s1.tlen.pl")); SetDlgItemInt(hwndDlg, IDC_HOSTPORT, db_get_w(NULL, proto->m_szModuleName, "ManualPort", TLEN_DEFAULT_PORT), FALSE); CheckDlgButton(hwndDlg, IDC_KEEPALIVE, db_get_b(NULL, proto->m_szModuleName, "KeepAlive", TRUE)); CheckDlgButton(hwndDlg, IDC_USE_SSL, db_get_b(NULL, proto->m_szModuleName, "UseEncryption", TRUE)); CheckDlgButton(hwndDlg, IDC_VISIBILITY_SUPPORT, db_get_b(NULL, proto->m_szModuleName, "VisibilitySupport", FALSE)); // File transfer options bChecked = FALSE; if (db_get_b(NULL, proto->m_szModuleName, "UseFileProxy", FALSE) == TRUE) { bChecked = TRUE; CheckDlgButton(hwndDlg, IDC_FILE_USE_PROXY, TRUE); } EnableWindow(GetDlgItem(hwndDlg, IDC_FILE_PROXY_TYPE_LABEL), bChecked); EnableWindow(GetDlgItem(hwndDlg, IDC_FILE_PROXY_TYPE), bChecked); EnableWindow(GetDlgItem(hwndDlg, IDC_FILE_PROXY_HOST_LABEL), bChecked); EnableWindow(GetDlgItem(hwndDlg, IDC_FILE_PROXY_HOST), bChecked); EnableWindow(GetDlgItem(hwndDlg, IDC_FILE_PROXY_PORT_LABEL), bChecked); EnableWindow(GetDlgItem(hwndDlg, IDC_FILE_PROXY_PORT), bChecked); EnableWindow(GetDlgItem(hwndDlg, IDC_FILE_PROXY_USE_AUTH), bChecked); if (db_get_b(NULL, proto->m_szModuleName, "FileProxyAuth", FALSE) == TRUE) CheckDlgButton(hwndDlg, IDC_FILE_PROXY_USE_AUTH, TRUE); else bChecked = FALSE; EnableWindow(GetDlgItem(hwndDlg, IDC_FILE_PROXY_USER_LABEL), bChecked); EnableWindow(GetDlgItem(hwndDlg, IDC_FILE_PROXY_USER), bChecked); EnableWindow(GetDlgItem(hwndDlg, IDC_FILE_PROXY_PASSWORD_LABEL), bChecked); EnableWindow(GetDlgItem(hwndDlg, IDC_FILE_PROXY_PASSWORD), bChecked); SendDlgItemMessage(hwndDlg, IDC_FILE_PROXY_TYPE, CB_ADDSTRING, 0, (LPARAM)TranslateT("Forwarding")); SendDlgItemMessage(hwndDlg, IDC_FILE_PROXY_TYPE, CB_ADDSTRING, 0, (LPARAM)_T("SOCKS4")); SendDlgItemMessage(hwndDlg, IDC_FILE_PROXY_TYPE, CB_ADDSTRING, 0, (LPARAM)_T("SOCKS5")); SendDlgItemMessage(hwndDlg, IDC_FILE_PROXY_TYPE, CB_SETCURSEL, db_get_w(NULL, proto->m_szModuleName, "FileProxyType", 0), 0); if (!db_get_ts(NULL, proto->m_szModuleName, "FileProxyHost", &dbv)) { SetDlgItemText(hwndDlg, IDC_FILE_PROXY_HOST, dbv.ptszVal); db_free(&dbv); } SetDlgItemInt(hwndDlg, IDC_FILE_PROXY_PORT, db_get_w(NULL, proto->m_szModuleName, "FileProxyPort", 0), FALSE); if (!db_get_ts(NULL, proto->m_szModuleName, "FileProxyUsername", &dbv)) { SetDlgItemText(hwndDlg, IDC_FILE_PROXY_USER, dbv.ptszVal); db_free(&dbv); } if (!db_get_s(NULL, proto->m_szModuleName, "FileProxyPassword", &dbv)) { SetDlgItemTextA(hwndDlg, IDC_FILE_PROXY_PASSWORD, dbv.pszVal); db_free(&dbv); } return TRUE; } case WM_COMMAND: { switch (LOWORD(wParam)) { case IDC_FILE_PROXY_TYPE: if (HIWORD(wParam) == CBN_SELCHANGE) MarkChanges(4, hwndDlg); break; case IDC_EDIT_LOGIN_SERVER: case IDC_HOST: case IDC_HOSTPORT: case IDC_FILE_PROXY_HOST: case IDC_FILE_PROXY_PORT: case IDC_FILE_PROXY_USER: case IDC_FILE_PROXY_PASSWORD: if ((HWND)lParam == GetFocus() && HIWORD(wParam) == EN_CHANGE) MarkChanges(4, hwndDlg); break; case IDC_FILE_USE_PROXY: bChecked = IsDlgButtonChecked(hwndDlg, IDC_FILE_USE_PROXY); EnableWindow(GetDlgItem(hwndDlg, IDC_FILE_PROXY_TYPE_LABEL), bChecked); EnableWindow(GetDlgItem(hwndDlg, IDC_FILE_PROXY_TYPE), bChecked); EnableWindow(GetDlgItem(hwndDlg, IDC_FILE_PROXY_HOST_LABEL), bChecked); EnableWindow(GetDlgItem(hwndDlg, IDC_FILE_PROXY_HOST), bChecked); EnableWindow(GetDlgItem(hwndDlg, IDC_FILE_PROXY_PORT_LABEL), bChecked); EnableWindow(GetDlgItem(hwndDlg, IDC_FILE_PROXY_PORT), bChecked); EnableWindow(GetDlgItem(hwndDlg, IDC_FILE_PROXY_USE_AUTH), bChecked); case IDC_FILE_PROXY_USE_AUTH: bChecked = IsDlgButtonChecked(hwndDlg, IDC_FILE_PROXY_USE_AUTH) & IsDlgButtonChecked(hwndDlg, IDC_FILE_USE_PROXY); EnableWindow(GetDlgItem(hwndDlg, IDC_FILE_PROXY_USER_LABEL), bChecked); EnableWindow(GetDlgItem(hwndDlg, IDC_FILE_PROXY_USER), bChecked); EnableWindow(GetDlgItem(hwndDlg, IDC_FILE_PROXY_PASSWORD_LABEL), bChecked); EnableWindow(GetDlgItem(hwndDlg, IDC_FILE_PROXY_PASSWORD), bChecked); MarkChanges(4, hwndDlg); break; case IDC_KEEPALIVE: case IDC_VISIBILITY_SUPPORT: case IDC_USE_SSL: MarkChanges(4, hwndDlg); break; } } break; case WM_NOTIFY: switch (((LPNMHDR) lParam)->code) { case PSN_APPLY: WORD port; BOOL useEncryption; BOOL reconnectRequired = FALSE; DBVARIANT dbv; GetDlgItemTextA(hwndDlg, IDC_EDIT_LOGIN_SERVER, text, sizeof(text)); if (db_get(NULL, proto->m_szModuleName, "LoginServer", &dbv) || strcmp(text, dbv.pszVal)) reconnectRequired = TRUE; if (dbv.pszVal != NULL) db_free(&dbv); db_set_s(NULL, proto->m_szModuleName, "LoginServer", strlwr(text)); GetDlgItemTextA(hwndDlg, IDC_HOST, text, sizeof(text)); if (db_get(NULL, proto->m_szModuleName, "ManualHost", &dbv) || strcmp(text, dbv.pszVal)) reconnectRequired = TRUE; if (dbv.pszVal != NULL) db_free(&dbv); db_set_s(NULL, proto->m_szModuleName, "ManualHost", text); port = (WORD) GetDlgItemInt(hwndDlg, IDC_HOSTPORT, NULL, FALSE); if (db_get_w(NULL, proto->m_szModuleName, "ManualPort", TLEN_DEFAULT_PORT) != port) reconnectRequired = TRUE; db_set_w(NULL, proto->m_szModuleName, "ManualPort", port); proto->tlenOptions.sendKeepAlive = IsDlgButtonChecked(hwndDlg, IDC_KEEPALIVE); db_set_b(NULL, proto->m_szModuleName, "KeepAlive", (BYTE) proto->tlenOptions.sendKeepAlive); useEncryption = IsDlgButtonChecked(hwndDlg, IDC_USE_SSL); if (db_get_b(NULL, proto->m_szModuleName, "UseEncryption", TRUE) != useEncryption) reconnectRequired = TRUE; db_set_b(NULL, proto->m_szModuleName, "UseEncryption", (BYTE) useEncryption); db_set_b(NULL, proto->m_szModuleName, "VisibilitySupport", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_VISIBILITY_SUPPORT)); // File transfer options db_set_b(NULL, proto->m_szModuleName, "UseFileProxy", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_FILE_USE_PROXY)); db_set_w(NULL, proto->m_szModuleName, "FileProxyType", (WORD) SendDlgItemMessage(hwndDlg, IDC_FILE_PROXY_TYPE, CB_GETCURSEL, 0, 0)); GetDlgItemTextA(hwndDlg, IDC_FILE_PROXY_HOST, text, sizeof(text)); db_set_s(NULL, proto->m_szModuleName, "FileProxyHost", text); db_set_w(NULL, proto->m_szModuleName, "FileProxyPort", (WORD) GetDlgItemInt(hwndDlg, IDC_FILE_PROXY_PORT, NULL, FALSE)); db_set_b(NULL, proto->m_szModuleName, "FileProxyAuth", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_FILE_PROXY_USE_AUTH)); GetDlgItemTextA(hwndDlg, IDC_FILE_PROXY_USER, text, sizeof(text)); db_set_s(NULL, proto->m_szModuleName, "FileProxyUsername", text); GetDlgItemTextA(hwndDlg, IDC_FILE_PROXY_PASSWORD, text, sizeof(text)); db_set_s(NULL, proto->m_szModuleName, "FileProxyPassword", text); if (reconnectRequired && proto->isConnected) MessageBox(hwndDlg, TranslateT("These changes will take effect the next time you connect to the Tlen network."), TranslateT("Tlen Protocol Option"), MB_OK|MB_SETFOREGROUND); ApplyChanges(proto, 4); return TRUE; } break; } return FALSE; }
static INT_PTR CALLBACK TlenBasicOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { char text[256]; TlenProtocol *proto = (TlenProtocol *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); switch (msg) { case WM_INITDIALOG: { DBVARIANT dbv; proto = (TlenProtocol *)lParam; SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)proto); TranslateDialogDefault(hwndDlg); if (!db_get_ts(NULL, proto->m_szModuleName, "LoginName", &dbv)) { SetDlgItemText(hwndDlg, IDC_EDIT_USERNAME, dbv.ptszVal); db_free(&dbv); } if (!db_get(NULL, proto->m_szModuleName, "Password", &dbv)) { SetDlgItemTextA(hwndDlg, IDC_EDIT_PASSWORD, dbv.pszVal); db_free(&dbv); } CheckDlgButton(hwndDlg, IDC_SAVEPASSWORD, db_get_b(NULL, proto->m_szModuleName, "SavePassword", TRUE)); CheckDlgButton(hwndDlg, IDC_RECONNECT, proto->tlenOptions.reconnect); CheckDlgButton(hwndDlg, IDC_ROSTER_SYNC, proto->tlenOptions.rosterSync); CheckDlgButton(hwndDlg, IDC_SHOW_OFFLINE, proto->tlenOptions.offlineAsInvisible); CheckDlgButton(hwndDlg, IDC_OFFLINE_MESSAGE, proto->tlenOptions.leaveOfflineMessage); CheckDlgButton(hwndDlg, IDC_IGNORE_ADVERTISEMENTS, proto->tlenOptions.ignoreAdvertisements); CheckDlgButton(hwndDlg, IDC_AVATARS, proto->tlenOptions.enableAvatars); CheckDlgButton(hwndDlg, IDC_VERSIONINFO, proto->tlenOptions.enableVersion); CheckDlgButton(hwndDlg, IDC_NUDGE_SUPPORT, proto->tlenOptions.useNudge); CheckDlgButton(hwndDlg, IDC_LOG_ALERTS, proto->tlenOptions.logAlerts); SendDlgItemMessage(hwndDlg, IDC_ALERT_POLICY, CB_ADDSTRING, 0, (LPARAM)TranslateT("Accept all alerts")); SendDlgItemMessage(hwndDlg, IDC_ALERT_POLICY, CB_ADDSTRING, 0, (LPARAM)TranslateT("Ignore alerts from unauthorized contacts")); SendDlgItemMessage(hwndDlg, IDC_ALERT_POLICY, CB_ADDSTRING, 0, (LPARAM)TranslateT("Ignore all alerts")); SendDlgItemMessage(hwndDlg, IDC_ALERT_POLICY, CB_SETCURSEL, proto->tlenOptions.alertPolicy, 0); SendDlgItemMessage(hwndDlg, IDC_MUC_POLICY, CB_ADDSTRING, 0, (LPARAM)TranslateT("Always ask me")); SendDlgItemMessage(hwndDlg, IDC_MUC_POLICY, CB_ADDSTRING, 0, (LPARAM)TranslateT("Accept invitations from authorized contacts")); SendDlgItemMessage(hwndDlg, IDC_MUC_POLICY, CB_ADDSTRING, 0, (LPARAM)TranslateT("Accept all invitations")); SendDlgItemMessage(hwndDlg, IDC_MUC_POLICY, CB_ADDSTRING, 0, (LPARAM)TranslateT("Ignore invitations from unauthorized contacts")); SendDlgItemMessage(hwndDlg, IDC_MUC_POLICY, CB_ADDSTRING, 0, (LPARAM)TranslateT("Ignore all invitation")); SendDlgItemMessage(hwndDlg, IDC_MUC_POLICY, CB_SETCURSEL, proto->tlenOptions.groupChatPolicy, 0); SendDlgItemMessage(hwndDlg, IDC_IMAGE_POLICY, CB_ADDSTRING, 0, (LPARAM)TranslateT("Accept all images")); SendDlgItemMessage(hwndDlg, IDC_IMAGE_POLICY, CB_ADDSTRING, 0, (LPARAM)TranslateT("Ignore images from unauthorized contacts")); SendDlgItemMessage(hwndDlg, IDC_IMAGE_POLICY, CB_ADDSTRING, 0, (LPARAM)TranslateT("Ignore all images")); SendDlgItemMessage(hwndDlg, IDC_IMAGE_POLICY, CB_SETCURSEL, proto->tlenOptions.imagePolicy, 0); SendDlgItemMessage(hwndDlg, IDC_OFFLINE_MESSAGE_OPTION, CB_ADDSTRING, 0, (LPARAM)TranslateT("<Last message>")); SendDlgItemMessage(hwndDlg, IDC_OFFLINE_MESSAGE_OPTION, CB_ADDSTRING, 0, (LPARAM)pcli->pfnGetStatusModeDescription(ID_STATUS_ONLINE, 0)); SendDlgItemMessage(hwndDlg, IDC_OFFLINE_MESSAGE_OPTION, CB_ADDSTRING, 0, (LPARAM)pcli->pfnGetStatusModeDescription(ID_STATUS_AWAY, 0)); SendDlgItemMessage(hwndDlg, IDC_OFFLINE_MESSAGE_OPTION, CB_ADDSTRING, 0, (LPARAM)pcli->pfnGetStatusModeDescription(ID_STATUS_NA, 0)); SendDlgItemMessage(hwndDlg, IDC_OFFLINE_MESSAGE_OPTION, CB_ADDSTRING, 0, (LPARAM)pcli->pfnGetStatusModeDescription(ID_STATUS_DND, 0)); SendDlgItemMessage(hwndDlg, IDC_OFFLINE_MESSAGE_OPTION, CB_ADDSTRING, 0, (LPARAM)pcli->pfnGetStatusModeDescription(ID_STATUS_FREECHAT, 0)); SendDlgItemMessage(hwndDlg, IDC_OFFLINE_MESSAGE_OPTION, CB_ADDSTRING, 0, (LPARAM)pcli->pfnGetStatusModeDescription(ID_STATUS_INVISIBLE, 0)); SendDlgItemMessage(hwndDlg, IDC_OFFLINE_MESSAGE_OPTION, CB_SETCURSEL, proto->tlenOptions.offlineMessageOption, 0); mir_subclassWindow(GetDlgItem(hwndDlg, IDC_EDIT_USERNAME), TlenValidateUsernameWndProc); return TRUE; } case WM_COMMAND: switch (LOWORD(wParam)) { case IDC_EDIT_USERNAME: case IDC_EDIT_PASSWORD: if ((HWND)lParam == GetFocus() && HIWORD(wParam) == EN_CHANGE) SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); break; // Fall through case IDC_SAVEPASSWORD: case IDC_RECONNECT: case IDC_ROSTER_SYNC: case IDC_IGNORE_ADVERTISEMENTS: case IDC_SHOW_OFFLINE: case IDC_OFFLINE_MESSAGE: MarkChanges(1, hwndDlg); break; case IDC_LOG_ALERTS: CheckDlgButton(hwndDlg, IDC_NUDGE_SUPPORT, BST_UNCHECKED); MarkChanges(1, hwndDlg); break; case IDC_NUDGE_SUPPORT: CheckDlgButton(hwndDlg, IDC_LOG_ALERTS, BST_UNCHECKED); MarkChanges(1, hwndDlg); break; case IDC_REGISTERACCOUNT: CallService(MS_UTILS_OPENURL, (WPARAM) 1, (LPARAM) TLEN_REGISTER); break; case IDC_OFFLINE_MESSAGE_OPTION: case IDC_ALERT_POLICY: case IDC_MUC_POLICY: if (HIWORD(wParam) == CBN_SELCHANGE) MarkChanges(1, hwndDlg); break; default: MarkChanges(1, hwndDlg); break; } break; case WM_NOTIFY: switch (((LPNMHDR) lParam)->code) { case PSN_APPLY: { BOOL reconnectRequired = FALSE; DBVARIANT dbv; GetDlgItemTextA(hwndDlg, IDC_EDIT_USERNAME, text, sizeof(text)); if (db_get(NULL, proto->m_szModuleName, "LoginName", &dbv) || strcmp(text, dbv.pszVal)) reconnectRequired = TRUE; if (dbv.pszVal != NULL) db_free(&dbv); db_set_s(NULL, proto->m_szModuleName, "LoginName", strlwr(text)); if (IsDlgButtonChecked(hwndDlg, IDC_SAVEPASSWORD)) { GetDlgItemTextA(hwndDlg, IDC_EDIT_PASSWORD, text, sizeof(text)); if (db_get(NULL, proto->m_szModuleName, "Password", &dbv) || strcmp(text, dbv.pszVal)) reconnectRequired = TRUE; if (dbv.pszVal != NULL) db_free(&dbv); db_set_s(NULL, proto->m_szModuleName, "Password", text); } else db_unset(NULL, proto->m_szModuleName, "Password"); db_set_b(NULL, proto->m_szModuleName, "SavePassword", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SAVEPASSWORD)); db_set_b(NULL, proto->m_szModuleName, "Reconnect", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_RECONNECT)); db_set_b(NULL, proto->m_szModuleName, "RosterSync", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_ROSTER_SYNC)); db_set_b(NULL, proto->m_szModuleName, "OfflineAsInvisible", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOW_OFFLINE)); db_set_b(NULL, proto->m_szModuleName, "IgnoreAdvertisements", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_IGNORE_ADVERTISEMENTS)); db_set_b(NULL, proto->m_szModuleName, "LeaveOfflineMessage", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_OFFLINE_MESSAGE)); db_set_w(NULL, proto->m_szModuleName, "OfflineMessageOption", (WORD) SendDlgItemMessage(hwndDlg, IDC_OFFLINE_MESSAGE_OPTION, CB_GETCURSEL, 0, 0)); db_set_w(NULL, proto->m_szModuleName, "AlertPolicy", (WORD) SendDlgItemMessage(hwndDlg, IDC_ALERT_POLICY, CB_GETCURSEL, 0, 0)); db_set_w(NULL, proto->m_szModuleName, "GroupChatPolicy", (WORD) SendDlgItemMessage(hwndDlg, IDC_MUC_POLICY, CB_GETCURSEL, 0, 0)); db_set_w(NULL, proto->m_szModuleName, "ImagePolicy", (WORD) SendDlgItemMessage(hwndDlg, IDC_IMAGE_POLICY, CB_GETCURSEL, 0, 0)); db_set_b(NULL, proto->m_szModuleName, "EnableAvatars", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_AVATARS)); db_set_b(NULL, proto->m_szModuleName, "EnableVersion", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_VERSIONINFO)); db_set_b(NULL, proto->m_szModuleName, "UseNudge", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_NUDGE_SUPPORT)); db_set_b(NULL, proto->m_szModuleName, "LogAlerts", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_LOG_ALERTS)); if (reconnectRequired && proto->isConnected) MessageBox(hwndDlg, TranslateT("These changes will take effect the next time you connect to the Tlen network."), TranslateT("Tlen Protocol Option"), MB_OK|MB_SETFOREGROUND); ApplyChanges(proto, 1); return TRUE; } } break; } return FALSE; }
BOOL CSimpleFilterDialog::OnApply() { ApplyChanges(); return TRUE; }
INT_PTR CALLBACK Meta_EditDialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { HWND hwnd; char *str; int sel, i; switch(msg) { case WM_INITDIALOG: { // Font necessary for all controls created with CreateWindowsEx //HFONT hfDefault = GetStockObject(DEFAULT_GUI_FONT); //HWND combo = GetDlgItem(hwndDlg,IDC_DEFAULT); int nb_contacts, default_contact_number, offline_contact_number; LVCOLUMN LvCol; TranslateDialogDefault( hwndDlg ); SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)LoadIconEx(I_EDIT)); // Disable the 'Apply' button. EnableWindow(GetDlgItem(hwndDlg,IDC_VALIDATE),FALSE); // (from http://www.codeproject.com/listctrl/listview.asp) // initialize list hwnd = GetDlgItem(hwndDlg, IDC_LST_CONTACTS); SendMessage(hwnd,LVM_SETEXTENDEDLISTVIEWSTYLE, 0,LVS_EX_FULLROWSELECT); // Set style // Create list columns ZeroMemory(&LvCol, sizeof(LvCol)); LvCol.mask=LVCF_TEXT|LVCF_WIDTH|LVCF_SUBITEM; // Type of mask // Inserting Couloms as much as we want LvCol.pszText=Translate("Contact"); // First Header Text LvCol.cx=100; // width of column SendMessage(hwnd,LVM_INSERTCOLUMN,0,(LPARAM)&LvCol); // Insert/Show the coloum LvCol.pszText=Translate("Id"); // Next coloum LvCol.cx=130; // width of column SendMessage(hwnd,LVM_INSERTCOLUMN,1,(LPARAM)&LvCol); // ... LvCol.pszText=Translate("Protocol"); // LvCol.cx=100; // width of column SendMessage(hwnd,LVM_INSERTCOLUMN,2,(LPARAM)&LvCol); // LvCol.pszText=Translate("Default"); // LvCol.cx=60; // width of column SendMessage(hwnd,LVM_INSERTCOLUMN,3,(LPARAM)&LvCol); // LvCol.pszText=Translate("Send Offline"); // LvCol.cx=85; // width of column SendMessage(hwnd,LVM_INSERTCOLUMN,4,(LPARAM)&LvCol); // // disable buttons until a selection is made in the list hwnd = GetDlgItem(hwndDlg, IDC_BTN_REM); EnableWindow(hwnd, FALSE); hwnd = GetDlgItem(hwndDlg, IDC_BTN_SETDEFAULT); EnableWindow(hwnd, FALSE); hwnd = GetDlgItem(hwndDlg, IDC_BTN_SETOFFLINE); EnableWindow(hwnd, FALSE); hwnd = GetDlgItem(hwndDlg, IDC_BTN_UP); EnableWindow(hwnd, FALSE); hwnd = GetDlgItem(hwndDlg, IDC_BTN_DOWN); EnableWindow(hwnd, FALSE); nb_contacts = DBGetContactSettingDword((HANDLE)lParam, META_PROTO, "NumContacts", 0); default_contact_number = DBGetContactSettingDword((HANDLE)lParam, META_PROTO, "Default", (DWORD)-1); offline_contact_number = DBGetContactSettingDword((HANDLE)lParam, META_PROTO, "OfflineSend", (DWORD)-1); changes.hMeta = (HANDLE)lParam; changes.num_contacts = nb_contacts; changes.num_deleted = 0; changes.hDefaultContact = Meta_GetContactHandle((HANDLE)lParam, default_contact_number); changes.hOfflineContact = Meta_GetContactHandle((HANDLE)lParam, offline_contact_number); for(i = 0; i < nb_contacts; i++) changes.hContact[i] = Meta_GetContactHandle((HANDLE)lParam, i); changes.force_default = MetaAPI_GetForceState((WPARAM)lParam, 0); SendMessage(hwndDlg, WMU_SETTITLE, 0, lParam); CheckDlgButton(hwndDlg, IDC_CHK_FORCEDEFAULT, changes.force_default); FillContactList(hwndDlg, &changes); return TRUE; } case WMU_SETTITLE: { char *szCDN = (char *) CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)lParam, 0); if(os_unicode_enabled) { wchar_t *swzCDN = (wchar_t *) CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)lParam, GCDNF_UNICODE), *swzContactDisplayName; // detect if the clist provided unicode display name by comparing with non-unicode if(szCDN && swzCDN && strncmp(szCDN, (char *)swzCDN, strlen(szCDN)) != 0 && wcslen(swzCDN) >= strlen(szCDN)) { swzContactDisplayName = swzCDN; } else { // no? convert to unicode if(szCDN) { swzContactDisplayName = (wchar_t *) _malloca(sizeof(wchar_t) * (strlen(szCDN) + 1)); MultiByteToWideChar(CP_ACP, 0, (char *) szCDN, -1, swzContactDisplayName, (int)strlen((char *)szCDN) + 1); } else { swzContactDisplayName = TranslateW(L"(Unknown Contact)"); } } SetWindowTextW(GetDlgItem(hwndDlg,IDC_ED_NAME), swzContactDisplayName); } else { SetWindowText(GetDlgItem(hwndDlg,IDC_ED_NAME), szCDN); } } return TRUE; case WM_NOTIFY: // the message that is being sent always switch(LOWORD(wParam)) // hit control { case IDC_LST_CONTACTS: // did we hit our ListView contorl? if(((LPNMHDR)lParam)->code == NM_CLICK) { hwnd = GetDlgItem(hwndDlg, IDC_LST_CONTACTS); sel=SendMessage(hwnd,LVM_GETNEXTITEM,-1,LVNI_FOCUSED|LVNI_SELECTED); // return item selected // enable buttons hwnd = GetDlgItem(hwndDlg, IDC_BTN_REM); EnableWindow(hwnd, sel!=-1); hwnd = GetDlgItem(hwndDlg, IDC_BTN_SETDEFAULT); EnableWindow(hwnd, sel!=-1 && changes.hContact[sel] != changes.hDefaultContact); hwnd = GetDlgItem(hwndDlg, IDC_BTN_SETOFFLINE); EnableWindow(hwnd, sel!=-1 && changes.hContact[sel] != changes.hOfflineContact); hwnd = GetDlgItem(hwndDlg, IDC_BTN_UP); EnableWindow(hwnd, (sel > 0)); hwnd = GetDlgItem(hwndDlg, IDC_BTN_DOWN); EnableWindow(hwnd, (sel != -1) && (sel < changes.num_contacts - 1)); /* // custom draw stuff - change colour of listview things - doesn't affect selection :( } else if(((LPNMHDR)lParam)->code == NM_CUSTOMDRAW) { SetWindowLong(hwndDlg, DWL_MSGRESULT, (LONG)ProcessCustomDraw(lParam)); return TRUE; */ } break; } break; case WM_COMMAND: switch(HIWORD(wParam)) { case BN_CLICKED: // A button ('Remove', 'Ok', 'Cancel' or 'Apply', normally) has been clicked switch(LOWORD(wParam)) { case IDC_VALIDATE: // Apply changes, if there is still one contact attached to the metacontact. if(changes.num_contacts == 0) // Otherwise, delete the metacontact. { if(MessageBox(hwndDlg,Translate("You are going to remove all the contacts associated with this MetaContact.\nThis will delete the MetaContact.\n\nProceed Anyway?"), Translate("Delete MetaContact?"),MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON1)!=IDYES) return TRUE; else { Meta_Delete((WPARAM)changes.hMeta,(LPARAM)NULL); DestroyWindow(hwndDlg); return TRUE; } } ApplyChanges(&changes); // Disable the 'Apply' button. EnableWindow(GetDlgItem(hwndDlg,IDC_VALIDATE),FALSE); break; case IDOK: if(IsWindowEnabled(GetDlgItem(hwndDlg,IDC_VALIDATE))) { // If there are changes that could be made, if(changes.num_contacts == 0) // do the work that would have be done if { // the button 'Apply' has been clicked. if(MessageBox(hwndDlg,Translate("You are going to remove all the contacts associated with this MetaContact.\nThis will delete the MetaContact.\n\nProceed Anyway?"), Translate("Delete MetaContact?"),MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON1)!=IDYES) { return TRUE; } else { Meta_Delete((WPARAM)changes.hMeta,(LPARAM)NULL); DestroyWindow(hwndDlg); return TRUE; } } ApplyChanges(&changes); } EndDialog(hwndDlg, IDOK); return TRUE; case IDCANCEL: // Simply close the dialog EndDialog(hwndDlg, IDCANCEL); return TRUE; case IDC_BTN_SETDEFAULT: hwnd = GetDlgItem(hwndDlg, IDC_LST_CONTACTS); sel=SendMessage(hwnd,LVM_GETNEXTITEM,-1,LVNI_FOCUSED|LVNI_SELECTED); // return item selected InvalidateRect(hwnd, 0, TRUE); changes.hDefaultContact = changes.hContact[sel]; SendMessage(hwndDlg, WMU_SETTITLE, 0, (LPARAM)changes.hContact[sel]); FillContactList(hwndDlg, &changes); SetListSelection(hwnd, sel); // Disable set default button EnableWindow(GetDlgItem(hwndDlg,IDC_BTN_SETDEFAULT),FALSE); // Enable the 'Apply' button. EnableWindow(GetDlgItem(hwndDlg,IDC_VALIDATE),TRUE); // repaint list return TRUE; case IDC_BTN_SETOFFLINE: hwnd = GetDlgItem(hwndDlg, IDC_LST_CONTACTS); sel=SendMessage(hwnd,LVM_GETNEXTITEM,-1,LVNI_FOCUSED|LVNI_SELECTED); // return item selected InvalidateRect(hwnd, 0, TRUE); changes.hOfflineContact = changes.hContact[sel]; FillContactList(hwndDlg, &changes); SetListSelection(hwnd, sel); // Disable set offline button EnableWindow(GetDlgItem(hwndDlg,IDC_BTN_SETOFFLINE),FALSE); // Enable the 'Apply' button. EnableWindow(GetDlgItem(hwndDlg,IDC_VALIDATE),TRUE); // repaint list return TRUE; case IDC_BTN_REM: hwnd = GetDlgItem(hwndDlg, IDC_LST_CONTACTS); sel=SendMessage(hwnd,LVM_GETNEXTITEM,-1,LVNI_FOCUSED|LVNI_SELECTED); // return item selected changes.num_contacts--; changes.hDeletedContacts[changes.num_deleted++] = changes.hContact[sel]; if(changes.hDefaultContact == changes.hContact[sel]) { if(changes.num_contacts > 0) { changes.hDefaultContact = changes.hContact[0]; str = (char *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)changes.hDefaultContact, 0); SetWindowText(GetDlgItem(hwndDlg,IDC_ED_DEFAULT),str); } else { changes.hDefaultContact = 0; SetWindowText(GetDlgItem(hwndDlg,IDC_ED_DEFAULT),"None"); } } for(i = sel; i < changes.num_contacts; i++) changes.hContact[i] = changes.hContact[i + 1]; FillContactList(hwndDlg, &changes); // disable buttons hwnd = GetDlgItem(hwndDlg, IDC_BTN_REM); EnableWindow(hwnd, FALSE); hwnd = GetDlgItem(hwndDlg, IDC_BTN_SETDEFAULT); EnableWindow(hwnd, FALSE); hwnd = GetDlgItem(hwndDlg, IDC_BTN_SETOFFLINE); EnableWindow(hwnd, FALSE); hwnd = GetDlgItem(hwndDlg, IDC_BTN_UP); EnableWindow(hwnd, FALSE); hwnd = GetDlgItem(hwndDlg, IDC_BTN_DOWN); EnableWindow(hwnd, FALSE); // Enable the 'Apply' button. EnableWindow(GetDlgItem(hwndDlg,IDC_VALIDATE),TRUE); return TRUE; case IDC_BTN_UP: hwnd = GetDlgItem(hwndDlg, IDC_LST_CONTACTS); sel=SendMessage(hwnd,LVM_GETNEXTITEM,-1,LVNI_FOCUSED|LVNI_SELECTED); // return item selected { HANDLE temp = changes.hContact[sel]; changes.hContact[sel] = changes.hContact[sel - 1]; changes.hContact[sel - 1] = temp; } FillContactList(hwndDlg, &changes); sel--; SetListSelection(hwnd, sel); hwnd = GetDlgItem(hwndDlg, IDC_BTN_UP); EnableWindow(hwnd, (sel > 0)); hwnd = GetDlgItem(hwndDlg, IDC_BTN_DOWN); EnableWindow(hwnd, (sel < changes.num_contacts - 1)); // Enable the 'Apply' button. EnableWindow(GetDlgItem(hwndDlg,IDC_VALIDATE),TRUE); return TRUE; case IDC_BTN_DOWN: hwnd = GetDlgItem(hwndDlg, IDC_LST_CONTACTS); sel=SendMessage(hwnd,LVM_GETNEXTITEM,-1,LVNI_FOCUSED|LVNI_SELECTED); // return item selected { HANDLE temp = changes.hContact[sel]; changes.hContact[sel] = changes.hContact[sel + 1]; changes.hContact[sel + 1] = temp; } FillContactList(hwndDlg, &changes); sel++; SetListSelection(hwnd, sel); hwnd = GetDlgItem(hwndDlg, IDC_BTN_UP); EnableWindow(hwnd, (sel > 0)); hwnd = GetDlgItem(hwndDlg, IDC_BTN_DOWN); EnableWindow(hwnd, (sel < changes.num_contacts - 1)); // Enable the 'Apply' button. EnableWindow(GetDlgItem(hwndDlg,IDC_VALIDATE),TRUE); return TRUE; case IDC_CHK_FORCEDEFAULT: changes.force_default = IsDlgButtonChecked(hwndDlg, IDC_CHK_FORCEDEFAULT); // Enable the 'Apply' button. EnableWindow(GetDlgItem(hwndDlg,IDC_VALIDATE),TRUE); return TRUE; } } break; case WM_CLOSE: DestroyWindow(hwndDlg); return TRUE; case WM_DESTROY: ReleaseIconEx((HICON)SendMessage(hwndDlg, WM_SETICON, ICON_BIG, 0)); EndDialog(hwndDlg, IDCANCEL); break; } return FALSE; }
void AW_AutoWidth(WidthInfo *wi) { FigureLR(wi); CheckOutOfBounds(wi); ApplyChanges(wi); }
void CDialogSound::OnBtnUp() { fVolume = 1.0; UpdateData( FALSE ); ApplyChanges( true, false ); }
//OptionsDialog class functions BOOL OptionsDialogType::DialogProcedure(UINT msg, WPARAM wParam, LPARAM lParam) { BOOL Result = FALSE; switch(msg) { case WM_INITDIALOG: InitDialog(); Result = TRUE; break; case WM_DESTROY: DestroyDialog(); break; case WM_COMMAND: switch (LOWORD(wParam)) { case IDC_FILENAME: switch(HIWORD(wParam)) { case EN_KILLFOCUS: FilenameChanged(); break; case EN_CHANGE: if (GetFocus() == (HWND)lParam) SetChanged(); break; } break; case IDC_BROWSE: if (HIWORD(wParam) == BN_CLICKED) { if (BrowseForSmileyPacks(GetSelProto())) { UpdateControls(true); SetChanged(); } } break; case IDC_SMLOPTBUTTON: if (HIWORD(wParam) == BN_CLICKED) ShowSmileyPreview(); break; case IDC_USESTDPACK: if (HIWORD(wParam) == BN_CLICKED) { PopulateSmPackList(); SetChanged(); } break; case IDC_PLUGENABLED: if (HIWORD(wParam) == BN_CLICKED) { BOOL en = IsDlgButtonChecked(m_hwndDialog, IDC_PLUGENABLED) == BST_UNCHECKED; EnableWindow(GetDlgItem(m_hwndDialog, IDC_SMLBUT), en); SetChanged(); } break; case IDC_ADDCATEGORY: if (HIWORD(wParam) == BN_CLICKED) { AddCategory(); } break; case IDC_DELETECATEGORY: if (HIWORD(wParam) == BN_CLICKED) { if (tmpsmcat.DeleteCustomCategory(GetSelProto())) { PopulateSmPackList(); SetChanged(); } } break; case IDC_SPACES: case IDC_SCALETOTEXTHEIGHT: case IDC_APPENDSPACES: case IDC_SMLBUT: case IDC_SCALEALLSMILEYS: case IDC_IEVIEWSTYLE: case IDC_ANIMATESEL: case IDC_ANIMATEDLG: case IDC_INPUTSMILEYS: case IDC_DCURSORSMILEY: case IDC_DISABLECUSTOM: case IDC_HQSCALING: if (HIWORD(wParam) == BN_CLICKED) SetChanged(); break; case IDC_SELCLR: if (HIWORD(wParam) == CPN_COLOURCHANGED) SetChanged(); break; case IDC_MAXCUSTSMSZ: case IDC_MINSMSZ: if (HIWORD(wParam) == EN_CHANGE && GetFocus() == (HWND)lParam) SetChanged(); break; } break; case UM_CHECKSTATECHANGE: UserAction((HTREEITEM)lParam); break; case WM_NOTIFY: switch(((LPNMHDR)lParam)->idFrom) { case 0: switch (((LPNMHDR)lParam)->code) { case PSN_APPLY: ApplyChanges(); break; } break; case IDC_CATEGORYLIST: switch (((LPNMHDR)lParam)->code) { case NM_CLICK: { TVHITTESTINFO ht = {0}; DWORD dwpos = GetMessagePos(); POINTSTOPOINT(ht.pt, MAKEPOINTS(dwpos)); MapWindowPoints(HWND_DESKTOP, ((LPNMHDR)lParam)->hwndFrom, &ht.pt, 1); TreeView_HitTest(((LPNMHDR)lParam)->hwndFrom, &ht); if (TVHT_ONITEM & ht.flags) FilenameChanged(); if (TVHT_ONITEMSTATEICON & ht.flags) PostMessage(m_hwndDialog, UM_CHECKSTATECHANGE, 0, (LPARAM)ht.hItem); } case TVN_KEYDOWN: if (((LPNMTVKEYDOWN) lParam)->wVKey == VK_SPACE) PostMessage(m_hwndDialog, UM_CHECKSTATECHANGE, 0, (LPARAM)TreeView_GetSelection(((LPNMHDR)lParam)->hwndFrom)); break; case TVN_SELCHANGEDA: case TVN_SELCHANGEDW: { LPNMTREEVIEW pnmtv = (LPNMTREEVIEW) lParam; if (pnmtv->itemNew.state & TVIS_SELECTED) UpdateControls(); } break; } break; } break; } return Result; }
BOOL CTransformationsDialog::OnApply() { ApplyChanges(); return TRUE; }