I don't think this is the optimal answer, but if you're dealing with a big source code tree, I personally like to use grep -r
. the -r stands for "recursive" and you can search recursively from a top directory downward for text inside files.
The output of grep will show the lines that match your search term, and which file they're in.
grep is available on *nix platforms but also has downloads available for Windows if you search it.
e.g. search for all instance of "tab" (could be a lot of hits!)
grep -ri "tab" .
The "i" here means case-insensitive, and the dot at the end means start searching in the current directory.
If you're trying to learn about the project, one thing I'd try to do is say "how do I change a small, small part of the program from X to Y?", or "how does X work", like you said.
Then, l would poke around trying to find which part of the logic deals with that.
For instance, if I search for grep -ri "Close ALL But this" -C 5 .
I get a result that includes:
./PowerEditor/src/NppNotification.cpp- if (!_tabPopupMenu.isCreated())
./PowerEditor/src/NppNotification.cpp- // IMPORTANT: If list below is modified, you have to change the value of tabContextMenuItemPos in localization.cpp file
./PowerEditor/src/NppNotification.cpp- std::vector<MenuItemUnit> itemUnitArray;
So that gives us some code that relates to the pop-up menu coming up when you right-click on a tab. Then you can open this file, and follow it backwards to see just how it knows what a tab is, and then figure out how that tab is loaded, etc. Maybe.
I would love to hear other people's ideas for exploring an unknown codebase.