mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-08-26 06:12:49 -06:00
new uvs2 releases : uppsrc-2618 tutorial-38 examples-142 reference-115
git-svn-id: svn://ultimatepp.org/upp/trunk@308 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
f31c9e9e95
commit
04c20734e6
23 changed files with 296 additions and 134 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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<File>(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<File>(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<File>(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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
#include "CtrlLib.h"
|
||||
|
||||
|
||||
NAMESPACE_UPP
|
||||
|
||||
#ifdef PLATFORM_WIN32
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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<String> uppdirs = GetUppDirs();
|
||||
String uppout = host->GetHostPath(GetVar("OUTPUT"));
|
||||
String uppout = exporting ? host->GetHostPath(GetVar("OUTPUT")) : "_out/";
|
||||
String inclist;
|
||||
|
||||
Index<String> 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<String> 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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ struct CppBuilder : Builder {
|
|||
|
||||
virtual void AddMakeFile(MakeFile& makefile, String package,
|
||||
const Vector<String>& all_uses, const Vector<String>& all_libraries,
|
||||
const Index<String>& common_config);
|
||||
const Index<String>& common_config, bool exporting);
|
||||
|
||||
CppBuilder() : wspc(GetIdeWorkspace()) {}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -370,14 +370,19 @@ static String MakeIdent(const char *name)
|
|||
return out;
|
||||
}
|
||||
|
||||
static String MakeSourcePath(const Vector<String>& dirs, String fn, bool raw)
|
||||
static String MakeSourcePath(const Vector<String>& 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<String>& all_uses, const Vector<String>& all_libraries,
|
||||
const Index<String>& common_config)
|
||||
const Index<String>& 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<String> 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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -404,7 +404,7 @@ struct Builder {
|
|||
virtual void AddFlags(Index<String>& cfg) {}
|
||||
virtual void AddMakeFile(MakeFile& mfinfo, String package,
|
||||
const Vector<String>& all_uses, const Vector<String>& all_libraries,
|
||||
const Index<String>& common_config) {}
|
||||
const Index<String>& common_config, bool exporting) {}
|
||||
virtual String GetTargetExt() const = 0;
|
||||
|
||||
Builder() { doall = false; }
|
||||
|
|
|
|||
85
uppsrc/ide/Export.cpp
Normal file
85
uppsrc/ide/Export.cpp
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
#include "ide.h"
|
||||
|
||||
void CopyFolder(const char *_dst, const char *_src, Index<String>& 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<TopWindow> dlg;
|
||||
CtrlLayoutOKCancel(dlg, "Export project");
|
||||
FrameRight<Button> dsb;
|
||||
DirSel(dlg.outdir, dsb);
|
||||
CtrlRetriever r;
|
||||
if(IsNull(export_name))
|
||||
export_name = main;
|
||||
r(dlg.outdir, export_outdir);
|
||||
r(dlg.name, export_name);
|
||||
r(dlg.usedonly, export_usedonly);
|
||||
if(dlg.Execute() != IDOK)
|
||||
return;
|
||||
r.Retrieve();
|
||||
SaveFile(false);
|
||||
::Workspace wspc;
|
||||
wspc.Scan(main);
|
||||
Index<String> used;
|
||||
HdependClearDependencies();
|
||||
for(int i = 0; i < wspc.GetCount(); i++) {
|
||||
const Package& p = wspc.GetPackage(i);
|
||||
String pn = wspc[i];
|
||||
for(int j = 0; j < p.GetCount(); j++) {
|
||||
const Package::File& f = p[j];
|
||||
if(!f.separator) {
|
||||
String p = SourcePath(pn, f);
|
||||
used.FindAdd(p);
|
||||
Vector<String> d = HdependGetDependencies(p);
|
||||
for(int q = 0; q < d.GetCount(); q++)
|
||||
used.FindAdd(d[q]);
|
||||
for(int q = 0; q < f.depends.GetCount(); q++)
|
||||
used.FindAdd(SourcePath(pn, f.depends[q].text));
|
||||
}
|
||||
}
|
||||
used.FindAdd(SourcePath(pn, "init"));
|
||||
}
|
||||
String ep = AppendFileName(export_outdir, export_name);
|
||||
if(FileExists(ep)) {
|
||||
if(!PromptYesNo("There is a [* " + DeQtf(export_name) + "] file in the output directory.&"
|
||||
"Do you want to delete it?")) return;
|
||||
FileDelete(ep);
|
||||
}
|
||||
if(DirectoryExists(ep)) {
|
||||
if(!PromptYesNo("Do you want to replace existing [* " + DeQtf(export_name) + "] export?"))
|
||||
return;
|
||||
DeleteFolderDeep(ep);
|
||||
}
|
||||
|
||||
Progress pi("Exporting project");
|
||||
pi.SetTotal(wspc.GetCount());
|
||||
for(int i = 0; i < wspc.GetCount(); i++) {
|
||||
if(pi.StepCanceled())
|
||||
return;
|
||||
CopyFolder(AppendFileName(ep, wspc[i]), PackageDirectory(wspc[i]), used, !export_usedonly);
|
||||
}
|
||||
SaveMakeFile(AppendFileName(ep, "Makefile"), true);
|
||||
}
|
||||
|
|
@ -221,20 +221,21 @@ bool Install()
|
|||
|
||||
#else
|
||||
|
||||
bool CopyFolder(Progress& pi, const char *dst, const char *src)
|
||||
bool CopyFolder(const char *dst, const char *src, Progress *pi)
|
||||
{
|
||||
if(strcmp(src, dst) == 0)
|
||||
return true;
|
||||
RealizeDirectory(dst);
|
||||
pi.SetText(dst);
|
||||
if(pi)
|
||||
pi->SetText(dst);
|
||||
FindFile ff(AppendFileName(src, "*"));
|
||||
while(ff) {
|
||||
if(pi.StepCanceled())
|
||||
if(pi && pi->StepCanceled())
|
||||
return false;
|
||||
String s = AppendFileName(src, ff.GetName());
|
||||
String d = AppendFileName(dst, ff.GetName());
|
||||
if(ff.IsFolder())
|
||||
if(!CopyFolder(pi, d, s))
|
||||
if(!CopyFolder(d, s, pi))
|
||||
return false;
|
||||
if(ff.IsFile())
|
||||
SaveFile(d, LoadFile(s));
|
||||
|
|
@ -243,6 +244,11 @@ bool CopyFolder(Progress& pi, const char *dst, const char *src)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool CopyFolder(Progress& pi, const char *dst, const char *src)
|
||||
{
|
||||
CopyFolder(dst, src, &pi);
|
||||
}
|
||||
|
||||
void ChkSupp(const char *s, String& dir)
|
||||
{
|
||||
if(IsNull(dir) && FileExists(AppendFileName(s, "GCC.bm")))
|
||||
|
|
@ -261,11 +267,11 @@ String DefaultInstallFolder()
|
|||
DefaultFolder = "upp-svn";
|
||||
else if(ExeTitle.Find("DEV") >= 0)
|
||||
DefaultFolder = "upp-dev";
|
||||
else if(ExeTitle.Find("BETA") >= 0)
|
||||
else if(ExeTitle.Find("BETA") >= 0)
|
||||
DefaultFolder = "upp-beta";
|
||||
else
|
||||
DefaultFolder = "upp";
|
||||
|
||||
|
||||
return DefaultFolder;
|
||||
|
||||
}
|
||||
|
|
@ -329,9 +335,9 @@ bool Install()
|
|||
Progress pi;
|
||||
if(dlg.Run() != IDOK) return true;
|
||||
String upp(dlg.path);
|
||||
|
||||
|
||||
SaveFile(ConfigFile("installpath"), upp);
|
||||
|
||||
|
||||
String uppsrc;
|
||||
String pp;
|
||||
String out = AppendFileName(upp, "out");
|
||||
|
|
|
|||
|
|
@ -347,6 +347,7 @@ void Ide::SetupFormat() {
|
|||
(edt.mark_lines, mark_lines)
|
||||
(edt.bordercolumn, bordercolumn)
|
||||
(edt.bordercolor, bordercolor)
|
||||
(edt.showtime, showtime)
|
||||
(ide.show_status_bar, show_status_bar)
|
||||
(ide.toolbar_in_row, toolbar_in_row)
|
||||
(ide.splash_screen, splash_screen)
|
||||
|
|
|
|||
|
|
@ -143,6 +143,7 @@ struct WorkspaceWork {
|
|||
ArrayMap<String, Backup> backup;
|
||||
|
||||
bool organizer;
|
||||
bool showtime;
|
||||
|
||||
virtual void PackageCursor();
|
||||
virtual void FileCursor();
|
||||
|
|
@ -181,6 +182,7 @@ struct WorkspaceWork {
|
|||
void LoadActualPackage();
|
||||
void SaveLoadPackage();
|
||||
void SaveLoadPackageNS();
|
||||
void TouchFile(const String& path);
|
||||
|
||||
void MoveFile(int d);
|
||||
void Move(Vector<String>& v, FileList& ta, int d);
|
||||
|
|
|
|||
|
|
@ -132,6 +132,7 @@ void WorkspaceWork::LoadActualPackage()
|
|||
filelist.Clear();
|
||||
fileindex.Clear();
|
||||
bool open = true;
|
||||
Time tm = GetSysTime();
|
||||
for(int i = 0; i < actual.file.GetCount(); i++) {
|
||||
Package::File& f = actual.file[i];
|
||||
if(f.separator) {
|
||||
|
|
@ -142,13 +143,38 @@ void WorkspaceWork::LoadActualPackage()
|
|||
}
|
||||
else
|
||||
if(open) {
|
||||
Color uln = Null;
|
||||
if(showtime) {
|
||||
FindFile ff(SourcePath(GetActivePackage(), f));
|
||||
if(ff) {
|
||||
int64 t = tm - Time(ff.GetLastWriteTime());
|
||||
if(t < 24 * 3600)
|
||||
uln = SColorMark;
|
||||
else
|
||||
if(t < 32 * 24 * 3600)
|
||||
uln = SColorDisabled;
|
||||
}
|
||||
}
|
||||
filelist.Add(f, IdeFileImage(f, f.optimize_speed), ListFont(), SColorText, false, 0,
|
||||
Null, SColorMark);
|
||||
Null, SColorMark, Null, Null, Null, uln);
|
||||
fileindex.Add(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void WorkspaceWork::TouchFile(const String& path)
|
||||
{
|
||||
if(!showtime)
|
||||
return;
|
||||
Time tm = GetSysTime();
|
||||
for(int i = 0; i < filelist.GetCount(); i++) {
|
||||
FileList::File f = filelist[i];
|
||||
if(path == SourcePath(GetActivePackage(), f.name))
|
||||
filelist.Set(i, f.name, f.icon, f.font, f.ink, false, 0,
|
||||
Null, SColorMark, Null, Null, Null, SColorMark);
|
||||
}
|
||||
}
|
||||
|
||||
void WorkspaceWork::PackageCursor()
|
||||
{
|
||||
actualpackage = GetActivePackage();
|
||||
|
|
@ -644,6 +670,7 @@ WorkspaceWork::WorkspaceWork()
|
|||
organizer = false;
|
||||
package.BackPaintHint();
|
||||
filelist.BackPaintHint();
|
||||
showtime = false;
|
||||
}
|
||||
|
||||
void WorkspaceWork::SerializeClosed(Stream& s)
|
||||
|
|
|
|||
|
|
@ -631,6 +631,7 @@ void Ide::AddHistory()
|
|||
Bookmark& b = history.Top();
|
||||
b.file = editfile;
|
||||
b.pos = editor.GetEditPos();
|
||||
TouchFile(editfile);
|
||||
}
|
||||
|
||||
void Ide::HistoryBk()
|
||||
|
|
@ -657,67 +658,9 @@ void Ide::Display() {
|
|||
display.SetLabel(Format("Ln %d, Col %d", p.y + 1, p.x + 1));
|
||||
}
|
||||
|
||||
void Ide::ExportProject() {
|
||||
FlushFile();
|
||||
FileSel fsel;
|
||||
if(!fsel.ExecuteSelectDir("Export folder"))
|
||||
return;
|
||||
String outpath = ~fsel;
|
||||
::Workspace wspc;
|
||||
wspc.Scan(main);
|
||||
console.Clear();
|
||||
int p;
|
||||
int total = wspc.GetCount();
|
||||
for(p = 0; p < wspc.GetCount(); p++)
|
||||
total += wspc.GetPackage(p).file.GetCount();
|
||||
Progress progress("Exporting file %d", total);
|
||||
for(p = 0; p < wspc.GetCount(); p++)
|
||||
{
|
||||
if(progress.StepCanceled())
|
||||
{
|
||||
console << "(canceled)\n";
|
||||
break;
|
||||
}
|
||||
String packname = NativePath(wspc[p]);
|
||||
String packupp = AppendFileName(packname, AppendExt(GetFileNamePos(packname), ".upp"));
|
||||
const Package& pkg = wspc.GetPackage(p);
|
||||
String packout = AppendFileName(outpath, packupp);
|
||||
console << NFormat("%s, %d file(s)\n", packname, pkg.file.GetCount());
|
||||
RealizePath(packout);
|
||||
if(!pkg.Save(packout))
|
||||
{
|
||||
console << NFormat("Error saving UPP file '%s' into '%s'\n", packname, packout);
|
||||
return;
|
||||
}
|
||||
for(int f = 0; f < pkg.file.GetCount(); f++)
|
||||
{
|
||||
if(progress.StepCanceled())
|
||||
{
|
||||
console << "(canceled)\n";
|
||||
return;
|
||||
}
|
||||
if(!pkg.file[f].separator)
|
||||
{
|
||||
String pkgfile = AppendFileName(packname, pkg.file[f]);
|
||||
String srcfile = SourcePath(packname, pkg.file[f]);
|
||||
String dstfile = AppendFileName(outpath, pkgfile);
|
||||
RealizePath(dstfile);
|
||||
if(!FileExists(srcfile))
|
||||
console << NFormat("%s: file not found\n", srcfile);
|
||||
else if(!FileCopy(srcfile, dstfile))
|
||||
{
|
||||
console << NFormat("%s: error saving '%s'\n", srcfile, dstfile);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
console << "Done\n";
|
||||
}
|
||||
|
||||
void Ide::SerializeWorkspace(Stream& s) {
|
||||
int i;
|
||||
int version = 7;
|
||||
int version = 8;
|
||||
s / version;
|
||||
s.Magic(0x12345);
|
||||
if(s.IsStoring()) {
|
||||
|
|
@ -777,6 +720,10 @@ void Ide::SerializeWorkspace(Stream& s) {
|
|||
s / v;
|
||||
}
|
||||
}
|
||||
if(version >= 8) {
|
||||
s % export_usedonly;
|
||||
s % export_name;
|
||||
}
|
||||
SerializeFindInFiles(s);
|
||||
String om;
|
||||
s % om;
|
||||
|
|
|
|||
|
|
@ -409,7 +409,7 @@ struct AssistEditor : CodeEditor {
|
|||
String IdBack(int& qq);
|
||||
|
||||
void SwapSContext(Parser& p);
|
||||
|
||||
|
||||
void CreateIndex();
|
||||
|
||||
void SyncIndex();
|
||||
|
|
@ -420,7 +420,7 @@ struct AssistEditor : CodeEditor {
|
|||
bool IndexKey(dword key);
|
||||
bool IsIndex();
|
||||
void ShowIndex(bool b);
|
||||
|
||||
|
||||
void SerializeIndex(Stream& s);
|
||||
|
||||
typedef AssistEditor CLASSNAME;
|
||||
|
|
@ -428,6 +428,9 @@ struct AssistEditor : CodeEditor {
|
|||
AssistEditor();
|
||||
};
|
||||
|
||||
void DirSel(EditField& f, FrameRight<Button>& b);
|
||||
bool CopyFolder(const char *dst, const char *src, Progress *pi);
|
||||
|
||||
struct Ide : public TopWindow, public WorkspaceWork, public IdeContext {
|
||||
public:
|
||||
virtual void Paint(Draw& w);
|
||||
|
|
@ -702,6 +705,10 @@ public:
|
|||
|
||||
int state_icon;
|
||||
|
||||
String export_name;
|
||||
String export_outdir;
|
||||
bool export_usedonly;
|
||||
|
||||
// ------------------------------------
|
||||
|
||||
void BeepMuteExclamation() { if(!mute_sounds) BeepExclamation(); }
|
||||
|
|
@ -845,7 +852,7 @@ public:
|
|||
void PackageClean();
|
||||
void RebuildAll();
|
||||
void CreateMakefile();
|
||||
void SaveMakeFile(const String& file);
|
||||
void SaveMakeFile(const String& file, bool exporting = false);
|
||||
void CleanUppOut();
|
||||
void SwitchHeader();
|
||||
void FileCompile();
|
||||
|
|
|
|||
|
|
@ -390,28 +390,29 @@ LAYOUT(SetupHlLayout, 544, 280)
|
|||
END_LAYOUT
|
||||
|
||||
LAYOUT(SetupEditorLayout, 488, 280)
|
||||
ITEM(Label, dv___0, SetLabel(t_("Tab size")).LeftPosZ(12, 44).TopPosZ(12, 19))
|
||||
ITEM(EditIntSpin, tabsize, LeftPosZ(112, 52).TopPosZ(12, 19))
|
||||
ITEM(Label, dv___2, SetLabel(t_("Indent")).LeftPosZ(12, 36).TopPosZ(36, 19))
|
||||
ITEM(EditIntSpin, indent_amount, LeftPosZ(112, 52).TopPosZ(36, 19))
|
||||
ITEM(Label, dv___4, SetLabel(t_("Paint line at column")).LeftPosZ(12, 96).TopPosZ(60, 19))
|
||||
ITEM(EditIntSpin, bordercolumn, Min(0).LeftPosZ(112, 48).TopPosZ(60, 19))
|
||||
ITEM(ColorPusher, bordercolor, LeftPosZ(164, 52).TopPosZ(60, 20))
|
||||
ITEM(Label, dv___7, SetLabel(t_("Default charset")).LeftPosZ(12, 76).TopPosZ(84, 20))
|
||||
ITEM(DropList, charset, LeftPosZ(112, 104).TopPosZ(84, 19))
|
||||
ITEM(Option, showtabs, SetLabel(t_("Show tabs")).LeftPosZ(12, 72).TopPosZ(116, 18))
|
||||
ITEM(Option, indent_spaces, SetLabel(t_("Indent using spaces")).LeftPosZ(12, 118).TopPosZ(136, 18))
|
||||
ITEM(Option, no_parenthesis_indent, SetLabel(t_("No indent after parenthesis")).LeftPosZ(12, 148).TopPosZ(156, 18))
|
||||
ITEM(Option, numbers, SetLabel(t_("Show line numbers")).LeftPosZ(12, 112).TopPosZ(176, 18))
|
||||
ITEM(Option, bookmark_pos, SetLabel(t_("Bookmarks restore position")).LeftPosZ(12, 152).TopPosZ(196, 18))
|
||||
ITEM(Option, filetabs, SetLabel(t_("File tabs")).LeftPosZ(12, 64).TopPosZ(216, 18))
|
||||
ITEM(Option, tabs_icons, SetLabel(t_("Icons")).LeftPosZ(80, 48).TopPosZ(216, 18))
|
||||
ITEM(Option, tabs_crosses, SetLabel(t_("Crosses")).LeftPosZ(132, 60).TopPosZ(216, 18))
|
||||
ITEM(Option, tabs_grouping, SetLabel(t_("Grouping")).LeftPosZ(196, 64).TopPosZ(216, 18))
|
||||
ITEM(Switch, insert_include, SetLabel(t_("No #include in new sources\n#include first\n#include previous")).LeftPosZ(316, 156).TopPosZ(32, 56))
|
||||
ITEM(Option, header_guards, SetLabel(t_("Insert guards to new headers")).LeftPosZ(316, 164).TopPosZ(12, 15))
|
||||
ITEM(Option, auto_enclose, SetLabel(t_("[ { ( \" / * enclose selection")).LeftPosZ(12, 168).TopPosZ(236, 15))
|
||||
ITEM(Option, mark_lines, SetLabel(t_("Mark lines with errors, warning and changes")).LeftPosZ(12, 256).TopPosZ(256, 15))
|
||||
ITEM(Label, dv___0, SetLabel(t_("Tab size")).LeftPosZ(12, 44).TopPosZ(4, 19))
|
||||
ITEM(EditIntSpin, tabsize, LeftPosZ(112, 52).TopPosZ(4, 19))
|
||||
ITEM(Label, dv___2, SetLabel(t_("Indent")).LeftPosZ(12, 36).TopPosZ(28, 19))
|
||||
ITEM(EditIntSpin, indent_amount, LeftPosZ(112, 52).TopPosZ(28, 19))
|
||||
ITEM(Label, dv___4, SetLabel(t_("Paint line at column")).LeftPosZ(12, 96).TopPosZ(52, 19))
|
||||
ITEM(EditIntSpin, bordercolumn, Min(0).LeftPosZ(112, 48).TopPosZ(52, 19))
|
||||
ITEM(ColorPusher, bordercolor, LeftPosZ(164, 52).TopPosZ(52, 20))
|
||||
ITEM(Label, dv___7, SetLabel(t_("Default charset")).LeftPosZ(12, 76).TopPosZ(76, 20))
|
||||
ITEM(DropList, charset, LeftPosZ(112, 104).TopPosZ(76, 19))
|
||||
ITEM(Option, showtabs, SetLabel(t_("Show tabs")).LeftPosZ(12, 72).TopPosZ(100, 18))
|
||||
ITEM(Option, indent_spaces, SetLabel(t_("Indent using spaces")).LeftPosZ(12, 118).TopPosZ(120, 18))
|
||||
ITEM(Option, no_parenthesis_indent, SetLabel(t_("No indent after parenthesis")).LeftPosZ(12, 148).TopPosZ(140, 18))
|
||||
ITEM(Option, numbers, SetLabel(t_("Show line numbers")).LeftPosZ(12, 112).TopPosZ(160, 18))
|
||||
ITEM(Option, bookmark_pos, SetLabel(t_("Bookmarks restore position")).LeftPosZ(12, 152).TopPosZ(180, 18))
|
||||
ITEM(Option, filetabs, SetLabel(t_("File tabs")).LeftPosZ(12, 64).TopPosZ(200, 18))
|
||||
ITEM(Option, tabs_icons, SetLabel(t_("Icons")).LeftPosZ(80, 48).TopPosZ(200, 18))
|
||||
ITEM(Option, tabs_crosses, SetLabel(t_("Crosses")).LeftPosZ(132, 60).TopPosZ(200, 18))
|
||||
ITEM(Option, tabs_grouping, SetLabel(t_("Grouping")).LeftPosZ(196, 64).TopPosZ(200, 18))
|
||||
ITEM(Switch, insert_include, SetLabel(t_("No #include in new sources\n#include first\n#include previous")).LeftPosZ(316, 156).TopPosZ(24, 56))
|
||||
ITEM(Option, header_guards, SetLabel(t_("Insert guards to new headers")).LeftPosZ(316, 164).TopPosZ(4, 15))
|
||||
ITEM(Option, auto_enclose, SetLabel(t_("[ { ( \" / * enclose selection")).LeftPosZ(12, 168).TopPosZ(220, 15))
|
||||
ITEM(Option, mark_lines, SetLabel(t_("Mark lines with errors, warning and changes")).LeftPosZ(12, 256).TopPosZ(240, 16))
|
||||
ITEM(Option, showtime, SetLabel(t_("Underline recently changed files")).LeftPosZ(12, 256).TopPosZ(260, 16))
|
||||
END_LAYOUT
|
||||
|
||||
LAYOUT(SetupIdeLayout, 520, 264)
|
||||
|
|
@ -531,3 +532,13 @@ LAYOUT(TppLayout, 148, 284)
|
|||
ITEM(Button, ok, SetLabel(t_("OK")).LeftPosZ(8, 64).TopPosZ(252, 24))
|
||||
ITEM(Button, cancel, SetLabel(t_("Cancel")).LeftPosZ(76, 64).TopPosZ(252, 24))
|
||||
END_LAYOUT
|
||||
|
||||
LAYOUT(ExportLayout, 400, 116)
|
||||
ITEM(Label, dv___0, SetLabel(t_("Output directory")).LeftPosZ(8, 92).TopPosZ(8, 19))
|
||||
ITEM(EditString, outdir, LeftPosZ(104, 288).TopPosZ(8, 19))
|
||||
ITEM(Label, dv___2, SetLabel(t_("Folder name")).LeftPosZ(8, 92).TopPosZ(32, 19))
|
||||
ITEM(EditString, name, LeftPosZ(104, 128).TopPosZ(32, 19))
|
||||
ITEM(Option, usedonly, SetLabel(t_("Export only files used in compilation")).LeftPosZ(104, 288).TopPosZ(56, 16))
|
||||
ITEM(Button, ok, SetLabel(t_("OK")).LeftPosZ(260, 64).TopPosZ(84, 24))
|
||||
ITEM(Button, cancel, SetLabel(t_("Cancel")).LeftPosZ(328, 64).TopPosZ(84, 24))
|
||||
END_LAYOUT
|
||||
|
|
|
|||
|
|
@ -59,11 +59,14 @@ file
|
|||
Build.cpp,
|
||||
Debug.cpp,
|
||||
Valgrind.cpp,
|
||||
Export.cpp,
|
||||
Resources readonly separator,
|
||||
ide.iml,
|
||||
ide.lay,
|
||||
app.tpp,
|
||||
ide.rc,
|
||||
ide.rc
|
||||
depends() xide.ico
|
||||
depends() ide.ico,
|
||||
Makefile,
|
||||
Info readonly separator,
|
||||
COPYING,
|
||||
|
|
@ -79,4 +82,3 @@ mainconfig
|
|||
custom() "",
|
||||
"",
|
||||
"$(OUTDIR)/$(FILE).obj";
|
||||
|
||||
|
|
|
|||
|
|
@ -303,6 +303,8 @@ void Ide::Project(Bar& menu) {
|
|||
if(OldLang())
|
||||
menu.Add("Convert s_ -> t_", THISBACK(ConvertST));
|
||||
FilePropertiesMenu(menu);
|
||||
menu.Separator();
|
||||
menu.Add("Export project..", THISBACK(ExportProject));
|
||||
}
|
||||
|
||||
void Ide::FilePropertiesMenu(Bar& menu)
|
||||
|
|
|
|||
|
|
@ -232,7 +232,10 @@ void Ide::SaveFile(bool always)
|
|||
{
|
||||
if(designer) {
|
||||
String fn = designer->GetFileName();
|
||||
Time tm = FileGetTime(fn);
|
||||
designer->Save();
|
||||
if(tm != FileGetTime(fn))
|
||||
TouchFile(fn);
|
||||
if(IsProjectFile(fn) && ToUpper(GetFileExt(fn)) == ".LAY")
|
||||
BrowserBaseScanLay(fn);
|
||||
return;
|
||||
|
|
@ -250,6 +253,7 @@ void Ide::SaveFile(bool always)
|
|||
if(!editor.IsDirty() && !always)
|
||||
return;
|
||||
|
||||
TouchFile(editfile);
|
||||
String tmpfile = editfile + ".$tmp", outfile = editfile;
|
||||
{
|
||||
FileOut out(tmpfile);
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ void Ide::ConsolePaste()
|
|||
}
|
||||
|
||||
void Ide::Serialize(Stream& s) {
|
||||
int version = 9;
|
||||
int version = 11;
|
||||
s.Magic(0x12346);
|
||||
s / version;
|
||||
s % main;
|
||||
|
|
@ -179,6 +179,10 @@ void Ide::Serialize(Stream& s) {
|
|||
s % LinuxHostConsole;
|
||||
if(version >= 9)
|
||||
editor.SerializeIndex(s);
|
||||
if(version >= 10)
|
||||
s % showtime;
|
||||
if(version >= 11)
|
||||
s % export_outdir;
|
||||
s.Magic();
|
||||
}
|
||||
|
||||
|
|
@ -604,6 +608,11 @@ Ide::Ide()
|
|||
histi = 0;
|
||||
|
||||
doc_serial = -1;
|
||||
|
||||
showtime = true;
|
||||
|
||||
export_outdir = GetHomeDirFile("export++");
|
||||
export_usedonly = true;
|
||||
}
|
||||
|
||||
Ide::~Ide()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue