+
+ // Read .ini file for file history etc.
+ wxConfig *conf = (wxConfig*) wxConfig::Get();
+
+ int entries = 0;
+ conf->Read( "/History/Count", &entries );
+
+ for (int i = 0; i < entries; i++)
+ {
+ wxString tmp;
+ tmp.Printf( "/History/File%d", (int)i );
+
+ wxString res;
+ conf->Read( tmp, &res );
+
+ if (!res.empty())
+ AddToHistory( res );
+ }
+}
+
+void MyFrame::MakeHistory()
+{
+ wxMenuBar *mb = GetMenuBar();
+
+ wxASSERT( mb );
+
+ int max = m_history.GetCount();
+ if (max > HISTORY_ENTRIES)
+ max = HISTORY_ENTRIES;
+
+ for (int i = 0; i < max; i++)
+ {
+ wxMenu *menu = NULL;
+ mb->FindItem( ID_LAST_1 + i, &menu );
+ wxASSERT( menu );
+
+ wxFileName fname( m_history[(size_t)i] );
+ menu->SetLabel( ID_LAST_1 + i, fname.GetFullName() );
+ }
+}
+
+void MyFrame::AddToHistory( const wxString &fname )
+{
+ // Fill menu with history index
+ int index = m_history.Index( fname );
+
+ if (index != wxNOT_FOUND)
+ m_history.Remove( (size_t) index );
+
+ m_history.Insert( fname, 0 );
+
+ // Update menu
+ MakeHistory();