Fixed FindFile pattern problem, X11 primary clipboard problem

git-svn-id: svn://ultimatepp.org/upp/trunk@450 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2008-09-16 10:32:21 +00:00
parent f15858c860
commit fb1f2841fd
4 changed files with 24 additions and 4 deletions

View file

@ -397,6 +397,7 @@ FindFile::FindFile(const char *name) {
}
bool FindFile::Search(const char *name) {
pattern = GetFileName(name);
Close();
if(w)
handle = UnicodeWin32().FindFirstFileW(ToSystemCharsetW(name), w);
@ -410,7 +411,7 @@ void FindFile::Close() {
handle = INVALID_HANDLE_VALUE;
}
bool FindFile::Next() {
bool FindFile::Next0() {
if(w) {
if(!UnicodeWin32().FindNextFileW(handle, w)) {
Close();
@ -426,6 +427,16 @@ bool FindFile::Next() {
return true;
}
bool FindFile::Next()
{
for(;;) {
if(!Next0())
return false;
if(PatternMatch(pattern, GetName()))
return true;
}
}
dword FindFile::GetAttributes() const
{
return w ? w->dwFileAttributes : a->dwFileAttributes;

View file

@ -62,8 +62,10 @@ class FindFile {
WIN32_FIND_DATA *a;
WIN32_FIND_DATAW *w;
HANDLE handle;
String pattern;
void Init();
void Init();
bool Next0();
public:
bool Search(const char *name);

View file

@ -77,7 +77,7 @@ void Ctrl::Xclipboard::Request(XSelectionRequestEvent *se)
LLOG("Request PRIMARY data " << XAtomName(se->target));
String fmt = XAtomName(se->target);
int i = sel_formats.Find(fmt);
if(i >= 0) {
if(i >= 0 && sel_ctrl) {
String d = sel_ctrl->GetSelectionData(fmt);
XChangeProperty(Xdisplay, se->requestor, se->property, se->target, 8, PropModeReplace,
d, d.GetLength());

View file

@ -135,6 +135,7 @@ void TopicCtrl::ScanDirForTpp(const char *dir, Index<String>& li, Vector<int>& s
VectorMap<String, VectorMap<String, Vector<String> > >& map,
const String& rel)
{
DLOG("a");
TopicLink tl;
for(FindFile pff(AppendFileName(dir, "*.*")); pff; pff.Next()) {
if(pff.IsFolder() && *pff.GetName() != '.') {
@ -144,6 +145,7 @@ void TopicCtrl::ScanDirForTpp(const char *dir, Index<String>& li, Vector<int>& s
if(ff.IsFolder()) {
tl.group = GetFileTitle(ff.GetName());
String dir = AppendFileName(pdir, ff.GetName());
DDUMP(dir);
for(FindFile ft(AppendFileName(dir, "*.tpp")); ft; ft.Next())
if(ft.IsFile()) {
tl.topic = GetFileTitle(ft.GetName());
@ -154,15 +156,18 @@ void TopicCtrl::ScanDirForTpp(const char *dir, Index<String>& li, Vector<int>& s
li.FindAdd(l);
}
String link = TopicLinkString(tl);
DDUMP(ft.GetName());
DDUMP(link);
if(idelink.Find(link) < 0 && MatchTopicLink(link, sdx) &&
(lng == "All" || lng == l)) {
map.GetAdd(tl.package).GetAdd(tl.group).Add(tl.topic);
map.GetAdd(tl.package).GetAdd(tl.group).GetAdd(tl.topic);
}
}
}
ScanDirForTpp(pdir, li, sdx, lng, map, tl.package + '/');
}
}
DLOG("b");
}
void TopicCtrl::SyncDocTree()
@ -226,6 +231,8 @@ void TopicCtrl::SyncDocTree()
for(int i = 0; i < group.GetCount(); i++) {
tl.topic = group[i];
String p = TopicLinkString(tl);
DUMP(tl.package);
DUMP(p);
String t = GetTopicTitle(p);
AddTree(gid, TopicImg::Topic(), p, t);
}