{"id":8674,"date":"2024-01-30T10:56:47","date_gmt":"2024-01-30T18:56:47","guid":{"rendered":"https:\/\/visualgdb.com\/w\/?p=8674"},"modified":"2024-01-30T10:56:47","modified_gmt":"2024-01-30T18:56:47","slug":"advanced-navigation-bar","status":"publish","type":"post","link":"https:\/\/visualgdb.com\/documentation\/intellisense\/navbar\/","title":{"rendered":"Advanced Navigation Bar"},"content":{"rendered":"<p>VisualGDB 6.0 and newer replaces the regular navigation bar in the upper part of the source editor with its own advanced version:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2024\/01\/navbar.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-8675\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2024\/01\/navbar.png\" alt=\"\" width=\"1090\" height=\"161\" \/><\/a>The advanced navigation bar provides a quick and convenient way to see the context of the code being edited:<\/p>\n<ul>\n<li>The <a href=\"#project\">project context<\/a> <strong>(1)<\/strong> shows the current project, included file tree, and allows opening the file from another project&#8217;s context.<\/li>\n<li>The <a href=\"#file\">file context<\/a> <strong>(2)<\/strong> shows where exactly in the file you are.<\/li>\n<li>The <a href=\"#data\">data context<\/a> <strong>(3)<\/strong> shows the current function argument or assigned variable.<\/li>\n<li>The <a href=\"#target\">target context<\/a> <strong>(4) <\/strong>shows information about the entity under the caret.<\/li>\n<\/ul>\n<p>Auxiliary buttons in the right corner provide shortcuts for:<\/p>\n<ul>\n<li>Going to the definition of the selected entity <strong>(5)<\/strong><\/li>\n<li>Analyzing the IntelliSense parse timing <strong>(6)<\/strong><\/li>\n<li>Editing the current clang-format file <strong>(7)<\/strong><\/li>\n<li>Toggling <a href=\"https:\/\/visualgdb.com\/documentation\/codejumps\/\">CodeJumps annotations<\/a> <strong>(8)<\/strong><\/li>\n<\/ul>\n<h2><a id=\"project\"><\/a>Project Context<\/h2>\n<p>The first drop-down box in the navigation bar shows the <strong>project context <\/strong>of the currently edited file:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2024\/01\/file-2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-8678\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2024\/01\/file-2.png\" alt=\"\" width=\"966\" height=\"281\" \/><\/a>E.g. if both main application and the bootloader use the same UART driver with different sets of <strong>#define<\/strong>-s, you can select either of the projects in the project list <strong>(1)<\/strong>.<\/p>\n<p>Include file tree <strong>(2)<\/strong> recursively shows all headers included by the current source file, allowing you to open each of them, or jump to the corresponding <strong>#include&lt;&gt;<\/strong> directive <strong>(3)<\/strong>.<\/p>\n<p>Header files that are included by different source files could have considerably different context depending on the including file. E.g. when included by a <strong>.cpp<\/strong> file, the <strong>#ifdef __cplusplus <\/strong>blocks will get activated, while including it from a <strong>.c<\/strong> file would leave them disabled. When editing headers, VisualGDB automatically takes the context from the most recently viewed source file, showing its name in the bar <strong>(4)<\/strong>. You can then see and navigate the chain of <strong>#include&lt;&gt;<\/strong> directives leading to that header <strong>(5)<\/strong> or open it in the context of another source file <strong>(6)<\/strong>.<\/p>\n<p>If you open a file that is not explicitly included in any of the projects, you can use the project context view to copy the context (i.e. list of header search paths and <strong>#define<\/strong>-s) from one of the existing source files:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2024\/01\/newfile.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-8679\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2024\/01\/newfile.png\" alt=\"\" width=\"432\" height=\"219\" \/><\/a><\/p>\n<h2><a id=\"file\"><\/a>File Context<\/h2>\n<p>The second drop-down box in the navigation bar is the file context. It shows where exactly in the file you are located. You can configure it to show any detail level from a plain list of functions to a super-detailed tree of all <strong>#ifdefs<\/strong>, comment blocks and every single <strong>if{}<\/strong> statement:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2024\/01\/filectx-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-8682\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2024\/01\/filectx-1.png\" alt=\"\" width=\"1375\" height=\"228\" \/><\/a>The detail level is controlled via the selector at the bottom of the bar <strong>(1)<\/strong> and can be tweaked to the finest detail <strong>(2)<\/strong>. If you hold <strong>Ctrl<\/strong>, the labels in the file context view become clickable, so you can quickly go to the beginning of the current method, class, namespace, or any of the <strong>if\/for\/while<\/strong> statements. The &#8220;Explore outline&#8221; button opens the file structure in a separate <a href=\"https:\/\/visualgdb.com\/documentation\/codeexplorer\/outline\/\">Code Explorer window<\/a>, so you can keep a track of the structure without having to open the drop-down bar.<\/p>\n<p>The detail levels of the file navigation bar are called <strong>outline presets<\/strong>. You can edit them, or define your own ones by clicking the preset configuration button <strong>(2)<\/strong> and choose which entity types to show (e.g. functions, classes, variables), whether to show <strong>if()\/for()\/switch()\/case<\/strong> statements in the tree, etc:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2024\/01\/detail.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-8683\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2024\/01\/detail.png\" alt=\"\" width=\"786\" height=\"793\" \/><\/a>The outline presets are stored in <strong>%LOCALAPPDATA%\\VisualGDB\\OutlinePresets<\/strong> and can be easily deployed to other machines.<\/p>\n<h2><a id=\"data\"><\/a>Data Context<\/h2>\n<p>The Data Context drop-down helps you quickly understand where the currently selected expression is going. Consider the following code:<\/p>\n<pre class=\"\">GPIO_InitTypeDef GPIO_InitStructure = { \r\n    GPIO_PIN_12,\r\n    GPIO_MODE_OUTPUT_PP,\r\n    GPIO_NOPULL,\r\n    GPIO_SPEED_FREQ_HIGH,\r\n    0\r\n};<\/pre>\n<p>It initializes the fields of <strong>GPIO_InitStructure <\/strong>in the order in which they were declared, so getting the exact field corresponding to each line would require looking up the structure definition. <strong>Data Context<\/strong> view does exactly that: shows the current structure field or function argument whenever you are editing one, and gives you a convenient table showing how other fields\/arguments are initialized:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2024\/01\/data.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-8684\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2024\/01\/data.png\" alt=\"\" width=\"1138\" height=\"269\" \/><\/a><\/p>\n<h2><a id=\"target\"><\/a>Target Context<\/h2>\n<p>The rightmost drop-down in the navigation bar shows information about the entity that is currently under the caret. Depending on how much can fit in one line, it will show:<\/p>\n<ul>\n<li>The fully qualified name of the variable or type (e.g. std::string::npos) with each component turning into an individually clickable hyperlink when you hold Ctrl.<\/li>\n<li>The type of the variable, target type of a typedef, or arguments and return type of a function.<\/li>\n<li>The value of a preprocessor macro or explicitly defined enum constant.<\/li>\n<\/ul>\n<p><a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2024\/01\/target.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-8685\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2024\/01\/target.png\" alt=\"\" width=\"884\" height=\"426\" \/><\/a><\/p>\n<p>Opening the drop-down box can show either the local references (all uses of a variable within the current source file) or the definition of a structure\/variable that is currently under the caret.<\/p>\n<h2>Settings<\/h2>\n<p>You can configure various settings of the smart navigation bars (e.g. popup size, drop-down box width weights, etc) via <strong>Tools-&gt;Options-&gt;Text Editor-&gt;C\/C++ (VisualGDB)-&gt;Navigation Bar<\/strong>:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2024\/01\/settings.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-8686\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2024\/01\/settings.png\" alt=\"\" width=\"744\" height=\"434\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>VisualGDB 6.0 and newer replaces the regular navigation bar in the upper part of the source editor with its own<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[239],"tags":[],"_links":{"self":[{"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/posts\/8674"}],"collection":[{"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/comments?post=8674"}],"version-history":[{"count":2,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/posts\/8674\/revisions"}],"predecessor-version":[{"id":8687,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/posts\/8674\/revisions\/8687"}],"wp:attachment":[{"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/media?parent=8674"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/categories?post=8674"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/tags?post=8674"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}