Example #1
0
//This creates a toolbar of type t in the ToolBars array
void AudacityProject::LoadToolBar(enum ToolBarType t)
{

   //First, go through ToolBarArray and determine the current 
   //combined height of all toolbars.
   int tbheight = 0;
   int len = mToolBarArray.GetCount();
   for (int i = 0; i < len; i++)
      tbheight += mToolBarArray[i]->GetHeight();


   //Get the size of the current project window
   int width, height;
   GetSize(&width, &height);

   //Create a toolbar of the proper type
   ToolBar *toolbar;
   int h;
   switch (t) {
   case ControlToolBarID:
      h = gControlToolBarStub->GetHeight();
      toolbar = new ControlToolBar(this, -1, wxPoint(10, tbheight), wxSize(width - 10, h));
      ((wxMenuItemBase *)mViewMenu->FindItem(FloatControlToolBarID))->SetName(_("Float Control Toolbar"));
      mToolBarArray.Insert(toolbar, 0);
      break;

   case EditToolBarID:

      if (!gEditToolBarStub){
         gEditToolBarStub = new ToolBarStub(gParentWindow, EditToolBarID);
      }
      
      h = gEditToolBarStub->GetHeight();
      toolbar = new EditToolBar(this, -1, wxPoint(10, tbheight), wxSize(width - 10, h));
      
      
      mToolBarArray.Add(toolbar);
      break;

   case NoneID:
   default:
      toolbar = NULL;
      break;
   }

   //Add the new toolbar to the ToolBarArray and redraw screen
   mTotalToolBarHeight += toolbar->GetHeight() + 1;

   HandleResize();
}