// // Save the toolbar states // void ToolManager::WriteConfig() { if( !gPrefs ) { return; } wxString oldpath = gPrefs->GetPath(); int ndx; // Change to the bar root gPrefs->SetPath( wxT("/GUI/ToolBars") ); // Save state of each bar for( ndx = 0; ndx < ToolBarCount; ndx++ ) { ToolBar *bar = mBars[ ndx ]; // Change to the bar subkey gPrefs->SetPath( bar->GetSection() ); // Search both docks for toolbar order int to = mTopDock->GetOrder( bar ); int bo = mBotDock->GetOrder( bar ); // Save gPrefs->Write( wxT("Dock"), to ? TopDockID : bo ? BotDockID : NoDockID ); gPrefs->Write( wxT("Order"), to + bo ); gPrefs->Write( wxT("Show"), IsVisible( ndx ) ); wxPoint pos( -1, -1 ); wxSize sz = bar->GetSize(); if( !bar->IsDocked() ) { pos = bar->GetParent()->GetPosition(); sz = bar->GetParent()->GetSize(); } gPrefs->Write( wxT("X"), pos.x ); gPrefs->Write( wxT("Y"), pos.y ); gPrefs->Write( wxT("W"), sz.x ); gPrefs->Write( wxT("H"), sz.y ); // Kill the bar bar->Destroy(); // Change back to the bar root gPrefs->SetPath( wxT("..") ); } // Restore original config path gPrefs->SetPath( oldpath ); gPrefs->Flush(); }