void wxExSTCFile::DoFileLoad(bool synced) { if (GetContentsChanged()) { wxExFileDialog dlg(m_STC, this); if (dlg.ShowModalIfChanged() == wxID_CANCEL) return; } // Synchronizing by appending only new data only works for log files. // Other kind of files might get new data anywhere inside the file, // we cannot sync that by keeping pos. // Also only do it for reasonably large files. ReadFromFile( synced && GetFileName().GetExt().CmpNoCase("log") == 0 && m_STC->GetTextLength() > 1024); m_STC->SetLexer(GetFileName().GetLexer().GetScintillaLexer(), true); if (!synced) { wxLogStatus(_("Opened") + ": " + GetFileName().GetFullPath()); } m_STC->PropertiesMessage(synced ? STAT_SYNC: STAT_DEFAULT); // No edges for log files. if (GetFileName().GetExt() == "log") { m_STC->SetEdgeMode(wxSTC_EDGE_NONE); } }
bool wxExSTCFile::DoFileLoad(bool synced) { if ( GetContentsChanged() && wxExFileDialog(m_STC, this).ShowModalIfChanged() == wxID_CANCEL) { return false; } // Synchronizing by appending only new data only works for log files. // Other kind of files might get new data anywhere inside the file, // we cannot sync that by keeping pos. // Also only do it for reasonably large files. const bool isLog = (GetFileName().GetExtension().find("log") == 0); m_STC->UseModificationMarkers(false); ReadFromFile( synced && isLog && m_STC->GetTextLength() > 1024); if (!synced) { // ReadFromFile might already have set the lexer using a modeline. if (m_STC->GetLexer().GetScintillaLexer().empty()) { m_STC->GetLexer().Set(GetFileName().GetLexer(), true); } // No edges for log files. if (isLog) { m_STC->SetEdgeMode(wxSTC_EDGE_NONE); } wxLogStatus(_("Opened") + ": " + GetFileName().GetFullPath()); } CheckWellFormed(GetFileName()); m_STC->PropertiesMessage(synced ? STAT_SYNC: STAT_DEFAULT); m_STC->UseModificationMarkers(true); return true; }