mirror of https://github.com/buggins/dlangui.git
parent
cfb0e63145
commit
3ea66645b8
|
@ -3130,7 +3130,7 @@ class EditBox : EditWidgetBase {
|
||||||
/// create find panel
|
/// create find panel
|
||||||
protected void createFindPanel(bool selectionOnly, bool replaceMode) {
|
protected void createFindPanel(bool selectionOnly, bool replaceMode) {
|
||||||
if (_findPanel) {
|
if (_findPanel) {
|
||||||
closeFindPanel();
|
closeFindPanel(false);
|
||||||
}
|
}
|
||||||
dstring txt = selectionText(true);
|
dstring txt = selectionText(true);
|
||||||
_findPanel = new FindPanel(this, selectionOnly, replaceMode, txt);
|
_findPanel = new FindPanel(this, selectionOnly, replaceMode, txt);
|
||||||
|
@ -3142,14 +3142,19 @@ class EditBox : EditWidgetBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// close find panel
|
/// close find panel
|
||||||
protected void closeFindPanel() {
|
protected void closeFindPanel(bool hideOnly = true) {
|
||||||
if (_findPanel) {
|
if (_findPanel) {
|
||||||
|
setFocus();
|
||||||
|
if (hideOnly) {
|
||||||
|
_findPanel.visibility = Visibility.Gone;
|
||||||
|
} else {
|
||||||
removeChild(_findPanel);
|
removeChild(_findPanel);
|
||||||
destroy(_findPanel);
|
destroy(_findPanel);
|
||||||
_findPanel = null;
|
_findPanel = null;
|
||||||
requestLayout();
|
requestLayout();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Draw widget at its position to buffer
|
/// Draw widget at its position to buffer
|
||||||
override void onDraw(DrawBuf buf) {
|
override void onDraw(DrawBuf buf) {
|
||||||
|
@ -3323,12 +3328,14 @@ class FindPanel : HorizontalLayout {
|
||||||
_cbCaseSensitive = childById!ImageCheckButton("cbCaseSensitive");
|
_cbCaseSensitive = childById!ImageCheckButton("cbCaseSensitive");
|
||||||
_cbWholeWords = childById!ImageCheckButton("cbWholeWords");
|
_cbWholeWords = childById!ImageCheckButton("cbWholeWords");
|
||||||
_cbSelection = childById!CheckBox("cbSelection");
|
_cbSelection = childById!CheckBox("cbSelection");
|
||||||
|
_cbCaseSensitive.checkChange = &onCaseSensitiveCheckChange;
|
||||||
if (!replace)
|
if (!replace)
|
||||||
childById("replace").visibility = Visibility.Gone;
|
childById("replace").visibility = Visibility.Gone;
|
||||||
//_edFind = new EditLine("edFind"
|
//_edFind = new EditLine("edFind"
|
||||||
dstring currentText = _edFind.text;
|
dstring currentText = _edFind.text;
|
||||||
Log.d("currentText=", currentText);
|
Log.d("currentText=", currentText);
|
||||||
setDirection(false);
|
setDirection(false);
|
||||||
|
updateHighlight();
|
||||||
}
|
}
|
||||||
void activate() {
|
void activate() {
|
||||||
_edFind.setFocus();
|
_edFind.setFocus();
|
||||||
|
@ -3389,13 +3396,29 @@ class FindPanel : HorizontalLayout {
|
||||||
dstring currentText = _edFind.text;
|
dstring currentText = _edFind.text;
|
||||||
Log.d("findNext text=", currentText, " back=", back);
|
Log.d("findNext text=", currentText, " back=", back);
|
||||||
_editor.setTextToHighlight(currentText, _cbCaseSensitive.checked);
|
_editor.setTextToHighlight(currentText, _cbCaseSensitive.checked);
|
||||||
|
TextPosition pos = _editor.caretPos;
|
||||||
|
bool res = _editor.findNextPattern(pos, currentText, _cbCaseSensitive.checked, back ? -1 : 1);
|
||||||
|
if (res) {
|
||||||
|
_editor.setCaretPos(pos.line, pos.pos, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void updateHighlight() {
|
||||||
|
dstring currentText = _edFind.text;
|
||||||
|
Log.d("onFindTextChange.currentText=", currentText);
|
||||||
|
_editor.setTextToHighlight(currentText, _cbCaseSensitive.checked);
|
||||||
}
|
}
|
||||||
|
|
||||||
void onFindTextChange(EditableContent source) {
|
void onFindTextChange(EditableContent source) {
|
||||||
Log.d("onFindTextChange");
|
Log.d("onFindTextChange");
|
||||||
dstring currentText = _edFind.text;
|
updateHighlight();
|
||||||
Log.d("onFindTextChange.currentText=", currentText);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool onCaseSensitiveCheckChange(Widget source, bool checkValue) {
|
||||||
|
updateHighlight();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool onFindEditorAction(const Action action) {
|
bool onFindEditorAction(const Action action) {
|
||||||
Log.d("onFindEditorAction ", action);
|
Log.d("onFindEditorAction ", action);
|
||||||
if (action.id == EditorActions.InsertNewLine) {
|
if (action.id == EditorActions.InsertNewLine) {
|
||||||
|
|
|
@ -12,8 +12,8 @@
|
||||||
<color id="editor_matching_bracket_highlight" value="#60FFE0B0"/>
|
<color id="editor_matching_bracket_highlight" value="#60FFE0B0"/>
|
||||||
<color id="editor_selection_focused" value="#B060A0FF"/>
|
<color id="editor_selection_focused" value="#B060A0FF"/>
|
||||||
<color id="editor_selection_normal" value="#D060A0FF"/>
|
<color id="editor_selection_normal" value="#D060A0FF"/>
|
||||||
<color id="editor_search_highlight_current" value="#808080FF"/>
|
<color id="editor_search_highlight_current" value="#60FFC040"/>
|
||||||
<color id="editor_search_highlight_other" value="#C08080FF"/>
|
<color id="editor_search_highlight_other" value="#90F0D080"/>
|
||||||
<color id="editor_left_pane_background" value="#F4F4F4"/>
|
<color id="editor_left_pane_background" value="#F4F4F4"/>
|
||||||
<color id="editor_left_pane_background2" value="#FFFFFF"/>
|
<color id="editor_left_pane_background2" value="#FFFFFF"/>
|
||||||
<color id="editor_left_pane_background3" value="#F0F0F0"/>
|
<color id="editor_left_pane_background3" value="#F0F0F0"/>
|
||||||
|
|
Loading…
Reference in New Issue