static void g_get_root_items(pfc::list_base_t<mainmenu_root_group> & p_out) { p_out.remove_all(); mnemonic_manager mnemonics; service_enum_t<mainmenu_group> e; service_ptr_t<mainmenu_group> ptr; service_ptr_t<mainmenu_group_popup> ptrp; while(e.next(ptr)) { if (ptr->get_parent() == pfc::guid_null) { if (ptr->service_query_t(ptrp)) { mainmenu_root_group item; pfc::string8 name; ptrp->get_display_string(name); item.m_guid = ptrp->get_guid(); item.m_sort_priority = ptrp->get_sort_priority(); uFixAmpersandChars_v2(name, item.m_name); name.reset(); mnemonics.process_string(item.m_name, name); pfc::stringcvt::string_os_from_utf8 os(name); item.m_name_with_accelerators.append_fromptr(os.get_ptr(), os.length()); item.m_name_with_accelerators.append_single(0); p_out.add_item(item); } } } p_out.sort_t(g_compare); }
bool splitter_window_impl::is_point_ours(HWND wnd_point, const POINT & pt_screen, pfc::list_base_t<uie::window::ptr> & p_hierarchy) { if (wnd_point == get_wnd() || IsChild(get_wnd(), wnd_point)) { if (wnd_point == get_wnd()) { p_hierarchy.add_item(this); return true; } else { t_size i, count = m_panels.get_count(); for (i = 0; i<count; i++) { uie::splitter_window_v2_ptr sptr; if (m_panels[i]->m_child.is_valid()) { if (m_panels[i]->m_child->service_query_t(sptr)) { pfc::list_t<uie::window::ptr> temp; temp.add_item(this); if (sptr->is_point_ours(wnd_point, pt_screen, temp)) { p_hierarchy.add_items(temp); return true; } } else if (wnd_point == m_panels[i]->m_wnd_child || IsChild(m_panels[i]->m_wnd_child, wnd_point)) { p_hierarchy.add_item(this); p_hierarchy.add_item(m_panels[i]->m_child); return true; } else if (wnd_point == m_panels[i]->m_wnd) { p_hierarchy.add_item(this); return true; } } } } } return false; };
bool input_entry::g_find_inputs_by_content_type(pfc::list_base_t<service_ptr_t<input_entry> > & p_out, const char * p_content_type, bool p_from_redirect) { service_enum_t<input_entry> e; service_ptr_t<input_entry> ptr; bool ret = false; while (e.next(ptr)) { if (!(p_from_redirect && ptr->is_redirect())) { if (ptr->is_our_content_type(p_content_type)) { p_out.add_item(ptr); ret = true; } } } return ret; }
bool input_entry::g_find_inputs_by_path(pfc::list_base_t<service_ptr_t<input_entry> > & p_out, const char * p_path, bool p_from_redirect) { service_enum_t<input_entry> e; service_ptr_t<input_entry> ptr; auto extension = pfc::string_extension(p_path); bool ret = false; while (e.next(ptr)) { if (!(p_from_redirect && ptr->is_redirect())) { if (ptr->is_our_path(p_path, extension)) { p_out.add_item(ptr); ret = true; } } } return ret; }
void splitter_window_impl::splitter_host_impl::get_children(pfc::list_base_t<uie::window::ptr> & p_out) { if (m_this.is_valid()) { t_size i, count = m_this->m_panels.get_count(); for (i = 0; i < count; i++) { if (m_this->m_panels[i]->m_child.is_valid()) p_out.add_item(m_this->m_panels[i]->m_child); } } }
void file_move_helper::make_new_item_list(pfc::list_base_t<metadb_handle_ptr> & p_out,const char * p_new_path,file_move_callback_manager & p_cb) { pfc::string8 new_path; filesystem::g_get_canonical_path(p_new_path,new_path); t_size n; const t_size m = m_data.get_size(); static_api_ptr_t<metadb> api; pfc::array_t<metadb_handle_ptr> hint_handles; pfc::array_t<const file_info*> hint_infos; pfc::array_t<t_filestats> hint_stats; hint_handles.set_size(m); hint_infos.set_size(m); hint_stats.set_size(m); t_size hintptr = 0; for(n=0;n<m;n++) { metadb_handle_ptr temp; api->handle_create(temp,make_playable_location(new_path,m_data[n].m_location.get_subsong())); if (m_data[n].m_have_info) { hint_handles[hintptr] = temp; hint_infos[hintptr] = &m_data[n].m_info; hint_stats[hintptr] = m_data[n].m_stats; hintptr++; } p_out.add_item(temp); } if (hintptr > 0) { p_cb.on_hint( pfc::list_const_array_t<metadb_handle_ptr,const pfc::array_t<metadb_handle_ptr> &>(hint_handles,hintptr), pfc::list_const_array_t<const file_info *,const pfc::array_t<const file_info *> &>(hint_infos,hintptr), pfc::list_const_array_t<t_filestats,const pfc::array_t<t_filestats> &>(hint_stats,hintptr) ); /* static_api_ptr_t<metadb_io>()->hint_multi( list_const_array_t<metadb_handle_ptr,const array_t<metadb_handle_ptr> &>(hint_handles,hintptr), list_const_array_t<const file_info *,const array_t<const file_info *> &>(hint_infos,hintptr), list_const_array_t<t_filestats,const array_t<t_filestats> &>(hint_stats,hintptr), bit_array_false());*/ } }
static bool grab_items_by_path(pfc::list_base_t<metadb_handle_ptr> & p_out,const char * p_path,abort_callback & p_abort) { try { pfc::string8 path; filesystem::g_get_canonical_path(p_path,path); p_out.remove_all(); service_ptr_t<input_info_reader> reader; input_entry::g_open_for_info_read(reader,0,path,p_abort); static_api_ptr_t<metadb> l_metadb; const t_uint32 count = reader->get_subsong_count(); for(t_uint32 n=0;n<count;n++) { p_abort.check_e(); metadb_handle_ptr ptr; l_metadb->handle_create(ptr,make_playable_location(path,reader->get_subsong(n))); p_out.add_item(ptr); } return p_out.get_count() > 0; } catch(std::exception const &) {return false;} }
void splitter_window_impl::get_panels_sizes(unsigned client_width, unsigned client_height, pfc::list_base_t<unsigned> & p_out) { struct t_size_info { unsigned height; bool sized; unsigned parts; }; unsigned n, count = m_panels.get_count(), height_allocated = 0; if (count) { pfc::array_t<t_size_info> size_info; size_info.set_size(count); //size_info.fill(0); memset(size_info.get_ptr(), 0, size_info.get_size()*sizeof(t_size_info)); unsigned caption_size = g_get_caption_size(); //unsigned divider_width = 2; int available_height = get_orientation() == horizontal ? client_width : client_height; unsigned available_parts = 0; for (n = 0; n<count; n++) { unsigned panel_divider_size = get_panel_divider_size(n);; unsigned height = m_panels[n]->m_hidden ? 0 : m_panels[n]->m_size; if (height>MAXLONG) height = MAXLONG; if (available_height > (-MAXLONG + (int)height)) available_height -= height; else available_height = -MAXLONG; if (available_height > (-MAXLONG + (int)panel_divider_size)) available_height -= panel_divider_size; else available_height = -MAXLONG; size_info[n].height = height + panel_divider_size; size_info[n].parts = (m_panels[n]->m_locked || m_panels[n]->m_hidden) ? 0 : 1; available_parts += size_info[n].parts; } do { unsigned this_pass_available_parts = available_parts; int this_pass_available_height = available_height; for (n = 0; n<count; n++) { if (!size_info[n].sized) { unsigned panel_divider_size = get_panel_divider_size(n); unsigned panel_caption_size = (get_orientation() != m_panels[n]->m_caption_orientation && m_panels[n]->m_show_caption) ? caption_size : 0; unsigned height = size_info[n].height; int adjustment = 0; { adjustment = this_pass_available_parts ? MulDiv(this_pass_available_height, size_info[n].parts, this_pass_available_parts) : 0; this_pass_available_parts -= size_info[n].parts; this_pass_available_height -= adjustment; } if ((adjustment < 0 && (height > panel_divider_size ? height - panel_divider_size : 0) < (unsigned)(adjustment*-1))) { adjustment = (height > panel_divider_size ? height - panel_divider_size : 0) * -1; size_info[n].sized = true; } unsigned unadjusted = height; bool hidden = m_panels[n]->m_hidden; height += adjustment; unsigned min_height = hidden ? 0 : (get_orientation() == horizontal ? m_panels[n]->m_size_limits.min_width : m_panels[n]->m_size_limits.min_height); if (min_height < (unsigned)(pfc_infinite)-panel_divider_size - caption_size) min_height += panel_divider_size + panel_caption_size; unsigned max_height = hidden ? 0 : (get_orientation() == horizontal ? m_panels[n]->m_size_limits.max_width : m_panels[n]->m_size_limits.max_height); if (max_height < (unsigned)(pfc_infinite)-panel_divider_size - caption_size) max_height += panel_divider_size + panel_caption_size; if (get_orientation() == horizontal && m_panels[n]->m_show_toggle_area && !m_panels[n]->m_autohide) { if (max_height < unsigned(pfc_infinite) - 1) max_height++; if (min_height < unsigned(pfc_infinite) - 1) min_height++; } if (height < min_height) { height = min_height; adjustment = (height - unadjusted); size_info[n].sized = true; } else if (height > max_height) { height = max_height; adjustment = (height - unadjusted); size_info[n].sized = true; } if (m_panels[n]->m_locked || hidden) size_info[n].sized = true; if (size_info[n].sized) available_parts -= size_info[n].parts; available_height -= (height - unadjusted); size_info[n].height = height; } } } while (available_parts && available_height); for (n = 0; n<count; n++) { p_out.add_item(size_info[n].height); } } }