summaryrefslogtreecommitdiff
path: root/examples/triage/headers.cpp
diff options
context:
space:
mode:
authorGlenn Smith <glenn@vector35.com>2022-02-07 16:14:09 -0500
committerGlenn Smith <glenn@vector35.com>2022-02-07 16:14:09 -0500
commit077462c083af241bf654d87a8aaa776834f0e3dc (patch)
treec87a20690b42973ded57927beeefb313886b8faa /examples/triage/headers.cpp
parent8040830ef060f98801b797c58caba2848e36937c (diff)
Triage view: respect "prefer graph view" setting
Closes #2941
Diffstat (limited to 'examples/triage/headers.cpp')
-rw-r--r--examples/triage/headers.cpp26
1 files changed, 24 insertions, 2 deletions
diff --git a/examples/triage/headers.cpp b/examples/triage/headers.cpp
index e327153e..1bd9d732 100644
--- a/examples/triage/headers.cpp
+++ b/examples/triage/headers.cpp
@@ -33,7 +33,18 @@ void NavigationAddressLabel::clickEvent()
{
ViewFrame* viewFrame = ViewFrame::viewFrameForWidget(this);
if (viewFrame)
- viewFrame->navigate("Linear:" + viewFrame->getCurrentDataType(), m_address);
+ {
+ if (BinaryNinja::Settings::Instance()->Get<bool>("ui.view.graph.preferred") &&
+ viewFrame->getCurrentBinaryView() &&
+ viewFrame->getCurrentBinaryView()->GetAnalysisFunctionsForAddress(m_address).size() > 0)
+ {
+ viewFrame->navigate("Graph:" + viewFrame->getCurrentDataType(), m_address);
+ }
+ else
+ {
+ viewFrame->navigate("Linear:" + viewFrame->getCurrentDataType(), m_address);
+ }
+ }
}
@@ -48,7 +59,18 @@ void NavigationCodeLabel::clickEvent()
{
ViewFrame* viewFrame = ViewFrame::viewFrameForWidget(this);
if (viewFrame)
- viewFrame->navigate("Graph:" + viewFrame->getCurrentDataType(), m_address);
+ {
+ if (BinaryNinja::Settings::Instance()->Get<bool>("ui.view.graph.preferred") &&
+ viewFrame->getCurrentBinaryView() &&
+ viewFrame->getCurrentBinaryView()->GetAnalysisFunctionsForAddress(m_address).size() > 0)
+ {
+ viewFrame->navigate("Graph:" + viewFrame->getCurrentDataType(), m_address);
+ }
+ else
+ {
+ viewFrame->navigate("Linear:" + viewFrame->getCurrentDataType(), m_address);
+ }
+ }
}