Skip to content
GitLab
Explorer
Connexion
Navigation principale
Rechercher ou aller à…
Projet
Aegisub
Gestion
Activité
Membres
Labels
Programmation
Tickets
Tableaux des tickets
Jalons
Wiki
Code
Requêtes de fusion
Dépôt
Branches
Validations
Étiquettes
Graphe du dépôt
Comparer les révisions
Extraits de code
Déploiement
Releases
Registre de paquets
Registre de conteneur
Registre de modèles
Opération
Modules Terraform
Surveillance
Incidents
Analyse
Données d'analyse des chaînes de valeur
Analyse des contributeurs
Données d'analyse du dépôt
Expériences du modèle
Aide
Aide
Support
Documentation de GitLab
Comparer les forfaits GitLab
Forum de la communauté
Contribuer à GitLab
Donner votre avis
Raccourcis clavier
?
Extraits de code
Groupes
Projets
Ce projet est archivé. Le dépôt et les autres ressources du projet sont en lecture seule.
Afficher davantage de fils d'Ariane
Kubat
Aegisub
Validations
05f5d375
Valider
05f5d375
rédigé
12 years ago
par
Thomas Goyne
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
Split AudioDisplay::OnMouseEvent into several methods
parent
3d3a74c5
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Modifications
2
Masquer les modifications d'espaces
En ligne
Côte à côte
Affichage de
2 fichiers modifiés
aegisub/src/audio_display.cpp
+70
-56
70 ajouts, 56 suppressions
aegisub/src/audio_display.cpp
aegisub/src/audio_display.h
+6
-0
6 ajouts, 0 suppression
aegisub/src/audio_display.h
avec
76 ajouts
et
56 suppressions
aegisub/src/audio_display.cpp
+
70
−
56
Voir le fichier @
05f5d375
...
...
@@ -589,8 +589,8 @@ AudioDisplay::AudioDisplay(wxWindow *parent, AudioController *controller, agi::C
Bind
(
wxEVT_MIDDLE_UP
,
&
AudioDisplay
::
OnMouseEvent
,
this
);
Bind
(
wxEVT_RIGHT_UP
,
&
AudioDisplay
::
OnMouseEvent
,
this
);
Bind
(
wxEVT_MOTION
,
&
AudioDisplay
::
OnMouseEvent
,
this
);
Bind
(
wxEVT_ENTER_WINDOW
,
&
AudioDisplay
::
OnMouseE
ve
nt
,
this
);
Bind
(
wxEVT_LEAVE_WINDOW
,
&
AudioDisplay
::
OnMouse
Event
,
this
);
Bind
(
wxEVT_ENTER_WINDOW
,
&
AudioDisplay
::
OnMouseEnt
er
,
this
);
Bind
(
wxEVT_LEAVE_WINDOW
,
&
AudioDisplay
::
OnMouse
Leave
,
this
);
Bind
(
wxEVT_PAINT
,
&
AudioDisplay
::
OnPaint
,
this
);
Bind
(
wxEVT_SIZE
,
&
AudioDisplay
::
OnSize
,
this
);
Bind
(
wxEVT_KILL_FOCUS
,
&
AudioDisplay
::
OnFocus
,
this
);
...
...
@@ -985,6 +985,18 @@ void AudioDisplay::RemoveTrackCursor()
SetTrackCursor
(
-
1
,
false
);
}
void
AudioDisplay
::
OnMouseEnter
(
wxMouseEvent
&
)
{
if
(
OPT_GET
(
"Audio/Auto/Focus"
)
->
GetBool
())
SetFocus
();
}
void
AudioDisplay
::
OnMouseLeave
(
wxMouseEvent
&
)
{
if
(
!
controller
->
IsPlaying
())
RemoveTrackCursor
();
}
void
AudioDisplay
::
OnMouseEvent
(
wxMouseEvent
&
event
)
{
// If we have focus, we get mouse move events on Mac even when the mouse is
...
...
@@ -995,89 +1007,46 @@ void AudioDisplay::OnMouseEvent(wxMouseEvent& event)
return
;
}
if
(
event
.
IsButton
()
||
(
event
.
Entering
()
&&
OPT_GET
(
"Audio/Auto/Focus"
)
->
GetBool
())
)
if
(
event
.
IsButton
())
SetFocus
();
// Handle any ongoing drag
if
(
dragged_object
&&
HasCapture
())
{
if
(
!
dragged_object
->
OnMouseEvent
(
event
))
{
scroll_timer
.
Stop
();
SetDraggedObject
(
0
);
SetCursor
(
wxNullCursor
);
}
return
;
}
else
{
// Something is wrong, we might have lost capture somehow.
// Fix state and pretend it didn't happen.
SetDraggedObject
(
0
);
SetCursor
(
wxNullCursor
);
}
wxPoint
mousepos
=
event
.
GetPosition
();
AudioDisplayInteractionObject
*
new_obj
=
0
;
// Check for scrollbar action
if
(
scrollbar
->
GetBounds
().
Contains
(
mousepos
))
{
new_obj
=
scrollbar
.
get
();
}
// Check for timeline action
else
if
(
timeline
->
GetBounds
().
Contains
(
mousepos
))
{
SetCursor
(
wxCursor
(
wxCURSOR_SIZEWE
));
new_obj
=
timeline
.
get
();
}
if
(
new_obj
)
{
if
(
!
controller
->
IsPlaying
())
RemoveTrackCursor
();
if
(
new_obj
->
OnMouseEvent
(
event
))
SetDraggedObject
(
new_obj
);
if
(
ForwardMouseEvent
(
event
))
return
;
}
if
(
event
.
Leaving
()
&&
!
controller
->
IsPlaying
())
{
RemoveTrackCursor
();
return
;
}
const
int
mouse_x
=
event
.
GetPosition
().
x
;
if
(
event
.
MiddleIsDown
())
{
context
->
videoController
->
JumpToTime
(
TimeFromRelativeX
(
mouse
pos
.
x
),
agi
::
vfr
::
EXACT
);
context
->
videoController
->
JumpToTime
(
TimeFromRelativeX
(
mouse
_
x
),
agi
::
vfr
::
EXACT
);
return
;
}
if
(
event
.
Moving
()
&&
!
controller
->
IsPlaying
())
{
SetTrackCursor
(
scroll_left
+
mouse
pos
.
x
,
OPT_GET
(
"Audio/Display/Draw/Cursor Time"
)
->
GetBool
());
SetTrackCursor
(
scroll_left
+
mouse
_
x
,
OPT_GET
(
"Audio/Display/Draw/Cursor Time"
)
->
GetBool
());
}
AudioTimingController
*
timing
=
controller
->
GetTimingController
();
if
(
!
timing
)
return
;
int
drag_sensitivity
=
int
(
OPT_GET
(
"Audio/Start Drag Sensitivity"
)
->
GetInt
()
*
ms_per_pixel
);
int
snap_sensitivity
=
OPT_GET
(
"Audio/Snap/Enable"
)
->
GetBool
()
!=
event
.
ShiftDown
()
?
int
(
OPT_GET
(
"Audio/Snap/Distance"
)
->
GetInt
()
*
ms_per_pixel
)
:
0
;
const
int
drag_sensitivity
=
int
(
OPT_GET
(
"Audio/Start Drag Sensitivity"
)
->
GetInt
()
*
ms_per_pixel
);
const
int
snap_sensitivity
=
OPT_GET
(
"Audio/Snap/Enable"
)
->
GetBool
()
!=
event
.
ShiftDown
()
?
int
(
OPT_GET
(
"Audio/Snap/Distance"
)
->
GetInt
()
*
ms_per_pixel
)
:
0
;
// Not scrollbar, not timeline, no button action
if
(
event
.
Moving
())
{
int
timepos
=
TimeFromRelativeX
(
mouse
pos
.
x
);
const
int
timepos
=
TimeFromRelativeX
(
mouse
_
x
);
if
(
timing
->
IsNearbyMarker
(
timepos
,
drag_sensitivity
))
SetCursor
(
wxCursor
(
wxCURSOR_SIZEWE
));
else
SetCursor
(
wxNullCursor
);
return
;
}
int
old_scroll_pos
=
scroll_left
;
const
int
old_scroll_pos
=
scroll_left
;
if
(
event
.
LeftDown
()
||
event
.
RightDown
())
{
int
timepos
=
TimeFromRelativeX
(
mouse
pos
.
x
);
const
int
timepos
=
TimeFromRelativeX
(
mouse
_
x
);
std
::
vector
<
AudioMarker
*>
markers
=
event
.
LeftDown
()
?
timing
->
OnLeftClick
(
timepos
,
event
.
CmdDown
(),
drag_sensitivity
,
snap_sensitivity
)
:
timing
->
OnRightClick
(
timepos
,
event
.
CmdDown
(),
drag_sensitivity
,
snap_sensitivity
);
...
...
@@ -1095,6 +1064,51 @@ void AudioDisplay::OnMouseEvent(wxMouseEvent& event)
}
}
bool
AudioDisplay
::
ForwardMouseEvent
(
wxMouseEvent
&
event
)
{
// Handle any ongoing drag
if
(
dragged_object
&&
HasCapture
())
{
if
(
!
dragged_object
->
OnMouseEvent
(
event
))
{
scroll_timer
.
Stop
();
SetDraggedObject
(
0
);
SetCursor
(
wxNullCursor
);
}
return
true
;
}
else
{
// Something is wrong, we might have lost capture somehow.
// Fix state and pretend it didn't happen.
SetDraggedObject
(
0
);
SetCursor
(
wxNullCursor
);
}
const
wxPoint
mousepos
=
event
.
GetPosition
();
AudioDisplayInteractionObject
*
new_obj
=
0
;
// Check for scrollbar action
if
(
scrollbar
->
GetBounds
().
Contains
(
mousepos
))
{
new_obj
=
scrollbar
.
get
();
}
// Check for timeline action
else
if
(
timeline
->
GetBounds
().
Contains
(
mousepos
))
{
SetCursor
(
wxCursor
(
wxCURSOR_SIZEWE
));
new_obj
=
timeline
.
get
();
}
else
{
return
false
;
}
if
(
!
controller
->
IsPlaying
())
RemoveTrackCursor
();
if
(
new_obj
->
OnMouseEvent
(
event
))
SetDraggedObject
(
new_obj
);
return
true
;
}
void
AudioDisplay
::
OnKeyDown
(
wxKeyEvent
&
event
)
{
hotkey
::
check
(
"Audio"
,
context
,
event
);
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
aegisub/src/audio_display.h
+
6
−
0
Voir le fichier @
05f5d375
...
...
@@ -207,6 +207,10 @@ class AudioDisplay: public wxWindow {
/// @param dc DC to paint to
void
PaintTrackCursor
(
wxDC
&
dc
);
/// Forward the mouse event to the appropriate child control, if any
/// @return Was the mouse event forwarded somewhere?
bool
ForwardMouseEvent
(
wxMouseEvent
&
event
);
/// wxWidgets paint event
void
OnPaint
(
wxPaintEvent
&
event
);
/// wxWidgets mouse input event
...
...
@@ -218,6 +222,8 @@ class AudioDisplay: public wxWindow {
/// wxWidgets keypress event
void
OnKeyDown
(
wxKeyEvent
&
event
);
void
OnScrollTimer
(
wxTimerEvent
&
event
);
void
OnMouseEnter
(
wxMouseEvent
&
);
void
OnMouseLeave
(
wxMouseEvent
&
);
// AudioControllerAudioEventListener implementation
void
OnAudioOpen
(
AudioProvider
*
provider
);
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
Aperçu
0%
Chargement en cours
Veuillez réessayer
ou
joindre un nouveau fichier
.
Annuler
You are about to add
0
people
to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Enregistrer le commentaire
Annuler
Veuillez vous
inscrire
ou vous
se connecter
pour commenter