Audacity  2.3.1
Public Member Functions | Public Attributes | List of all members
DragCommand Class Reference

Command that sets clip information. More...

#include <DragCommand.h>

Inheritance diagram for DragCommand:
AudacityCommand ComponentInterface

Public Member Functions

 DragCommand ()
 
ComponentInterfaceSymbol GetSymbol () override
 
wxString GetDescription () override
 
bool DefineParams (ShuttleParams &S) override
 
void PopulateOrExchange (ShuttleGui &S) override
 
wxString ManualPage () override
 
bool Apply (const CommandContext &context) override
 
- Public Member Functions inherited from AudacityCommand
 AudacityCommand ()
 
virtual ~AudacityCommand ()
 
wxString GetPath () override
 
ComponentInterfaceSymbol GetVendor () override
 
wxString GetVersion () override
 
virtual bool IsBatchProcessing ()
 
virtual void SetBatchProcessing (bool start)
 
virtual bool Apply (const CommandContext &WXUNUSED(context))
 
virtual bool Apply ()
 
bool ShowInterface (wxWindow *parent, bool forceModal=false)
 
virtual void SetHostUI (EffectUIHostInterface *WXUNUSED(host))
 
bool PopulateUI (wxWindow *parent)
 
wxDialog * CreateUI (wxWindow *parent, AudacityCommand *client)
 
virtual bool GetAutomationParameters (wxString &parms)
 
virtual bool SetAutomationParameters (const wxString &parms)
 
bool DoAudacityCommand (wxWindow *parent, const CommandContext &context, bool shouldPrompt=true)
 
int MessageBox (const wxString &message, long style=DefaultMessageBoxStyle, const wxString &titleStr=wxString{})
 
virtual bool Init ()
 
virtual bool PromptUser (wxWindow *parent)
 
virtual bool CheckWhetherSkipAudacityCommand ()
 
virtual void End ()
 
virtual void PopulateOrExchange (ShuttleGui &WXUNUSED(S))
 
virtual bool TransferDataToWindow ()
 
virtual bool TransferDataFromWindow ()
 
- Public Member Functions inherited from ComponentInterface
virtual ~ComponentInterface ()
 
const wxString & GetTranslatedName ()
 
virtual bool DefineParams (ShuttleParams &WXUNUSED(S))
 

Public Attributes

double mFromX
 
double mFromY
 
double mToX
 
double mToY
 
int mRelativeTo
 
int mId
 
wxString mWinName
 
bool bHasFromX
 
bool bHasFromY
 
bool bHasToX
 
bool bHasToY
 
bool bHasRelativeTo
 
bool bHasId
 
bool bHasWinName
 

Additional Inherited Members

- Public Types inherited from AudacityCommand
enum  : long { DefaultMessageBoxStyle = wxOK | wxCENTRE }
 
- Protected Attributes inherited from AudacityCommand
ProgressDialogmProgress
 
wxDialog * mUIDialog
 
wxWindow * mUIParent
 
int mUIResultID
 

Detailed Description

Command that sets clip information.

Definition at line 24 of file DragCommand.h.

Constructor & Destructor Documentation

DragCommand::DragCommand ( )

Definition at line 28 of file DragCommand.cpp.

29 {
30 }

Member Function Documentation

bool DragCommand::Apply ( const CommandContext context)
override

Definition at line 81 of file DragCommand.cpp.

References bHasFromX, bHasFromY, bHasId, bHasToX, bHasToY, bHasWinName, CommandContext::GetProject(), mFromX, mFromY, mId, mToX, mToY, and mWinName.

