mirror of https://github.com/odrling/Aegisub
Use id instead of pos to robustly locate VisualToolDrag button
This commit is contained in:
parent
47b2bfd544
commit
3ec57295fd
|
@ -59,7 +59,7 @@ VisualToolDrag::VisualToolDrag(VideoDisplay *parent, agi::Context *context)
|
|||
void VisualToolDrag::SetToolbar(wxToolBar *tb) {
|
||||
toolbar = tb;
|
||||
toolbar->AddSeparator();
|
||||
toolbar->AddTool(-1, _("Toggle between \\move and \\pos"), ICON(visual_move_conv_move));
|
||||
move_pos_button = toolbar->AddTool(-1, _("Toggle between \\move and \\pos"), ICON(visual_move_conv_move))->GetId();
|
||||
toolbar->Realize();
|
||||
toolbar->Show(true);
|
||||
|
||||
|
@ -76,8 +76,7 @@ void VisualToolDrag::UpdateToggleButtons() {
|
|||
|
||||
if (to_move == button_is_move) return;
|
||||
|
||||
toolbar->SetToolNormalBitmap(toolbar->GetToolByPos(1)->GetId(),
|
||||
to_move ? ICON(visual_move_conv_move) : ICON(visual_move_conv_pos));
|
||||
toolbar->SetToolNormalBitmap(move_pos_button, to_move ? ICON(visual_move_conv_move) : ICON(visual_move_conv_pos));
|
||||
button_is_move = to_move;
|
||||
}
|
||||
|
||||
|
|
|
@ -39,6 +39,7 @@ class wxToolBar;
|
|||
class VisualToolDrag final : public VisualTool<VisualToolDragDraggableFeature> {
|
||||
/// The subtoolbar for the move/pos conversion button
|
||||
wxToolBar *toolbar;
|
||||
int move_pos_button;
|
||||
/// The feature last clicked on for the double-click handler
|
||||
/// Equal to curFeature during drags; possibly different at all other times
|
||||
/// nullptr if no features have been clicked on or the last clicked on one no
|
||||
|
|
Loading…
Reference in New Issue