diff options
-rw-r--r-- | doc/tools/makerst.py | 30 | ||||
-rw-r--r-- | drivers/coreaudio/audio_driver_coreaudio.cpp | 2 | ||||
-rw-r--r-- | editor/editor_help.cpp | 203 | ||||
-rw-r--r-- | editor/editor_help.h | 25 | ||||
-rw-r--r-- | editor/plugins/tile_set_editor_plugin.cpp | 5 | ||||
-rw-r--r-- | platform/windows/detect.py | 4 |
6 files changed, 152 insertions, 117 deletions
diff --git a/doc/tools/makerst.py b/doc/tools/makerst.py index 492f3b6d54..9e767bf3d6 100644 --- a/doc/tools/makerst.py +++ b/doc/tools/makerst.py @@ -155,8 +155,9 @@ def rstize_text(text, cclass): # Escape * character to avoid interpreting it as emphasis pos = 0 + next_brac_pos = text.find('['); while True: - pos = text.find('*', pos) + pos = text.find('*', pos, next_brac_pos) if pos == -1: break text = text[:pos] + "\*" + text[pos + 1:] @@ -165,7 +166,7 @@ def rstize_text(text, cclass): # Escape _ character at the end of a word to avoid interpreting it as an inline hyperlink pos = 0 while True: - pos = text.find('_', pos) + pos = text.find('_', pos, next_brac_pos) if pos == -1: break if not text[pos + 1].isalnum(): # don't escape within a snake_case word @@ -264,6 +265,27 @@ def rstize_text(text, cclass): if escape_post and post_text and post_text[0].isalnum(): # not punctuation, escape post_text = '\ ' + post_text + next_brac_pos = post_text.find('[',0) + iter_pos = 0 + while not inside_code: + iter_pos = post_text.find('*', iter_pos, next_brac_pos) + if iter_pos == -1: + break + post_text = post_text[:iter_pos] + "\*" + post_text[iter_pos + 1:] + iter_pos += 2 + + iter_pos = 0 + while not inside_code: + iter_pos = post_text.find('_', iter_pos, next_brac_pos) + if iter_pos == -1: + break + if not post_text[iter_pos + 1].isalnum(): # don't escape within a snake_case word + post_text = post_text[:iter_pos] + "\_" + post_text[iter_pos + 1:] + iter_pos += 2 + else: + iter_pos += 1 + + text = pre_text + tag_text + post_text pos = len(pre_text) + len(tag_text) @@ -500,7 +522,7 @@ def make_rst_class(node): enums.append(c) else: consts.append(c) - + if len(consts) > 0: f.write(make_heading('Numeric Constants', '-')) for c in list(consts): @@ -512,7 +534,7 @@ def make_rst_class(node): s += ' --- ' + rstize_text(c.text.strip(), name) f.write(s + '\n') f.write('\n') - + if len(enum_names) > 0: f.write(make_heading('Enums', '-')) for e in enum_names: diff --git a/drivers/coreaudio/audio_driver_coreaudio.cpp b/drivers/coreaudio/audio_driver_coreaudio.cpp index 6db9aebeed..0b39f9ebc3 100644 --- a/drivers/coreaudio/audio_driver_coreaudio.cpp +++ b/drivers/coreaudio/audio_driver_coreaudio.cpp @@ -37,7 +37,7 @@ #define kOutputBus 0 #ifdef OSX_ENABLED -static OSStatus outputDeviceAddressCB(AudioObjectID inObjectID, UInt32 inNumberAddresses, const AudioObjectPropertyAddress *inAddresses, void *__nullable inClientData) { +static OSStatus outputDeviceAddressCB(AudioObjectID inObjectID, UInt32 inNumberAddresses, const AudioObjectPropertyAddress *inAddresses, void *inClientData) { AudioDriverCoreAudio *driver = (AudioDriverCoreAudio *)inClientData; driver->reopen(); diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp index 198a52fef2..7f76cf1af2 100644 --- a/editor/editor_help.cpp +++ b/editor/editor_help.cpp @@ -81,162 +81,147 @@ void EditorHelpSearch::_sbox_input(const Ref<InputEvent> &p_ie) { } } -class EditorHelpSearch::IncrementalSearch : public Reference { - String term; - TreeItem *root; +void EditorHelpSearch::IncrementalSearch::phase1(Map<String, DocData::ClassDoc>::Element *E) { - EditorHelpSearch *search; - Tree *search_options; + if (E->key().findn(term) != -1) { - DocData *doc; - Ref<Texture> def_icon; - - int phase; - Map<String, DocData::ClassDoc>::Element *iterator; - - void phase1(Map<String, DocData::ClassDoc>::Element *E) { - - if (E->key().findn(term) != -1) { - - TreeItem *item = search_options->create_item(root); - item->set_metadata(0, "class_name:" + E->key()); - item->set_text(0, E->key() + " (Class)"); - if (search->has_icon(E->key(), "EditorIcons")) - item->set_icon(0, search->get_icon(E->key(), "EditorIcons")); - else - item->set_icon(0, def_icon); - } + TreeItem *item = search_options->create_item(root); + item->set_metadata(0, "class_name:" + E->key()); + item->set_text(0, E->key() + " (Class)"); + if (search->has_icon(E->key(), "EditorIcons")) + item->set_icon(0, search->get_icon(E->key(), "EditorIcons")); + else + item->set_icon(0, def_icon); } +} - void phase2(Map<String, DocData::ClassDoc>::Element *E) { +void EditorHelpSearch::IncrementalSearch::phase2(Map<String, DocData::ClassDoc>::Element *E) { - DocData::ClassDoc &c = E->get(); + DocData::ClassDoc &c = E->get(); - Ref<Texture> cicon; - if (search->has_icon(E->key(), "EditorIcons")) - cicon = search->get_icon(E->key(), "EditorIcons"); - else - cicon = def_icon; + Ref<Texture> cicon; + if (search->has_icon(E->key(), "EditorIcons")) + cicon = search->get_icon(E->key(), "EditorIcons"); + else + cicon = def_icon; - for (int i = 0; i < c.methods.size(); i++) { - if ((term.begins_with(".") && c.methods[i].name.begins_with(term.right(1))) || (term.ends_with("(") && c.methods[i].name.ends_with(term.left(term.length() - 1).strip_edges())) || (term.begins_with(".") && term.ends_with("(") && c.methods[i].name == term.substr(1, term.length() - 2).strip_edges()) || c.methods[i].name.findn(term) != -1) { + for (int i = 0; i < c.methods.size(); i++) { + if ((term.begins_with(".") && c.methods[i].name.begins_with(term.right(1))) || (term.ends_with("(") && c.methods[i].name.ends_with(term.left(term.length() - 1).strip_edges())) || (term.begins_with(".") && term.ends_with("(") && c.methods[i].name == term.substr(1, term.length() - 2).strip_edges()) || c.methods[i].name.findn(term) != -1) { - TreeItem *item = search_options->create_item(root); - item->set_metadata(0, "class_method:" + E->key() + ":" + c.methods[i].name); - item->set_text(0, E->key() + "." + c.methods[i].name + " (Method)"); - item->set_icon(0, cicon); - } + TreeItem *item = search_options->create_item(root); + item->set_metadata(0, "class_method:" + E->key() + ":" + c.methods[i].name); + item->set_text(0, E->key() + "." + c.methods[i].name + " (Method)"); + item->set_icon(0, cicon); } + } - for (int i = 0; i < c.signals.size(); i++) { + for (int i = 0; i < c.signals.size(); i++) { - if (c.signals[i].name.findn(term) != -1) { + if (c.signals[i].name.findn(term) != -1) { - TreeItem *item = search_options->create_item(root); - item->set_metadata(0, "class_signal:" + E->key() + ":" + c.signals[i].name); - item->set_text(0, E->key() + "." + c.signals[i].name + " (Signal)"); - item->set_icon(0, cicon); - } + TreeItem *item = search_options->create_item(root); + item->set_metadata(0, "class_signal:" + E->key() + ":" + c.signals[i].name); + item->set_text(0, E->key() + "." + c.signals[i].name + " (Signal)"); + item->set_icon(0, cicon); } + } - for (int i = 0; i < c.constants.size(); i++) { + for (int i = 0; i < c.constants.size(); i++) { - if (c.constants[i].name.findn(term) != -1) { + if (c.constants[i].name.findn(term) != -1) { - TreeItem *item = search_options->create_item(root); - item->set_metadata(0, "class_constant:" + E->key() + ":" + c.constants[i].name); - item->set_text(0, E->key() + "." + c.constants[i].name + " (Constant)"); - item->set_icon(0, cicon); - } + TreeItem *item = search_options->create_item(root); + item->set_metadata(0, "class_constant:" + E->key() + ":" + c.constants[i].name); + item->set_text(0, E->key() + "." + c.constants[i].name + " (Constant)"); + item->set_icon(0, cicon); } + } - for (int i = 0; i < c.properties.size(); i++) { + for (int i = 0; i < c.properties.size(); i++) { - if (c.properties[i].name.findn(term) != -1) { + if (c.properties[i].name.findn(term) != -1) { - TreeItem *item = search_options->create_item(root); - item->set_metadata(0, "class_property:" + E->key() + ":" + c.properties[i].name); - item->set_text(0, E->key() + "." + c.properties[i].name + " (Property)"); - item->set_icon(0, cicon); - } + TreeItem *item = search_options->create_item(root); + item->set_metadata(0, "class_property:" + E->key() + ":" + c.properties[i].name); + item->set_text(0, E->key() + "." + c.properties[i].name + " (Property)"); + item->set_icon(0, cicon); } + } - for (int i = 0; i < c.theme_properties.size(); i++) { + for (int i = 0; i < c.theme_properties.size(); i++) { - if (c.theme_properties[i].name.findn(term) != -1) { + if (c.theme_properties[i].name.findn(term) != -1) { - TreeItem *item = search_options->create_item(root); - item->set_metadata(0, "class_theme_item:" + E->key() + ":" + c.theme_properties[i].name); - item->set_text(0, E->key() + "." + c.theme_properties[i].name + " (Theme Item)"); - item->set_icon(0, cicon); - } + TreeItem *item = search_options->create_item(root); + item->set_metadata(0, "class_theme_item:" + E->key() + ":" + c.theme_properties[i].name); + item->set_text(0, E->key() + "." + c.theme_properties[i].name + " (Theme Item)"); + item->set_icon(0, cicon); } } +} - bool slice() { +bool EditorHelpSearch::IncrementalSearch::slice() { - if (phase > 2) - return true; + if (phase > 2) + return true; - if (iterator) { + if (iterator) { - switch (phase) { + switch (phase) { - case 1: { - phase1(iterator); - } break; - case 2: { - phase2(iterator); - } break; - default: { - WARN_PRINT("illegal phase in IncrementalSearch"); - return true; - } + case 1: { + phase1(iterator); + } break; + case 2: { + phase2(iterator); + } break; + default: { + WARN_PRINT("illegal phase in IncrementalSearch"); + return true; } - - iterator = iterator->next(); - } else { - - phase += 1; - iterator = doc->class_list.front(); } - return false; + iterator = iterator->next(); + } else { + + phase += 1; + iterator = doc->class_list.front(); } -public: - IncrementalSearch(EditorHelpSearch *p_search, Tree *p_search_options, const String &p_term) : - search(p_search), - search_options(p_search_options) { + return false; +} - def_icon = search->get_icon("Node", "EditorIcons"); - doc = EditorHelp::get_doc_data(); +EditorHelpSearch::IncrementalSearch::IncrementalSearch(EditorHelpSearch *p_search, Tree *p_search_options, const String &p_term) : + search(p_search), + search_options(p_search_options) { - term = p_term; + def_icon = search->get_icon("Node", "EditorIcons"); + doc = EditorHelp::get_doc_data(); - root = search_options->create_item(); - phase = 0; - iterator = 0; - } + term = p_term; - bool empty() const { + root = search_options->create_item(); + phase = 0; + iterator = 0; +} - return root->get_children() == NULL; - } +bool EditorHelpSearch::IncrementalSearch::empty() const { - bool work(uint64_t slot = 1000000 / 10) { + return root->get_children() == NULL; +} - const uint64_t until = OS::get_singleton()->get_ticks_usec() + slot; +bool EditorHelpSearch::IncrementalSearch::work(uint64_t slot) { - while (!slice()) { + const uint64_t until = OS::get_singleton()->get_ticks_usec() + slot; - if (OS::get_singleton()->get_ticks_usec() > until) - return false; - } + while (!slice()) { - return true; + if (OS::get_singleton()->get_ticks_usec() > until) + return false; } -}; + + return true; +} void EditorHelpSearch::_update_search() { search_options->clear(); diff --git a/editor/editor_help.h b/editor/editor_help.h index db4c33afb0..aa84aa611f 100644 --- a/editor/editor_help.h +++ b/editor/editor_help.h @@ -54,7 +54,30 @@ class EditorHelpSearch : public ConfirmationDialog { Tree *search_options; String base_type; - class IncrementalSearch; + class IncrementalSearch : public Reference { + String term; + TreeItem *root; + + EditorHelpSearch *search; + Tree *search_options; + + DocData *doc; + Ref<Texture> def_icon; + + int phase; + Map<String, DocData::ClassDoc>::Element *iterator; + + void phase1(Map<String, DocData::ClassDoc>::Element *E); + void phase2(Map<String, DocData::ClassDoc>::Element *E); + bool slice(); + + public: + IncrementalSearch(EditorHelpSearch *p_search, Tree *p_search_options, const String &p_term); + + bool empty() const; + bool work(uint64_t slot = 1000000 / 10); + }; + Ref<IncrementalSearch> search; void _update_search(); diff --git a/editor/plugins/tile_set_editor_plugin.cpp b/editor/plugins/tile_set_editor_plugin.cpp index dd5127181d..2ff8536b4c 100644 --- a/editor/plugins/tile_set_editor_plugin.cpp +++ b/editor/plugins/tile_set_editor_plugin.cpp @@ -1023,6 +1023,9 @@ void AutotileEditor::_on_workspace_input(const Ref<InputEvent> &p_ie) { } } } else if (tools[SHAPE_NEW_POLYGON]->is_pressed()) { + if (!tools[TOOL_SELECT]->is_disabled()) + tools[TOOL_SELECT]->set_disabled(true); + if (mb.is_valid()) { if (mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) { Vector2 pos = mb->get_position(); @@ -1089,6 +1092,8 @@ void AutotileEditor::_on_workspace_input(const Ref<InputEvent> &p_ie) { } else if (mb->is_pressed() && mb->get_button_index() == BUTTON_RIGHT && current_shape.size() > 2) { if (creating_shape) { close_shape(shape_anchor); + if (tools[TOOL_SELECT]->is_disabled()) + tools[TOOL_SELECT]->set_disabled(false); } } } else if (mm.is_valid()) { diff --git a/platform/windows/detect.py b/platform/windows/detect.py index 2b3743b066..b8a9ed482c 100644 --- a/platform/windows/detect.py +++ b/platform/windows/detect.py @@ -179,7 +179,7 @@ def configure(env): if env["bits"] == "64": env.Append(CCFLAGS=['/D_WIN64']) - LIBS = ['winmm', 'opengl32', 'dsound', 'kernel32', 'ole32', 'oleaut32', 'user32', 'gdi32', 'IPHLPAPI', 'Shlwapi', 'wsock32', 'Ws2_32', 'shell32', 'advapi32', 'dinput8', 'dxguid', 'Imm32'] + LIBS = ['winmm', 'opengl32', 'dsound', 'kernel32', 'ole32', 'oleaut32', 'user32', 'gdi32', 'IPHLPAPI', 'Shlwapi', 'wsock32', 'Ws2_32', 'shell32', 'advapi32', 'dinput8', 'dxguid', 'imm32'] env.Append(LINKFLAGS=[p + env["LIBSUFFIX"] for p in LIBS]) env.Append(LIBPATH=[os.getenv("WindowsSdkDir") + "/Lib"]) @@ -281,7 +281,7 @@ def configure(env): env.Append(CCFLAGS=['-DRTAUDIO_ENABLED']) env.Append(CCFLAGS=['-DWASAPI_ENABLED']) env.Append(CCFLAGS=['-DWINVER=%s' % env['target_win_version'], '-D_WIN32_WINNT=%s' % env['target_win_version']]) - env.Append(LIBS=['mingw32', 'opengl32', 'dsound', 'ole32', 'd3d9', 'winmm', 'gdi32', 'iphlpapi', 'shlwapi', 'wsock32', 'ws2_32', 'kernel32', 'oleaut32', 'dinput8', 'dxguid', 'ksuser', 'Imm32']) + env.Append(LIBS=['mingw32', 'opengl32', 'dsound', 'ole32', 'd3d9', 'winmm', 'gdi32', 'iphlpapi', 'shlwapi', 'wsock32', 'ws2_32', 'kernel32', 'oleaut32', 'dinput8', 'dxguid', 'ksuser', 'imm32']) env.Append(CPPFLAGS=['-DMINGW_ENABLED']) |