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,87 +875,90 @@ 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"));
|
const auto tick_code_it = m_ticks.ticks.find(TickCode{tick});
|
||||||
if (icon_focus == ifCog)
|
|
||||||
tooltip = _(L("Set extruder sequence for whole print"));
|
if (tick_code_it == m_ticks.ticks.end() && focused_item == fiActionIcon) // tick doesn't exist
|
||||||
else if (m_is_action_icon_focesed)
|
|
||||||
{
|
{
|
||||||
const int tick = m_selection == ssLower ? m_lower_value : m_higher_value;
|
// Show mode as a first string of tooltop
|
||||||
const auto tick_code_it = m_ticks.ticks.find(TickCode{tick});
|
tooltip = " " + _(L("Slider(print) mode")) + ": ";
|
||||||
|
tooltip += (m_mode == t_mode::SingleExtruder ? CustomGCode::SingleExtruderMode :
|
||||||
|
m_mode == t_mode::MultiAsSingle ? CustomGCode::MultiAsSingleMode :
|
||||||
|
CustomGCode::MultiExtruderMode );
|
||||||
|
tooltip += "\n\n";
|
||||||
|
|
||||||
/* Note: just on OSX!!!
|
/* Note: just on OSX!!!
|
||||||
* Right click event causes a little scrolling.
|
* Right click event causes a little scrolling.
|
||||||
* So, as a workaround we use Ctrl+LeftMouseClick instead of RightMouseClick
|
* So, as a workaround we use Ctrl+LeftMouseClick instead of RightMouseClick
|
||||||
* Show this information in tooltip
|
* Show this information in tooltip
|
||||||
* */
|
* */
|
||||||
|
|
||||||
if (tick_code_it == m_ticks.ticks.end()) // tick doesn't exist
|
// Show list of actions with new tick
|
||||||
{
|
tooltip += ( m_mode == t_mode::MultiAsSingle ?
|
||||||
// Show mode as a first string of tooltop
|
_(L("For add change extruder use left mouse button click")) :
|
||||||
tooltip = " " + _(L("Slider(print) mode")) + ": ";
|
_(L("For add color change use left mouse button click")) ) + " " +
|
||||||
tooltip += (m_mode == t_mode::SingleExtruder ? CustomGCode::SingleExtruderMode :
|
_(L("OR pres \"+\" key")) + "\n" + (
|
||||||
m_mode == t_mode::MultiAsSingle ? CustomGCode::MultiAsSingleMode :
|
is_osx ?
|
||||||
CustomGCode::MultiExtruderMode );
|
_(L("For add another code use Ctrl + Left mouse button click")) :
|
||||||
tooltip += "\n\n";
|
_(L("For add another code use right mouse button click")) );
|
||||||
|
|
||||||
// Show list of actions with new tick
|
|
||||||
tooltip += ( m_mode == t_mode::MultiAsSingle ?
|
|
||||||
_(L("For add change extruder use left mouse button click")) :
|
|
||||||
_(L("For add color change use left mouse button click")) ) + " " +
|
|
||||||
_(L("OR pres \"+\" key")) + "\n" + (
|
|
||||||
is_osx ?
|
|
||||||
_(L("For add another code use Ctrl + Left mouse button click")) :
|
|
||||||
_(L("For add another code use right mouse button click")) );
|
|
||||||
}
|
|
||||||
else // tick exists
|
|
||||||
{
|
|
||||||
// Show custom Gcode as a first string of tooltop
|
|
||||||
tooltip = " ";
|
|
||||||
tooltip += tick_code_it->gcode == ColorChangeCode ? (
|
|
||||||
m_mode == t_mode::SingleExtruder ?
|
|
||||||
from_u8((boost::format(_utf8(L("Color change (\"%1%\")"))) % tick_code_it->gcode ).str()) :
|
|
||||||
from_u8((boost::format(_utf8(L("Color change (\"%1%\") for Extruder %2%"))) %
|
|
||||||
tick_code_it->gcode % tick_code_it->extruder).str()) ) :
|
|
||||||
tick_code_it->gcode == PausePrintCode ?
|
|
||||||
from_u8((boost::format(_utf8(L("Pause print (\"%1%\")"))) % tick_code_it->gcode ).str()) :
|
|
||||||
tick_code_it->gcode == ToolChangeCode ?
|
|
||||||
from_u8((boost::format(_utf8(L("Extruder(tool) is changed to Extruder \"%1%\""))) % tick_code_it->extruder ).str()) :
|
|
||||||
from_u8((boost::format(_utf8(L("\"%1%\""))) % tick_code_it->gcode ).str()) ;
|
|
||||||
|
|
||||||
// If tick is marked as a conflict (exclamation icon),
|
|
||||||
// we should to explain why
|
|
||||||
ConflictType conflict = m_ticks.is_conflict_tick(*tick_code_it, m_mode, m_only_extruder, m_values[tick]);
|
|
||||||
if (conflict != ctNone)
|
|
||||||
tooltip += "\n\n" + _(L("Note")) + "! ";
|
|
||||||
if (conflict == ctModeConflict)
|
|
||||||
tooltip += _(L("G-code of this tick has a conflict with slider(print) mode.\n"
|
|
||||||
"Any its editing will cause a changes of DoubleSlider data."));
|
|
||||||
else if (conflict == ctMeaninglessColorChange)
|
|
||||||
tooltip += _(L("There is a color change for extruder that wouldn't be used till the end of printing.\n"
|
|
||||||
"This code wouldn't be processed during GCode generation."));
|
|
||||||
else if (conflict == ctMeaninglessToolChange)
|
|
||||||
tooltip += _(L("There is a extruder change to the same extruder.\n"
|
|
||||||
"This code wouldn't be processed during GCode generation."));
|
|
||||||
else if (conflict == ctRedundant)
|
|
||||||
tooltip += _(L("There is a color change for extruder that has not been used before.\n"
|
|
||||||
"Check your choice to avoid redundant color changes."));
|
|
||||||
|
|
||||||
// Show list of actions with existing tick
|
|
||||||
tooltip += "\n\n" + _(L("For Delete tick use left mouse button click OR pres \"-\" key")) + "\n" + (
|
|
||||||
is_osx ?
|
|
||||||
_(L("For Edit tick use Ctrl + Left mouse button click")) :
|
|
||||||
_(L("For Edit tick use right mouse button click")) );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (tick_code_it != m_ticks.ticks.end()) // tick exists
|
||||||
|
{
|
||||||
|
// Show custom Gcode as a first string of tooltop
|
||||||
|
tooltip = " ";
|
||||||
|
tooltip += tick_code_it->gcode == ColorChangeCode ? (
|
||||||
|
m_mode == t_mode::SingleExtruder ?
|
||||||
|
from_u8((boost::format(_utf8(L("Color change (\"%1%\")"))) % tick_code_it->gcode ).str()) :
|
||||||
|
from_u8((boost::format(_utf8(L("Color change (\"%1%\") for Extruder %2%"))) %
|
||||||
|
tick_code_it->gcode % tick_code_it->extruder).str()) ) :
|
||||||
|
tick_code_it->gcode == PausePrintCode ?
|
||||||
|
from_u8((boost::format(_utf8(L("Pause print (\"%1%\")"))) % tick_code_it->gcode ).str()) :
|
||||||
|
tick_code_it->gcode == ToolChangeCode ?
|
||||||
|
from_u8((boost::format(_utf8(L("Extruder(tool) is changed to Extruder \"%1%\""))) % tick_code_it->extruder ).str()) :
|
||||||
|
from_u8((boost::format(_utf8(L("\"%1%\""))) % tick_code_it->gcode ).str()) ;
|
||||||
|
|
||||||
|
// If tick is marked as a conflict (exclamation icon),
|
||||||
|
// we should to explain why
|
||||||
|
ConflictType conflict = m_ticks.is_conflict_tick(*tick_code_it, m_mode, m_only_extruder, m_values[tick]);
|
||||||
|
if (conflict != ctNone)
|
||||||
|
tooltip += "\n\n" + _(L("Note")) + "! ";
|
||||||
|
if (conflict == ctModeConflict)
|
||||||
|
tooltip += _(L("G-code of this tick has a conflict with slider(print) mode.\n"
|
||||||
|
"Any its editing will cause a changes of DoubleSlider data."));
|
||||||
|
else if (conflict == ctMeaninglessColorChange)
|
||||||
|
tooltip += _(L("There is a color change for extruder that wouldn't be used till the end of printing.\n"
|
||||||
|
"This code wouldn't be processed during GCode generation."));
|
||||||
|
else if (conflict == ctMeaninglessToolChange)
|
||||||
|
tooltip += _(L("There is a extruder change to the same extruder.\n"
|
||||||
|
"This code wouldn't be processed during GCode generation."));
|
||||||
|
else if (conflict == ctRedundant)
|
||||||
|
tooltip += _(L("There is a color change for extruder that has not been used before.\n"
|
||||||
|
"Check your choice to avoid redundant color changes."));
|
||||||
|
|
||||||
|
// 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" + (
|
||||||
|
is_osx ?
|
||||||
|
_(L("For Edit tick use Ctrl + Left 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
Reference in a new issue