bool dsp_preset_switcher::addEntry( const char *str ) const { CONST LRESULT ret = uSendMessageText( wnd_my_combo_box , CB_ADDSTRING , NULL , str ); if( ret < 0 ) { console::printf( CONSOLE_HEADER "%s() failed" , __FUNCTION__ ); return false; } return true; }
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; }
void t_list_view::create_inline_edit(const pfc::list_base_const_t<t_size> & indices, unsigned column) { t_size indices_count = indices.get_count(); if (!indices_count) return; if (!(column < m_columns.get_count()) || m_selecting) { //console::print("internal error - edit column index out of range"); return; } { t_size item_count = m_items.get_count(); for (t_size j = 0; j < indices_count; j++) { if (indices[j] >= item_count) return; } } t_size indices_spread = indices[indices_count-1] - indices[0] +1; t_size indices_total_height = get_item_position_bottom(indices[indices_count-1]) - get_item_position(indices[0]); t_size active_count = m_items.get_count(); if (m_timer_inline_edit) { KillTimer(get_wnd(), EDIT_TIMER_ID); m_timer_inline_edit = false; } t_size median = indices[0] + indices_spread/2;//indices[(indices_count/2)]; bool start_visible = is_visible(indices[0]); bool end_visible = is_visible(indices[indices_count-1]); if (!start_visible || !end_visible) { SCROLLINFO si; memset(&si, 0, sizeof(SCROLLINFO)); si.cbSize = sizeof(si); si.fMask = SIF_POS|SIF_TRACKPOS|SIF_PAGE|SIF_RANGE; GetScrollInfo(get_wnd(), SB_VERT, &si); t_size target; if (indices_count > si.nPage) { target = median; scroll(false, get_item_position(target) + m_item_height/2 - ((si.nPage>1?si.nPage-1:0)/2)); } else { target = get_item_position(indices[0]) > (t_size)m_scroll_position ? indices[indices_count-1] : indices[0]; scroll(false, get_item_position(target) -(get_item_position(target) > (t_size)m_scroll_position ? (si.nPage>1?si.nPage-1:0) - m_item_height : 0)); } } int x = 0; { { x = get_total_indentation(); } { unsigned n, count = m_columns.get_count(); for (n=0; n<count && n<column; n++) { x += m_columns[n].m_display_size; } } } RECT rc_playlist, rc_items; GetClientRect(get_wnd(), &rc_playlist); get_items_rect(&rc_items); int font_height = uGetFontHeight(m_font); int header_height = rc_items.top;//get_header_height(); int y = (get_item_position(indices[0])-m_scroll_position) + header_height; if (y < header_height) y= header_height; int cx = m_columns[column].m_display_size; //if (column == 0) // cx -= min(x,cx); int cy = min (indices_total_height, t_size(rc_items.bottom-rc_items.top)); if (!m_autosize && ( (x - m_horizontal_scroll_position < 0) || x + cx - m_horizontal_scroll_position > rc_items.right)) { /*SCROLLINFO si; memset(&si, 0, sizeof(SCROLLINFO)); si.cbSize = sizeof(si); si.fMask = SIF_POS|SIF_TRACKPOS|SIF_PAGE|SIF_RANGE; GetScrollInfo(get_wnd(), SB_HORZ, &si);*/ if (x - m_horizontal_scroll_position < 0) { scroll(false, x, true); } else if (x + cx - m_horizontal_scroll_position > rc_items.right) { const int x_right = x + cx - rc_items.right; scroll(false, cx > rc_items.right ? x : x_right, true); } } x -= m_horizontal_scroll_position; /*int horizontal_offset = 0; if (x-horizontal_offset + cx > rc_playlist.right) scroll(scroll_horizontally, scroll_position_delta, x-horizontal_offset + (cx>rc_playlist.right?0:cx-rc_playlist.right)); else if (x-horizontal_offset < 0) scroll(scroll_horizontally, scroll_position_delta, x-horizontal_offset); x-=horizontal_offset;*/ if (m_wnd_inline_edit) { save_inline_edit(); //NEW m_inline_edit_prevent_kill = true; DestroyWindow(m_wnd_inline_edit); m_wnd_inline_edit=0; m_inline_edit_autocomplete.release(); m_inline_edit_prevent_kill = false; //END NEW } //m_inline_edit_field.set_string(pfc::empty_string_t<char>()); //m_inline_edit_items.remove_all(); //m_inline_edit_items.set_count(indices_count); //pfc::list_t<bool> mask; pfc::string8 text; t_size flags = 0; mmh::comptr_t<IUnknown> pAutoCompleteEntries; if (!notify_create_inline_edit(indices, column, text, flags, pAutoCompleteEntries)) { m_inline_edit_save = false; exit_inline_edit(); return; } if (!m_wnd_inline_edit) { m_inline_edit_save = true; m_wnd_inline_edit = CreateWindowEx(0, WC_EDIT, pfc::stringcvt::string_os_from_utf8(text).get_ptr(), WS_CHILD|WS_CLIPSIBLINGS|WS_VISIBLE|ES_LEFT| ES_AUTOHSCROLL|ES_MULTILINE|ES_AUTOVSCROLL|WS_BORDER|WS_CLIPCHILDREN|((flags & inline_edit_uppercase) ? ES_UPPERCASE : 0), x, y, cx, cy, get_wnd(), HMENU(667), core_api::get_my_instance(), 0); m_proc_original_inline_edit = (WNDPROC)GetWindowLongPtr(m_wnd_inline_edit,GWLP_WNDPROC); if (/*flags & inline_edit_autocomplete && */pAutoCompleteEntries.is_valid()) { if (SUCCEEDED(m_inline_edit_autocomplete.instantiate(CLSID_AutoComplete))) { if (pAutoCompleteEntries.is_valid()) m_inline_edit_autocomplete->Init(m_wnd_inline_edit, pAutoCompleteEntries, NULL, NULL); mmh::comptr_t<IAutoComplete2> pA2 = m_inline_edit_autocomplete; mmh::comptr_t<IAutoCompleteDropDown> pAutoCompleteDropDown = m_inline_edit_autocomplete; if (pA2.is_valid()) { pA2->SetOptions(ACO_AUTOSUGGEST|ACO_UPDOWNKEYDROPSLIST); } } } SetWindowLongPtr(m_wnd_inline_edit,GWL_USERDATA,(LPARAM)(this)); m_proc_inline_edit = (WNDPROC)SetWindowLongPtr(m_wnd_inline_edit,GWL_WNDPROC,(LPARAM)(g_on_inline_edit_message)); SetWindowPos(m_wnd_inline_edit,HWND_TOP,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE); SendMessage(m_wnd_inline_edit, WM_SETFONT, (WPARAM)m_font.get(), MAKELONG(TRUE,0)); } #if 0 else { if (m_inline_edit_autocomplete.is_valid()) m_inline_edit_autocomplete->Enable(FALSE); SetWindowLongPtr(m_wnd_inline_edit, GWL_STYLE, (GetWindowLongPtr (m_wnd_inline_edit, GWL_STYLE) & ~ES_UPPERCASE) | ((flags & inline_edit_uppercase) ? ES_UPPERCASE : 0)); SendMessage(m_wnd_inline_edit, WM_SETTEXT, 0, (LPARAM)_T("")); SetWindowPos(m_wnd_inline_edit, NULL, x, y, cx, cy, SWP_NOZORDER); uSendMessageText(m_wnd_inline_edit, WM_SETTEXT, 0, text); if (m_inline_edit_autocomplete.is_valid()) { if (pAutoCompleteEntries.is_valid()) { m_inline_edit_autocomplete->Init(m_wnd_inline_edit, pAutoCompleteEntries, NULL, NULL); m_inline_edit_autocomplete->Enable(TRUE); } } } #endif RECT rc; rc.left = x+2; rc.top = y + (cy-font_height)/2; rc.right = x+(cx>0?cx-2:0); rc.bottom = rc.top + font_height; MapWindowPoints(get_wnd(), m_wnd_inline_edit, (LPPOINT)&rc, 2); SendMessage(m_wnd_inline_edit, EM_SETRECT, NULL, (LPARAM)&rc); SendMessage(m_wnd_inline_edit, EM_SETSEL, 0, -1); SetFocus(m_wnd_inline_edit); m_inline_edit_indices.remove_all(); m_inline_edit_indices.add_items(indices); m_inline_edit_column = column; }
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; }