mirror of https://github.com/adamdruppe/arsd.git
Merge branch 'adamdruppe:master' into accurateCursorPos
This commit is contained in:
commit
2b35882926
13
cgi.d
13
cgi.d
|
@ -3513,7 +3513,11 @@ string toHexUpper(long num) {
|
||||||
|
|
||||||
// the generic mixins
|
// the generic mixins
|
||||||
|
|
||||||
/// Use this instead of writing your own main
|
/++
|
||||||
|
Use this instead of writing your own main
|
||||||
|
|
||||||
|
It ultimately calls [cgiMainImpl] which creates a [RequestServer] for you.
|
||||||
|
+/
|
||||||
mixin template GenericMain(alias fun, long maxContentLength = defaultMaxContentLength) {
|
mixin template GenericMain(alias fun, long maxContentLength = defaultMaxContentLength) {
|
||||||
mixin CustomCgiMain!(Cgi, fun, maxContentLength);
|
mixin CustomCgiMain!(Cgi, fun, maxContentLength);
|
||||||
}
|
}
|
||||||
|
@ -5478,6 +5482,7 @@ class ListeningConnectionManager {
|
||||||
fd_set read_fds;
|
fd_set read_fds;
|
||||||
FD_ZERO(&read_fds);
|
FD_ZERO(&read_fds);
|
||||||
FD_SET(listener.handle, &read_fds);
|
FD_SET(listener.handle, &read_fds);
|
||||||
|
if(cancelfd != -1)
|
||||||
FD_SET(cancelfd, &read_fds);
|
FD_SET(cancelfd, &read_fds);
|
||||||
auto max = listener.handle > cancelfd ? listener.handle : cancelfd;
|
auto max = listener.handle > cancelfd ? listener.handle : cancelfd;
|
||||||
auto ret = select(max + 1, &read_fds, null, null, null);
|
auto ret = select(max + 1, &read_fds, null, null, null);
|
||||||
|
@ -5489,7 +5494,7 @@ class ListeningConnectionManager {
|
||||||
throw new Exception("wtf select");
|
throw new Exception("wtf select");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(FD_ISSET(cancelfd, &read_fds)) {
|
if(cancelfd != -1 && FD_ISSET(cancelfd, &read_fds)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9480,8 +9485,10 @@ css";
|
||||||
Element htmlContainer() {
|
Element htmlContainer() {
|
||||||
auto document = new Document(q"html
|
auto document = new Document(q"html
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html class="no-script">
|
||||||
<head>
|
<head>
|
||||||
|
<script>document.documentElement.classList.remove("no-script");</script>
|
||||||
|
<style>.no-script requires-script { display: none; }</style>
|
||||||
<title>D Application</title>
|
<title>D Application</title>
|
||||||
<link rel="stylesheet" href="style.css" />
|
<link rel="stylesheet" href="style.css" />
|
||||||
</head>
|
</head>
|
||||||
|
|
3
dub.json
3
dub.json
|
@ -474,7 +474,8 @@
|
||||||
"description": "Postgresql client library. Wraps the libpq C library with my database.d interface.",
|
"description": "Postgresql client library. Wraps the libpq C library with my database.d interface.",
|
||||||
"targetType": "library",
|
"targetType": "library",
|
||||||
"dependencies": {"arsd-official:database_base":"*"},
|
"dependencies": {"arsd-official:database_base":"*"},
|
||||||
"libs": ["pq"],
|
"libs-posix": ["pq"],
|
||||||
|
"libs-windows": ["libpq"],
|
||||||
"sourceFiles": ["postgres.d"],
|
"sourceFiles": ["postgres.d"],
|
||||||
"importPaths": ["."],
|
"importPaths": ["."],
|
||||||
"dflags-dmd": ["-mv=arsd.postgres=$PACKAGE_DIR/postgres.d"],
|
"dflags-dmd": ["-mv=arsd.postgres=$PACKAGE_DIR/postgres.d"],
|
||||||
|
|
51
minigui.d
51
minigui.d
|
@ -11754,6 +11754,19 @@ class TextDisplayHelper : Widget {
|
||||||
return ctx;
|
return ctx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override void defaultEventHandler_blur(Event ev) {
|
||||||
|
super.defaultEventHandler_blur(ev);
|
||||||
|
if(l.wasMutated()) {
|
||||||
|
auto evt = new ChangeEvent!string(this, &this.content);
|
||||||
|
evt.dispatch();
|
||||||
|
l.clearWasMutatedFlag();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private string content() {
|
||||||
|
return l.getTextString();
|
||||||
|
}
|
||||||
|
|
||||||
void undo() {
|
void undo() {
|
||||||
if(undoStack.length) {
|
if(undoStack.length) {
|
||||||
auto state = undoStack[$-1];
|
auto state = undoStack[$-1];
|
||||||
|
@ -12347,9 +12360,9 @@ abstract class EditableTextWidget : EditableTextWidgetParent {
|
||||||
else
|
else
|
||||||
return null;
|
return null;
|
||||||
} else version(custom_widgets) {
|
} else version(custom_widgets) {
|
||||||
version(use_new_text_system)
|
version(use_new_text_system) {
|
||||||
return textLayout.getTextString();
|
return textLayout.getTextString();
|
||||||
else
|
} else
|
||||||
return textLayout.getPlainText();
|
return textLayout.getPlainText();
|
||||||
} else static assert(false);
|
} else static assert(false);
|
||||||
}
|
}
|
||||||
|
@ -12505,10 +12518,7 @@ abstract class EditableTextWidget : EditableTextWidgetParent {
|
||||||
}
|
}
|
||||||
else static assert(false);
|
else static assert(false);
|
||||||
|
|
||||||
|
version(trash_text)
|
||||||
version(trash_text) {
|
|
||||||
|
|
||||||
|
|
||||||
version(custom_widgets)
|
version(custom_widgets)
|
||||||
override void defaultEventHandler_mousedown(MouseDownEvent ev) {
|
override void defaultEventHandler_mousedown(MouseDownEvent ev) {
|
||||||
super.defaultEventHandler_mousedown(ev);
|
super.defaultEventHandler_mousedown(ev);
|
||||||
|
@ -12532,12 +12542,14 @@ abstract class EditableTextWidget : EditableTextWidgetParent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
version(trash_text)
|
||||||
version(custom_widgets)
|
version(custom_widgets)
|
||||||
override void defaultEventHandler_mouseup(MouseUpEvent ev) {
|
override void defaultEventHandler_mouseup(MouseUpEvent ev) {
|
||||||
//this.parentWindow.win.releaseInputGrab();
|
//this.parentWindow.win.releaseInputGrab();
|
||||||
super.defaultEventHandler_mouseup(ev);
|
super.defaultEventHandler_mouseup(ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
version(trash_text)
|
||||||
version(custom_widgets)
|
version(custom_widgets)
|
||||||
override void defaultEventHandler_mousemove(MouseMoveEvent ev) {
|
override void defaultEventHandler_mousemove(MouseMoveEvent ev) {
|
||||||
super.defaultEventHandler_mousemove(ev);
|
super.defaultEventHandler_mousemove(ev);
|
||||||
|
@ -12547,6 +12559,7 @@ abstract class EditableTextWidget : EditableTextWidgetParent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
version(trash_text)
|
||||||
version(custom_widgets)
|
version(custom_widgets)
|
||||||
override void defaultEventHandler_focus(Event ev) {
|
override void defaultEventHandler_focus(Event ev) {
|
||||||
super.defaultEventHandler_focus(ev);
|
super.defaultEventHandler_focus(ev);
|
||||||
|
@ -12582,6 +12595,7 @@ abstract class EditableTextWidget : EditableTextWidgetParent {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
version(trash_text) {
|
||||||
private string lastContentBlur;
|
private string lastContentBlur;
|
||||||
|
|
||||||
override void defaultEventHandler_blur(Event ev) {
|
override void defaultEventHandler_blur(Event ev) {
|
||||||
|
@ -12603,7 +12617,24 @@ abstract class EditableTextWidget : EditableTextWidgetParent {
|
||||||
lastContentBlur = this.content;
|
lastContentBlur = this.content;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
version(win32_widgets) {
|
||||||
|
private string lastContentBlur;
|
||||||
|
|
||||||
|
override void defaultEventHandler_blur(Event ev) {
|
||||||
|
super.defaultEventHandler_blur(ev);
|
||||||
|
|
||||||
|
if(this.content != lastContentBlur) {
|
||||||
|
auto evt = new ChangeEvent!string(this, &this.content);
|
||||||
|
evt.dispatch();
|
||||||
|
lastContentBlur = this.content;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
version(trash_text)
|
||||||
version(custom_widgets)
|
version(custom_widgets)
|
||||||
override void defaultEventHandler_char(CharEvent ev) {
|
override void defaultEventHandler_char(CharEvent ev) {
|
||||||
super.defaultEventHandler_char(ev);
|
super.defaultEventHandler_char(ev);
|
||||||
|
@ -12614,6 +12645,7 @@ abstract class EditableTextWidget : EditableTextWidgetParent {
|
||||||
auto cbb = textLayout.contentBoundingBox();
|
auto cbb = textLayout.contentBoundingBox();
|
||||||
setContentSize(cbb.width, cbb.height);
|
setContentSize(cbb.width, cbb.height);
|
||||||
}
|
}
|
||||||
|
version(trash_text)
|
||||||
version(custom_widgets)
|
version(custom_widgets)
|
||||||
override void defaultEventHandler_keydown(KeyDownEvent ev) {
|
override void defaultEventHandler_keydown(KeyDownEvent ev) {
|
||||||
//super.defaultEventHandler_keydown(ev);
|
//super.defaultEventHandler_keydown(ev);
|
||||||
|
@ -12669,8 +12701,6 @@ abstract class EditableTextWidget : EditableTextWidgetParent {
|
||||||
ensureVisibleInScroll(textLayout.caretBoundingBox());
|
ensureVisibleInScroll(textLayout.caretBoundingBox());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
version(use_new_text_system) {
|
version(use_new_text_system) {
|
||||||
bool showingVerticalScroll() { return true; }
|
bool showingVerticalScroll() { return true; }
|
||||||
bool showingHorizontalScroll() { return true; }
|
bool showingHorizontalScroll() { return true; }
|
||||||
|
@ -14999,6 +15029,11 @@ class AutomaticDialog(T) : Dialog {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.addEventListener((scope ClosedEvent ce) {
|
||||||
|
if(onCancel)
|
||||||
|
onCancel();
|
||||||
|
});
|
||||||
|
|
||||||
//this.children[0].focus();
|
//this.children[0].focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,11 @@
|
||||||
should be found in the PostgreSQL lib and/or bin folders (check them both!).
|
should be found in the PostgreSQL lib and/or bin folders (check them both!).
|
||||||
+/
|
+/
|
||||||
module arsd.postgres;
|
module arsd.postgres;
|
||||||
pragma(lib, "pq");
|
|
||||||
|
version(Windows)
|
||||||
|
pragma(lib, "libpq");
|
||||||
|
else
|
||||||
|
pragma(lib, "pq");
|
||||||
|
|
||||||
public import arsd.database;
|
public import arsd.database;
|
||||||
|
|
||||||
|
|
|
@ -474,6 +474,7 @@ public struct Selection {
|
||||||
FIXME: what if i want to replace it with some multiply styled text? Could probably call it in sequence actually.
|
FIXME: what if i want to replace it with some multiply styled text? Could probably call it in sequence actually.
|
||||||
+/
|
+/
|
||||||
Selection replaceContent(scope const(char)[] newText, TextLayouter.StyleHandle style = TextLayouter.StyleHandle.init) {
|
Selection replaceContent(scope const(char)[] newText, TextLayouter.StyleHandle style = TextLayouter.StyleHandle.init) {
|
||||||
|
layouter.wasMutated_ = true;
|
||||||
|
|
||||||
if(style == TextLayouter.StyleHandle.init)
|
if(style == TextLayouter.StyleHandle.init)
|
||||||
style = layouter.getInsertionStyleAt(impl.focus);
|
style = layouter.getInsertionStyleAt(impl.focus);
|
||||||
|
@ -1068,6 +1069,19 @@ class TextLayouter {
|
||||||
WrappedAround = 2
|
WrappedAround = 2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool wasMutated_ = false;
|
||||||
|
/++
|
||||||
|
The layouter maintains a flag to tell if the content has been changed.
|
||||||
|
+/
|
||||||
|
public bool wasMutated() {
|
||||||
|
return wasMutated_;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// ditto
|
||||||
|
public void clearWasMutatedFlag() {
|
||||||
|
wasMutated_ = false;
|
||||||
|
}
|
||||||
|
|
||||||
/++
|
/++
|
||||||
Represents a possible registered style for a segment of text.
|
Represents a possible registered style for a segment of text.
|
||||||
+/
|
+/
|
||||||
|
@ -1090,6 +1104,7 @@ class TextLayouter {
|
||||||
Appends text at the end, without disturbing user selection.
|
Appends text at the end, without disturbing user selection.
|
||||||
+/
|
+/
|
||||||
public void appendText(scope const(char)[] text, StyleHandle style = StyleHandle.init) {
|
public void appendText(scope const(char)[] text, StyleHandle style = StyleHandle.init) {
|
||||||
|
wasMutated_ = true;
|
||||||
auto before = this.text;
|
auto before = this.text;
|
||||||
this.text.length += text.length;
|
this.text.length += text.length;
|
||||||
this.text[before.length-1 .. before.length-1 + text.length] = text[];
|
this.text[before.length-1 .. before.length-1 + text.length] = text[];
|
||||||
|
@ -1117,7 +1132,7 @@ class TextLayouter {
|
||||||
FIXME: have some kind of index stuff so you can select some text found in here (think regex search)
|
FIXME: have some kind of index stuff so you can select some text found in here (think regex search)
|
||||||
+/
|
+/
|
||||||
void getText(scope void delegate(scope const(char)[] segment, TextStyle style) handler) {
|
void getText(scope void delegate(scope const(char)[] segment, TextStyle style) handler) {
|
||||||
handler(text, null);
|
handler(text[0 .. $-1], null); // cut off the null terminator
|
||||||
}
|
}
|
||||||
|
|
||||||
/++
|
/++
|
||||||
|
|
Loading…
Reference in New Issue