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

Command that sets clip information. More...

#include <DragCommand.h>

Inheritance diagram for DragCommand:
[legend]
Collaboration diagram for DragCommand:
[legend]

Public Member Functions

 DragCommand ()
 
ComponentInterfaceSymbol GetSymbol () const override
 
TranslatableString GetDescription () const override
 
template<bool Const>
bool VisitSettings (SettingsVisitorBase< Const > &S)
 
bool VisitSettings (SettingsVisitor &S) override
 
bool VisitSettings (ConstSettingsVisitor &S) override
 
void PopulateOrExchange (ShuttleGui &S) override
 
ManualPageID ManualPage () override
 
bool Apply (const CommandContext &context) override
 
- Public Member Functions inherited from AudacityCommand
 AudacityCommand ()
 
virtual ~AudacityCommand ()
 
PluginPath GetPath () const override
 
VendorSymbol GetVendor () const override
 
wxString GetVersion () const override
 
ComponentInterfaceSymbol GetSymbol () const override=0
 
virtual TranslatableString GetDescription () const override
 
virtual ManualPageID ManualPage ()
 
virtual bool IsBatchProcessing () const
 
virtual void SetBatchProcessing (bool start)
 
virtual bool Apply (const CommandContext &WXUNUSED(context))
 
bool ShowInterface (wxWindow *parent, bool forceModal=false)
 
wxDialog * CreateUI (wxWindow *parent, AudacityCommand *client)
 
bool SaveSettingsAsString (wxString &parms)
 
bool LoadSettingsFromString (const wxString &parms)
 
bool DoAudacityCommand (wxWindow *parent, const CommandContext &context, bool shouldPrompt=true)
 
int MessageBox (const TranslatableString &message, long style=DefaultMessageBoxStyle, const TranslatableString &titleStr={})
 
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 ()
 
virtual bool VisitSettings (SettingsVisitor &)
 
virtual bool VisitSettings (ConstSettingsVisitor &)
 
- Public Member Functions inherited from ComponentInterface
virtual ~ComponentInterface ()
 
virtual PluginPath GetPath () const =0
 
virtual ComponentInterfaceSymbol GetSymbol () const =0
 
virtual VendorSymbol GetVendor () const =0
 
virtual wxString GetVersion () const =0
 
virtual TranslatableString GetDescription () const =0
 
TranslatableString GetName () const
 

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
 

Static Public Attributes

static const ComponentInterfaceSymbol Symbol { XO("Drag") }
 

Additional Inherited Members

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

Detailed Description

Command that sets clip information.

Definition at line 22 of file DragCommand.h.

Constructor & Destructor Documentation

◆ DragCommand()

DragCommand::DragCommand ( )

Definition at line 40 of file DragCommand.cpp.

41{
42}

Member Function Documentation

◆ Apply()

bool DragCommand::Apply ( const CommandContext context)
override

Definition at line 99 of file DragCommand.cpp.

