/** * @brief 文書の新規作成 */ void CFootyDoc::CreateNew(int nGlobalID) { // 今までの情報を全て破棄する m_lsLines.clear(); m_lsUndoBuffer.clear(); m_lsEmphasisWord.clear(); m_pNowUndoPos = m_lsUndoBuffer.end(); SetSavePoint(); SetReadOnly( false ); // 最初の1行を挿入する CFootyLine cFirstLine; cFirstLine.m_strLineData = L""; m_lsLines.push_back(cFirstLine); // エディタ上の位置を設定する m_cCaretPos.SetPosition(&m_lsLines,0,0); SendMoveCaretCallBack(); for (int i=0;i<4;i++) { m_cFirstVisibleLine[i].SetPosition(m_lsLines.begin()); } // 変数初期化 m_nSelectType = SELECT_NONE; m_nLineMode = LM_CRLF; m_nGlobalID = nGlobalID; }
bool IWnd_stc::DoLoadFile(const wxString& file,int) { StringBuffer<char> buff; buff.load(wx2str(file)); SetText(str2wx(buff)); EmptyUndoBuffer(); SetSavePoint(); return true; }
void ScriptEditor::WriteFile(const wxString &filename) { wxLogDebug(_T("Write file %s"), filename.c_str()); // TODO make backup file? // write out file in the scintilla coding system (utf-8) std::ofstream output(filename.utf8_str(), std::ofstream::out); const wxCharBuffer buf = GetTextRaw(); size_t len = GetLength(); output.write(buf, len); SetSavePoint(); }
bool IWnd_stc::DoSaveFile(const wxString& file,int) { wxString text=GetValue(); StringBuffer<char> buff; buff=wx2str(text); buff.save(wx2str(file)); SetSavePoint(); if(func) func(); return true; }
void ScriptEditor::LoadFile(const wxString &filename) { // assume input files are in the correct coding system for now std::ifstream input(filename.utf8_str(), std::ifstream::in); char buf[8193]; while (input.good()) { input.read(buf, sizeof(buf)); size_t got = input.gcount(); buf[got] = '\0'; AddTextRaw(buf); } SetSavePoint(); EmptyUndoBuffer(); }