1 /**********************************************************************
2 
3    Audacity - A Digital Audio Editor
4    Copyright 1999-2018 Audacity Team
5    License: GPL v2 - see LICENSE.txt
6 
7    Dan Horgan
8    James Crook
9 
10 ******************************************************************//**
11 
12 \file SelectCommand.h
13 \brief Declarations for SelectCommand and SelectCommandType classes
14 
15 *//*******************************************************************/
16 
17 #ifndef __SELECT_COMMAND__
18 #define __SELECT_COMMAND__
19 
20 
21 
22 #include "CommandType.h"
23 #include "Command.h"
24 
25 //#include "../commands/AudacityCommand.h"
26 
27 class SelectTimeCommand : public AudacityCommand
28 {
29 public:
30    static const ComponentInterfaceSymbol Symbol;
31 
32    // ComponentInterface overrides
GetSymbol()33    ComponentInterfaceSymbol GetSymbol() override {return Symbol;};
GetDescription()34    TranslatableString GetDescription() override {return XO("Selects a time range.");};
35    bool DefineParams( ShuttleParams & S ) override;
36    void PopulateOrExchange(ShuttleGui & S) override;
37    bool Apply(const CommandContext & context) override;
38 
39    // AudacityCommand overrides
ManualPage()40    ManualPageID ManualPage() override {return L"Extra_Menu:_Scriptables_I#select_time";}
41 
42    bool bHasT0;
43    bool bHasT1;
44    bool bHasFromEnd;
45    bool bHasRelativeSpec;
46 
47    double mT0;
48    double mT1;
49    int mRelativeTo;
50    bool mFromEnd;
51 };
52 
53 class SelectFrequenciesCommand : public AudacityCommand
54 {
55 public:
56    static const ComponentInterfaceSymbol Symbol;
57 
58    // ComponentInterface overrides
GetSymbol()59    ComponentInterfaceSymbol GetSymbol() override {return Symbol;};
GetDescription()60    TranslatableString GetDescription() override {return XO("Selects a frequency range.");};
61    bool DefineParams( ShuttleParams & S ) override;
62    void PopulateOrExchange(ShuttleGui & S) override;
63    bool Apply(const CommandContext & context) override;
64 
65    // AudacityCommand overrides
ManualPage()66    ManualPageID ManualPage() override {return L"Extra_Menu:_Scriptables_I#select_frequencies";}
67 
68    bool bHasBottom;
69    bool bHasTop;
70 
71    double mBottom;
72    double mTop;
73 };
74 
75 
76 class SelectTracksCommand : public AudacityCommand
77 {
78 public:
79    static const ComponentInterfaceSymbol Symbol;
80 
81    // ComponentInterface overrides
GetSymbol()82    ComponentInterfaceSymbol GetSymbol() override {return Symbol;};
GetDescription()83    TranslatableString GetDescription() override {return XO("Selects a range of tracks.");};
84    bool DefineParams( ShuttleParams & S ) override;
85    void PopulateOrExchange(ShuttleGui & S) override;
86    bool Apply(const CommandContext & context) override;
87    // AudacityCommand overrides
ManualPage()88    ManualPageID ManualPage() override {return L"Extra_Menu:_Scriptables_I#select_tracks";}
89 
90    bool bHasFirstTrack;
91    bool bHasNumTracks;
92    bool bHasMode;
93 
94    double mFirstTrack;
95    double mNumTracks;
96    int mMode;
97 };
98 
99 
100 class SelectCommand : public AudacityCommand
101 {
102 public:
103    static const ComponentInterfaceSymbol Symbol;
104 
105    // ComponentInterface overrides
GetSymbol()106    ComponentInterfaceSymbol GetSymbol() override {return Symbol;};
GetDescription()107    TranslatableString GetDescription() override {return XO("Selects Audio.");};
DefineParams(ShuttleParams & S)108    bool DefineParams( ShuttleParams & S ) override {
109       return
110          mSelTime.DefineParams(S) &&
111          mSelFreq.DefineParams(S) &&
112          mSelTracks.DefineParams(S);
113    };
PopulateOrExchange(ShuttleGui & S)114    void PopulateOrExchange(ShuttleGui & S) override {
115       mSelTime.PopulateOrExchange(S);
116       mSelFreq.PopulateOrExchange(S);
117       mSelTracks.PopulateOrExchange(S);
118    };
Apply(const CommandContext & context)119    bool Apply(const CommandContext & context) override {
120       return
121          mSelTime.Apply(context) &&
122          mSelFreq.Apply( context )&&
123          mSelTracks.Apply(context);
124    }
125    // AudacityCommand overrides
ManualPage()126    ManualPageID ManualPage() override {return L"Extra_Menu:_Scriptables_II#select";}
127 private:
128    SelectTimeCommand mSelTime;
129    SelectFrequenciesCommand mSelFreq;
130    SelectTracksCommand mSelTracks;
131 
132 
133 };
134 
135 #endif /* End of include guard: __SELECT_COMMAND__ */
136