コード例 #1
0
void RightPopupMenu::CreateCommonMenu(wxMenu& menu)
{
	if (m_edited_sprs.empty()) {
		return;
	}

	m_parent->Bind(wxEVT_COMMAND_MENU_SELECTED, &EditPanelImpl::OnRightPopupMenu, m_stage, MENU_UP_LAYER);
	menu.Append(MENU_UP_LAYER, "ÉÏÒÆÒ»²ã");
	m_parent->Bind(wxEVT_COMMAND_MENU_SELECTED, &EditPanelImpl::OnRightPopupMenu, m_stage, MENU_DOWN_LAYER);
	menu.Append(MENU_DOWN_LAYER, "ÏÂÒÆÒ»²ã");	

	m_parent->Bind(wxEVT_COMMAND_MENU_SELECTED, &EditPanelImpl::OnRightPopupMenu, m_stage, MENU_UP_MOST);
	menu.Append(MENU_UP_MOST, "ÒƵ½¶¥");
	m_parent->Bind(wxEVT_COMMAND_MENU_SELECTED, &EditPanelImpl::OnRightPopupMenu, m_stage, MENU_DOWN_MOST);
	menu.Append(MENU_DOWN_MOST, "ÒƵ½µ×");

	menu.AppendSeparator();

	m_parent->Bind(wxEVT_COMMAND_MENU_SELECTED, &EditPanelImpl::OnRightPopupMenu, m_stage, MENU_HORI_MIRROR);
	menu.Append(MENU_HORI_MIRROR, "ˮƽ¾µÏñ");
	m_parent->Bind(wxEVT_COMMAND_MENU_SELECTED, &EditPanelImpl::OnRightPopupMenu, m_stage, MENU_VERT_MIRROR);
	menu.Append(MENU_VERT_MIRROR, "ÊúÖ±¾µÏñ");

	menu.AppendSeparator();

	if (m_edited_sprs.size() == 1) 
	{
		m_parent->Bind(wxEVT_COMMAND_MENU_SELECTED, &EditPanelImpl::OnRightPopupMenu, m_stage, MENU_SELECT_SAME);
		menu.Append(MENU_SELECT_SAME, "Ñ¡ÔñÏàͬ");

		menu.AppendSeparator();
	}
}
コード例 #2
0
void ddTextTableItemFigure::createMenu(wxMenu &mnu)
{
	wxMenu *submenu;
	wxMenuItem *item;

	mnu.Append(MNU_DDADDCOLUMN, _("Add a column..."));
	item = mnu.Append(MNU_DELCOLUMN, _("Delete the selected column..."));
	if(getOwnerColumn()->isGeneratedForeignKey())
		item->Enable(false);
	mnu.Append(MNU_RENAMECOLUMN, _("Rename the selected column..."));
	if(getOwnerColumn()->isGeneratedForeignKey() && !getOwnerColumn()->isFkNameGenerated())
		mnu.Append(MNU_AUTONAMCOLUMN, _("Activate fk auto-naming..."));
	mnu.AppendSeparator();
	item = mnu.AppendCheckItem(MNU_NOTNULL, _("Not NULL constraint"));
	if(getOwnerColumn()->isNotNull())
		item->Check(true);
	if(getOwnerColumn()->isGeneratedForeignKey())
		item->Enable(false);
	mnu.AppendSeparator();
	item = mnu.AppendCheckItem(MNU_PKEY, _("Primary Key"));
	if(getOwnerColumn()->isPrimaryKey())
		item->Check(true);
	if(getOwnerColumn()->isGeneratedForeignKey())
		item->Enable(false);
	item = mnu.AppendCheckItem(MNU_UKEY, _("Unique Key"));
	if(getOwnerColumn()->isUniqueKey())
		item->Check(true);
	mnu.AppendSeparator();
	submenu = new wxMenu();
	item = mnu.AppendSubMenu(submenu, _("Column datatype"));
	if(getOwnerColumn()->isGeneratedForeignKey())
		item->Enable(false);
	item = submenu->AppendCheckItem(MNU_TYPESERIAL, _("serial"));
	item->Check(columnType == dt_bigint);
	item = submenu->AppendCheckItem(MNU_TYPEBOOLEAN, _("boolean"));
	item->Check(columnType == dt_boolean);
	item = submenu->AppendCheckItem(MNU_TYPEINTEGER, _("integer"));
	item->Check(columnType == dt_integer);
	item = submenu->AppendCheckItem(MNU_TYPEMONEY, _("money"));
	item->Check(columnType == dt_money);
	item = submenu->AppendCheckItem(MNU_TYPEVARCHAR, _("varchar(n)"));
	item->Check(columnType == dt_varchar);
	item = submenu->Append(MNU_TYPEOTHER, _("Choose another datatype..."));
	mnu.AppendSeparator();
	mnu.Append(MNU_TYPEPKEY_CONSTRAINTNAME, _("Primary Key Constraint name..."));
	mnu.Append(MNU_TYPEUKEY_CONSTRAINTNAME, _("Unique Key Constraint name..."));
	mnu.AppendSeparator();
	mnu.Append(MNU_DELTABLE, _("Delete table..."));
};
コード例 #3
0
    void showPopupMenu( wxMenu& menu ) override
    {
        if( m_grid->GetGridCursorCol() == COL_OPTIONS )
        {
            menu.Append( MYID_OPTIONS_EDITOR, _( "Options Editor..." ), _( "Edit options" ) );
            menu.AppendSeparator();
        }

        GRID_TRICKS::showPopupMenu( menu );
    }
