#include "wx/filedlg.h"
#endif
+#ifdef __WXGTK__
+#include "wx/mdi.h"
+#endif
+
#include "wx/msgdlg.h"
#include "wx/choicdlg.h"
#include "wx/docview.h"
#include "wx/generic/prntdlgg.h"
#include "wx/generic/printps.h"
-/*
-#ifdef __WXMSW__
-#include "wx/mdi.h"
-#endif
-*/
-
#include <stdio.h>
#include <string.h>
char *tmp = wxFileSelector("Save as", docTemplate->GetDirectory(), GetFilename(),
docTemplate->GetDefaultExtension(), docTemplate->GetFileFilter(),
- 0, GetDocumentWindow());
+ wxSAVE|wxOVERWRITE_PROMPT, GetDocumentWindow());
if (!tmp)
return FALSE;
else
{
- SetFilename(tmp);
- SetTitle(wxFileNameFromPath(tmp));
+ wxString fileName(tmp);
+ wxString path("");
+ wxString name("");
+ wxString ext("");
+ wxSplitPath(fileName, & path, & name, & ext);
+
+ if (ext.IsEmpty() || ext == "")
+ {
+ fileName += ".";
+ fileName += docTemplate->GetDefaultExtension();
+ }
+
+ SetFilename(fileName);
+ SetTitle(wxFileNameFromPath(fileName));
- GetDocumentManager()->AddFileToHistory(tmp);
+ GetDocumentManager()->AddFileToHistory(fileName);
// Notify the views that the filename has changed
wxNode *node = m_documentViews.First();
wxString name;
GetDocument()->GetPrintableName(name);
- // If the frame is an MDI child, just set the title
- // to the name.
- // Otherwise, append the document name to the name of the application
-#ifdef __WXMSW__
- if (GetFrame()->IsKindOf(CLASSINFO(wxMDIChildFrame)))
-#else
- if (FALSE)
-#endif
- {
- GetFrame()->SetTitle(name);
- }
- else
- {
- if (wxTheApp->GetAppName() != "")
- {
- char buf[400];
- sprintf(buf, "%s - %s", (const char *)wxTheApp->GetAppName(), (const char *)name);
- GetFrame()->SetTitle(buf);
- }
- else
- GetFrame()->SetTitle(name);
- }
+ GetFrame()->SetTitle(name);
}
}
EVT_ACTIVATE(wxDocChildFrame::OnActivate)
END_EVENT_TABLE()
-wxDocChildFrame::wxDocChildFrame(wxDocument *doc, wxView *view, wxFrame *frame, const wxString& title,
+wxDocChildFrame::wxDocChildFrame(wxDocument *doc, wxView *view, wxFrame *frame, wxWindowID id, const wxString& title,
const wxPoint& pos, const wxSize& size, long style, const wxString& name):
- wxFrame(frame, -1, title, pos, size, style, name)
+ wxFrame(frame, id, title, pos, size, style, name)
{
m_childDocument = doc;
m_childView = view;
BEGIN_EVENT_TABLE(wxDocParentFrame, wxFrame)
EVT_MENU(wxID_EXIT, wxDocParentFrame::OnExit)
- EVT_MENU_RANGE(wxID_FILE1, wxID_FILE2, wxDocParentFrame::OnMRUFile)
+ EVT_MENU_RANGE(wxID_FILE1, wxID_FILE9, wxDocParentFrame::OnMRUFile)
END_EVENT_TABLE()
-wxDocParentFrame::wxDocParentFrame(wxDocManager *manager, wxFrame *frame, const wxString& title,
+wxDocParentFrame::wxDocParentFrame(wxDocManager *manager, wxFrame *frame, wxWindowID id, const wxString& title,
const wxPoint& pos, const wxSize& size, long style, const wxString& name):
- wxFrame(frame, -1, title, pos, size, style, name)
+ wxFrame(frame, id, title, pos, size, style, name)
{
m_docManager = manager;
}