4#include "MRPch/MRJson.h"
5#include "MRMesh/MRphmap.h"
25 std::shared_ptr<RibbonMenuItem>
item;
65 MRVIEWER_API
static bool addItem(
const std::shared_ptr<RibbonMenuItem>& item );
69 MRVIEWER_API
static bool delItem(
const std::shared_ptr<RibbonMenuItem>& item );
81 float captionWeight{ 1.f };
82 float captionOrderWeight{ 1.f };
83 float tooltipWeight{ 1.f };
84 float tooltipOrderWeight{ 1.f };
87 MRVIEWER_API
static std::vector<SearchResult>
search(
const std::string& searchStr,
int* captionCount =
nullptr,
88 std::vector<SearchResultWeight>* weights =
nullptr );
111 MRVIEWER_API
virtual std::vector<std::filesystem::path>
getStructureFiles_(
const std::string& fileExtension )
const;
118 MRVIEWER_API
void readUIJson_(
const std::filesystem::path& path )
const;
127 static_assert( std::is_base_of_v<RibbonMenuItem, T> );
129 template<
typename... Args>
141 std::shared_ptr<T> item_;
147 static_assert( std::is_base_of_v<RibbonMenuItem, T> );
153 for (
const auto& item : items )
155 auto plugin = std::dynamic_pointer_cast< T >( item.second.item );
158 f( plugin_ = std::move( plugin ) );
168 std::shared_ptr<T> plugin_;
169 std::function<void(std::shared_ptr<T>)> g_;
173#define MR_REGISTER_RIBBON_ITEM(pluginType) \
174 static MR::RibbonMenuItemAdder<pluginType> ribbonMenuItemAdder##pluginType##_;
177#define MR_RIBBON_ITEM_CALL(pluginType,f,g) \
178 static MR::RibbonMenuItemCall<pluginType> ribbonMenuItemCall##func##pluginType##_( f, g );
Definition MRRibbonSchema.h:59
static MRVIEWER_API RibbonSchema & schema()
static MRVIEWER_API bool delItem(const std::shared_ptr< RibbonMenuItem > &item)
static MRVIEWER_API bool addItem(const std::shared_ptr< RibbonMenuItem > &item)
static MRVIEWER_API std::vector< SearchResult > search(const std::string &searchStr, int *captionCount=nullptr, std::vector< SearchResultWeight > *weights=nullptr)
Definition MRRibbonSchema.h:96
virtual ~RibbonSchemaLoader()=default
MRVIEWER_API void sortFilesByOrder_(std::vector< std::filesystem::path > &files) const
static MRVIEWER_API void recalcItemSizes()
virtual MRVIEWER_API std::vector< std::filesystem::path > getStructureFiles_(const std::string &fileExtension) const
MRVIEWER_API void readUIJson_(const std::filesystem::path &path) const
MRVIEWER_API void readItemsJson_(const Json::Value &root) const
MRVIEWER_API void readItemsJson_(const std::filesystem::path &path) const
virtual MRVIEWER_API void loadSchema() const
MRVIEWER_API void readUIJson_(const Json::Value &root) const
static MRVIEWER_API void readMenuItemsList(const Json::Value &root, MenuItemsList &list)
RibbonSchemaLoader()=default
Definition MRCameraOrientationPlugin.h:8
std::vector< std::pair< std::string_view, float > > SplitCaptionInfo
Definition MRRibbonSchema.h:15
HashMap< std::string, MenuItemInfo > ItemMap
Definition MRRibbonSchema.h:33
std::vector< std::string > MenuItemsList
Definition MRRibbonMenuItem.h:9
HashMap< std::string, std::vector< std::string > > TabsGroupsMap
Definition MRRibbonSchema.h:34
TabsGroupsMap GroupsItemsMap
Definition MRRibbonSchema.h:35
phmap::flat_hash_map< K, V, Hash, Eq > HashMap
Definition MRMesh/MRMeshFwd.h:460
ancillary struct to hold information for search result order
Definition MRRibbonSchema.h:80
struct to hold information for search result presentation
Definition MRRibbonSchema.h:73
Definition MRRibbonSchema.h:46
MenuItemsList sceneButtonsList
Definition MRRibbonSchema.h:53
MenuItemsList defaultQuickAccessList
Definition MRRibbonSchema.h:51
TabsGroupsMap tabsMap
Definition MRRibbonSchema.h:48
GroupsItemsMap groupsMap
Definition MRRibbonSchema.h:49
std::vector< RibbonTab > tabsOrder
Definition MRRibbonSchema.h:47
ItemMap items
Definition MRRibbonSchema.h:50
MenuItemsList headerQuickAccessList
Definition MRRibbonSchema.h:52
Definition MRRibbonSchema.h:38
bool experimental
Definition MRRibbonSchema.h:41
int priority
Definition MRRibbonSchema.h:40
std::string name
Definition MRRibbonSchema.h:39