diff --git a/lib-src/mod-track-panel/ModTrackPanelCallback.cpp b/lib-src/mod-track-panel/ModTrackPanelCallback.cpp index b9308ad90..09f4bdcdb 100644 --- a/lib-src/mod-track-panel/ModTrackPanelCallback.cpp +++ b/lib-src/mod-track-panel/ModTrackPanelCallback.cpp @@ -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: diff --git a/lib-src/mod-track-panel/Registrar.cpp b/lib-src/mod-track-panel/Registrar.cpp index 92535e0ca..f6798b977 100644 --- a/lib-src/mod-track-panel/Registrar.cpp +++ b/lib-src/mod-track-panel/Registrar.cpp @@ -21,8 +21,6 @@ plugging in of new resources. #include #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(); +} \ No newline at end of file diff --git a/lib-src/mod-track-panel/Registrar.h b/lib-src/mod-track-panel/Registrar.h index bd7cc81d7..73014c12c 100644 --- a/lib-src/mod-track-panel/Registrar.h +++ b/lib-src/mod-track-panel/Registrar.h @@ -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 diff --git a/lib-src/mod-track-panel/SkewedRuler.cpp b/lib-src/mod-track-panel/SkewedRuler.cpp index 218847aa7..533e2f8ed 100644 --- a/lib-src/mod-track-panel/SkewedRuler.cpp +++ b/lib-src/mod-track-panel/SkewedRuler.cpp @@ -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 +#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. + diff --git a/lib-src/mod-track-panel/SkewedRuler.h b/lib-src/mod-track-panel/SkewedRuler.h index 0c082f77e..723ede964 100644 --- a/lib-src/mod-track-panel/SkewedRuler.h +++ b/lib-src/mod-track-panel/SkewedRuler.h @@ -13,13 +13,11 @@ #ifndef __AUDACITY_SKEWED_RULER__ #define __AUDACITY_SKEWED_RULER__ -#include "Registrar.h" -START_NAMESPACE + class SkewedRuler { public: }; -};//End of Namespace. #endif diff --git a/lib-src/mod-track-panel/TrackPanel2.cpp b/lib-src/mod-track-panel/TrackPanel2.cpp new file mode 100644 index 000000000..1dac9ccd8 --- /dev/null +++ b/lib-src/mod-track-panel/TrackPanel2.cpp @@ -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 +#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("

TrackPanel

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("

Diagnostics

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; +} + diff --git a/lib-src/mod-track-panel/TrackPanel2.h b/lib-src/mod-track-panel/TrackPanel2.h new file mode 100644 index 000000000..58c40470b --- /dev/null +++ b/lib-src/mod-track-panel/TrackPanel2.h @@ -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 diff --git a/lib-src/mod-track-panel/mod-track-panel.vcproj b/lib-src/mod-track-panel/mod-track-panel.vcproj index b8f6dacbf..f3c0902e2 100644 --- a/lib-src/mod-track-panel/mod-track-panel.vcproj +++ b/lib-src/mod-track-panel/mod-track-panel.vcproj @@ -63,7 +63,7 @@ /> + + + +