100{
101 // Defaults if no value...
102 if( !bHasFromX )
103 mFromX = 200.0;
104 if( !bHasFromY )
105 mFromY = 10;
106 if( !bHasToX )
107 mToX = 400;
108 if( !bHasToY )
109 mToY = 10;
110
111 wxWindow * pWin = &GetProjectFrame( context.project );
112 wxWindow * pWin1 = nullptr;
113 wxMouseEvent Evt( wxEVT_MOTION );
114 Evt.m_x = mFromX;
115 Evt.m_y = mFromY;
116 if( bHasId )
117 pWin1 = pWin->FindWindowById( mId );
118 if( bHasWinName )
119 pWin1 = pWin->FindWindowByName( mWinName );
120 if( pWin1 )
121 pWin = pWin1;
122 // Process twice - possible bug in Audacity being worked around
123 // where we need an event to enter AND an event to move.
124 // AdornedRuler Quick-Play bug.
125 pWin->GetEventHandler()->ProcessEvent( Evt );
126 pWin->GetEventHandler()->ProcessEvent( Evt );
127 if( bHasToX ){
128 wxMouseEvent Evt2( wxEVT_LEFT_DOWN );
129 Evt2.m_leftDown = true;
130 Evt2.m_x = mFromX;
131 Evt2.m_y = mFromY;
132 Evt2.m_aux2Down = true;
133 pWin->GetEventHandler()->ProcessEvent( Evt2 );
134 wxMouseEvent Evt3( wxEVT_MOTION );
135 Evt3.m_leftDown = true;
136 Evt2.m_aux2Down = true;
137 Evt3.m_x = mToX;
138 Evt3.m_y = mToY;
139 // AdornedRuler Quick-Play bug again.
140 pWin->GetEventHandler()->ProcessEvent( Evt3 );
141 pWin->GetEventHandler()->ProcessEvent( Evt3 );
142 wxMouseEvent Evt4( wxEVT_LEFT_UP );
143 Evt2.m_aux2Down = true;
144 Evt4.m_x = mToX;
145 Evt4.m_y = mToY;
146 pWin->GetEventHandler()->ProcessEvent( Evt4 );
147 }
148 return true;
149}
AUDACITY_DLL_API wxFrame & GetProjectFrame(AudacityProject &project)
Get the top-level window associated with the project (as a wxFrame only, when you do not need to use ...
AudacityProject & project
bool bHasWinName
Definition: DragCommand.h:56
double mToY
Definition: DragCommand.h:45
double mToX
Definition: DragCommand.h:44
bool bHasToX
Definition: DragCommand.h:52
wxString mWinName
Definition: DragCommand.h:48
double mFromY
Definition: DragCommand.h:43
double mFromX
Definition: DragCommand.h:42
bool bHasFromX
Definition: DragCommand.h:50
bool bHasToY
Definition: DragCommand.h:53
bool bHasFromY
Definition: DragCommand.h:51

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

Here is the call graph for this function:

◆ GetDescription()

TranslatableString DragCommand::GetDescription ( ) const
inlineoverridevirtual

Reimplemented from AudacityCommand.

Definition at line 30 of file DragCommand.h.

30{return XO("Drags mouse from one place to another.");};
XO("Cut/Copy/Paste")

References XO().

Here is the call graph for this function:

◆ GetSymbol()

ComponentInterfaceSymbol DragCommand::GetSymbol ( ) const
inlineoverridevirtual

Implements AudacityCommand.

Definition at line 29 of file DragCommand.h.

29{return Symbol;};
static const ComponentInterfaceSymbol Symbol
Definition: DragCommand.h:25

References Symbol.

◆ ManualPage()

ManualPageID DragCommand::ManualPage ( )
inlineoverridevirtual

Reimplemented from AudacityCommand.

Definition at line 37 of file DragCommand.h.

37{return L"Extra_Menu:_Scriptables_II#move_mouse";}

◆ PopulateOrExchange()

void DragCommand::PopulateOrExchange ( ShuttleGui S)
override

Definition at line 80 of file DragCommand.cpp.

81{
82 S.AddSpace(0, 5);
83
84 S.StartMultiColumn(3, wxALIGN_CENTER);
85 {
86 /* i18n-hint abbreviates "Identity" or "Identifier" */
87 S.Optional( bHasId ).TieNumericTextBox( XXO("Id:"), mId );
88 S.Optional( bHasWinName ).TieTextBox( XXO("Window Name:"), mWinName );
89 S.Optional( bHasFromX ).TieNumericTextBox( XXO("From X:"), mFromX );
90 S.Optional( bHasFromY ).TieNumericTextBox( XXO("From Y:"), mFromY );
91 S.Optional( bHasToX ).TieNumericTextBox( XXO("To X:"), mToX );
92 S.Optional( bHasToY ).TieNumericTextBox( XXO("To Y:"), mToY );
93 S.Optional( bHasRelativeTo ).TieChoice( XXO("Relative To:"), mRelativeTo,
95 }
96 S.EndMultiColumn();
97}
@ nCoordTypes
Definition: DragCommand.cpp:50
static const EnumValueSymbol kCoordTypeStrings[nCoordTypes]
Definition: DragCommand.cpp:53
XXO("&Cut/Copy/Paste Toolbar")
TranslatableStrings Msgids(const EnumValueSymbol strings[], size_t nStrings)
Convenience function often useful when adding choice controls.
#define S(N)
Definition: ToChars.cpp:64
bool bHasRelativeTo
Definition: DragCommand.h:54
int mRelativeTo
Definition: DragCommand.h:46

References bHasFromX, bHasFromY, bHasId, bHasRelativeTo, bHasToX, bHasToY, bHasWinName, kCoordTypeStrings, mFromX, mFromY, mId, mRelativeTo, Msgids(), mToX, mToY, mWinName, nCoordTypes, S, and XXO().

Here is the call graph for this function:

◆ VisitSettings() [1/3]

bool DragCommand::VisitSettings ( ConstSettingsVisitor )
overridevirtual

Visit settings, if defined. false means no defined settings. Default implementation returns false

Reimplemented from AudacityCommand.

Definition at line 77 of file DragCommand.cpp.

78 { return VisitSettings<true>(S); }

References S.

◆ VisitSettings() [2/3]

bool DragCommand::VisitSettings ( SettingsVisitor )
overridevirtual

Visit settings, if defined. false means no defined settings. Default implementation returns false

Reimplemented from AudacityCommand.

Definition at line 74 of file DragCommand.cpp.

75 { return VisitSettings<false>(S); }

References S.

◆ VisitSettings() [3/3]

template<bool Const>
bool DragCommand::VisitSettings ( SettingsVisitorBase< Const > &  S)

Definition at line 63 of file DragCommand.cpp.

63 {
64 S.OptionalN( bHasId ).Define( mId, wxT("Id"), 11000, -100000, 1000000);
65 S.OptionalY( bHasWinName ).Define( mWinName, wxT("Window"), wxString{"Timeline"});
66 S.OptionalY( bHasFromX ).Define( mFromX, wxT("FromX"), 200.0, 0.0, 1000000.0);
67 S.OptionalY( bHasFromY ).Define( mFromY, wxT("FromY"), 10.0, 0.0, 1000000.0);
68 S.OptionalN( bHasToX ).Define( mToX, wxT("ToX"), 400.0, 0.0, 1000000.0);
69 S.OptionalN( bHasToY ).Define( mToY, wxT("ToY"), 10.0, 0.0, 1000000.0);
70 S.OptionalN( bHasRelativeTo ).DefineEnum( mRelativeTo, wxT("RelativeTo"), kPanel, kCoordTypeStrings, nCoordTypes );
71 return true;
72};
wxT("CloseDown"))
@ kPanel
Definition: DragCommand.cpp:46

References bHasFromX, bHasFromY, bHasId, bHasRelativeTo, bHasToX, bHasToY, bHasWinName, kCoordTypeStrings, kPanel, mFromX, mFromY, mId, mRelativeTo, mToX, mToY, mWinName, nCoordTypes, S, and wxT().

Here is the call graph for this function:

Member Data Documentation

◆ bHasFromX

bool DragCommand::bHasFromX

Definition at line 50 of file DragCommand.h.

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

◆ bHasFromY

bool DragCommand::bHasFromY

Definition at line 51 of file DragCommand.h.

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

◆ bHasId

bool DragCommand::bHasId

Definition at line 55 of file DragCommand.h.

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

◆ bHasRelativeTo

bool DragCommand::bHasRelativeTo

Definition at line 54 of file DragCommand.h.

Referenced by PopulateOrExchange(), and VisitSettings().

◆ bHasToX

bool DragCommand::bHasToX

Definition at line 52 of file DragCommand.h.

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

◆ bHasToY

bool DragCommand::bHasToY

Definition at line 53 of file DragCommand.h.

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

◆ bHasWinName

bool DragCommand::bHasWinName

Definition at line 56 of file DragCommand.h.

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

◆ mFromX

double DragCommand::mFromX

Definition at line 42 of file DragCommand.h.

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

◆ mFromY

double DragCommand::mFromY

Definition at line 43 of file DragCommand.h.

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

◆ mId

int DragCommand::mId

Definition at line 47 of file DragCommand.h.

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

◆ mRelativeTo

int DragCommand::mRelativeTo

Definition at line 46 of file DragCommand.h.

Referenced by PopulateOrExchange(), and VisitSettings().

◆ mToX

double DragCommand::mToX

Definition at line 44 of file DragCommand.h.

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

◆ mToY

double DragCommand::mToY

Definition at line 45 of file DragCommand.h.

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

◆ mWinName

wxString DragCommand::mWinName

Definition at line 48 of file DragCommand.h.

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

◆ Symbol

const ComponentInterfaceSymbol DragCommand::Symbol { XO("Drag") }
static

Definition at line 25 of file DragCommand.h.

Referenced by GetSymbol().


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