Search: 1. The position of the search window is in the middle of the scene.
2. When "Search in English" is checked, then search in English names too. 3. Added score value at the end of option name -> [score_value] 4. Set focus to the Plater, when switch from some tab with focused field to the Plater and search window is shown. 5. For the mode, when settings are in non-modal dialog, neither dialog nor tabpanel doesn't receive wxEVT_KEY_UP event, when some field is selected. So, like a workaround we check wxEVT_KEY_UP event for the Filed and switch between tabs if Ctrl+(1-4) was pressed + PreferencesDialog: fixed a control of the difference in layout modes
This commit is contained in:
parent
3a6bc2e31a
commit
559f9279d9
@ -79,6 +79,29 @@ void Field::PostInitialize()
|
||||
m_em_unit = em_unit(m_parent);
|
||||
|
||||
BUILD();
|
||||
|
||||
// For the mode, when settings are in non-modal dialog, neither dialog nor tabpanel doesn't receive wxEVT_KEY_UP event, when some field is selected.
|
||||
// So, like a workaround check wxEVT_KEY_UP event for the Filed and switch between tabs if Ctrl+(1-4) was pressed
|
||||
if (getWindow())
|
||||
getWindow()->Bind(wxEVT_KEY_UP, [](wxKeyEvent& evt) {
|
||||
if ((evt.GetModifiers() & wxMOD_CONTROL) != 0) {
|
||||
int tab_id = -1;
|
||||
switch (evt.GetKeyCode()) {
|
||||
case '1': { tab_id = 0; break; }
|
||||
case '2': { tab_id = 1; break; }
|
||||
case '3': { tab_id = 2; break; }
|
||||
case '4': { tab_id = 3; break; }
|
||||
default: break;
|
||||
}
|
||||
if (tab_id >= 0)
|
||||
wxGetApp().mainframe->select_tab(tab_id);
|
||||
if (tab_id > 0)
|
||||
// tab panel should be focused for correct navigation between tabs
|
||||
wxGetApp().tab_panel()->SetFocus();
|
||||
}
|
||||
|
||||
evt.Skip();
|
||||
});
|
||||
}
|
||||
|
||||
// Values of width to alignments of fields
|
||||
@ -397,7 +420,7 @@ void TextCtrl::BUILD() {
|
||||
bKilledFocus = false;
|
||||
#endif // __WXOSX__
|
||||
}), temp->GetId());
|
||||
|
||||
/*
|
||||
// select all text using Ctrl+A
|
||||
temp->Bind(wxEVT_CHAR, ([temp](wxKeyEvent& event)
|
||||
{
|
||||
@ -405,7 +428,7 @@ void TextCtrl::BUILD() {
|
||||
temp->SetSelection(-1, -1); //select all
|
||||
event.Skip();
|
||||
}));
|
||||
|
||||
*/
|
||||
// recast as a wxWindow to fit the calling convention
|
||||
window = dynamic_cast<wxWindow*>(temp);
|
||||
}
|
||||
|
@ -4391,7 +4391,7 @@ bool GLCanvas3D::_render_search_list(float pos_x) const
|
||||
bool action_taken = false;
|
||||
ImGuiWrapper* imgui = wxGetApp().imgui();
|
||||
|
||||
const float x = pos_x * (float)wxGetApp().plater()->get_camera().get_zoom() + 0.5f * (float)get_canvas_size().get_width();
|
||||
const float x = /*pos_x * (float)wxGetApp().plater()->get_camera().get_zoom() + */0.5f * (float)get_canvas_size().get_width();
|
||||
imgui->set_next_window_pos(x, m_main_toolbar.get_height(), ImGuiCond_Always, 0.5f, 0.0f);
|
||||
std::string title = L("Search");
|
||||
imgui->begin(_(title), ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse);
|
||||
@ -7143,9 +7143,14 @@ bool GLCanvas3D::_deactivate_undo_redo_toolbar_items()
|
||||
return false;
|
||||
}
|
||||
|
||||
bool GLCanvas3D::is_search_pressed() const
|
||||
{
|
||||
return m_main_toolbar.is_item_pressed("search");
|
||||
}
|
||||
|
||||
bool GLCanvas3D::_deactivate_search_toolbar_item()
|
||||
{
|
||||
if (m_main_toolbar.is_item_pressed("search"))
|
||||
if (is_search_pressed())
|
||||
{
|
||||
m_main_toolbar.force_left_action(m_main_toolbar.get_item_id("search"), *this);
|
||||
return true;
|
||||
|
@ -574,6 +574,7 @@ public:
|
||||
|
||||
bool is_layers_editing_enabled() const;
|
||||
bool is_layers_editing_allowed() const;
|
||||
bool is_search_pressed() const;
|
||||
|
||||
void reset_layer_height_profile();
|
||||
void adaptive_layer_height_profile(float quality_factor);
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include "RemovableDriveManager.hpp"
|
||||
#include "InstanceCheck.hpp"
|
||||
#include "I18N.hpp"
|
||||
#include "GLCanvas3D.hpp"
|
||||
|
||||
#include <fstream>
|
||||
#include "GUI_App.hpp"
|
||||
@ -1263,6 +1264,9 @@ void MainFrame::select_tab(size_t tab/* = size_t(-1)*/)
|
||||
if (tab==0) {
|
||||
if (m_settings_dialog->IsShown())
|
||||
this->SetFocus();
|
||||
// plater should be focused for correct navigation inside search window
|
||||
if (m_plater->canvas3D()->is_search_pressed())
|
||||
m_plater->SetFocus();
|
||||
return;
|
||||
}
|
||||
// Show/Activate Settings Dialog
|
||||
@ -1278,6 +1282,10 @@ void MainFrame::select_tab(size_t tab/* = size_t(-1)*/)
|
||||
else if (m_layout == slNew) {
|
||||
m_plater->Show(tab == 0);
|
||||
m_tabpanel->Show(tab != 0);
|
||||
|
||||
// plater should be focused for correct navigation inside search window
|
||||
if (tab == 0 && m_plater->canvas3D()->is_search_pressed())
|
||||
m_plater->SetFocus();
|
||||
Layout();
|
||||
}
|
||||
|
||||
|
@ -5364,6 +5364,9 @@ void Plater::paste_from_clipboard()
|
||||
void Plater::search(bool plater_is_active)
|
||||
{
|
||||
if (plater_is_active) {
|
||||
// plater should be focused for correct navigation inside search window
|
||||
this->SetFocus();
|
||||
|
||||
wxKeyEvent evt;
|
||||
#ifdef __APPLE__
|
||||
evt.m_keyCode = 'f';
|
||||
|
@ -190,9 +190,17 @@ void PreferencesDialog::accept()
|
||||
|
||||
auto app_config = get_app_config();
|
||||
|
||||
m_settings_layout_changed = m_values.find("old_settings_layout_mode") != m_values.end() ||
|
||||
m_values.find("new_settings_layout_mode") != m_values.end() ||
|
||||
m_values.find("dlg_settings_layout_mode") != m_values.end();
|
||||
m_settings_layout_changed = false;
|
||||
for (const std::string& key : {"old_settings_layout_mode",
|
||||
"new_settings_layout_mode",
|
||||
"dlg_settings_layout_mode" })
|
||||
{
|
||||
auto it = m_values.find(key);
|
||||
if (it != m_values.end() && app_config->get(key) != it->second) {
|
||||
m_settings_layout_changed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_settings_layout_changed) {
|
||||
// the dialog needs to be destroyed before the call to recreate_gui()
|
||||
|
@ -262,13 +262,14 @@ bool OptionsSearcher::search(const std::string& search, bool force/* = false*/)
|
||||
append(matches, matches2);
|
||||
score = score2;
|
||||
}
|
||||
if (fuzzy_match(wsearch, label_english, score2, matches2) && score2 > score) {
|
||||
if (view_params.english && fuzzy_match(wsearch, label_english, score2, matches2) && score2 > score) {
|
||||
label = std::move(label_english);
|
||||
matches = std::move(matches2);
|
||||
score = score2;
|
||||
}
|
||||
if (score > std::numeric_limits<int>::min()) {
|
||||
label = mark_string(label, matches);
|
||||
label = mark_string(label, matches);
|
||||
label += L" [" + std::to_wstring(score) + L"]";// add score value
|
||||
std::string label_u8 = into_u8(label);
|
||||
std::string label_plain = label_u8;
|
||||
boost::erase_all(label_plain, std::string(1, char(ImGui::ColorMarkerStart)));
|
||||
|
Loading…
Reference in New Issue
Block a user