-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added notification history #3368
Conversation
@@ -35,6 +35,7 @@ class RibbonNotifier | |||
public: | |||
// adds new notification for drawing | |||
void pushNotification( const RibbonNotification& notification ); | |||
void drawNotificationHistoryButton( float scaling ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
source/MRViewer/MRRibbonMenu.cpp
Outdated
notifier_.drawNotificationHistoryButton( menu_scaling() ); | ||
notifier_.drawNotifications( menu_scaling() ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
calc scaling once, and pass to both functions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
if ( ImGui::IsWindowAppearing() ) | ||
{ | ||
if ( !activeModal ) | ||
ImGui::BringWindowToDisplayFront( ImGui::GetCurrentWindow() ); // bring to front to be over modal background | ||
if ( !ProgressBar::isOrdered() && !activeModal ) // do not focus window, not to close modal on appearing | ||
ImGui::SetWindowFocus(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is not needed for "Notification History" it is simple button that should not appear over other windows
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
if ( activeModal ) | ||
{ | ||
// workaround to be able to hover notification even if modal is present | ||
auto mousePos = ImGui::GetMousePos(); | ||
isHovered = window->Rect().Contains( mousePos ) && !activeModal->Rect().Contains( mousePos ); | ||
} | ||
else | ||
{ | ||
if ( notifications_.size() == cNotificationNumberLimit ) | ||
notifications_.erase( notifications_.end() - 1 ); | ||
notifications_.insert( notifications_.begin(), NotificationWithTimer{ notification } ); | ||
isHovered = ImGui::IsWindowHovered(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
…o #4657_notifiaction_history
|
||
void RibbonNotifier::drawNotificationHistoryButton( float scaling ) | ||
{ | ||
if ( !notifications_.empty() || notificationsHistory_.empty() ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why check both, should check only notificationsHistory_
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i don't think it's necessary to show history button if we are already showing notifications
(notificationsHistory_ is empty only until first notification)
} | ||
requestClosestRedraw_(); | ||
const float size = ImGui::GetTextLineHeight() + 10.f * scaling * 2.f; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is 10&scaling*2?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reworked
|
||
ImGui::Begin( name.c_str(), nullptr, flags ); | ||
|
||
iconsFont = RibbonFontManager::getFontByTypeStatic( RibbonFontManager::FontType::Icons ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why take it second time?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
bool isHovered = false; | ||
isHovered = ImGui::IsWindowHovered(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bool isHovered = ImGui::IsWindowHovered();
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
if ( ImGui::IsMouseClicked( ImGuiMouseButton_Left ) ) | ||
{ | ||
for ( int i = int( notificationsHistory_.size() ) - 1; i >= 0; --i ) | ||
{ | ||
const auto& nwt = notificationsHistory_[i]; | ||
for ( int j = 0; j < nwt.sameCounter; ++j ) | ||
addNotification_( notifications_, nwt.notification ); | ||
} | ||
requestClosestRedraw_(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what if click several times? will notifications_
timer work and close them automatical?
@@ -35,8 +35,8 @@ class RibbonNotifier | |||
public: | |||
// adds new notification for drawing | |||
void pushNotification( const RibbonNotification& notification ); | |||
// draws all present notifications | |||
void drawNotifications( float scaling ); | |||
// main draw function |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please write more detailed comment, what does it draw
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
const float cWindowRounding = 4.f; | ||
const float cWIndowSpacing = 20.f; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we already have MRRibbonConstants.h
mb use constants form there
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
if ( auto menu = getViewerInstance().getMenuPluginAs<RibbonMenu>() ) | ||
notificationsPosX += float( menu->getSceneSize().x ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead of dynamic casting RibbonMenu mb take it as argument from draw? or set as class field? or better sceneSize
@@ -209,7 +407,23 @@ void RibbonNotifier::drawNotifications( float scaling ) | |||
ImGui::PopStyleVar( 4 ); | |||
currentPos.y -= window->Size.y; | |||
} | |||
filterInvalid_( numInvalid ); | |||
|
|||
historyBtnPosY_ = currentPos.y - cWIndowSpacing * scaling; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we update it each frame? should be always in the same position?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, button is located above upper-left corner of notifications
…o #4657_notifiaction_history # Conflicts: # source/MRViewer/MRRibbonMenu.cpp # source/MRViewer/MRRibbonNotification.h
No description provided.