void MapEditor::OnLevelMapCalc(Level& level, int number) { if (level.GetMapBG().IsEmpty()) { Exclamation(NFormat(t_("Please, select the image for level: %s"), level.GetName())); return; } String fp = AppendFileName( AppendFileName( GetFileDirectory(GetExeFilePath()), "Maps"), level.GetMapBG()); if (!FileExists(fp)) { Exclamation(NFormat(t_("Image file not exist: %s"), fp)); return; } String name = level.GetName(); double zx = level.GetZoomDX(); Size pz = level.GetPageSize(); Size sz = level.GetCellSize(); FileIn in(fp); One<StreamRaster> r = StreamRaster::OpenAny(in); if (!r) { Exclamation(NFormat(t_("Error while loading image file: %s"), fp)); return; } Image img = r->GetImage(); Calculate(sz.cx, sz.cy, pz.cx, pz.cy, zx, NFormat("%s-%d", _map.GetName(), number + 1), img); }
void TabRegression::OnAutoset() { if (down.switchColsRows == 0) { // Columnas int fRow = down.firstCellIsName ? 1 : 0; int c; for (c = 0; c < down.grid.GetColumnCount(); ++c) { if (IsNumber2(down.grid.Get(fRow, c))) { down.gridDef.Set(0, 0, c); down.gridDef.Set(0, 3, c + 1); down.gridDef.Set(0, 1, fRow); break; } } if (c == down.grid.GetColumnCount()) { Exclamation(t_("Problem in Autoset")); return; } int r; for (r = fRow; r < down.grid.GetRowCount(); ++r) { if (!IsNumber2(down.grid.Get(r, c))) break; } down.gridDef.Set(0, 2, r - 1); } else { Exclamation("Not implemented"); } OnUpdate(); }
void GrabScreen::ButSnap_Push() { /* program->Minimize(); TopWindow win; Button b; b.SetLabel("CLOSE"); b <<= win.Breaker(); StaticImage desktop; desktop.Set(Snap_Desktop()); win.Add(desktop.SizePos()); win.Add(b.LeftPos(10, 100).TopPos(10, 30)); win.FullScreen().Run(); program->Overlap(); */ String fileName = ~editFileNameSnap; FileDelete(fileName); String ext = GetFileExt(fileName); if (ext == ".png") { PNGEncoder encoder; if (!encoder.SaveFile(fileName, canvasImage)) Exclamation(Format(t_("Impossible to save %s"), fileName)); } else if (ext == ".jpg") { JPGEncoder encoder(90); if (!encoder.SaveFile(fileName, canvasImage)) Exclamation(Format(t_("Impossible to save %s"), fileName)); } else Exclamation(Format(t_("File format \"%s\" not found"), ext)); }
void TabRegression::OnAutoset() { if (switchColsRows == 0) { // Columnas int fRow = firstCellIsName ? 1 : 0; int c; for (c = 0; c < grid.GetColumnCount(); ++c) { if (IsNumber2(grid.Get(fRow, c))) { gridDef.Set(0, 0, c); gridDef.Set(0, 3, c + 1); gridDef.Set(0, 1, fRow); break; } } if (c == grid.GetColumnCount()) { Exclamation(t_("Problem in Autoset")); return; } int r; for (r = fRow; r < grid.GetRowCount(); ++r) { if (!IsNumber2(grid.Get(r, c))) break; } gridDef.Set(0, 2, r - 1); } else { Exclamation("No implementado"); } scatter.RemoveAllSeries(); scatter.AddSeries(ds).Legend("Series").MarkStyle<RhombMarkPlot>().MarkWidth(10).NoPlot(); gridTrend.Clear(); scatter.ZoomToFit(true, true); }
// get user options, process and save. void Options::onbtnSave() { int dontsplash = optSplash.Get(); // get the value from option control int savewinpos = optSaveWinPos.Get();// get the value from option control Ctrl* owner = GetOwner(); // get a handle to the Options dislog owner which is MyUppApp main window. Rect rc; // create a struct to store window position and size if ( savewinpos != 1 ) { // if Save Window option is not checked. rc.left = 0; // set window position x to 0 rc.top = 0; // set window position y to 0 } else { rc = owner->GetRect(); // get the position and size of MyUppApp main window } String cfg; // create a string to store config data cfg << "Splash=" << dontsplash << "\n" // save user's choice "SaveWinPos=" << savewinpos << "\n" // save user's choice "PosX=" << rc.left << "\n" // save window x position "PosY=" << rc.top << "\n"; // save window y position if( !SaveFile(cfgfile, cfg) ) // save the config file Exclamation("Error saving configuration!"); // if failed show error dialog else PromptOK("Options saved!"); // show success dialog Break(IDOK); // close this dialog }
void Ide::Licenses() { Progress pi; const Workspace& wspc = IdeWorkspace(); pi.SetTotal(wspc.GetCount()); VectorMap<String, String> license_package; for(int i = 0; i < wspc.GetCount(); i++) { String n = wspc[i]; pi.SetText(n); if(pi.StepCanceled()) return; String l = LoadFile(SourcePath(n, "Copying")); if(l.GetCount()) MergeWith(license_package.GetAdd(l), ", ", n); } if(license_package.GetCount() == 0) { Exclamation("No license files ('Copying') have been found."); return; } String qtf; for(int i = 0; i < license_package.GetCount(); i++) { bool m = license_package[i].Find(',') >= 0; qtf << (m ? "Packages [* \1" : "Package [* \1") << license_package[i] << (m ? "\1] have" : "\1] has") << " following licence notice:&" << "{{@Y [C1 " << DeQtf(license_package.GetKey(i)) << "]}}&&"; } ShowQTF(qtf, "Licenses"); }
bool Gdb_MI2::RunTo() { String bi; bool df = disas.HasFocus(); bool res; // sets a temporary breakpoint on cursor location // it'll be cleared automatically on first stop if(df) { if(!disas.GetCursor()) return false; res = TryBreak(disas.GetCursor(), true); } else res = TryBreak(IdeGetFileName(), IdeGetFileLine() + 1, true); if(!res) { Exclamation(t_("No code at chosen location !")); return false; } Run(); if(df) disas.SetFocus(); return true; }
bool Gdb_MI2::SetBreakpoint(const String& filename, int line, const String& bp) { String file = Filter(host->GetHostPath(NormalizePath(filename)), CharFilterReSlash2); // gets all breakpoints MIValue bps = GetBreakpoints(); // line should start from 1... line++; // check wether we've got already a breakpoint here // and remove it MIValue brk = pick(bps.FindBreakpoint(file, line)); if(!brk.IsEmpty()) if(!MICmd(Format("break-delete %s", brk["number"].Get()))) { Exclamation(t_("Couldn't remove breakpoint")); return false; } if(bp.IsEmpty()) return true; else if(bp[0] == 0xe) return MICmd(Format("break-insert %s:%d", file, line)); else return MICmd(Format("break-insert -c \"%s\" %s:%d", bp, file, line)); }
bool BaseSetupDlg::Run(String& vars) { upp <<= GetVar("UPP"); output <<= GetVar("OUTPUT"); base <<= vars; new_base = IsNull(vars); while(TopWindow::Run() == IDOK) { String varname = ~base; String varfile = VarFilePath(varname); if(varname != vars) { if(FileExists(varfile) && !PromptOKCancel(NFormat("Overwrite existing assembly [* \1%s\1]?", varfile))) continue; if(!SaveVars(varname)) { Exclamation(NFormat("Error writing assmbly [* \1%s\1].", VarFilePath(varname))); continue; } } SetVar("UPP", ~upp); SetVar("OUTPUT", ~output); Vector<String> paths = SplitDirs(upp.GetText().ToString()); for(int i = 0; i < paths.GetCount(); i++) RealizeDirectory(paths[i]); RealizeDirectory(output); vars = varname; return true; } return false; }
void NotesCheck(STATUS nError) { if(nError == NOERROR) return; char h[256]; OSLoadString(GetModuleHandle(NULL), ERR(nError), h, 255); Exclamation(h); abort(); }
void Pdb::Error(const char *s) { String txt = "Error!&"; if(s) txt << s << "&"; LLOG("ERROR: " << DeQtf(GetLastErrorMessage())); Exclamation(txt + DeQtf(GetLastErrorMessage())); running = false; Stop(); }
bool SaveFileFinish(const String& filename, const String& data) { if(!SaveFile(filename + ".$tmp", data)) { if(IsDeactivationSave()) return true; Exclamation("Error creating temporary file " + filename); return false; } return FinishSave(filename); }
void WorkspaceWork::DeletePackage() { String active = GetActivePackage(); if(package.GetCursor() == 0) { Exclamation("Cannot delete the main package!"); return; } if(IsAux() || !package.IsCursor() || !PromptYesNo("Do you really want to delete package [* \1" + active + "\1]?&&" "[/ Warning:] [* Package will only be removed&" "from packages of current workspace!]")) return; if(!PromptYesNo("This operation is irreversible.&Do you really want to proceed?")) return; if(!DeleteFolderDeep(GetFileFolder(GetActivePackagePath()))) { Exclamation("Deleting directory has failed."); return; } PackageOp(active, Null, Null); }
void Ide::LoadConfig() { if(!LoadFromFile(*this) && GetIniKey("DebugClipboard") == "1") { Exclamation("LoadConfig has failed!"); if(!LoadFromFile(*this, ConfigFile() + ".bak")) { Exclamation("LoadConfig .bak has failed!"); if(!LoadFromFile(*this, ConfigFile() + ".bak1")) Exclamation("LoadConfig .bak1 has failed!"); } } RestoreKeys(LoadFile(ConfigFile("ide.key"))); editor.LoadHlStyles(LoadFile(ConfigFile("ide.colors"))); config_time = FileGetTime(ConfigFile()); UpdateFormat(); if(filelist.IsCursor()) { FlushFile(); FileCursor(); } SaveLoadPackage(); SyncCh(); }
bool DropGrid::Accept() { if(!Ctrl::Accept()) return false; if(must_change && !change) { Exclamation(must_change_str); SetWantFocus(); return false; } return true; }
void LayoutDesigner::Execute() { // frame.SetRect(100, 100, 700, 500); #ifndef flagIDERW LoadFromFile(*this); #endif OpenWindow(); frame.Run(); #ifndef flagIDERW StoreToFile(*this); #endif if(!alias_map.Save(alias_map_file)) Exclamation(NFormat("Error updating alias file [* \1%s\1].", alias_map_file)); }
void MapEditor::OnLoadMap() { WithMapLoadLayout<TopWindow> dlg; CtrlLayoutOKCancel(dlg, t_("Load Map...")); String dir = AppendFileName( GetFileDirectory(GetExeFilePath()), "Mipmaps"); Vector<String> files = GetDirectoryFiles(dir, "*.map"); Sort(files); if (files.GetCount() <= 0) { Exclamation(t_("No any file to load!")); return; } for (int i = 0; i < files.GetCount(); ++i) dlg.MapList.Add(files[i], files[i]); dlg.MapList.SetIndex(0); if (dlg.Execute() != IDOK) return; String fp = AppendFileName(dir, (~dlg.MapList).ToString()); if (!FileExists(fp)) { Exclamation(NFormat(t_("File not found: %s"), fp)); return; } if (!LoadFromXMLFile(_map, fp)) { Exclamation(NFormat(t_("Error while loading map from file: %s"), fp)); return; } UpdateLevelList(); UpdateEditorCtrls(); }
void OutMode::Export(int kind) { String ep = ~export_dir; if(IsNull(ep)) { Exclamation("Missing output directory!"); return; } if(kind == 2) ide.ExportMakefile(ep); else ide.ExportProject(ep, kind, true); Break(IDOK); }
bool RenamePackageFs(const String& upp, const String& newname) { if(IsNull(newname)) { Exclamation("Wrong name."); return false; } if(FileExists(PackagePath(newname))) { Exclamation("Package [* \1" + newname + "\1] already exists!"); return false; } String pf = GetFileFolder(upp); String npf = GetPackagePathNest(pf) + "/" + newname; RealizePath(npf); if(!FileMove(pf, npf)) { Exclamation("Renaming package folder has failed."); return false; } if(!FileMove(npf + "/" + GetFileName(upp), npf + "/" + GetFileName(newname) + ".upp")) { FileMove(npf, pf); Exclamation("Renaming .upp file has failed."); return false; } return true; }
//Вывод в файл список в формате Оригинал - Русское - количество эпизодов void AnimeList::PrintFile() { if(!fs.ExecuteSaveAs()) return; String printfile = fs; String xml, name, namerus, episodes; for(int i = 0; i < listName.GetCount(); i++) { xml += Format(AsString(listName.Get(i, Named)) + " - " + AsString(listName.Get(i, NamedRus)) + " - Episodes: %d", listName.Get(i, Episodes)); RawCat(xml, "\r\n"); } if(!SaveFile(printfile, xml)) Exclamation("Error Saving the File"); }
void MapEditor::OnSaveMap() { CalculateAllPrompt(); if (!StoreAsXMLFile(_map, _map.GetName(), AppendFileName( AppendFileName(GetFileDirectory(GetExeFilePath()), "Mipmaps"), _map.GetName() + ".map" ))) { Exclamation(t_("Error while saving map to file!")); } UpdateEditorCtrls(); }
void MapEditor::OnViewMap() { WithPreviewLayout<TopWindow> dlg; CtrlLayout(dlg, t_("Map Preview")); dlg.Sizeable().MaximizeBox(); dlg.View.HighQuality(true); if (!dlg.View.LoadMap(_map)) { Exclamation(t_("Error while loading preview!")); return; } dlg.Execute(); }
void SelectPackageDlg::OnBaseRemove() { int c = base.GetCursor(); if(c < 0) return; String next; if(c + 1 < base.GetCount()) next = base.Get(c + 1); else if(c > 0) next = base.Get(c - 1); String vars = base.Get(0); String varpath = VarFilePath(vars); if(PromptOKCancel(NFormat("Remove base file [* \1%s\1]?", varpath)) && !FileDelete(varpath)) Exclamation(NFormat("Error deleting file [* \1%s\1].", varpath)); SyncBase(next); }
void Pdb::BreakRunning() //TODO: Fix in wow64? { stop = true; if(running) { BOOL (WINAPI *debugbreak)(HANDLE Process); debugbreak = (BOOL (WINAPI *)(HANDLE)) GetProcAddress(GetModuleHandle("kernel32.dll"), "DebugBreakProcess"); if(debugbreak) { LLOG("=== DebugBreakProcess"); break_running = true; (*debugbreak)(hProcess); } else Exclamation("Operation is not supported on this OS"); } }
bool DockBase::AddWidgettoGroup(String name, DockableCtrl& ctrl) { CtrlRecord* record = GetCtrlRecord(ctrl); if(!record || name == t_("Default")) return false; NewWidgetGroup(name); Vector<int>& ids = groups.Get(name); for(int i = 0; i < ids.GetCount(); i++) if(ids[i] == record->id) { Exclamation(Format(t_("Error: Widget (%s) is already in the group '%s'"), ctrl.GetLabel(), name)); return false; } ids.Add(record->id); grouptab.grouptree.Add(grouptab.grouptree.Find(name), ctrl.GetIcon(), Value(record->id), Value(ctrl.GetLabel())); return true; }
void GrabScreen::ButGrab_Push() { #if defined(PLATFORM_WIN32) FileDelete(editFileNameGrab.GetData().ToString()); bool ret; if (swGrabMode.GetData() == 0) ret = Record_Desktop(~editFileNameGrab, editTime, editFrameRate, opGrabMouse); else if (swGrabMode.GetData() == 1) ret = Record_Window(~editFileNameGrab, editTime, GetWindowIdFromCaption(~editWindowTitle, false), editFrameRate, opGrabMouse); else if (swGrabMode.GetData() == 2) ret = Record_DesktopRectangle(~editFileNameGrab, editTime, editLeft, editTop, editWidth, editHeight, editFrameRate, opGrabMouse); else throw Exc("Unexpected value"); if (!ret) Exclamation("Error on grabbing"); #endif }
void WorkspaceWork::NewPackageFile() { NewPackageFileWindow dlg; dlg.folder = GetFileFolder(GetActivePackagePath()); dlg.Open(); dlg.name.SetFocus(); dlg.name.SetSelection(0, 0); for(;;) { if(dlg.Run() != IDOK) return; String e = dlg.GetError(); if(e.GetCount() == 0) break; Exclamation(e); } AddItem(~dlg.name, false, false); }
void Ide::CheckUpdatesManual(){ int tmp=UpdaterCfg().ignored; UpdaterCfg().ignored=0; su.ClearError(); if(su.NeedsUpdate(true)){ su.Execute(); }else{ String err=su.GetError(); if(err=="CANCEL") return; if(!err.IsEmpty()){ Exclamation("Unable to check for updates. "+err); }else{ PromptOK("No update found. You are using version "+su.GetLocal()+"."); } UpdaterCfg().ignored=tmp; } SetBar(); }
void SelectPackageDlg::DeletePackage() { String n = GetCurrentName(); if(IsNull(n)) return; String pp = GetFileFolder(PackagePath(GetCurrentName())); if(!DirectoryExists(pp)) { Exclamation("Directory does not exist!"); return; } if(!PromptYesNo("Do you really want to delete package [* \1" + GetCurrentName() + "\1]?&&" "[/ Warning:] [* Package will not be removed " "from uses of any other package!]")) return; if(!PromptYesNo("This operation is irreversible.&Do you really want to proceed?")) return; DeleteFolderDeep(pp); Load(); }
void DockBase::OnAddNewLayout() { String name; if(EditText(name, t_("Add new layout"), t_("Layout name:"), 32)) { if(IsNull(name)) { Exclamation(t_("You must enter a name for the new layout")); return; } else if(layouts.Find(name) >= 0) { if(!PromptOKCancel(Format(t_("Layout '%s' adready exists. Do you want to overwrite it?"), name))) return; } NewWidgetLayout(name); RefreshPanel(); } }