static BOOL CALLBACK ConfigProc(HWND wnd, UINT msg, WPARAM wp, LPARAM lp) { switch (msg) { case WM_INITDIALOG: { refresh_me(wnd); initialised = true; } break; case WM_DESTROY: { initialised = false; } break; case WM_COMMAND: switch (wp) { case (EN_CHANGE << 16) | IDC_STRING: main_window::config_notification_icon_script.set(string_utf8_from_window((HWND)lp)); break; case IDC_NOWPL: { cfg_np = uSendMessage((HWND)lp, BM_GETCHECK, 0, 0); } break; case IDC_USE_CUSTOM_ICON: { cfg_custom_icon = uSendMessage((HWND)lp, BM_GETCHECK, 0, 0); create_icon_handle(); create_systray_icon(); } break; case IDC_BROWSE_ICON: { pfc::string8 path = cfg_tray_icon_path; if (uGetOpenFileName(wnd, "Icon Files (*.ico)|*.ico|All Files (*.*)|*.*", 0, "ico", "Choose Icon", NULL, path, FALSE)) { cfg_tray_icon_path = path; if (cfg_custom_icon) { create_icon_handle(); create_systray_icon(); } } } break; case IDC_MINIMISE_TO_SYSTRAY: { cfg_minimise_to_tray = uSendMessage((HWND)lp, BM_GETCHECK, 0, 0); } break; case IDC_SHOW_SYSTRAY: { cfg_show_systray = uSendMessage((HWND)lp, BM_GETCHECK, 0, 0); // EnableWindow(GetDlgItem(wnd, IDC_MINIMISE_TO_SYSTRAY), cfg_show_systray); if (g_main_window) { auto is_iconic = IsIconic(g_main_window) != 0; if (cfg_show_systray && !g_icon_created) { create_systray_icon(); } else if (!cfg_show_systray && g_icon_created && (!is_iconic || !cfg_minimise_to_tray)) { destroy_systray_icon(); if (is_iconic) standard_commands::main_activate(); } if (g_status) update_systray(); } } break; case IDC_BALLOON: { cfg_balloon = uSendMessage((HWND)lp, BM_GETCHECK, 0, 0); } break; } } return 0; }
static BOOL CALLBACK ConfigProc(HWND wnd, UINT msg, WPARAM wp, LPARAM lp) { switch (msg) { case WM_INITDIALOG: { uTCITEM tabs; memset(&tabs, 0, sizeof(tabs)); HWND wnd_tab = GetDlgItem(wnd, IDC_TAB1); tabs.mask = TCIF_TEXT; tabs.pszText = "Variables"; uTabCtrl_InsertItem(wnd_tab, 0, &tabs); tabs.pszText = "Style"; uTabCtrl_InsertItem(wnd_tab, 1, &tabs); TabCtrl_SetCurSel(wnd_tab, g_cur_tab2); uSendDlgItemMessageText(wnd, IDC_CHAR7, WM_SETTEXT, 0, "\x07"); colour_code_gen(wnd, IDC_COLOUR, false, true); uSendDlgItemMessage(wnd, IDC_STRING, EM_LIMITTEXT, 0, 0); refresh_me(wnd); editproc = (WNDPROC)SetWindowLongPtr(GetDlgItem(wnd, IDC_STRING), GWLP_WNDPROC, (LPARAM)EditHook); g_editor_font_notify.set(GetDlgItem(wnd, IDC_STRING)); } break; case WM_NOTIFY: switch (((LPNMHDR)lp)->idFrom) { case IDC_TAB1: switch (((LPNMHDR)lp)->code) { case TCN_SELCHANGE: { save_string(wnd); int id = TabCtrl_GetCurSel(GetDlgItem(wnd, IDC_TAB1)); g_cur_tab2 = id; uSendDlgItemMessageText(wnd, IDC_STRING, WM_SETTEXT, 0, (g_cur_tab2 == 0 ? cfg_globalstring : cfg_colour)); } break; } break; } break; case WM_DESTROY: { g_editor_font_notify.release(); save_string(wnd); refresh_all_playlist_views(); pvt::ng_playlist_view_t::g_update_all_items(); } break; case WM_COMMAND: switch (wp) { case IDC_GLOBAL: cfg_global = uSendMessage((HWND)lp, BM_GETCHECK, 0, 0); break; case IDC_DATE: cfg_playlist_date = uSendMessage((HWND)lp, BM_GETCHECK, 0, 0); set_day_timer(); pvt::ng_playlist_view_t::g_on_use_date_info_change(); break; case IDC_TFHELP: { RECT rc; GetWindowRect(GetDlgItem(wnd, IDC_TFHELP), &rc); // MapWindowPoints(HWND_DESKTOP, wnd, (LPPOINT)(&rc), 2); HMENU menu = CreatePopupMenu(); enum { IDM_TFHELP = 1, IDM_GHELP = 2, IDM_SPEEDTEST, IDM_PREVIEW, IDM_EDITORFONT, IDM_RESETSTYLE }; uAppendMenu(menu, (MF_STRING), IDM_TFHELP, "Titleformatting &help"); uAppendMenu(menu, (MF_STRING), IDM_GHELP, "&Global help"); uAppendMenu(menu, (MF_SEPARATOR), 0, ""); uAppendMenu(menu, (MF_STRING), IDM_SPEEDTEST, "&Speed test"); uAppendMenu(menu, (MF_STRING), IDM_PREVIEW, "&Preview to console"); uAppendMenu(menu, (MF_SEPARATOR), 0, ""); uAppendMenu(menu, (MF_STRING), IDM_EDITORFONT, "Change editor &font"); uAppendMenu(menu, (MF_SEPARATOR), 0, ""); uAppendMenu(menu, (MF_STRING), IDM_RESETSTYLE, "&Reset style string"); int cmd = TrackPopupMenu(menu, TPM_LEFTBUTTON | TPM_NONOTIFY | TPM_RETURNCMD, rc.left, rc.bottom, 0, wnd, 0); DestroyMenu(menu); if (cmd == IDM_TFHELP) { standard_commands::main_titleformat_help(); } else if (cmd == IDM_GHELP) { uMessageBox(wnd, COLOUR_HELP "\n\nNew global format: $set_global(var, val), retreive values using $get_global(var)", "Global help", 0); } else if (cmd == IDM_SPEEDTEST) { speedtest(g_columns, cfg_global != 0, cfg_oldglobal != 0, cfg_playlist_date != 0); } else if (cmd == IDM_PREVIEW) { preview_to_console(string_utf8_from_window(wnd, IDC_STRING), g_cur_tab2 != 0 && cfg_global); } else if (cmd == IDM_EDITORFONT) { if (font_picker(wnd, cfg_editor_font)) g_editor_font_notify.on_change(); } else if (cmd == IDM_RESETSTYLE) { extern const char * g_default_colour; cfg_colour = g_default_colour; if (g_cur_tab2 == 1) uSendDlgItemMessageText(wnd, IDC_STRING, WM_SETTEXT, 0, cfg_colour); refresh_all_playlist_views(); pvt::ng_playlist_view_t::g_update_all_items(); } } break; case IDC_OLDGLOBAL: cfg_oldglobal = uSendMessage((HWND)lp, BM_GETCHECK, 0, 0); break; case IDC_GLOBALSORT: cfg_global_sort = uSendMessage((HWND)lp, BM_GETCHECK, 0, 0); break; case IDC_APPLY: save_string(wnd); refresh_all_playlist_views(); pvt::ng_playlist_view_t::g_update_all_items(); break; case IDC_PICK_COLOUR: colour_code_gen(wnd, IDC_COLOUR, false, false); 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; }
static BOOL CALLBACK ConfigProc(HWND wnd, UINT msg, WPARAM wp, LPARAM lp) { switch (msg) { case WM_INITDIALOG: { uSendDlgItemMessageText(wnd, IDC_PLISTEDGE, CB_ADDSTRING, 0, "None"); uSendDlgItemMessageText(wnd, IDC_PLISTEDGE, CB_ADDSTRING, 0, "Sunken"); uSendDlgItemMessageText(wnd, IDC_PLISTEDGE, CB_ADDSTRING, 0, "Grey"); uSendDlgItemMessage(wnd, IDC_SPINPL, UDM_SETRANGE32, -100, 100); uSendDlgItemMessage(wnd, IDC_SWITCH_SPIN, UDM_SETRANGE32, 0, 10000); refresh_me(wnd); initialised = true; } break; case WM_DESTROY: { initialised = false; SendMessage(wnd, WM_COMMAND, IDC_APPLY, 0); } break; case WM_COMMAND: switch (wp) { case (EN_CHANGE << 16) | IDC_PLHEIGHT: { if (initialised) { BOOL result; int new_height = GetDlgItemInt(wnd, IDC_PLHEIGHT, &result, TRUE); if (result) cfg_plheight = new_height; // if (g_plist) uSendMessage(g_plist, LB_SETITEMHEIGHT, 0, get_pl_item_height()); playlist_switcher_t::g_on_vertical_item_padding_change(); } } break; case IDC_APPLY: if (playlist_switcher_string_changed) { playlist_switcher_t::g_refresh_all_items(); playlist_switcher_string_changed = false; } break; case IDC_PLAUTOHIDE: { cfg_pl_autohide = uSendMessage((HWND)lp, BM_GETCHECK, 0, 0); g_on_autohide_tabs_change(); // if (g_main_window) // { // bool move = false; // if (create_plist()) move = true; // if (create_tabs()) move = true; // if (move) {move_window_controls();RedrawWindow(g_main_window, 0, 0, RDW_INVALIDATE|RDW_UPDATENOW);} // } } break; case IDC_MCLICK: cfg_mclick = uSendMessage((HWND)lp, BM_GETCHECK, 0, 0); break; //case IDC_SHIFT_LMB: // cfg_playlists_shift_lmb = SendMessage((HWND)lp,BM_GETCHECK,0,0); // break; //case IDC_DELETE: //cfg_playlist_panel_delete = uSendMessage((HWND)lp,BM_GETCHECK,0,0); //break; case (EN_CHANGE << 16) | IDC_PLAYLIST_TF: cfg_playlist_switcher_tagz = string_utf8_from_window((HWND)lp); playlist_switcher_string_changed = true; break; case IDC_SIDEBAR_TOOLTIPS: cfg_playlist_sidebar_tooltips = SendMessage((HWND)lp, BM_GETCHECK, 0, 0); break; case IDC_USE_PLAYLIST_TF: cfg_playlist_switcher_use_tagz = SendMessage((HWND)lp, BM_GETCHECK, 0, 0); playlist_switcher_t::g_refresh_all_items(); playlist_switcher_string_changed = false; break; case IDC_TABS_MULTILINE: { cfg_tabs_multiline = uSendMessage((HWND)lp, BM_GETCHECK, 0, 0); g_on_multiline_tabs_change(); #if 0 if (g_main_window && g_tab) { // create_tabs(); long flags = WS_CHILD | TCS_HOTTRACK | TCS_TABS | (cfg_tabs_multiline ? TCS_MULTILINE : TCS_SINGLELINE) | WS_VISIBLE | WS_CLIPSIBLINGS | TCS_SINGLELINE; uSetWindowLong(g_tab, GWL_STYLE, flags); move_window_controls(); } #endif } break; case IDC_MCLICK3: { cfg_plm_rename = uSendMessage((HWND)lp, BM_GETCHECK, 0, 0); } break; case IDC_PLDRAG: { cfg_drag_pl = uSendMessage((HWND)lp, BM_GETCHECK, 0, 0); } break; #if 0 case IDC_MCLICK2: { cfg_mclick2 = uSendMessage((HWND)lp, BM_GETCHECK, 0, 0); } break; case IDC_TABS: { cfg_tabs = uSendMessage((HWND)lp, BM_GETCHECK, 0, 0); if (g_main_window) { create_tabs(); move_window_controls(); } } break; #endif case (CBN_SELCHANGE << 16) | IDC_PLISTEDGE: { cfg_plistframe = uSendMessage((HWND)lp, CB_GETCURSEL, 0, 0); playlist_switcher_t::g_on_edgestyle_change(); } break; } } return 0; }
static BOOL CALLBACK ConfigProc(HWND wnd, UINT msg, WPARAM wp, LPARAM lp) { switch (msg) { case WM_INITDIALOG: { uSendDlgItemMessage(wnd, IDC_SPINPL, UDM_SETRANGE32, -100, 100); uSendDlgItemMessage(wnd, IDC_SWITCH_SPIN, UDM_SETRANGE32, 0, 10000); refresh_me(wnd); initialised = true; } break; case WM_DESTROY: { initialised = false; } break; case WM_COMMAND: switch (wp) { case (EN_CHANGE << 16) | IDC_SWITCH_DELAY: { if (initialised) { BOOL result; unsigned new_height = GetDlgItemInt(wnd, IDC_SWITCH_DELAY, &result, FALSE); if (result) cfg_autoswitch_delay = new_height; } } break; case (EN_CHANGE << 16) | IDC_DROP_STRING: cfg_pgenstring = string_utf8_from_window((HWND)lp); break; #if 0 case IDC_DROP_NAME: cfg_pgen_dir = uSendMessage((HWND)lp, BM_GETCHECK, 0, 0); break; case IDC_DROP_PLAYLIST: cfg_pgen_playlist = uSendMessage((HWND)lp, BM_GETCHECK, 0, 0); break; #endif case IDC_REMOVE_UNDERSCORES: cfg_replace_drop_underscores = uSendMessage((HWND)lp, BM_GETCHECK, 0, 0); break; case IDC_DROP_USE_STRING: cfg_pgen_tf = uSendMessage((HWND)lp, BM_GETCHECK, 0, 0); break; case IDC_ACTIVATE_TARGET: main_window::config_set_activate_target_playlist_on_dropped_items(0 != SendMessage((HWND)lp, BM_GETCHECK, 0, 0)); break; case IDC_AUTOSWITCH: { cfg_drag_autoswitch = uSendMessage((HWND)lp, BM_GETCHECK, 0, 0); } break; } } return 0; }
BOOL CALLBACK tab_appearance_fonts::on_message(HWND wnd, UINT msg, WPARAM wp, LPARAM lp) { switch (msg) { case WM_INITDIALOG: { m_wnd = wnd; m_wnd_colours_mode = GetDlgItem(wnd, IDC_COLOURS_MODE); m_wnd_colours_element = GetDlgItem(wnd, IDC_COLOURS_ELEMENT); m_fonts_client_list.g_get_list(m_fonts_client_list); ComboBox_AddString(m_wnd_colours_element, L"Common (list items)"); ComboBox_AddString(m_wnd_colours_element, L"Common (labels)"); t_size i, count = m_fonts_client_list.get_count(); for (i = 0; i < count; i++) ComboBox_AddString(m_wnd_colours_element, pfc::stringcvt::string_os_from_utf8(m_fonts_client_list[i].m_name)); ComboBox_SetCurSel(m_wnd_colours_element, 0); m_element_ptr = g_fonts_manager_data.m_common_items_entry; update_mode_combobox(); update_font_desc(); update_change(); refresh_me(wnd); } break; case WM_DESTROY: { m_wnd = NULL; m_fonts_client_list.remove_all(); m_element_ptr.release(); m_element_api.release(); } break; case WM_COMMAND: switch (wp) { case IDC_CHANGE_FONT: { LOGFONT lf; get_font(lf); if (font_picker(lf, wnd)) { m_element_ptr->font = lf; update_font_desc(); on_font_changed(); } } break; case IDC_COLOURS_MODE | (CBN_SELCHANGE << 16) : { int idx = ComboBox_GetCurSel((HWND)lp); m_element_ptr->font_mode = (cui::fonts::font_mode_t)ComboBox_GetItemData((HWND)lp, idx);; update_font_desc(); update_change(); on_font_changed(); } break; case IDC_COLOURS_ELEMENT | (CBN_SELCHANGE << 16) : { int idx = ComboBox_GetCurSel((HWND)lp); m_element_api.release(); if (idx != -1) { if (idx == 0) m_element_ptr = g_fonts_manager_data.m_common_items_entry; else if (idx == 1) m_element_ptr = g_fonts_manager_data.m_common_labels_entry; else if (idx >= 2) { m_element_api = m_fonts_client_list[idx - 2].m_ptr; g_fonts_manager_data.find_by_guid(m_fonts_client_list[idx - 2].m_guid, m_element_ptr); } } update_mode_combobox(); update_font_desc(); update_change(); } return 0; /*case IDC_IMPORT: g_import_fonts_to_unified(); break;*/ } break; } return 0; }
BOOL CALLBACK on_message(HWND wnd,UINT msg,WPARAM wp,LPARAM lp) { switch(msg) { case WM_INITDIALOG: { HWND wnd_fields = m_source_list.create_in_dialog_units(wnd, ui_helpers::window_position_t(20,44,276,80)); SetWindowPos(wnd_fields, HWND_TOP, 0,0,0,0,SWP_NOSIZE|SWP_NOMOVE); refresh_me(wnd); ShowWindow(wnd_fields, SW_SHOWNORMAL); } break; case WM_DESTROY: { on_scripts_change(); } break; case WM_COMMAND: switch(wp) { #if 0 case (EN_CHANGE<<16)|IDC_FRONT: artwork_panel::cfg_front = string_utf8_from_window((HWND)lp); m_changed = true; break; case (EN_CHANGE<<16)|IDC_BACK: artwork_panel::cfg_back = string_utf8_from_window((HWND)lp); m_changed = true; break; case (EN_CHANGE<<16)|IDC_DISC: artwork_panel::cfg_disc = string_utf8_from_window((HWND)lp); m_changed = true; break; case (EN_KILLFOCUS<<16)|IDC_FRONT: case (EN_KILLFOCUS<<16)|IDC_BACK: case (EN_KILLFOCUS<<16)|IDC_DISC: on_scripts_change(); break; #endif /*case (EN_CHANGE<<16)|IDC_ICON: artwork_panel::cfg_icon = string_utf8_from_window((HWND)lp); m_changed = true; break;*/ case IDC_FB2KARTWORK|(CBN_SELCHANGE<<16): artwork_panel::cfg_fb2k_artwork_mode = ComboBox_GetCurSel((HWND)lp); break; case IDC_EDGESTYLE|(CBN_SELCHANGE<<16): artwork_panel::cfg_edge_style = ComboBox_GetCurSel((HWND)lp); artwork_panel::artwork_panel_t::g_on_edge_style_change(); break; case IDC_ADD: { RECT rc; GetWindowRect((HWND)lp, &rc); HMENU menu = CreatePopupMenu(); enum {IDM_FRONT = 1}; t_size index, indexcount = tabsize(g_artwork_sources); for (index = 0; index < indexcount; index++) { AppendMenuW(menu,(MF_STRING),index+1,pfc::stringcvt::string_wide_from_utf8(g_artwork_sources[index].m_name)); } int cmd = TrackPopupMenu(menu,TPM_LEFTBUTTON|TPM_NONOTIFY|TPM_RETURNCMD,rc.left,rc.bottom,0,wnd,0); DestroyMenu(menu); if (cmd>0 && (t_size)cmd <= indexcount) { index = cmd-1; t_size subindex = g_artwork_sources[index].m_scripts->add_item("<enter script>"); t_size combined_index = get_combined_index(index, subindex); t_list_view::t_item_insert item; item.m_groups.add_item(g_artwork_sources[index].m_name); item.m_subitems.add_item("<enter script>"); m_source_list.insert_items(combined_index, 1, &item); SetFocus(m_source_list.get_wnd()); m_source_list.set_item_selected_single(combined_index); m_source_list.activate_inline_editing(); m_source_list.m_changed = true; } } break; case IDC_REMOVE: { if (m_source_list.get_selection_count(2) == 1) { bit_array_bittable mask(m_source_list.get_item_count()); m_source_list.get_selection_state(mask); //bool b_found = false; t_size combined_index=0, count=m_source_list.get_item_count(); while (combined_index < count) { if (mask[combined_index]) break; combined_index++; } t_size index, subindex; if (combined_index < count && get_separated_index(combined_index, index, subindex)) { g_artwork_sources[index].m_scripts->remove_by_idx(subindex); m_source_list.remove_item(combined_index); m_source_list.m_changed = true; t_size new_count = m_source_list.get_item_count(); if (new_count) { if (combined_index < new_count) m_source_list.set_item_selected_single(combined_index); else if (combined_index) m_source_list.set_item_selected_single(combined_index-1); } } } } break; case IDC_UP: { if (m_source_list.get_selection_count(2) == 1) { t_size combined_index = 0; { t_size count = m_source_list.get_item_count(); while (!m_source_list.get_item_selected(combined_index) && combined_index < count) combined_index++; } t_size index, subindex, combined_index_start, count; get_group_from_combined_index(combined_index, index, subindex, combined_index_start, count); if (subindex && count) { g_artwork_sources[index].m_scripts->swap_items(subindex, subindex-1); pfc::list_t<t_list_view::t_item_insert> items; items.set_count(2); items[0].m_groups.add_item(g_artwork_sources[index].m_name); items[1].m_groups.add_item(g_artwork_sources[index].m_name); items[0].m_subitems.add_item((*g_artwork_sources[index].m_scripts)[subindex-1]); items[1].m_subitems.add_item((*g_artwork_sources[index].m_scripts)[subindex]); m_source_list.replace_items(combined_index-1, items); m_source_list.set_item_selected_single(combined_index-1); m_source_list.m_changed = true; } } } break; case IDC_DOWN: { if (m_source_list.get_selection_count(2) == 1) { t_size combined_index = 0; { t_size count = m_source_list.get_item_count(); while (!m_source_list.get_item_selected(combined_index) && combined_index < count) combined_index++; } t_size index, subindex, combined_index_start, count; get_group_from_combined_index(combined_index, index, subindex, combined_index_start, count); if (subindex + 1 < count) { g_artwork_sources[index].m_scripts->swap_items(subindex, subindex+1); pfc::list_t<t_list_view::t_item_insert> items; items.set_count(2); items[0].m_groups.add_item(g_artwork_sources[index].m_name); items[1].m_groups.add_item(g_artwork_sources[index].m_name); items[0].m_subitems.add_item((*g_artwork_sources[index].m_scripts)[subindex]); items[1].m_subitems.add_item((*g_artwork_sources[index].m_scripts)[subindex+1]); m_source_list.replace_items(combined_index, items); m_source_list.set_item_selected_single(combined_index+1); m_source_list.m_changed = true; } } } break; } } return 0; }