mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-18 20:28:08 -06:00
Show tooltip for all hovered ticks, not just for a selected one
This commit is contained in:
parent
0da4cb29b5
commit
49c5822be4
2 changed files with 98 additions and 79 deletions
|
@ -875,28 +875,24 @@ void Control::correct_higher_value()
|
||||||
m_lower_value = m_higher_value;
|
m_lower_value = m_higher_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString Control::get_tooltip(IconFocus icon_focus)
|
wxString Control::get_tooltip(FocusItem focused_item, int tick/*=-1*/)
|
||||||
{
|
{
|
||||||
wxString tooltip(wxEmptyString);
|
if (focused_item == fiNone)
|
||||||
if (m_is_one_layer_icon_focesed)
|
return "";
|
||||||
tooltip = _(L("One layer mode"));
|
if (focused_item == fiOneLayerIcon)
|
||||||
|
return _(L("One layer mode"));
|
||||||
|
if (focused_item == fiRevertIcon)
|
||||||
|
return _(L("Discard all custom changes"));
|
||||||
|
if (focused_item == fiCogIcon)
|
||||||
|
return _(L("Set extruder sequence for whole print"));
|
||||||
|
if (focused_item == fiColorBand)
|
||||||
|
return m_mode != t_mode::SingleExtruder ? "" :
|
||||||
|
_(L("For edit current color use Right(Double) mouse click on colored band"));
|
||||||
|
|
||||||
if (icon_focus == ifRevert)
|
wxString tooltip;
|
||||||
tooltip = _(L("Discard all custom changes"));
|
|
||||||
if (icon_focus == ifCog)
|
|
||||||
tooltip = _(L("Set extruder sequence for whole print"));
|
|
||||||
else if (m_is_action_icon_focesed)
|
|
||||||
{
|
|
||||||
const int tick = m_selection == ssLower ? m_lower_value : m_higher_value;
|
|
||||||
const auto tick_code_it = m_ticks.ticks.find(TickCode{tick});
|
const auto tick_code_it = m_ticks.ticks.find(TickCode{tick});
|
||||||
|
|
||||||
/* Note: just on OSX!!!
|
if (tick_code_it == m_ticks.ticks.end() && focused_item == fiActionIcon) // tick doesn't exist
|
||||||
* Right click event causes a little scrolling.
|
|
||||||
* So, as a workaround we use Ctrl+LeftMouseClick instead of RightMouseClick
|
|
||||||
* Show this information in tooltip
|
|
||||||
* */
|
|
||||||
|
|
||||||
if (tick_code_it == m_ticks.ticks.end()) // tick doesn't exist
|
|
||||||
{
|
{
|
||||||
// Show mode as a first string of tooltop
|
// Show mode as a first string of tooltop
|
||||||
tooltip = " " + _(L("Slider(print) mode")) + ": ";
|
tooltip = " " + _(L("Slider(print) mode")) + ": ";
|
||||||
|
@ -905,6 +901,12 @@ wxString Control::get_tooltip(IconFocus icon_focus)
|
||||||
CustomGCode::MultiExtruderMode );
|
CustomGCode::MultiExtruderMode );
|
||||||
tooltip += "\n\n";
|
tooltip += "\n\n";
|
||||||
|
|
||||||
|
/* Note: just on OSX!!!
|
||||||
|
* Right click event causes a little scrolling.
|
||||||
|
* So, as a workaround we use Ctrl+LeftMouseClick instead of RightMouseClick
|
||||||
|
* Show this information in tooltip
|
||||||
|
* */
|
||||||
|
|
||||||
// Show list of actions with new tick
|
// Show list of actions with new tick
|
||||||
tooltip += ( m_mode == t_mode::MultiAsSingle ?
|
tooltip += ( m_mode == t_mode::MultiAsSingle ?
|
||||||
_(L("For add change extruder use left mouse button click")) :
|
_(L("For add change extruder use left mouse button click")) :
|
||||||
|
@ -914,7 +916,8 @@ wxString Control::get_tooltip(IconFocus icon_focus)
|
||||||
_(L("For add another code use Ctrl + Left mouse button click")) :
|
_(L("For add another code use Ctrl + Left mouse button click")) :
|
||||||
_(L("For add another code use right mouse button click")) );
|
_(L("For add another code use right mouse button click")) );
|
||||||
}
|
}
|
||||||
else // tick exists
|
|
||||||
|
if (tick_code_it != m_ticks.ticks.end()) // tick exists
|
||||||
{
|
{
|
||||||
// Show custom Gcode as a first string of tooltop
|
// Show custom Gcode as a first string of tooltop
|
||||||
tooltip = " ";
|
tooltip = " ";
|
||||||
|
@ -948,14 +951,14 @@ wxString Control::get_tooltip(IconFocus icon_focus)
|
||||||
"Check your choice to avoid redundant color changes."));
|
"Check your choice to avoid redundant color changes."));
|
||||||
|
|
||||||
// Show list of actions with existing tick
|
// Show list of actions with existing tick
|
||||||
|
if (focused_item == fiActionIcon)
|
||||||
tooltip += "\n\n" + _(L("For Delete tick use left mouse button click OR pres \"-\" key")) + "\n" + (
|
tooltip += "\n\n" + _(L("For Delete tick use left mouse button click OR pres \"-\" key")) + "\n" + (
|
||||||
is_osx ?
|
is_osx ?
|
||||||
_(L("For Edit tick use Ctrl + Left mouse button click")) :
|
_(L("For Edit tick use Ctrl + Left mouse button click")) :
|
||||||
_(L("For Edit tick use right mouse button click")) );
|
_(L("For Edit tick use right mouse button click")) );
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return tooltip;
|
return tooltip;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Control::OnMotion(wxMouseEvent& event)
|
void Control::OnMotion(wxMouseEvent& event)
|
||||||
|
@ -966,14 +969,26 @@ void Control::OnMotion(wxMouseEvent& event)
|
||||||
const wxPoint pos = event.GetLogicalPosition(dc);
|
const wxPoint pos = event.GetLogicalPosition(dc);
|
||||||
|
|
||||||
m_is_one_layer_icon_focesed = is_point_in_rect(pos, m_rect_one_layer_icon);
|
m_is_one_layer_icon_focesed = is_point_in_rect(pos, m_rect_one_layer_icon);
|
||||||
IconFocus icon_focus = ifNone;
|
|
||||||
|
FocusItem focused_item = fiNone;
|
||||||
|
int tick = -1;
|
||||||
|
|
||||||
if (!m_is_left_down && !m_is_one_layer) {
|
if (!m_is_left_down && !m_is_one_layer) {
|
||||||
m_is_action_icon_focesed = is_point_in_rect(pos, m_rect_tick_action);
|
m_is_action_icon_focesed = is_point_in_rect(pos, m_rect_tick_action);
|
||||||
if (!m_ticks.empty() && is_point_in_rect(pos, m_rect_revert_icon))
|
if (m_is_one_layer_icon_focesed)
|
||||||
icon_focus = ifRevert;
|
focused_item = fiOneLayerIcon;
|
||||||
|
else if (m_is_action_icon_focesed) {
|
||||||
|
focused_item = fiActionIcon;
|
||||||
|
tick = m_selection == ssLower ? m_lower_value : m_higher_value;
|
||||||
|
}
|
||||||
|
else if (!m_ticks.empty() && is_point_in_rect(pos, m_rect_revert_icon))
|
||||||
|
focused_item = fiRevertIcon;
|
||||||
else if (is_point_in_rect(pos, m_rect_cog_icon))
|
else if (is_point_in_rect(pos, m_rect_cog_icon))
|
||||||
icon_focus = ifCog;
|
focused_item = fiCogIcon;
|
||||||
|
else {
|
||||||
|
focused_item = fiTick;
|
||||||
|
tick = get_tick_near_point(pos);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (m_is_left_down || m_is_right_down) {
|
else if (m_is_left_down || m_is_right_down) {
|
||||||
if (m_selection == ssLower) {
|
if (m_selection == ssLower) {
|
||||||
|
@ -994,7 +1009,7 @@ void Control::OnMotion(wxMouseEvent& event)
|
||||||
event.Skip();
|
event.Skip();
|
||||||
|
|
||||||
// Set tooltips with information for each icon
|
// Set tooltips with information for each icon
|
||||||
this->SetToolTip(get_tooltip(icon_focus));
|
this->SetToolTip(get_tooltip(focused_item, tick));
|
||||||
|
|
||||||
if (action)
|
if (action)
|
||||||
{
|
{
|
||||||
|
|
|
@ -33,10 +33,14 @@ enum SelectedSlider {
|
||||||
ssHigher
|
ssHigher
|
||||||
};
|
};
|
||||||
|
|
||||||
enum IconFocus {
|
enum FocusItem {
|
||||||
ifNone,
|
fiNone,
|
||||||
ifRevert,
|
fiRevertIcon,
|
||||||
ifCog
|
fiOneLayerIcon,
|
||||||
|
fiCogIcon,
|
||||||
|
fiColorBand,
|
||||||
|
fiActionIcon,
|
||||||
|
fiTick
|
||||||
};
|
};
|
||||||
|
|
||||||
enum ConflictType
|
enum ConflictType
|
||||||
|
@ -263,7 +267,7 @@ private:
|
||||||
wxSize get_size();
|
wxSize get_size();
|
||||||
void get_size(int *w, int *h);
|
void get_size(int *w, int *h);
|
||||||
double get_double_value(const SelectedSlider& selection);
|
double get_double_value(const SelectedSlider& selection);
|
||||||
wxString get_tooltip(IconFocus icon_focus);
|
wxString get_tooltip(FocusItem focused_item, int tick = -1);
|
||||||
|
|
||||||
std::string get_color_for_tool_change_tick(std::set<TickCode>::const_iterator it) const;
|
std::string get_color_for_tool_change_tick(std::set<TickCode>::const_iterator it) const;
|
||||||
std::string get_color_for_color_change_tick(std::set<TickCode>::const_iterator it) const;
|
std::string get_color_for_color_change_tick(std::set<TickCode>::const_iterator it) const;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue