mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-22 06:05:33 -06:00
ide: Spellchecking comments
git-svn-id: svn://ultimatepp.org/upp/trunk@10384 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
68b953002b
commit
62d921fcb0
26 changed files with 443 additions and 320 deletions
|
|
@ -89,16 +89,23 @@ const wchar *HighlightNumber(HighlightOutput& hls, const wchar *p, bool ts, bool
|
||||||
|
|
||||||
const wchar *CSyntax::DoComment(HighlightOutput& hls, const wchar *p, const wchar *e)
|
const wchar *CSyntax::DoComment(HighlightOutput& hls, const wchar *p, const wchar *e)
|
||||||
{
|
{
|
||||||
String w;
|
WString w;
|
||||||
for(const wchar *s = p; s < e && IsAlpha(*s) && w.GetCount() < 5; s++)
|
for(const wchar *s = p; s < e && IsLetter(*s); s++)
|
||||||
w.Cat(ToUpper(*s));
|
w.Cat(ToUpper(*s));
|
||||||
int n = w.GetCount();
|
int n = w.GetCount();
|
||||||
if(findarg(w, "TODO", "FIXME") >= 0)
|
if(!n)
|
||||||
|
for(const wchar *s = p; s < e && !IsLetter(*s); s++)
|
||||||
|
n++;
|
||||||
|
word flags = 0;
|
||||||
|
if(n && comments_lang && !SpellWord(w, comments_lang))
|
||||||
|
flags = LineEdit::SPELLERROR;
|
||||||
|
hls.SetFlags(n, flags);
|
||||||
|
static WString todo = "TODO";
|
||||||
|
static WString fixme = "FIXME";
|
||||||
|
if(w.GetCount() >= 4 && w.GetCount() <= 5 && findarg(w, todo, fixme) >= 0)
|
||||||
hls.Put(n, hl_style[INK_COMMENT_WORD], hl_style[PAPER_COMMENT_WORD]);
|
hls.Put(n, hl_style[INK_COMMENT_WORD], hl_style[PAPER_COMMENT_WORD]);
|
||||||
else {
|
else
|
||||||
n = max(n, 1);
|
|
||||||
hls.Put(n, hl_style[INK_COMMENT]);
|
hls.Put(n, hl_style[INK_COMMENT]);
|
||||||
}
|
|
||||||
return p + n;
|
return p + n;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ protected:
|
||||||
|
|
||||||
static int InitUpp(const char **q);
|
static int InitUpp(const char **q);
|
||||||
static void InitKeywords();
|
static void InitKeywords();
|
||||||
static const wchar *DoComment(HighlightOutput& hls, const wchar *p, const wchar *e);
|
const wchar *DoComment(HighlightOutput& hls, const wchar *p, const wchar *e);
|
||||||
|
|
||||||
static Vector< Index<String> > keyword;
|
static Vector< Index<String> > keyword;
|
||||||
static Vector< Index<String> > name;
|
static Vector< Index<String> > name;
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@ One<EditorSyntax> CodeEditor::GetSyntax(int line)
|
||||||
{
|
{
|
||||||
CTIMING("GetSyntax");
|
CTIMING("GetSyntax");
|
||||||
One<EditorSyntax> syntax = EditorSyntax::Create(highlight);
|
One<EditorSyntax> syntax = EditorSyntax::Create(highlight);
|
||||||
|
syntax->SpellCheckComments(spellcheck_comments);
|
||||||
int ln = 0;
|
int ln = 0;
|
||||||
for(int i = 0; i < __countof(syntax_cache); i++)
|
for(int i = 0; i < __countof(syntax_cache); i++)
|
||||||
if(line >= syntax_cache[i].line && syntax_cache[i].line > 0) {
|
if(line >= syntax_cache[i].line && syntax_cache[i].line > 0) {
|
||||||
|
|
|
||||||
|
|
@ -274,6 +274,8 @@ protected:
|
||||||
|
|
||||||
String highlight;
|
String highlight;
|
||||||
|
|
||||||
|
int spellcheck_comments = 0;
|
||||||
|
|
||||||
struct Tip : Ctrl {
|
struct Tip : Ctrl {
|
||||||
Value v;
|
Value v;
|
||||||
const Display *d;
|
const Display *d;
|
||||||
|
|
@ -462,6 +464,9 @@ public:
|
||||||
void IndentAmount(int ia) { indent_amount = ia; }
|
void IndentAmount(int ia) { indent_amount = ia; }
|
||||||
void NoParenthesisIndent(bool b) { no_parenthesis_indent = b; }
|
void NoParenthesisIndent(bool b) { no_parenthesis_indent = b; }
|
||||||
|
|
||||||
|
void SpellcheckComments(int lang) { spellcheck_comments = lang; Refresh(); }
|
||||||
|
int GetSpellcheckComments() const { return spellcheck_comments; }
|
||||||
|
|
||||||
void NoFindReplace() { withfindreplace = false; }
|
void NoFindReplace() { withfindreplace = false; }
|
||||||
|
|
||||||
void LineNumbers(bool b) { bar.LineNumbers(b); }
|
void LineNumbers(bool b) { bar.LineNumbers(b); }
|
||||||
|
|
|
||||||
|
|
@ -59,6 +59,14 @@ void HighlightOutput::SetPaper(int pos, int count, Color paper)
|
||||||
v[pos++].paper = paper;
|
v[pos++].paper = paper;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void HighlightOutput::SetFlags(int pos, int count, word flags)
|
||||||
|
{
|
||||||
|
if(pos + count > v.GetCount())
|
||||||
|
v.At(pos + count - 1, def);
|
||||||
|
while(count-- > 0)
|
||||||
|
v[pos++].flags = flags;
|
||||||
|
}
|
||||||
|
|
||||||
void HighlightOutput::SetInk(int pos, int count, Color ink)
|
void HighlightOutput::SetInk(int pos, int count, Color ink)
|
||||||
{
|
{
|
||||||
if(pos + count > v.GetCount())
|
if(pos + count > v.GetCount())
|
||||||
|
|
|
||||||
|
|
@ -72,13 +72,16 @@ struct HighlightOutput : HighlightSetup {
|
||||||
public:
|
public:
|
||||||
void SetChar(int pos, int chr) { v[pos].chr = chr; }
|
void SetChar(int pos, int chr) { v[pos].chr = chr; }
|
||||||
void Set(int pos, int count, const HlStyle& ink);
|
void Set(int pos, int count, const HlStyle& ink);
|
||||||
|
void SetFlags(int pos, int count, word flags);
|
||||||
void SetFont(int pos, int count, const HlStyle& f);
|
void SetFont(int pos, int count, const HlStyle& f);
|
||||||
void SetPaper(int pos, int count, Color paper);
|
void SetPaper(int pos, int count, Color paper);
|
||||||
void SetInk(int pos, int count, Color ink);
|
void SetInk(int pos, int count, Color ink);
|
||||||
|
void SetFlags(int count, word flags) { SetFlags(pos, count, flags); }
|
||||||
void Put(int count, const HlStyle& ink) { Set(pos, count, ink); pos += count; }
|
void Put(int count, const HlStyle& ink) { Set(pos, count, ink); pos += count; }
|
||||||
void Put(int count, const HlStyle& ink, const HlStyle& paper);
|
void Put(int count, const HlStyle& ink, const HlStyle& paper);
|
||||||
void Put(const HlStyle& ink) { Put(1, ink); }
|
void Put(const HlStyle& ink) { Put(1, ink); }
|
||||||
void Put(const HlStyle& ink, word flags) { Put(1, ink); v[pos - 1].flags = flags; }
|
void Put(const HlStyle& ink, word flags) { Put(1, ink); v[pos - 1].flags = flags; }
|
||||||
|
void Flags(word flags) { v[pos - 1].flags = flags; }
|
||||||
int GetCount() const { return v.GetCount(); }
|
int GetCount() const { return v.GetCount(); }
|
||||||
|
|
||||||
const wchar *CString(const wchar *p);
|
const wchar *CString(const wchar *p);
|
||||||
|
|
@ -98,6 +101,7 @@ class EditorSyntax : public HighlightSetup { // Inheriting to make static member
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool ignore_errors;
|
bool ignore_errors;
|
||||||
|
int comments_lang;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual void Clear();
|
virtual void Clear();
|
||||||
|
|
@ -118,6 +122,7 @@ public:
|
||||||
String Get() { CTIMING("Get"); return StoreAsString(*this); }
|
String Get() { CTIMING("Get"); return StoreAsString(*this); }
|
||||||
|
|
||||||
void IgnoreErrors() { ignore_errors = true; }
|
void IgnoreErrors() { ignore_errors = true; }
|
||||||
|
void SpellCheckComments(int lang) { comments_lang = lang; }
|
||||||
|
|
||||||
EditorSyntax() { Clear(); ignore_errors = false; }
|
EditorSyntax() { Clear(); ignore_errors = false; }
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -179,6 +179,11 @@ String ConfigFile(const char *file) {
|
||||||
#endif//PLATFORM
|
#endif//PLATFORM
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String GetConfigFolder()
|
||||||
|
{
|
||||||
|
return GetFileFolder(ConfigFile("x"));
|
||||||
|
}
|
||||||
|
|
||||||
String ConfigFile() {
|
String ConfigFile() {
|
||||||
return ConfigFile(GetExeTitle() + ".cfg");
|
return ConfigFile(GetExeTitle() + ".cfg");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ void SetHomeDirectory(const char *dir);
|
||||||
|
|
||||||
void UseHomeDirectoryConfig(bool b = true);
|
void UseHomeDirectoryConfig(bool b = true);
|
||||||
|
|
||||||
|
String GetConfigFolder();
|
||||||
String ConfigFile(const char *file);
|
String ConfigFile(const char *file);
|
||||||
String ConfigFile();
|
String ConfigFile();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -83,6 +83,7 @@ file
|
||||||
Util.cpp,
|
Util.cpp,
|
||||||
mathutil.cpp,
|
mathutil.cpp,
|
||||||
Random.cpp,
|
Random.cpp,
|
||||||
|
Speller.cpp,
|
||||||
LocalProcess.h,
|
LocalProcess.h,
|
||||||
LocalProcess.cpp,
|
LocalProcess.cpp,
|
||||||
Containers readonly separator,
|
Containers readonly separator,
|
||||||
|
|
|
||||||
288
uppsrc/Core/Speller.cpp
Normal file
288
uppsrc/Core/Speller.cpp
Normal file
|
|
@ -0,0 +1,288 @@
|
||||||
|
#include "Core.h"
|
||||||
|
|
||||||
|
namespace Upp {
|
||||||
|
|
||||||
|
#define LLOG(x) // LOG(x)
|
||||||
|
|
||||||
|
struct SpellBlock : Moveable<SpellBlock> {
|
||||||
|
String first;
|
||||||
|
int offset;
|
||||||
|
int ctrl_len;
|
||||||
|
int text_len;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct Speller {
|
||||||
|
String data;
|
||||||
|
byte charset;
|
||||||
|
const char *voc[256];
|
||||||
|
int dict;
|
||||||
|
struct Line : Moveable<Line> {
|
||||||
|
const byte *begin;
|
||||||
|
const byte *end;
|
||||||
|
};
|
||||||
|
VectorMap<dword, Line> line;
|
||||||
|
Index<WString> user;
|
||||||
|
|
||||||
|
String path;
|
||||||
|
Array<SpellBlock> block;
|
||||||
|
|
||||||
|
bool SetOld(const String& data);
|
||||||
|
void Clear() { data.Clear(); path.Clear(); }
|
||||||
|
operator bool() const { return !data.IsEmpty() || path.GetCount(); }
|
||||||
|
bool CheckOld(const WString& wstr) const;
|
||||||
|
|
||||||
|
String Get(int offset, int len);
|
||||||
|
};
|
||||||
|
|
||||||
|
bool Speller::SetOld(const String& _data)
|
||||||
|
{
|
||||||
|
data = _data;
|
||||||
|
const char *s = data;
|
||||||
|
if(s >= data.End()) {
|
||||||
|
data.Clear();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
charset = *s++;
|
||||||
|
s++;// reserved for prefixes
|
||||||
|
dict = *s++;
|
||||||
|
for(int i = 0; i < 256 - dict; i++) {
|
||||||
|
if(s >= data.End()) {
|
||||||
|
data.Clear();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
voc[i] = s;
|
||||||
|
while(*s) s++;
|
||||||
|
s++;
|
||||||
|
}
|
||||||
|
line.Clear();
|
||||||
|
while(s < data.End()) {
|
||||||
|
if(s + 8 >= data.End()) {
|
||||||
|
data.Clear();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
int code = Peek32le(s);
|
||||||
|
s += 4;
|
||||||
|
int len = Peek32le(s);
|
||||||
|
s += 4;
|
||||||
|
Line& l = line.Add(code);
|
||||||
|
l.begin = (const byte *)s;
|
||||||
|
s += len;
|
||||||
|
l.end = (const byte *)s;
|
||||||
|
};
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Speller::CheckOld(const WString& wstr) const
|
||||||
|
{
|
||||||
|
int len = wstr.GetLength();
|
||||||
|
if(len < 2)
|
||||||
|
return true;
|
||||||
|
if(len < 64) {
|
||||||
|
String w = FromUnicode(wstr, charset);
|
||||||
|
String wl = FromUnicode(ToLower(wstr), charset);
|
||||||
|
int i;
|
||||||
|
if(len == 2) {
|
||||||
|
w.Cat(127);
|
||||||
|
wl.Cat(127);
|
||||||
|
}
|
||||||
|
i = line.Find(ToLower(wl[0], charset) +
|
||||||
|
(ToLower(wl[1], charset) << 8) +
|
||||||
|
(ToLower(wl[2], charset) << 16));
|
||||||
|
if(i >= 0) {
|
||||||
|
const byte *s = line[i].begin;
|
||||||
|
const byte *e = line[i].end;
|
||||||
|
String q;
|
||||||
|
while(s < e)
|
||||||
|
if(*s < dict) {
|
||||||
|
if(q == w || q == wl)
|
||||||
|
return true;
|
||||||
|
q.Trim(*s++);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ASSERT(*s >= dict);
|
||||||
|
const char *x = voc[(int)*s++ - dict];
|
||||||
|
q.Cat(x);
|
||||||
|
}
|
||||||
|
if(q == w || q == wl)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return user.Find(wstr) >= 0;;
|
||||||
|
}
|
||||||
|
|
||||||
|
static String sUserFile(int lang)
|
||||||
|
{
|
||||||
|
return ConfigFile(LNGAsText(lang) + ".usp");
|
||||||
|
}
|
||||||
|
|
||||||
|
String spell_path;
|
||||||
|
|
||||||
|
void SetSpellPath(const String& p)
|
||||||
|
{
|
||||||
|
spell_path = p;
|
||||||
|
}
|
||||||
|
|
||||||
|
static String sZet(FileIn& in, int offset, int len)
|
||||||
|
{
|
||||||
|
in.Seek(offset);
|
||||||
|
return ZDecompress(in.Get(len));
|
||||||
|
}
|
||||||
|
|
||||||
|
void DoSpellerPath(String& pp, String dir)
|
||||||
|
{
|
||||||
|
for(;;) {
|
||||||
|
pp << dir << ';';
|
||||||
|
String d = GetFileFolder(dir);
|
||||||
|
if(d == dir) break;
|
||||||
|
dir = d;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Speller *sGetSpeller(int lang)
|
||||||
|
{
|
||||||
|
static ArrayMap<int, Speller> speller;
|
||||||
|
int q = speller.Find(lang);
|
||||||
|
if(q < 0) {
|
||||||
|
String pp = spell_path;
|
||||||
|
DoSpellerPath(pp, GetExeDirFile("scd"));
|
||||||
|
DoSpellerPath(pp, ConfigFile("scd"));
|
||||||
|
pp << spell_path << ';' << getenv("LIB") << ';' << getenv("PATH") << ';';
|
||||||
|
String path = GetFileOnPath(ToLower(LNGAsText(lang)) + ".udc", pp);
|
||||||
|
if(IsNull(path))
|
||||||
|
path = GetFileOnPath(ToLower(LNGAsText(lang)) + ".scd", pp);
|
||||||
|
if(IsNull(path))
|
||||||
|
return NULL;
|
||||||
|
FileIn in(path);
|
||||||
|
if(!in)
|
||||||
|
return NULL;
|
||||||
|
q = speller.GetCount();
|
||||||
|
Speller& f = speller.Add(lang);
|
||||||
|
FileIn user(sUserFile(lang));
|
||||||
|
while(!user.IsEof()) {
|
||||||
|
String s = user.GetLine();
|
||||||
|
if(!s.IsEmpty())
|
||||||
|
f.user.Add(FromUtf8(s));
|
||||||
|
}
|
||||||
|
if(in.Get() != 255)
|
||||||
|
f.SetOld(LoadFile(path));
|
||||||
|
else {
|
||||||
|
f.path = path;
|
||||||
|
int n = in.GetL();
|
||||||
|
LLOG("Found scd file " << path << " blocks " << n);
|
||||||
|
if(n > 0 && n < 100000) {
|
||||||
|
for(int i = 0; i < n; i++) {
|
||||||
|
SpellBlock& b = f.block.Add();
|
||||||
|
b.first = in.Get(in.Get());
|
||||||
|
b.ctrl_len = in.GetL();
|
||||||
|
b.text_len = in.GetL();
|
||||||
|
}
|
||||||
|
if(in.IsEof())
|
||||||
|
f.block.Clear();
|
||||||
|
else {
|
||||||
|
int off = (int)in.GetPos();
|
||||||
|
for(int i = 0; i < n; i++) {
|
||||||
|
SpellBlock& b = f.block[i];
|
||||||
|
b.offset = off;
|
||||||
|
off += b.ctrl_len + b.text_len;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return &speller[q];
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SpellWordRaw(const WString& wrd, int lang, Vector<String> *withdia)
|
||||||
|
{
|
||||||
|
Speller *f = sGetSpeller(lang);
|
||||||
|
if(!f)
|
||||||
|
return true;
|
||||||
|
if(f->data.GetCount())
|
||||||
|
return f->CheckOld(wrd);
|
||||||
|
String awrd = ToUpper(ToAscii(wrd).ToString());
|
||||||
|
String t1 = ToUtf8(wrd);
|
||||||
|
String t2 = ToUtf8(ToLower(wrd));
|
||||||
|
for(int i = 0;; i++) {
|
||||||
|
if(i + 1 >= f->block.GetCount() || awrd <= f->block[i + 1].first) {
|
||||||
|
for(;;) {
|
||||||
|
if(i >= f->block.GetCount())
|
||||||
|
return f->user.Find(wrd) >= 0;;
|
||||||
|
LLOG("Spell block " << i << ": " << f->block[i].first);
|
||||||
|
const SpellBlock& b = f->block[i++];
|
||||||
|
if(b.first > awrd) {
|
||||||
|
LLOG(" --- end");
|
||||||
|
return f->user.Find(wrd) >= 0;;
|
||||||
|
}
|
||||||
|
FileIn in(f->path);
|
||||||
|
String ctrl = sZet(in, b.offset, b.ctrl_len);
|
||||||
|
String text = sZet(in, b.offset + b.ctrl_len, b.text_len);
|
||||||
|
in.Close();
|
||||||
|
String w;
|
||||||
|
const char *s = ctrl;
|
||||||
|
const char *e = ctrl.End();
|
||||||
|
const char *t = text;
|
||||||
|
const char *te = text.End();
|
||||||
|
while(s < e && t < te) {
|
||||||
|
w.Trim(*s++);
|
||||||
|
while(*t)
|
||||||
|
w.Cat(*t++);
|
||||||
|
if(w == t1 || w == t2)
|
||||||
|
return true;
|
||||||
|
if(withdia && t2 == ToLower(ToAscii(w.ToWString()).ToString()))
|
||||||
|
withdia->Add(w);
|
||||||
|
t++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return f->user.Find(wrd) >= 0;;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct SpellKey : Moveable<SpellKey> {
|
||||||
|
int lang;
|
||||||
|
WString wrd;
|
||||||
|
|
||||||
|
unsigned GetHashValue() const { return CombineHash(lang, wrd); }
|
||||||
|
bool operator==(const SpellKey& b) const { return lang == b.lang && wrd == b.wrd; }
|
||||||
|
};
|
||||||
|
|
||||||
|
struct SpellMaker : LRUCache<bool, SpellKey>::Maker {
|
||||||
|
SpellKey k;
|
||||||
|
|
||||||
|
SpellKey Key() const { return k; }
|
||||||
|
int Make(bool& r) const {
|
||||||
|
r = SpellWordRaw(k.wrd, k.lang);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
static LRUCache<bool, SpellKey> speller_cache;
|
||||||
|
|
||||||
|
bool SpellWord(const WString& ws, int lang)
|
||||||
|
{
|
||||||
|
speller_cache.Shrink(2000);
|
||||||
|
SpellMaker m;
|
||||||
|
m.k.lang = lang;
|
||||||
|
m.k.wrd = ws;
|
||||||
|
return speller_cache.Get(m);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SpellWord(const wchar *ws, int len, int lang)
|
||||||
|
{
|
||||||
|
return SpellWord(WString(ws, len), lang);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SpellerAdd(const WString& w, int lang)
|
||||||
|
{
|
||||||
|
if(!SpellWord(w, w.GetCount(), lang)) {
|
||||||
|
Speller *f = sGetSpeller(lang);
|
||||||
|
if(f) {
|
||||||
|
FileAppend fa(sUserFile(lang));
|
||||||
|
fa.PutLine(ToUtf8(w));
|
||||||
|
f->user.Add(w);
|
||||||
|
speller_cache.Clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
@ -482,6 +482,11 @@ String Replace(const String& s, const VectorMap<String, String>& fr);
|
||||||
WString Replace(const WString& s, const Vector<WString>& find, const Vector<WString>& replace);
|
WString Replace(const WString& s, const Vector<WString>& find, const Vector<WString>& replace);
|
||||||
WString Replace(const WString& s, const VectorMap<WString, WString>& fr);
|
WString Replace(const WString& s, const VectorMap<WString, WString>& fr);
|
||||||
|
|
||||||
|
bool SpellWordRaw(const WString& wrd, int lang, Vector<String> *withdia = NULL);
|
||||||
|
bool SpellWord(const WString& ws, int lang);
|
||||||
|
bool SpellWord(const wchar *ws, int len, int lang);
|
||||||
|
void SpellerAdd(const WString& w, int lang);
|
||||||
|
|
||||||
String GetP7Signature(const void *data, int length, const String& cert_pem, const String& pkey_pem);
|
String GetP7Signature(const void *data, int length, const String& cert_pem, const String& pkey_pem);
|
||||||
String GetP7Signature(const String& data, const String& cert_pem, const String& pkey_pem);
|
String GetP7Signature(const String& data, const String& cert_pem, const String& pkey_pem);
|
||||||
|
|
||||||
|
|
@ -500,4 +505,3 @@ String Garble(const String& s);
|
||||||
|
|
||||||
String Encode64(const String& s);
|
String Encode64(const String& s);
|
||||||
String Decode64(const String& s);
|
String Decode64(const String& s);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -66,9 +66,8 @@ has ability to `'add`' functions using operator<<. Also, unlike
|
||||||
exception.&]
|
exception.&]
|
||||||
[s5; [* Event ]is equivalent of Callback `- unlike Callback, it is
|
[s5; [* Event ]is equivalent of Callback `- unlike Callback, it is
|
||||||
not necessary to have Callback, Callback1, Callback2, number
|
not necessary to have Callback, Callback1, Callback2, number
|
||||||
of parameters is resolved by C`+`+11 template varargs. For backward
|
of parameters is resolved by C`+`+11 template varargs.&]
|
||||||
compatibility Callback`[N`] are aliased as Event variants.&]
|
[s5; Callback is deprecated but supported for backward compatibility.&]
|
||||||
[s5; Similarly, [* EventGate] is a new equivalent of [* Gate].&]
|
|
||||||
[s3; Algorithms and Containers&]
|
[s3; Algorithms and Containers&]
|
||||||
[s5; The set of algorithms provided by U`+`+ is now streamlined by
|
[s5; The set of algorithms provided by U`+`+ is now streamlined by
|
||||||
introduction of [/ Range] concept. Range is entity that provides
|
introduction of [/ Range] concept. Range is entity that provides
|
||||||
|
|
|
||||||
|
|
@ -461,7 +461,7 @@ void LineEdit::Paint0(Draw& w) {
|
||||||
else
|
else
|
||||||
ln = tx.GetCount();
|
ln = tx.GetCount();
|
||||||
int lgp = -1;
|
int lgp = -1;
|
||||||
for(int pass = 0; pass < 2; pass++) {
|
for(int pass = 0; pass < 3; pass++) {
|
||||||
int gp = 0;
|
int gp = 0;
|
||||||
int scx = fsz.cx * sc.x;
|
int scx = fsz.cx * sc.x;
|
||||||
sOptimizedRectRenderer rw(w);
|
sOptimizedRectRenderer rw(w);
|
||||||
|
|
@ -546,7 +546,9 @@ void LineEdit::Paint0(Draw& w) {
|
||||||
if(bordercolumn > 0 && bordercolumn >= gp && bordercolumn < gp + 1 + cjk)
|
if(bordercolumn > 0 && bordercolumn >= gp && bordercolumn < gp + 1 + cjk)
|
||||||
rw.DrawRect((bordercolumn - sc.x) * fsz.cx, y, 1, fsz.cy, bordercolor);
|
rw.DrawRect((bordercolumn - sc.x) * fsz.cx, y, 1, fsz.cy, bordercolor);
|
||||||
}
|
}
|
||||||
else
|
if(pass == 1 && (h.flags & SPELLERROR))
|
||||||
|
rw.DrawRect(x, max(y, y + fsz.cy - Zy(1)), (cjk + 1) * fsz.cx, Zy(1), LtRed());
|
||||||
|
if(pass == 2)
|
||||||
tw.DrawChar(x + (h.flags & SHIFT_L ? -fsz.cx / 6 : h.flags & SHIFT_R ? fsz.cx / 6 : 0),
|
tw.DrawChar(x + (h.flags & SHIFT_L ? -fsz.cx / 6 : h.flags & SHIFT_R ? fsz.cx / 6 : 0),
|
||||||
y + fascent - h.font.GetAscent(),
|
y + fascent - h.font.GetAscent(),
|
||||||
h.chr, (cjk + 1) * fsz.cx, h.font, h.ink);
|
h.chr, (cjk + 1) * fsz.cx, h.font, h.ink);
|
||||||
|
|
|
||||||
|
|
@ -243,6 +243,7 @@ public:
|
||||||
enum Flags {
|
enum Flags {
|
||||||
SHIFT_L = 1,
|
SHIFT_L = 1,
|
||||||
SHIFT_R = 2,
|
SHIFT_R = 2,
|
||||||
|
SPELLERROR = 4,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Highlight : Moveable<Highlight> {
|
struct Highlight : Moveable<Highlight> {
|
||||||
|
|
|
||||||
|
|
@ -197,10 +197,6 @@ public:
|
||||||
StyleManager();
|
StyleManager();
|
||||||
};
|
};
|
||||||
|
|
||||||
bool SpellWordRaw(const WString& wrd, int lang, Vector<String> *withdia = NULL);
|
|
||||||
bool SpellWord(const wchar *ws, int len, int lang);
|
|
||||||
bool SpellWord(const WString& ws, int lang);
|
|
||||||
|
|
||||||
void SetupFaceList(DropList& face);
|
void SetupFaceList(DropList& face);
|
||||||
|
|
||||||
class RichEdit : public Ctrl, private TextArrayOps {
|
class RichEdit : public Ctrl, private TextArrayOps {
|
||||||
|
|
|
||||||
|
|
@ -2,287 +2,9 @@
|
||||||
|
|
||||||
namespace Upp {
|
namespace Upp {
|
||||||
|
|
||||||
#define LLOG(x) // LOG(x)
|
|
||||||
|
|
||||||
struct SpellBlock : Moveable<SpellBlock> {
|
|
||||||
String first;
|
|
||||||
int offset;
|
|
||||||
int ctrl_len;
|
|
||||||
int text_len;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct Speller {
|
|
||||||
String data;
|
|
||||||
byte charset;
|
|
||||||
const char *voc[256];
|
|
||||||
int dict;
|
|
||||||
struct Line : Moveable<Line> {
|
|
||||||
const byte *begin;
|
|
||||||
const byte *end;
|
|
||||||
};
|
|
||||||
VectorMap<dword, Line> line;
|
|
||||||
Index<WString> user;
|
|
||||||
|
|
||||||
String path;
|
|
||||||
Array<SpellBlock> block;
|
|
||||||
|
|
||||||
bool SetOld(const String& data);
|
|
||||||
void Clear() { data.Clear(); path.Clear(); }
|
|
||||||
operator bool() const { return !data.IsEmpty() || path.GetCount(); }
|
|
||||||
bool CheckOld(const WString& wstr) const;
|
|
||||||
|
|
||||||
String Get(int offset, int len);
|
|
||||||
};
|
|
||||||
|
|
||||||
bool Speller::SetOld(const String& _data)
|
|
||||||
{
|
|
||||||
data = _data;
|
|
||||||
const char *s = data;
|
|
||||||
if(s >= data.End()) {
|
|
||||||
data.Clear();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
charset = *s++;
|
|
||||||
s++;// reserved for prefixes
|
|
||||||
dict = *s++;
|
|
||||||
for(int i = 0; i < 256 - dict; i++) {
|
|
||||||
if(s >= data.End()) {
|
|
||||||
data.Clear();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
voc[i] = s;
|
|
||||||
while(*s) s++;
|
|
||||||
s++;
|
|
||||||
}
|
|
||||||
line.Clear();
|
|
||||||
while(s < data.End()) {
|
|
||||||
if(s + 8 >= data.End()) {
|
|
||||||
data.Clear();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
int code = Peek32le(s);
|
|
||||||
s += 4;
|
|
||||||
int len = Peek32le(s);
|
|
||||||
s += 4;
|
|
||||||
Line& l = line.Add(code);
|
|
||||||
l.begin = (const byte *)s;
|
|
||||||
s += len;
|
|
||||||
l.end = (const byte *)s;
|
|
||||||
};
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Speller::CheckOld(const WString& wstr) const
|
|
||||||
{
|
|
||||||
int len = wstr.GetLength();
|
|
||||||
if(len == 1)
|
|
||||||
return true;
|
|
||||||
if(len < 64) {
|
|
||||||
String w = FromUnicode(wstr, charset);
|
|
||||||
String wl = FromUnicode(ToLower(wstr), charset);
|
|
||||||
int i;
|
|
||||||
if(len == 2) {
|
|
||||||
w.Cat(127);
|
|
||||||
wl.Cat(127);
|
|
||||||
}
|
|
||||||
i = line.Find(ToLower(wl[0], charset) +
|
|
||||||
(ToLower(wl[1], charset) << 8) +
|
|
||||||
(ToLower(wl[2], charset) << 16));
|
|
||||||
if(i >= 0) {
|
|
||||||
const byte *s = line[i].begin;
|
|
||||||
const byte *e = line[i].end;
|
|
||||||
String q;
|
|
||||||
while(s < e)
|
|
||||||
if(*s < dict) {
|
|
||||||
if(q == w || q == wl)
|
|
||||||
return true;
|
|
||||||
q.Trim(*s++);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
ASSERT(*s >= dict);
|
|
||||||
const char *x = voc[(int)*s++ - dict];
|
|
||||||
q.Cat(x);
|
|
||||||
}
|
|
||||||
if(q == w || q == wl)
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return user.Find(wstr) >= 0;;
|
|
||||||
}
|
|
||||||
|
|
||||||
static String sUserFile(int lang)
|
|
||||||
{
|
|
||||||
return ConfigFile(LNGAsText(lang) + ".usp");
|
|
||||||
}
|
|
||||||
|
|
||||||
String spell_path;
|
|
||||||
|
|
||||||
void SetSpellPath(const String& p)
|
|
||||||
{
|
|
||||||
spell_path = p;
|
|
||||||
}
|
|
||||||
|
|
||||||
static String sZet(FileIn& in, int offset, int len)
|
|
||||||
{
|
|
||||||
in.Seek(offset);
|
|
||||||
return ZDecompress(in.Get(len));
|
|
||||||
}
|
|
||||||
|
|
||||||
void DoSpellerPath(String& pp, String dir)
|
|
||||||
{
|
|
||||||
for(;;) {
|
|
||||||
pp << dir << ';';
|
|
||||||
String d = GetFileFolder(dir);
|
|
||||||
if(d == dir) break;
|
|
||||||
dir = d;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Speller *sGetSpeller(int lang)
|
|
||||||
{
|
|
||||||
static ArrayMap<int, Speller> speller;
|
|
||||||
int q = speller.Find(lang);
|
|
||||||
if(q < 0) {
|
|
||||||
String pp = spell_path;
|
|
||||||
DoSpellerPath(pp, GetExeDirFile("scd"));
|
|
||||||
DoSpellerPath(pp, ConfigFile("scd"));
|
|
||||||
pp << spell_path << ';' << getenv("LIB") << ';' << getenv("PATH") << ';';
|
|
||||||
String path = GetFileOnPath(ToLower(LNGAsText(lang)) + ".udc", pp);
|
|
||||||
if(IsNull(path))
|
|
||||||
path = GetFileOnPath(ToLower(LNGAsText(lang)) + ".scd", pp);
|
|
||||||
if(IsNull(path))
|
|
||||||
return NULL;
|
|
||||||
FileIn in(path);
|
|
||||||
if(!in)
|
|
||||||
return NULL;
|
|
||||||
q = speller.GetCount();
|
|
||||||
Speller& f = speller.Add(lang);
|
|
||||||
FileIn user(sUserFile(lang));
|
|
||||||
while(!user.IsEof()) {
|
|
||||||
String s = user.GetLine();
|
|
||||||
if(!s.IsEmpty())
|
|
||||||
f.user.Add(FromUtf8(s));
|
|
||||||
}
|
|
||||||
if(in.Get() != 255)
|
|
||||||
f.SetOld(LoadFile(path));
|
|
||||||
else {
|
|
||||||
f.path = path;
|
|
||||||
int n = in.GetL();
|
|
||||||
LLOG("Found scd file " << path << " blocks " << n);
|
|
||||||
if(n > 0 && n < 100000) {
|
|
||||||
for(int i = 0; i < n; i++) {
|
|
||||||
SpellBlock& b = f.block.Add();
|
|
||||||
b.first = in.Get(in.Get());
|
|
||||||
b.ctrl_len = in.GetL();
|
|
||||||
b.text_len = in.GetL();
|
|
||||||
}
|
|
||||||
if(in.IsEof())
|
|
||||||
f.block.Clear();
|
|
||||||
else {
|
|
||||||
int off = (int)in.GetPos();
|
|
||||||
for(int i = 0; i < n; i++) {
|
|
||||||
SpellBlock& b = f.block[i];
|
|
||||||
b.offset = off;
|
|
||||||
off += b.ctrl_len + b.text_len;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return &speller[q];
|
|
||||||
}
|
|
||||||
|
|
||||||
bool SpellWordRaw(const WString& wrd, int lang, Vector<String> *withdia)
|
|
||||||
{
|
|
||||||
Speller *f = sGetSpeller(lang);
|
|
||||||
if(!f)
|
|
||||||
return true;
|
|
||||||
if(f->data.GetCount())
|
|
||||||
return f->CheckOld(wrd);
|
|
||||||
String awrd = ToUpper(ToAscii(wrd).ToString());
|
|
||||||
String t1 = ToUtf8(wrd);
|
|
||||||
String t2 = ToUtf8(ToLower(wrd));
|
|
||||||
for(int i = 0;; i++) {
|
|
||||||
if(i + 1 >= f->block.GetCount() || awrd <= f->block[i + 1].first) {
|
|
||||||
for(;;) {
|
|
||||||
if(i >= f->block.GetCount())
|
|
||||||
return f->user.Find(wrd) >= 0;;
|
|
||||||
LLOG("Spell block " << i << ": " << f->block[i].first);
|
|
||||||
const SpellBlock& b = f->block[i++];
|
|
||||||
if(b.first > awrd) {
|
|
||||||
LLOG(" --- end");
|
|
||||||
return f->user.Find(wrd) >= 0;;
|
|
||||||
}
|
|
||||||
FileIn in(f->path);
|
|
||||||
String ctrl = sZet(in, b.offset, b.ctrl_len);
|
|
||||||
String text = sZet(in, b.offset + b.ctrl_len, b.text_len);
|
|
||||||
in.Close();
|
|
||||||
String w;
|
|
||||||
const char *s = ctrl;
|
|
||||||
const char *e = ctrl.End();
|
|
||||||
const char *t = text;
|
|
||||||
const char *te = text.End();
|
|
||||||
while(s < e && t < te) {
|
|
||||||
w.Trim(*s++);
|
|
||||||
while(*t)
|
|
||||||
w.Cat(*t++);
|
|
||||||
if(w == t1 || w == t2)
|
|
||||||
return true;
|
|
||||||
if(withdia && t2 == ToLower(ToAscii(w.ToWString()).ToString()))
|
|
||||||
withdia->Add(w);
|
|
||||||
t++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return f->user.Find(wrd) >= 0;;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct SpellKey : Moveable<SpellKey> {
|
|
||||||
int lang;
|
|
||||||
WString wrd;
|
|
||||||
|
|
||||||
unsigned GetHashValue() const { return CombineHash(lang, wrd); }
|
|
||||||
bool operator==(const SpellKey& b) const { return lang == b.lang && wrd == b.wrd; }
|
|
||||||
};
|
|
||||||
|
|
||||||
struct SpellMaker : LRUCache<bool, SpellKey>::Maker {
|
|
||||||
SpellKey k;
|
|
||||||
|
|
||||||
SpellKey Key() const { return k; }
|
|
||||||
int Make(bool& r) const {
|
|
||||||
r = SpellWordRaw(k.wrd, k.lang);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
static LRUCache<bool, SpellKey> speller_cache;
|
|
||||||
|
|
||||||
bool SpellWord(const WString& ws, int lang)
|
|
||||||
{
|
|
||||||
speller_cache.Shrink(2000);
|
|
||||||
SpellMaker m;
|
|
||||||
m.k.lang = lang;
|
|
||||||
m.k.wrd = ws;
|
|
||||||
return speller_cache.Get(m);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool SpellWord(const wchar *ws, int len, int lang)
|
|
||||||
{
|
|
||||||
return SpellWord(WString(ws, len), lang);
|
|
||||||
}
|
|
||||||
|
|
||||||
void RichEdit::SpellerAdd(const WString& w, int lang)
|
void RichEdit::SpellerAdd(const WString& w, int lang)
|
||||||
{
|
{
|
||||||
if(!SpellWord(w, w.GetCount(), lang)) {
|
Upp::SpellerAdd(w, lang);
|
||||||
Speller *f = sGetSpeller(lang);
|
|
||||||
if(f) {
|
|
||||||
FileAppend fa(sUserFile(lang));
|
|
||||||
fa.PutLine(ToUtf8(w));
|
|
||||||
f->user.Add(w);
|
|
||||||
speller_cache.Clear();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int RichEdit::fixedlang;
|
int RichEdit::fixedlang;
|
||||||
|
|
|
||||||
|
|
@ -162,7 +162,7 @@ void Sentinel(Stream& s, const char *txt)
|
||||||
|
|
||||||
void Ide::Serialize(Stream& s)
|
void Ide::Serialize(Stream& s)
|
||||||
{
|
{
|
||||||
int version = 10;
|
int version = 11;
|
||||||
Sentinel(s, "before 12341234");
|
Sentinel(s, "before 12341234");
|
||||||
s.Magic(0x12341234);
|
s.Magic(0x12341234);
|
||||||
Sentinel(s, "after magic");
|
Sentinel(s, "after magic");
|
||||||
|
|
@ -200,6 +200,8 @@ void Ide::Serialize(Stream& s)
|
||||||
s % tabs_grouping;
|
s % tabs_grouping;
|
||||||
s % tabs_serialize;
|
s % tabs_serialize;
|
||||||
s % tabs_stacking;
|
s % tabs_stacking;
|
||||||
|
if(version >= 11)
|
||||||
|
s % spellcheck_comments;
|
||||||
bool dummy_force_crlf = false;
|
bool dummy_force_crlf = false;
|
||||||
s % dummy_force_crlf;
|
s % dummy_force_crlf;
|
||||||
if(version >= 1)
|
if(version >= 1)
|
||||||
|
|
|
||||||
|
|
@ -302,10 +302,11 @@ public:
|
||||||
int font;
|
int font;
|
||||||
String highlight;
|
String highlight;
|
||||||
bool pch, nopch, noblitz;
|
bool pch, nopch, noblitz;
|
||||||
|
int spellcheck_comments;
|
||||||
|
|
||||||
void operator=(const String& s) { String::operator=(s); readonly = separator = false; }
|
void operator=(const String& s) { String::operator=(s); readonly = separator = false; }
|
||||||
void Init() { readonly = separator = false; tabsize = Null; charset = 0; font = 0;
|
void Init() { readonly = separator = false; tabsize = Null; charset = 0; font = 0;
|
||||||
pch = nopch = noblitz = false; }
|
pch = nopch = noblitz = false; spellcheck_comments = Null; }
|
||||||
|
|
||||||
File() { Init(); }
|
File() { Init(); }
|
||||||
File(const String& s) : String(s) { Init(); }
|
File(const String& s) : String(s) { Init(); }
|
||||||
|
|
@ -334,6 +335,7 @@ public:
|
||||||
Time time;
|
Time time;
|
||||||
bool bold, italic;
|
bool bold, italic;
|
||||||
Color ink;
|
Color ink;
|
||||||
|
int spellcheck_comments;
|
||||||
|
|
||||||
int GetCount() const { return file.GetCount(); }
|
int GetCount() const { return file.GetCount(); }
|
||||||
File& operator[](int i) { return file[i]; }
|
File& operator[](int i) { return file[i]; }
|
||||||
|
|
|
||||||
|
|
@ -163,6 +163,7 @@ void Package::Reset()
|
||||||
noblitz = nowarnings = false;
|
noblitz = nowarnings = false;
|
||||||
bold = italic = false;
|
bold = italic = false;
|
||||||
ink = Null;
|
ink = Null;
|
||||||
|
spellcheck_comments = Null;
|
||||||
}
|
}
|
||||||
|
|
||||||
Package::Package()
|
Package::Package()
|
||||||
|
|
@ -319,6 +320,9 @@ bool Package::Load(const char *path)
|
||||||
else
|
else
|
||||||
if(p.Id("highlight"))
|
if(p.Id("highlight"))
|
||||||
f.highlight = p.ReadId();
|
f.highlight = p.ReadId();
|
||||||
|
else
|
||||||
|
if(p.Id("spellcheck_comments"))
|
||||||
|
f.spellcheck_comments = LNGFromText(p.ReadString());
|
||||||
else
|
else
|
||||||
p.SkipTerm();
|
p.SkipTerm();
|
||||||
}
|
}
|
||||||
|
|
@ -348,6 +352,9 @@ bool Package::Load(const char *path)
|
||||||
else
|
else
|
||||||
if(p.Id("custom"))
|
if(p.Id("custom"))
|
||||||
custom.Add().Load(p);
|
custom.Add().Load(p);
|
||||||
|
else
|
||||||
|
if(p.Id("spellcheck_comments"))
|
||||||
|
spellcheck_comments = LNGFromText(p.ReadString());
|
||||||
else
|
else
|
||||||
p.SkipTerm();
|
p.SkipTerm();
|
||||||
}
|
}
|
||||||
|
|
@ -422,6 +429,12 @@ String IdeCharsetName(byte charset) {
|
||||||
CharsetName(charset));
|
CharsetName(charset));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PutSpellCheckComments(StringStream& out, int sc)
|
||||||
|
{
|
||||||
|
if(!IsNull(sc))
|
||||||
|
out << " spellcheck_comments " << AsCString(sc ? LNGAsText(sc) : "");
|
||||||
|
}
|
||||||
|
|
||||||
bool Package::Save(const char *path) const {
|
bool Package::Save(const char *path) const {
|
||||||
StringStream out;
|
StringStream out;
|
||||||
if(description.GetCount() || italic || bold || !IsNull(ink)) {
|
if(description.GetCount() || italic || bold || !IsNull(ink)) {
|
||||||
|
|
@ -475,6 +488,7 @@ bool Package::Save(const char *path) const {
|
||||||
out << " charset " << AsCString(IdeCharsetName(f.charset));
|
out << " charset " << AsCString(IdeCharsetName(f.charset));
|
||||||
if(!IsNull(f.highlight))
|
if(!IsNull(f.highlight))
|
||||||
out << " highlight " << f.highlight;
|
out << " highlight " << f.highlight;
|
||||||
|
PutSpellCheckComments(out, f.spellcheck_comments);
|
||||||
putfopt(out, "options", f.option);
|
putfopt(out, "options", f.option);
|
||||||
putfopt(out, "depends", f.depends);
|
putfopt(out, "depends", f.depends);
|
||||||
}
|
}
|
||||||
|
|
@ -489,6 +503,7 @@ bool Package::Save(const char *path) const {
|
||||||
}
|
}
|
||||||
out << ";\n\n";
|
out << ";\n\n";
|
||||||
}
|
}
|
||||||
|
PutSpellCheckComments(out, spellcheck_comments);
|
||||||
for(int i = 0; i < custom.GetCount(); i++)
|
for(int i = 0; i < custom.GetCount(); i++)
|
||||||
out << custom[i].AsString();
|
out << custom[i].AsString();
|
||||||
return SaveChangedFile(path, out.GetResult());
|
return SaveChangedFile(path, out.GetResult());
|
||||||
|
|
|
||||||
|
|
@ -332,6 +332,32 @@ void InsertPath(EditString *es)
|
||||||
es->SetWantFocus();
|
es->SetWantFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DlSpellerLangs(DropList& dl)
|
||||||
|
{
|
||||||
|
static Vector<int> lng;
|
||||||
|
ONCELOCK {
|
||||||
|
VectorMap<int, String> lngs;
|
||||||
|
String path = GetExeDirFile("scd") + ';' + ConfigFile("scd") + ';' +
|
||||||
|
GetExeFolder() + ';' + GetConfigFolder() + ';' +
|
||||||
|
getenv("LIB") + ';' + getenv("PATH");
|
||||||
|
Vector<String> p = Split(path, ';');
|
||||||
|
for(auto dir : p) {
|
||||||
|
FindFile ff(AppendFileName(dir, "*.scd"));
|
||||||
|
while(ff) {
|
||||||
|
int lang = LNGFromText(ff.GetName());
|
||||||
|
if(lang)
|
||||||
|
lngs.Add(lang, LNGAsText(lang));
|
||||||
|
ff.Next();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SortByValue(lngs);
|
||||||
|
lng = lngs.PickKeys();
|
||||||
|
}
|
||||||
|
dl.Add(0, "Off");
|
||||||
|
for(auto l : lng)
|
||||||
|
dl.Add(l, LNGAsText(l));
|
||||||
|
}
|
||||||
|
|
||||||
void Ide::SetupFormat() {
|
void Ide::SetupFormat() {
|
||||||
FormatDlg dlg;
|
FormatDlg dlg;
|
||||||
dlg.Title("Settings");
|
dlg.Title("Settings");
|
||||||
|
|
@ -401,6 +427,9 @@ void Ide::SetupFormat() {
|
||||||
edt.indent_amount.Enable(indent_spaces);
|
edt.indent_amount.Enable(indent_spaces);
|
||||||
CtrlRetriever rtvr;
|
CtrlRetriever rtvr;
|
||||||
int hs = hilite_scope;
|
int hs = hilite_scope;
|
||||||
|
|
||||||
|
DlSpellerLangs(edt.spellcheck_comments);
|
||||||
|
|
||||||
rtvr
|
rtvr
|
||||||
(hlt.hilite_scope, hs)
|
(hlt.hilite_scope, hs)
|
||||||
(hlt.hilite_bracket, hilite_bracket)
|
(hlt.hilite_bracket, hilite_bracket)
|
||||||
|
|
@ -427,6 +456,7 @@ void Ide::SetupFormat() {
|
||||||
(edt.tabs_grouping, tabs_grouping)
|
(edt.tabs_grouping, tabs_grouping)
|
||||||
(edt.tabs_stacking, tabs_stacking)
|
(edt.tabs_stacking, tabs_stacking)
|
||||||
(edt.tabs_serialize, tabs_serialize)
|
(edt.tabs_serialize, tabs_serialize)
|
||||||
|
(edt.spellcheck_comments, spellcheck_comments)
|
||||||
(edt.persistent_find_replace, persistent_find_replace)
|
(edt.persistent_find_replace, persistent_find_replace)
|
||||||
(edt.find_replace_restore_pos, find_replace_restore_pos)
|
(edt.find_replace_restore_pos, find_replace_restore_pos)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -90,6 +90,7 @@ void PackageEditor::SaveOptions() {
|
||||||
actual.bold = ~bold;
|
actual.bold = ~bold;
|
||||||
actual.italic = ~italic;
|
actual.italic = ~italic;
|
||||||
actual.charset = (byte)(int)~charset;
|
actual.charset = (byte)(int)~charset;
|
||||||
|
actual.spellcheck_comments = ~spellcheck_comments;
|
||||||
actual.accepts = Split(accepts.GetText().ToString(), ' ');
|
actual.accepts = Split(accepts.GetText().ToString(), ' ');
|
||||||
actual.noblitz = noblitz;
|
actual.noblitz = noblitz;
|
||||||
actual.nowarnings = nowarnings;
|
actual.nowarnings = nowarnings;
|
||||||
|
|
@ -116,6 +117,7 @@ void PackageEditor::Empty()
|
||||||
{
|
{
|
||||||
FileEmpty();
|
FileEmpty();
|
||||||
charset.Disable();
|
charset.Disable();
|
||||||
|
spellcheck_comments.Disable();
|
||||||
noblitz.Disable();
|
noblitz.Disable();
|
||||||
nowarnings.Disable();
|
nowarnings.Disable();
|
||||||
description.Disable();
|
description.Disable();
|
||||||
|
|
@ -174,6 +176,7 @@ void PackageEditor::PackageCursor()
|
||||||
bold <<= actual.bold;
|
bold <<= actual.bold;
|
||||||
italic <<= actual.italic;
|
italic <<= actual.italic;
|
||||||
charset <<= (int)actual.charset;
|
charset <<= (int)actual.charset;
|
||||||
|
spellcheck_comments <<= actual.spellcheck_comments;
|
||||||
noblitz = actual.noblitz;
|
noblitz = actual.noblitz;
|
||||||
nowarnings = actual.nowarnings;
|
nowarnings = actual.nowarnings;
|
||||||
String s;
|
String s;
|
||||||
|
|
@ -187,6 +190,7 @@ void PackageEditor::PackageCursor()
|
||||||
bold.Enable();
|
bold.Enable();
|
||||||
italic.Enable();
|
italic.Enable();
|
||||||
charset.Enable();
|
charset.Enable();
|
||||||
|
spellcheck_comments.Enable();
|
||||||
noblitz.Enable();
|
noblitz.Enable();
|
||||||
nowarnings.Enable();
|
nowarnings.Enable();
|
||||||
accepts.Enable();
|
accepts.Enable();
|
||||||
|
|
@ -579,12 +583,15 @@ PackageEditor::PackageEditor()
|
||||||
CtrlLayoutOKCancel(*this, "Package organizer");
|
CtrlLayoutOKCancel(*this, "Package organizer");
|
||||||
description.Disable();
|
description.Disable();
|
||||||
description <<= THISBACK(Description);
|
description <<= THISBACK(Description);
|
||||||
|
|
||||||
|
spellcheck_comments.Add(Null, "Default");
|
||||||
|
DlSpellerLangs(spellcheck_comments);
|
||||||
DlCharsetD(charset);
|
DlCharsetD(charset);
|
||||||
charset.Disable();
|
charset.Disable();
|
||||||
filelist.Disable();
|
filelist.Disable();
|
||||||
|
spellcheck_comments.Disable();
|
||||||
accepts.SetFilter(FlagFilter);
|
accepts.SetFilter(FlagFilter);
|
||||||
accepts <<=
|
accepts ^= spellcheck_comments ^= charset ^= THISFN(SaveOptions);
|
||||||
charset <<= THISBACK(SaveOptions);
|
|
||||||
noblitz <<=
|
noblitz <<=
|
||||||
nowarnings <<=
|
nowarnings <<=
|
||||||
pch_file <<=
|
pch_file <<=
|
||||||
|
|
|
||||||
|
|
@ -161,6 +161,7 @@ void WorkspaceWork::SavePackage()
|
||||||
b.data = String::GetVoid();
|
b.data = String::GetVoid();
|
||||||
}
|
}
|
||||||
actual.Save(pp);
|
actual.Save(pp);
|
||||||
|
#if 0 // nobody is using 'init'. to be replaced by "add by include" method
|
||||||
String init;
|
String init;
|
||||||
String mnm = Filter('_' + actualpackage + "_icpp_init_stub", CharFilterMacro);
|
String mnm = Filter('_' + actualpackage + "_icpp_init_stub", CharFilterMacro);
|
||||||
init << "#ifndef " << mnm << "\r\n";
|
init << "#ifndef " << mnm << "\r\n";
|
||||||
|
|
@ -182,6 +183,7 @@ void WorkspaceWork::SavePackage()
|
||||||
}
|
}
|
||||||
init << "#endif\r\n";
|
init << "#endif\r\n";
|
||||||
SaveChangedFile(SourcePath(actualpackage, "init"), init);
|
SaveChangedFile(SourcePath(actualpackage, "init"), init);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorkspaceWork::RestoreBackup()
|
void WorkspaceWork::RestoreBackup()
|
||||||
|
|
|
||||||
|
|
@ -303,6 +303,8 @@ void DrawFileName(Draw& w, const Rect& r, const String& h, Color ink);
|
||||||
void AddPath(EditString *es);
|
void AddPath(EditString *es);
|
||||||
void InsertPath(EditString *es);
|
void InsertPath(EditString *es);
|
||||||
|
|
||||||
|
void DlSpellerLangs(DropList& dl);
|
||||||
|
|
||||||
#include "Assist.h"
|
#include "Assist.h"
|
||||||
|
|
||||||
void DirSel(EditField& f, FrameRight<Button>& b);
|
void DirSel(EditField& f, FrameRight<Button>& b);
|
||||||
|
|
@ -589,6 +591,7 @@ public:
|
||||||
bool find_replace_restore_pos;
|
bool find_replace_restore_pos;
|
||||||
bool auto_rescan;
|
bool auto_rescan;
|
||||||
bool auto_check;
|
bool auto_check;
|
||||||
|
int spellcheck_comments;
|
||||||
/*
|
/*
|
||||||
astyle code formatter control vars
|
astyle code formatter control vars
|
||||||
added 2008.01.27 by Massimo Del Fedele
|
added 2008.01.27 by Massimo Del Fedele
|
||||||
|
|
@ -708,8 +711,8 @@ public:
|
||||||
void ChangeFileCharset(const String& name, Package& p, byte charset);
|
void ChangeFileCharset(const String& name, Package& p, byte charset);
|
||||||
void ChangeCharset();
|
void ChangeCharset();
|
||||||
void FlushFile();
|
void FlushFile();
|
||||||
void EditFile0(const String& path, byte charset = CHARSET_DEFAULT, bool astext = false,
|
void EditFile0(const String& path, byte charset, int spellcheck_comments,
|
||||||
const String& header = Null);
|
const String& headername = Null);
|
||||||
void EditFile(const String& path);
|
void EditFile(const String& path);
|
||||||
void AddEditFile(const String& path);
|
void AddEditFile(const String& path);
|
||||||
void ReloadFile();
|
void ReloadFile();
|
||||||
|
|
|
||||||
|
|
@ -109,20 +109,22 @@ END_LAYOUT
|
||||||
|
|
||||||
LAYOUT(UppLayout, 936, 576)
|
LAYOUT(UppLayout, 936, 576)
|
||||||
UNTYPED(package, LeftPosZ(4, 240).VSizePosZ(4, 196))
|
UNTYPED(package, LeftPosZ(4, 240).VSizePosZ(4, 196))
|
||||||
UNTYPED(filelist, LeftPosZ(4, 240).BottomPosZ(4, 188))
|
ITEM(Label, dv___1, SetLabel(t_("Description")).LeftPosZ(248, 64).TopPosZ(4, 19))
|
||||||
ITEM(Label, dv___2, SetLabel(t_("Description")).LeftPosZ(248, 64).TopPosZ(4, 19))
|
ITEM(DataPusher, description, HSizePosZ(308, 224).TopPosZ(4, 20))
|
||||||
ITEM(DataPusher, description, HSizePosZ(308, 208).TopPosZ(4, 20))
|
ITEM(Label, dv___3, SetLabel(t_("Highlight")).RightPosZ(144, 68).TopPosZ(4, 19))
|
||||||
ITEM(Label, dv___4, SetLabel(t_("Highlight")).RightPosZ(152, 48).TopPosZ(4, 19))
|
ITEM(ColorPusher, ink, RightPosZ(100, 52).TopPosZ(4, 19))
|
||||||
ITEM(ColorPusher, ink, RightPosZ(100, 52).TopPosZ(4, 20))
|
|
||||||
ITEM(Option, bold, SetLabel(t_("Bold")).RightPosZ(52, 44).TopPosZ(4, 20))
|
ITEM(Option, bold, SetLabel(t_("Bold")).RightPosZ(52, 44).TopPosZ(4, 20))
|
||||||
ITEM(Option, italic, SetLabel(t_("Italic")).RightPosZ(4, 44).TopPosZ(4, 20))
|
ITEM(Option, italic, SetLabel(t_("Italic")).RightPosZ(4, 44).TopPosZ(4, 20))
|
||||||
ITEM(Label, dv___8, SetLabel(t_("&Accepts")).LeftPosZ(368, 44).TopPosZ(28, 19))
|
ITEM(Label, dv___7, SetLabel(t_("&Accepts")).LeftPosZ(248, 44).TopPosZ(28, 19))
|
||||||
ITEM(EditString, accepts, HSizePosZ(412, 356).TopPosZ(28, 19))
|
ITEM(EditString, accepts, HSizePosZ(308, 548).TopPosZ(28, 19))
|
||||||
ITEM(Label, dv___10, SetLabel(t_("Encoding")).RightPosZ(300, 48).TopPosZ(28, 19))
|
ITEM(Label, dv___9, SetLabel(t_("Spellcheck comments")).LeftPosZ(396, 120).TopPosZ(28, 19))
|
||||||
|
ITEM(DropList, spellcheck_comments, LeftPosZ(512, 68).TopPosZ(28, 19))
|
||||||
|
ITEM(Label, dv___11, SetLabel(t_("Encoding")).RightPosZ(300, 48).TopPosZ(28, 19))
|
||||||
ITEM(DropList, charset, RightPosZ(184, 112).TopPosZ(28, 19))
|
ITEM(DropList, charset, RightPosZ(184, 112).TopPosZ(28, 19))
|
||||||
ITEM(Option, noblitz, SetLabel(t_("No BLITZ")).RightPosZ(98, 76).TopPosZ(28, 20))
|
ITEM(Option, noblitz, SetLabel(t_("No BLITZ")).RightPosZ(98, 76).TopPosZ(28, 20))
|
||||||
ITEM(Option, nowarnings, SetLabel(t_("No warnings")).RightPosZ(4, 88).TopPosZ(28, 20))
|
ITEM(Option, nowarnings, SetLabel(t_("No warnings")).RightPosZ(4, 88).TopPosZ(28, 20))
|
||||||
ITEM(ArrayCtrl, option, HSizePosZ(248, 4).VSizePosZ(52, 152))
|
ITEM(ArrayCtrl, option, HSizePosZ(248, 4).VSizePosZ(52, 152))
|
||||||
|
UNTYPED(filelist, LeftPosZ(4, 240).BottomPosZ(4, 188))
|
||||||
ITEM(ArrayCtrl, fileoption, HSizePosZ(248, 4).BottomPosZ(36, 112))
|
ITEM(ArrayCtrl, fileoption, HSizePosZ(248, 4).BottomPosZ(36, 112))
|
||||||
ITEM(Option, includeable_file, SetLabel(t_("Includeable group")).LeftPosZ(252, 116).BottomPosZ(9, 19))
|
ITEM(Option, includeable_file, SetLabel(t_("Includeable group")).LeftPosZ(252, 116).BottomPosZ(9, 19))
|
||||||
ITEM(Option, pch_file, SetLabel(t_("Precompile header")).LeftPosZ(368, 120).BottomPosZ(9, 19))
|
ITEM(Option, pch_file, SetLabel(t_("Precompile header")).LeftPosZ(368, 120).BottomPosZ(9, 19))
|
||||||
|
|
@ -145,7 +147,7 @@ LAYOUT(NewPackageLayout, 728, 560)
|
||||||
UNTYPED(preview, HSizePosZ(248, 8).VSizePosZ(28, 4))
|
UNTYPED(preview, HSizePosZ(248, 8).VSizePosZ(28, 4))
|
||||||
END_LAYOUT
|
END_LAYOUT
|
||||||
|
|
||||||
LAYOUT(FileFormatLayout, 348, 160)
|
LAYOUT(FileFormatLayout, 348, 184)
|
||||||
ITEM(Label, dv___0, SetLabel(t_("&Encoding")).LeftPosZ(8, 64).TopPosZ(8, 20))
|
ITEM(Label, dv___0, SetLabel(t_("&Encoding")).LeftPosZ(8, 64).TopPosZ(8, 20))
|
||||||
ITEM(DropList, charset, LeftPosZ(80, 120).TopPosZ(8, 19))
|
ITEM(DropList, charset, LeftPosZ(80, 120).TopPosZ(8, 19))
|
||||||
ITEM(Label, dv___2, SetLabel(t_("&Font")).LeftPosZ(8, 76).TopPosZ(32, 20))
|
ITEM(Label, dv___2, SetLabel(t_("&Font")).LeftPosZ(8, 76).TopPosZ(32, 20))
|
||||||
|
|
@ -156,8 +158,10 @@ LAYOUT(FileFormatLayout, 348, 160)
|
||||||
ITEM(DropList, highlight, LeftPosZ(80, 260).TopPosZ(80, 19))
|
ITEM(DropList, highlight, LeftPosZ(80, 260).TopPosZ(80, 19))
|
||||||
ITEM(Label, dv___8, SetLabel(t_("Line endings")).LeftPosZ(8, 96).TopPosZ(104, 19))
|
ITEM(Label, dv___8, SetLabel(t_("Line endings")).LeftPosZ(8, 96).TopPosZ(104, 19))
|
||||||
ITEM(DropList, line_endings, LeftPosZ(80, 68).TopPosZ(104, 19))
|
ITEM(DropList, line_endings, LeftPosZ(80, 68).TopPosZ(104, 19))
|
||||||
ITEM(Button, ok, SetLabel(t_("OK")).LeftPosZ(208, 64).TopPosZ(128, 22))
|
ITEM(Label, dv___10, SetLabel(t_("Spellcheck comments")).LeftPosZ(8, 120).TopPosZ(128, 19))
|
||||||
ITEM(Button, cancel, SetLabel(t_("Cancel")).LeftPosZ(276, 64).TopPosZ(128, 22))
|
ITEM(DropList, spellcheck_comments, LeftPosZ(124, 100).TopPosZ(128, 19))
|
||||||
|
ITEM(Button, ok, SetLabel(t_("OK")).LeftPosZ(208, 64).TopPosZ(156, 22))
|
||||||
|
ITEM(Button, cancel, SetLabel(t_("Cancel")).LeftPosZ(276, 64).TopPosZ(156, 22))
|
||||||
END_LAYOUT
|
END_LAYOUT
|
||||||
|
|
||||||
LAYOUT(CharsetLayout, 204, 64)
|
LAYOUT(CharsetLayout, 204, 64)
|
||||||
|
|
@ -565,6 +569,8 @@ LAYOUT(SetupEditorLayout, 544, 296)
|
||||||
ITEM(Option, tabs_grouping, SetLabel(t_("Group by file folders")).LeftPosZ(304, 132).VCenterPosZ(16, -80))
|
ITEM(Option, tabs_grouping, SetLabel(t_("Group by file folders")).LeftPosZ(304, 132).VCenterPosZ(16, -80))
|
||||||
ITEM(Option, tabs_stacking, SetLabel(t_("Stacking")).LeftPosZ(304, 132).VCenterPosZ(16, -64))
|
ITEM(Option, tabs_stacking, SetLabel(t_("Stacking")).LeftPosZ(304, 132).VCenterPosZ(16, -64))
|
||||||
ITEM(Option, tabs_serialize, SetLabel(t_("Persistent tabs")).LeftPosZ(304, 132).VCenterPosZ(16, -48))
|
ITEM(Option, tabs_serialize, SetLabel(t_("Persistent tabs")).LeftPosZ(304, 132).VCenterPosZ(16, -48))
|
||||||
|
ITEM(Label, dv___30, SetLabel(t_("Spellcheck comments")).LeftPosZ(304, 120).TopPosZ(116, 19))
|
||||||
|
ITEM(DropList, spellcheck_comments, LeftPosZ(428, 92).TopPosZ(116, 19))
|
||||||
END_LAYOUT
|
END_LAYOUT
|
||||||
|
|
||||||
LAYOUT(SetupAssistLayout, 532, 212)
|
LAYOUT(SetupAssistLayout, 532, 212)
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,7 @@ void Ide::FileCursor()
|
||||||
if(p != HELPNAME)
|
if(p != HELPNAME)
|
||||||
p = GetActiveFilePath();
|
p = GetActiveFilePath();
|
||||||
EditFile0(p, f.charset ? f.charset : actual.charset ? actual.charset : default_charset,
|
EditFile0(p, f.charset ? f.charset : actual.charset ? actual.charset : default_charset,
|
||||||
false, headername);
|
Nvl(f.spellcheck_comments, actual.spellcheck_comments, spellcheck_comments));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -136,6 +136,9 @@ void Ide::FileProperties()
|
||||||
d.line_endings.Add(LF, "LF");
|
d.line_endings.Add(LF, "LF");
|
||||||
d.line_endings <<= findarg(Nvl(editfile_line_endings, line_endings), LF, DETECT_LF) >= 0 ? LF : CRLF;
|
d.line_endings <<= findarg(Nvl(editfile_line_endings, line_endings), LF, DETECT_LF) >= 0 ? LF : CRLF;
|
||||||
d.line_endings.Enable(findarg(line_endings, DETECT_CRLF, DETECT_LF) >= 0);
|
d.line_endings.Enable(findarg(line_endings, DETECT_CRLF, DETECT_LF) >= 0);
|
||||||
|
d.spellcheck_comments.Add(Null, "Default");
|
||||||
|
DlSpellerLangs(d.spellcheck_comments);
|
||||||
|
d.spellcheck_comments <<= f.spellcheck_comments;
|
||||||
for(;;) {
|
for(;;) {
|
||||||
switch(d.Run()) {
|
switch(d.Run()) {
|
||||||
case IDCANCEL:
|
case IDCANCEL:
|
||||||
|
|
@ -149,6 +152,7 @@ void Ide::FileProperties()
|
||||||
f.tabsize = Nvl((int)~d.tabsize);
|
f.tabsize = Nvl((int)~d.tabsize);
|
||||||
f.font = Nvl((int)~d.font);
|
f.font = Nvl((int)~d.font);
|
||||||
f.highlight = ~d.highlight;
|
f.highlight = ~d.highlight;
|
||||||
|
f.spellcheck_comments = ~d.spellcheck_comments;
|
||||||
SavePackage();
|
SavePackage();
|
||||||
PackageCursor();
|
PackageCursor();
|
||||||
filelist.SetCursor(c);
|
filelist.SetCursor(c);
|
||||||
|
|
@ -413,7 +417,8 @@ bool Ide::FileRemove()
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ide::EditFile0(const String& path, byte charset, bool astext, const String& headername) {
|
void Ide::EditFile0(const String& path, byte charset, int spellcheck_comments, const String& headername)
|
||||||
|
{
|
||||||
text_updated.Kill();
|
text_updated.Kill();
|
||||||
|
|
||||||
AKEditor();
|
AKEditor();
|
||||||
|
|
@ -424,12 +429,13 @@ void Ide::EditFile0(const String& path, byte charset, bool astext, const String&
|
||||||
|
|
||||||
editfile = path;
|
editfile = path;
|
||||||
editor.SetCharset(charset);
|
editor.SetCharset(charset);
|
||||||
|
editor.SpellcheckComments(spellcheck_comments);
|
||||||
AddLru();
|
AddLru();
|
||||||
|
|
||||||
editfile_isfolder = IsFolder(editfile) || IsHelpName(editfile);
|
editfile_isfolder = IsFolder(editfile) || IsHelpName(editfile);
|
||||||
svn_dirs = SvnDirs(true).GetCount(); // Perhaps not the best place, but should be ok
|
svn_dirs = SvnDirs(true).GetCount(); // Perhaps not the best place, but should be ok
|
||||||
|
|
||||||
bool candesigner = !astext && !(debugger && !editfile_isfolder && (PathIsEqual(path, posfile[0]) || PathIsEqual(path, posfile[0])))
|
bool candesigner = !(debugger && !editfile_isfolder && (PathIsEqual(path, posfile[0]) || PathIsEqual(path, posfile[0])))
|
||||||
&& editastext.Find(path) < 0 && editashex.Find(path) < 0 && !IsNestReadOnly(editfile);
|
&& editastext.Find(path) < 0 && editashex.Find(path) < 0 && !IsNestReadOnly(editfile);
|
||||||
|
|
||||||
if(candesigner) {
|
if(candesigner) {
|
||||||
|
|
@ -587,8 +593,9 @@ void Ide::EditAsHex()
|
||||||
editastext.RemoveKey(editfile);
|
editastext.RemoveKey(editfile);
|
||||||
editashex.FindPut(editfile);
|
editashex.FindPut(editfile);
|
||||||
byte cs = editor.GetCharset();
|
byte cs = editor.GetCharset();
|
||||||
|
int sc = editor.GetSpellcheckComments();
|
||||||
FlushFile();
|
FlushFile();
|
||||||
EditFile0(path, cs);
|
EditFile0(path, cs, sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Ide::IsDesignerFile(const String& path)
|
bool Ide::IsDesignerFile(const String& path)
|
||||||
|
|
@ -614,8 +621,9 @@ void Ide::EditAsText()
|
||||||
return;
|
return;
|
||||||
DoEditAsText(path);
|
DoEditAsText(path);
|
||||||
byte cs = editor.GetCharset();
|
byte cs = editor.GetCharset();
|
||||||
|
int sc = editor.GetSpellcheckComments();
|
||||||
FlushFile();
|
FlushFile();
|
||||||
EditFile0(path, cs);
|
EditFile0(path, cs, sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ide::EditUsingDesigner()
|
void Ide::EditUsingDesigner()
|
||||||
|
|
@ -626,8 +634,9 @@ void Ide::EditUsingDesigner()
|
||||||
editashex.RemoveKey(editfile);
|
editashex.RemoveKey(editfile);
|
||||||
editastext.RemoveKey(editfile);
|
editastext.RemoveKey(editfile);
|
||||||
byte cs = editor.GetCharset();
|
byte cs = editor.GetCharset();
|
||||||
|
int sc = editor.GetSpellcheckComments();
|
||||||
FlushFile();
|
FlushFile();
|
||||||
EditFile0(path, cs);
|
EditFile0(path, cs, sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ide::AddEditFile(const String& path)
|
void Ide::AddEditFile(const String& path)
|
||||||
|
|
@ -785,7 +794,7 @@ void Ide::ReloadFile()
|
||||||
int ln = editor.GetCursorLine();
|
int ln = editor.GetCursorLine();
|
||||||
editfile.Clear();
|
editfile.Clear();
|
||||||
int sc = filelist.GetSbPos();
|
int sc = filelist.GetSbPos();
|
||||||
EditFile0(fn, editor.GetCharset());
|
EditFile0(fn, editor.GetCharset(), editor.GetSpellcheckComments());
|
||||||
filelist.SetSbPos(sc);
|
filelist.SetSbPos(sc);
|
||||||
int l = LocateLine(data, ln, ~editor);
|
int l = LocateLine(data, ln, ~editor);
|
||||||
editor.SetCursor(editor.GetPos(l));
|
editor.SetCursor(editor.GetPos(l));
|
||||||
|
|
@ -875,6 +884,7 @@ void Ide::PassEditor()
|
||||||
editor.SetFocus();
|
editor.SetFocus();
|
||||||
editor.ScrollIntoCursor();
|
editor.ScrollIntoCursor();
|
||||||
editor2.Annotate(editfile2);
|
editor2.Annotate(editfile2);
|
||||||
|
editor2.SpellcheckComments(editor.GetSpellcheckComments());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ide::ClearEditedFile()
|
void Ide::ClearEditedFile()
|
||||||
|
|
|
||||||
|
|
@ -525,6 +525,7 @@ Ide::Ide()
|
||||||
#else
|
#else
|
||||||
line_endings = DETECT_CRLF;
|
line_endings = DETECT_CRLF;
|
||||||
#endif
|
#endif
|
||||||
|
spellcheck_comments = LNG_ENGLISH;
|
||||||
/*
|
/*
|
||||||
astyle code formatter control vars
|
astyle code formatter control vars
|
||||||
added 2008.01.27 by Massimo Del Fedele
|
added 2008.01.27 by Massimo Del Fedele
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue