mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-21 06:45:39 -06:00
ide: rudimentary css highlighting support, PGSQL: support for hex blobs
git-svn-id: svn://ultimatepp.org/upp/trunk@5078 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
6372241578
commit
0a14488501
7 changed files with 48 additions and 10 deletions
|
|
@ -180,6 +180,7 @@ public:
|
||||||
enum {
|
enum {
|
||||||
HIGHLIGHT_NONE = -1, HIGHLIGHT_CPP = 0, HIGHLIGHT_USC, HIGHLIGHT_JAVA, HIGHLIGHT_T,
|
HIGHLIGHT_NONE = -1, HIGHLIGHT_CPP = 0, HIGHLIGHT_USC, HIGHLIGHT_JAVA, HIGHLIGHT_T,
|
||||||
HIGHLIGHT_CALC, HIGHLIGHT_LAY, HIGHLIGHT_SCH, HIGHLIGHT_SQL, HIGHLIGHT_JAVASCRIPT,
|
HIGHLIGHT_CALC, HIGHLIGHT_LAY, HIGHLIGHT_SCH, HIGHLIGHT_SQL, HIGHLIGHT_JAVASCRIPT,
|
||||||
|
HIGHLIGHT_CSS,
|
||||||
HIGHLIGHT_COUNT
|
HIGHLIGHT_COUNT
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -328,6 +328,26 @@ void CodeEditor::InitKeywords()
|
||||||
"debugger", "super", "true", "false", "undefined",
|
"debugger", "super", "true", "false", "undefined",
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
static const char *css[] = {
|
||||||
|
"azimuth", "background-attachment", "background-color", "background-image", "background-position",
|
||||||
|
"background-repeat", "background", "border-collapse", "border-color", "border-spacing", "border-style",
|
||||||
|
"border-top", "border-right", "border-bottom", "border-left", "border-top-color", "border-right-color",
|
||||||
|
"border-bottom-color", "border-left-color", "border-top-style", "border-right-style", "border-bottom-style",
|
||||||
|
"border-left-style", "border-top-width", "border-right-width", "border-bottom-width", "border-left-width",
|
||||||
|
"border-width", "border", "bottom", "caption-side", "clear", "clip", "color", "content", "counter-increment",
|
||||||
|
"counter-reset", "cue-after", "cue-before", "cue", "cursor", "direction", "display", "elevation", "empty-cells",
|
||||||
|
"float", "font-family", "font-size", "font-style", "font-variant", "font-weight", "font", "height", "left",
|
||||||
|
"letter-spacing", "line-height", "list-style-image", "list-style-position", "list-style-type", "list-style",
|
||||||
|
"margin-right", "margin-left", "margin-top", "margin-bottom", "margin", "max-height", "max-width", "min-height",
|
||||||
|
"min-width", "orphans", "outline-color", "outline-style", "outline-width", "outline", "overflow", "padding-top",
|
||||||
|
"padding-right", "padding-bottom", "padding-left", "padding", "page-break-after", "page-break-before",
|
||||||
|
"page-break-inside", "pause-after", "pause-before", "pause", "pitch-range", "pitch", "play-during", "position",
|
||||||
|
"quotes", "richness", "right", "speak-header", "speak-numeral", "speak-punctuation", "speak", "speech-rate",
|
||||||
|
"stress", "table-layout", "text-align", "text-decoration", "text-indent", "text-transform", "top",
|
||||||
|
"unicode-bidi", "vertical-align", "visibility", "voice-family", "volume", "white-space", "widows", "width",
|
||||||
|
"word-spacing", "z-index",
|
||||||
|
NULL
|
||||||
|
};
|
||||||
static const char *upp_macros[] = {
|
static const char *upp_macros[] = {
|
||||||
"CLASSNAME", "THISBACK", "THISBACK1", "THISBACK2", "THISBACK3", "THISBACK4",
|
"CLASSNAME", "THISBACK", "THISBACK1", "THISBACK2", "THISBACK3", "THISBACK4",
|
||||||
"PTEBACK", "PTEBACK1", "PTEBACK2", "PTEBACK3", "PTEBACK4",
|
"PTEBACK", "PTEBACK1", "PTEBACK2", "PTEBACK3", "PTEBACK4",
|
||||||
|
|
@ -431,10 +451,10 @@ void CodeEditor::InitKeywords()
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
static const char **kw[HIGHLIGHT_COUNT] = {
|
static const char **kw[HIGHLIGHT_COUNT] = {
|
||||||
cpp, usc, java, tfile, usc, lay, sch, sql, javascript
|
cpp, usc, java, tfile, usc, lay, sch, sql, javascript, css,
|
||||||
};
|
};
|
||||||
static const char **nm[HIGHLIGHT_COUNT] = {
|
static const char **nm[HIGHLIGHT_COUNT] = {
|
||||||
upp, usclib, javan, tlng, usclib, javan, javan, javan, javascriptn
|
upp, usclib, javan, tlng, usclib, javan, javan, javan, javascriptn, javan,
|
||||||
};
|
};
|
||||||
const char **q = NULL;
|
const char **q = NULL;
|
||||||
for(int i = 0; i < HIGHLIGHT_COUNT; i++) {
|
for(int i = 0; i < HIGHLIGHT_COUNT; i++) {
|
||||||
|
|
@ -503,7 +523,7 @@ void CodeEditor::HighlightLine(int line, Vector<LineEdit::Highlight>& hl, int po
|
||||||
p++;
|
p++;
|
||||||
hls.Put(hl_style[INK_NORMAL]);
|
hls.Put(hl_style[INK_NORMAL]);
|
||||||
}
|
}
|
||||||
if(*p == '#' && highlight != HIGHLIGHT_JAVASCRIPT) {
|
if(*p == '#' && highlight != HIGHLIGHT_JAVASCRIPT && highlight != HIGHLIGHT_CSS) {
|
||||||
static const char *pd[] = {
|
static const char *pd[] = {
|
||||||
"define", "error", "if", "elif", "else", "endif",
|
"define", "error", "if", "elif", "else", "endif",
|
||||||
"ifdef", "ifndef", "include", "line", "undef", "pragma",
|
"ifdef", "ifndef", "include", "line", "undef", "pragma",
|
||||||
|
|
|
||||||
|
|
@ -219,8 +219,11 @@ void WakeUpGuiThread()
|
||||||
::PostThreadMessage(sMainThreadId, WM_NULL, 0, 0);
|
::PostThreadMessage(sMainThreadId, WM_NULL, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AvoidPaintingCheck__();
|
||||||
|
|
||||||
static void Win32PanicMessageBox(const char *title, const char *text)
|
static void Win32PanicMessageBox(const char *title, const char *text)
|
||||||
{
|
{
|
||||||
|
AvoidPaintingCheck__();
|
||||||
#ifdef PLATFORM_WINCE
|
#ifdef PLATFORM_WINCE
|
||||||
static wchar wtext[256], wtitle[256];
|
static wchar wtext[256], wtitle[256];
|
||||||
ToUnicode(wtext, text, strlen(text), CHARSET_DEFAULT);
|
ToUnicode(wtext, text, strlen(text), CHARSET_DEFAULT);
|
||||||
|
|
|
||||||
|
|
@ -371,7 +371,12 @@ bool PostgreSQLSession::Open(const char *connect)
|
||||||
DoKeepAlive();
|
DoKeepAlive();
|
||||||
|
|
||||||
LLOG( String("Postgresql client encoding: ") + pg_encoding_to_char( PQclientEncoding(conn) ) );
|
LLOG( String("Postgresql client encoding: ") + pg_encoding_to_char( PQclientEncoding(conn) ) );
|
||||||
|
|
||||||
|
|
||||||
|
Sql sql(*this);
|
||||||
|
if(sql.Execute("select setting from pg_settings where name = 'bytea_output'") && sql[0] == "hex")
|
||||||
|
hex_blobs = true;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -627,10 +632,14 @@ void PostgreSQLConnection::GetColumn(int i, Ref f) const
|
||||||
break;
|
break;
|
||||||
default: {
|
default: {
|
||||||
if(oid[i] == PGSQL_BYTEAOID) {
|
if(oid[i] == PGSQL_BYTEAOID) {
|
||||||
size_t len;
|
if(session.hex_blobs)
|
||||||
unsigned char *q = PQunescapeBytea((const unsigned char *)s, &len);
|
f.SetValue(ScanHexString(s, strlen(s)));
|
||||||
f.SetValue(String(q, len));
|
else {
|
||||||
PQfreemem(q);
|
size_t len;
|
||||||
|
unsigned char *q = PQunescapeBytea((const unsigned char *)s, &len);
|
||||||
|
f.SetValue(String(q, len));
|
||||||
|
PQfreemem(q);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
f.SetValue(FromCharset(String(s)));
|
f.SetValue(FromCharset(String(s)));
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,7 @@ private:
|
||||||
|
|
||||||
String conns;
|
String conns;
|
||||||
bool keepalive;
|
bool keepalive;
|
||||||
|
bool hex_blobs;
|
||||||
|
|
||||||
void ExecTrans(const char * statement);
|
void ExecTrans(const char * statement);
|
||||||
Vector<String> EnumData(char type, const char *schema = NULL);
|
Vector<String> EnumData(char type, const char *schema = NULL);
|
||||||
|
|
@ -88,7 +89,7 @@ public:
|
||||||
virtual void Rollback();
|
virtual void Rollback();
|
||||||
virtual int GetTransactionLevel() const;
|
virtual int GetTransactionLevel() const;
|
||||||
|
|
||||||
PostgreSQLSession() { conn = NULL; Dialect(PGSQL); level = 0; keepalive = false; }
|
PostgreSQLSession() { conn = NULL; Dialect(PGSQL); level = 0; keepalive = hex_blobs = false; }
|
||||||
~PostgreSQLSession() { Close(); }
|
~PostgreSQLSession() { Close(); }
|
||||||
PGconn * GetPGConn() { return conn; }
|
PGconn * GetPGConn() { return conn; }
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,9 @@ void Ide::SetupEditor(int f, String hl, String fn)
|
||||||
if(hl == "js")
|
if(hl == "js")
|
||||||
editor.Highlight(CodeEditor::HIGHLIGHT_JAVASCRIPT);
|
editor.Highlight(CodeEditor::HIGHLIGHT_JAVASCRIPT);
|
||||||
else
|
else
|
||||||
|
if(hl == "css")
|
||||||
|
editor.Highlight(CodeEditor::HIGHLIGHT_CSS);
|
||||||
|
else
|
||||||
if(hl == "t" || hl == "jt")
|
if(hl == "t" || hl == "jt")
|
||||||
editor.Highlight(CodeEditor::HIGHLIGHT_T);
|
editor.Highlight(CodeEditor::HIGHLIGHT_T);
|
||||||
else
|
else
|
||||||
|
|
@ -123,6 +126,7 @@ void Ide::FileProperties()
|
||||||
d.highlight.Add("cpp", "C++");
|
d.highlight.Add("cpp", "C++");
|
||||||
d.highlight.Add("java", "Java");
|
d.highlight.Add("java", "Java");
|
||||||
d.highlight.Add("js", "JavaScript");
|
d.highlight.Add("js", "JavaScript");
|
||||||
|
d.highlight.Add("css", "CSS");
|
||||||
d.highlight.Add("sql", "SQL");
|
d.highlight.Add("sql", "SQL");
|
||||||
d.highlight.Add("usc", "Esc");
|
d.highlight.Add("usc", "Esc");
|
||||||
d.highlight.Add("sch", "DB schema");
|
d.highlight.Add("sch", "DB schema");
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,6 @@
|
||||||
#include "usvn/init"
|
#include "usvn/init"
|
||||||
#include "TextDiffCtrl/init"
|
#include "TextDiffCtrl/init"
|
||||||
#include "TabBar/init"
|
#include "TabBar/init"
|
||||||
#include "ide\SrcUpdater/init"
|
|
||||||
#include "ide\Img/init"
|
#include "ide\Img/init"
|
||||||
|
#include "ide\SrcUpdater/init"
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue