1
0
Fork 0

Highlighting: use camelCase for method names in Highlight API.

This commit is contained in:
Julian Smith 2021-11-20 16:33:33 +00:00
parent 493a9fa60d
commit 0c6f4983dc
6 changed files with 44 additions and 44 deletions

View file

@ -928,7 +928,7 @@ bool DigitalFilter::configure( SGPropertyNode& prop_root,
Highlight* highlight = globals->get_subsystem<Highlight>();
for (auto in: inputs) {
for (auto& out: _output_list) {
highlight->add_property_property(
highlight->addPropertyProperty(
in->getPath(true /*simplify*/),
out->getPath(true /*simplify*/)
);

View file

@ -327,7 +327,7 @@ struct FdmInitialisedListener : SGPropertyChangeListener
{
SG_LOG(SG_GENERAL, SG_DEBUG, "fdm property association: " << from << " => " << to);
Highlight* highlight = (Highlight*) ref;
highlight->add_property_property(from, to);
highlight->addPropertyProperty(from, to);
}
void valueChanged(SGPropertyNode* node) override
{
@ -378,7 +378,7 @@ static std::string canonical(const std::string property)
}
int Highlight::highlight_nodes(osg::Node* node)
int Highlight::highlightNodes(osg::Node* node)
{
if (!s_output_stats)
{
@ -429,23 +429,23 @@ int Highlight::highlight_nodes(osg::Node* node)
-> property4
-> other nodes
*/
for (auto& property1: Highlight::find_node_properties(node))
for (auto& property1: Highlight::findNodeProperties(node))
{
/* <property1> animates <node>. */
items.insert(NameValue("property", property1));
for (auto& property2: Highlight::find_property_to_properties(property1))
for (auto& property2: Highlight::findPropertyToProperties(property1))
{
/* <property2> is set by <property1> (which animates <node>). */
items.insert(NameValue("property", property2));
}
for (auto& property3: Highlight::find_property_from_properties(property1))
for (auto& property3: Highlight::findPropertyFromProperties(property1))
{
/* <property3> sets <property1> (which animates <node>). */
items.insert(NameValue("property", property3));
for (auto& property4: Highlight::find_property_to_properties(property3))
for (auto& property4: Highlight::findPropertyToProperties(property3))
{
/* <property4> is set by <property3> (which also
sets <property1>, which animates <node>). */
@ -460,7 +460,7 @@ int Highlight::highlight_nodes(osg::Node* node)
{
const std::string& property = nv.value;
SG_LOG(SG_GENERAL, SG_DEBUG, "Looking at property=" << property);
const HighlightInfo& info = Highlight::find_property_info(property);
const HighlightInfo& info = Highlight::findPropertyInfo(property);
for (auto& node: info.nodes)
{
num_props += s_node_highlighting->highlight(node, true);
@ -468,7 +468,7 @@ int Highlight::highlight_nodes(osg::Node* node)
for (auto& dialog: info.dialogs)
{
items.insert(NameValue("dialog", dialog));
for (auto& menu: Highlight::find_menu_from_dialog(dialog))
for (auto& menu: Highlight::findMenuFromDialog(dialog))
{
items.insert(NameValue("menu", menu.description()));
}
@ -543,7 +543,7 @@ static const HighlightInfo info_empty;
static const std::set<std::string> set_string_empty;
static const std::set<HighlightMenu> set_menu_empty;
const HighlightInfo& Highlight::find_property_info(const std::string& property)
const HighlightInfo& Highlight::findPropertyInfo(const std::string& property)
{
std::string property2 = canonical(property);
auto it = s_property_to_info.find(property2);
@ -551,35 +551,35 @@ const HighlightInfo& Highlight::find_property_info(const std::string& property)
return it->second;
}
const std::set<std::string>& Highlight::find_node_properties(osg::Node* node)
const std::set<std::string>& Highlight::findNodeProperties(osg::Node* node)
{
auto it = s_node_to_properties.find(node);
if (it == s_node_to_properties.end()) return set_string_empty;
return it->second;
}
const std::set<std::string>& Highlight::find_dialog_properties(const std::string& dialog)
const std::set<std::string>& Highlight::findDialogProperties(const std::string& dialog)
{
auto it = s_dialog_to_properties.find(dialog);
if (it == s_dialog_to_properties.end()) return set_string_empty;
return it->second;
}
const std::set<std::string>& Highlight::find_keypress_properties(const std::string& keypress)
const std::set<std::string>& Highlight::findKeypressProperties(const std::string& keypress)
{
auto it = s_keypress_to_properties.find(keypress);
if (it == s_keypress_to_properties.end()) return set_string_empty;
return it->second;
}
const std::set<std::string>& Highlight::find_menu_properties(const HighlightMenu& menu)
const std::set<std::string>& Highlight::findMenuProperties(const HighlightMenu& menu)
{
auto it = s_menu_to_properties.find(menu);
if (it == s_menu_to_properties.end()) return set_string_empty;
return it->second;
}
const std::set<std::string>& Highlight::find_property_to_properties(const std::string& property)
const std::set<std::string>& Highlight::findPropertyToProperties(const std::string& property)
{
std::string property2 = canonical(property);
auto it = s_property_to_properties.find(property2);
@ -587,7 +587,7 @@ const std::set<std::string>& Highlight::find_property_to_properties(const std::s
return it->second;
}
const std::set<std::string>& Highlight::find_property_from_properties(const std::string& property)
const std::set<std::string>& Highlight::findPropertyFromProperties(const std::string& property)
{
std::string property2 = canonical(property);
auto it = s_property_from_properties.find(property2);
@ -595,7 +595,7 @@ const std::set<std::string>& Highlight::find_property_from_properties(const std:
return it->second;
}
const std::set<HighlightMenu>& Highlight::find_menu_from_dialog(const std::string& dialog)
const std::set<HighlightMenu>& Highlight::findMenuFromDialog(const std::string& dialog)
{
auto it = s_dialog_to_menus.find(dialog);
if (it == s_dialog_to_menus.end()) return set_menu_empty;
@ -605,7 +605,7 @@ const std::set<HighlightMenu>& Highlight::find_menu_from_dialog(const std::strin
/* Functions that populate our internal data. */
void Highlight::add_property_node(const std::string& property, osg::ref_ptr<osg::Node> node)
void Highlight::addPropertyNode(const std::string& property, osg::ref_ptr<osg::Node> node)
{
std::string property2 = canonical(property);
s_property_to_info[property2].nodes.insert(node);
@ -613,7 +613,7 @@ void Highlight::add_property_node(const std::string& property, osg::ref_ptr<osg:
SG_LOG(SG_INPUT, SG_DEBUG, "node=" << node.get() << " property=" << property2);
}
void Highlight::add_property_dialog(const std::string& property, const std::string& dialog)
void Highlight::addPropertyDialog(const std::string& property, const std::string& dialog)
{
std::string property2 = canonical(property);
s_property_to_info[property2].dialogs.insert(dialog);
@ -621,7 +621,7 @@ void Highlight::add_property_dialog(const std::string& property, const std::stri
SG_LOG(SG_INPUT, SG_DEBUG, "dialog=" << dialog << " property=" << property2);
}
void Highlight::add_property_keypress(const std::string& property, const std::string& keypress)
void Highlight::addPropertyKeypress(const std::string& property, const std::string& keypress)
{
std::string property2 = canonical(property);
s_property_to_info[property2].keypresses.insert(keypress);
@ -629,7 +629,7 @@ void Highlight::add_property_keypress(const std::string& property, const std::st
SG_LOG(SG_INPUT, SG_DEBUG, "keypress=" << keypress << " property=" << property2);
}
void Highlight::add_property_menu(HighlightMenu menu, const std::string& property)
void Highlight::addPropertyMenu(HighlightMenu menu, const std::string& property)
{
std::string property2 = canonical(property);
s_property_to_info[property2].menus.insert(menu);
@ -637,14 +637,14 @@ void Highlight::add_property_menu(HighlightMenu menu, const std::string& propert
SG_LOG(SG_INPUT, SG_DEBUG, "menu=(" << menu.menu << " " << menu.item << ") property=" << property2);
}
void Highlight::add_menu_dialog(HighlightMenu menu, const std::string& dialog)
void Highlight::addMenuDialog(HighlightMenu menu, const std::string& dialog)
{
s_menu_to_dialog[menu] = dialog;
if (s_dialog_to_menus[dialog].insert(menu).second)
SG_LOG(SG_INPUT, SG_DEBUG, "menu (" << menu.menu << " " << menu.item << ") dialog=" << dialog);
}
void Highlight::add_property_property(const std::string& from0, const std::string& to0)
void Highlight::addPropertyProperty(const std::string& from0, const std::string& to0)
{
std::string from = canonical(from0);
std::string to = canonical(to0);
@ -657,11 +657,11 @@ void Highlight::add_property_property(const std::string& from0, const std::strin
// Add transitive associations.
for (auto& toto: s_property_to_properties[to])
{
Highlight::add_property_property(from, toto);
Highlight::addPropertyProperty(from, toto);
}
for (auto& fromfrom: s_property_from_properties[from])
{
Highlight::add_property_property(fromfrom, to);
Highlight::addPropertyProperty(fromfrom, to);
}
}
}

View file

@ -54,11 +54,11 @@ struct Highlight : SGSubsystem
Returns the number of properties found. Returns -1 if highlighting is not
currently enabled. */
int highlight_nodes(osg::Node* node);
int highlightNodes(osg::Node* node);
/* Returns information about nodes and UI elements that are associated with a
specific property. */
const HighlightInfo& find_property_info(const std::string& property);
const HighlightInfo& findPropertyInfo(const std::string& property);
/* Below are individual functions that return properties that are associated
@ -66,49 +66,49 @@ struct Highlight : SGSubsystem
/* Returns list of properties that are used to animate the specified OSG node.
*/
const std::set<std::string>& find_node_properties(osg::Node* node);
const std::set<std::string>& findNodeProperties(osg::Node* node);
/* Returns list of properties affected by specified dialog. */
const std::set<std::string>& find_dialog_properties(const std::string& dialog);
const std::set<std::string>& findDialogProperties(const std::string& dialog);
/* Returns list of properties affected by specified keypress. */
const std::set<std::string>& find_keypress_properties(const std::string& keypress);
const std::set<std::string>& findKeypressProperties(const std::string& keypress);
/* Returns list of properties affected by specified menu. */
const std::set<std::string>& find_menu_properties(const HighlightMenu& menu);
const std::set<std::string>& findMenuProperties(const HighlightMenu& menu);
/* Returns list of properties that are influenced by the specified property,
/e.g. if <property> is controls/flight/rudder, the returned set could contain
/surface-positions/rudder-pos-norm. */
const std::set<std::string>& find_property_to_properties(const std::string& property);
const std::set<std::string>& findPropertyToProperties(const std::string& property);
/* Returns list of properties that influence the specified property, e.g.
if <property> is /surface-positions/rudder-pos-norm, the returned set could
contain /controls/flight/rudder. */
const std::set<std::string>& find_property_from_properties(const std::string& property);
const std::set<std::string>& findPropertyFromProperties(const std::string& property);
/* Returns list of menus that open the specified dialog. */
const std::set<HighlightMenu>& find_menu_from_dialog(const std::string& dialog);
const std::set<HighlightMenu>& findMenuFromDialog(const std::string& dialog);
/* Below are functions that are used to set up associations. */
/* Should be called if <node> is animated using <property>. */
void add_property_node(const std::string& property, osg::ref_ptr<osg::Node> node);
void addPropertyNode(const std::string& property, osg::ref_ptr<osg::Node> node);
/* Should be called if <dialog> affects <property>. */
void add_property_dialog(const std::string& property, const std::string& dialog);
void addPropertyDialog(const std::string& property, const std::string& dialog);
/* Should be called if <keypress> affects <property>. */
void add_property_keypress(const std::string& property, const std::string& keypress);
void addPropertyKeypress(const std::string& property, const std::string& keypress);
/* Should be called if <menu> affects <property>. */
void add_property_menu(HighlightMenu menu, const std::string& property);
void addPropertyMenu(HighlightMenu menu, const std::string& property);
/* Should be called if <menu> opens <dialog>. */
void add_menu_dialog(HighlightMenu menu, const std::string& dialog);
void addMenuDialog(HighlightMenu menu, const std::string& dialog);
/* Should be called if two properties are associated, for example YASim
associates /controls/flight/flaps with /surface-positions/flap-pos-norm. */
void add_property_property(const std::string& property1, const std::string& property2);
void addPropertyProperty(const std::string& property1, const std::string& property2);
};

View file

@ -98,7 +98,7 @@ static void scanMenus()
std::vector<std::string> dialog_names;
findAllLeafValues(item, "dialog-name", dialog_names);
for (auto dialog_name: dialog_names) {
highlight->add_menu_dialog(HighlightMenu(menu->getIndex(), item->getIndex()), dialog_name);
highlight->addMenuDialog(HighlightMenu(menu->getIndex(), item->getIndex()), dialog_name);
}
}
}
@ -464,7 +464,7 @@ NewGUI::readDir (const SGPath& path)
std::vector<std::string> property_paths;
findAllLeafValues(props, "property", property_paths);
for (auto property_path: property_paths) {
highlight->add_property_dialog(property_path, name);
highlight->addPropertyDialog(property_path, name);
}
}
}

View file

@ -98,7 +98,7 @@ struct VisitorHighlight : osg::NodeVisitor
SG_LOG(SG_GENERAL, SG_DEBUG, spaces() << "group: " << group.libraryName() << "::" << group.className());
for (auto name: m_highlight_names)
{
m_highlight->add_property_node(name, &group);
m_highlight->addPropertyNode(name, &group);
}
m_level += 1;
traverse(group);

View file

@ -1011,7 +1011,7 @@ PickList FGRenderer::pick(const osg::Vec2& windowPos)
for (npi = np.rbegin(); npi != np.rend(); ++npi) {
if (!higlight_num_props) {
higlight_num_props = highlight->highlight_nodes(*npi);
higlight_num_props = highlight->highlightNodes(*npi);
}
SGSceneUserData* ud = SGSceneUserData::getSceneUserData(*npi);
if (!ud || (ud->getNumPickCallbacks() == 0))