File: menumanager.cpp

package info (click to toggle)
codelite 12.0+dfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: buster, sid
  • size: 95,112 kB
  • sloc: cpp: 424,040; ansic: 18,284; php: 9,569; lex: 4,186; yacc: 2,820; python: 2,294; sh: 312; makefile: 51; xml: 13
file content (99 lines) | stat: -rw-r--r-- 5,283 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//
// copyright            : (C) 2008 by Eran Ifrah
// file name            : menumanager.cpp
//
// -------------------------------------------------------------------------
// A
//              _____           _      _     _ _
//             /  __ \         | |    | |   (_) |
//             | /  \/ ___   __| | ___| |    _| |_ ___
//             | |    / _ \ / _  |/ _ \ |   | | __/ _ )
//             | \__/\ (_) | (_| |  __/ |___| | ||  __/
//              \____/\___/ \__,_|\___\_____/_|\__\___|
//
//                                                  F i l e
//
//    This program is free software; you can redistribute it and/or modify
//    it under the terms of the GNU General Public License as published by
//    the Free Software Foundation; either version 2 of the License, or
//    (at your option) any later version.
//
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
#include "menumanager.h"
#include "menu_event_handlers.h"
#include "macros.h"

MenuManager::MenuManager(void)
{
    PushHandler(new EditHandler(wxID_COPY));
    PushHandler(new EditHandler(wxID_CUT));
    PushHandler(new EditHandler(wxID_PASTE));
    PushHandler(new EditHandler(wxID_UNDO));
    PushHandler(new EditHandler(wxID_REDO));
    PushHandler(new EditHandler(XRCID("label_current_state")));
    PushHandler(new EditHandler(wxID_SELECTALL));
    PushHandler(new EditHandler(wxID_DUPLICATE));
    PushHandler(new EditHandler(wxID_DELETE));
    PushHandler(new EditHandler(XRCID("delete_line")));
    PushHandler(new EditHandler(XRCID("delete_line_end")));
    PushHandler(new EditHandler(XRCID("delete_line_start")));
    PushHandler(new EditHandler(XRCID("copy_line")));
    PushHandler(new EditHandler(XRCID("cut_line")));
    PushHandler(new EditHandler(XRCID("transpose_lines")));
    PushHandler(new EditHandler(XRCID("trim_trailing")));
    PushHandler(new EditHandler(XRCID("to_upper")));
    PushHandler(new EditHandler(XRCID("to_lower")));
    PushHandler(new EditHandler(XRCID("swap_files")));
    PushHandler(new EditHandler(XRCID("move_line_down")));
    PushHandler(new EditHandler(XRCID("move_line_up")));
    PushHandler(new EditHandler(XRCID("center_line_roll")));
    PushHandler(new EditHandler(XRCID("convert_indent_to_tabs")));
    PushHandler(new EditHandler(XRCID("convert_indent_to_spaces")));
    PushHandler(new BraceMatchHandler(XRCID("select_to_brace")));
    PushHandler(new BraceMatchHandler(XRCID("match_brace")));
    PushHandler(new FindReplaceHandler(wxID_FIND));
    PushHandler(new FindReplaceHandler(wxID_REPLACE));
    PushHandler(new FindReplaceHandler(XRCID("ID_QUICK_ADD_NEXT")));
    PushHandler(new FindReplaceHandler(XRCID("ID_QUICK_FIND_ALL")));
    PushHandler(new GotoHandler(XRCID("goto_linenumber")));
    PushHandler(new BookmarkHandler(XRCID("toggle_bookmark")));
    PushHandler(new BookmarkHandler(XRCID("next_bookmark")));
    PushHandler(new BookmarkHandler(XRCID("previous_bookmark")));
    PushHandler(new BookmarkHandler(XRCID("removeall_current_bookmarks")));
    PushHandler(new BookmarkHandler(XRCID("removeall_bookmarks")));
    PushHandler(new GotoDefinitionHandler(XRCID("goto_definition")));
    PushHandler(new GotoDefinitionHandler(XRCID("goto_previous_definition")));
    PushHandler(new WordWrapHandler(XRCID("word_wrap")));
    PushHandler(new FoldHandler(XRCID("toggle_fold")));
    PushHandler(new FoldHandler(XRCID("fold_topmost_in_selection")));
    PushHandler(new FoldHandler(XRCID("fold_all_in_selection")));
    PushHandler(new FoldHandler(XRCID("fold_all")));
    PushHandler(new DebuggerMenuHandler(XRCID("add_breakpoint")));
    PushHandler(new DebuggerMenuHandler(XRCID("insert_breakpoint"))); // This actually does 'toggle'
    PushHandler(new DebuggerMenuHandler(XRCID("disable_all_breakpoints")));
    PushHandler(new DebuggerMenuHandler(XRCID("enable_all_breakpoints")));
    PushHandler(new DebuggerMenuHandler(XRCID("delete_all_breakpoints")));
    PushHandler(new DebuggerMenuHandler(XRCID("insert_temp_breakpoint")));
    PushHandler(new DebuggerMenuHandler(XRCID("insert_disabled_breakpoint")));
    PushHandler(new DebuggerMenuHandler(XRCID("insert_cond_breakpoint")));
    PushHandler(new DebuggerMenuHandler(XRCID("insert_watchpoint")));
    PushHandler(new DebuggerMenuHandler(XRCID("toggle_breakpoint_enabled_status")));
    PushHandler(new DebuggerMenuHandler(XRCID("ignore_breakpoint")));
    PushHandler(new DebuggerMenuHandler(XRCID("edit_breakpoint")));
    PushHandler(new DebuggerMenuHandler(XRCID("delete_breakpoint")));
    PushHandler(new DebuggerMenuHandler(XRCID("show_breakpoint_dlg")));
}

MenuManager::~MenuManager(void) {}

void MenuManager::PushHandler(MenuEventHandlerPtr handler) { m_handlers[handler->GetEventId()] = handler; }

MenuEventHandlerPtr MenuManager::GetHandler(int id)
{
    HandlesrHash::iterator iter = m_handlers.find(id);
    if(iter != m_handlers.end()) return iter->second;
    return NULL;
}