Index: Assist.cpp
===================================================================
--- Assist.cpp	(revision 3180)
+++ Assist.cpp	(working copy)
@@ -24,6 +24,19 @@
 	assist.NoGrid();
 	assist.AddColumn().Margin(0).SetDisplay(Single<CppItemInfoDisplay>());
 	assist.WhenLeftClick = THISBACK(AssistInsert);
+	
+	
+	files.AutoHideSb(true).NoHeader().NoGrid().AddColumn().Margin(0).SetDisplay(Single<IncludeFileItem::MyDisplay>());
+	files.SetFrame(BlackFrame()).BackPaint();
+	files.WhenLeftClick = THISBACK(AssistFileInsert);
+	mAssistSearchStringConfig = "h;hpp";
+	mUseIncludeAssist = true;
+	mWorkerBusy = false;
+	mIncludePathDepth = 0;
+	mAssistFrontCharacter = 0;
+	
+	
+	
 	type.NoHeader();
 	type.NoGrid();
 	type.AddColumn();
@@ -110,6 +123,12 @@
 	return id;
 }
 
+inline bool IsSpc(int c)
+{
+	return c > 0 && c <= 32;
+}
+/**/
+
 void AssistEditor::DirtyFrom(int line)
 {
 	if(line >= cachedln) {
@@ -123,7 +142,8 @@
 int AssistEditor::Ch(int i)
 {
 	if(i >= 0 && i < GetLength()) {
-		if(i < cachedpos || i - cachedpos > cachedline.GetCount()) {
+		if(i < cachedpos || i - cachedpos > cachedline.GetCount()) 
+		{
 			cachedln = GetLine(i);
 			cachedline = GetWLine(cachedln);
 			cachedpos = GetPos(cachedln);
@@ -149,11 +169,6 @@
 	return max(0, q);
 }
 
-bool IsSpc(int c)
-{
-	return c > 0 && c <= 32;
-}
-
 void AssistEditor::SkipSpcBack(int& q)
 {
 	while(q > 0 && IsSpc(Ch(q - 1)))
@@ -285,7 +300,8 @@
 
 int memcmp_i(const char *s, const char *t, int n)
 {
-	while(n--) {
+	while(n--) 
+	{
 		int q = ToUpper(*s++) - ToUpper(*t++);
 		if(q)
 			return q;
@@ -299,16 +315,55 @@
 	name = ReadIdBack(GetCursor());
 	assist.Clear();
 	int typei = type.GetCursor() - 1;
-	for(int p = 0; p < 2; p++) {
+	
+	if(typei < 0)
+	{
 		VectorMap<String, int> over;
-		for(int i = 0; i < assist_item.GetCount(); i++) {
+		for(int i = 0; i < assist_item.GetCount(); i++) 
+		{
 			const CppItemInfo& m = assist_item[i];
+			if(memcmp_i(name, m.name, name.GetCount()) == 0)
+			{
+				int q = over.Find(m.name);
+				if(m.scope.GetCount() && q < 0)
+				{
+					assist.Add(RawToValue(m));
+					over.Add(m.name);
+				}
+			}
+		}
+	}
+	else
+	{
+		for(int i = 0; i < assist_item.GetCount(); i++) 
+		{
+			const CppItemInfo& m = assist_item[i];
+			if(	m.typei == typei && (memcmp_i(name, m.name, name.GetCount()) == 0) )
+			{
+				if(m.scope.GetCount())
+					assist.Add(RawToValue(m));
+			}
+		}
+	}
+	
+	/*/
+	for(int p = 0; p < 2; p++) 
+	{
+		
+		VectorMap<String, int> over;
+		
+		for(int i = 0; i < assist_item.GetCount(); i++) 
+		{
+			const CppItemInfo& m = assist_item[i];
+			
 			if((typei < 0 || m.typei == typei) &&
 			   (p ? memcmp_i(name, m.name, name.GetCount()) == 0
 			        && memcmp(name, m.name, name.GetCount())
-			      : memcmp(name, m.name, name.GetCount()) == 0)) {
+			      : memcmp(name, m.name, name.GetCount()) == 0)) 
+			      {
 				int q = over.Find(m.name);
-				if(q < 0 || over[q] == m.typei && m.scope.GetCount()) {
+				if(q < 0 || over[q] == m.typei && m.scope.GetCount()) 
+				{
 					assist.Add(RawToValue(m));
 					if(q < 0)
 						over.Add(m.name, m.typei);
@@ -316,6 +371,7 @@
 			}
 		}
 	}
+	/**/
 	assist.Sort(0, CppItemInfoOrder);
 }
 
@@ -330,22 +386,29 @@
 	assist_cursor = q;
 	assist_type.Clear();
 	assist_item.Clear();
+
 	Index<String> in_types;
 	while(iscid(Ch(q - 1)))
 		q--;
 	SkipSpcBack(q);
 	thisback = false;
-	if(Ch(q - 1) == '(') {
+	
+	int Character = Ch(q-1);
+	
+	if(Character == '(')
+	{
 		--q;
 		String id = IdBack(q);
-		if(id == "THISBACK") {
+		if(id == "THISBACK") 
+		{
 			thisback = true;
 			thisbackn = false;
 			GatherItems(parser.current_scope, false, in_types, false);
 			PopUpAssist();
 			return;
 		}
-		if(id == "THISBACK1" || id == "THISBACK2" || id == "THISBACK3" || id == "THISBACK4") {
+		if(id == "THISBACK1" || id == "THISBACK2" || id == "THISBACK3" || id == "THISBACK4") 
+		{
 			thisback = true;
 			thisbackn = true;
 			GatherItems(parser.current_scope, false, in_types, false);
@@ -353,14 +416,16 @@
 			return;
 		}
 	}
-	if(Ch(q - 1) == ':') {
+	else if(Character == ':') 
+	{
 		while(Ch(q - 1) == ':')
 			q--;
 		Vector<String> tparam;
 		String scope = ParseTemplatedType(Qualify(parser.current_scope, CompleteIdBack(q)), tparam);
 		GatherItems(scope, false, in_types, true);
 	}
-	else {
+	else 
+	{
 		String tp;
 		Vector<String> xp = ReadBack(q);
 		if(xp.GetCount()) {
@@ -570,7 +635,8 @@
 		}
 	}
 	
-	if(popup.IsOpen()) {
+	if(popup.IsOpen()) 
+	{
 		int k = key & ~K_CTRL;
 		ArrayCtrl& kt = key & K_CTRL ? type : assist;
 		if(k == K_UP || k == K_PAGEUP || k == K_CTRL_PAGEUP || k == K_CTRL_END)
@@ -587,25 +653,69 @@
 				kt.SetCursor(0);
 				return true;
 			}
-		if(key == K_ENTER && assist.IsCursor()) {
+		if(key == K_ENTER && assist.IsCursor()) 
+		{
 			AssistInsert();
 			return true;
 		}
-		if(key == K_TAB && !assist.IsCursor() && assist.GetCount()) {
+		if(key == K_TAB && !assist.IsCursor() && assist.GetCount()) 
+		{
 			assist.GoBegin();
 			AssistInsert();
 			return true;
 		}
 	}
+	else if(files.IsOpen())
+	{
+		int k = key & ~K_CTRL;
+		if(k == K_UP || k == K_PAGEUP || k == K_CTRL_PAGEUP || k == K_CTRL_END)
+			if(files.IsCursor())
+				return files.Key(k, count);
+			else {
+				files.SetCursor(files.GetCount() - 1);
+				return true;
+			}
+		if(k == K_DOWN || k == K_PAGEDOWN || k == K_CTRL_PAGEDOWN || k == K_CTRL_HOME)
+			if(files.IsCursor())
+				return files.Key(k, count);
+			else {
+				files.SetCursor(0);
+				return true;
+			}
+		if(files.IsCursor())
+		{
+			if(key == K_ENTER)
+			{
+				AssistFileInsert();
+				return true;
+			}
+		}
+		else if(key == K_TAB && files.GetCount())
+		{
+			files.GoBegin();
+			AssistFileInsert();
+			return true;
+		}
+		else if(key == '/')
+		{
+			if(AssistFileManualInsert())
+				return true;
+		}
+	}
+	
 	int c = GetCursor();
 	int cc = GetChar(c);
 	int bcc = c > 0 ? GetChar(c - 1) : 0;
 	bool b = CodeEditor::Key(key, count);
-	if(assist.IsOpen()) {
+	
+	if(assist.IsOpen()) 
+	{
 		if(!iscid(key) &&
 		   !(iscid(cc) && (key == K_DELETE || key == K_RIGHT)) &&
-		   !(iscid(bcc) && (key == K_LEFT || key == K_BACKSPACE))) {
-			if(b) {
+		   !(iscid(bcc) && (key == K_LEFT || key == K_BACKSPACE))) 
+		   {
+			if(b) 
+			{
 				CloseAssist();
 				if(key == '.')
 					Assist();
@@ -614,13 +724,32 @@
 		else
 			SyncAssist();
 	}
-	else
-	if(auto_assist && InCode()) {
-		if(key == '.' || key == '>' && Ch(GetCursor() - 2) == '-' ||
-		   key == ':' && Ch(GetCursor() - 2) == ':')
+	else if(files.IsOpen())
+	{
+		if(!(iscid(key) || key == '.' || key == '/' || (key == K_DELETE || key == K_RIGHT) || (bcc != '<' && bcc != '"' && (key == K_LEFT || key == K_BACKSPACE)) ))
+		{
+			if(b) 
+				CloseFiles();
+		}
+		else if(mWorkerBusy == false && key != '/')
+		{
+			HandleIncludePopup();
+		}
+	}
+	else if((key == '"' || key == '<') && IsIncludeAssistAvailable())
+	{
+		if(IncludeAssist())
+			return true;
+	}
+	if(auto_assist && InCode()) 
+	{
+		int CH = Ch(GetCursor() - 2);
+		if(key == '.' || (key == '>' && CH == '-') ||
+		   (key == ':' && CH == ':')
+		   )
 			Assist();
-		else
-		if(key == '(') {
+		else if(key == '(') 
+		{
 			int q = GetCursor() - 1;
 			String id = IdBack(q);
 			if(id == "THISBACK" || id == "THISBACK1" || id == "THISBACK2" || id == "THISBACK3" || id == "THISBACK4")
@@ -630,6 +759,7 @@
 	return b;
 }
 
+
 void AssistEditor::MouseWheel(Point p, int zdelta, dword keyflags)
 {
 	if(keyflags & K_CTRL)
@@ -650,10 +780,13 @@
 void AssistEditor::LostFocus()
 {
 	CloseAssist();
+	if(files.IsOpen())
+		CloseFiles();
 }
 
 String AssistEditor::RemoveDefPar(const char *s)
 {
+	
 	String r;
 	int lvl = 0;
 	bool dp = true;
@@ -850,17 +983,17 @@
 	return GetIdScope(os, scope, id, done);
 }
 
-bool IsPif(const String& l)
+inline bool IsPif(const String& l)
 {
 	return l.Find("#if") >= 0;
 }
 
-bool IsPelse(const String& l)
+inline bool IsPelse(const String& l)
 {
 	return l.Find("#el") >= 0;
 }
 
-bool IsPendif(const String& l)
+inline bool IsPendif(const String& l)
 {
 	return l.Find("#endif") >= 0;
 }
@@ -1084,10 +1217,16 @@
 bool AssistEditor::Esc()
 {
 	bool r = false;
-	if(assist.IsOpen()) {
+	if(assist.IsOpen()) 
+	{
 		CloseAssist();
 		r = true;
 	}
+	else if(files.IsOpen())
+	{
+		CloseFiles();
+		r = true;
+	}
 	if(param_info.IsOpen()) {
 		for(int i = 0; i < PARAMN; i++)
 			param[i].line = -1;
Index: Browser/Browser.h
===================================================================
--- Browser/Browser.h	(revision 3180)
+++ Browser/Browser.h	(working copy)
@@ -112,6 +112,40 @@
 	CppItemInfoDisplay() { namestart = false; showtopic = false; }
 };
 
+class IncludeFileDisplayClass;
+struct IncludeFileItem : Moveable<IncludeFileItem> 
+{
+	int 			Type;
+	String 			name;
+	String			fullPath;
+				
+	inline IncludeFileItem(const String & nm,const String& Path,int tp):Type(tp),name(nm),fullPath(Path)
+	{
+	}
+	IncludeFileItem();
+	IncludeFileItem(const char *);
+	
+	inline bool IsFile()const { return (Type > 0); }
+	inline bool IsFolder()const { return (Type == 0); }
+	inline bool IsRefreshSymbol()const { return (Type == -1); }
+	inline bool IsValid()const { return (Type>=0); }
+	typedef IncludeFileDisplayClass MyDisplay;
+	
+	static IncludeFileItem& GetLoadingItem();
+	static IncludeFileItem& GetEmptyItem();
+	static IncludeFileItem&	GetInvalidItem();
+	
+	static int CompareForArrayCtrl(const Value& va,const Value& vb);
+};
+
+class IncludeFileDisplayClass : public Display
+{
+public:
+	virtual void Paint0(Draw& draw, const Rect& rc, const Value& v, Color ink, Color paper, dword style) const;
+	virtual void Paint(Draw& draw, const Rect& rc, const Value& v, Color ink, Color paper, dword style) const;
+	virtual Size GetStdSize(const Value& q) const;
+};
+
 int SearchItemFilter(int c);
 
 struct CodeBrowser {
Index: Browser/ItemDisplay.cpp
===================================================================
--- Browser/ItemDisplay.cpp	(revision 3180)
+++ Browser/ItemDisplay.cpp	(working copy)
@@ -189,3 +189,76 @@
 	            max(16, BrowserFont().Info().GetHeight()));
 }
 
+
+void IncludeFileDisplayClass::Paint0(Draw& w, const Rect& r, const Value& q,
+                             Color ink, Color paper, dword s) const
+{
+	WString txt;
+	Font font = StdFont();
+	int x = r.left+3;
+	int y = r.top;
+	int width = r.GetWidth();
+	
+	const IncludeFileItem& t = ValueTo<IncludeFileItem>(q);
+	txt = t.name.ToWString();
+	if(t.IsFile()) 
+	{
+		//const Image & img = BrowserImg::IncludeFile();
+		const Image & img = CtrlImg::File();
+		Size isz = img.GetSize();
+		w.DrawImage(x, y + max((r.Height() - isz.cy) / 2, 0), img);
+		x += isz.cx + 4;
+	}
+	else if(t.IsFolder())
+	{
+		//const Image & img = BrowserImg::IncludeFolder();
+		const Image & img = CtrlImg::Dir();		
+		Size isz = img.GetSize();
+		w.DrawImage(x, y + max((r.Height() - isz.cy) / 2, 0), img);
+		x += isz.cx + 4;
+	}
+	else if(t.IsRefreshSymbol())
+	{
+		//refresh symbol
+		//const Image & img = BrowserImg::IncludeRefresh();
+		const Image & img = CtrlImg::Toggle();
+		Size isz = img.GetSize();
+		w.DrawImage(x, y + max((r.Height() - isz.cy) / 2, 0), img);
+		x += isz.cx + 4;
+	}
+	else
+	{
+		const Image & img = CtrlImg::Remove();
+		Size isz = img.GetSize();
+		w.DrawImage(x, y + max((r.Height() - isz.cy) / 2, 0), img);
+		x += isz.cx + 4;
+	}
+	
+	int tcy = GetTLTextHeight(txt, font);
+	int tt = y + max((r.Height() - tcy) / 2, 0);
+	DrawTLText(w, x, tt, width, txt, font, ink);/**/
+}
+void IncludeFileDisplayClass::Paint(Draw& w, const Rect& r, const Value& q,
+                    Color ink, Color paper, dword s) const
+{
+	PaintBackground(w, r, q, ink, paper, s);
+	Paint0(w, r, q, ink, paper, s);
+}
+Size IncludeFileDisplayClass::GetStdSize(const Value& q) const
+{
+	Font font = StdFont();
+	WString txt;
+	Size isz(0, 0);
+	
+	const IncludeFileItem& t = ValueTo<IncludeFileItem>(q);
+	
+	txt = t.name.ToWString();
+	isz = CtrlImg::Dir().GetSize();
+	
+	isz.cx += 4;//t.imgspc
+	
+	Size sz = GetTLTextSize(txt, font);
+	
+	return Size(sz.cx + isz.cx, max(sz.cy, isz.cy));
+}
+
Index: Browser/Util.cpp
===================================================================
--- Browser/Util.cpp	(revision 3180)
+++ Browser/Util.cpp	(working copy)
@@ -1,62 +1,93 @@
-#include "Browser.h"
-
-void SplitCodeRef(const String& s, String& scope, String& item)
-{
-	int q = s.FindFirstOf("( ");
-	q = q >= 0 ? s.ReverseFind(':', q) : s.ReverseFind(':');
-	if(q < 0) {
-		scope.Clear();
-		item = s;
-	}
-	else {
-		scope = s.Mid(0, max(q - 1, 0));
-		item = s.Mid(q + 1);
-	}
-}
-
-String MakeCodeRef(const String& nest, const String& item)
-{
-	if(nest.GetCount())
-		return nest + "::" + item;
-	return item;
-}
-
-int GetMatchLen(const char *s, const char *t)
-{
-	int i = 0;
-	while(s[i] == t[i] && s[i])
-		i++;
-	return i;
-}
-
-const CppItem *GetCodeRefItem(const String& ref, const String& rfile)
-{
-	String scope;
-	String item;
-	SplitCodeRef(ref, scope, item);
-	int q = CodeBase().Find(scope);
-	if(q < 0)
-		return NULL;
-	const Array<CppItem>& n = CodeBase()[q];
-	q = FindItem(n, item);
-	if(q < 0)
-		return NULL;
-	if(!IsNull(rfile)) {
-		int i = q;
-		int qml = 0;
-		while(i < n.GetCount() && n[i].qitem == item) {
-			int ml = GetMatchLen(GetCppFile(n[i].file), rfile);
-			if(ml > qml) {
-				q = i;
-				qml = ml;
-			}
-			i++;
-		}
-	}
-	return &n[q];
-}
-
-const CppItem *GetCodeRefItem(const String& ref)
-{
-	return GetCodeRefItem(ref, Null);
-}
+#include "Browser.h"
+
+
+void SplitCodeRef(const String& s, String& scope, String& item)
+{
+	int q = s.FindFirstOf("( ");
+	q = q >= 0 ? s.ReverseFind(':', q) : s.ReverseFind(':');
+	if(q < 0) {
+		scope.Clear();
+		item = s;
+	}
+	else {
+		scope = s.Mid(0, max(q - 1, 0));
+		item = s.Mid(q + 1);
+	}
+}
+
+String MakeCodeRef(const String& nest, const String& item)
+{
+	if(nest.GetCount())
+		return nest + "::" + item;
+	return item;
+}
+
+int GetMatchLen(const char *s, const char *t)
+{
+	int i = 0;
+	while(s[i] == t[i] && s[i])
+		i++;
+	return i;
+}
+
+const CppItem *GetCodeRefItem(const String& ref, const String& rfile)
+{
+	String scope;
+	String item;
+	SplitCodeRef(ref, scope, item);
+	int q = CodeBase().Find(scope);
+	if(q < 0)
+		return NULL;
+	const Array<CppItem>& n = CodeBase()[q];
+	q = FindItem(n, item);
+	if(q < 0)
+		return NULL;
+	if(!IsNull(rfile)) {
+		int i = q;
+		int qml = 0;
+		while(i < n.GetCount() && n[i].qitem == item) {
+			int ml = GetMatchLen(GetCppFile(n[i].file), rfile);
+			if(ml > qml) {
+				q = i;
+				qml = ml;
+			}
+			i++;
+		}
+	}
+	return &n[q];
+}
+
+const CppItem *GetCodeRefItem(const String& ref)
+{
+	return GetCodeRefItem(ref, Null);
+}
+
+IncludeFileItem::IncludeFileItem():Type(-1),name("Loading...")
+{
+}
+IncludeFileItem::IncludeFileItem(const char * text):Type(-2),name(text)
+{
+}
+IncludeFileItem& IncludeFileItem::GetLoadingItem()
+{
+	static IncludeFileItem item;
+	return item;
+}
+IncludeFileItem& IncludeFileItem::GetEmptyItem()
+{
+	static IncludeFileItem item("No files.");
+	return item;
+}
+IncludeFileItem& IncludeFileItem::GetInvalidItem()
+{
+	static IncludeFileItem item("Invalid path!");
+	return item;
+}
+
+int IncludeFileItem::CompareForArrayCtrl(const Value& va,const Value& vb)
+{
+	const IncludeFileItem& a = ValueTo<IncludeFileItem>(va);
+	const IncludeFileItem& b = ValueTo<IncludeFileItem>(vb);
+	return a.name.Compare(b.name);
+}
+                                                
Index: ide.h
===================================================================
--- ide.h	(revision 3180)
+++ ide.h	(working copy)
@@ -329,6 +329,26 @@
 	int            cachedpos;
 	int            cachedln;
 	
+	
+	//----------------------------------------------
+	ArrayCtrl					files;//control to display the include assist
+	Array<IncludeFileItem>		mMainIncludeFiles;//will hold all the files from VC Include directories + all files/folders from the current assembly
+	Array<IncludeFileItem>		mTempIncludeFiles;//temporarely hold some scanned filed depending on context
+	Vector<String> 				mIncludeSearchExtTypes;	
+	Vector<String>				mIncludePathStack;
+
+	int							mIncludePathDepth;	
+	
+	String						mFolderNameStringCache;
+	String						mCurentBuildMethod;//keeps the build method saved in order to check for changes
+	bool						mWorkerBusy;//scanning some files in the background?
+	int							mAssistFrontCharacter;//stores the character with which include assist was started
+	
+	bool						mUseIncludeAssist;
+	String						mAssistSearchStringConfig;
+	//----------------------------------------------
+	
+	
 	RichTextCtrl   param_info;
 	String         param_qtf;
 	struct ParamInfo {
@@ -344,6 +364,31 @@
 	ParamInfo param[PARAMN];
 	int       parami;
 	
+	
+	//----------------------------------------------
+	void			PopUpFiles();
+	void			ShapeFilesPopup();
+	void 			CloseFiles();
+	void 			SyncFiles();
+	void			InsertFiles(bool get_local);
+	bool 			IncludeAssist();//returnes true if file assist was opened
+	
+	void			ScanFrontFiles();
+	void			ScanLocalFiles();
+	void			NotifyScanFinish();
+	bool			AssistFileManualInsert();
+	void 			AssistFileInsert();
+	int 			ReadPathBack(int q);//returnes true if has the character < or " in front
+	bool			ComposeSearchPath();
+	bool			UpdateFileSync(int count);
+	void			HandleIncludePopup();
+	void			InclLocateFolderPath(int &left,int &right);
+	void 			InsertInvalidPath();
+	bool			IsBuildMethodChanged()const;
+	bool			IsIncludeAssistAvailable()const;
+	void			NotifyIncludeConfigChange();
+	//----------------------------------------------
+	
 	void           PopUpAssist(bool auto_insert = false);
 	void           CloseAssist();
 	void           Assist();
@@ -610,7 +655,8 @@
 	String    recent_stdout_file;
 
 // ------------------------------------
-
+	CoWork		mWork;
+// ------------------------------------
 	One<Debugger> debugger;
 
 	Time      start_time;
Index: ide.lay
===================================================================
--- ide.lay	(revision 3180)
+++ ide.lay	(working copy)
@@ -442,15 +442,17 @@
 	ITEM(Option, tabs_serialize, SetLabel(t_("Persistent tabs")).LeftPosZ(272, 108).TopPosZ(108, 16))
 END_LAYOUT
 
-LAYOUT(SetupAssistLayout, 520, 124)
-	ITEM(Option, assist, SetLabel(t_("Automatic assist")).HSizePosZ(4, 280).TopPosZ(4, 16))
+LAYOUT(SetupAssistLayout, 440, 124)
+	ITEM(Option, assist, SetLabel(t_("Automatic assist")).HSizePosZ(4, 200).TopPosZ(4, 16))
 	ITEM(Option, commentdp, SetLabel(t_("Comment out default parameters")).Tip(t_("Comment out default parameters when converting declaration to definition instead of removing them")).LeftPosZ(4, 236).TopPosZ(24, 16))
 	ITEM(Option, auto_enclose, SetLabel(t_("[ { ( \" / * enclose selection")).LeftPosZ(4, 236).TopPosZ(44, 16))
 	ITEM(Option, mark_lines, SetLabel(t_("Mark lines with errors, warning and changes")).LeftPosZ(4, 236).TopPosZ(64, 16))
 	ITEM(Option, barline, SetLabel(t_("Highlight line in the left bar")).LeftPosZ(4, 236).TopPosZ(84, 16))
 	ITEM(Option, qtfsel, SetLabel(t_("QTF designer edits selection")).LeftPosZ(4, 236).TopPosZ(104, 16))
 	ITEM(Option, header_guards, SetLabel(t_("Insert guards to new headers")).LeftPosZ(272, 164).TopPosZ(4, 16))
-	ITEM(Switch, insert_include, SetLabel(t_("No #include in new sources\n#include first\n#include previous")).LeftPosZ(272, 156).TopPosZ(24, 52))
+	ITEM(Option, use_assist, SetLabel(t_("Start Assist for #include")).Tip(t_("In c/c++ code the assist will popup when needed showing you the files you can include.")).LeftPosZ(272, 164).TopPosZ(80, 16))
+	ITEM(Switch, insert_include, SetLabel(t_("No #include in new sources\n#include first\n#include previous")).LeftPosZ(272, 164).TopPosZ(24, 52))
+	ITEM(EditString, include_assist_headers, Tip(t_("The extensions of the files to search for will be specified here separated by ';'")).LeftPosZ(272, 164).TopPosZ(100, 19))
 END_LAYOUT
 
 LAYOUT(SetupIdeLayout, 512, 264)
Index: ide.upp
===================================================================
--- ide.upp	(revision 3180)
+++ ide.upp	(working copy)
@@ -40,6 +40,7 @@
 	Bottom.cpp,
 	t.cpp,
 	Cpp.cpp,
+	IncludeAssist.cpp,
 	Assist.cpp,
 	ParamInfo.cpp,
 	Navigator.cpp,
@@ -83,7 +84,7 @@
 	Copying;
 
 mainconfig
-	"" = "GUI",
+	"" = "GUI MT",
 	"" = "GUI .USEMALLOC",
 	"" = ".NOGTK GUI",
 	"" = "GUI HEAPDBG CHECKINIT",
Index: idewin.cpp
===================================================================
--- idewin.cpp	(revision 3180)
+++ idewin.cpp	(working copy)
@@ -79,8 +79,9 @@
 	}
 }
 
-void Ide::Serialize(Stream& s) {
-	int version = 18;
+void Ide::Serialize(Stream& s) 
+{
+	int version = 19;
 	s.Magic(0x1234);
 	s / version;
 	s % main;
@@ -101,6 +102,14 @@
 	s % font2;
 	s % show_status_bar;
 	s % toolbar_in_row;
+	
+	if(version >= 19)
+	{
+		s % editor.mUseIncludeAssist;
+		s % editor.mAssistSearchStringConfig;
+		/*if(s.IsLoading())
+			editor.NotifyIncludeConfigChange();/**/
+	}
 	if(version >= 18) {
 		s % filetabs;
 	}
@@ -1015,6 +1024,8 @@
 		ide.editor_bottom.Zoom(0);
 		ide.right_split.Zoom(0);
 		ide.UpdateFormat();
+		ide.editor.NotifyIncludeConfigChange();
+		
 		RestoreKeys(LoadFile(ConfigFile("ide.key")));
 		ide.editor.LoadHlStyles(LoadFile(ConfigFile("ide.colors")));
 		if(FileExists(ConfigFile("developide"))) {
Index: IncludeAssist.cpp
===================================================================
--- IncludeAssist.cpp	(revision 0)
+++ IncludeAssist.cpp	(revision 0)
@@ -0,0 +1,528 @@
+#include "ide.h"
+
+
+int memcmp_i(const char *s, const char *t, int n);
+bool IsFolderChar(int c)
+{
+	//need all of them???
+	return (iscid(c) || (c == '!')|| (c == '@')|| (c == '#')|| (c == '$')|| (c == '%')|| (c == '^')|| (c == '&')|| (c == '(')|| (c == ')')|| (c == '_')
+	|| (c == '-')|| (c == '+')|| (c == '=')|| (c == ',')|| (c == '.')|| (c == '`')|| (c == '~'));
+	//posix folders have even more characters
+}
+inline bool IsSpc0(int c)
+{
+	return c > 0 && c <= 32;
+}
+bool AssistEditor::IsIncludeAssistAvailable()const
+{
+	return mUseIncludeAssist;
+}
+int AssistEditor::ReadPathBack(int q)
+{
+	int ch;
+	int ids = q;
+	int len;
+	int depth = 0;
+#ifdef PLATFORM_WIN32
+	int depth2 = 0;
+#endif
+	if(ids > 0)
+	{
+		ch = GetChar(ids - 1);
+		if(IsSpc0(ch))
+			return -1;
+		while(ids > 0 && IsFolderChar(ch))
+		{
+			ids--;
+			ch = GetChar(ids - 1);
+		}
+		len = q - ids;
+#ifdef PLATFORM_WIN32
+		while(ids > 0 && (IsFolderChar(ch) || ch == '/' || ch == '.' || ch == '\\'))
+#else
+		while(ids > 0 && (IsFolderChar(ch) || ch == '/' || ch == '.'))
+#endif
+		{
+			depth += (int)(ch == '/');
+#ifdef PLATFORM_WIN32
+			depth2 += (int)(ch == '\\');
+#endif	
+
+			ids--;
+			ch = GetChar(ids - 1);
+		}
+		if(!((ch == '<') || (ch == '"')))
+			return -1;
+	}
+	else 
+		return -1;
+	mFolderNameStringCache.Clear();
+	while(len!=0 && len < GetLength())
+	{
+		ch = GetChar(q-len);
+		//path << (char)ch;
+		mFolderNameStringCache << (char)ch;
+		len--;
+	}
+#ifdef PLATFORM_WIN32
+	return depth + depth2/2;//will this work??
+#else
+	return depth;
+#endif
+}
+
+bool AssistEditor::IncludeAssist()
+{
+	CloseFiles();
+	
+	int q = GetCursor();
+	int Character = Ch(q-1);
+	
+	if(Character == '"' || Character == '<')//this check should not happen
+	{
+		--q;
+		SkipSpcBack(q);
+		String id = IdBack(q);
+		
+		//if(id == "include")
+		if(memcmp_i(id,"include",id.GetCount()) == 0)
+		{
+			mAssistFrontCharacter = Character;
+			if(mWorkerBusy == false)
+			{
+				
+				InsertFiles(Character == '"');
+				PopUpFiles();
+				return true;
+			}
+		}
+	}
+	return false;
+}
+
+void			AssistEditor::NotifyIncludeConfigChange()
+{
+	Vector<String> local = Split(mAssistSearchStringConfig,";");
+
+	mIncludeSearchExtTypes.Clear();
+	mIncludeSearchExtTypes.Reserve(local.GetCount()+1);
+	mIncludeSearchExtTypes.Add("*");//add the folder
+	String tmp = "*.";
+	for(int i = 0; i < local.GetCount(); i++)
+	{
+		if(local[i].GetCount() != 0)
+			mIncludeSearchExtTypes.Add(tmp+local[i]);
+	}
+	mCurentBuildMethod.Clear();
+}
+
+void			AssistEditor::ShapeFilesPopup()
+{
+	int lcy = max(16, BrowserFont().Info().GetHeight());
+	int cy;
+	
+	if(files.GetCount() > 0)
+		cy = lcy * min(16,(files.GetCount()-1)) + HeaderCtrl::GetStdHeight() + 4;
+	else
+		cy = 4 + HeaderCtrl::GetStdHeight() ;
+
+	files.SetLineCy(lcy);
+	
+	Point p = GetCaretPoint() + GetScreenView().TopLeft();
+	Rect wa = GetWorkArea();
+	int cx = min(wa.Width() - 100, HorzLayoutZoom(250));
+	
+	if(p.x + cx > wa.right)
+		p.x = wa.right - cx;
+	if(p.y + cy + GetFontSize().cy < wa.bottom)
+		files.SetRect(p.x, p.y + GetFontSize().cy, cx, cy);
+	else
+		files.SetRect(p.x, p.y - cy, cx, cy);
+}
+void			AssistEditor::PopUpFiles()
+{
+	ShapeFilesPopup();
+	files.Ctrl::PopUp(this, false, false, true);
+}
+bool AssistEditor::UpdateFileSync(int count)
+{
+	if(count == 0)
+	{
+		mIncludePathDepth = 0;
+		mIncludePathStack.Clear();
+		if(mAssistFrontCharacter == '"')
+		{
+			mWorkerBusy = true;
+			files.Clear();
+			files.Add(RawToValue(IncludeFileItem::GetLoadingItem()));
+			mIncludePathStack.Add(GetFileDirectory(theide->editfile));
+			theide->mWork.Do(THISBACK(ScanLocalFiles));
+		}
+		else if(IsBuildMethodChanged())
+		{
+			mWorkerBusy = true;
+			files.Clear();
+			files.Add(RawToValue(IncludeFileItem::GetLoadingItem()));
+			mCurentBuildMethod = theide->method;
+			mIncludePathStack.Clear();
+			theide->mWork.Do(THISBACK(ScanFrontFiles));
+		}
+		else
+			return true;
+	}
+	else
+	{
+		if(count < mIncludePathDepth)
+		{
+			while(mIncludePathDepth != count)
+			{
+				mIncludePathStack.Pop();
+				mIncludePathDepth--;
+			}
+		}
+		else
+		{
+			//...u lalalaaa
+		}
+		mWorkerBusy = true;
+		theide->mWork.Do(THISBACK(ScanLocalFiles));
+	}
+	return false;
+}
+void AssistEditor::InclLocateFolderPath(int &left,int &right)
+{
+	while(left > 0 && IsFolderChar(Ch(left-1)))
+		left--;
+	if(right<GetLength())
+	{
+		int temp = Ch(right);
+#ifdef PLATFORM_WIN32
+		while(right < GetLength() && (IsFolderChar(temp) || temp == '/' || temp == '\\'))
+#else
+		while(right < GetLength() && (IsFolderChar(temp) || temp == '/'))
+#endif
+			temp = Ch(++right);
+	}
+}
+bool AssistEditor::IsBuildMethodChanged()const
+{
+	return (mCurentBuildMethod != theide->method);
+}
+bool AssistEditor::AssistFileManualInsert()
+{
+	if(mFolderNameStringCache == "..")
+	{
+		if(mIncludePathStack.GetCount() == 0)
+		{
+			mTempIncludeFiles.Clear();
+			InsertInvalidPath();
+		}
+		else
+		{
+			String new_path = mIncludePathStack.Top();
+#ifdef PLATFORM_WIN32
+			if(new_path.GetLength() <= 3)
+#else
+			if(new_path == "/" || new_path.GetCount()<=1)
+#endif
+			{
+				//invalid Path
+				mTempIncludeFiles.Clear();
+				InsertInvalidPath();
+			}
+			else
+			{
+				mIncludePathDepth++;
+				new_path.Trim(new_path.GetLength()-1);
+				new_path = GetFileDirectory(new_path);
+				mIncludePathStack.Add(new_path);
+				mWorkerBusy = true;
+				theide->mWork.Do(THISBACK(ScanLocalFiles));
+			}
+		}
+		return false;
+	}
+	
+	int cursor_pos = GetCursor();
+	int cursor_aux_pos = cursor_pos;
+	String txt;
+	Array<IncludeFileItem> & touse = (mIncludePathDepth==0 && mAssistFrontCharacter == '<') ? mMainIncludeFiles : mTempIncludeFiles;
+	int found_index = -1;
+	
+	//find best fit for the name
+	for(int i = 0; i < touse.GetCount(); i++) 
+	{
+		const IncludeFileItem & item = touse[i];
+		if(!item.IsFolder())
+			continue;
+		if(mFolderNameStringCache == item.name)//exact fit
+		{
+			mIncludePathDepth++;
+			mIncludePathStack.Add(AppendFileName(item.fullPath,item.name+"/"));
+			mWorkerBusy = true;
+			theide->mWork.Do(THISBACK(ScanLocalFiles));
+			return false;
+		}
+		else if(memcmp_i(item.name,mFolderNameStringCache,item.name.GetCount()) == 0)
+			found_index = i;
+	}
+	if(found_index != -1)
+	{
+		const IncludeFileItem & item = touse[found_index];
+		txt = item.name;
+		InclLocateFolderPath(cursor_pos,cursor_aux_pos);
+		
+		Remove(cursor_pos, cursor_aux_pos - cursor_pos);
+		SetCursor(cursor_pos);
+		
+		mIncludePathDepth++;
+		txt+="/";
+		Paste(ToUnicode(txt, CHARSET_WIN1250));
+
+		mIncludePathStack.Add(AppendFileName(item.fullPath,txt));
+		mWorkerBusy = true;
+		theide->mWork.Do(THISBACK(ScanLocalFiles));
+		
+		return true;
+	}
+	else
+	{
+		InsertInvalidPath();
+		return false;
+	}
+}
+void AssistEditor::AssistFileInsert()
+{
+	if(mWorkerBusy)
+		return;
+	
+	String txt;
+	
+	int cursor_pos = GetCursor();
+	int cursor_aux_pos = cursor_pos;
+	int depth = 0;
+	
+	const IncludeFileItem& item = ValueTo<IncludeFileItem>(files.Get(0));
+	if(!item.IsValid())
+		return;
+	
+	txt = item.name;
+	InclLocateFolderPath(cursor_pos,cursor_aux_pos);
+	
+	Remove(cursor_pos, cursor_aux_pos - cursor_pos);
+	SetCursor(cursor_pos);
+		
+	if(item.IsFile())
+	{
+		if(mAssistFrontCharacter == '"')
+			txt+="\"";
+		else if(mAssistFrontCharacter == '<')
+			txt+=">";
+			
+		Paste(ToUnicode(txt, CHARSET_WIN1250));
+		CloseFiles();
+		IgnoreMouseUp();
+	}
+	else
+	{
+		mIncludePathDepth++;
+		txt+="/";
+		Paste(ToUnicode(txt, CHARSET_WIN1250));
+
+		mIncludePathStack.Add(AppendFileName(item.fullPath,txt));
+		mWorkerBusy = true;
+		theide->mWork.Do(THISBACK(ScanLocalFiles));
+	}
+}
+void AssistEditor::InsertInvalidPath()
+{
+	mIncludePathDepth++;
+	mIncludePathStack.Add();
+	files.Clear();
+	files.Add(RawToValue(IncludeFileItem::GetInvalidItem()));
+	ShapeFilesPopup();
+}
+void AssistEditor::NotifyScanFinish()
+{
+	if(files.IsOpen())//still opened then use 
+	{
+		int Count = (mIncludePathDepth==0 && mAssistFrontCharacter == '<') ? mMainIncludeFiles.GetCount() : mTempIncludeFiles.GetCount();
+
+		files.Clear();
+		if(Count == 0)
+		{
+			files.Add(RawToValue(IncludeFileItem::GetEmptyItem()));
+			ShapeFilesPopup();
+		}
+		else
+		{
+			int rezult = ReadPathBack(GetCursor());
+			if(rezult != -1)
+			{
+				if(rezult != mIncludePathDepth)
+				{
+					if(UpdateFileSync(rezult))
+					{
+						SyncFiles();
+						ShapeFilesPopup();
+					}
+				}
+				else
+				{
+					SyncFiles();
+					ShapeFilesPopup();
+				}
+			}
+			else
+				CloseFiles();
+		}
+	}
+	mWorkerBusy = false;
+}
+void AssistEditor::HandleIncludePopup()
+{
+	int rezult = ReadPathBack(GetCursor());
+	if(rezult != -1)
+	{
+		if(rezult != mIncludePathDepth)
+		{
+			if(UpdateFileSync(rezult))
+			{
+				SyncFiles();
+				ShapeFilesPopup();
+			}
+		}
+		else 
+		{
+			SyncFiles();
+			ShapeFilesPopup();
+		}
+	}
+	else
+		CloseFiles();
+}
+#ifdef PLATFORM_LINUX
+void GCC_HARDWIRE_INCLUDE_HACK(Vector<String> & l)
+{
+	String a = "/usr/include";
+	String b = "/usr/local/include";
+	
+	bool oka = true;
+	bool okb = true;
+	for(int i = 0; i < l.GetCount(); i++)
+	{
+		String s = NativePath(l[i]);
+		if(s == a)
+			oka = false;
+		else if(s == b)
+			okb = false;
+	}
+	if(oka)
+		l.Add(a);
+	if(okb)
+		l.Add(b);
+}
+#endif
+
+void AssistEditor::ScanFrontFiles()
+{
+	VectorMap<String, String> BuildMethodMap = GetMethodVars(theide->method);
+	Vector<String> SearchPaths = SplitDirs(GetVar("UPP") + ';' + BuildMethodMap.Get("INCLUDE", ""));
+	
+#ifdef PLATFORM_WIN32
+	const char * intermediate = "\\";
+#else
+
+#ifdef PLATFORM_LINUX
+	GCC_HARDWIRE_INCLUDE_HACK(SearchPaths);
+#endif
+	const char * intermediate = "/";
+
+#endif
+
+	mMainIncludeFiles.Clear();
+	for(int i = 0; i < SearchPaths.GetCount(); i++)
+		for(int j = 0; j < mIncludeSearchExtTypes.GetCount(); j++)
+			for(FindFile ff(SearchPaths[i] + intermediate + mIncludeSearchExtTypes[j]);ff;ff.Next())
+				if(ff.IsFolder() || (ff.IsFile() && j != 0))
+					mMainIncludeFiles.Add(IncludeFileItem(ff.GetName(),SearchPaths[i],j));
+	Call(THISBACK(NotifyScanFinish));
+}
+
+void AssistEditor::ScanLocalFiles()
+{
+	const String &top = mIncludePathStack.Top();
+	mTempIncludeFiles.Clear();
+	if(top.GetCount()!=0)
+	{
+		String search_path = NativePath(top);
+		for(int i = 0; i < mIncludeSearchExtTypes.GetCount(); i++)
+			for(FindFile ff(search_path + mIncludeSearchExtTypes[i]);ff;ff.Next())
+				if(ff.IsFolder() || (ff.IsFile() && i != 0))
+					mTempIncludeFiles.Add(IncludeFileItem(ff.GetName(),search_path,i));
+	}
+	Call(THISBACK(NotifyScanFinish));
+}
+void AssistEditor::InsertFiles(bool get_local)
+{
+	if(get_local)
+	{
+		mWorkerBusy = true;
+		if(files.GetCount() == 0)
+			files.Add(RawToValue(IncludeFileItem::GetLoadingItem()));
+		mIncludePathStack.Add(GetFileDirectory(theide->editfile));
+		theide->mWork.Do(THISBACK(ScanLocalFiles));
+	}
+	else if(IsBuildMethodChanged())
+	{
+		
+		mWorkerBusy = true;
+		files.Add(RawToValue(IncludeFileItem::GetLoadingItem()));
+		mCurentBuildMethod = theide->method;
+		theide->mWork.Do(THISBACK(ScanFrontFiles));
+	}
+	else
+	{
+		Array<IncludeFileItem> & touse = (mIncludePathDepth==0 && mAssistFrontCharacter == '<') ? mMainIncludeFiles : mTempIncludeFiles;
+		for(int i = 0; i < touse.GetCount(); i++)
+			files.Add(RawToValue(touse[i]));
+		files.Sort(0,IncludeFileItem::CompareForArrayCtrl);
+	}
+}
+void AssistEditor::SyncFiles()
+{
+	Array<IncludeFileItem> & touse = (mIncludePathDepth==0 && mAssistFrontCharacter == '<') ? mMainIncludeFiles : mTempIncludeFiles;
+	//int active_count = files.GetCount();
+	files.Clear();
+	if(mFolderNameStringCache.GetCount() == 0)
+	{
+		for(int i = 0; i < touse.GetCount(); i++)
+			files.Add(RawToValue(touse[i]));
+		//active_count -= touse.GetCount();
+	}
+	else
+	{
+		for(int i = 0; i < touse.GetCount(); i++) 
+		{
+			const IncludeFileItem & item = touse[i];
+			if(memcmp_i(mFolderNameStringCache,item.name,mFolderNameStringCache.GetCount())==0)
+			{
+				files.Add(RawToValue(item));
+				//active_count--;
+			}
+		}
+	}
+	if(files.GetCount() == 0)
+		files.Add(RawToValue(IncludeFileItem::GetEmptyItem()));
+	else
+		files.Sort(0,IncludeFileItem::CompareForArrayCtrl);
+	//return active_count;
+};
+void AssistEditor::CloseFiles()
+{
+	mFolderNameStringCache.Clear();
+	mIncludePathStack.Clear();
+	files.Close();
+	files.Clear();
+	mIncludePathDepth = 0;
+}
\ No newline at end of file
Index: Methods.cpp
===================================================================
--- Methods.cpp	(revision 3180)
+++ Methods.cpp	(working copy)
@@ -402,8 +402,10 @@
 		int c = m.Run();
 		if(c == IDCANCEL)
 			break;
-		if(c == IDOK && m.Save()) {
+		if(c == IDOK && m.Save()) 
+		{
 			use_target = m.use_target;
+			editor.NotifyIncludeConfigChange();
 			break;
 		}
 	}
Index: Setup.cpp
===================================================================
--- Setup.cpp	(revision 3180)
+++ Setup.cpp	(working copy)
@@ -390,6 +390,8 @@
 		(assist.mark_lines, mark_lines)
 		(assist.qtfsel, qtfsel)
 		(assist.assist, editor.auto_assist)
+		(assist.use_assist, editor.mUseIncludeAssist)
+		(assist.include_assist_headers, editor.mAssistSearchStringConfig)
 
 		(ide.showtime, showtime)
 		(ide.show_status_bar, show_status_bar)
@@ -481,6 +483,7 @@
 		FlushFile();
 		FileCursor();
 	}
+	editor.NotifyIncludeConfigChange();
 	FileSetTime(ConfigFile("version"), ToTime(~ide.showtimeafter));
 	SaveLoadPackage();
 	SyncCh();