82 {
83  // Defaults if no value...
84  if( !bHasFromX )
85  mFromX = 200.0;
86  if( !bHasFromY )
87  mFromY = 10;
88  if( !bHasToX )
89  mToX = 400;
90  if( !bHasToY )
91  mToY = 10;
92 
93  wxWindow * pWin = context.GetProject();
94  wxWindow * pWin1 = nullptr;
95  wxMouseEvent Evt( wxEVT_MOTION );
96  Evt.m_x = mFromX;
97  Evt.m_y = mFromY;
98  if( bHasId )
99  pWin1 = pWin->FindWindowById( mId );
100  if( bHasWinName )
101  pWin1 = pWin->FindWindowByName( mWinName );
102  if( pWin1 )
103  pWin = pWin1;
104  // Process twice - possible bug in Audacity being worked around
105  // where we need an event to enter AND an event to move.
106  // AdornedRuler Quick-Play bug.
107  pWin->GetEventHandler()->ProcessEvent( Evt );
108  pWin->GetEventHandler()->ProcessEvent( Evt );
109  if( bHasToX ){
110  wxMouseEvent Evt2( wxEVT_LEFT_DOWN );
111  Evt2.m_leftDown = true;
112  Evt2.m_x = mFromX;
113  Evt2.m_y = mFromY;
114  Evt2.m_aux2Down = true;
115  pWin->GetEventHandler()->ProcessEvent( Evt2 );
116  wxMouseEvent Evt3( wxEVT_MOTION );
117  Evt3.m_leftDown = true;
118  Evt2.m_aux2Down = true;
119  Evt3.m_x = mToX;
120  Evt3.m_y = mToY;
121  // AdornedRuler Quick-Play bug again.
122  pWin->GetEventHandler()->ProcessEvent( Evt3 );
123  pWin->GetEventHandler()->ProcessEvent( Evt3 );
124  wxMouseEvent Evt4( wxEVT_LEFT_UP );
125  Evt2.m_aux2Down = true;
126  Evt4.m_x = mToX;
127  Evt4.m_y = mToY;
128  pWin->GetEventHandler()->ProcessEvent( Evt4 );
129  }
130  return true;
131 }
double mFromX
Definition: DragCommand.h:40
AudacityProject * GetProject() const
bool bHasFromX
Definition: DragCommand.h:48
double mToY
Definition: DragCommand.h:43
bool bHasFromY
Definition: DragCommand.h:49
bool bHasToX
Definition: DragCommand.h:50
double mToX
Definition: DragCommand.h:42
bool bHasWinName
Definition: DragCommand.h:54
wxString mWinName
Definition: DragCommand.h:46
double mFromY
Definition: DragCommand.h:41
bool bHasToY
Definition: DragCommand.h:51
bool DragCommand::DefineParams ( ShuttleParams S)
override

Definition at line 50 of file DragCommand.cpp.

References bHasFromX, bHasFromY, bHasId, bHasRelativeTo, bHasToX, bHasToY, bHasWinName, ShuttleParams::Define(), ShuttleParams::DefineEnum(), kPanel, mFromX, mFromY, mId, mRelativeTo, mToX, mToY, mWinName, nCoordTypes, ShuttleParams::OptionalN(), and ShuttleParams::OptionalY().

