ultimatepp/uppsrc/ide/Browser/TopicI.cpp
cxl 3dc71df9f4 ide: Individual .tpp file designer
git-svn-id: svn://ultimatepp.org/upp/trunk@11293 f0d560ea-af0d-0410-9eb7-867de7ffcac7
2017-08-06 08:31:03 +00:00

42 lines
No EOL
1.1 KiB
C++

#include "Browser.h"
bool IsTopicFile(const char *path)
{
return ToLower(GetFileExt(path)) == ".tpp" && FileExists(path);
}
bool IsTopicGroup(const char *path)
{
return ToLower(GetFileExt(path)) == ".tpp" && (!IsFullPath(path) || !FileExists(path));
}
struct TopicModule : public IdeModule {
virtual String GetID() { return "TopicModule"; }
virtual Image FileIcon(const char *path) {
return IsTopicFile(path) ? TopicImg::Topic() : IsTopicGroup(path) ? TopicImg::Group() : Null;
}
virtual IdeDesigner *CreateDesigner(const char *path, byte cs) {
if(IsTopicGroup(path)) {
TopicEditor *d = new TopicEditor;
d->PersistentFindReplace(TheIde()->IsPersistentFindReplace());
d->Open(path);
return d;
}
if(IsTopicFile(path)) {
TopicEditor *d = new TopicEditor;
d->PersistentFindReplace(TheIde()->IsPersistentFindReplace());
d->OpenFile(path);
return d;
}
return NULL;
}
virtual void Serialize(Stream& s) {
TopicEditor::SerializeEditPos(s);
}
};
void InitializeTopicModule()
{
RegisterIdeModule(Single<TopicModule>());
}