bool vgmstreamPreferences::HasChanged() { if(IsDlgButtonChecked(IDC_LOOP_FOREVER)) if(cfg_LoopForever != true) return true; if(IsDlgButtonChecked(IDC_IGNORE_LOOP)) if(cfg_IgnoreLoop != true) return true; if(IsDlgButtonChecked(IDC_LOOP_NORMALLY)) if(cfg_IgnoreLoop != false || cfg_LoopForever != false) return true; bool current_cfg_DisableSubsongs = IsDlgButtonChecked(IDC_DISABLE_SUBSONGS)?true:false; if(cfg_DisableSubsongs != current_cfg_DisableSubsongs) return true; bool current_cfg_TagfileDisable = IsDlgButtonChecked(IDC_TAGFILE_DISABLE)?true:false; if(cfg_TagfileDisable != current_cfg_TagfileDisable) return true; bool current_cfg_OverrideTitle = IsDlgButtonChecked(IDC_OVERRIDE_TITLE)?true:false; if(cfg_OverrideTitle != current_cfg_OverrideTitle) return true; pfc::string FadeLength(cfg_FadeLength); pfc::string FadeDelay(cfg_FadeDelay); pfc::string LoopCount(cfg_LoopCount); if(FadeLength != uGetDlgItemText(m_hWnd, IDC_FADE_SECONDS)) return true; if(FadeDelay != uGetDlgItemText(m_hWnd, IDC_FADE_DELAY_SECONDS)) return true; if(LoopCount != uGetDlgItemText(m_hWnd, IDC_LOOP_COUNT)) return true; pfc::string DownmixChannels(cfg_DownmixChannels); if(DownmixChannels != uGetDlgItemText(m_hWnd, IDC_DOWNMIX_CHANNELS)) return true; return FALSE; }
void vgmstreamPreferences::apply() { cfg_LoopForever = IsDlgButtonChecked(IDC_LOOP_FOREVER)?true:false; cfg_IgnoreLoop = IsDlgButtonChecked(IDC_IGNORE_LOOP)?true:false; cfg_DisableSubsongs = IsDlgButtonChecked(IDC_DISABLE_SUBSONGS)?true:false; cfg_TagfileDisable = IsDlgButtonChecked(IDC_TAGFILE_DISABLE)?true:false; cfg_OverrideTitle = IsDlgButtonChecked(IDC_OVERRIDE_TITLE)?true:false; double temp_fade_seconds; double temp_fade_delay_seconds; double temp_loop_count; int consumed; int temp_downmix_channels; pfc::string buf; buf = uGetDlgItemText(m_hWnd, IDC_FADE_SECONDS); if (sscanf(buf.get_ptr(),"%lf%n",&temp_fade_seconds,&consumed)<1 || consumed!=strlen(buf.get_ptr()) || temp_fade_seconds<0) { uMessageBox(m_hWnd, "Invalid value for Fade Length\n" "Must be a number greater than or equal to zero", "Error",MB_OK|MB_ICONERROR); return; } else cfg_FadeLength = buf.get_ptr(); buf = uGetDlgItemText(m_hWnd, IDC_LOOP_COUNT); if (sscanf(buf.get_ptr(),"%lf%n",&temp_loop_count,&consumed)<1 || consumed!=strlen(buf.get_ptr()) || temp_loop_count<0) { uMessageBox(m_hWnd, "Invalid value for Loop Count\n" "Must be a number greater than or equal to zero", "Error",MB_OK|MB_ICONERROR); return; } else cfg_LoopCount = buf.get_ptr(); buf = uGetDlgItemText(m_hWnd, IDC_FADE_DELAY_SECONDS); if (sscanf(buf.get_ptr(),"%lf%n",&temp_fade_delay_seconds,&consumed)<1 || consumed!=strlen(buf.get_ptr()) || temp_fade_delay_seconds<0) { uMessageBox(m_hWnd, "Invalid value for Fade Delay\n" "Must be a number", "Error",MB_OK|MB_ICONERROR); return; } else cfg_FadeDelay = buf.get_ptr(); buf = uGetDlgItemText(m_hWnd, IDC_DOWNMIX_CHANNELS); if (sscanf(buf.get_ptr(),"%d%n",&temp_downmix_channels,&consumed)<1 || consumed!=strlen(buf.get_ptr()) || temp_downmix_channels<0) { uMessageBox(m_hWnd, "Invalid value for Downmix Channels\n" "Must be a number greater than or equal to zero", "Error",MB_OK|MB_ICONERROR); return; } else cfg_DownmixChannels = buf.get_ptr(); }
bool CMyPreferences::HasChanged() { //returns whether our dialog content is different from the current configuration (whether the apply button should be enabled or not) HWND EB = GetDlgItem(IDC_Clock); HWND CB1 = GetDlgItem(IDC_ModePlaying); HWND CB2 = GetDlgItem(IDC_ModePaused); HWND CB3 = GetDlgItem(IDC_ModeStopped); return GetDlgItemInt(IDC_COMPORT, NULL, FALSE) != cfg_COMPort || GetDlgItemInt(IDC_BAUD, NULL, FALSE) != cfg_BaudRate || GetDlgItemInt(IDC_SignAdress, NULL, FALSE) != cfg_SignAdress || uGetDlgItemText(*this, IDC_PatternPlaying) != cfg_PatternPlaying || uGetDlgItemText(*this, IDC_PatternPaused) != cfg_PatternPaused || uGetDlgItemText(*this, IDC_PatternStopped) != cfg_PatternStopped || SendMessage(CB1, CB_GETCURSEL, 0, 0) != cfg_ModePlaying - 'A' || SendMessage(CB2, CB_GETCURSEL, 0, 0) != cfg_ModePaused - 'A' || SendMessage(CB3, CB_GETCURSEL, 0, 0) != cfg_ModeStopped - 'A' || cfg_UseClock != (SendMessage(EB, BM_GETCHECK,0 , 0) == BST_CHECKED); }
static BOOL CALLBACK RenameProc(HWND wnd,UINT msg,WPARAM wp,LPARAM lp) { switch(msg) { case WM_INITDIALOG: SetWindowLongPtr(wnd,DWLP_USER,lp); { rename_param * ptr = (rename_param *)lp; ptr->m_scope.initialize(FindOwningPopup(wnd)); uSetWindowText(wnd,uStringPrintf("Rename playlist: \"%s\"",ptr->m_text->get_ptr())); uSetDlgItemText(wnd,IDC_EDIT,ptr->m_text->get_ptr()); } return 1; case WM_COMMAND: switch(wp) { case IDOK: { rename_param * ptr = (rename_param *)GetWindowLong(wnd,DWLP_USER); uGetDlgItemText(wnd,IDC_EDIT,*ptr->m_text); EndDialog(wnd,1); } break; case IDCANCEL: EndDialog(wnd,0); break; } break; case WM_CLOSE: EndDialog(wnd,0); break; } return 0; }
void vgmstreamPreferences::apply() { cfg_LoopForever = IsDlgButtonChecked(IDC_LOOP_FOREVER)?true:false; cfg_IgnoreLoop = IsDlgButtonChecked(IDC_IGNORE_LOOP)?true:false; double temp_fade_seconds; double temp_fade_delay_seconds; double temp_loop_count; int consumed; pfc::string buf; buf = uGetDlgItemText(m_hWnd, IDC_FADE_SECONDS); if (sscanf(buf.get_ptr(),"%lf%n",&temp_fade_seconds,&consumed)<1 || consumed!=strlen(buf.get_ptr()) || temp_fade_seconds<0) { uMessageBox(m_hWnd, "Invalid value for Fade Length\n" "Must be a number greater than or equal to zero", "Error",MB_OK|MB_ICONERROR); return; } else cfg_FadeLength = buf.get_ptr(); buf = uGetDlgItemText(m_hWnd, IDC_LOOP_COUNT); if (sscanf(buf.get_ptr(),"%lf%n",&temp_loop_count,&consumed)<1 || consumed!=strlen(buf.get_ptr()) || temp_loop_count<0) { uMessageBox(m_hWnd, "Invalid value for Loop Count\n" "Must be a number greater than or equal to zero", "Error",MB_OK|MB_ICONERROR); return; } else cfg_LoopCount = buf.get_ptr(); buf = uGetDlgItemText(m_hWnd, IDC_FADE_DELAY_SECONDS); if (sscanf(buf.get_ptr(),"%lf%n",&temp_fade_delay_seconds,&consumed)<1 || consumed!=strlen(buf.get_ptr()) || temp_fade_delay_seconds<0) { uMessageBox(m_hWnd, "Invalid value for Fade Delay\n" "Must be a number", "Error",MB_OK|MB_ICONERROR); return; } else cfg_FadeDelay = buf.get_ptr(); }
LRESULT CNameValueEdit::OnCommand(UINT codeNotify, int id, HWND hwndCtl) { if (id == IDOK || id == IDCANCEL) { if (id == IDOK) uGetDlgItemText(m_hWnd, IDC_EDIT_VALUE, m_value); EndDialog(id); } return 0; }
bool vgmstreamPreferences::HasChanged() { if(IsDlgButtonChecked(IDC_LOOP_FOREVER)) if(cfg_LoopForever != true) return true; if(IsDlgButtonChecked(IDC_IGNORE_LOOP)) if(cfg_IgnoreLoop != true) return true; if(IsDlgButtonChecked(IDC_LOOP_NORMALLY)) if(cfg_IgnoreLoop != false || cfg_LoopForever != false) return true; pfc::string FadeLength(cfg_FadeLength); pfc::string FadeDelay(cfg_FadeDelay); pfc::string LoopCount(cfg_LoopCount); if(FadeLength != uGetDlgItemText(m_hWnd, IDC_FADE_SECONDS)) return true; if(FadeDelay != uGetDlgItemText(m_hWnd, IDC_FADE_DELAY_SECONDS)) return true; if(LoopCount != uGetDlgItemText(m_hWnd, IDC_LOOP_COUNT)) return true; return FALSE; }
//Värkställer dialogvärdena void CMyPreferences::apply() { cfg_COMPort = GetDlgItemInt(IDC_COMPORT, NULL, FALSE); cfg_BaudRate = GetDlgItemInt(IDC_BAUD, NULL, FALSE); cfg_SignAdress = GetDlgItemInt(IDC_SignAdress, NULL, FALSE); uGetDlgItemText(*this, IDC_PatternPlaying, cfg_PatternPlaying); uGetDlgItemText(*this, IDC_PatternPaused, cfg_PatternPaused); uGetDlgItemText(*this, IDC_PatternStopped, cfg_PatternStopped); HWND EB = GetDlgItem(IDC_Clock); cfg_UseClock = (SendMessage(EB, BM_GETCHECK,0 , 0) == BST_CHECKED); HWND CB1 = GetDlgItem(IDC_ModePlaying); HWND CB2 = GetDlgItem(IDC_ModePaused); HWND CB3 = GetDlgItem(IDC_ModeStopped); cfg_ModePlaying = 'A' + SendMessage(CB1, CB_GETCURSEL, 0, 0); cfg_ModePaused = 'A' + SendMessage(CB2, CB_GETCURSEL, 0, 0); cfg_ModeStopped = 'A' + SendMessage(CB3, CB_GETCURSEL, 0, 0); OnChanged(); //our dialog content has not changed but the flags have - our currently shown values now match the settings so the apply button can be disabled }
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; }
bool Write_Tag(LPCSTR filename, void* tagHandle) { // TODO: // read metadata from tagHandle and set each field to supported tag // only TAGFIELD_* are supported (see QCDModTagEditor.h) // example of how to get value from tagHandle // use SetFieldA for ASCII or MultiBytes strings. // use SetFieldW for UNICODE strings // // szwValue = ModInitTag.GetFieldW(tagHandle, TAGFIELD_ORCHESTRA); // write tag to file MP4FileHandle file = MP4_INVALID_FILE_HANDLE; char dummy1[1024]; char temp[1024]; short dummy, dummy2; #ifdef DEBUG_OUTPUT in_mp4_DebugOutput("mp4_tag_write"); #endif /* save Metadata changes */ tag_delete(&tags); file = MP4Read(filename, 0); if (file != MP4_INVALID_FILE_HANDLE) { ReadMP4Tag(file, &tags); MP4Close(file); file = MP4Modify(filename, 0, 0); if (file != MP4_INVALID_FILE_HANDLE) { MP4MetadataDelete(file); MP4Close(file); } } file = MP4Modify(filename, 0, 0); if (file == MP4_INVALID_FILE_HANDLE) { tag_delete(&tags); //EndDialog(hwndDlg, wParam); return false; } uGetDlgItemText(tagHandle, TAGFIELD_TITLE, dummy1, 1024); tag_set_field(&tags, "title", dummy1); uGetDlgItemText(tagHandle, TAGFIELD_COMPOSER, dummy1, 1024); tag_set_field(&tags, "writer", dummy1); uGetDlgItemText(tagHandle, TAGFIELD_ARTIST, dummy1, 1024); tag_set_field(&tags, "artist", dummy1); uGetDlgItemText(tagHandle, TAGFIELD_ALBUM, dummy1, 1024); tag_set_field(&tags, "album", dummy1); uGetDlgItemText(tagHandle, TAGFIELD_COMMENT, dummy1, 1024); tag_set_field(&tags, "comment", dummy1); uGetDlgItemText(tagHandle, TAGFIELD_GENRE, dummy1, 1024); tag_set_field(&tags, "genre", dummy1); uGetDlgItemText(tagHandle, TAGFIELD_YEAR, dummy1, 1024); tag_set_field(&tags, "year", dummy1); dummy = 0; MP4GetMetadataTrack(file, (unsigned __int16*)&dummy, (unsigned __int16*)&dummy2); memcpy(dummy1, ModInitTag.GetFieldA(tagHandle, TAGFIELD_TRACK), sizeof(dummy1)); dummy = atoi(dummy1); wsprintf(temp, "%d/%d", dummy, dummy2); tag_set_field(&tags, "track", temp); //GetDlgItemText(hwndDlg, IDC_METADISK1, dummy1, 1024); //dummy = atoi(dummy1); //GetDlgItemText(hwndDlg, IDC_METADISK2, dummy1, 1024); //dummy2 = atoi(dummy1); //wsprintf(temp, "%d/%d", dummy, dummy2); //tag_set_field(&tags, "disc", temp); //GetDlgItemText(hwndDlg, IDC_METATEMPO, dummy1, 1024); //tag_set_field(&tags, "tempo", dummy1); //dummy3 = SendMessage(GetDlgItem(hwndDlg, IDC_METACOMPILATION), BM_GETCHECK, 0, 0); //tag_set_field(&tags, "compilation", (dummy3 ? "1" : "0")); uGetDlgItemText(tagHandle, TAGFIELD_ENCODER, dummy1, 1024); tag_set_field(&tags, "tool", dummy1); uGetDlgItemText(tagHandle, TAGFIELD_CONDUCTOR, dummy1, 1024); tag_set_field(&tags, "CONDUCTOR", dummy1); uGetDlgItemText(tagHandle, TAGFIELD_ORCHESTRA, dummy1, 1024); tag_set_field(&tags, "ORCHESTRA", dummy1); uGetDlgItemText(tagHandle, TAGFIELD_YEARCOMPOSED, dummy1, 1024); tag_set_field(&tags, "YEARCOMPOSED", dummy1); uGetDlgItemText(tagHandle, TAGFIELD_ORIGARTIST, dummy1, 1024); tag_set_field(&tags, "ORIGARTIST", dummy1); uGetDlgItemText(tagHandle, TAGFIELD_LABEL, dummy1, 1024); tag_set_field(&tags, "LABEL", dummy1); uGetDlgItemText(tagHandle, TAGFIELD_COPYRIGHT, dummy1, 1024); tag_set_field(&tags, "COPYRIGHT", dummy1); uGetDlgItemText(tagHandle, TAGFIELD_CDDBTAGID, dummy1, 1024); tag_set_field(&tags, "CDDBTAGID", dummy1); WriteMP4Tag(file, &tags); MP4Close(file); MP4Optimize(filename, NULL, 0); /* ! */ return true; }
void CMyPreferences::apply() { uGetDlgItemText(*this,IDC_NAME,cfg_username); uGetDlgItemText(*this,IDC_PWD,cfg_password); OnChanged(); //our dialog content has not changed but the flags have - our currently shown values now match the settings so the apply button can be disabled }
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; }
UINT AlsongLyricLinkDialog::DialogProc(UINT iMessage, WPARAM wParam, LPARAM lParam) { switch(iMessage) { case WM_CLOSE: EndDialog(m_hWnd, 0); return TRUE; case WM_DESTROY: return TRUE; case WM_INITDIALOG: { uSetWindowText(m_hWnd, m_track->get_path()); //set artist, title field service_ptr_t<titleformat_object> to; pfc::string8 artist; pfc::string8 title; static_api_ptr_t<titleformat_compiler>()->compile_safe(to, "%artist%"); m_track->format_title(NULL, artist, to, NULL); static_api_ptr_t<titleformat_compiler>()->compile_safe(to, "%title%"); m_track->format_title(NULL, title, to, NULL); uSetDlgItemText(m_hWnd, IDC_ARTIST, artist.get_ptr()); uSetDlgItemText(m_hWnd, IDC_TITLE, title.get_ptr()); //perform listview initialization. LVCOLUMN lv; lv.mask = LVCF_WIDTH | LVCF_TEXT; lv.cx = 150; lv.pszText = TEXT("아티스트"); ListView_InsertColumn(GetDlgItem(m_hWnd, IDC_LYRICLIST), 0, &lv); lv.pszText = TEXT("제목"); ListView_InsertColumn(GetDlgItem(m_hWnd, IDC_LYRICLIST), 1, &lv); SetWindowLong(GetDlgItem(m_hWnd, IDC_NEXT), GWL_STYLE, GetWindowLong(GetDlgItem(m_hWnd, IDC_NEXT), GWL_STYLE) | WS_DISABLED); //disable next, prev button SetWindowLong(GetDlgItem(m_hWnd, IDC_PREV), GWL_STYLE, GetWindowLong(GetDlgItem(m_hWnd, IDC_NEXT), GWL_STYLE) | WS_DISABLED); } return TRUE; case WM_NOTIFY: { NMHDR *hdr = (NMHDR *)lParam; if(hdr->code == LVN_ITEMCHANGED && hdr->idFrom == IDC_LYRICLIST) { int nSel; NMLISTVIEW *nlv = (NMLISTVIEW *)lParam; nSel = nlv->iItem; LVITEM litem; litem.mask = LVIF_PARAM; litem.iItem = nSel; litem.iSubItem = 0; ListView_GetItem(GetDlgItem(m_hWnd, IDC_LYRICLIST), &litem); Lyric *res = m_searchresult->Get((int)litem.lParam); std::string lyric = res->GetRawLyric(); boost::replace_all(lyric, "<br>", "\r\n"); uSetDlgItemText(m_hWnd, IDC_LYRIC, lyric.c_str()); } } return TRUE; case WM_COMMAND: if(HIWORD(wParam) == BN_CLICKED) { switch(LOWORD(wParam)) { case IDC_SEARCH: { pfc::string8 artist; uGetDlgItemText(m_hWnd, IDC_ARTIST, artist); pfc::string8 title; uGetDlgItemText(m_hWnd, IDC_TITLE, title); if(artist.get_length() == 0) { MessageBox(m_hWnd, TEXT("아티스트를 입력해 주세요"), TEXT("에러"), MB_OK); return TRUE; } if(title.get_length() == 0) { MessageBox(m_hWnd, TEXT("제목을 입력해 주세요"), TEXT("에러"), MB_OK); return TRUE; } m_page = 0; m_lyriccount = LyricSourceAlsong().SearchLyricGetCount(artist.toString(), title.toString()); std::stringstream str; str << m_page * 100 + 1 << "~" << min(m_lyriccount, (m_page + 1) * 100) << "/" << m_lyriccount; uSetDlgItemText(m_hWnd, IDC_STATUS, str.str().c_str()); LVITEM item; HWND hListView = GetDlgItem(m_hWnd, IDC_LYRICLIST); item.mask = LVIF_TEXT; item.iItem = 0; item.iSubItem = 0; item.pszText = L""; ListView_InsertItem(hListView, &item); item.iSubItem = 1; item.mask = LVIF_TEXT; item.pszText = L"잠시 기다려 주세요"; ListView_SetItem(hListView, &item); m_searchresult = LyricSourceAlsong().SearchLyric(artist.toString(), title.toString(), 0); PopulateListView(); SetWindowLong(GetDlgItem(m_hWnd, IDC_PREV), GWL_STYLE, GetWindowLong(GetDlgItem(m_hWnd, IDC_PREV), GWL_STYLE) | WS_DISABLED); if(m_lyriccount > 100) SetWindowLong(GetDlgItem(m_hWnd, IDC_NEXT), GWL_STYLE, GetWindowLong(GetDlgItem(m_hWnd, IDC_NEXT), GWL_STYLE) & ~WS_DISABLED); else SetWindowLong(GetDlgItem(m_hWnd, IDC_NEXT), GWL_STYLE, GetWindowLong(GetDlgItem(m_hWnd, IDC_NEXT), GWL_STYLE) | WS_DISABLED); } break; case IDC_RESET: SetDlgItemText(m_hWnd, IDC_ARTIST, TEXT("")); SetDlgItemText(m_hWnd, IDC_TITLE, TEXT("")); SetDlgItemText(m_hWnd, IDC_STATUS, TEXT("")); ListView_DeleteAllItems(GetDlgItem(m_hWnd, IDC_LYRICLIST)); SetDlgItemText(m_hWnd, IDC_LYRIC, TEXT("")); SetFocus(GetDlgItem(m_hWnd, IDC_ARTIST)); SetWindowLong(GetDlgItem(m_hWnd, IDC_NEXT), GWL_STYLE, GetWindowLong(GetDlgItem(m_hWnd, IDC_NEXT), GWL_STYLE) | WS_DISABLED); SetWindowLong(GetDlgItem(m_hWnd, IDC_PREV), GWL_STYLE, GetWindowLong(GetDlgItem(m_hWnd, IDC_NEXT), GWL_STYLE) | WS_DISABLED); SetWindowLong(GetDlgItem(m_hWnd, IDC_ARTIST), GWL_STYLE, GetWindowLong(GetDlgItem(m_hWnd, IDC_ARTIST), GWL_STYLE) & ~WS_DISABLED); SetWindowLong(GetDlgItem(m_hWnd, IDC_TITLE), GWL_STYLE, GetWindowLong(GetDlgItem(m_hWnd, IDC_ARTIST), GWL_STYLE) & ~WS_DISABLED); //reset; break; case IDC_NEWLYRIC: //something break; case IDC_PREV: { if(m_page == 0) return TRUE; m_page --; pfc::string8 artist; uGetDlgItemText(m_hWnd, IDC_ARTIST, artist); pfc::string8 title; uGetDlgItemText(m_hWnd, IDC_TITLE, title); std::stringstream str; str << m_page * 100 + 1 << "~" << min(m_lyriccount, (m_page + 1) * 100) << "/" << m_lyriccount; uSetDlgItemText(m_hWnd, IDC_STATUS, str.str().c_str()); m_searchresult = LyricSourceAlsong().SearchLyric(artist.toString(), title.toString(), 0); PopulateListView(); if(m_page != 0) SetWindowLong(GetDlgItem(m_hWnd, IDC_PREV), GWL_STYLE, GetWindowLong(GetDlgItem(m_hWnd, IDC_PREV), GWL_STYLE) & ~WS_DISABLED); else SetWindowLong(GetDlgItem(m_hWnd, IDC_PREV), GWL_STYLE, GetWindowLong(GetDlgItem(m_hWnd, IDC_PREV), GWL_STYLE) | WS_DISABLED); if(m_lyriccount / 100 != m_page) SetWindowLong(GetDlgItem(m_hWnd, IDC_NEXT), GWL_STYLE, GetWindowLong(GetDlgItem(m_hWnd, IDC_NEXT), GWL_STYLE) & ~WS_DISABLED); else SetWindowLong(GetDlgItem(m_hWnd, IDC_NEXT), GWL_STYLE, GetWindowLong(GetDlgItem(m_hWnd, IDC_NEXT), GWL_STYLE) | WS_DISABLED); } break; case IDC_NEXT: { if(m_page == m_lyriccount / 100) return TRUE; m_page ++; pfc::string8 artist; uGetDlgItemText(m_hWnd, IDC_ARTIST, artist); pfc::string8 title; uGetDlgItemText(m_hWnd, IDC_TITLE, title); std::stringstream str; str << m_page * 100 + 1 << "~" << min(m_lyriccount, (m_page + 1) * 100) << "/" << m_lyriccount; uSetDlgItemText(m_hWnd, IDC_STATUS, str.str().c_str()); m_searchresult = LyricSourceAlsong().SearchLyric(artist.toString(), title.toString(), 0); PopulateListView(); if(m_page != 0) SetWindowLong(GetDlgItem(m_hWnd, IDC_PREV), GWL_STYLE, GetWindowLong(GetDlgItem(m_hWnd, IDC_PREV), GWL_STYLE) & ~WS_DISABLED); else SetWindowLong(GetDlgItem(m_hWnd, IDC_PREV), GWL_STYLE, GetWindowLong(GetDlgItem(m_hWnd, IDC_PREV), GWL_STYLE) | WS_DISABLED); if(m_lyriccount / 100 != m_page) SetWindowLong(GetDlgItem(m_hWnd, IDC_NEXT), GWL_STYLE, GetWindowLong(GetDlgItem(m_hWnd, IDC_NEXT), GWL_STYLE) & ~WS_DISABLED); else SetWindowLong(GetDlgItem(m_hWnd, IDC_NEXT), GWL_STYLE, GetWindowLong(GetDlgItem(m_hWnd, IDC_NEXT), GWL_STYLE) | WS_DISABLED); } break; case IDC_SYNCEDIT: break; case IDC_REGISTER: { int nSel; nSel = SendMessage(GetDlgItem(m_hWnd, IDC_LYRICLIST), LVM_GETSELECTIONMARK, 0, 0); LVITEM litem; litem.mask = LVIF_PARAM; litem.iItem = nSel; litem.iSubItem = 0; ListView_GetItem(GetDlgItem(m_hWnd, IDC_LYRICLIST), &litem); if(LyricSourceAlsong().Save(m_track, *m_searchresult->Get(litem.lParam))) { MessageBox(m_hWnd, TEXT("등록 성공"), TEXT("안내"), MB_OK); static_api_ptr_t<play_control> pc; metadb_handle_ptr p_track; pc->get_now_playing(p_track); if(p_track == m_track) LyricManager::Reload(p_track); EndDialog(m_hWnd, 0); return TRUE; } MessageBox(m_hWnd, TEXT("등록 실패"), TEXT("안내"), MB_OK); } break; case IDC_CANCEL: EndDialog(m_hWnd, 0); break; } } return TRUE; } return FALSE; }