Example #1
0
// File history management
void FileHistory::AddFileToHistory(const wxString & file, bool update)
{
   // Needed to transition from wxFileHistory to FileHistory since there
   // can be empty history "slots".
   if (file.IsEmpty()) {
      return;
   }

#if defined(__WXMSW__)
   int i = mHistory.Index(file, false);
#else
   int i = mHistory.Index(file, true);
#endif

   if (i != wxNOT_FOUND) {
      mHistory.RemoveAt(i);
   }

   if (mMaxFiles == mHistory.GetCount()) {
      mHistory.RemoveAt(mHistory.GetCount() - 1);
   }

   mHistory.Insert(file, 0);

   if (update) {
      AddFilesToMenu();
   }
}
void wxFileHistoryBase::Load(const wxConfigBase& config)
{
    RemoveExistingHistory();

    m_fileHistory.Clear();

    wxString buf;
    buf.Printf(wxT("file%d"), 1);

    wxString historyFile;
#if defined(__INTEL_COMPILER) && 1 /* VDM auto patch */
#   pragma ivdep
#   pragma swp
#   pragma unroll
#   pragma prefetch
#   if 0
#       pragma simd noassert
#   endif
#endif /* VDM auto patch */
    while ((m_fileHistory.GetCount() < m_fileMaxFiles) &&
           config.Read(buf, &historyFile) && !historyFile.empty())
    {
        m_fileHistory.Add(historyFile);

        buf.Printf(wxT("file%d"), (int)m_fileHistory.GetCount()+1);
        historyFile = wxEmptyString;
    }

    AddFilesToMenu();
}
Example #3
0
void wxFileHistoryBase::AddFilesToMenu()
{
    if ( m_fileHistory.empty() )
        return;

    for ( wxList::compatibility_iterator node = m_fileMenus.GetFirst();
          node;
          node = node->GetNext() )
    {
        AddFilesToMenu((wxMenu *) node->GetData());
    }
}
Example #4
0
void FileHistory::RemoveFileFromHistory(size_t i, bool update)
{
   wxASSERT(i < mHistory.GetCount());

   if (i < mHistory.GetCount()) {
      mHistory.RemoveAt(i);

      if (update) {
         AddFilesToMenu();
      }
   }
}
Example #5
0
void FileHistory::Load(wxConfigBase & config, const wxString & group)
{
   mHistory.Clear();

   config.SetPath(group);

   wxString file;
   long ndx;
   bool got = config.GetFirstEntry(file, ndx);
   while (got) {
      AddFileToHistory(config.Read(file), false);
      got = config.GetNextEntry(file, ndx);
   }

   config.SetPath(wxT(".."));

   AddFilesToMenu();
}
Example #6
0
void wxFileHistoryBase::Load(const wxConfigBase& config)
{
    m_fileHistory.Clear();

    wxString buf;
    buf.Printf(wxT("file%d"), 1);

    wxString historyFile;
    while ((m_fileHistory.GetCount() < m_fileMaxFiles) &&
           config.Read(buf, &historyFile) && !historyFile.empty())
    {
        m_fileHistory.Add(historyFile);

        buf.Printf(wxT("file%d"), (int)m_fileHistory.GetCount()+1);
        historyFile = wxEmptyString;
    }

    AddFilesToMenu();
}
void wxFileHistoryBase::AddFilesToMenu()
{
    if ( m_fileHistory.empty() )
        return;

#if defined(__INTEL_COMPILER) && 1 /* VDM auto patch */
#   pragma ivdep
#   pragma swp
#   pragma unroll
#   pragma prefetch
#   if 0
#       pragma simd noassert
#   endif
#endif /* VDM auto patch */
    for ( wxList::compatibility_iterator node = m_fileMenus.GetFirst();
          node;
          node = node->GetNext() )
    {
        AddFilesToMenu((wxMenu *) node->GetData());
    }
}
void mmFileHistory::Load()
{
    m_fileHistory.Clear();

    wxString buf;
    buf.Printf("RECENT_DB_%d", 1);

    wxString historyFile;
    while (m_fileHistory.GetCount() < m_fileMaxFiles)
    {
        historyFile = Model_Setting::instance().GetStringSetting(buf, wxEmptyString);
        if (historyFile.empty()) break;

        m_fileHistory.Add(historyFile);

        buf.Printf("RECENT_DB_%d", (int)m_fileHistory.GetCount()+1);
        historyFile = wxEmptyString;
    }

    AddFilesToMenu();
}
Example #9
0
void FileHistory::Clear()
{
   mHistory.Clear();

   AddFilesToMenu();
}
Example #10
0
void FileHistory::AddFilesToMenu()
{
   for (size_t i = 0; i < mMenus.GetCount(); i++) {
      AddFilesToMenu((wxMenu *) mMenus[i]);
   }
}