MCPcopy Create free account
hub / github.com/audacity/audacity / ReadConfig

Method ReadConfig

src/toolbars/ToolManager.cpp:717–925  ·  view source on GitHub ↗

Read the toolbar states

Source from the content-addressed store, hash-verified

715// Read the toolbar states
716//
717void ToolManager::ReadConfig()
718{
719 std::vector<Identifier> unordered[ DockCount ];
720 std::vector<ToolBar*> dockedAndHidden;
721 std::map<Identifier, bool> show;
722 std::map<Identifier, int> width;
723 std::map<Identifier, int> height;
724 int x, y;
725 int dock;
726 bool someFound { false };
727
728#if defined(__WXMAC__)
729 // Disable window animation
730 wxSystemOptions::SetOption( wxMAC_WINDOW_PLAIN_TRANSITION, 1 );
731#endif
732
733 // Change to the bar root
734 auto toolbarsGroup = gPrefs->BeginGroup("/GUI/ToolBars");
735
736 ToolBarConfiguration::Legacy topLegacy, botLegacy;
737
738 int vMajor, vMinor, vMicro;
739 GetPreferencesVersion(vMajor, vMinor, vMicro);
740 bool useLegacyDock = false;
741 // note that vMajor, vMinor, and vMicro will all be zero if either it's a new audacity.cfg file
742 // or the version is less than 1.3.13 (when there were no version keys according to the comments in
743 // InitPreferences()). So for new audacity.cfg
744 // file useLegacyDock will be true, but this doesn't matter as there are no Dock or DockV2 keys in the file yet.
745 if (vMajor <= 1 ||
746 (vMajor == 2 && (vMinor <= 1 || (vMinor == 2 && vMicro <= 1)))) // version <= 2.2.1
747 useLegacyDock = true;
748
749
750 // Load and apply settings for each bar
751 ForEach([&](ToolBar *bar){
752 //wxPoint Center = mParent->GetPosition() + (mParent->GetSize() * 0.33);
753 //wxPoint Center(
754 // wxSystemSettings::GetMetric( wxSYS_SCREEN_X ) /2 ,
755 // wxSystemSettings::GetMetric( wxSYS_SCREEN_Y ) /2 );
756
757 // Change to the bar subkey
758 auto ndx = bar->GetSection();
759 auto barGroup = gPrefs->BeginGroup(ndx.GET());
760
761 const bool bShownByDefault = bar->ShownByDefault();
762 const int defaultDock = bar->DefaultDockID();
763
764 // Read in all the settings
765
766 if (useLegacyDock)
767 gPrefs->Read( wxT("Dock"), &dock, -1); // legacy version of DockV2
768 else
769 gPrefs->Read( wxT("DockV2"), &dock, -1);
770
771 const bool found = (dock != -1);
772 if (found)
773 someFound = true;
774 if (!found)

Callers

nothing calls this directly

Calls 15

GetPreferencesVersionFunction · 0.85
ForEachFunction · 0.85
ToolFrameClass · 0.85
GetSectionMethod · 0.80
SetVisibleMethod · 0.80
ResizingDoneMethod · 0.80
PostReadMethod · 0.80
LoadConfigMethod · 0.80
DockMethod · 0.80
GetDockMethod · 0.80
SetPreferredNeighborsMethod · 0.80
wxPointClass · 0.70

Tested by

no test coverage detected