#if USE_DOC_VIEW_ARCHITECTURE
#ifndef WX_PRECOMP
+#include "wx/string.h"
#include "wx/utils.h"
#include "wx/app.h"
#include "wx/dc.h"
#include "wx/menu.h"
#include "wx/list.h"
#include "wx/filedlg.h"
+#include <wx/intl.h>
#endif
#ifdef __WXGTK__
m_documentFile="";
m_documentTitle="";
m_documentParent=parent;
- m_documentTemplate = NULL;
+ m_documentTemplate = (wxDocTemplate *) NULL;
m_documentTypeName = "";
m_savedYet = FALSE;
}
wxView *wxDocument::GetFirstView(void) const
{
if (m_documentViews.Number() == 0)
- return NULL;
+ return (wxView *) NULL;
return (wxView *)m_documentViews.First()->Data();
}
if (!docTemplate)
return FALSE;
- char *tmp = wxFileSelector("Save as", docTemplate->GetDirectory(), GetFilename(),
+ char *tmp = wxFileSelector(_("Save as"), docTemplate->GetDirectory(), GetFilename(),
docTemplate->GetDefaultExtension(), docTemplate->GetFileFilter(),
wxSAVE|wxOVERWRITE_PROMPT, GetDocumentWindow());
if (wxTheApp->GetAppName() != "")
msgTitle = wxTheApp->GetAppName();
else
- msgTitle = wxString("File error");
+ msgTitle = wxString(_("File error"));
ofstream store(file);
if (store.fail() || store.bad())
{
- (void)wxMessageBox("Sorry, could not open this file for saving.", msgTitle, wxOK | wxICON_EXCLAMATION,
+ (void)wxMessageBox(_("Sorry, could not open this file for saving."), msgTitle, wxOK | wxICON_EXCLAMATION,
GetDocumentWindow());
// Saving error
return FALSE;
}
if (SaveObject(store)==FALSE)
{
- (void)wxMessageBox("Sorry, could not save this file.", msgTitle, wxOK | wxICON_EXCLAMATION,
+ (void)wxMessageBox(_("Sorry, could not save this file."), msgTitle, wxOK | wxICON_EXCLAMATION,
GetDocumentWindow());
// Saving error
return FALSE;
if (wxTheApp->GetAppName() != "")
msgTitle = wxTheApp->GetAppName();
else
- msgTitle = wxString("File error");
+ msgTitle = wxString(_("File error"));
ifstream store(file);
if (store.fail() || store.bad())
{
- (void)wxMessageBox("Sorry, could not open this file.", msgTitle, wxOK|wxICON_EXCLAMATION,
+ (void)wxMessageBox(_("Sorry, could not open this file."), msgTitle, wxOK|wxICON_EXCLAMATION,
GetDocumentWindow());
return FALSE;
}
if (LoadObject(store)==FALSE)
{
- (void)wxMessageBox("Sorry, could not open this file.", msgTitle, wxOK|wxICON_EXCLAMATION,
+ (void)wxMessageBox(_("Sorry, could not open this file."), msgTitle, wxOK|wxICON_EXCLAMATION,
GetDocumentWindow());
return FALSE;
}
}
else
{
- buf = "unnamed";
+ buf = _("unnamed");
return TRUE;
}
}
if (wxTheApp->GetAppName() != "")
msgTitle = wxTheApp->GetAppName();
else
- msgTitle = wxString("Warning");
+ msgTitle = wxString(_("Warning"));
- sprintf(buf, "Do you want to save changes to document %s?", (const char *)title);
+ sprintf(buf, _("Do you want to save changes to document %s?"), (const char *)title);
int res = wxMessageBox(buf, msgTitle, wxYES_NO|wxCANCEL|wxICON_QUESTION,
GetDocumentWindow());
if (res == wxNO)
SetDocument(doc);
m_viewTypeName = "";
- m_viewFrame = NULL;
+ m_viewFrame = (wxFrame *) NULL;
}
wxView::~wxView(void)
wxDocument *wxDocTemplate::CreateDocument(const wxString& path, long flags)
{
if (!m_docClassInfo)
- return NULL;
+ return (wxDocument *) NULL;
wxDocument *doc = (wxDocument *)m_docClassInfo->CreateObject();
doc->SetFilename(path);
doc->SetDocumentTemplate(this);
else
{
delete doc;
- return NULL;
+ return (wxDocument *) NULL;
}
}
wxView *wxDocTemplate::CreateView(wxDocument *doc, long flags)
{
if (!m_viewClassInfo)
- return NULL;
+ return (wxView *) NULL;
wxView *view = (wxView *)m_viewClassInfo->CreateObject();
view->SetDocument(doc);
if (view->OnCreate(doc, flags))
else
{
delete view;
- return NULL;
+ return (wxView *) NULL;
}
}
{
m_defaultDocumentNameCounter = 1;
m_flags = flags;
- m_currentView = NULL;
+ m_currentView = (wxView *) NULL;
m_maxDocsOpen = 10000;
- m_fileHistory = NULL;
+ m_fileHistory = (wxFileHistory *) NULL;
if (initialize)
Initialize();
}
if (printout)
{
// Pass two printout objects: for preview, and possible printing.
- wxPrintPreviewBase *preview = NULL;
+ wxPrintPreviewBase *preview = (wxPrintPreviewBase *) NULL;
#ifdef __WXMSW__
if ( wxTheApp->GetPrintMode() == wxPRINT_WINDOWS )
preview = new wxWindowsPrintPreview(printout, view->OnCreatePrintout());
#endif
preview = new wxPostScriptPrintPreview(printout, view->OnCreatePrintout());
- wxPreviewFrame *frame = new wxPreviewFrame(preview, (wxFrame *)wxTheApp->GetTopWindow(), "Print Preview",
+ wxPreviewFrame *frame = new wxPreviewFrame(preview, (wxFrame *)wxTheApp->GetTopWindow(), _("Print Preview"),
wxPoint(100, 100), wxSize(600, 650));
frame->Centre(wxBOTH);
frame->Initialize();
wxDocument* doc = (wxDocument*) m_docs.First()->Data();
return doc->GetFirstView();
}
- return NULL;
+ return (wxView *) NULL;
}
// Extend event processing to search the view's event table
if (n == 0)
{
delete[] templates;
- return NULL;
+ return (wxDocument *) NULL;
}
// If we've reached the max number of docs, close the
delete doc;
}
else
- return NULL;
+ return (wxDocument *) NULL;
}
// New document: user chooses a template, unless there's only one.
return newDoc;
}
else
- return NULL;
+ return (wxDocument *) NULL;
}
// Existing document
- wxDocTemplate *temp = NULL;
+ wxDocTemplate *temp = (wxDocTemplate *) NULL;
wxString path2("");
if (path != "")
if (!newDoc->OnOpenDocument(path2))
{
delete newDoc;
- return NULL;
+ return (wxDocument *) NULL;
}
AddFileToHistory(path2);
}
return newDoc;
}
else
- return NULL;
+ return (wxDocument *) NULL;
}
wxView *wxDocManager::CreateView(wxDocument *doc, long flags)
if (n == 0)
{
delete[] templates;
- return NULL;
+ return (wxView *) NULL;
}
if (n == 1)
{
return view;
}
else
- return NULL;
+ return (wxView *) NULL;
}
// Not yet implemented
if (m_currentView)
return m_currentView->GetDocument();
else
- return NULL;
+ return (wxDocument *) NULL;
}
// Make a default document name
bool wxDocManager::MakeDefaultName(wxString& name)
{
char buf[256];
- sprintf(buf, "unnamed%d", m_defaultDocumentNameCounter);
+ sprintf(buf, _("unnamed%d"), m_defaultDocumentNameCounter);
m_defaultDocumentNameCounter ++;
name = buf;
return TRUE;
// Not yet implemented
wxDocTemplate *wxDocManager::MatchTemplate(const wxString& WXUNUSED(path))
{
- return NULL;
+ return (wxDocTemplate *) NULL;
}
// File history management
return ext;
}
else
- return NULL;
+ return (char *) NULL;
}
- else return NULL;
+ else return (char *) NULL;
}
{
char *theExt = FindExtension((char *)(const char *)path);
if (!theExt)
- return NULL;
- wxDocTemplate *theTemplate = NULL;
+ return (wxDocTemplate *) NULL;
+ wxDocTemplate *theTemplate = (wxDocTemplate *) NULL;
if (m_templates.Number() == 1)
return (wxDocTemplate *)m_templates.First()->Data();
// Omit final "|"
descrBuf[len-1] = 0;
- char *pathTmp = wxFileSelector("Select a file", "", "", "", descrBuf, 0, wxTheApp->GetTopWindow());
+ char *pathTmp = wxFileSelector(_("Select a file"), "", "", "", descrBuf, 0, wxTheApp->GetTopWindow());
delete[] descrBuf;
if (pathTmp)
{
path = pathTmp;
char *theExt = FindExtension((char *)(const char *)path);
if (!theExt)
- return NULL;
+ return (wxDocTemplate *) NULL;
// This is dodgy in that we're selecting the template on the
// basis of the file extension, which may not be a standard
else
{
path = "";
- return NULL;
+ return (wxDocTemplate *) NULL;
}
#else
// In all other windowing systems, until we have more advanced
// _then_ pop up the file selector.
wxDocTemplate *temp = SelectDocumentType(templates, noTemplates);
if (!temp)
- return NULL;
+ return (wxDocTemplate *) NULL;
- char *pathTmp = wxFileSelector("Select a file", "", "",
+ char *pathTmp = wxFileSelector(_("Select a file"), "", "",
temp->GetDefaultExtension(),
temp->GetFileFilter(),
0, wxTheApp->GetTopWindow());
return temp;
}
else
- return NULL;
+ return (wxDocTemplate *) NULL;
#endif
}
{
delete[] strings;
delete[] data;
- return NULL;
+ return (wxDocTemplate *) NULL;
}
else if (n == 1)
{
return temp;
}
- wxDocTemplate *theTemplate = (wxDocTemplate *)wxGetSingleChoiceData("Select a document template", "Templates", n,
+ wxDocTemplate *theTemplate = (wxDocTemplate *)wxGetSingleChoiceData(_("Select a document template"), _("Templates"), n,
strings, data);
delete[] strings;
delete[] data;
n ++;
}
}
- wxDocTemplate *theTemplate = (wxDocTemplate *)wxGetSingleChoiceData("Select a document view", "Views", n,
+ wxDocTemplate *theTemplate = (wxDocTemplate *)wxGetSingleChoiceData(_("Select a document view"), _("Views"), n,
strings, data);
delete[] strings;
delete[] data;
if (activate)
m_currentView = view;
else
- m_currentView = NULL;
+ m_currentView = (wxView *) NULL;
}
}
{
m_childView->Activate(FALSE);
delete m_childView;
- m_childView = NULL;
- m_childDocument = NULL;
+ m_childView = (wxView *) NULL;
+ m_childDocument = (wxDocument *) NULL;
}
return ans;
wxCommandProcessor::wxCommandProcessor(int maxCommands)
{
m_maxNoCommands = maxCommands;
- m_currentCommand = NULL;
- m_commandEditMenu = NULL;
+ m_currentCommand = (wxNode *) NULL;
+ m_commandEditMenu = (wxMenu *) NULL;
}
wxCommandProcessor::~wxCommandProcessor(void)
bool wxCommandProcessor::Redo(void)
{
- wxCommand *redoCommand = NULL;
- wxNode *redoNode = NULL;
+ wxCommand *redoCommand = (wxCommand *) NULL;
+ wxNode *redoNode = (wxNode *) NULL;
if (m_currentCommand && m_currentCommand->Next())
{
redoCommand = (wxCommand *)m_currentCommand->Next()->Data();
{
wxCommand *command = (wxCommand *)m_currentCommand->Data();
wxString commandName(command->GetName());
- if (commandName == "") commandName = "Unnamed command";
+ if (commandName == "") commandName = _("Unnamed command");
bool canUndo = command->CanUndo();
if (canUndo)
- buf = wxString("&Undo ") + commandName;
+ buf = wxString(_("&Undo ")) + commandName;
else
- buf = wxString("Can't &Undo ") + commandName;
+ buf = wxString(_("Can't &Undo ")) + commandName;
m_commandEditMenu->SetLabel(wxID_UNDO, buf);
m_commandEditMenu->Enable(wxID_UNDO, canUndo);
{
wxCommand *redoCommand = (wxCommand *)m_currentCommand->Next()->Data();
wxString redoCommandName(redoCommand->GetName());
- if (redoCommandName == "") redoCommandName = "Unnamed command";
- buf = wxString("&Redo ") + redoCommandName;
+ if (redoCommandName == "") redoCommandName = _("Unnamed command");
+ buf = wxString(_("&Redo ")) + redoCommandName;
m_commandEditMenu->SetLabel(wxID_REDO, buf);
m_commandEditMenu->Enable(wxID_REDO, TRUE);
}
else
{
- m_commandEditMenu->SetLabel(wxID_REDO, "&Redo");
+ m_commandEditMenu->SetLabel(wxID_REDO, _("&Redo"));
m_commandEditMenu->Enable(wxID_REDO, FALSE);
}
}
else
{
- m_commandEditMenu->SetLabel(wxID_UNDO, "&Undo");
+ m_commandEditMenu->SetLabel(wxID_UNDO, _("&Undo"));
m_commandEditMenu->Enable(wxID_UNDO, FALSE);
if (m_commands.Number() == 0)
{
- m_commandEditMenu->SetLabel(wxID_REDO, "&Redo");
+ m_commandEditMenu->SetLabel(wxID_REDO, _("&Redo"));
m_commandEditMenu->Enable(wxID_REDO, FALSE);
}
else
// we've undone to the start of the list, but can redo the first.
wxCommand *redoCommand = (wxCommand *)m_commands.First()->Data();
wxString redoCommandName(redoCommand->GetName());
- if (!redoCommandName) redoCommandName = "Unnamed command";
- buf = wxString("&Redo ") + redoCommandName;
+ if (!redoCommandName) redoCommandName = _("Unnamed command");
+ buf = wxString(_("&Redo ")) + redoCommandName;
m_commandEditMenu->SetLabel(wxID_REDO, buf);
m_commandEditMenu->Enable(wxID_REDO, TRUE);
}
delete node;
node = m_commands.First();
}
- m_currentCommand = NULL;
+ m_currentCommand = (wxNode *) NULL;
}
wxFileHistory::wxFileHistory(int maxFiles)
{
m_fileMaxFiles = maxFiles;
- m_fileMenu = NULL;
+ m_fileMenu = (wxMenu *) NULL;
m_fileHistoryN = 0;
m_fileHistory = new char *[m_fileMaxFiles];
}
if (m_fileHistoryN == m_fileMaxFiles)
{
delete[] m_fileHistory[m_fileMaxFiles-1];
- m_fileHistory[m_fileMaxFiles-1] = NULL;
+ m_fileHistory[m_fileMaxFiles-1] = (char *) NULL;
}
if (m_fileHistoryN < m_fileMaxFiles)
{
if (m_fileHistoryN == 0)
m_fileMenu->AppendSeparator();
- m_fileMenu->Append(wxID_FILE1+m_fileHistoryN, "[EMPTY]");
+ m_fileMenu->Append(wxID_FILE1+m_fileHistoryN, _("[EMPTY]"));
m_fileHistoryN ++;
}
// Shuffle filenames down
m_fileHistoryN = 0;
char buf[400];
sprintf(buf, "file%d", m_fileHistoryN+1);
- char *historyFile = NULL;
+ char *historyFile = (char *) NULL;
while ((m_fileHistoryN <= m_fileMaxFiles) && wxGetResource(section, buf, &historyFile, resourceFile) && historyFile)
{
// wxGetResource allocates memory so this is o.k.
m_fileHistory[m_fileHistoryN] = historyFile;
m_fileHistoryN ++;
sprintf(buf, "file%d", m_fileHistoryN+1);
- historyFile = NULL;
+ historyFile = (char *) NULL;
}
#endif
}