BOOL CALLBACK playlists_dropdown::RenameDialogProc(HWND wnd, UINT msg, WPARAM wp, LPARAM lp) { switch (msg) { case WM_INITDIALOG: { uSetWindowLong(wnd, DWL_USER, lp); pfc::string_base* ptr = reinterpret_cast<pfc::string_base*>(lp); pfc::string8 title("Rename playlist: \""); title << *ptr << "\""; uSetWindowText(wnd, title); uSetDlgItemText(wnd, IDC_PLAYLIST_NAME, *ptr); Edit_SetSel(uGetDlgItem(wnd, IDC_PLAYLIST_NAME), 0, -1); SetFocus(uGetDlgItem(wnd, IDC_PLAYLIST_NAME)); } return 1; case WM_COMMAND: switch (wp) { case IDOK: uGetDlgItemText(wnd, IDC_PLAYLIST_NAME, *reinterpret_cast<pfc::string_base*>(uGetWindowLong(wnd, DWL_USER))); EndDialog(wnd, 1); break; case IDCANCEL: EndDialog(wnd, 0); break; } break; case WM_CLOSE: EndDialog(wnd, 0); break; } return 0; }
BOOL CALLBACK playlists_dropdown::SortDialogProc(HWND wnd, UINT msg, WPARAM wp, LPARAM lp) { switch (msg) { case WM_INITDIALOG: { uSetWindowLong(wnd, DWL_USER, lp); HWND hCombo = uGetDlgItem(wnd, IDC_SORT_STRING); cfg::sort_string.setup_dropdown(hCombo); if (!cfg::sort_string.is_empty()) { ComboBox_SetCurSel(hCombo, 0); ComboBox_SetEditSel(hCombo, 0, -1); } SetFocus(hCombo); } return 1; case WM_CONTEXTMENU: { const HWND source = (HWND) wp; if (source != NULL && source == GetDlgItem(wnd, IDC_SORT_STRING)) { cfg::sort_string.on_context(source, lp); return TRUE; } } break; case WM_COMMAND: switch (wp) { case IDOK: { uGetDlgItemText(wnd, IDC_SORT_STRING, *reinterpret_cast< pfc::string_base * >(uGetWindowLong(wnd, DWL_USER))); pfc::string8 pattern; if (uGetDlgItemText(wnd, IDC_SORT_STRING, pattern)) { cfg::sort_string.add_item(pattern); } EndDialog(wnd, 1); } break; case IDCANCEL: EndDialog(wnd, 0); break; case IDC_FIELDS: { HMENU menu = CreatePopupMenu(); uAppendMenu(menu, MF_STRING | MF_GRAYED | MF_DISABLED, 0, "Copy to clipboard:"); uAppendMenu(menu, MF_SEPARATOR, 0, 0); for (int i = 1; i < tabsize(g_fields_list); i++) { if (!g_fields_list[i].label) break; // Only basic fields uAppendMenu(menu, MF_STRING, i, g_fields_list[i].label); } RECT rc; GetWindowRect(GetDlgItem(wnd, IDC_FIELDS), &rc); int cmd = TrackPopupMenu(menu, TPM_NONOTIFY | TPM_RETURNCMD, rc.left, rc.bottom, 0, GetDlgItem(wnd, IDC_FIELDS), 0); DestroyMenu(menu); if (cmd >= 0 && cmd < tabsize(g_fields_list) && !!g_fields_list[cmd].label) { uSetClipboardString(g_fields_list[cmd].label); } } break; } break; case WM_CLOSE: EndDialog(wnd, 0); break; } return 0; }
static BOOL CALLBACK SpectrumPopupProc(HWND wnd,UINT msg,WPARAM wp,LPARAM lp) { switch(msg) { case WM_INITDIALOG: uSetWindowLong(wnd,DWL_USER,lp); { spec_param * ptr = reinterpret_cast<spec_param*>(lp); ptr->m_scope.initialize(FindOwningPopup(wnd)); uSendDlgItemMessage(wnd, IDC_BARS, BM_SETCHECK, ptr->ptr->mode == MODE_BARS, 0); HWND wnd_combo = GetDlgItem(wnd, IDC_FRAME_COMBO); EnableWindow(wnd_combo, ptr->b_show_frame); if (ptr->b_show_frame) { ComboBox_AddString(wnd_combo, _T("None")); ComboBox_AddString(wnd_combo, _T("Sunken")); ComboBox_AddString(wnd_combo, _T("Grey")); ComboBox_SetCurSel(wnd_combo, ptr->frame); } wnd_combo = GetDlgItem(wnd, IDC_SCALE); ComboBox_AddString(wnd_combo, _T("Linear")); ComboBox_AddString(wnd_combo, _T("Logarithmic")); ComboBox_SetCurSel(wnd_combo, ptr->m_scale); wnd_combo = GetDlgItem(wnd, IDC_VERTICAL_SCALE); ComboBox_AddString(wnd_combo, _T("Linear")); ComboBox_AddString(wnd_combo, _T("Logarithmic")); ComboBox_SetCurSel(wnd_combo, ptr->m_vertical_scale); } return TRUE; case WM_ERASEBKGND: SetWindowLongPtr(wnd, DWL_MSGRESULT, TRUE); return TRUE; case WM_PAINT: ui_helpers::innerWMPaintModernBackground(wnd, GetDlgItem(wnd, IDOK)); return TRUE; case WM_CTLCOLORSTATIC: { spec_param * ptr = reinterpret_cast<spec_param*>(uGetWindowLong(wnd,DWL_USER)); if (GetDlgItem(wnd, IDC_PATCH_FORE) == (HWND)lp) { HDC dc =(HDC)wp; if (!ptr->br_fore) { ptr->br_fore = CreateSolidBrush(ptr->cr_fore); } return (BOOL)ptr->br_fore; } else if (GetDlgItem(wnd, IDC_PATCH_BACK) == (HWND)lp) { HDC dc =(HDC)wp; if (!ptr->br_back) { ptr->br_back = CreateSolidBrush(ptr->cr_back); } return (BOOL)ptr->br_back; } else return (BOOL)GetSysColorBrush(COLOR_3DHIGHLIGHT); } break; case WM_COMMAND: switch(wp) { case IDCANCEL: EndDialog(wnd,0); return TRUE; case IDC_CHANGE_BACK: { spec_param * ptr = reinterpret_cast<spec_param*>(uGetWindowLong(wnd,DWL_USER)); COLORREF COLOR = ptr->cr_back; COLORREF COLORS[16] = {get_default_colour(colours::COLOUR_BACK),GetSysColor(COLOR_3DFACE),0,0,0,0,0,0,0,0,0,0,0,0,0,0}; if (uChooseColor(&COLOR, wnd, &COLORS[0])) { ptr->cr_back = COLOR; ptr->flush_back(); RedrawWindow(GetDlgItem(wnd, IDC_PATCH_BACK), 0, 0, RDW_INVALIDATE|RDW_UPDATENOW); } } break; case IDC_CHANGE_FORE: { spec_param * ptr = reinterpret_cast<spec_param*>(uGetWindowLong(wnd,DWL_USER)); COLORREF COLOR = ptr->cr_fore; COLORREF COLORS[16] = {get_default_colour(colours::COLOUR_TEXT),GetSysColor(COLOR_3DSHADOW),0,0,0,0,0,0,0,0,0,0,0,0,0,0}; if (uChooseColor(&COLOR, wnd, &COLORS[0])) { ptr->cr_fore = COLOR; ptr->flush_fore(); RedrawWindow(GetDlgItem(wnd, IDC_PATCH_FORE), 0, 0, RDW_INVALIDATE|RDW_UPDATENOW); } } break; case IDC_BARS: { spec_param * ptr = reinterpret_cast<spec_param*>(uGetWindowLong(wnd,DWL_USER)); ptr->mode = (uSendMessage((HWND)lp, BM_GETCHECK, 0, 0) != TRUE ? MODE_STANDARD : MODE_BARS); } break; case IDC_FRAME_COMBO|(CBN_SELCHANGE<<16): { spec_param * ptr = reinterpret_cast<spec_param*>(uGetWindowLong(wnd,DWL_USER)); ptr->frame = ComboBox_GetCurSel(HWND(lp)); } break; case IDC_SCALE|(CBN_SELCHANGE<<16): { spec_param * ptr = reinterpret_cast<spec_param*>(uGetWindowLong(wnd,DWL_USER)); ptr->m_scale = ComboBox_GetCurSel(HWND(lp)); } break; case IDC_VERTICAL_SCALE|(CBN_SELCHANGE<<16): { spec_param * ptr = reinterpret_cast<spec_param*>(uGetWindowLong(wnd,DWL_USER)); ptr->m_vertical_scale = ComboBox_GetCurSel(HWND(lp)); } break; case IDOK: { spec_param * ptr = reinterpret_cast<spec_param*>(uGetWindowLong(wnd,DWL_USER)); EndDialog(wnd,1); } return TRUE; default: return FALSE; } default: return FALSE; } }