void CMyPreferences::reset() { int n, o; char temp[16]; SendDlgItemMessage( IDC_INDEFINITE, BM_SETCHECK, default_cfg_indefinite ); SendDlgItemMessage( IDC_WRITE, BM_SETCHECK, default_cfg_write ); SendDlgItemMessage( IDC_WNSFE, BM_SETCHECK, default_cfg_write_nsfe ); SendDlgItemMessage( IDC_NSFEPL, BM_SETCHECK, default_cfg_nsfe_ignore_playlists ); SendDlgItemMessage( IDC_NSF4011, BM_SETCHECK, default_cfg_nsf_ignore_w4011 ); SendDlgItemMessage( IDC_ANTISURROUND, BM_SETCHECK, default_cfg_spc_anti_surround ); SendDlgItemMessage( IDC_GD3JAPANESE, BM_SETCHECK, default_cfg_vgm_gd3_prefers_japanese ); SendDlgItemMessage( IDC_EFFECTS, BM_SETCHECK, default_cfg_effects_enable ); for(n=IDC_FORMAT_NSF,o=0;n<=IDC_FORMAT_SFM;n++,o++) { SendDlgItemMessage( n, BM_SETCHECK, !! ( default_cfg_format_enable & ( 1 << o ) ) ); } print_time_crap( default_cfg_default_length, (char *)&temp ); uSetDlgItemText( m_hWnd, IDC_DLENGTH, (char *)&temp ); print_time_crap( default_cfg_default_fade, (char *)&temp ); uSetDlgItemText( m_hWnd, IDC_DFADE, (char *)&temp ); SendDlgItemMessage( IDC_SLIDER_BASS, TBM_SETPOS, 1, default_cfg_effects_bass ); SendDlgItemMessage( IDC_SLIDER_TREBLE, TBM_SETPOS, 1, default_cfg_effects_treble ); SendDlgItemMessage( IDC_SLIDER_ECHO_DEPTH, TBM_SETPOS, 1, default_cfg_effects_echo_depth ); SetDlgItemInt( IDC_SAMPLERATE, default_cfg_sample_rate, FALSE ); SendDlgItemMessage( IDC_VGMLOOPCOUNT, CB_SETCURSEL, default_cfg_vgm_loop_count ); enable_vgm_loop_count( !default_cfg_indefinite ); SendDlgItemMessage( IDC_INTERPOLATION, CB_SETCURSEL, default_cfg_spc_interpolation + 2 ); OnChanged(); }
void vgmstreamPreferences::reset() { CheckDlgButton(IDC_LOOP_FOREVER, DEFAULT_LOOP_FOREVER?BST_CHECKED:BST_UNCHECKED); CheckDlgButton(IDC_IGNORE_LOOP, DEFAULT_IGNORE_LOOP?BST_CHECKED:BST_UNCHECKED); CheckDlgButton(IDC_LOOP_NORMALLY, (!DEFAULT_IGNORE_LOOP && !DEFAULT_LOOP_FOREVER)?BST_CHECKED:BST_UNCHECKED); uSetDlgItemText(m_hWnd, IDC_LOOP_COUNT, DEFAULT_LOOP_COUNT); uSetDlgItemText(m_hWnd, IDC_FADE_SECONDS, DEFAULT_FADE_SECONDS); uSetDlgItemText(m_hWnd, IDC_FADE_DELAY_SECONDS, DEFAULT_FADE_DELAY_SECONDS); }
BOOL vgmstreamPreferences::OnInitDialog(CWindow, LPARAM) { CheckDlgButton(IDC_LOOP_FOREVER, cfg_LoopForever?BST_CHECKED:BST_UNCHECKED); CheckDlgButton(IDC_IGNORE_LOOP, cfg_IgnoreLoop?BST_CHECKED:BST_UNCHECKED); CheckDlgButton(IDC_LOOP_NORMALLY, (!cfg_IgnoreLoop && !cfg_LoopForever)?BST_CHECKED:BST_UNCHECKED); uSetDlgItemText(m_hWnd, IDC_LOOP_COUNT, cfg_LoopCount); uSetDlgItemText(m_hWnd, IDC_FADE_SECONDS, cfg_FadeLength); uSetDlgItemText(m_hWnd, IDC_FADE_DELAY_SECONDS, cfg_FadeDelay); return TRUE; }
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 CMyPreferences::apply() { char temp[16]; int t = GetDlgItemInt( IDC_SAMPLERATE, NULL, FALSE ); if ( t < 6000 ) t = 6000; else if ( t > 96000 ) t = 96000; SetDlgItemInt( IDC_SAMPLERATE, t, FALSE ); itoa( t, temp, 10 ); cfg_history_rate.add_item(temp); cfg_sample_rate = t; cfg_vgm_loop_count = SendDlgItemMessage( IDC_VGMLOOPCOUNT, CB_GETCURSEL ); cfg_spc_interpolation = SendDlgItemMessage( IDC_INTERPOLATION, CB_GETCURSEL ) - 2; t = parse_time_crap( string_utf8_from_window( GetDlgItem( IDC_DLENGTH ) ) ); if ( t != BORK_TIME ) cfg_default_length = t; else { print_time_crap( cfg_default_length, (char *)&temp ); uSetDlgItemText( m_hWnd, IDC_DLENGTH, (char *)&temp ); } t = parse_time_crap( string_utf8_from_window( GetDlgItem( IDC_DFADE ) ) ); if ( t != BORK_TIME ) cfg_default_fade = t; else { print_time_crap( cfg_default_fade, (char *)&temp ); uSetDlgItemText( m_hWnd, IDC_DFADE, (char *)&temp ); } cfg_indefinite = SendDlgItemMessage( IDC_INDEFINITE, BM_GETCHECK ); cfg_write = SendDlgItemMessage( IDC_WRITE, BM_GETCHECK ); cfg_write_nsfe = SendDlgItemMessage( IDC_WNSFE, BM_GETCHECK ); cfg_nsfe_ignore_playlists = SendDlgItemMessage( IDC_NSFEPL, BM_GETCHECK ); cfg_nsf_ignore_w4011 = SendDlgItemMessage( IDC_NSF4011, BM_GETCHECK ); cfg_spc_anti_surround = SendDlgItemMessage( IDC_ANTISURROUND, BM_GETCHECK ); cfg_vgm_gd3_prefers_japanese = SendDlgItemMessage( IDC_GD3JAPANESE, BM_GETCHECK ); cfg_effects_enable = SendDlgItemMessage( IDC_EFFECTS, BM_GETCHECK ); cfg_format_enable = ~0; for (unsigned wp = IDC_FORMAT_NSF; wp <= IDC_FORMAT_SFM; wp++) { unsigned bit = 1 << ( wp - IDC_FORMAT_NSF ); unsigned mask = ~0 ^ bit; cfg_format_enable = ( cfg_format_enable & mask ) | ( bit * SendDlgItemMessage( wp, BM_GETCHECK ) ); } cfg_effects_bass = SendDlgItemMessage( IDC_SLIDER_BASS, TBM_GETPOS ); cfg_effects_treble = SendDlgItemMessage( IDC_SLIDER_TREBLE, TBM_GETPOS ); cfg_effects_echo_depth = SendDlgItemMessage( IDC_SLIDER_ECHO_DEPTH, TBM_GETPOS ); 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 }
void vgmstreamPreferences::reset() { CheckDlgButton(IDC_LOOP_FOREVER, DEFAULT_LOOP_FOREVER?BST_CHECKED:BST_UNCHECKED); CheckDlgButton(IDC_IGNORE_LOOP, DEFAULT_IGNORE_LOOP?BST_CHECKED:BST_UNCHECKED); CheckDlgButton(IDC_LOOP_NORMALLY, (!DEFAULT_IGNORE_LOOP && !DEFAULT_LOOP_FOREVER)?BST_CHECKED:BST_UNCHECKED); uSetDlgItemText(m_hWnd, IDC_LOOP_COUNT, DEFAULT_LOOP_COUNT); uSetDlgItemText(m_hWnd, IDC_FADE_SECONDS, DEFAULT_FADE_SECONDS); uSetDlgItemText(m_hWnd, IDC_FADE_DELAY_SECONDS, DEFAULT_FADE_DELAY_SECONDS); CheckDlgButton(IDC_DISABLE_SUBSONGS, DEFAULT_DISABLE_SUBSONGS?BST_CHECKED:BST_UNCHECKED); uSetDlgItemText(m_hWnd, IDC_DOWNMIX_CHANNELS, DEFAULT_DOWNMIX_CHANNELS); CheckDlgButton(IDC_TAGFILE_DISABLE, DEFAULT_TAGFILE_DISABLE?BST_CHECKED:BST_UNCHECKED); CheckDlgButton(IDC_OVERRIDE_TITLE, DEFAULT_OVERRIDE_TITLE?BST_CHECKED:BST_UNCHECKED); }
BOOL vgmstreamPreferences::OnInitDialog(CWindow, LPARAM) { CheckDlgButton(IDC_LOOP_FOREVER, cfg_LoopForever?BST_CHECKED:BST_UNCHECKED); CheckDlgButton(IDC_IGNORE_LOOP, cfg_IgnoreLoop?BST_CHECKED:BST_UNCHECKED); CheckDlgButton(IDC_LOOP_NORMALLY, (!cfg_IgnoreLoop && !cfg_LoopForever)?BST_CHECKED:BST_UNCHECKED); uSetDlgItemText(m_hWnd, IDC_LOOP_COUNT, cfg_LoopCount); uSetDlgItemText(m_hWnd, IDC_FADE_SECONDS, cfg_FadeLength); uSetDlgItemText(m_hWnd, IDC_FADE_DELAY_SECONDS, cfg_FadeDelay); CheckDlgButton(IDC_DISABLE_SUBSONGS, cfg_DisableSubsongs?BST_CHECKED:BST_UNCHECKED); uSetDlgItemText(m_hWnd, IDC_DOWNMIX_CHANNELS, cfg_DownmixChannels); CheckDlgButton(IDC_TAGFILE_DISABLE, cfg_TagfileDisable?BST_CHECKED:BST_UNCHECKED); CheckDlgButton(IDC_OVERRIDE_TITLE, cfg_OverrideTitle?BST_CHECKED:BST_UNCHECKED); return TRUE; }
//Återställer dialogvärdena void CMyPreferences::reset() { SetDlgItemInt(IDC_COMPORT, default_cfg_ComPort, FALSE); SetDlgItemInt(IDC_BAUD, default_cfg_Baud, FALSE); SetDlgItemInt(IDC_SignAdress, default_cfg_SignAdress, FALSE); uSetDlgItemText(*this, IDC_PatternPlaying, default_cfg_PatternPlaying); uSetDlgItemText(*this, IDC_PatternPaused, default_cfg_PatternPaused); uSetDlgItemText(*this, IDC_PatternStopped, default_cfg_PatternStopped); HWND EB = GetDlgItem(IDC_Clock); SendMessage(EB, BM_SETCHECK, default_cfg_Clock ? BST_CHECKED : BST_UNCHECKED, 0); //? = inline if HWND CB1 = GetDlgItem(IDC_ModePlaying); HWND CB2 = GetDlgItem(IDC_ModePaused); HWND CB3 = GetDlgItem(IDC_ModeStopped); SendMessage(CB1, CB_SETCURSEL, default_cfg_ModePlaying - 'A', 0); SendMessage(CB2, CB_SETCURSEL, default_cfg_ModePaused - 'A', 0); SendMessage(CB3, CB_SETCURSEL, default_cfg_ModeStopped - 'A', 0); OnChanged(); }
void OnSize(UINT, CSize s) { auto DPI = QueryScreenDPIEx(*this); pfc::string_formatter msg; msg << "Current size: "; if ( DPI.cx > 0 && DPI.cy > 0 ) { msg << MulDiv( s.cx, 96, DPI.cx ) << "x" << MulDiv( s.cy, 96, DPI.cy ) << " units, "; } msg << s.cx << "x" << s.cy << " pixels"; uSetDlgItemText( *this, IDC_STATIC_SIZE, msg ); }
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 CMyPreferences::OnInitDialog(CWindow, LPARAM) { char temp[16]; SendDlgItemMessage( IDC_INDEFINITE, BM_SETCHECK, cfg_indefinite ); SendDlgItemMessage( IDC_WRITE, BM_SETCHECK, cfg_write ); SendDlgItemMessage( IDC_WNSFE, BM_SETCHECK, cfg_write_nsfe ); SendDlgItemMessage( IDC_NSFEPL, BM_SETCHECK, cfg_nsfe_ignore_playlists ); SendDlgItemMessage( IDC_NSF4011, BM_SETCHECK, cfg_nsf_ignore_w4011 ); SendDlgItemMessage( IDC_ANTISURROUND, BM_SETCHECK, cfg_spc_anti_surround ); SendDlgItemMessage( IDC_GD3JAPANESE, BM_SETCHECK, cfg_vgm_gd3_prefers_japanese ); SendDlgItemMessage( IDC_EFFECTS, BM_SETCHECK, cfg_effects_enable ); print_time_crap( cfg_default_length, (char *)&temp ); uSetDlgItemText( m_hWnd, IDC_DLENGTH, (char *)&temp ); print_time_crap( cfg_default_fade, (char *)&temp ); uSetDlgItemText( m_hWnd, IDC_DFADE, (char *)&temp ); CWindow w; w = GetDlgItem( IDC_SLIDER_BASS ); ::SendMessage( w, TBM_SETRANGE, 0, MAKELONG( 0, 255 ) ); ::SendMessage( w, TBM_SETPOS, 1, cfg_effects_bass ); w = GetDlgItem( IDC_SLIDER_TREBLE ); ::SendMessage( w, TBM_SETRANGE, 0, MAKELONG( 0, 255 ) ); ::SendMessage( w, TBM_SETPOS, 1, cfg_effects_treble ); w = GetDlgItem( IDC_SLIDER_ECHO_DEPTH ); ::SendMessage( w, TBM_SETRANGE, 0, MAKELONG( 0, 255 ) ); ::SendMessage( w, TBM_SETPOS, 1, cfg_effects_echo_depth ); int n,o; for(n=IDC_FORMAT_NSF,o=0;n<=IDC_FORMAT_SFM;n++,o++) { SendDlgItemMessage( n, BM_SETCHECK, cfg_format_enable & ( 1 << o ) ); } for(n=tabsize(srate_tab);n--;) { if (srate_tab[n] != cfg_sample_rate) { itoa(srate_tab[n], temp, 10); cfg_history_rate.add_item(temp); } } itoa( cfg_sample_rate, temp, 10 ); cfg_history_rate.add_item(temp); w = GetDlgItem( IDC_SAMPLERATE ); cfg_history_rate.setup_dropdown( w ); ::SendMessage( w, CB_SETCURSEL, 0, 0 ); w = GetDlgItem( IDC_VGMLOOPCOUNT ); uSendMessageText( w, CB_ADDSTRING, 0, "none" ); for (n = 1; n <= 10; n++) { itoa( n, temp, 10 ); uSendMessageText( w, CB_ADDSTRING, 0, temp ); } ::SendMessage( w, CB_SETCURSEL, cfg_vgm_loop_count, 0 ); enable_vgm_loop_count( !cfg_indefinite ); w = GetDlgItem( IDC_INTERPOLATION ); uSendMessageText( w, CB_ADDSTRING, 0, "None" ); uSendMessageText( w, CB_ADDSTRING, 0, "Linear" ); uSendMessageText( w, CB_ADDSTRING, 0, "Gaussian" ); uSendMessageText( w, CB_ADDSTRING, 0, "Cubic" ); uSendMessageText( w, CB_ADDSTRING, 0, "Sinc" ); ::SendMessage( w, CB_SETCURSEL, cfg_spc_interpolation + 2, 0 ); union { RECT r; POINT p [2]; }; w = GetDlgItem( IDC_GROUPBOX ); w.GetClientRect( &r ); w.MapWindowPoints( m_hWnd, &p [1], 1 ); CreateLogo( m_hWnd, p [1].x + 2, p [1].y - 181 ); return FALSE; }
bool Read_Tag(LPCSTR filename, void* tagHandle) { // TODO: // read metadata from tag and set each field to tagHandle // only TAGFIELD_* are supported (see QCDModTagEditor.h) // example of how to set value to tagHandle // use SetFieldA for ASCII or MultiBytes strings. // use SetFieldW for UNICODE strings // // ModInitTag.SetFieldW(tagHandle, TAGFIELD_COMPOSER, szwValue); // return true for successfull read, false for failure MP4FileHandle file = MP4_INVALID_FILE_HANDLE; char *pVal, dummy1[1024]; short dummy, dummy2; u_int32_t valueSize = 0; #ifdef DEBUG_OUTPUT in_mp4_DebugOutput("mp4_tag_read"); #endif file = MP4Read(filename, 0); if (file == MP4_INVALID_FILE_HANDLE) return false; /* get Metadata */ pVal = NULL; MP4GetMetadataName(file, &pVal); uSetDlgItemText(tagHandle, TAGFIELD_TITLE, pVal); pVal = NULL; MP4GetMetadataArtist(file, &pVal); uSetDlgItemText(tagHandle, TAGFIELD_ARTIST, pVal); pVal = NULL; MP4GetMetadataWriter(file, &pVal); uSetDlgItemText(tagHandle, TAGFIELD_COMPOSER, pVal); pVal = NULL; MP4GetMetadataComment(file, &pVal); uSetDlgItemText(tagHandle, TAGFIELD_COMMENT, pVal); pVal = NULL; MP4GetMetadataAlbum(file, &pVal); uSetDlgItemText(tagHandle, TAGFIELD_ALBUM, pVal); pVal = NULL; MP4GetMetadataGenre(file, &pVal); uSetDlgItemText(tagHandle, TAGFIELD_GENRE, pVal); //dummy = 0; //MP4GetMetadataTempo(file, &dummy); //if (dummy) //{ // wsprintf(dummy1, "%d", dummy); // SetDlgItemText(hwndDlg,IDC_METATEMPO, dummy1); //} dummy = 0; dummy2 = 0; MP4GetMetadataTrack(file, (unsigned __int16*)&dummy, (unsigned __int16*)&dummy2); if (dummy) { wsprintf(dummy1, "%d", dummy); ModInitTag.SetFieldA(tagHandle, TAGFIELD_TRACK, dummy1); } //if (dumm2) //{ // wsprintf(dummy1, "%d", dummy2); // SetDlgItemText(hwndDlg,IDC_METATRACK2, dummy1); //} //dummy = 0; dummy2 = 0; //MP4GetMetadataDisk(file, &dummy, &dummy2); //if (dummy) //{ // wsprintf(dummy1, "%d", dummy); // SetDlgItemText(hwndDlg,IDC_METADISK1, dummy1); //} //if (dummy) //{ // wsprintf(dummy1, "%d", dummy2); // SetDlgItemText(hwndDlg,IDC_METADISK2, dummy1); //} pVal = NULL; if (MP4GetMetadataYear(file, &pVal)) uSetDlgItemText(tagHandle, TAGFIELD_YEAR, pVal); //dummy3 = 0; //MP4GetMetadataCompilation(file, &dummy3); //if (dummy3) // SendMessage(GetDlgItem(hwndDlg, IDC_METACOMPILATION), BM_SETCHECK, BST_CHECKED, 0); pVal = NULL; MP4GetMetadataTool(file, &pVal); uSetDlgItemText(tagHandle, TAGFIELD_ENCODER, pVal); pVal = NULL; MP4GetMetadataFreeForm(file, "CONDUCTOR", (unsigned __int8**)&pVal, &valueSize); uSetDlgItemText(tagHandle, TAGFIELD_CONDUCTOR, pVal); pVal = NULL; MP4GetMetadataFreeForm(file, "ORCHESTRA", (unsigned __int8**)&pVal, &valueSize); uSetDlgItemText(tagHandle, TAGFIELD_ORCHESTRA, pVal); pVal = NULL; MP4GetMetadataFreeForm(file, "YEARCOMPOSED", (unsigned __int8**)&pVal, &valueSize); uSetDlgItemText(tagHandle, TAGFIELD_YEARCOMPOSED, pVal); pVal = NULL; MP4GetMetadataFreeForm(file, "ORIGARTIST", (unsigned __int8**)&pVal, &valueSize); uSetDlgItemText(tagHandle, TAGFIELD_ORIGARTIST, pVal); pVal = NULL; MP4GetMetadataFreeForm(file, "LABEL", (unsigned __int8**)&pVal, &valueSize); uSetDlgItemText(tagHandle, TAGFIELD_LABEL, pVal); pVal = NULL; MP4GetMetadataFreeForm(file, "COPYRIGHT", (unsigned __int8**)&pVal, &valueSize); uSetDlgItemText(tagHandle, TAGFIELD_COPYRIGHT, pVal); pVal = NULL; MP4GetMetadataFreeForm(file, "CDDBTAGID", (unsigned __int8**)&pVal, &valueSize); uSetDlgItemText(tagHandle, TAGFIELD_CDDBTAGID, pVal); /* ! Metadata */ MP4Close(file); return true; }
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; }
//Sätter alla värden när iställningarna öppnas BOOL CMyPreferences::OnInitDialog(CWindow, LPARAM) { //Sätter max läng på Text fälten HWND EB = GetDlgItem(IDC_COMPORT); SendMessage(EB, EM_LIMITTEXT, 3, 0); EB = GetDlgItem(IDC_BAUD); SendMessage(EB, EM_LIMITTEXT, 5, 0); EB = GetDlgItem(IDC_SignAdress); SendMessage(EB, EM_LIMITTEXT, 4, 0); EB = GetDlgItem(IDC_PatternPlaying); SendMessage(EB, EM_LIMITTEXT, 100, 0); EB = GetDlgItem(IDC_PatternPlaying); SendMessage(EB, EM_LIMITTEXT, 100, 0); EB = GetDlgItem(IDC_PatternStopped); SendMessage(EB, EM_LIMITTEXT, 100, 0); //Ställer in dialogerna orginal värde SetDlgItemInt(IDC_COMPORT, cfg_COMPort, FALSE); SetDlgItemInt(IDC_BAUD, cfg_BaudRate, FALSE); SetDlgItemInt(IDC_SignAdress, cfg_SignAdress, FALSE); uSetDlgItemText(*this, IDC_PatternPlaying, cfg_PatternPlaying); uSetDlgItemText(*this, IDC_PatternPaused, cfg_PatternPaused); uSetDlgItemText(*this, IDC_PatternStopped, cfg_PatternStopped); //Sätter textboxen EB = GetDlgItem(IDC_Clock); SendMessage(EB, BM_SETCHECK, cfg_UseClock ? BST_CHECKED : BST_UNCHECKED, 0); //? = inline if HWND PAT = GetDlgItem(IDC_PatternStopped); HWND MODE = GetDlgItem(IDC_ModeStopped); if(cfg_UseClock) { ::EnableWindow(PAT, FALSE); ::EnableWindow(MODE, FALSE); }else { ::EnableWindow(PAT, TRUE); ::EnableWindow(MODE, TRUE); } //Lista över lägena wchar_t * Modes[24] = { _T("Cyclic"), _T("Imidate"), _T("Open From Right"), _T("Open from Left"), _T("Open From Center"), _T("Open To Center"), _T("Cover From Center"), _T("Cover From right"), _T("Cover from left"), _T("Cover to center"), _T("Scroll up "), _T("Scroll down"), _T("Interlace to center"), _T("Interlace cover "), _T("Cover Up"), _T("Cover Down"), _T("Scanline"), _T("Explode"), _T("Pacman"), _T("Fall & Stack"), _T("Shoot"), _T("Flash"), _T("Random"), _T("Slide IN") }; //Fyller de tre lägeslistorna HWND CB1 = GetDlgItem(IDC_ModePlaying); HWND CB2 = GetDlgItem(IDC_ModePaused); HWND CB3 = GetDlgItem(IDC_ModeStopped); for(int i = 0; i<24; i++) { SendMessage(CB1, CB_ADDSTRING, 0,(LPARAM)Modes[i]); SendMessage(CB2, CB_ADDSTRING, 0,(LPARAM)Modes[i]); SendMessage(CB3, CB_ADDSTRING, 0,(LPARAM)Modes[i]); } //Lägena är gjorda som bokstäverna mellan A-X //Vi kan då göra om mellan index och läge genom att använda en bokstavs position SendMessage(CB1, CB_SETCURSEL, cfg_ModePlaying - 'A', 0); SendMessage(CB2, CB_SETCURSEL, cfg_ModePaused - 'A', 0); SendMessage(CB3, CB_SETCURSEL, cfg_ModeStopped - 'A', 0); return FALSE; }