Exemplo n.º 1
0
std::list<wxMenuItem*> CONTEXT_MENU::Add( CONTEXT_MENU* aMenu, const wxString& aLabel, bool aExpand )
{
    std::list<wxMenuItem*> items;
    CONTEXT_MENU* menuCopy = new CONTEXT_MENU( *aMenu );
    m_submenus.push_back( menuCopy );
    menuCopy->m_parent = this;

    if( aExpand )
    {
        for( int i = 0; i < (int) aMenu->GetMenuItemCount(); ++i )
        {
            wxMenuItem* item = aMenu->FindItemByPosition( i );
            items.push_back( appendCopy( item ) );
        }
    }
    else
    {
        if( aMenu->m_icon )
        {
            wxMenuItem* newItem = new wxMenuItem( this, -1, aLabel, wxEmptyString, wxITEM_NORMAL );
            newItem->SetBitmap( KiBitmap( aMenu->m_icon ) );
            newItem->SetSubMenu( menuCopy );
            items.push_back( Append( newItem ) );
        }
        else
        {
            items.push_back( AppendSubMenu( menuCopy, aLabel ) );
        }
    }

    return items;
}
Exemplo n.º 2
0
CMenuEdit::CMenuEdit()
{
  Append(
    IDmenuEditDirectory,
    LABEL_EDIT_DIRECTORY
    );
  Append(
    IDmenuEditCell,
    ".",
    "Edit selected data"
    );
  m_pMenuAccept = new CMenuAccept;
  m_pMenuItemAccept = AppendSubMenu(m_pMenuAccept,LABEL_ACCEPT_ALERTS);
  m_pMenuReview = new CMenuReview;
  m_pMenuItemReview = AppendSubMenu(m_pMenuReview,LABEL_REVIEW_EDIT);
  Append(IDmenuDisableSample,".");
}
Exemplo n.º 3
0
void wxGISMenu::AddMenu(wxMenu* pMenu, wxString sName)
{		
	IGISCommandBar* pGISCommandBar = dynamic_cast<IGISCommandBar*>(pMenu);
	if(pGISCommandBar)
		pGISCommandBar->Reference();
	SUBMENUDATA data = {AppendSubMenu(pMenu, sName), pGISCommandBar};
	m_SubmenuArray.push_back(data);
}
Exemplo n.º 4
0
void wxGISMenu::AddCommand(wxGISCommand* pCmd)
{
	switch(pCmd->GetKind())
	{
	case enumGISCommandSeparator:
		AppendSeparator();
		break;
	case enumGISCommandMenu:
		{
			wxGISCommandBar* pGISCommandBar = dynamic_cast<wxGISCommandBar*>(pCmd);
			if(pGISCommandBar)
			{
				pGISCommandBar->Reference();
				SUBMENUDATA data = {AppendSubMenu(dynamic_cast<wxMenu*>(pCmd), pCmd->GetCaption(), pCmd->GetMessage()), pGISCommandBar};
				m_SubmenuArray.push_back(data);
			}
		}
		break;
	case enumGISCommandCheck:
	case enumGISCommandRadio:
    case enumGISCommandNormal:
		{
			wxMenuItem *item = new wxMenuItem(this, pCmd->GetID(), pCmd->GetCaption(), pCmd->GetMessage(), (wxItemKind)pCmd->GetKind());
#ifdef __WIN32__
            wxBitmap Bmp = pCmd->GetBitmap();
			if(Bmp.IsOk())
            {

                wxImage Img = Bmp.ConvertToImage();                //Img.RotateHue(-0.1);
				item->SetBitmaps(Bmp, Img.ConvertToGreyscale());
            }
 #endif
			Append(item);
		}
		break;
	case enumGISCommandDropDown:
		{
			wxMenuItem *item = new wxMenuItem(this, pCmd->GetID(), pCmd->GetCaption(), pCmd->GetMessage(), (wxItemKind)enumGISCommandNormal);
#ifdef __WIN32__
			wxBitmap Bmp = pCmd->GetBitmap();
			if(Bmp.IsOk())
				item->SetBitmap(Bmp);
#endif
			Append(item);
		}
		break;
	case enumGISCommandControl:
		return;
	}
	wxGISCommandBar::AddCommand(pCmd);
}
Exemplo n.º 5
0
void wxGISMenu::AddCommand(ICommand* pCmd)
{
	switch(pCmd->GetKind())
	{
	case enumGISCommandSeparator:
		AppendSeparator();
		break;
	case enumGISCommandMenu:
		{
			IGISCommandBar* pGISCommandBar = dynamic_cast<IGISCommandBar*>(pCmd);
			if(pGISCommandBar)
			{
				pGISCommandBar->Reference();
				SUBMENUDATA data = {AppendSubMenu(dynamic_cast<wxMenu*>(pCmd), pCmd->GetCaption(), pCmd->GetMessage()), pGISCommandBar};
				m_SubmenuArray.push_back(data);
			}
		}
		break;
	case enumGISCommandCheck:
	case enumGISCommandRadio:
	case enumGISCommandNormal:
		{
			wxMenuItem *item = new wxMenuItem(this, pCmd->GetID(), pCmd->GetCaption(), pCmd->GetMessage(), (wxItemKind)pCmd->GetKind());
			wxBitmap Bmp = pCmd->GetBitmap();
			if(Bmp.IsOk())
				item->SetBitmaps(Bmp);//SetBitmap
			Append(item);
			//wxMenuItem* pItem = Append(pCmd->GetID(), pCmd->GetCaption(), pCmd->GetMessage(), pCmd->GetKind());
			//pItem->SetBitmaps(pCmd->GetBitmap());
		}
		break;
	case enumGISCommandControl:
		return;
	}
	wxGISCommandBar::AddCommand(pCmd);
}
Exemplo n.º 6
0
// -----------------------------------------------------------------------------
// Sets up the wxWidgets window layout
// -----------------------------------------------------------------------------
void MainWindow::setupLayout()
{
	// Create the wxAUI manager & related things
	aui_mgr_ = new wxAuiManager(this);
	aui_mgr_->SetArtProvider(new SAuiDockArt());
	wxAuiPaneInfo p_inf;

	// Set icon
	auto icon_filename = App::path(App::iconFile(), App::Dir::Temp);
	App::archiveManager().programResourceArchive()->entry(App::iconFile())->exportFile(icon_filename);
	SetIcon(wxIcon(icon_filename, wxBITMAP_TYPE_ICO));
	wxRemoveFile(icon_filename);


	// -- Editor Area --
	stc_tabs_ = new STabCtrl(this, true, true, tabs_condensed ? 27 : 31, true, true);

	// Setup panel info & add panel
	p_inf.CenterPane();
	p_inf.Name("editor_area");
	p_inf.PaneBorder(false);
	aui_mgr_->AddPane(stc_tabs_, p_inf);

	// Create Start Page
	start_page_ = new SStartPage(stc_tabs_);
	if (show_start_page)
	{
		stc_tabs_->AddPage(start_page_, "Start Page");
		stc_tabs_->SetPageBitmap(0, Icons::getIcon(Icons::General, "logo"));
		start_page_->init();
		createStartPage();
	}
	else
		start_page_->Show(false);

	// -- Console Panel --
	auto panel_console = new ConsolePanel(this, -1);

	// Setup panel info & add panel
	p_inf.DefaultPane();
	p_inf.Float();
	p_inf.FloatingSize(WxUtils::scaledSize(600, 400));
	p_inf.FloatingPosition(WxUtils::scaledPoint(100, 100));
	p_inf.MinSize(WxUtils::scaledSize(-1, 192));
	p_inf.Show(false);
	p_inf.Caption("Console");
	p_inf.Name("console");
	aui_mgr_->AddPane(panel_console, p_inf);


	// -- Archive Manager Panel --
	panel_archivemanager_ = new ArchiveManagerPanel(this, stc_tabs_);

	// Setup panel info & add panel
	p_inf.DefaultPane();
	p_inf.Left();
	p_inf.BestSize(WxUtils::scaledSize(192, 480));
	p_inf.Caption("Archive Manager");
	p_inf.Name("archive_manager");
	p_inf.Show(true);
	p_inf.Dock();
	aui_mgr_->AddPane(panel_archivemanager_, p_inf);


	// -- Undo History Panel --
	panel_undo_history_ = new UndoManagerHistoryPanel(this, nullptr);

	// Setup panel info & add panel
	p_inf.DefaultPane();
	p_inf.Right();
	p_inf.BestSize(WxUtils::scaledSize(128, 480));
	p_inf.Caption("Undo History");
	p_inf.Name("undo_history");
	p_inf.Show(false);
	p_inf.Dock();
	aui_mgr_->AddPane(panel_undo_history_, p_inf);


	// -- Menu bar --
	auto menu = new wxMenuBar();
	menu->SetThemeEnabled(false);

	// File menu
	auto file_new_menu = new wxMenu("");
	SAction::fromId("aman_newwad")->addToMenu(file_new_menu, "&Wad Archive");
	SAction::fromId("aman_newzip")->addToMenu(file_new_menu, "&Zip Archive");
	SAction::fromId("aman_newmap")->addToMenu(file_new_menu, "&Map");
	auto file_menu = new wxMenu("");
	file_menu->AppendSubMenu(file_new_menu, "&New", "Create a new Archive");
	SAction::fromId("aman_open")->addToMenu(file_menu);
	SAction::fromId("aman_opendir")->addToMenu(file_menu);
	file_menu->AppendSeparator();
	SAction::fromId("aman_save")->addToMenu(file_menu);
	SAction::fromId("aman_saveas")->addToMenu(file_menu);
	SAction::fromId("aman_saveall")->addToMenu(file_menu);
	file_menu->AppendSubMenu(panel_archivemanager_->getRecentMenu(), "&Recent Files");
	file_menu->AppendSeparator();
	SAction::fromId("aman_close")->addToMenu(file_menu);
	SAction::fromId("aman_closeall")->addToMenu(file_menu);
	file_menu->AppendSeparator();
	SAction::fromId("main_exit")->addToMenu(file_menu);
	menu->Append(file_menu, "&File");

	// Edit menu
	auto editor_menu = new wxMenu("");
	SAction::fromId("main_undo")->addToMenu(editor_menu);
	SAction::fromId("main_redo")->addToMenu(editor_menu);
	editor_menu->AppendSeparator();
	SAction::fromId("main_setbra")->addToMenu(editor_menu);
	SAction::fromId("main_preferences")->addToMenu(editor_menu);
	menu->Append(editor_menu, "E&dit");

	// View menu
	auto view_menu = new wxMenu("");
	SAction::fromId("main_showam")->addToMenu(view_menu);
	SAction::fromId("main_showconsole")->addToMenu(view_menu);
	SAction::fromId("main_showundohistory")->addToMenu(view_menu);
	SAction::fromId("main_showstartpage")->addToMenu(view_menu);
	toolbar_menu_ = new wxMenu();
	view_menu->AppendSubMenu(toolbar_menu_, "Toolbars");
	menu->Append(view_menu, "&View");

	// Tools menu
	auto tools_menu = new wxMenu("");
	SAction::fromId("main_runscript")->addToMenu(tools_menu);
	menu->Append(tools_menu, "&Tools");

	// Help menu
	auto help_menu = new wxMenu("");
	SAction::fromId("main_onlinedocs")->addToMenu(help_menu);
	SAction::fromId("main_about")->addToMenu(help_menu);
#ifdef __WXMSW__
	SAction::fromId("main_updatecheck")->addToMenu(help_menu);
#endif
	menu->Append(help_menu, "&Help");

	// Set the menu
	SetMenuBar(menu);



	// -- Toolbars --
	toolbar_ = new SToolBar(this, true);

	// Create File toolbar
	auto tbg_file = new SToolBarGroup(toolbar_, "_File");
	tbg_file->addActionButton("aman_newwad");
	tbg_file->addActionButton("aman_newzip");
	tbg_file->addActionButton("aman_open");
	tbg_file->addActionButton("aman_opendir");
	tbg_file->addActionButton("aman_save");
	tbg_file->addActionButton("aman_saveas");
	tbg_file->addActionButton("aman_saveall");
	tbg_file->addActionButton("aman_close");
	tbg_file->addActionButton("aman_closeall");
	toolbar_->addGroup(tbg_file);

	// Create Archive toolbar
	auto tbg_archive = new SToolBarGroup(toolbar_, "_Archive");
	tbg_archive->addActionButton("arch_newentry");
	tbg_archive->addActionButton("arch_newdir");
	tbg_archive->addActionButton("arch_importfiles");
	tbg_archive->addActionButton("arch_texeditor");
	tbg_archive->addActionButton("arch_mapeditor");
	tbg_archive->addActionButton("arch_run");
	toolbar_->addGroup(tbg_archive);

	// Create Entry toolbar
	auto tbg_entry = new SToolBarGroup(toolbar_, "_Entry");
	tbg_entry->addActionButton("arch_entry_rename");
	tbg_entry->addActionButton("arch_entry_delete");
	tbg_entry->addActionButton("arch_entry_import");
	tbg_entry->addActionButton("arch_entry_export");
	tbg_entry->addActionButton("arch_entry_moveup");
	tbg_entry->addActionButton("arch_entry_movedown");
	toolbar_->addGroup(tbg_entry);

	// Create Base Resource Archive toolbar
	auto tbg_bra = new SToolBarGroup(toolbar_, "_Base Resource", true);
	auto brc     = new BaseResourceChooser(tbg_bra);
	tbg_bra->addCustomControl(brc);
	tbg_bra->addActionButton("main_setbra", "settings");
	toolbar_->addGroup(tbg_bra);

	// Create Palette Chooser toolbar
	auto tbg_palette = new SToolBarGroup(toolbar_, "_Palette", true);
	palette_chooser_ = new PaletteChooser(tbg_palette, -1);
	palette_chooser_->selectPalette(global_palette);
	tbg_palette->addCustomControl(palette_chooser_);
	toolbar_->addGroup(tbg_palette);

	// Archive and Entry toolbars are initially disabled
	toolbar_->enableGroup("_archive", false);
	toolbar_->enableGroup("_entry", false);

	// Add toolbar
	aui_mgr_->AddPane(
		toolbar_,
		wxAuiPaneInfo()
			.Top()
			.CaptionVisible(false)
			.MinSize(-1, SToolBar::getBarHeight())
			.Resizable(false)
			.PaneBorder(false)
			.Name("toolbar"));

	// Populate the 'View->Toolbars' menu
	populateToolbarsMenu();
	toolbar_->enableContextMenu();

	// -- Status Bar --
	CreateStatusBar(3);


	// Load previously saved perspective string
	loadLayout();

	// Finalize
	aui_mgr_->Update();
	Layout();

	// Bind events
	Bind(wxEVT_SIZE, &MainWindow::onSize, this);
	Bind(wxEVT_CLOSE_WINDOW, &MainWindow::onClose, this);
	Bind(wxEVT_AUINOTEBOOK_PAGE_CHANGED, &MainWindow::onTabChanged, this);
	Bind(wxEVT_STOOLBAR_LAYOUT_UPDATED, &MainWindow::onToolBarLayoutChanged, this, toolbar_->GetId());
	Bind(wxEVT_ACTIVATE, &MainWindow::onActivate, this);
	Bind(wxEVT_AUINOTEBOOK_PAGE_CLOSE, [&](wxAuiNotebookEvent& e) {
		// Null start_page pointer if start page tab is closed
		auto page = stc_tabs_->GetPage(stc_tabs_->GetSelection());
		if (page->GetName() == "startpage")
			start_page_ = nullptr;
	});

	// Initial focus to toolbar
	toolbar_->SetFocus();
}
Exemplo n.º 7
0
void CMenuPlot::_Build(CPlotData *pData, CKitColors *pColors) 
{
  wxString s;
  const CSingleKitColors *pKitColors =
    pColors->GetKitColors(pData->GetKitName());
  const CChannelColors *pChannelColors;
  wxMenuItem *pItem;
  int nID;
  unsigned int iu;

  m_nChannelCount = pData->GetChannelCount();
  
  // build data menu

  m_pMenuData = new wxMenu;
  m_pMenuData->AppendCheckItem(
    _ID(IDmenuPlotDataAnalyzed),
    "Analyzed");
  m_pMenuData->AppendCheckItem(
    _ID(IDmenuPlotDataRaw),
    "Raw");
  m_pMenuData->AppendCheckItem(
    _ID(IDmenuPlotDataLadder),
    "Ladder");
  m_pMenuData->AppendCheckItem(
    _ID(IDmenuPlotDataBaseline),
    "Baseline");
  EnableBaseline(pData->HasBaseline());
  if(!m_bPreview)
  {
    m_pMenuData->Append(
      IDmenuTable,
      "Show Table");
  }


  // channel menu

  m_pMenuChannels = new wxMenu;
  if(pKitColors == NULL)
  {
    for(iu = 1; iu <= m_nChannelCount; iu++)
    {
      nID = _ID( ID_GET_CHANNEL_ID_FROM_NR(iu) );
      s.Printf("Channel %u",iu);
      m_pMenuChannels->AppendCheckItem(nID,s);
    }
  }
  else
  {
    for(iu = 1; iu <= m_nChannelCount; iu++)
    {
      pChannelColors = pKitColors->GetColorChannel(iu);
      if(pChannelColors != NULL)
      {
        nID = _ID(ID_GET_CHANNEL_ID_FROM_NR(iu));
        s = nwxString::FormatNumber((int)iu);
        s.Append(" - ");
        s.Append(pChannelColors->m_sDyeName);
        pItem = new wxMenuItem(
          m_pMenuChannels,nID,s,"",wxITEM_CHECK);
#if COLOR_MENU_ITEMS
        pItem->SetBackgroundColour(pChannelColors->m_ColorAnalyzed);
        pItem->SetTextColour(*wxWHITE);
#endif
        m_pMenuChannels->Append(pItem);
      }
    }
  }

  m_pMenuLabels = new CMenuLabels(true,m_nOffset);
  m_pMenuArtifact = new CMenuArtifact(m_nOffset);

  // now build the menu

  AppendSubMenu(m_pMenuData,"Data");
  AppendSubMenu(m_pMenuChannels,"Channel");
  if(!m_bPreview)
  {
    AppendCheckItem(
      _ID(IDmenuPlotSync),
      "Synchronize Axes");
  }
  AppendCheckItem(
    _ID(IDmenuPlotILS),
    "Show ILS");
  AppendCheckItem(
    _ID(IDmenuPlotRFU),
    "Show minimum RFU");
  m_pMenuItemLabels = AppendSubMenu(m_pMenuLabels,"Labels");
  AppendSubMenu(m_pMenuArtifact,"Artifacts");
  AppendCheckItem(
    _ID(IDmenuPlotLadderLabels),
    "Show ladder labels");
  if(!m_bPreview)
  {
    Append(_ID(IDmenuPlotResetAxes),
      "Reset Axes",
      "Reset axes to display all alleles");
    Append(_ID(IDmenuPlotResetAxesFull),
      "Show Primer Peaks",
      "Reset axes to include primer peaks");
    Append(_ID(IDmenuPlotMultiple),
      "Multiple Plots",
      "Show a plot for each channel");
    Append(_ID(IDmenuPlotAppend),
      "Append plot",
      "Append a new plot directly below this plot");
    Append(_ID(IDmenuPlotRemove),
      "Remove plot",
      "Remove this plot, keep all others");
    Append(_ID(IDmenuPlotRemoveOthers),
      "Remove other plots",
      "Remove all plots except this");
  }
  else
  {
    Append(IDMaxLadderLabels,
      LABEL_MAX_PEAK_LABELS,
      STATUS_MAX_PEAK_LABELS);
  }
}