コード例 #4
0
ファイル: pcb_layer_widget.cpp プロジェクト: johnbeard/kicad
void PCB_LAYER_WIDGET::AddRightClickMenuItems( wxMenu& menu )
{
    // menu text is capitalized:
    // http://library.gnome.org/devel/hig-book/2.20/design-text-labels.html.en#layout-capitalization
    AddMenuItem( &menu, ID_SHOW_ALL_COPPER_LAYERS,
                 _( "Show All Copper Layers" ),
                 KiBitmap( select_layer_pair_xpm ) );
    AddMenuItem( &menu, ID_SHOW_NO_COPPER_LAYERS_BUT_ACTIVE,
                 _( "Hide All Copper Layers But Active" ),
                 KiBitmap( select_w_layer_xpm ) );
    AddMenuItem( &menu, ID_ALWAYS_SHOW_NO_COPPER_LAYERS_BUT_ACTIVE,
                 _( "Always Hide All Copper Layers But Active" ),
                 KiBitmap( select_w_layer_xpm ) );
    AddMenuItem( &menu, ID_SHOW_NO_COPPER_LAYERS,
                 _( "Hide All Copper Layers" ),
                 KiBitmap( show_no_copper_layers_xpm ) );

    menu.AppendSeparator();

    AddMenuItem( &menu, ID_SHOW_ALL_NON_COPPER,
                 _( "Show All Non Copper Layers" ),
                 KiBitmap( select_w_layer_xpm ) );
    AddMenuItem( &menu, ID_HIDE_ALL_NON_COPPER,
                 _( "Hide All Non Copper Layers" ),
                 KiBitmap( show_no_copper_layers_xpm ) );

    menu.AppendSeparator();

    AddMenuItem( &menu, ID_SHOW_NO_LAYERS, _( "Hide All Layers" ),
                 KiBitmap( show_no_layers_xpm ) );
    AddMenuItem( &menu, ID_SHOW_ALL_LAYERS, _( "Show All Layers" ),
                 KiBitmap( show_all_layers_xpm ) );

    menu.AppendSeparator();

    AddMenuItem( &menu, ID_SHOW_ALL_FRONT, _( "Show All Front Layers" ),
                 KiBitmap( show_no_layers_xpm ) );

    AddMenuItem( &menu, ID_SHOW_ALL_BACK, _( "Show All Back Layers" ),
                 KiBitmap( show_all_layers_xpm ) );
}
コード例 #5
0
void RightPopupMenu::CreateDebugMenu(wxMenu& menu)
{
	if (m_edited_sprs.empty()) {
		return;
	}

#ifdef _DEBUG
	m_parent->Bind(wxEVT_COMMAND_MENU_SELECTED, &EditPanelImpl::OnRightPopupMenu, m_stage, MENU_INSERT_TO_DTEX);
	menu.Append(MENU_INSERT_TO_DTEX, "Insert To DTex");
	m_parent->Bind(wxEVT_COMMAND_MENU_SELECTED, &EditPanelImpl::OnRightPopupMenu, m_stage, MENU_REMOVE_FROM_DTEX);
	menu.Append(MENU_REMOVE_FROM_DTEX, "Remove From DTex");

	menu.AppendSeparator();
#endif
}
コード例 #6
0
void RightPopupMenu::CreateSelectMenu(wxMenu& menu)
{
	if (m_selected_sprs.size() <= 1) {
		return;
	}

	int sz = std::min(MENU_MULTI_SELECTED_END - MENU_MULTI_SELECTED + 1, (int)m_selected_sprs.size());
	for (int i = 0; i < sz; ++i) {
		auto spr = m_selected_sprs[i];
		m_parent->Bind(wxEVT_COMMAND_MENU_SELECTED, &EditPanelImpl::OnRightPopupMenu, m_stage, MENU_MULTI_SELECTED + i);
		auto name = FileHelper::GetFilename(std::dynamic_pointer_cast<ee::Symbol>(spr->GetSymbol())->GetFilepath());
		menu.Append(MENU_MULTI_SELECTED + i, name.c_str());
	}

	menu.AppendSeparator();
}
コード例 #7
0
ファイル: subs_edit_ctrl.cpp プロジェクト: seawaveT/Aegisub
void SubsTextEditCtrl::AddThesaurusEntries(wxMenu &menu) {
	if (currentWord.empty()) return;

	if (!thesaurus)
		thesaurus.reset(new Thesaurus);

	std::vector<Thesaurus::Entry> results;
	thesaurus->Lookup(currentWord, &results);

	thesSugs.clear();

	if (results.size()) {
		wxMenu *thesMenu = new wxMenu;

		int curThesEntry = 0;
		for (auto const& result : results) {
			// Single word, insert directly
			if (result.second.size() == 1) {
				thesMenu->Append(EDIT_MENU_THESAURUS_SUGS+curThesEntry, to_wx(result.first));
				thesSugs.push_back(result.first);
				++curThesEntry;
			}
			// Multiple, create submenu
			else {
				wxMenu *subMenu = new wxMenu;
				for (auto const& sug : result.second) {
					subMenu->Append(EDIT_MENU_THESAURUS_SUGS+curThesEntry, to_wx(sug));
					thesSugs.push_back(sug);
					++curThesEntry;
				}

				thesMenu->Append(-1, to_wx(result.first), subMenu);
			}
		}

		menu.Append(-1, wxString::Format(_("Thesaurus suggestions for \"%s\""), to_wx(currentWord)), thesMenu);
	}
	else
		menu.Append(EDIT_MENU_THESAURUS,_("No thesaurus suggestions"))->Enable(false);

	// Append language list
	menu.Append(-1,_("Thesaurus language"), GetLanguagesMenu(
		EDIT_MENU_THES_LANGS,
		to_wx(OPT_GET("Tool/Thesaurus/Language")->GetString()),
		to_wx(thesaurus->GetLanguageList())));
	menu.AppendSeparator();
}
コード例 #8
0
//Hack to allow use (events) of wxmenu inside a tool like simpletexttool
void ddDrawingView::setTextPopUpList(wxArrayString &strings, wxMenu &mnu)
{
	//DD-TODO: choose a better id for event
	mnu.Disconnect(wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)(wxEventFunction) (wxCommandEventFunction) &ddDrawingView::OnTextPopupClick,NULL,this);
	int sz = strings.size();  //to avoid warning
	wxMenuItem *item = NULL;
	wxMenu *submenu = NULL;
	bool isSubItem;
	bool subItemsDisable=false;
	for(int i=0 ; i < sz ; i++){
			//DD-TODO: only create options for what I need, this can be improved later
			//String "--submenu##menu item**sub menu title" and "--subitem--" create and add items to last created submenu
			isSubItem=false;
			item=NULL;
			if(strings[i].Contains(wxT("--submenu"))) 
			{
				if(strings[i].Contains(wxT("--disable"))) 
					subItemsDisable=true;
				else
					subItemsDisable=false;
				submenu = new wxMenu(strings[i].SubString(strings[i].find(wxT("**"))+2,strings[i].length())); 
				mnu.AppendSubMenu(submenu,strings[i].SubString(strings[i].find(wxT("##"))+2,strings[i].find(wxT("**"))-1));
			}
			else if(strings[i].Contains(wxT("--subitem")))
			{
				isSubItem=true;
				if(submenu)
				{
					if(strings[i].Contains(wxT("--checked")))
					{
						item=submenu->AppendCheckItem(i,strings[i].SubString(strings[i].find(wxT("**"))+2,strings[i].length()));
					}
					else
					{
						item=submenu->Append(i,strings[i].SubString(strings[i].find(wxT("**"))+2,strings[i].length()));
					}
				}
				else
				{
					wxMessageDialog *error = new wxMessageDialog(NULL, wxT("Error setting text popup strings list"), wxT("Error!"), wxOK | wxICON_ERROR);
					error->ShowModal();
					delete error;
				}
			}
			else if(strings[i].Contains(wxT("--separator--")))
			{
				mnu.AppendSeparator();
			}
			else if(strings[i].Contains(wxT("--checked")))
			{
				item = mnu.AppendCheckItem(i, strings[i].SubString(strings[i].find(wxT("**"))+2,strings[i].length()));
			}
			else if(strings[i].Contains(wxT("**")))
			{
				item = mnu.Append(i, strings[i].SubString(strings[i].find(wxT("**"))+2,strings[i].length()));
			}
			else 
			{
				item = mnu.Append(i, strings[i]);
			}

			if(item && strings[i].Contains(wxT("--checked")))
			{
				item->Check(true);
			}
			if(   item &&  ( strings[i].Contains(wxT("--disable")) || (submenu && isSubItem && subItemsDisable) )   )
			{
				item->Enable(false);
			}

		}
//DD-TODO: create a better version of this hack
	mnu.Connect(wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)(wxEventFunction) (wxCommandEventFunction) &ddDrawingView::OnTextPopupClick,NULL,this);
}