Hint notification

changes in hints.ini
Hint notification: Just one button in Help menu.
Hint notification: New naming - Tip of the day
Notifications: no scrolling.
Hint notification: fadeout colors.
This commit is contained in:
David Kocik 2021-08-11 17:14:47 +02:00
parent fc1054c61d
commit 4df2c969a5
6 changed files with 23 additions and 61 deletions

View file

@ -662,11 +662,7 @@ void NotificationManager::HintNotification::render_close_button(ImGuiWrapper& im
close();
}
ImGui::PopStyleColor();
ImGui::PopStyleColor();
ImGui::PopStyleColor();
ImGui::PopStyleColor();
ImGui::PopStyleColor();
ImGui::PopStyleColor(5);
//render_right_arrow_button(imgui, win_size_x, win_size_y, win_pos_x, win_pos_y);
@ -722,11 +718,7 @@ void NotificationManager::HintNotification::render_preferences_button(ImGuiWrapp
wxGetApp().open_preferences(2);
}
ImGui::PopStyleColor();
ImGui::PopStyleColor();
ImGui::PopStyleColor();
ImGui::PopStyleColor();
ImGui::PopStyleColor();
ImGui::PopStyleColor(5);
// preferences button is in place of minimize button
m_minimize_b_visible = true;
}
@ -758,11 +750,7 @@ void NotificationManager::HintNotification::render_right_arrow_button(ImGuiWrapp
retrieve_data();
}
ImGui::PopStyleColor();
ImGui::PopStyleColor();
ImGui::PopStyleColor();
ImGui::PopStyleColor();
ImGui::PopStyleColor();
ImGui::PopStyleColor(5);
}
void NotificationManager::HintNotification::render_logo(ImGuiWrapper& imgui, const float win_size_x, const float win_size_y, const float win_pos_x, const float win_pos_y)
{
@ -788,11 +776,7 @@ void NotificationManager::HintNotification::render_logo(ImGuiWrapper& imgui, con
{
}
ImGui::PopStyleColor();
ImGui::PopStyleColor();
ImGui::PopStyleColor();
ImGui::PopStyleColor();
ImGui::PopStyleColor();
ImGui::PopStyleColor(5);
}
void NotificationManager::HintNotification::render_documentation_button(ImGuiWrapper& imgui, const float win_size_x, const float win_size_y, const float win_pos_x, const float win_pos_y)
{
@ -846,11 +830,7 @@ void NotificationManager::HintNotification::render_documentation_button(ImGuiWra
open_documentation();
}
ImGui::PopStyleColor();
ImGui::PopStyleColor();
ImGui::PopStyleColor();
ImGui::PopStyleColor();
ImGui::PopStyleColor();
ImGui::PopStyleColor(5);
}
void NotificationManager::HintNotification::open_documentation()

View file

@ -99,8 +99,8 @@ protected:
float m_close_b_y { 0 };
float m_close_b_w { 0 };
// hover of buttons
size_t m_docu_hover_time { 0 };
size_t m_prefe_hover_time{ 0 };
long m_docu_hover_time { 0 };
long m_prefe_hover_time{ 0 };
};
} //namespace Slic3r

View file

