mirror of https://github.com/odrling/Aegisub
Kill the redundant VisualToolEvent nonsense and make the drag tool just use OnSubTool like the vector clip mode.
Originally committed to SVN as r4316.
This commit is contained in:
parent
2ec4a97dbb
commit
34a7d21a42
|
@ -71,7 +71,6 @@ const wxColour VisualTool::colour[4] = {wxColour(106,32,19), wxColour(255,169,40
|
|||
/// @param parent
|
||||
VisualTool::VisualTool(VideoDisplay *parent, VideoState const& video)
|
||||
: parent(parent)
|
||||
, eventSink(this)
|
||||
, holding(false)
|
||||
, curDiag(NULL)
|
||||
, dragging(false)
|
||||
|
@ -692,21 +691,3 @@ void VisualTool::SetOverride(wxString tag,wxString value) {
|
|||
VideoContext::Get()->grid->editBox->SetOverride(tag,value,0,false);
|
||||
//parent->SetFocus();
|
||||
}
|
||||
|
||||
/// @brief Connect button
|
||||
/// @param button
|
||||
void VisualTool::ConnectButton(wxButton *button) {
|
||||
button->Connect(wxEVT_COMMAND_BUTTON_CLICKED,wxCommandEventHandler(VisualToolEvent::OnButton),NULL,&eventSink);
|
||||
}
|
||||
|
||||
/// @brief Event sink
|
||||
/// @param _tool
|
||||
VisualToolEvent::VisualToolEvent(VisualTool *_tool) {
|
||||
tool = _tool;
|
||||
}
|
||||
|
||||
/// @brief DOCME
|
||||
/// @param event
|
||||
void VisualToolEvent::OnButton(wxCommandEvent &event) {
|
||||
tool->OnButton(event);
|
||||
}
|
||||
|
|
|
@ -69,37 +69,12 @@ struct VideoState;
|
|||
|
||||
|
||||
|
||||
/// DOCME
|
||||
/// @class VisualToolEvent
|
||||
/// @brief DOCME
|
||||
///
|
||||
/// DOCME
|
||||
class VisualToolEvent : public wxEvtHandler {
|
||||
private:
|
||||
|
||||
/// DOCME
|
||||
VisualTool *tool;
|
||||
|
||||
public:
|
||||
void OnButton(wxCommandEvent &event);
|
||||
|
||||
VisualToolEvent(VisualTool *tool);
|
||||
};
|
||||
|
||||
|
||||
|
||||
/// DOCME
|
||||
/// @class VisualTool
|
||||
/// @brief DOCME
|
||||
///
|
||||
/// DOCME
|
||||
class VisualTool : public OpenGLWrapper {
|
||||
friend class VisualToolEvent;
|
||||
|
||||
private:
|
||||
/// DOCME
|
||||
VisualToolEvent eventSink;
|
||||
|
||||
int GetHighlightedFeature();
|
||||
protected:
|
||||
/// DOCME
|
||||
|
@ -173,15 +148,6 @@ protected:
|
|||
void DrawAllFeatures();
|
||||
void Commit(bool full=false);
|
||||
|
||||
void ConnectButton(wxButton *button);
|
||||
|
||||
/// @brief DOCME
|
||||
/// @param event
|
||||
/// @return
|
||||
///
|
||||
virtual void OnButton(wxCommandEvent &event) {}
|
||||
|
||||
|
||||
/// @brief DOCME
|
||||
/// @return
|
||||
///
|
||||
|
|
|
@ -34,9 +34,6 @@
|
|||
/// @ingroup visual_ts
|
||||
///
|
||||
|
||||
|
||||
///////////
|
||||
// Headers
|
||||
#include "config.h"
|
||||
|
||||
#include "ass_dialogue.h"
|
||||
|
@ -50,12 +47,7 @@
|
|||
#include "video_display.h"
|
||||
#include "visual_tool_drag.h"
|
||||
|
||||
|
||||
///////
|
||||
// IDs
|
||||
enum {
|
||||
|
||||
/// DOCME
|
||||
BUTTON_TOGGLE_MOVE = VISUAL_SUB_TOOL_START
|
||||
};
|
||||
|
||||
|
@ -67,11 +59,10 @@ enum {
|
|||
///
|
||||
VisualToolDrag::VisualToolDrag(VideoDisplay *parent, VideoState const& video, wxToolBar * toolBar)
|
||||
: VisualTool(parent, video)
|
||||
, toolBar(toolBar)
|
||||
, toggleMoveOnMove(true)
|
||||
{
|
||||
toggleMove = new wxBitmapButton(toolBar,BUTTON_TOGGLE_MOVE,GETIMAGE(visual_move_conv_move_24),wxDefaultPosition);
|
||||
ConnectButton(toggleMove);
|
||||
toolBar->AddControl(toggleMove);
|
||||
toggleMoveOnMove = true;
|
||||
toolBar->AddTool(BUTTON_TOGGLE_MOVE, _("Toggle between \\move and \\pos"), GETIMAGE(visual_move_conv_move_24));
|
||||
toolBar->Realize();
|
||||
toolBar->Show(true);
|
||||
}
|
||||
|
@ -96,8 +87,12 @@ void VisualToolDrag::UpdateToggleButtons() {
|
|||
if (toMove == toggleMoveOnMove) return;
|
||||
|
||||
// Change bitmap
|
||||
if (toMove) toggleMove->SetBitmapLabel(GETIMAGE(visual_move_conv_move_24));
|
||||
else toggleMove->SetBitmapLabel(GETIMAGE(visual_move_conv_pos_24));
|
||||
if (toMove) {
|
||||
toolBar->SetToolNormalBitmap(BUTTON_TOGGLE_MOVE, GETIMAGE(visual_move_conv_move_24));
|
||||
}
|
||||
else {
|
||||
toolBar->SetToolNormalBitmap(BUTTON_TOGGLE_MOVE, GETIMAGE(visual_move_conv_pos_24));
|
||||
}
|
||||
toggleMoveOnMove = toMove;
|
||||
}
|
||||
|
||||
|
@ -106,8 +101,7 @@ void VisualToolDrag::UpdateToggleButtons() {
|
|||
/// @brief Toggle button pressed
|
||||
/// @param event
|
||||
/// @return
|
||||
///
|
||||
void VisualToolDrag::OnButton(wxCommandEvent &event) {
|
||||
void VisualToolDrag::OnSubTool(wxCommandEvent &event) {
|
||||
// Get line
|
||||
AssDialogue *line = GetActiveDialogueLine();
|
||||
if (!line) return;
|
||||
|
@ -125,10 +119,7 @@ void VisualToolDrag::OnButton(wxCommandEvent &event) {
|
|||
// Replace tag
|
||||
if (hasMove) SetOverride(L"\\pos",wxString::Format(L"(%i,%i)",x1,y1));
|
||||
else SetOverride(L"\\move",wxString::Format(L"(%i,%i,%i,%i,%i,%i)",x1,y1,x1,y1,0,line->End.GetMS() - line->Start.GetMS()));
|
||||
SubtitlesGrid *grid = VideoContext::Get()->grid;
|
||||
grid->editBox->CommitText();
|
||||
grid->ass->FlagAsModified(_("visual typesetting"));
|
||||
grid->CommitChanges(false,true);
|
||||
Commit(true);
|
||||
|
||||
// Update display
|
||||
Refresh();
|
||||
|
|
|
@ -34,11 +34,6 @@
|
|||
/// @ingroup visual_ts
|
||||
///
|
||||
|
||||
|
||||
|
||||
|
||||
///////////
|
||||
// Headers
|
||||
#ifndef AGI_PRE
|
||||
#include <wx/bmpbuttn.h>
|
||||
#include <wx/toolbar.h>
|
||||
|
@ -54,14 +49,12 @@
|
|||
/// DOCME
|
||||
class VisualToolDrag : public VisualTool {
|
||||
private:
|
||||
|
||||
/// DOCME
|
||||
wxBitmapButton *toggleMove;
|
||||
wxToolBar *toolBar;
|
||||
|
||||
/// DOCME
|
||||
bool toggleMoveOnMove;
|
||||
|
||||
|
||||
/// @brief DOCME
|
||||
///
|
||||
bool CanDrag() { return true; }
|
||||
|
@ -69,7 +62,6 @@ private:
|
|||
void UpdateDrag(VisualDraggableFeature &feature);
|
||||
void CommitDrag(VisualDraggableFeature &feature);
|
||||
|
||||
void OnButton(wxCommandEvent &event);
|
||||
void UpdateToggleButtons();
|
||||
void DoRefresh();
|
||||
|
||||
|
@ -77,4 +69,5 @@ public:
|
|||
VisualToolDrag(VideoDisplay *parent, VideoState const& video, wxToolBar *toolbar);
|
||||
|
||||
void Draw();
|
||||
void OnSubTool(wxCommandEvent &event);
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue