*Controls4U: Some fixes in EditFileFolder

git-svn-id: svn://ultimatepp.org/upp/trunk@5943 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
koldo 2013-04-01 15:52:51 +00:00
commit cb51856805
3 changed files with 28 additions and 21 deletions

View file

@ -115,8 +115,9 @@ void EditFileFolder::DoBrowse() {
if (DirectoryExists(s))
fs.PreSelect(s);
else {
if (GetFileFolder(s).IsEmpty())
s = AppendFileName(fs.GetActiveDir(), s);
String folder = GetFileFolder(s);
if (folder.IsEmpty() || folder.Find("..") >= 0 || !DirectoryExists(folder))
s = AppendFileName(NormalizePath(folder, fs.GetActiveDir()), GetFileName(s));
fs.PreSelect(s);
}
}
@ -140,7 +141,7 @@ void EditFileFolder::SetData(const Value& data) {
void EditFileFolder::DoGo(bool add) {
Set(GetData()); // Write Edit to FileSel
if (UpperFolder(GetData().ToString()))
if (IsRootFolder(GetData().ToString()))
butUp.Enable(true);
else
butUp.Enable(false);

View file

@ -38,21 +38,21 @@ public:
void DoLeft(), DoRight(), DoUp();
void DoBrowse();
void DoGo(bool add = true);
void Type(const char *name, const char *ext) {InitFs(); pfs->Type(name, ext);};
void AllFilesType() {InitFs(); pfs->AllFilesType();};
void ActiveDir(const String& d) {InitFs(); pfs->ActiveDir(d);};
void MkDirOption(bool b) {InitFs(); pfs->MkDirOption(b);};
String Get() const {return GetData();};
String operator~() const {return Get();};
operator String() const {return Get();};
operator const char *() const {return Get();};
void Set(const String& s) {InitFs(); pfs->Set(s); EditString::SetData(s);};
void operator<<=(const String& s) {Set(s);};
void operator=(const String& s) {Set(s);};
bool IsEmpty() {return GetData().IsNull();};
EditFileFolder &NotNull(bool b) {EditString::NotNull(b); return *this;};
EditFileFolder &SelLoad(bool load) {isLoad = load; return *this;};
EditFileFolder &SetTitle(const char *_title) {title = _title; return *this;};
void Type(const char *name, const char *ext) {InitFs(); pfs->Type(name, ext);}
void AllFilesType() {InitFs(); pfs->AllFilesType();}
void ActiveDir(const String& d) {InitFs(); pfs->ActiveDir(d);}
void MkDirOption(bool b) {InitFs(); pfs->MkDirOption(b);}
String Get() const {return GetData();}
operator const char *() const {return Get();}
const char *operator~() const {return Get();}
void Set(const String& s) {InitFs(); pfs->Set(s); EditString::SetData(s);}
void operator<<=(const String& s) {Set(s);}
EditFileFolder &operator=(const char *s) {Set(s); return *this;}
EditFileFolder &operator=(const String& s) {Set(s); return *this;}
bool IsEmpty() {return GetData().IsNull();}
EditFileFolder &NotNull(bool b) {EditString::NotNull(b); return *this;}
EditFileFolder &SelLoad(bool load) {isLoad = load; return *this;}
EditFileFolder &SetTitle(const char *_title) {title = _title; return *this;}
EditFileFolder &UseHistory(bool use);
EditFileFolder &UseUp(bool use);
EditFileFolder &UseBrowse(bool use);
@ -65,12 +65,14 @@ class EditFile : public EditFileFolder {
typedef EditFile CLASSNAME;
public:
EditFile();
using EditFileFolder::operator=;
};
class EditFolder : public EditFileFolder {
typedef EditFolder CLASSNAME;
public:
EditFolder();
using EditFileFolder::operator=;
};
class StaticImage : public Ctrl {

View file

@ -4,6 +4,7 @@ fn atan_base(z) {
return z - z*z*z/3 + z*z*z*z*z/5 - z*z*z*z*z*z*z/7 + z*z*z*z*z*z*z*z*z/9
- z*z*z*z*z*z*z*z*z*z*z/11 + z*z*z*z*z*z*z*z*z*z*z*z*z/13;
}
fn atan(z) {
if (z*z < 1)
return atan_base(z);
@ -12,9 +13,11 @@ fn atan(z) {
else
return 3*Pi()/2 - atan_base(1/z);
}
fn Pi() {
return 3.14159265358979323846;
}
fn ToRad(angle) {
if (angle > 0)
return angle*Pi()/180;
@ -40,6 +43,7 @@ fn PaintRect(w, left, top, right, bottom, width, color)
w.DrawLine(right, bottom, left, bottom, width, color);
w.DrawLine(left, bottom, left, top, width, color);
}
fn PaintEllipse(w, left, top, right, bottom, width, color)
{
if (width < 1)
@ -255,11 +259,11 @@ ctrl StaticImage {
w.DrawImage(r.left+(sz.cx-imageaspect*sz.cy)/2, r.top, imageaspect*sz.cy, sz.cy, img);
else
w.DrawImage(r.left, r.top+(sz.cy-sz.cx/imageaspect)/2, sz.cx, sz.cx/imageaspect, img);
} else if (.SetFit == "1") {
} else if (.SetFit == "1")
w.DrawImage(r.left, r.top, sz.cx, sz.cy, img);
} else if (.SetFit == "2") {
else if (.SetFit == "2")
w.DrawImage(r.left, r.top, img);
} else if (.SetFit == "3") {
else if (.SetFit == "3") {
imagesize = GetImageSize(img);
top = r.top;
for (left = r.left; left < r.right; left += imagesize.cx)