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 on_message(HWND wnd,UINT msg,WPARAM wp,LPARAM lp) { switch(msg) { case WM_INITDIALOG: { { HWND list = uGetDlgItem(wnd,IDC_DBLCLK); uSendMessageText(list,CB_ADDSTRING,0,"Send to autosend playlist"); uSendMessageText(list,CB_ADDSTRING,0,"Send to autosend playlist and play"); uSendMessageText(list,CB_ADDSTRING,0,"Send to playlist"); uSendMessageText(list,CB_ADDSTRING,0,"Send to playlist and play"); uSendMessageText(list,CB_ADDSTRING,0,"Add to active playlist"); SendMessage(list,CB_SETCURSEL,filter_panel::cfg_doubleclickaction,0); list = uGetDlgItem(wnd,IDC_MIDDLE); uSendMessageText(list,CB_ADDSTRING,0,"None"); uSendMessageText(list,CB_ADDSTRING,0,"Send to autosend playlist"); uSendMessageText(list,CB_ADDSTRING,0,"Send to autosend playlist and play"); uSendMessageText(list,CB_ADDSTRING,0,"Send to playlist"); uSendMessageText(list,CB_ADDSTRING,0,"Send to playlist and play"); uSendMessageText(list,CB_ADDSTRING,0,"Add to active playlist"); SendMessage(list,CB_SETCURSEL,filter_panel::cfg_middleclickaction,0); uSendDlgItemMessageText(wnd,IDC_EDGESTYLE,CB_ADDSTRING,0,"None"); uSendDlgItemMessageText(wnd,IDC_EDGESTYLE,CB_ADDSTRING,0,"Sunken"); uSendDlgItemMessageText(wnd,IDC_EDGESTYLE,CB_ADDSTRING,0,"Grey"); uSendDlgItemMessageText(wnd,IDC_EDGESTYLE,CB_SETCURSEL,filter_panel::cfg_edgestyle,0); uSendDlgItemMessageText(wnd,IDC_PRECEDENCE,CB_ADDSTRING,0,"By position in splitter"); uSendDlgItemMessageText(wnd,IDC_PRECEDENCE,CB_ADDSTRING,0,"By field list above"); uSendDlgItemMessageText(wnd,IDC_PRECEDENCE,CB_SETCURSEL,filter_panel::cfg_orderedbysplitters ? 0 : 1,0); SendDlgItemMessage(wnd,IDC_SPINPADDING,UDM_SETRANGE32,-100,100); HWND wnd_fields = m_field_list.create_in_dialog_units(wnd, ui_helpers::window_position_t(20,17,278,79)); SetWindowPos(wnd_fields, HWND_TOP, 0,0,0,0,SWP_NOSIZE|SWP_NOMOVE); ShowWindow(wnd_fields, SW_SHOWNORMAL); } refresh_me(wnd); } break; case WM_DESTROY: { //if (m_changed) // filter_panel::g_on_fields_change(); m_field_list.destroy(); } break; case WM_COMMAND: switch(wp) { case IDC_FILTER_HELP: { const char * text = "You can use either enter field names (for remappings, separate multiple field names by a semi-colon) or titleformatting scripts to specify fields. " "For example, \"Album Artist;Artist\" or \"%album artist%\".\r\n\r\n" "Only the former format supports multiple values per field and is compatible with inline metadata editing."; message_window_t::g_run(wnd, "Filter Field Help", text); } break; case IDC_UP: { if (m_field_list.get_selection_count(2) == 1) { t_size index = 0, count = m_field_list.get_item_count(); while (!m_field_list.get_item_selected(index) && index < count) index++; if (index && filter_panel::cfg_field_list.get_count()) { filter_panel::cfg_field_list.swap_items(index, index-1); filter_panel::filter_panel_t::g_on_fields_swapped(index, index - 1); pfc::list_t<t_list_view::t_item_insert> items; get_insert_items(index-1, 2, items); m_field_list.replace_items(index-1, items); m_field_list.set_item_selected_single(index-1); } } } break; case IDC_DOWN: { if (m_field_list.get_selection_count(2) == 1) { t_size index = 0, count = m_field_list.get_item_count(); while (!m_field_list.get_item_selected(index) && index < count) index++; if (index+1 < count && index + 1 < filter_panel::cfg_field_list.get_count()) { filter_panel::cfg_field_list.swap_items(index, index+1); filter_panel::filter_panel_t::g_on_fields_swapped(index, index + 1); pfc::list_t<t_list_view::t_item_insert> items; get_insert_items(index, 2, items); m_field_list.replace_items(index, items); m_field_list.set_item_selected_single(index+1); } } } break; case IDC_NEW: { filter_panel::field_t temp; temp.m_name = "<enter name here>"; temp.m_field = "<enter field here>"; t_size index = filter_panel::cfg_field_list.add_item(temp); filter_panel::filter_panel_t::g_on_new_field(temp); pfc::list_t<t_list_view::t_item_insert> items; get_insert_items(index, 1, items); m_field_list.insert_items(index, 1, items.get_ptr()); m_field_list.set_item_selected_single(index); SetFocus(m_field_list.get_wnd()); m_field_list.activate_inline_editing(); } break; case IDC_REMOVE: { if (m_field_list.get_selection_count(2) == 1) { bit_array_bittable mask(m_field_list.get_item_count()); m_field_list.get_selection_state(mask); //bool b_found = false; t_size index=0, count=m_field_list.get_item_count(); while (index < count) { if (mask[index]) break; index++; } if (index < count && index < filter_panel::cfg_field_list.get_count()) { filter_panel::cfg_field_list.remove_by_idx(index); m_field_list.remove_item(index); filter_panel::filter_panel_t::g_on_field_removed(index); t_size new_count = m_field_list.get_item_count(); if (new_count) { if (index < new_count) m_field_list.set_item_selected_single(index); else if (index) m_field_list.set_item_selected_single(index-1); } } } } break; case IDC_SORT: { filter_panel::cfg_sort = (Button_GetCheck((HWND)lp) != BST_UNCHECKED); } break; case IDC_AUTOSEND: filter_panel::cfg_autosend = (Button_GetCheck((HWND)lp) != BST_UNCHECKED); break; case IDC_SHOWEMPTY: filter_panel::cfg_showemptyitems = (Button_GetCheck((HWND)lp) != BST_UNCHECKED); filter_panel::filter_panel_t::g_on_showemptyitems_change(filter_panel::cfg_showemptyitems); break; case (EN_CHANGE<<16)|IDC_SORT_STRING: { filter_panel::cfg_sort_string = string_utf8_from_window((HWND)lp); } break; case (EN_CHANGE<<16)|IDC_PADDING: if (!initialising) { filter_panel::cfg_vertical_item_padding = strtol(string_utf8_from_window((HWND)lp).get_ptr(), NULL, 10); filter_panel::filter_panel_t::g_on_vertical_item_padding_change(); } break; case IDC_PRECEDENCE | (CBN_SELCHANGE<<16): filter_panel::cfg_orderedbysplitters = SendMessage((HWND)lp,CB_GETCURSEL,0,0) == 0; filter_panel::filter_panel_t::g_on_orderedbysplitters_change(); break; case IDC_MIDDLE | (CBN_SELCHANGE<<16): filter_panel::cfg_middleclickaction = SendMessage((HWND)lp,CB_GETCURSEL,0,0); break; case IDC_DBLCLK | (CBN_SELCHANGE<<16): filter_panel::cfg_doubleclickaction = SendMessage((HWND)lp,CB_GETCURSEL,0,0); break; case IDC_EDGESTYLE | (CBN_SELCHANGE<<16): filter_panel::cfg_edgestyle = SendMessage((HWND)lp,CB_GETCURSEL,0,0); filter_panel::filter_panel_t::g_on_edgestyle_change(); 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; }
BOOL CALLBACK playlists_dropdown::preferences::DisplayDlgProc(HWND wnd, UINT msg, WPARAM wp, LPARAM lp) { switch (msg) { case MSG_UPDATEPREVIEW: { static_api_ptr_t<playlist_manager> pm; t_size playlist = pm->get_active_playlist(); if (playlist != pfc_infinite) { static_api_ptr_t<titleformat_compiler> cmp; titleformat_object::ptr title_format; if (cmp->compile(title_format, cfg::title_string)) { titleformat_hook_impl_splitter hook(titleformat_hook_impl_splitter( &title_format_hook(playlist, false), &titleformat_hook_impl_list(playlist, pm->get_playlist_count()))); pfc::string8 title; title_format->run(&hook, title, NULL); pfc::string8 preview; cmp->remove_color_marks(title, preview); preview.replace_char('\t', ' '); uSetDlgItemText(wnd, IDC_PREVIEW, preview); } else { uSetDlgItemText(wnd, IDC_PREVIEW, "COMPILATION ERROR"); } } else { uSetDlgItemText(wnd, IDC_PREVIEW, "N/A"); } } break; case WM_COMMAND: switch (wp) { // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= // GENERAL // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= case IDC_SHOW_ICONS: cfg::show_icons = uButton_GetCheck(wnd, IDC_SHOW_ICONS); playlists_dropdown::g_reload_icons(); playlists_dropdown::g_update_all_sizes(); playlists_dropdown::g_redraw_all(); break; case IDC_ICON_UTILS: { HMENU menu = CreatePopupMenu(); uAppendMenu(menu, MF_STRING, 1, "Clear custom icons history"); uAppendMenu(menu, MF_STRING, 2, "Reset all icons to default"); RECT rc; GetWindowRect(GetDlgItem(wnd, IDC_ICON_UTILS), &rc); int cmd = TrackPopupMenu(menu, TPM_NONOTIFY | TPM_RETURNCMD, rc.left, rc.bottom, 0, GetDlgItem(wnd, IDC_ICON_UTILS), 0); DestroyMenu(menu); if (cmd == 1 && uMessageBox(wnd, "Are you sure you want to clear all custom icons history?", "Continue?", MB_YESNO) == IDYES) { cfg::custom_icons_history.reset(); } else if (cmd == 2 && uMessageBox(wnd, "Are you sure you want to reset all icons to default?", "Continue?", MB_YESNO) == IDYES) { try { static_api_ptr_t<playlist_manager_v2> pm2; for (int i = 0, total = pm2->get_playlist_count(); i < total; i++) { pm2->playlist_remove_property(i, guid_icon_path); } } catch(...) { } } playlists_dropdown::g_reload_icons(); playlists_dropdown::g_update_all_sizes(); playlists_dropdown::g_redraw_all(); } break; case IDC_MIN_VISIBLE | EN_CHANGE << 16: cfg::min_visible = uGetDlgItemInt(wnd, IDC_MIN_VISIBLE, NULL, true); playlists_dropdown::g_update_all_min_visible(); break; case IDC_FORMATTING_STRING | EN_CHANGE << 16: if (TabCtrl_GetDlgCurSel(wnd, IDC_FS_TAB) == 0) { uGetDlgItemText(wnd, IDC_FORMATTING_STRING, cfg::title_string); uSendMessage(wnd, MSG_UPDATEPREVIEW, 0, 0); } else { uGetDlgItemText(wnd, IDC_FORMATTING_STRING, cfg::style_string); } uEnableWindow(uGetDlgItem(wnd, IDC_APPLY), true); break; // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= // PADDING // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= case IDC_PADDING_TOP | EN_CHANGE << 16: cfg::padding.get_value().top = uGetDlgItemInt(wnd, IDC_PADDING_TOP, NULL, true); playlists_dropdown::g_update_all_sizes(); playlists_dropdown::g_redraw_all(); break; case IDC_PADDING_RIGHT | EN_CHANGE << 16: cfg::padding.get_value().right = uGetDlgItemInt(wnd, IDC_PADDING_RIGHT, NULL, true); playlists_dropdown::g_update_all_sizes(); playlists_dropdown::g_redraw_all(); break; case IDC_PADDING_BOTTOM | EN_CHANGE << 16: cfg::padding.get_value().bottom = uGetDlgItemInt(wnd, IDC_PADDING_BOTTOM, NULL, true); playlists_dropdown::g_update_all_sizes(); playlists_dropdown::g_redraw_all(); break; case IDC_PADDING_LEFT | EN_CHANGE << 16: cfg::padding.get_value().left = uGetDlgItemInt(wnd, IDC_PADDING_LEFT, NULL, true); playlists_dropdown::g_update_all_sizes(); playlists_dropdown::g_redraw_all(); break; // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= // FIELDS BUTTON // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= case IDC_FIELDS: { HMENU menu = CreatePopupMenu(); for (int i = 1; i < tabsize(g_fields_list); i++) { uAppendMenu(menu, !!g_fields_list[i].label ? MF_STRING : MF_SEPARATOR, 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) { uSendDlgItemMessageText(wnd, IDC_FORMATTING_STRING, EM_REPLACESEL, TRUE, g_fields_list[cmd].label); SetFocus(GetDlgItem(wnd, IDC_FORMATTING_STRING)); } } break; // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= // APPLY // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= case IDC_APPLY: apply_config(); uEnableWindow(uGetDlgItem(wnd, IDC_APPLY), FALSE); break; } break; case WM_INITDIALOG: { EnableTheming(wnd); // Setup "Display/Style" TabControl HWND hTabWnd = uGetDlgItem(wnd, IDC_FS_TAB); uTabCtrl_InsertItemText(hTabWnd, 0, "Display"); uTabCtrl_InsertItemText(hTabWnd, 1, "Style"); TabCtrl_SetCurSel(hTabWnd, cfg::last_fs_tab); uSetDlgItemText(wnd, IDC_FORMATTING_STRING, get_formatting_string(TabCtrl_GetCurSel(hTabWnd))); uButton_SetCheck(wnd, IDC_SHOW_ICONS, cfg::show_icons); SetDlgSpinner(wnd, IDC_MIN_VISIBLE_SPIN, IDC_MIN_VISIBLE, 1, 1000, cfg::min_visible); SetDlgSpinner(wnd, IDC_PADDING_TOP_SPIN, IDC_PADDING_TOP, 0, 1024, cfg::padding.get_value().top); SetDlgSpinner(wnd, IDC_PADDING_RIGHT_SPIN, IDC_PADDING_RIGHT, 0, 1024, cfg::padding.get_value().right); SetDlgSpinner(wnd, IDC_PADDING_BOTTOM_SPIN, IDC_PADDING_BOTTOM, 0, 1024, cfg::padding.get_value().bottom); SetDlgSpinner(wnd, IDC_PADDING_LEFT_SPIN, IDC_PADDING_LEFT, 0, 1024, cfg::padding.get_value().left); uEnableWindow(uGetDlgItem(wnd, IDC_APPLY), FALSE); SendMessage(wnd, MSG_UPDATEPREVIEW, 0, 0); } break; case WM_DESTROY: cfg::last_fs_tab = TabCtrl_GetDlgCurSel(wnd, IDC_FS_TAB); break; case WM_NOTIFY: if (((LPNMHDR) lp)->idFrom == IDC_FS_TAB && ((LPNMHDR) lp)->code == TCN_SELCHANGE) { uSetDlgItemText(wnd, IDC_FORMATTING_STRING, get_formatting_string(TabCtrl_GetDlgCurSel(wnd, IDC_FS_TAB))); } break; default: return false; } return true; }