@ -1078,9 +1078,7 @@ static wxMenu* generate_help_menu()
else
append_menu_item(helpMenu, wxID_ANY, wxString::Format(_L("&About %s"), GCODEVIEWER_APP_NAME), _L("Show about dialog"),
[](wxCommandEvent&) { Slic3r::GUI::about(); });
append_menu_item(helpMenu, wxID_ANY, _L("Next Hint notification"), _L("Opens another Hint notification."),
[](wxCommandEvent&) { wxGetApp().plater()->get_notification_manager()->push_hint_notification(true); });
append_menu_item(helpMenu, wxID_ANY, _L("Reopen Hint notification"), _L("Opens Hint notification in bottom right corner."),
append_menu_item(helpMenu, wxID_ANY, _L("Show Tip of the day"), _L("Opens Tip of the day notification in bottom right corner or shows another tip if already opened."),
[](wxCommandEvent&) { wxGetApp().plater()->get_notification_manager()->push_hint_notification(false); });
helpMenu->AppendSeparator();
append_menu_item(helpMenu, wxID_ANY, _L("Keyboard Shortcuts") + sep + "&?", _L("Show the list of the keyboard shortcuts"),

View file

@ -218,6 +218,7 @@ void NotificationManager::PopNotification::render(GLCanvas3D& canvas, float init
if (m_state == EState::FadingOut) {
push_style_color(ImGuiCol_WindowBg, ImGui::GetStyleColorVec4(ImGuiCol_WindowBg), true, m_current_fade_opacity);
push_style_color(ImGuiCol_Text, ImGui::GetStyleColorVec4(ImGuiCol_Text), true, m_current_fade_opacity);
push_style_color(ImGuiCol_ButtonHovered, ImGui::GetStyleColorVec4(ImGuiCol_ButtonHovered), true, m_current_fade_opacity);
fading_pop = true;
}
@ -229,7 +230,7 @@ void NotificationManager::PopNotification::render(GLCanvas3D& canvas, float init
m_id = m_id_provider.allocate_id();
std::string name = "!!Ntfctn" + std::to_string(m_id);
if (imgui.begin(name, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoScrollbar)) {
if (imgui.begin(name, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse)) {
ImVec2 win_size = ImGui::GetWindowSize();
render_left_sign(imgui);
@ -245,7 +246,7 @@ void NotificationManager::PopNotification::render(GLCanvas3D& canvas, float init
ImGui::PopStyleColor();
if (fading_pop)
ImGui::PopStyleColor(2);
ImGui::PopStyleColor(3);
}
bool NotificationManager::PopNotification::push_background_color()
{
@ -440,9 +441,7 @@ void NotificationManager::PopNotification::render_hypertext(ImGuiWrapper& imgui,
close();
}
}
ImGui::PopStyleColor();
ImGui::PopStyleColor();
ImGui::PopStyleColor();
ImGui::PopStyleColor(3);
//hover color
ImVec4 orange_color = ImVec4(.99f, .313f, .0f, 1.0f);
@ -501,11 +500,7 @@ void NotificationManager::PopNotification::render_close_button(ImGuiWrapper& img
{
close();
}
ImGui::PopStyleColor();
ImGui::PopStyleColor();
ImGui::PopStyleColor();
ImGui::PopStyleColor();
ImGui::PopStyleColor();
ImGui::PopStyleColor(5);
}
void NotificationManager::PopNotification::render_left_sign(ImGuiWrapper& imgui)
@ -545,11 +540,7 @@ void NotificationManager::PopNotification::render_minimize_button(ImGuiWrapper&
m_multiline = false;
}
ImGui::PopStyleColor();
ImGui::PopStyleColor();
ImGui::PopStyleColor();
ImGui::PopStyleColor();
ImGui::PopStyleColor();
ImGui::PopStyleColor(5);
m_minimize_b_visible = true;
}
bool NotificationManager::PopNotification::on_text_click()
@ -790,11 +781,7 @@ void NotificationManager::ExportFinishedNotification::render_eject_button(ImGuiW
wxPostEvent(m_evt_handler, EjectDriveNotificationClickedEvent(EVT_EJECT_DRIVE_NOTIFICAION_CLICKED));
close();
}
ImGui::PopStyleColor();
ImGui::PopStyleColor();
ImGui::PopStyleColor();
ImGui::PopStyleColor();
ImGui::PopStyleColor();
ImGui::PopStyleColor(5);
}
bool NotificationManager::ExportFinishedNotification::on_text_click()
{
@ -1054,11 +1041,7 @@ void NotificationManager::PrintHostUploadNotification::render_cancel_button(ImGu
{
wxGetApp().printhost_job_queue().cancel(m_job_id - 1);
}
ImGui::PopStyleColor();
ImGui::PopStyleColor();
ImGui::PopStyleColor();
ImGui::PopStyleColor();
ImGui::PopStyleColor();
ImGui::PopStyleColor(5);
}
//------UpdatedItemsInfoNotification-------
void NotificationManager::UpdatedItemsInfoNotification::count_spaces()
@ -1096,7 +1079,7 @@ void NotificationManager::UpdatedItemsInfoNotification::add_type(InfoItemType ty
case InfoItemType::MmuSegmentation: text += _utf8("multimaterial painting.\n"); break;
case InfoItemType::VariableLayerHeight: text += _utf8("variable layer height.\n"); break;
case InfoItemType::Sinking: text += _utf8("Partial sinking.\n"); break;
default: text.clear(); break;
default: BOOST_LOG_TRIVIAL(error) << "Unknown InfoItemType: " << (*it).second; break;
}
}
NotificationData data { get_data().type, get_data().level , get_data().duration, text };
@ -1380,10 +1363,7 @@ void NotificationManager::push_hint_notification(bool open_next)
{
for (std::unique_ptr<PopNotification>& notification : m_pop_notifications) {
if (notification->get_type() == NotificationType::DidYouKnowHint) {
if (open_next)
(dynamic_cast<HintNotification*>(notification.get()))->open_next();
else
notification->set_hovered();
(dynamic_cast<HintNotification*>(notification.get()))->open_next();
return;
}
}

View file

@ -342,7 +342,7 @@ void PreferencesDialog::build(size_t selected_tab)
m_optgroup_gui->append_single_option_line(option);
#endif
def.label = L("Show \"Did you know\" hints after start");
def.label = L("Show \"Tip of the day\" notification after start");
def.type = coBool;
def.tooltip = L("If enabled, useful hints are displayed at startup.");
def.set_default_value(new ConfigOptionBool{ app_config->get("show_hints") == "1" });