diff --git a/uppsrc/CtrlLib/ChGtk.cpp b/uppsrc/CtrlLib/ChGtk.cpp index 72f4e0e59..93d3eb492 100644 --- a/uppsrc/CtrlLib/ChGtk.cpp +++ b/uppsrc/CtrlLib/ChGtk.cpp @@ -612,7 +612,7 @@ void ChHostSkin() bool bold = false; bool italic = false; - const char *font_name = GtkStyleString("gtk-font-name"); + String font_name = GtkStyleString("gtk-font-name"); int xdpi = Nvl(GtkStyleInt("gtk-xft-dpi"), 72 * 1024); gtk_antialias = Nvl(GtkStyleInt("gtk-xft-antialias"), -1); diff --git a/uppsrc/CtrlLib/FileList.cpp b/uppsrc/CtrlLib/FileList.cpp index 5cb8cc64b..d18649375 100644 --- a/uppsrc/CtrlLib/FileList.cpp +++ b/uppsrc/CtrlLib/FileList.cpp @@ -34,7 +34,7 @@ const wchar *strdirsep(const wchar *s) { } void DrawFileName(Draw& w, int x, int y, int wcx, int cy, const WString& mname, bool isdir, Font font, - Color ink, Color extink, const WString& desc, Font descfont, bool justname) + Color ink, Color extink, const WString& desc, Font descfont, bool justname, Color uln) { FontInfo fi = font.Info(); int extpos = (isdir ? -1 : mname.ReverseFind('.')); @@ -47,17 +47,22 @@ void DrawFileName(Draw& w, int x, int y, int wcx, int cy, const WString& mname, if(justname && slash >= 0) name += slash + 1; int txtcx = GetTextSize(fi, name); + int x0 = x; if(txtcx <= wcx) { w.DrawText(x, y, name, font, ink, (int)(ext - name)); w.DrawText(x + GetTextSize(fi, name, ext), y, ext, font, extink, (int)(mname.End() - ext)); if(!IsEmpty(desc)) DrawTextEllipsis(w, x + fi.GetHeight(), y, wcx - txtcx, desc, "...", descfont, extink); + x += txtcx; } else { int dot3 = 3 * fi['.']; - if(2 * dot3 > wcx) - w.DrawText(x, y, name, font, ink, GetTextFitCount(fi, name, wcx)); + if(2 * dot3 > wcx) { + int n = GetTextFitCount(fi, name, wcx); + w.DrawText(x, y, name, font, ink, n); + x += GetTextSize(fi, name, name + n); + } else { const wchar *end = mname.End(); int dircx = 2 * fi['.'] + fi[DIR_SEP]; @@ -73,7 +78,8 @@ void DrawFileName(Draw& w, int x, int y, int wcx, int cy, const WString& mname, w.DrawText(x, y, name, font, ink, (int)(ext - name)); x += GetTextSize(fi, name, ext); w.DrawText(x, y, ext, font, extink, (int)(end - ext)); - return; + x += GetTextSize(fi, ext, end); + goto end; } bk = strdirsep(name); } @@ -86,6 +92,7 @@ void DrawFileName(Draw& w, int x, int y, int wcx, int cy, const WString& mname, w.DrawText(x, y, name, font, ink, n); x += GetTextSize(fi, name, name + n); w.DrawText(x, y, "...", font, SColorDisabled, 3); + x += dot3; } else { wcx -= extcx; @@ -94,9 +101,14 @@ void DrawFileName(Draw& w, int x, int y, int wcx, int cy, const WString& mname, x += GetTextSize(fi, name, name + n); w.DrawText(x, y, "...", font, SColorDisabled, 3); w.DrawText(x + dot3, y, ext, font, extink, (int)(end - ext)); + x += dot3 + extcx; } } } +end: + if(IsNull(uln)) + return; + w.DrawRect(x0, y + fi.GetAscent() + 1, x - x0, 1, uln); } void FileList::Paint(Draw& w, const Rect& r, const Value& q, @@ -114,7 +126,7 @@ void FileList::Paint(Draw& w, const Rect& r, const Value& q, r.right - x - 2, r.Height(), WString(m.name), m.isdir, m.font, dark ? SColorHighlightText : m.ink, dark ? SColorHighlightText : m.extink, - WString(m.desc), m.descfont, justname); + WString(m.desc), m.descfont, justname, m.underline); } Size FileList::GetStdSize(const Value& q) const @@ -203,7 +215,7 @@ bool FileList::Key(dword key, int count) { void FileList::Insert(int ii, const String& name, const Image& icon, Font font, Color ink, bool isdir, int64 length, Time time, Color extink, - const String& desc, Font descfont, Value data) + const String& desc, Font descfont, Value data, Color uln) { Value v; File& m = CreateRawValue(v); @@ -218,12 +230,35 @@ void FileList::Insert(int ii, m.desc = desc; m.descfont = descfont; m.data = data; + m.underline = uln; ColumnList::Insert(ii, v, !m.isdir); } +void FileList::Set(int ii, + const String& name, const Image& icon, Font font, Color ink, + bool isdir, int64 length, Time time, Color extink, + const String& desc, Font descfont, Value data, Color uln) +{ + Value v; + File& m = CreateRawValue(v); + m.isdir = isdir; + m.icon = icon; + m.name = name; + m.font = font; + m.ink = ink; + m.length = length; + m.time = time; + m.extink = IsNull(extink) ? ink : extink; + m.desc = desc; + m.descfont = descfont; + m.data = data; + m.underline = uln; + ColumnList::Set(ii, v, !m.isdir); +} + void FileList::Add(const String& name, const Image& icon, Font font, Color ink, bool isdir, int64 length, Time time, Color extink, - const String& desc, Font descfont, Value data) + const String& desc, Font descfont, Value data, Color uln) { Value v; File& m = CreateRawValue(v); @@ -238,6 +273,7 @@ void FileList::Add(const String& name, const Image& icon, Font font, Color ink, m.desc = desc; m.descfont = descfont; m.data = data; + m.underline = uln; ColumnList::Add(v, !m.isdir); } diff --git a/uppsrc/CtrlLib/FileSel.h b/uppsrc/CtrlLib/FileSel.h index 2aebab74e..007e811da 100644 --- a/uppsrc/CtrlLib/FileSel.h +++ b/uppsrc/CtrlLib/FileSel.h @@ -1,7 +1,8 @@ Image GetDriveImage(char drive_style); void DrawFileName(Draw& w, int x, int y, int wcx, int cy, const WString& mname, bool isdir, Font font, - Color ink, Color extink, const WString& desc, Font descfont, bool justname); + Color ink, Color extink, const WString& desc = Null, Font descfont = Null, + bool justname = false, Color underline = Null); class FileList : public ColumnList, private Display { public: @@ -25,6 +26,7 @@ public: String desc; Font descfont; Value data; + Color underline; operator const String&() const { return name; } }; @@ -69,12 +71,19 @@ public: const String& name, const Image& icon = Null, Font font = StdFont(), Color ink = SColorText(), bool isdir = false, int64 length = 0, Time time = Null, Color extink = Null, - const String& desc = Null, Font descfont = Null, Value data = Null); + const String& desc = Null, Font descfont = Null, Value data = Null, + Color underline = Null); + void Set(int ii, + const String& name, const Image& icon = Null, + Font font = StdFont(), Color ink = SColorText(), + bool isdir = false, int64 length = 0, Time time = Null, Color extink = Null, + const String& desc = Null, Font descfont = Null, Value data = Null, + Color underline = Null); void Add(const String& name, const Image& icon = Null, Font font = StdFont(), Color ink = SColorText(), bool isdir = false, int64 length = 0, Time time = Null, Color extink = Null, - const String& desc = Null, Font descfont = Null, Value data = Null); - + const String& desc = Null, Font descfont = Null, Value data = Null, + Color underline = Null); String GetCurrentName() const; int Find(const char *name); diff --git a/uppsrc/CtrlLib/Update.cpp b/uppsrc/CtrlLib/Update.cpp index 4e834e74b..82f697414 100644 --- a/uppsrc/CtrlLib/Update.cpp +++ b/uppsrc/CtrlLib/Update.cpp @@ -1,6 +1,5 @@ #include "CtrlLib.h" - NAMESPACE_UPP #ifdef PLATFORM_WIN32 diff --git a/uppsrc/CtrlLib/init b/uppsrc/CtrlLib/init index 144bdde2d..da5288144 100644 --- a/uppsrc/CtrlLib/init +++ b/uppsrc/CtrlLib/init @@ -3,7 +3,7 @@ #include "CtrlCore/init" #include "RichText/init" #include "PdfDraw/init" -#define BLITZ_INDEX__ FF8C05BA5437D7F0BDE90A0A8910FDCBE +#define BLITZ_INDEX__ F9591244744ADAA29768E46A610ADBF23 #include "CtrlLib.icpp" #undef BLITZ_INDEX__ #endif diff --git a/uppsrc/Draw/DrawOpX11.cpp b/uppsrc/Draw/DrawOpX11.cpp index bd6f2b62b..8712c7522 100644 --- a/uppsrc/Draw/DrawOpX11.cpp +++ b/uppsrc/Draw/DrawOpX11.cpp @@ -304,11 +304,12 @@ void Draw::DrawArcOp(const Rect& rc, Point start, Point end, int width, Color co XChangeGC(Xdisplay, GetGC(), GCForeground, &gcv); Point centre = rc.CenterPoint(); int angle1 = fround(360 * 64 / (2 * M_PI) * - atan2(start.x - centre.x, centre.y - start.y)); + atan2(centre.y - start.y, start.x - centre.x)); int angle2 = fround(360 * 64 / (2 * M_PI) * - atan2(end.x - centre.x, centre.y - end.y)); + atan2(centre.y - end.y, end.x - centre.x)); if(angle2 <= angle1) angle2 += 360 * 64; + angle2 -= angle1; XDrawArc(Xdisplay, GetDrawable(), GetGC(), rc.left + offset.x, rc.top + offset.y, rc.Width(), rc.Height(), angle1, angle2); XChangeGC(Xdisplay, GetGC(), GCForeground, &gcv_old); diff --git a/uppsrc/Draw/DrawTextUtil.cpp b/uppsrc/Draw/DrawTextUtil.cpp index a1703acb2..fe6361f77 100644 --- a/uppsrc/Draw/DrawTextUtil.cpp +++ b/uppsrc/Draw/DrawTextUtil.cpp @@ -35,7 +35,7 @@ void DrawTextEllipsis(Draw& w, int x, int y, int cx, const wchar *text, const ch void DrawTextEllipsis(Draw& w, int x, int y, int cx, const char *text, const char *ellipsis, Font font, Color ink, int n) { - DrawTextEllipsis(w, x, y, cx, WString(text), ellipsis, font, ink, n); + return DrawTextEllipsis(w, x, y, cx, WString(text), ellipsis, font, ink, n); } Size GetTLTextSize(const wchar *text, Font font) diff --git a/uppsrc/ide/Build.cpp b/uppsrc/ide/Build.cpp index 112001b20..9069080cb 100644 --- a/uppsrc/ide/Build.cpp +++ b/uppsrc/ide/Build.cpp @@ -748,7 +748,7 @@ void Ide::CreateMakefile() SaveMakeFile(~mfout); } -void Ide::SaveMakeFile(const String& fn) +void Ide::SaveMakeFile(const String& fn, bool exporting) { const Workspace& wspc = IdeWorkspace(); @@ -762,7 +762,7 @@ void Ide::SaveMakeFile(const String& fn) String makefile; Vector uppdirs = GetUppDirs(); - String uppout = host->GetHostPath(GetVar("OUTPUT")); + String uppout = exporting ? host->GetHostPath(GetVar("OUTPUT")) : "_out/"; String inclist; Index allconfig = PackageConfig(wspc, 0, bm, mainconfigparam, *host, *b); @@ -775,17 +775,20 @@ void Ide::SaveMakeFile(const String& fn) allconfig.Remove(a); } - for(int i = 0; i < uppdirs.GetCount(); i++) { - String srcdir = GetMakePath(AdjustMakePath(host->GetHostPath(AppendFileName(uppdirs[i], ""))), win32); - makefile << "UPPDIR" << (i + 1) << " = " << srcdir << "\n"; - inclist << " -I$(UPPDIR" << (i + 1) << ")"; - } + if(!exporting) + for(int i = 0; i < uppdirs.GetCount(); i++) { + String srcdir = GetMakePath(AdjustMakePath(host->GetHostPath(AppendFileName(uppdirs[i], ""))), win32); + makefile << "UPPDIR" << (i + 1) << " = " << srcdir << "\n"; + inclist << " -I$(UPPDIR" << (i + 1) << ")"; + } + else + inclist << "-I./"; Vector includes = SplitDirs(bm.Get("INCLUDE","")); for(int i = 0; i < includes.GetCount(); i++) inclist << " -I" << includes[i]; makefile << "\n" - "UPPOUT = " << GetMakePath(AdjustMakePath(host->GetHostPath(AppendFileName(uppout, ""))), win32) << "\n" + "UPPOUT = " << (exporting ? "_out/" : GetMakePath(AdjustMakePath(host->GetHostPath(AppendFileName(uppout, ""))), win32)) << "\n" "CINC = " << inclist << "\n" "Macro = "; @@ -800,7 +803,9 @@ void Ide::SaveMakeFile(const String& fn) b->version = tm.version; b->method = method; MakeFile mf; - b->AddMakeFile(mf, wspc[i], GetAllUses(wspc, i), GetAllLibraries(wspc, i, bm, mainconfigparam, *host, *b), allconfig); + b->AddMakeFile(mf, wspc[i], GetAllUses(wspc, i), + GetAllLibraries(wspc, i, bm, mainconfigparam, *host, *b), allconfig, + exporting); if(!i) { String tdir = mf.outdir; String trg; @@ -812,6 +817,8 @@ void Ide::SaveMakeFile(const String& fn) trg.Insert(0, "$(OutDir)"); } output = Nvl(trg, mf.output); + if(exporting) + output = "_out/" + GetFileName(mf.output); install << "\n" "OutDir = " << tdir << "\n" "OutFile = " << output << "\n" @@ -837,10 +844,12 @@ void Ide::SaveMakeFile(const String& fn) "$(OutFile): " << linkdep << "\n\t" << linkfiles << linkfileend << "\n" << rules; - if(::SaveFile(fn, makefile)) - PutConsole(NFormat("%s(1): makefile generation complete", fn)); - else - PutConsole(NFormat("%s: error writing makefile", fn)); + bool sv = ::SaveFile(fn, makefile); + if(!exporting) + if(sv) + PutConsole(NFormat("%s(1): makefile generation complete", fn)); + else + PutConsole(NFormat("%s: error writing makefile", fn)); EndBuilding(true); } diff --git a/uppsrc/ide/Builders/Builders.h b/uppsrc/ide/Builders/Builders.h index 71ffedd10..643766952 100644 --- a/uppsrc/ide/Builders/Builders.h +++ b/uppsrc/ide/Builders/Builders.h @@ -57,7 +57,7 @@ struct CppBuilder : Builder { virtual void AddMakeFile(MakeFile& makefile, String package, const Vector& all_uses, const Vector& all_libraries, - const Index& common_config); + const Index& common_config, bool exporting); CppBuilder() : wspc(GetIdeWorkspace()) {} }; diff --git a/uppsrc/ide/Builders/CppBuilder.cpp b/uppsrc/ide/Builders/CppBuilder.cpp index 3302fc804..5e7110ed4 100644 --- a/uppsrc/ide/Builders/CppBuilder.cpp +++ b/uppsrc/ide/Builders/CppBuilder.cpp @@ -370,14 +370,19 @@ static String MakeIdent(const char *name) return out; } -static String MakeSourcePath(const Vector& dirs, String fn, bool raw) +static String MakeSourcePath(const Vector& dirs, String fn, bool raw, bool exporting) { fn = UnixPath(fn); for(int i = 0; i < dirs.GetCount(); i++) { int dl = dirs[i].GetLength(); - if(fn.GetLength() >= dl + 2 && !memcmp(fn, dirs[i], dl) && fn[dl] == '/') - return String().Cat() << "$(UPPDIR" << (i + 1) << ")" << AdjustMakePath(fn.GetIter(dl + 1)); + if(fn.GetLength() >= dl + 2 && !memcmp(fn, dirs[i], dl) && fn[dl] == '/') { + String s; + if(!exporting) + s << "$(UPPDIR" << (i + 1) << ")"; + s << AdjustMakePath(fn.GetIter(dl + 1)); + return s; + } } return raw ? String() : AdjustMakePath(fn); } @@ -389,7 +394,7 @@ String CppBuilder::GetMakePath(String fn) const void CppBuilder::AddMakeFile(MakeFile& makefile, String package, const Vector& all_uses, const Vector& all_libraries, - const Index& common_config) + const Index& common_config, bool exporting) { String packagepath = PackagePath(package); Package pkg; @@ -512,12 +517,12 @@ void CppBuilder::AddMakeFile(MakeFile& makefile, String package, if(isc || isrc || iscpp || isicpp) { String outfile; outfile << makefile.outdir << AdjustMakePath(GetFileTitle(fn)) << (isrc ? "_rc" : "") << objext; - String srcfile = GetMakePath(MakeSourcePath(src, fn, false)); + String srcfile = GetMakePath(MakeSourcePath(src, fn, false, exporting)); makefile.rules << outfile << ": " << srcfile; Vector dep = HdependGetDependencies(fn); Sort(dep, GetLanguageInfo()); for(int d = 0; d < dep.GetCount(); d++) { - String dfn = MakeSourcePath(src, dep[d], true); + String dfn = MakeSourcePath(src, dep[d], true, exporting); if(!IsNull(dfn)) makefile.rules << " \\\n\t" << GetMakePath(dfn); } diff --git a/uppsrc/ide/Common/Common.h b/uppsrc/ide/Common/Common.h index b7f09d584..0500b2ceb 100644 --- a/uppsrc/ide/Common/Common.h +++ b/uppsrc/ide/Common/Common.h @@ -404,7 +404,7 @@ struct Builder { virtual void AddFlags(Index& cfg) {} virtual void AddMakeFile(MakeFile& mfinfo, String package, const Vector& all_uses, const Vector& all_libraries, - const Index& common_config) {} + const Index& common_config, bool exporting) {} virtual String GetTargetExt() const = 0; Builder() { doall = false; } diff --git a/uppsrc/ide/Export.cpp b/uppsrc/ide/Export.cpp new file mode 100644 index 000000000..5ad9bb718 --- /dev/null +++ b/uppsrc/ide/Export.cpp @@ -0,0 +1,85 @@ +#include "ide.h" + +void CopyFolder(const char *_dst, const char *_src, Index& used, bool all) +{ + String dst = NativePath(_dst); + String src = NativePath(_src); + if(dst == src) + return; + FindFile ff(AppendFileName(src, "*")); + bool realize = true; + while(ff) { + String s = AppendFileName(src, ff.GetName()); + String d = AppendFileName(dst, ff.GetName()); + if(ff.IsFolder()) + CopyFolder(d, s, used, all); + else + if(ff.IsFile() && (all || used.Find(s) >= 0)) { + if(realize) { + RealizeDirectory(dst); + realize = false; + } + SaveFile(d, LoadFile(s)); + SetFileTime(d, ff.GetLastWriteTime()); + } + ff.Next(); + } +} + +void Ide::ExportProject() { + WithExportLayout dlg; + CtrlLayoutOKCancel(dlg, "Export project"); + FrameRight