menumgr.cpp
来自「开放源码的编译器open watcom 1.6.0版的源代码」· C++ 代码 · 共 465 行 · 第 1/2 页
CPP
465 行
/****************************************************************************
*
* Open Watcom Project
*
* Portions Copyright (c) 1983-2002 Sybase, Inc. All Rights Reserved.
*
* ========================================================================
*
* This file contains Original Code and/or Modifications of Original
* Code as defined in and that are subject to the Sybase Open Watcom
* Public License version 1.0 (the 'License'). You may not use this file
* except in compliance with the License. BY USING THIS FILE YOU AGREE TO
* ALL TERMS AND CONDITIONS OF THE LICENSE. A copy of the License is
* provided with the Original Code and Modifications, and is also
* available at www.sybase.com/developer/opensource.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND SYBASE AND ALL CONTRIBUTORS HEREBY DISCLAIM
* ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR
* NON-INFRINGEMENT. Please see the License for the specific language
* governing rights and limitations under the License.
*
* ========================================================================
*
* Description: WHEN YOU FIGURE OUT WHAT THIS FILE DOES, PLEASE
* DESCRIBE IT HERE!
*
****************************************************************************/
#include <wchash.h>
#include <wpopmenu.hpp>
#include <wmenuitm.hpp>
#include <wmenusep.hpp>
#include "assure.h"
#include "browse.h"
#include "menumgr.h"
#include "menuids.h"
#include "view.h"
#include "viewmgr.h"
struct MenuInfo {
MIMainMenu mainId;
const char * menuName;
const char * hint;
};
MenuInfo MainMenuInfo[ MMNumMainMenus ] = {
{ MMFile, "&File", "Create / Open DBR files, Load/Save Options" },
{ MMView, "&View", "Open new views / change view options for current window" },
{ MMDetail, "&Detail", "View extra information for this symbol" },
{ MMTree, "&Tree", "Select nodes to view" },
{ MMLocate, "&Locate", "Find symbols within view / re-load view" },
{ MMOptions, "&Options", "Change options for all windows" },
{ MMWindows, "&Windows", "Arrange/show/hide/select windows" },
{ MMHelp, "&Help", "View Help" },
};
MenuInfo CascadeMenuInfo[ CMNumCascadeMenus ] = {
{ VMInherit, "&Inheritance", "View the inheritance hierarchy" },
{ VMCall, "&Calls", "View the call hierarchy" },
};
struct SubMenuInfo {
MIMainMenu mainId;
MISubMenu subId;
const char * menuName;
const char * hint;
};
static SubMenuInfo FileMenuInfo[ FMNumFileMenus ] = {
{ MMFile, FMNew, "&New...", "Create a new database file" },
{ MMFile, FMOpen, "&Open...", "Open an existing database file" },
{ MMFile, FMModules, "&Modules...", "List Browser modules" },
{ MMFile, FMSep0, NULL, NULL },
{ MMFile, FMLoad, "&Load Options...", "Load Setup" },
{ MMFile, FMSave, "&Save Options", "Save current options" },
{ MMFile, FMSaveAs, "Save Options &As...", "Save current options, specifying a file name" },
#ifdef REPORT_IMPLEMENTED
{ MMFile, FMSep1, NULL, NULL },
{ MMFile, FMReport, "&Report...", "Write a formatted report to a disk file" },
#endif
{ MMFile, FMSep2, NULL, NULL },
{ MMFile, FMExit, "E&xit", "Leave the Browser" },
};
static SubMenuInfo ViewMenuInfo[ VMNumViewMenus ] = {
{ MMView, VMList, "&List...", "View a list of symbols" },
{ MMView, VMInherit, NULL, NULL },
{ MMView, VMCall, NULL, NULL },
};
static SubMenuInfo ViewInheritMenuInfo[ VMNumViewInheritMenus ] = {
{ CMViewInherit, VMInheritTree, "&Graph...", "Show a tree view of inheritance" },
{ CMViewInherit, VMInheritOutline, "&Outline...", "Show an outline view of inheritance" },
};
static SubMenuInfo ViewCallMenuInfo[ VMNumViewCallMenus ] = {
{ CMViewCall, VMCallTree, "&Graph...", "Show a tree view of calls" },
{ CMViewCall, VMCallOutline,"&Outline...", "Show an outline view of calls" },
};
static SubMenuInfo DetailMenuInfo[ DMNumDetailMenus ] = {
{ MMDetail, DMDetail, "&Detail...", "View the details of the selected symbol" },
{ MMDetail, DMDefinition, "&Goto Definition...", "Start editor at the definition of the current symbol" },
{ MMDetail, DMSep0, NULL, NULL },
{ MMDetail, DMReferences, "&Source References...", "List the source lines which refer to the current symbol" },
{ MMDetail, DMUsers, "Symbol &References...", "List the symbols which refer to the current symbol" },
#ifdef DETAIL_STUFF_IMPLEMENTED
{ MMDetail, DMSep1, NULL, NULL },
{ MMDetail, DMInheritance, "&Inheritance...", "Show immediate base and derived classes of the current symbol" },
{ MMDetail, DMStructure, "&Member Layout...", "Show the layout of member variables for the current symbol" },
{ MMDetail, DMSep2, NULL, NULL },
{ MMDetail, DMCalls, "&Calls...", "Show immediate calls to and from the current symbol" },
#endif
};
static SubMenuInfo TreeMenuInfo[ TMNumTreeMenus ] = {
{ MMTree, TMRoots, "&Select Root Nodes...", "Select which trees are displayed, which are hidden" },
{ MMTree, TMArrangeAll, "&Arrange Graph", "Arrange the nodes currently visible in the active graphical tree" },
{ MMTree, TMSep0, NULL, NULL },
{ MMTree, TMExpandOne, "Expand One Level\t+", "Show the immediate child nodes of the selected node" },
{ MMTree, TMExpandBranch, "Expand Branch\t*", "Expand all the descendants of the selected node" },
{ MMTree, TMExpandAll, "Expand All\tCtrl *", "Expand all nodes in the display" },
{ MMTree, TMCollapseBranch, "Collapse Branch\t-", "Collapse all the descendants of the selected node" },
{ MMTree, TMCollapseAll, "Collapse All\tCtrl -", "Collapse all nodes, showing only root nodes" },
#ifdef DEBUGTREE
{ MMTree, TMSep1, NULL, NULL },
{ MMTree, TMDebugInfo, "Debug Info", "Show debugging info for selected node" },
{ MMTree, TMSibWidth, "Sib Width", "Show sibling width" },
#endif
};
static SubMenuInfo LocateMenuInfo[ LMNumLocateMenus ] = {
{ MMLocate, LMFind, "&Find...", "Find a symbol in the current view" },
{ MMLocate, LMFindNext, "Find &Next", "Find the next occurence of a symbol in the current view" },
{ MMLocate, LMSep0, NULL, NULL },
{ MMLocate, LMFindSelected, "Find &Selected", "Find the currently selected symbol in the current view" },
};
static SubMenuInfo OptionsMenuInfo[ OMNumOptionsMenus ] = {
{ MMOptions, OMRegExp, "&Regular Expressions...", "Configure regular expression usage" },
{ MMOptions, OMQuery, "&Query...", "Re-load the current view, for the specified query" },
{ MMOptions, OMSep0, NULL, NULL },
{ MMOptions, OMEnumStyles, "&Enumeration Styles...", "Choose display styles for enumeration values" },
{ MMOptions, OMMemberFilters, "Member &Filters...", "Choose which class members to display" },
#ifdef OPTIONS_IMPLEMENTED
{ MMOptions, OMMemberOrder, "Member &Order...", "Configure the display order of class members" },
#endif
{ MMOptions, OMSep1, NULL, NULL },
{ MMOptions, OMTreeAutoArrange, "Graph &Auto-arrange", "Automatically re-arrange graph views when nodes collapsed" },
{ MMOptions, OMTreeSquareLines, "Graph Square &Lines", "Use square lines to display trees" },
{ MMOptions, OMTreeHorizontal, "Graph &Horizontal", "Draw graphs horizontally" },
{ MMOptions, OMSep2, NULL, NULL },
{ MMOptions, OMInheritTreeLegend,"&Inheritance Graph Legend...", "Choose colours and line styles for inheritance trees" },
{ MMOptions, OMCallTreeLegend, "&Call Graph Legend...", "Choose colours and line styles for call trees" },
{ MMOptions, OMSep3, NULL, NULL },
{ MMOptions, OMEditorDLL, "Set Text E&ditor...", "Choose a text editor executable or a DLL to communicate with a text editor" },
{ MMOptions, OMAutoSave, "&Save Options on Exit", "Automatically save options on program exit" },
};
#if defined( __OS2__ )
#define _HelpMenuContents "&Table of Contents"
#define _HelpMenuIndex "Help &Index"
#define _HelpMenuIndexHint "View Index"
#define _HelpMenuUsing "&Using Help"
#define _HelpMenuInformation "&Product Information"
#else
#define _HelpMenuContents "&Contents"
#define _HelpMenuIndex "&Search for Help On..."
#define _HelpMenuIndexHint "Search for topic"
#define _HelpMenuUsing "&How to Use Help"
#define _HelpMenuInformation "&About Source Browser..."
#endif
static SubMenuInfo HelpMenuInfo[ HMNumHelpMenus ] = {
{ MMHelp, HMContents, _HelpMenuContents, "View table of contents" },
{ MMHelp, HMSearch, _HelpMenuIndex, _HelpMenuIndexHint },
{ MMHelp, HMUsingHelp, _HelpMenuUsing, "View help on using help" },
{ MMHelp, HMSep0, NULL, NULL },
{ MMHelp, HMAbout, _HelpMenuInformation, "View product information for the source browser" },
};
unsigned MenuHash( const MIMenuID & id )
//--------------------------------------
{
return( id.mainID() ^ id.subID() );
};
MenuManager::MenuManager()
: _clientWin( NULL )
, _topMenus( NULL )
, _receivers( NULL )
//----------------------------------
{
}
MenuManager::~MenuManager()
//-------------------------
{
delete [] _topMenus;
_receivers->clear();
delete _receivers;
}
void MenuManager::registerForViewEvents( ViewManager * vmgr )
//-----------------------------------------------------------
{
vmgr->registerForEvents( this );
}
ViewEvent MenuManager::wantEvents()
//---------------------------------
{
return( VEGettingFocus | VELosingFocus | VEBrowseTopDying );
}
void MenuManager::event( ViewEvent ve, View * view )
//--------------------------------------------------
{
switch( ve ) {
case VEGettingFocus:
view->setMenus( this );
break;
case VELosingFocus:
view->unsetMenus( this );
break;
case VEBrowseTopDying:
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?