50  {
51  S.OptionalN( bHasId ).Define( mId, wxT("Id"), 11000.0, -100000.0, 1000000.0);
52  S.OptionalY( bHasWinName ).Define( mWinName, wxT("Window"), "Timeline");
53  S.OptionalY( bHasFromX ).Define( mFromX, wxT("FromX"), 200.0, 0.0, 1000000.0);
54  S.OptionalY( bHasFromY ).Define( mFromY, wxT("FromY"), 10.0, 0.0, 1000000.0);
55  S.OptionalN( bHasToX ).Define( mToX, wxT("ToX"), 400.0, 0.0, 1000000.0);
56  S.OptionalN( bHasToY ).Define( mToY, wxT("ToY"), 10.0, 0.0, 1000000.0);
58  return true;
59 };
double mFromX
Definition: DragCommand.h:40
virtual ShuttleParams & OptionalN(bool &var)
Definition: Shuttle.h:72
bool bHasFromX
Definition: DragCommand.h:48
double mToY
Definition: DragCommand.h:43
bool bHasFromY
Definition: DragCommand.h:49
bool bHasToX
Definition: DragCommand.h:50
virtual ShuttleParams & OptionalY(bool &var)
Definition: Shuttle.h:71
int mRelativeTo
Definition: DragCommand.h:44
double mToX
Definition: DragCommand.h:42
virtual void DefineEnum(int &var, const wxChar *key, const int vdefault, const ComponentInterfaceSymbol strings[], size_t nStrings)
Definition: Shuttle.cpp:345
virtual void Define(bool &var, const wxChar *key, const bool vdefault, const bool vmin=false, const bool vmax=false, const bool vscl=false)
Definition: Shuttle.cpp:338
bool bHasWinName
Definition: DragCommand.h:54
wxString mWinName
Definition: DragCommand.h:46
double mFromY
Definition: DragCommand.h:41
bool bHasToY
Definition: DragCommand.h:51
bool bHasRelativeTo
Definition: DragCommand.h:52
static const ComponentInterfaceSymbol kCoordTypeStrings[nCoordTypes]
Definition: DragCommand.cpp:41
wxString DragCommand::GetDescription ( )
inlineoverridevirtual

Reimplemented from AudacityCommand.

Definition at line 30 of file DragCommand.h.

References _().

30 {return _("Drags mouse from one place to another.");};
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom")).Raw()), OnMoveTrack)#define SET_TRACK_NAME_PLUGIN_SYMBOLclass SetTrackNameCommand:public AudacityCommand
ComponentInterfaceSymbol DragCommand::GetSymbol ( )
inlineoverridevirtual

Implements AudacityCommand.

Definition at line 29 of file DragCommand.h.

References DRAG_PLUGIN_SYMBOL.

29 {return DRAG_PLUGIN_SYMBOL;};
#define DRAG_PLUGIN_SYMBOL
Definition: DragCommand.h:22
wxString DragCommand::ManualPage ( )
inlineoverridevirtual

Reimplemented from AudacityCommand.

Definition at line 35 of file DragCommand.h.

35 {return wxT("Extra_Menu:_Scriptables_II#move_mouse");};
void DragCommand::PopulateOrExchange ( ShuttleGui S)
override

Definition at line 61 of file DragCommand.cpp.

References _(), ShuttleGui::AddSpace(), bHasFromX, bHasFromY, bHasId, bHasRelativeTo, bHasToX, bHasToY, bHasWinName, ShuttleGuiBase::EndMultiColumn(), LocalizedStrings(), mFromX, mFromY, mId, mRelativeTo, mToX, mToY, mWinName, nCoordTypes, ShuttleGui::Optional(), ShuttleGuiBase::StartMultiColumn(), ShuttleGuiBase::TieChoice(), ShuttleGuiBase::TieNumericTextBox(), and ShuttleGuiBase::TieTextBox().

