mirror of https://github.com/odrling/Aegisub
Fixed hidden cursor on right click
Originally committed to SVN as r1093.
This commit is contained in:
parent
9dcb9d7884
commit
9f18c2d448
|
@ -132,6 +132,26 @@ VideoDisplay::~VideoDisplay () {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///////////////
|
||||||
|
// Show cursor
|
||||||
|
void VideoDisplay::ShowCursor(bool show) {
|
||||||
|
// Show
|
||||||
|
if (show) SetCursor(wxNullCursor);
|
||||||
|
|
||||||
|
// Hide
|
||||||
|
else {
|
||||||
|
// Bleeeh! Hate this 'solution':
|
||||||
|
#if __WXGTK__
|
||||||
|
static char cursor_image[] = {0};
|
||||||
|
wxCursor cursor(cursor_image, 8, 1, -1, -1, cursor_image);
|
||||||
|
#else
|
||||||
|
wxCursor cursor(wxCURSOR_BLANK);
|
||||||
|
#endif // __WXGTK__
|
||||||
|
SetCursor(cursor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//////////
|
//////////
|
||||||
// Render
|
// Render
|
||||||
void VideoDisplay::Render() {
|
void VideoDisplay::Render() {
|
||||||
|
@ -345,9 +365,6 @@ void VideoDisplay::OnMouseEvent(wxMouseEvent& event) {
|
||||||
// Disable when playing
|
// Disable when playing
|
||||||
if (VideoContext::Get()->IsPlaying()) return;
|
if (VideoContext::Get()->IsPlaying()) return;
|
||||||
|
|
||||||
// Set mode, for whatever reason this is needed
|
|
||||||
visual->SetMode(visual->mode);
|
|
||||||
|
|
||||||
// OnMouseLeave isn't called as long as we have an OnMouseEvent
|
// OnMouseLeave isn't called as long as we have an OnMouseEvent
|
||||||
// Just check for it and call it manually instead
|
// Just check for it and call it manually instead
|
||||||
if (event.Leaving()) {
|
if (event.Leaving()) {
|
||||||
|
@ -358,6 +375,7 @@ void VideoDisplay::OnMouseEvent(wxMouseEvent& event) {
|
||||||
|
|
||||||
// Right click
|
// Right click
|
||||||
if (event.ButtonUp(wxMOUSE_BTN_RIGHT)) {
|
if (event.ButtonUp(wxMOUSE_BTN_RIGHT)) {
|
||||||
|
// Create menu
|
||||||
wxMenu menu;
|
wxMenu menu;
|
||||||
menu.Append(VIDEO_MENU_SAVE_SNAPSHOT,_("Save PNG snapshot"));
|
menu.Append(VIDEO_MENU_SAVE_SNAPSHOT,_("Save PNG snapshot"));
|
||||||
menu.Append(VIDEO_MENU_COPY_TO_CLIPBOARD,_("Copy image to Clipboard"));
|
menu.Append(VIDEO_MENU_COPY_TO_CLIPBOARD,_("Copy image to Clipboard"));
|
||||||
|
@ -367,10 +385,16 @@ void VideoDisplay::OnMouseEvent(wxMouseEvent& event) {
|
||||||
menu.Append(VIDEO_MENU_COPY_TO_CLIPBOARD_RAW,_("Copy image to Clipboard (no subtitles)"))->Enable(canDoRaw);
|
menu.Append(VIDEO_MENU_COPY_TO_CLIPBOARD_RAW,_("Copy image to Clipboard (no subtitles)"))->Enable(canDoRaw);
|
||||||
menu.AppendSeparator();
|
menu.AppendSeparator();
|
||||||
menu.Append(VIDEO_MENU_COPY_COORDS,_("Copy coordinates to Clipboard"));
|
menu.Append(VIDEO_MENU_COPY_COORDS,_("Copy coordinates to Clipboard"));
|
||||||
|
|
||||||
|
// Show cursor and popup
|
||||||
|
ShowCursor(true);
|
||||||
PopupMenu(&menu);
|
PopupMenu(&menu);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Enforce correct cursor display
|
||||||
|
ShowCursor(visual->mode != 0);
|
||||||
|
|
||||||
// Click?
|
// Click?
|
||||||
if (event.ButtonDown(wxMOUSE_BTN_ANY)) {
|
if (event.ButtonDown(wxMOUSE_BTN_ANY)) {
|
||||||
SetFocus();
|
SetFocus();
|
||||||
|
|
|
@ -104,6 +104,7 @@ public:
|
||||||
|
|
||||||
void Render();
|
void Render();
|
||||||
|
|
||||||
|
void ShowCursor(bool show);
|
||||||
void ConvertMouseCoords(int &x,int &y);
|
void ConvertMouseCoords(int &x,int &y);
|
||||||
void DrawText(wxPoint Pos, wxString Text);
|
void DrawText(wxPoint Pos, wxString Text);
|
||||||
void UpdatePositionDisplay();
|
void UpdatePositionDisplay();
|
||||||
|
|
|
@ -84,22 +84,8 @@ void VideoDisplayVisual::SetMode(int _mode) {
|
||||||
// Set mode
|
// Set mode
|
||||||
mode = _mode;
|
mode = _mode;
|
||||||
|
|
||||||
// Hide cursor
|
// Display cursor or not
|
||||||
if (mode == 0) {
|
parent->ShowCursor(mode != 0);
|
||||||
// Bleeeh! Hate this 'solution':
|
|
||||||
#if __WXGTK__
|
|
||||||
static char cursor_image[] = {0};
|
|
||||||
wxCursor cursor(cursor_image, 8, 1, -1, -1, cursor_image);
|
|
||||||
#else
|
|
||||||
wxCursor cursor(wxCURSOR_BLANK);
|
|
||||||
#endif // __WXGTK__
|
|
||||||
parent->SetCursor(cursor);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Show cursor
|
|
||||||
else {
|
|
||||||
parent->SetCursor(wxNullCursor);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue