Audacity  3.0.3
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 () override
 
TranslatableString GetDescription () override
 
bool DefineParams (ShuttleParams &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 () override
 
VendorSymbol GetVendor () override
 
wxString GetVersion () override
 
virtual bool IsBatchProcessing ()
 
virtual void SetBatchProcessing (bool start)
 
virtual bool Apply (const CommandContext &WXUNUSED(context))
 
bool ShowInterface (wxWindow *parent, bool forceModal=false)
 
virtual void SetHostUI (EffectUIHostInterface *WXUNUSED(host))
 
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 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 ()
 
- Public Member Functions inherited from ComponentInterface
virtual ~ComponentInterface ()
 
TranslatableString GetName ()
 
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
 

Static Public Attributes

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

Additional Inherited Members

- Public Types inherited from AudacityCommand
enum  : long { DefaultMessageBoxStyle = wxOK | wxCENTRE }
 
using VetoDialogHook = bool(*)(wxDialog *)
 
- Static Public Member Functions inherited from AudacityCommand
static VetoDialogHook SetVetoDialogHook (VetoDialogHook hook)
 
- Protected Attributes inherited from AudacityCommand
ProgressDialogmProgress
 
wxDialog * mUIDialog
 
wxWindow * mUIParent
 
int mUIResultID
 

Detailed Description

Command that sets clip information.

Definition at line 22 of file DragCommand.h.

Constructor & Destructor Documentation

◆ DragCommand()

DragCommand::DragCommand ( )

Definition at line 37 of file DragCommand.cpp.

38 {
39 }

Member Function Documentation

◆ Apply()

bool DragCommand::Apply ( const CommandContext context)
override

Definition at line 89 of file DragCommand.cpp.

90 {
91  // Defaults if no value...
92  if( !bHasFromX )
93  mFromX = 200.0;
94  if( !bHasFromY )
95  mFromY = 10;
96  if( !bHasToX )
97  mToX = 400;
98  if( !bHasToY )
99  mToY = 10;
100 
101  wxWindow * pWin = &GetProjectFrame( context.project );
102  wxWindow * pWin1 = nullptr;
103  wxMouseEvent Evt( wxEVT_MOTION );
104  Evt.m_x = mFromX;
105  Evt.m_y = mFromY;
106  if( bHasId )
107  pWin1 = pWin->FindWindowById( mId );
108  if( bHasWinName )
109  pWin1 = pWin->FindWindowByName( mWinName );
110  if( pWin1 )
111  pWin = pWin1;
112  // Process twice - possible bug in Audacity being worked around
113  // where we need an event to enter AND an event to move.
114  // AdornedRuler Quick-Play bug.
115  pWin->GetEventHandler()->ProcessEvent( Evt );
116  pWin->GetEventHandler()->ProcessEvent( Evt );
117  if( bHasToX ){
118  wxMouseEvent Evt2( wxEVT_LEFT_DOWN );
119  Evt2.m_leftDown = true;
120  Evt2.m_x = mFromX;
121  Evt2.m_y = mFromY;
122  Evt2.m_aux2Down = true;
123  pWin->GetEventHandler()->ProcessEvent( Evt2 );
124  wxMouseEvent Evt3( wxEVT_MOTION );
125  Evt3.m_leftDown = true;
126  Evt2.m_aux2Down = true;
127  Evt3.m_x = mToX;
128  Evt3.m_y = mToY;
129  // AdornedRuler Quick-Play bug again.
130  pWin->GetEventHandler()->ProcessEvent( Evt3 );
131  pWin->GetEventHandler()->ProcessEvent( Evt3 );
132  wxMouseEvent Evt4( wxEVT_LEFT_UP );
133  Evt2.m_aux2Down = true;
134  Evt4.m_x = mToX;
135  Evt4.m_y = mToY;
136  pWin->GetEventHandler()->ProcessEvent( Evt4 );
137  }
138  return true;
139 }

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:

◆ DefineParams()

bool DragCommand::DefineParams ( ShuttleParams S)
override

Definition at line 59 of file DragCommand.cpp.

59  {
60  S.OptionalN( bHasId ).Define( mId, wxT("Id"), 11000.0, -100000.0, 1000000.0);
61  S.OptionalY( bHasWinName ).Define( mWinName, wxT("Window"), "Timeline");
62  S.OptionalY( bHasFromX ).Define( mFromX, wxT("FromX"), 200.0, 0.0, 1000000.0);
63  S.OptionalY( bHasFromY ).Define( mFromY, wxT("FromY"), 10.0, 0.0, 1000000.0);
64  S.OptionalN( bHasToX ).Define( mToX, wxT("ToX"), 400.0, 0.0, 1000000.0);
65  S.OptionalN( bHasToY ).Define( mToY, wxT("ToY"), 10.0, 0.0, 1000000.0);
67  return true;
68 };

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

Here is the call graph for this function:

◆ GetDescription()

TranslatableString DragCommand::GetDescription ( )
inlineoverridevirtual

Reimplemented from AudacityCommand.

Definition at line 30 of file DragCommand.h.

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

References XO.

◆ GetSymbol()

ComponentInterfaceSymbol DragCommand::GetSymbol ( )
inlineoverridevirtual

Implements AudacityCommand.

Definition at line 29 of file DragCommand.h.

29 {return Symbol;};

References Symbol.

◆ ManualPage()

ManualPageID DragCommand::ManualPage ( )
inlineoverridevirtual

Reimplemented from AudacityCommand.

Definition at line 35 of file DragCommand.h.

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

◆ PopulateOrExchange()

void DragCommand::PopulateOrExchange ( ShuttleGui S)
override

Definition at line 70 of file DragCommand.cpp.

71 {
72  S.AddSpace(0, 5);
73 
74  S.StartMultiColumn(3, wxALIGN_CENTER);
75  {
76  /* i18n-hint abbreviates "Identity" or "Identifier" */
77  S.Optional( bHasId ).TieNumericTextBox( XXO("Id:"), mId );
78  S.Optional( bHasWinName ).TieTextBox( XXO("Window Name:"), mWinName );
79  S.Optional( bHasFromX ).TieNumericTextBox( XXO("From X:"), mFromX );
80  S.Optional( bHasFromY ).TieNumericTextBox( XXO("From Y:"), mFromY );
81  S.Optional( bHasToX ).TieNumericTextBox( XXO("To X:"), mToX );
82  S.Optional( bHasToY ).TieNumericTextBox( XXO("To Y:"), mToY );
83  S.Optional( bHasRelativeTo ).TieChoice( XXO("Relative To:"), mRelativeTo,
85  }
86  S.EndMultiColumn();
87 }

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

Here is the call graph for this function:

Member Data Documentation

◆ bHasFromX

bool DragCommand::bHasFromX

Definition at line 48 of file DragCommand.h.

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

◆ bHasFromY

bool DragCommand::bHasFromY

Definition at line 49 of file DragCommand.h.

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

◆ bHasId

bool DragCommand::bHasId

Definition at line 53 of file DragCommand.h.

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

◆ bHasRelativeTo

bool DragCommand::bHasRelativeTo

Definition at line 52 of file DragCommand.h.

Referenced by DefineParams(), and PopulateOrExchange().

◆ bHasToX

bool DragCommand::bHasToX

Definition at line 50 of file DragCommand.h.

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

◆ bHasToY

bool DragCommand::bHasToY

Definition at line 51 of file DragCommand.h.

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

◆ bHasWinName

bool DragCommand::bHasWinName

Definition at line 54 of file DragCommand.h.

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

◆ mFromX

double DragCommand::mFromX

Definition at line 40 of file DragCommand.h.

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

◆ mFromY

double DragCommand::mFromY

Definition at line 41 of file DragCommand.h.

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

◆ mId

int DragCommand::mId

Definition at line 45 of file DragCommand.h.

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

◆ mRelativeTo

int DragCommand::mRelativeTo

Definition at line 44 of file DragCommand.h.

Referenced by DefineParams(), and PopulateOrExchange().

◆ mToX

double DragCommand::mToX

Definition at line 42 of file DragCommand.h.

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

◆ mToY

double DragCommand::mToY

Definition at line 43 of file DragCommand.h.

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

◆ mWinName

wxString DragCommand::mWinName

Definition at line 46 of file DragCommand.h.

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

◆ 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:
DragCommand::Symbol
static const ComponentInterfaceSymbol Symbol
Definition: DragCommand.h:25
DragCommand::bHasToY
bool bHasToY
Definition: DragCommand.h:51
kPanel
@ kPanel
Definition: DragCommand.cpp:43
kCoordTypeStrings
static const EnumValueSymbol kCoordTypeStrings[nCoordTypes]
Definition: DragCommand.cpp:50
ShuttleGui::AddSpace
wxSizerItem * AddSpace(int width, int height, int prop=0)
Definition: ShuttleGui.cpp:2459
XO
#define XO(s)
Definition: Internat.h:31
DragCommand::mRelativeTo
int mRelativeTo
Definition: DragCommand.h:44
DragCommand::mToX
double mToX
Definition: DragCommand.h:42
ShuttleGuiBase::EndMultiColumn
void EndMultiColumn()
Definition: ShuttleGui.cpp:1238
ShuttleParams::OptionalN
virtual ShuttleParams & OptionalN(bool &var)
Definition: Shuttle.h:72
ShuttleGuiBase::TieTextBox
wxTextCtrl * TieTextBox(const TranslatableString &Caption, wxString &Value, const int nChars=0)
Definition: ShuttleGui.cpp:1652
DragCommand::mFromX
double mFromX
Definition: DragCommand.h:40
XXO
#define XXO(s)
Definition: Internat.h:44
DragCommand::mFromY
double mFromY
Definition: DragCommand.h:41
ShuttleGuiBase::StartMultiColumn
void StartMultiColumn(int nCols, int PositionFlags=wxALIGN_LEFT)
Definition: ShuttleGui.cpp:1229
DragCommand::bHasFromY
bool bHasFromY
Definition: DragCommand.h:49
ShuttleParams::DefineEnum
virtual void DefineEnum(int &var, const wxChar *key, const int vdefault, const EnumValueSymbol strings[], size_t nStrings)
Definition: Shuttle.cpp:339
DragCommand::bHasToX
bool bHasToX
Definition: DragCommand.h:50
ShuttleParams::OptionalY
virtual ShuttleParams & OptionalY(bool &var)
Definition: Shuttle.h:71
nCoordTypes
@ nCoordTypes
Definition: DragCommand.cpp:47
ShuttleGuiBase::TieNumericTextBox
wxTextCtrl * TieNumericTextBox(const TranslatableString &Prompt, int &Value, const int nChars=0)
Definition: ShuttleGui.cpp:1673
Msgids
TranslatableStrings Msgids(const EnumValueSymbol strings[], size_t nStrings)
Convenience function often useful when adding choice controls.
Definition: ShuttleGui.cpp:2522
DragCommand::bHasRelativeTo
bool bHasRelativeTo
Definition: DragCommand.h:52
DragCommand::bHasFromX
bool bHasFromX
Definition: DragCommand.h:48
GetProjectFrame
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 ...
Definition: ProjectWindows.cpp:72
DragCommand::bHasId
bool bHasId
Definition: DragCommand.h:53
DragCommand::bHasWinName
bool bHasWinName
Definition: DragCommand.h:54
ShuttleParams::Define
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:332
ShuttleGui::Optional
ShuttleGui & Optional(bool &bVar)
Definition: ShuttleGui.cpp:2280
DragCommand::mToY
double mToY
Definition: DragCommand.h:43
CommandContext::project
AudacityProject & project
Definition: CommandContext.h:64
DragCommand::mId
int mId
Definition: DragCommand.h:45
ShuttleGuiBase::TieChoice
wxChoice * TieChoice(const TranslatableString &Prompt, TranslatableString &Selected, const TranslatableStrings &choices)
Definition: ShuttleGui.cpp:1727
DragCommand::mWinName
wxString mWinName
Definition: DragCommand.h:46