String GetUmkFile(const char *fn) { return GetFileOnPath(fn, GetHomeDirFile(".upp/umk") + ';' + GetHomeDirFile(".upp/theide") + ';' + GetHomeDirFile(".upp/ide") + ';' + GetHomeDirectory() + ';' + GetFileFolder(GetExeFilePath())); }
void Ide::SetMain(const String& package) { FlushFile(); SaveWorkspace(); transferfilecache.Clear(); main = package; export_dir = GetHomeDirFile(main); mainconfigname.Clear(); mainconfigparam.Clear(); ScanWorkspace(); LoadFromFile(THISBACK(SerializeWorkspace), WorkspaceFile()); editorsplit.Zoom(0); UpdateFormat(); String e = editfile; editfile.Clear(); MakeTitle(); MakeIcon(); SyncMainConfigList(); AdjustMainConfig(); SyncBuildMode(); SetHdependDirs(); SetBar(); HideBottom(); SyncUsc(); NewCodeBase(); if(IsNull(e)) e = GetFirstFile(); EditFile(e); }
String GetExeFilePath() { static String exepath; ONCELOCK { const char *exe = procexepath_(); if(*exe) exepath = exe; else { String x = Argv0__; if(IsFullPath(x) && FileExists(x)) exepath = x; else { exepath = GetHomeDirFile("upp"); Vector<String> p = Split(FromSystemCharset(Environment().Get("PATH")), ':'); if(x.Find('/') >= 0) p.Add(GetCurrentDirectory()); for(int i = 0; i < p.GetCount(); i++) { String ep = NormalizePath(AppendFileName(p[i], x)); if(FileExists(ep)) exepath = ep; } } } } return exepath; }
String Ide::GetLogPath() { if(target.GetCount() == 0) return Null; #ifdef PLATFORM_WIN32 return ForceExt(target, ".log"); #else String p = GetFileTitle(target); return GetHomeDirFile(".upp/" + p + "/" + p + ".log"); #endif }
static VectorMap<String, String>& sIniKeys() { static VectorMap<String, String> key; static int version; if(version != ini_version__) { version = ini_version__; key = LoadIniFile(GetIniFile()); #ifdef PLATFORM_WIN32 if(key.GetCount() == 0) key = LoadIniFile(~GetExeDirFile("q.ini")); if(key.GetCount() == 0) key = LoadIniFile("c:\\q.ini"); #endif #ifdef PLATFORM_POSIX if(key.GetCount() == 0) key = LoadIniFile(GetHomeDirFile("q.ini")); #endif } return key; }
String Ide::GetConfigDir() { return GetHomeDirFile(".upp/" + GetFileTitle(target)); }
void Ide::SetupFormat() { FormatDlg dlg; dlg.Title("Format setup"); WithSetupFontLayout<ParentCtrl> fnt; WithSetupHlLayout<ParentCtrl> hlt; WithSetupEditorLayout<ParentCtrl> edt; WithSetupIdeLayout<ParentCtrl> ide; WithSetupAssistLayout<ParentCtrl> assist; WithSetupMobilePlatformsLayout<ParentCtrl> mobile; AStyleSetupDialog ast(this); #ifdef PLATFORM_WIN32 ide.console_txt.Hide(); ide.console.Hide(); ide.kde.Hide(); ide.gnome.Hide(); ide.xterm.Hide(); ide.mate.Hide(); #endif ide.kde <<= callback2(SetConsole, &ide.console, "/usr/bin/konsole -e"); ide.gnome <<= callback2(SetConsole, &ide.console, "/usr/bin/gnome-terminal -x"); ide.mate <<= callback2(SetConsole, &ide.console, "/usr/bin/mate-terminal -x"); ide.xterm <<= callback2(SetConsole, &ide.console, "/usr/bin/xterm -e"); edt.lineends .Add(LF, "LF") .Add(CRLF, "CRLF") .Add(DETECT_LF, "Detect with default LF") .Add(DETECT_CRLF, "Detect with default CRLF"); edt.filetabs .Add(AlignedFrame::LEFT, "Left") .Add(AlignedFrame::TOP, "Top") .Add(AlignedFrame::RIGHT, "Right") .Add(AlignedFrame::BOTTOM, "Bottom") .Add(-1, "Off"); edt.tabs_crosses .Add(AlignedFrame::LEFT, "Left") .Add(AlignedFrame::RIGHT, "Right") .Add(-1, "Off"); dlg.Add(fnt, "Fonts"); dlg.Add(hlt, "Syntax highlighting"); dlg.Add(edt, "Editor"); dlg.Add(assist, "Assist"); dlg.Add(ide, "IDE"); dlg.Add(ast, "Code formatting"); dlg.Add(mobile, "Mobile platforms"); dlg.WhenClose = dlg.Acceptor(IDEXIT); FontSelectManager ed, vf, con, f1, f2, tf; ed.Set(fnt.face, fnt.height, fnt.bold, fnt.italic, fnt.naa); vf.Set(fnt.vface, fnt.vheight, fnt.vbold, fnt.vitalic, fnt.vnaa); con.Set(fnt.cface, fnt.cheight, fnt.cbold, fnt.citalic, fnt.cnaa); tf.Set(fnt.tface, fnt.theight, fnt.tbold, fnt.titalic, fnt.tnaa); f1.Set(fnt.face1, fnt.height1, fnt.bold1, fnt.italic1, fnt.naa1); f2.Set(fnt.face2, fnt.height2, fnt.bold2, fnt.italic2, fnt.naa2); ed.Set(editorfont); vf.Set(veditorfont); con.Set(consolefont); tf.Set(tfont); f1.Set(font1); f2.Set(font2); DlCharset(edt.charset); edt.tabsize.MinMax(1, 100).NotNull(); edt.tabsize <<= editortabsize; edt.indent_amount.MinMax(1, 100).NotNull(); edt.indent_amount <<= indent_spaces ? indent_amount : editortabsize; edt.indent_amount.Enable(indent_spaces); CtrlRetriever rtvr; int hs = hilite_scope; rtvr (hlt.hilite_scope, hs) (hlt.hilite_bracket, hilite_bracket) (hlt.hilite_ifdef, hilite_ifdef) (hlt.hilite_if_endif, hilite_if_endif) (hlt.thousands_separator, thousands_separator) (hlt.hline, hline) (edt.indent_spaces, indent_spaces) (edt.no_parenthesis_indent, no_parenthesis_indent) (edt.showtabs, show_tabs) (edt.warnwhitespace, warnwhitespace) (edt.lineends, line_endings) (edt.numbers, line_numbers) (edt.bookmark_pos, bookmark_pos) (edt.bordercolumn, bordercolumn) (edt.bordercolor, bordercolor) (edt.findpicksel, find_pick_sel) (edt.findpicktext, find_pick_text) (edt.deactivate_save, deactivate_save) (edt.filetabs, filetabs) (edt.tabs_icons, tabs_icons) (edt.tabs_crosses, tabs_crosses) (edt.tabs_grouping, tabs_grouping) (edt.tabs_stacking, tabs_stacking) (edt.tabs_serialize, tabs_serialize) (edt.persistent_find_replace, persistent_find_replace) (edt.find_replace_restore_pos, find_replace_restore_pos) (assist.barline, barline) (assist.auto_enclose, auto_enclose) (assist.commentdp, editor.commentdp) (assist.header_guards, header_guards) (assist.insert_include, insert_include) (assist.mark_lines, mark_lines) (assist.qtfsel, qtfsel) (assist.assist, editor.auto_assist) (ide.showtime, showtime) (ide.show_status_bar, show_status_bar) (ide.toolbar_in_row, toolbar_in_row) (ide.splash_screen, splash_screen) (ide.sort, sort) (ide.mute_sounds, mute_sounds) (ide.wrap_console_text, wrap_console_text) (ide.hydra1_threads, hydra1_threads) (ide.gdbSelector, gdbSelector) (ide.chstyle, chstyle) (ide.console, LinuxHostConsole) (ide.output_per_assembly, output_per_assembly) (ast.BracketIndent, astyle_BracketIndent) (ast.NamespaceIndent, astyle_NamespaceIndent) (ast.BlockIndent, astyle_BlockIndent) (ast.CaseIndent, astyle_CaseIndent) (ast.ClassIndent, astyle_ClassIndent) (ast.LabelIndent, astyle_LabelIndent) (ast.SwitchIndent, astyle_SwitchIndent) (ast.PreprocessorIndent, astyle_PreprocessorIndent) (ast.MinInStatementIndentLength, astyle_MinInStatementIndentLength) (ast.MaxInStatementIndentLength, astyle_MaxInStatementIndentLength) (ast.BreakClosingHeaderBracketsMode,astyle_BreakClosingHeaderBracketsMode) (ast.BreakElseIfsMode, astyle_BreakElseIfsMode) (ast.BreakOneLineBlocksMode, astyle_BreakOneLineBlocksMode) (ast.SingleStatementsMode, astyle_SingleStatementsMode) (ast.BreakBlocksMode, astyle_BreakBlocksMode) (ast.BreakClosingHeaderBlocksMode, astyle_BreakClosingHeaderBlocksMode) (ast.BracketFormatMode, astyle_BracketFormatMode) (ast.ParensPaddingMode, astyle_ParensPaddingMode) (ast.ParensUnPaddingMode, astyle_ParensUnPaddingMode) (ast.OperatorPaddingMode, astyle_OperatorPaddingMode) (ast.EmptyLineFill, astyle_EmptyLineFill) (ast.TabSpaceConversionMode, astyle_TabSpaceConversionMode) (ast.TestBox, astyle_TestBox) (mobile.AndroidSDKPath, androidSDKPath) ; hlt.hlstyle.AddColumn("Style"); hlt.hlstyle.AddColumn("Color").Ctrls(HlPusherFactory); hlt.hlstyle.AddColumn("Bold").Ctrls<Option>(); hlt.hlstyle.AddColumn("Italic").Ctrls<Option>(); hlt.hlstyle.AddColumn("Underline").Ctrls<Option>(); hlt.hlstyle.ColumnWidths("211 80 45 45 80"); hlt.hlstyle.EvenRowColor().NoHorzGrid().SetLineCy(EditField::GetStdHeight() + 2); ReadHlStyles(hlt.hlstyle); edt.charset <<= (int)default_charset; edt.tabsize <<= rtvr <<= hlt.hlstyle.WhenCtrlsAction = ed.WhenAction = tf.WhenAction = con.WhenAction = f1.WhenAction = f2.WhenAction = dlg.Breaker(222); ide.showtimeafter <<= Nvl((Date)FileGetTime(ConfigFile("version")), GetSysDate() - 1); hlt.hl_restore <<= dlg.Breaker(333); ide.chstyle.Add(0, "Host platform"); ide.chstyle.Add(1, "Standard"); ide.chstyle.Add(2, "Classic"); ide.chstyle.Add(3, "Host platform, blue bars"); ide.chstyle.Add(4, "Standard, blue bars"); FrameRight<Button> uscBrowse; uscBrowse.SetImage(CtrlImg::right_arrow()); uscBrowse <<= callback1(AddPath, &ide.uscpath); ide.uscpath.AddFrame(uscBrowse); ide.uscpath <<= LoadFile(GetHomeDirFile("usc.path")); FrameRight<Button> androidSDKDownload; androidSDKDownload.SetImage(IdeImg::DownloadBlack()); androidSDKDownload.Tip("Download"); androidSDKDownload <<= callback1(LaunchWebBrowser, AndroidSDK::GetDownloadUrl()); mobile.AndroidSDKPath.AddFrame(androidSDKDownload); FrameRight<Button> androidSDKBrowse; androidSDKBrowse.SetImage(CtrlImg::right_arrow()); androidSDKBrowse.Tip("Select directory"); androidSDKBrowse <<= callback1(InsertPath, &mobile.AndroidSDKPath); mobile.AndroidSDKPath.AddFrame(androidSDKBrowse); mobile.AndroidSDKPath <<= androidSDKPath; for(;;) { int c = dlg.Run(); Upp::SaveFile(GetHomeDirFile("usc.path"), ~ide.uscpath); editorfont = ed.Get(); tfont = tf.Get(); veditorfont = vf.Get(); consolefont = con.Get(); font1 = f1.Get(); font2 = f2.Get(); editortabsize = Nvl((int)~edt.tabsize, 4); rtvr.Retrieve(); console.SetSlots(minmax(hydra1_threads, 1, 256)); hilite_scope = hs; if(indent_spaces) indent_amount = ~edt.indent_amount; else { indent_amount = editortabsize; edt.indent_amount <<= editortabsize; } edt.indent_amount.Enable(indent_spaces); default_charset = (byte)(int)~edt.charset; for(int i = 0; i < CodeEditor::HL_COUNT; i++) editor.SetHlStyle(i, hlt.hlstyle.Get(i, 1), hlt.hlstyle.Get(i, 2), hlt.hlstyle.Get(i, 3), hlt.hlstyle.Get(i, 4)); UpdateFormat(); if(c == IDEXIT) break; if(c == 333 && PromptYesNo("Restore default highlighting colors?")) { editor.DefaultHlStyles(); ReadHlStyles(hlt.hlstyle); } } FileSetTime(ConfigFile("version"), ToTime(~ide.showtimeafter)); FinishConfig(); SaveConfig(); }