#ifndef IDE_H #define IDE_H #include #include #include #include #include #include #include #include #include #include #include #include #include #include "MethodsCtrls.h" #define LAYOUTFILE #include #define IMAGECLASS IdeImg #define IMAGEFILE #include #define KEYGROUPNAME "Ide" #define KEYNAMESPACE IdeKeys #define KEYFILE #include #include "version.h" #include #include #ifdef PLATFORM_POSIX #include #endif const char *FindTag(const char *txt, const char *tag); const char *FindAfter(const char *txt, const char *tag); int IdeLocateLine(String old_file, int old_line, String new_file); #include "UppDlg.h" bool IsTextFile(const String& file, int maxline = INT_MAX); void Puts(const char *s); class Console : public LineEdit { public: virtual bool Key(dword key, int count); virtual void LeftDouble(Point p, dword); virtual void RightDown(Point p, dword); virtual void Append(const String& s); protected: struct Slot { Slot() : outfile(NULL), quiet(true), exitcode(Null) { serial = INT_MAX; } One process; String cmdline; String output; String key; String group; Stream *outfile; bool quiet; int exitcode; int last_msecs; int serial; }; struct Group { Group() : count(0), start_time(::msecs()), finished(false), msecs(0), raw_msecs(0) {} int count; int start_time; bool finished; int msecs; int raw_msecs; }; struct Finisher { int serial; Callback cb; }; Array processes; ArrayMap groups; Array finisher; Vector error_keys; String current_group; String spooled_output; int console_lock; bool wrap_text; FrameBottom input; String line; int serial; void CheckEndGroup(); void FlushConsole(); public: Callback WhenSelect; Callback1 WhenBar; Callback1 WhenLine; Callback WhenRunEnd; bool console; bool verbosebuild; int Execute(const char *cmdline, Stream *out = NULL, const char *envptr = NULL, bool quiet = false, bool noconvert = false); int Execute(One pick_ process, const char *cmdline, Stream *out = NULL, bool quiet = false); int GetSlotCount() const { return processes.GetCount(); } int AllocSlot(); bool Run(const char *cmdline, Stream *out = NULL, const char *endptr = NULL, bool quiet = false, int slot = 0, String key = Null, int blitz_count = 1); bool Run(One pick_ process, const char *cmdline, Stream *out = NULL, bool quiet = false, int slot = 0, String key = Null, int blitz_count = 1); void BeginGroup(String group); void EndGroup(); Console& operator<<(const String& s) { Append(s); return *this; } void ToErrors(const String& s); void AppendOutput(const String& s); bool IsRunning(); bool IsRunning(int slot); int Flush(); void Kill(int slot); void Kill(); void ClearError() { error_keys.Clear(); line.Clear(); WhenRunEnd(); } Vector PickErrors() { Vector e = pick(error_keys); error_keys.Clear(); return pick(e); } void Wait(int slot); bool Wait(); void OnFinish(Callback cb); void WrapText(bool w) { wrap_text = w; } void SetSlots(int s); void Input(bool b); Console(); }; VectorMap& BuilderMap(); String SelectAnyPackage(); String FindInDirs(const Vector& dir, const String& file); String FindCommand(const Vector& exedir, const String& cmdline); void DlCharset(DropList& d); void DlCharsetD(DropList& d); void SetupBuildMethods(); VectorMap GetMethodVars(const String& method); String GetDefaultMethod(); bool CheckLicense(); bool Install(); #define HELPNAME "Help Topics" #define METAPACKAGE "" class TopicCtrl : public HelpWindow { public: virtual Topic AcquireTopic(const String& topic); virtual void BarEx(Bar& bar); virtual bool Key(dword key, int count); virtual void FinishText(RichText& text); private: EditString search; DropList lang; bool internal; bool showwords, all; VectorMap > > map; Index lang_list; Vector spos; static Index idelink; void OpenTopic(); void Search(); void ShowWords(); void All(); void Lang(); void SShow(); void ScanDirForTpp(const char *dir, const String& rel, Index& donepackage, Index& lang_list); void LoadMap(); void FocusSearch(); void Prev(); void Next(); public: Callback WhenTopic; void SyncDocTree(); void SearchWord(const String& s); void Serialize(Stream& s); typedef TopicCtrl CLASSNAME; TopicCtrl(); }; struct IdeCalc : CodeEditor { virtual bool Key(dword key, int count); virtual void LeftDouble(Point p, dword flags); ArrayMap vars; void Execute(); IdeCalc(); }; void AutoSetup(); extern bool splash_screen; void HideSplash(); void ShowSplash(); bool IsSplashOpen(); class RightTabs : public FrameCtrl { public: virtual void Paint(Draw& w); virtual void LeftDown(Point p, dword); virtual void MouseMove(Point p, dword); virtual void MouseLeave(); virtual void CancelMode(); virtual void FramePaint(Draw& w, const Rect& r); virtual void FrameLayout(Rect& r); virtual void FrameAddSize(Size& sz); private: enum { SPACE = 7 }; struct Tab { int y; Image img; String tip; int GetHeight() const { return img.GetSize().cy + SPACE; } int GetRight() const { return y + GetHeight(); } }; Array tab; int cx; int hl; int cursor; void Repos(); void PaintTab(Draw& w, int x, int y, int cx, int cy, Color paper, const Image& img, Color hl); int GetPos(Point p); public: void Clear(); void Add(const Image& img, const String& tip); void SetCursor(int i); int GetCursor() const { return cursor; } RightTabs(); }; class EditorTabBar : public FileTabs { public: EditorTabBar(); String GetFile(int n) const; bool FindSetFile(const String& fn); void SetAddFile(const String& fn); void RenameFile(const String& fn, const String& nn); void SetSplitColor(const String& fn, const Color& c); void ClearSplitColor(); typedef EditorTabBar CLASSNAME; }; int memcmp_i(const char *s, const char *t, int n); String ResolveTParam(const String& type, const Vector& tparam); void ResolveTParam(Vector& type, const Vector& tparam); String Qualify(const String& scope, const String& type, const String& usings); int CharFilterMacro(int c); int CharFilterFileName(int c); bool isincludefnchar(int c); Size GetDrawFileNameSize(const String& h); void DrawFileName(Draw& w, const Rect& r, const String& h, Color ink); void AddPath(EditString *es); void InsertPath(EditString *es); #include "Assist.h" void DirSel(EditField& f, FrameRight