62 {
64 
65  S.AddSpace(0, 5);
66 
67  S.StartMultiColumn(3, wxALIGN_CENTER);
68  {
69  /* i18n-hint abbreviates "Identity" or "Identifier" */
70  S.Optional( bHasId ).TieNumericTextBox( _("Id:"), mId );
71  S.Optional( bHasWinName ).TieTextBox( _("Window Name:"), mWinName );
72  S.Optional( bHasFromX ).TieNumericTextBox( _("From X:"), mFromX );
73  S.Optional( bHasFromY ).TieNumericTextBox( _("From Y:"), mFromY );
74  S.Optional( bHasToX ).TieNumericTextBox( _("To X:"), mToX );
75  S.Optional( bHasToY ).TieNumericTextBox( _("To Y:"), mToY );
76  S.Optional( bHasRelativeTo ).TieChoice( _("Relative To:"), mRelativeTo, &coords );
77  }
78  S.EndMultiColumn();
79 }
double mFromX
Definition: DragCommand.h:40
wxChoice * TieChoice(const wxString &Prompt, WrappedType &WrappedRef, const wxArrayString *pChoices)
ShuttleGui & Optional(bool &bVar)
bool bHasFromX
Definition: DragCommand.h:48
double mToY
Definition: DragCommand.h:43
void EndMultiColumn()
bool bHasFromY
Definition: DragCommand.h:49
bool bHasToX
Definition: DragCommand.h:50
int mRelativeTo
Definition: DragCommand.h:44
double mToX
Definition: DragCommand.h:42
void StartMultiColumn(int nCols, int PositionFlags=wxALIGN_LEFT)
wxTextCtrl * TieNumericTextBox(const wxString &Prompt, WrappedType &WrappedRef, const int nChars)
bool bHasWinName
Definition: DragCommand.h:54
wxString mWinName
Definition: DragCommand.h:46
double mFromY
Definition: DragCommand.h:41
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom")).Raw()), OnMoveTrack)#define SET_TRACK_NAME_PLUGIN_SYMBOLclass SetTrackNameCommand:public AudacityCommand
bool bHasToY
Definition: DragCommand.h:51
bool bHasRelativeTo
Definition: DragCommand.h:52
static const ComponentInterfaceSymbol kCoordTypeStrings[nCoordTypes]
Definition: DragCommand.cpp:41
wxArrayString LocalizedStrings(const ComponentInterfaceSymbol strings[], size_t nStrings)
Definition: Internat.cpp:303
wxSizerItem * AddSpace(int width, int height)
wxTextCtrl * TieTextBox(const wxString &Prompt, WrappedType &WrappedRef, const int nChars)

Member Data Documentation

bool DragCommand::bHasFromX

Definition at line 48 of file DragCommand.h.

Referenced by Apply(), DefineParams(), and PopulateOrExchange().

bool DragCommand::bHasFromY

Definition at line 49 of file DragCommand.h.

Referenced by Apply(), DefineParams(), and PopulateOrExchange().

bool DragCommand::bHasId

Definition at line 53 of file DragCommand.h.

Referenced by Apply(), DefineParams(), and PopulateOrExchange().

bool DragCommand::bHasRelativeTo

Definition at line 52 of file DragCommand.h.

Referenced by DefineParams(), and PopulateOrExchange().

bool DragCommand::bHasToX

Definition at line 50 of file DragCommand.h.

Referenced by Apply(), DefineParams(), and PopulateOrExchange().

bool DragCommand::bHasToY

Definition at line 51 of file DragCommand.h.

Referenced by Apply(), DefineParams(), and PopulateOrExchange().

bool DragCommand::bHasWinName

Definition at line 54 of file DragCommand.h.

Referenced by Apply(), DefineParams(), and PopulateOrExchange().

double DragCommand::mFromX

Definition at line 40 of file DragCommand.h.

Referenced by Apply(), DefineParams(), and PopulateOrExchange().

double DragCommand::mFromY

Definition at line 41 of file DragCommand.h.

Referenced by Apply(), DefineParams(), and PopulateOrExchange().

int DragCommand::mId

Definition at line 45 of file DragCommand.h.

Referenced by Apply(), DefineParams(), and PopulateOrExchange().

int DragCommand::mRelativeTo

Definition at line 44 of file DragCommand.h.

Referenced by DefineParams(), and PopulateOrExchange().

double DragCommand::mToX

Definition at line 42 of file DragCommand.h.

Referenced by Apply(), DefineParams(), and PopulateOrExchange().

double DragCommand::mToY

Definition at line 43 of file DragCommand.h.

Referenced by Apply(), DefineParams(), and PopulateOrExchange().

wxString DragCommand::mWinName

Definition at line 46 of file DragCommand.h.

Referenced by Apply(), DefineParams(), and PopulateOrExchange().


The documentation for this class was generated from the following files: