mirror of
				https://github.com/cookiengineer/audacity
				synced 2025-10-30 17:23:51 +01:00 
			
		
		
		
	Added TrackPanel2. Removed namespaces, as they don't help avoid collision with TrackPanel name.
This commit is contained in:
		| @@ -111,6 +111,7 @@ void ModTrackPanelCommandFunctor::operator()(int index ) | ||||
| void ModTrackPanelCallback::OnFuncShowAudioExplorer() | ||||
| { | ||||
|    int k=3; | ||||
|    Registrar::ShowNewPanel(); | ||||
| } | ||||
|  | ||||
| void ModTrackPanelCallback::OnFuncShowAnotherExtension() | ||||
| @@ -148,10 +149,10 @@ MOD_TRACK_PANEL_DLL_API int ModuleDispatch(ModuleDispatchTypes type) | ||||
|    switch (type) | ||||
|    { | ||||
|    case AppInitialized: | ||||
|       ModTrackPanel::Registrar::Start(); | ||||
|       Registrar::Start(); | ||||
|       break; | ||||
|    case AppQuiting: | ||||
|       ModTrackPanel::Registrar::Finish(); | ||||
|       Registrar::Finish(); | ||||
|       break; | ||||
|    case ProjectInitialized: | ||||
|    case MenusRebuilt: | ||||
|   | ||||
| @@ -21,8 +21,6 @@ plugging in of new resources. | ||||
| #include <wx/wx.h> | ||||
| #include "Registrar.h" | ||||
|  | ||||
| START_NAMESPACE | ||||
|  | ||||
| Registrar * pRegistrar = NULL; | ||||
|  | ||||
| // By defining the external function and including it here, we save ourselves maintaing two lists. | ||||
| @@ -44,6 +42,7 @@ int RegistrarDispatch( t_RegistrarDispatchType Type ) | ||||
|    DISPATCH( EnvelopeArtist ); | ||||
|    DISPATCH( LabelArtist ); | ||||
|    DISPATCH( DragGridSizer ); | ||||
|    DISPATCH( TrackPanel2 ); | ||||
|    return 0; | ||||
| } | ||||
|  | ||||
| @@ -54,6 +53,7 @@ void Registrar::Start() | ||||
|    wxASSERT( pRegistrar ==NULL ); | ||||
|    pRegistrar = new Registrar(); | ||||
|  | ||||
|    RegistrarDispatch( RegResource ); | ||||
|    RegistrarDispatch( RegArtist ); | ||||
|    RegistrarDispatch( RegDataType ); | ||||
|    RegistrarDispatch( RegCommand ); | ||||
| @@ -69,6 +69,9 @@ void Registrar::Finish() | ||||
|    pRegistrar = NULL; | ||||
| } | ||||
|  | ||||
|  | ||||
|  | ||||
| };//End of Namespace. | ||||
| void Registrar::ShowNewPanel() | ||||
| { | ||||
|    wxASSERT( pRegistrar !=NULL ); | ||||
|    if( pRegistrar->pShowFn != NULL) | ||||
|       pRegistrar->pShowFn(); | ||||
| } | ||||
| @@ -13,16 +13,9 @@ | ||||
| #ifndef __AUDACITY_REGISTRAR__ | ||||
| #define __AUDACITY_REGISTRAR__ | ||||
|  | ||||
| // MSVC auto-indents, but I don't want that, for the namespace. | ||||
| // so using a macro for that works around ir | ||||
| // AND allows me to change the namespace name easily. | ||||
|  | ||||
| #define START_NAMESPACE namespace ModTrackPanel { | ||||
|  | ||||
| START_NAMESPACE  | ||||
|  | ||||
| typedef enum | ||||
| { | ||||
|    RegResource, | ||||
|    RegArtist, | ||||
|    RegDataType, | ||||
|    RegCommand, | ||||
| @@ -31,14 +24,22 @@ typedef enum | ||||
| } t_RegistrarDispatchType; | ||||
|  | ||||
| class Registrar { | ||||
|    Registrar::Registrar(){ | ||||
|       pShowFn = NULL;} | ||||
| public: | ||||
|    // Fairly generic registrar functions. | ||||
|    static void Start(); | ||||
|    static void Finish(); | ||||
|  | ||||
|    // Somewhat specific to this application registrar functions. | ||||
|    // These mostly reflect one-offs, where a more sophisticated  | ||||
|    // system would manage a list. | ||||
|    static void ShowNewPanel(); | ||||
| public: | ||||
|    void (*pShowFn)(void); | ||||
| }; | ||||
|  | ||||
|  | ||||
| extern int RegistrarDispatch( t_RegistrarDispatchType Type ); | ||||
|  | ||||
| };//End of Namespace. | ||||
| #endif | ||||
|   | ||||
| @@ -11,19 +11,15 @@ | ||||
|  | ||||
| ********************************************************************//** | ||||
|  | ||||
| \class Registrar | ||||
| \brief Registrar is a class that other classes register resources of | ||||
| various kinds with.  It makes a system that is much more amenable to  | ||||
| plugging in of new resources. | ||||
| \class SkewedRuller | ||||
| \brief SkewedRuler draws a ruler for aligning two sequences. | ||||
|  | ||||
| *//********************************************************************/ | ||||
|  | ||||
| #include <wx/wx.h> | ||||
| #include "Registrar.h" | ||||
| #include "SkewedRuler.h" | ||||
|  | ||||
| START_NAMESPACE | ||||
|  | ||||
|  | ||||
| extern int SkewedRulerDispatch( Registrar & R, t_RegistrarDispatchType Type ) | ||||
| { | ||||
|    switch( Type ) | ||||
| @@ -137,4 +133,4 @@ int DragGridSizerDispatch( Registrar & R, t_RegistrarDispatchType Type ) | ||||
| } | ||||
|  | ||||
|  | ||||
| };//End of Namespace. | ||||
|  | ||||
|   | ||||
| @@ -13,13 +13,11 @@ | ||||
| #ifndef __AUDACITY_SKEWED_RULER__ | ||||
| #define __AUDACITY_SKEWED_RULER__ | ||||
|  | ||||
| #include "Registrar.h" | ||||
| START_NAMESPACE  | ||||
|  | ||||
|  | ||||
| class SkewedRuler { | ||||
| public: | ||||
|  | ||||
| }; | ||||
|  | ||||
| };//End of Namespace. | ||||
| #endif | ||||
|   | ||||
							
								
								
									
										107
									
								
								lib-src/mod-track-panel/TrackPanel2.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										107
									
								
								lib-src/mod-track-panel/TrackPanel2.cpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,107 @@ | ||||
| /********************************************************************** | ||||
|  | ||||
|   Audacity: A Digital Audio Editor | ||||
|  | ||||
|   Registrar.cpp | ||||
|  | ||||
|   James Crook | ||||
|  | ||||
|   Audacity is free software. | ||||
|   This file is licensed under the wxWidgets license, see License.txt | ||||
|  | ||||
| ********************************************************************//** | ||||
|  | ||||
| \class TrackPanel2 | ||||
| \brief TrackPanel2 is the start of the new TrackPanel. | ||||
|  | ||||
| *//********************************************************************/ | ||||
|  | ||||
| #include <wx/wx.h> | ||||
| #include "ShuttleGui.h" | ||||
| #include "widgets/LinkingHtmlWindow.h" | ||||
| #include "SkewedRuler.h" | ||||
| #include "Registrar.h" | ||||
| #include "TrackPanel2.h" | ||||
|  | ||||
|  | ||||
| void ShowTrackPanel() | ||||
| { | ||||
|    int k=42; | ||||
|  | ||||
|    wxDialog Dlg(NULL, wxID_ANY, wxString(wxT("Experimental New TrackPanel"))); | ||||
|    ShuttleGui S(&Dlg, eIsCreating); | ||||
| #if 0 | ||||
|    S.StartHorizontalLay(wxCENTER, false); | ||||
|    { | ||||
|       S.StartStatic(wxT(""), false);    | ||||
|       { | ||||
|          S.SetBorder(200); | ||||
|          S.AddFixedText(wxT("AAA")); | ||||
|       } | ||||
|       S.EndStatic(); | ||||
|    } | ||||
|    S.EndHorizontalLay(); | ||||
| #endif | ||||
|    S.StartNotebook(); | ||||
|    { | ||||
|       S.StartNotebookPage( _("Panel") ); | ||||
|       S.StartVerticalLay(1); | ||||
|       { | ||||
|          HtmlWindow *html = new LinkingHtmlWindow(S.GetParent(), -1, | ||||
|                                                wxDefaultPosition, | ||||
|                                                wxSize(600, 359),  | ||||
|                                                wxHW_SCROLLBAR_AUTO | wxSUNKEN_BORDER); | ||||
|          html->SetFocus(); | ||||
|          html->SetPage(wxT("<h1><font color=\"blue\">TrackPanel</font></h1>This will be replaced with the panel")); | ||||
|          S.Prop(1).AddWindow( html, wxEXPAND ); | ||||
|       } | ||||
|       S.EndVerticalLay(); | ||||
|       S.EndNotebookPage(); | ||||
|  | ||||
|       S.StartNotebookPage( _("Diagnostics") ); | ||||
|       S.StartVerticalLay(1); | ||||
|       { | ||||
|          HtmlWindow *html = new LinkingHtmlWindow(S.GetParent(), -1, | ||||
|                                                wxDefaultPosition, | ||||
|                                                wxSize(600, 359),  | ||||
|                                                wxHW_SCROLLBAR_AUTO | wxSUNKEN_BORDER); | ||||
|          html->SetFocus(); | ||||
|          html->SetPage(wxT("<h1>Diagnostics</h1>This is an html diagnostics page")); | ||||
|          S.Prop(1).AddWindow( html, wxEXPAND ); | ||||
|       } | ||||
|       S.EndVerticalLay(); | ||||
|       S.EndNotebookPage(); | ||||
|    } | ||||
|    S.EndNotebook(); | ||||
|     | ||||
|    wxButton *ok = new wxButton(S.GetParent(), wxID_OK, _("OK... Audacious!")); | ||||
|    ok->SetDefault(); | ||||
|    S.Prop(0).AddWindow( ok ); | ||||
|  | ||||
|    Dlg.Fit(); | ||||
|  | ||||
|    Dlg.ShowModal(); | ||||
| } | ||||
|  | ||||
|  | ||||
| int TrackPanel2Dispatch( Registrar & R, t_RegistrarDispatchType Type ) | ||||
| { | ||||
|    switch( Type ) | ||||
|    { | ||||
|    case RegResource: | ||||
|       R.pShowFn = ShowTrackPanel; | ||||
|       break; | ||||
|    case RegArtist: | ||||
|       break; | ||||
|    case RegDataType: | ||||
|       break; | ||||
|    case RegCommand: | ||||
|       break; | ||||
|    case RegMenuItem: | ||||
|       break; | ||||
|    default: | ||||
|       break; | ||||
|    } | ||||
|    return 1; | ||||
| } | ||||
|  | ||||
							
								
								
									
										20
									
								
								lib-src/mod-track-panel/TrackPanel2.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								lib-src/mod-track-panel/TrackPanel2.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,20 @@ | ||||
| /********************************************************************** | ||||
|  | ||||
|   Audacity: A Digital Audio Editor | ||||
|  | ||||
|   TrackPanel2.h | ||||
|  | ||||
|   James Crook | ||||
|  | ||||
| **********************************************************************/ | ||||
|  | ||||
| #ifndef __AUDACITY_TRACK_PANEL2__ | ||||
| #define __AUDACITY_TRACK_PANEL2__ | ||||
|  | ||||
|  | ||||
| class TrackPanel2 { | ||||
| public: | ||||
|  | ||||
| }; | ||||
|  | ||||
| #endif | ||||
| @@ -63,7 +63,7 @@ | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCLinkerTool" | ||||
| 				AdditionalDependencies="wxmsw28ud_core.lib wxbase28ud.lib odbc32.lib odbccp32.lib oldnames.lib comctl32.lib rpcrt4.lib wsock32.lib netapi32.lib Audacity.lib" | ||||
| 				AdditionalDependencies="wxmsw28ud_core.lib wxbase28ud.lib wxmsw28ud_html.lib odbc32.lib odbccp32.lib oldnames.lib comctl32.lib rpcrt4.lib wsock32.lib netapi32.lib Audacity.lib" | ||||
| 				OutputFile="$(OutDir)\modules\$(ProjectName).dll" | ||||
| 				AdditionalLibraryDirectories=""$(WXWIN)\lib\vc_dll";"$(OutDir)"" | ||||
| 				GenerateDebugInformation="true" | ||||
| @@ -138,7 +138,7 @@ | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCLinkerTool" | ||||
| 				AdditionalDependencies="wxmsw28u_core.lib wxbase28u.lib odbc32.lib odbccp32.lib oldnames.lib comctl32.lib rpcrt4.lib wsock32.lib netapi32.lib Audacity.lib" | ||||
| 				AdditionalDependencies="wxmsw28u_core.lib wxbase28u.lib wxmsw28u_html.lib odbc32.lib odbccp32.lib oldnames.lib comctl32.lib rpcrt4.lib wsock32.lib netapi32.lib Audacity.lib" | ||||
| 				OutputFile="$(OutDir)\modules\$(ProjectName).dll" | ||||
| 				LinkIncremental="1" | ||||
| 				AdditionalLibraryDirectories=""$(WXWIN)\lib\vc_dll";"$(OutDir)"" | ||||
| @@ -203,6 +203,14 @@ | ||||
| 				RelativePath=".\SkewedRuler.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath=".\TrackPanel2.cpp" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath=".\TrackPanel2.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 		</Filter> | ||||
| 	</Files> | ||||
| 	<Globals> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user