private void OpenEditWindow(string path) { if (_recentlyOpenedFiles.Contains(path)) { int index = _recentlyOpenedFiles.IndexOf(path); _recentlyOpenedFiles.RemoveAt(index); _recentlyOpenedFiles.Insert(0, path); } else { _recentlyOpenedFiles.Insert(0, path); if (_recentlyOpenedFiles.Count > 10) { _recentlyOpenedFiles.RemoveAt(_recentlyOpenedFiles.Count - 1); } } CSVFileParser _parser = new CSVFileParser(); _parser.FromCSV(path); CSVEditorEditWindow window = new CSVEditorEditWindow(_parser); window.Show(); }
public CSVEditorEditWindow(CSVFileParser parser) { _parser = parser; this.wantsMouseMove = true; GUIContent guiContent = new GUIContent(_parser.FileName); this.titleContent = guiContent; guiContent = new GUIContent(CSVEditorWindowConsts.ADD_COLUMN_CONTEXT_MENU_ELEMENT); _contextMenu.AddItem(guiContent, false, AddColumn); guiContent = new GUIContent(CSVEditorWindowConsts.ADD_ROW_CONTEXT_MENU_ELEMENT); _contextMenu.AddItem(guiContent, false, AddRow); guiContent = new GUIContent(CSVEditorWindowConsts.INSERT_ROW_CONTEXT_MENU_ELEMENT); _insertRowContextMenu.AddItem(guiContent, false, InsertRow); guiContent = new GUIContent(CSVEditorWindowConsts.INSERT_COLUMN_CONTEXT_MENU_ELEMENT); _insertColumnContextMenu.AddItem(guiContent, false, InsertColumn); for (int i = 0; i < _parser.ColumnsCount; i++) { _columnSize.Add(CSVEditorWindowConsts.DEFAULT_COLUMN_WIDTH); } for (int i = 0; i < _parser.RowsCount; i++) { _rowSize.Add(CSVEditorWindowConsts.DEFAULT_ROW_HEIGHT); } CalculateReSizeRects(); }