mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-08-25 14:22:54 -06:00
Syncing uppdev
git-svn-id: svn://ultimatepp.org/upp/trunk@1174 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
ffb79be3a9
commit
5855949de4
11 changed files with 279 additions and 1 deletions
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
using namespace Upp;
|
||||
|
||||
#define TEST
|
||||
|
||||
CONSOLE_APP_MAIN
|
||||
{
|
||||
Any alpha;
|
||||
|
|
|
|||
9
uppdev/CodeIndex/CodeIndex.upp
Normal file
9
uppdev/CodeIndex/CodeIndex.upp
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
uses
|
||||
CtrlLib,
|
||||
CodeEditor;
|
||||
|
||||
file
|
||||
main.cpp;
|
||||
|
||||
mainconfig
|
||||
"" = "GUI";
|
||||
145
uppdev/CodeIndex/main.cpp
Normal file
145
uppdev/CodeIndex/main.cpp
Normal file
|
|
@ -0,0 +1,145 @@
|
|||
#include <CodeEditor/CodeEditor.h>
|
||||
|
||||
using namespace Upp;
|
||||
|
||||
struct CodeIndex : public TopWindow {
|
||||
virtual bool Key(dword key, int count);
|
||||
|
||||
FileList files;
|
||||
CodeEditor view;
|
||||
ToolBar toolbar;
|
||||
Splitter split;
|
||||
EditString search;
|
||||
|
||||
Index<String> exts;
|
||||
Index<String> file;
|
||||
VectorMap<String, Vector<int> > index;
|
||||
|
||||
void ScanFile(const String& f);
|
||||
void Scan(const String& dir, Progress& pi, int64& amount);
|
||||
void Scan();
|
||||
void Serialize(Stream& s);
|
||||
void ToolBar(Bar& bar);
|
||||
void File();
|
||||
|
||||
public:
|
||||
typedef CodeIndex CLASSNAME;
|
||||
|
||||
CodeIndex();
|
||||
};
|
||||
|
||||
void CodeIndex::ScanFile(const String& fn) {
|
||||
DUMP(fn);
|
||||
int fi = file.GetCount();
|
||||
file.Add(fn);
|
||||
String f = LoadFile(fn);
|
||||
const char *q = f;
|
||||
for(;;) {
|
||||
int c = *q;
|
||||
if(IsAlpha(c) || c == '_') {
|
||||
const char *b = q++;
|
||||
while(IsAlNum(*q) || *q == '_') q++;
|
||||
Vector<int>& mf = index.GetAdd(String(b, q));
|
||||
if(mf.GetCount() == 0 || mf.Top() != fi)
|
||||
mf.Add(fi);
|
||||
}
|
||||
else {
|
||||
if(!c) break;
|
||||
q++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int NoP(int c)
|
||||
{
|
||||
return c == '%' ? 0 : c;
|
||||
}
|
||||
|
||||
void CodeIndex::Scan(const String& dir, Progress& pi, int64& amount)
|
||||
{
|
||||
FindFile ff(AppendFileName(dir, "*.*"));
|
||||
while(ff) {
|
||||
String p = AppendFileName(dir, ff.GetName());
|
||||
if(ff.IsFile()) {
|
||||
String ext = ToUpper(GetFileExt(ff.GetName()));
|
||||
if(pi.StepCanceled())
|
||||
throw Exc();
|
||||
if(ext.GetCount() && exts.Find(ext.Mid(1)) >= 0)
|
||||
ScanFile(p);
|
||||
amount += ff.GetLength();
|
||||
}
|
||||
if(ff.IsFolder()) {
|
||||
pi.SetText(AsString(amount >> 20) + " MB: " + Filter(p, NoP));
|
||||
Scan(p, pi, amount);
|
||||
}
|
||||
ff.Next();
|
||||
}
|
||||
}
|
||||
|
||||
void CodeIndex::Scan()
|
||||
{
|
||||
try {
|
||||
Progress pi;
|
||||
int64 amount = 0;
|
||||
pi.AlignText(ALIGN_LEFT);
|
||||
Scan("f:/exsrc", pi, amount);
|
||||
}
|
||||
catch(Exc) {}
|
||||
}
|
||||
|
||||
void CodeIndex::ToolBar(Bar& bar)
|
||||
{
|
||||
bar.Add(search, INT_MAX);
|
||||
}
|
||||
|
||||
bool CodeIndex::Key(dword key, int count)
|
||||
{
|
||||
if(key == K_ENTER) {
|
||||
files.Clear();
|
||||
int q = index.Find(~search);
|
||||
if(q >= 0) {
|
||||
Vector<int>& f = index[q];
|
||||
for(int i = 0; i < f.GetCount(); i++)
|
||||
files.Add(file[f[i]]);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void CodeIndex::File()
|
||||
{
|
||||
view.Clear();
|
||||
if(files.IsCursor())
|
||||
view <<= LoadFile(files.GetCurrentName());
|
||||
}
|
||||
|
||||
CodeIndex::CodeIndex()
|
||||
{
|
||||
Add(split.Horz(files, view));
|
||||
split.SetPos(2000);
|
||||
files.AddFrame(toolbar);
|
||||
view.SetReadOnly();
|
||||
toolbar.Set(THISBACK(ToolBar));
|
||||
exts = Split("C;CPP;H;HPP", ';');
|
||||
files.WhenSel = THISBACK(File);
|
||||
}
|
||||
|
||||
void CodeIndex::Serialize(Stream& s)
|
||||
{
|
||||
s.Magic(0x76129812);
|
||||
s % file;
|
||||
s % index;
|
||||
}
|
||||
|
||||
GUI_APP_MAIN
|
||||
{
|
||||
CodeIndex app;
|
||||
LoadFromFile(app);
|
||||
if(app.index.GetCount() == 0)
|
||||
app.Scan();
|
||||
app.Run();
|
||||
StoreToFile(app);
|
||||
// Progress pi;
|
||||
// b.Scan("f:/exsrc", &pi);
|
||||
}
|
||||
28
uppdev/RSS/RSS.cpp
Normal file
28
uppdev/RSS/RSS.cpp
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
#include <Web/Web.h>
|
||||
|
||||
using namespace Upp;
|
||||
|
||||
CONSOLE_APP_MAIN
|
||||
{
|
||||
HttpClient client;
|
||||
client.URL("http://losangeles.craigslist.org/search/jjj?query=php&format=rss");
|
||||
String out = client.ExecuteRedirect();
|
||||
XmlNode n = ParseXML(out, 0);
|
||||
int q = n.FindTag("rdf:RDF");
|
||||
if(q >= 0) {
|
||||
const XmlNode& channel = n[q];
|
||||
for(int i = channel.FindTag("item"); i<channel.GetCount(); i++) {
|
||||
if(channel[i].GetTag() == "item") {
|
||||
const XmlNode &item=channel[i];
|
||||
int tag = item.FindTag("title");
|
||||
if(tag >= 0) {
|
||||
const XmlNode& title = item[tag];
|
||||
for(int j = 0; j < title.GetCount(); j++) {
|
||||
DUMP(title[j].GetType());
|
||||
DUMP(title[j].GetText());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
10
uppdev/RSS/RSS.upp
Normal file
10
uppdev/RSS/RSS.upp
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
uses
|
||||
Core,
|
||||
Web;
|
||||
|
||||
file
|
||||
RSS.cpp;
|
||||
|
||||
mainconfig
|
||||
"" = "";
|
||||
|
||||
5
uppdev/RSS/init
Normal file
5
uppdev/RSS/init
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
#ifndef _RSS_icpp_init_stub
|
||||
#define _RSS_icpp_init_stub
|
||||
#include "Core/init"
|
||||
#include "Web/init"
|
||||
#endif
|
||||
10
uppdev/TestLag/TestLag.upp
Normal file
10
uppdev/TestLag/TestLag.upp
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
uses
|
||||
CtrlLib,
|
||||
CodeEditor;
|
||||
|
||||
file
|
||||
main.cpp;
|
||||
|
||||
mainconfig
|
||||
"" = "GUI";
|
||||
|
||||
5
uppdev/TestLag/init
Normal file
5
uppdev/TestLag/init
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
#ifndef _TestLag_icpp_init_stub
|
||||
#define _TestLag_icpp_init_stub
|
||||
#include "CtrlLib/init"
|
||||
#include "CodeEditor/init"
|
||||
#endif
|
||||
21
uppdev/TestLag/main.cpp
Normal file
21
uppdev/TestLag/main.cpp
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
#include <CodeEditor/CodeEditor.h>
|
||||
|
||||
using namespace Upp;
|
||||
|
||||
GUI_APP_MAIN {
|
||||
for(int i = 0; i < 10000; i++) {
|
||||
TIMING("Test");
|
||||
::IsClipboardFormatAvailable(CF_TEXT);
|
||||
}
|
||||
TopWindow win;
|
||||
CodeEditor cedit; //2nd test
|
||||
{
|
||||
LineEdit edit;
|
||||
win.Add(edit.SizePos());
|
||||
win.Run();
|
||||
cedit <<= ~edit;
|
||||
}
|
||||
cedit.Highlight(CodeEditor::HIGHLIGHT_CPP);
|
||||
win.Add(cedit.SizePos());
|
||||
win.Run();
|
||||
}
|
||||
|
|
@ -1,2 +1,3 @@
|
|||
#define LAYOUTFILE <aaa/aaa.lay>
|
||||
#include <CtrlCore/lay.h>
|
||||
kk
|
||||
|
|
@ -39,6 +39,48 @@ public:
|
|||
String x,
|
||||
String x,
|
||||
String x,
|
||||
String x, String x,
|
||||
String x,
|
||||
String x,
|
||||
String x,
|
||||
String x, String x,
|
||||
String x,
|
||||
String x,
|
||||
String x,xxxxxxxx
|
||||
String x,
|
||||
String x,
|
||||
String x,
|
||||
String x,
|
||||
String x,
|
||||
String x,
|
||||
String x, String x,
|
||||
String x,
|
||||
String x,
|
||||
String x,helloksjdfalsfj haskldjhf alsflhjdas flk hdasfjkahdshasjfdkljhashdfhasdfklhahdfklhasdfklhasdfkljhasd
|
||||
String x,
|
||||
String x,
|
||||
String x,
|
||||
String x,
|
||||
String x,
|
||||
String x,
|
||||
String x,
|
||||
String x,
|
||||
String x,
|
||||
String x,
|
||||
String x,
|
||||
String x,
|
||||
String x,
|
||||
String x,
|
||||
String x,
|
||||
String x,
|
||||
|
||||
String x,
|
||||
String x,
|
||||
String x,helloksjdfalsfj haskldjhf alsflhjdas flk hdasfjkahdshasjfdkljhashdfhasdfklhahdfklhasdfklhasdfkljhasd
|
||||
String x,
|
||||
String x,
|
||||
String x,
|
||||
String x,
|
||||
String x,
|
||||
String x,
|
||||
String x,
|
||||
|
|
@ -75,7 +117,7 @@ public:
|
|||
|
||||
#endif
|
||||
|
||||
|
||||
s
|
||||
|
||||
|
||||
počítač
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue