void WorkspaceWork::DoMove(int b, bool drag) { int fi = filelist.GetCursor(); if(fi < 0 || fi >= fileindex.GetCount()) return; int a = fileindex[fi]; if(a < 0 || b < 0 || a >= actual.file.GetCount() || (drag ? b > actual.file.GetCount() : b >= actual.file.GetCount())) return; int s = filelist.GetSbPos(); ShowFile(a); ShowFile(b); if(drag) { actual.file.Move(a, b); if(b >= a) b--; } else Swap(actual.file[a], actual.file[b]); ShowFile(a); ShowFile(b); SavePackage(); LoadActualPackage(); filelist.SetSbPos(s); for(int i = 0; i < fileindex.GetCount(); i++) if(fileindex[i] == b) { filelist.SetCursor(i); break; } filelist.Sync(); }
void Ide::MainConfig() { package.SetCursor(0); if(package.GetCursor() != 0) return; MainConfigDlg dlg(IdeWorkspace()); for(int i = 0; i < actual.config.GetCount(); i++) { const Package::Config& f = actual.config[i]; dlg.list.Add(f.param, f.name); } if(!dlg.Perform(mainconfigname)) return; actual.config.Clear(); for(int i = 0; i < dlg.list.GetCount(); i++) { Package::Config& f = actual.config.Add(); f.param = dlg.list.Get(i, 0); f.name = dlg.list.Get(i, 1); } SavePackage(); if(dlg.list.IsCursor()) { mainconfigparam = dlg.list.Get(0); mainconfigname = Nvl((String)dlg.list.Get(1), mainconfigparam); MakeTitle(); } SyncMainConfigList(); SetHdependDirs(); MakeTitle(); }
void WorkspaceWork::SaveLoadPackageNS(bool sel) { SavePackage(); String p = actualpackage; String f; if(IsActiveFile()) f = ActiveFile(); int psc = package.GetSbPos(); int fsc = filelist.GetSbPos(); ScanWorkspace(); package.SetSbPos(psc); package.FindSetCursor(p); if (sel) { filelist.SetSbPos(fsc); filelist.FindSetCursor(f); } }
void Ide::ToggleReadOnly() { if(CanToggleReadOnly() && IsActiveFile()) { #ifdef PLATFORM_WIN32 FindFile ff(editfile); if(ff && ff.IsReadOnly()) { dword attrib = GetFileAttributes(editfile); attrib &= ~FILE_ATTRIBUTE_READONLY; SetFileAttributes(editfile, attrib); } #endif editor.SetEditable(editor.IsReadOnly()); ActiveFile().readonly = editor.IsReadOnly(); SavePackage(); MakeTitle(); SetBar(); } }