// local constants
// ----------------------------------------------------------------------------
-static const char *s_MRUEntryFormat = wxT("&%d %s");
+static const wxChar *s_MRUEntryFormat = wxT("&%d %s");
// ============================================================================
// implementation
wxView::~wxView()
{
- GetDocumentManager()->ActivateView(this, FALSE, TRUE);
+// GetDocumentManager()->ActivateView(this, FALSE, TRUE);
m_viewDocument->RemoveView(this);
}
m_currentView = (wxView *) NULL;
m_maxDocsOpen = 10000;
m_fileHistory = (wxFileHistory *) NULL;
- m_lastDirectory = wxT("") ;
if (initialize)
Initialize();
}
}
wxDocTemplate *theTemplate = (wxDocTemplate *)wxGetSingleChoiceData(_("Select a document template"), _("Templates"), n,
- strings, (char **)data);
+ strings, (void **)data);
delete[] strings;
delete[] data;
return theTemplate;
}
}
wxDocTemplate *theTemplate = (wxDocTemplate *)wxGetSingleChoiceData(_("Select a document view"), _("Views"), n,
- strings, (char **)data);
+ strings, (void **)data);
delete[] strings;
delete[] data;
return theTemplate;
{
wxMenu* menu = (wxMenu*) node->Data();
- // wxMenu::Delete() is missing from wxGTK, so this can't be done :-(
-#if 0
- // delete the menu items
- menu->Delete(wxID_FILE1 + i);
-#endif
-
// delete the element from the array (could use memmove() too...)
delete [] m_fileHistory[i];
menu->SetLabel(wxID_FILE1 + j, buf);
}
- // to be removed as soon as wxMenu::Delete() is implemented
-#if 1
- menu->SetLabel(wxID_FILE1 + m_fileHistoryN - 1, wxT(""));
-#endif
-
node = node->Next();
+
+ // delete the last menu item which is unused now
+ menu->Delete(wxID_FILE1 + m_fileHistoryN - 1);
+
+ // delete the last separator too if no more files are left
+ if ( m_fileHistoryN == 1 )
+ {
+ wxMenuItemList::Node *node = menu->GetMenuItems().GetLast();
+ if ( node )
+ {
+ wxMenuItem *menuItem = node->GetData();
+ if ( menuItem->IsSeparator() )
+ {
+ menu->Delete(menuItem);
+ }
+ //else: should we search backwards for the last separator?
+ }
+ //else: menu is empty somehow
+ }
}
+
m_fileHistoryN--;
}
wxString wxFileHistory::GetHistoryFile(int i) const
{
- if (i < m_fileHistoryN)
- return wxString(m_fileHistory[i]);
+ wxString s;
+ if ( i < m_fileHistoryN )
+ {
+ s = m_fileHistory[i];
+ }
else
- return wxString("");
+ {
+ wxFAIL_MSG( wxT("bad index in wxFileHistory::GetHistoryFile") );
+ }
+
+ return s;
}
void wxFileHistory::UseMenu(wxMenu *menu)