Mercurial > hg > sonic-visualiser
comparison main/MainWindow.cpp @ 705:44fcce228d02 tony_integration
Remove tool-specific keyboard shortcut reference registration from Pane and put it in MainWindow (as it depends on which tools are in use)
author | Chris Cannam |
---|---|
date | Wed, 02 Apr 2014 08:50:18 +0100 |
parents | 959f01137742 |
children | d1c5444be23d |
comparison
equal
deleted
inserted
replaced
704:b3f8eb4b843b | 705:44fcce228d02 |
---|---|
143 m_rightButtonMenu(0), | 143 m_rightButtonMenu(0), |
144 m_rightButtonLayerMenu(0), | 144 m_rightButtonLayerMenu(0), |
145 m_rightButtonTransformsMenu(0), | 145 m_rightButtonTransformsMenu(0), |
146 m_rightButtonPlaybackMenu(0), | 146 m_rightButtonPlaybackMenu(0), |
147 m_soloAction(0), | 147 m_soloAction(0), |
148 m_soloModified(false), | |
149 m_prevSolo(false), | |
150 m_rwdStartAction(0), | 148 m_rwdStartAction(0), |
151 m_rwdSimilarAction(0), | 149 m_rwdSimilarAction(0), |
152 m_rwdAction(0), | 150 m_rwdAction(0), |
153 m_ffwdAction(0), | 151 m_ffwdAction(0), |
154 m_ffwdSimilarAction(0), | 152 m_ffwdSimilarAction(0), |
155 m_ffwdEndAction(0), | 153 m_ffwdEndAction(0), |
156 m_playAction(0), | 154 m_playAction(0), |
157 m_playSelectionAction(0), | 155 m_playSelectionAction(0), |
158 m_playLoopAction(0), | 156 m_playLoopAction(0), |
157 m_soloModified(false), | |
158 m_prevSolo(false), | |
159 m_playControlsSpacer(0), | 159 m_playControlsSpacer(0), |
160 m_playControlsWidth(0), | 160 m_playControlsWidth(0), |
161 m_preferencesDialog(0), | 161 m_preferencesDialog(0), |
162 m_layerTreeDialog(0), | 162 m_layerTreeDialog(0), |
163 m_activityLog(new ActivityLog()), | 163 m_activityLog(new ActivityLog()), |
401 QAction *acts[] = { | 401 QAction *acts[] = { |
402 m_playAction, m_zoomInAction, m_zoomOutAction, m_zoomFitAction, | 402 m_playAction, m_zoomInAction, m_zoomOutAction, m_zoomFitAction, |
403 m_scrollLeftAction, m_scrollRightAction, m_showPropertyBoxesAction | 403 m_scrollLeftAction, m_scrollRightAction, m_showPropertyBoxesAction |
404 }; | 404 }; |
405 | 405 |
406 for (int i = 0; i < sizeof(acts)/sizeof(acts[0]); ++i) { | 406 for (int i = 0; i < int(sizeof(acts)/sizeof(acts[0])); ++i) { |
407 sc = new QShortcut(acts[i]->shortcut(), ps); | 407 sc = new QShortcut(acts[i]->shortcut(), ps); |
408 connect(sc, SIGNAL(activated()), acts[i], SLOT(trigger())); | 408 connect(sc, SIGNAL(activated()), acts[i], SLOT(trigger())); |
409 } | 409 } |
410 | 410 |
411 ps->showFullScreen(); | 411 ps->showFullScreen(); |
452 icon.addPixmap(il.loadPixmap("fileopen-22")); | 452 icon.addPixmap(il.loadPixmap("fileopen-22")); |
453 action = new QAction(icon, tr("&Open..."), this); | 453 action = new QAction(icon, tr("&Open..."), this); |
454 action->setShortcut(tr("Ctrl+O")); | 454 action->setShortcut(tr("Ctrl+O")); |
455 action->setStatusTip(tr("Open a session file, audio file, or layer")); | 455 action->setStatusTip(tr("Open a session file, audio file, or layer")); |
456 connect(action, SIGNAL(triggered()), this, SLOT(openSomething())); | 456 connect(action, SIGNAL(triggered()), this, SLOT(openSomething())); |
457 m_keyReference->registerShortcut(action); | |
457 toolbar->addAction(action); | 458 toolbar->addAction(action); |
458 menu->addAction(action); | 459 menu->addAction(action); |
459 | 460 |
460 // We want this one to go on the toolbar now, if we add it at all, | 461 // We want this one to go on the toolbar now, if we add it at all, |
461 // but on the menu later | 462 // but on the menu later |
2066 m_rightButtonPlaybackMenu->addAction(normalAction); | 2067 m_rightButtonPlaybackMenu->addAction(normalAction); |
2067 | 2068 |
2068 toolbar = addToolBar(tr("Edit Toolbar")); | 2069 toolbar = addToolBar(tr("Edit Toolbar")); |
2069 CommandHistory::getInstance()->registerToolbar(toolbar); | 2070 CommandHistory::getInstance()->registerToolbar(toolbar); |
2070 | 2071 |
2071 m_keyReference->setCategory(tr("Tool Selection")); | |
2072 | |
2073 toolbar = addToolBar(tr("Tools Toolbar")); | 2072 toolbar = addToolBar(tr("Tools Toolbar")); |
2074 QActionGroup *group = new QActionGroup(this); | 2073 QActionGroup *group = new QActionGroup(this); |
2075 | 2074 |
2075 m_keyReference->setCategory(tr("Tool Selection")); | |
2076 QAction *action = toolbar->addAction(il.load("navigate"), | 2076 QAction *action = toolbar->addAction(il.load("navigate"), |
2077 tr("Navigate")); | 2077 tr("Navigate")); |
2078 action->setCheckable(true); | 2078 action->setCheckable(true); |
2079 action->setChecked(true); | 2079 action->setChecked(true); |
2080 action->setShortcut(tr("1")); | 2080 action->setShortcut(tr("1")); |
2082 connect(action, SIGNAL(triggered()), this, SLOT(toolNavigateSelected())); | 2082 connect(action, SIGNAL(triggered()), this, SLOT(toolNavigateSelected())); |
2083 connect(this, SIGNAL(replacedDocument()), action, SLOT(trigger())); | 2083 connect(this, SIGNAL(replacedDocument()), action, SLOT(trigger())); |
2084 group->addAction(action); | 2084 group->addAction(action); |
2085 m_keyReference->registerShortcut(action); | 2085 m_keyReference->registerShortcut(action); |
2086 m_toolActions[ViewManager::NavigateMode] = action; | 2086 m_toolActions[ViewManager::NavigateMode] = action; |
2087 | 2087 |
2088 m_keyReference->setCategory | |
2089 (tr("Navigate Tool Mouse Actions")); | |
2090 m_keyReference->registerShortcut | |
2091 (tr("Navigate"), tr("Left"), | |
2092 tr("Click left button and drag to move around")); | |
2093 m_keyReference->registerShortcut | |
2094 (tr("Zoom to Area"), tr("Shift+Left"), | |
2095 tr("Shift-click left button and drag to zoom to a rectangular area")); | |
2096 m_keyReference->registerShortcut | |
2097 (tr("Relocate"), tr("Double-Click Left"), | |
2098 tr("Double-click left button to jump to clicked location")); | |
2099 m_keyReference->registerShortcut | |
2100 (tr("Edit"), tr("Double-Click Left"), | |
2101 tr("Double-click left button on an item to edit it")); | |
2102 | |
2103 m_keyReference->setCategory(tr("Tool Selection")); | |
2088 action = toolbar->addAction(il.load("select"), | 2104 action = toolbar->addAction(il.load("select"), |
2089 tr("Select")); | 2105 tr("Select")); |
2090 action->setCheckable(true); | 2106 action->setCheckable(true); |
2091 action->setShortcut(tr("2")); | 2107 action->setShortcut(tr("2")); |
2092 action->setStatusTip(tr("Select ranges")); | 2108 action->setStatusTip(tr("Select ranges")); |
2093 connect(action, SIGNAL(triggered()), this, SLOT(toolSelectSelected())); | 2109 connect(action, SIGNAL(triggered()), this, SLOT(toolSelectSelected())); |
2094 group->addAction(action); | 2110 group->addAction(action); |
2095 m_keyReference->registerShortcut(action); | 2111 m_keyReference->registerShortcut(action); |
2096 m_toolActions[ViewManager::SelectMode] = action; | 2112 m_toolActions[ViewManager::SelectMode] = action; |
2097 | 2113 |
2114 m_keyReference->setCategory | |
2115 (tr("Select Tool Mouse Actions")); | |
2116 m_keyReference->registerShortcut | |
2117 (tr("Select"), tr("Left"), | |
2118 tr("Click left button and drag to select region; drag region edge to resize")); | |
2119 #ifdef Q_OS_MAC | |
2120 m_keyReference->registerShortcut | |
2121 (tr("Multi Select"), tr("Ctrl+Left"), | |
2122 tr("Cmd-click left button and drag to select an additional region")); | |
2123 #else | |
2124 m_keyReference->registerShortcut | |
2125 (tr("Multi Select"), tr("Ctrl+Left"), | |
2126 tr("Ctrl-click left button and drag to select an additional region")); | |
2127 #endif | |
2128 m_keyReference->registerShortcut | |
2129 (tr("Fine Select"), tr("Shift+Left"), | |
2130 tr("Shift-click left button and drag to select without snapping to items or grid")); | |
2131 | |
2132 m_keyReference->setCategory(tr("Tool Selection")); | |
2098 action = toolbar->addAction(il.load("move"), | 2133 action = toolbar->addAction(il.load("move"), |
2099 tr("Edit")); | 2134 tr("Edit")); |
2100 action->setCheckable(true); | 2135 action->setCheckable(true); |
2101 action->setShortcut(tr("3")); | 2136 action->setShortcut(tr("3")); |
2102 action->setStatusTip(tr("Edit items in layer")); | 2137 action->setStatusTip(tr("Edit items in layer")); |
2103 connect(action, SIGNAL(triggered()), this, SLOT(toolEditSelected())); | 2138 connect(action, SIGNAL(triggered()), this, SLOT(toolEditSelected())); |
2104 connect(this, SIGNAL(canEditLayer(bool)), action, SLOT(setEnabled(bool))); | 2139 connect(this, SIGNAL(canEditLayer(bool)), action, SLOT(setEnabled(bool))); |
2105 group->addAction(action); | 2140 group->addAction(action); |
2106 m_keyReference->registerShortcut(action); | 2141 m_keyReference->registerShortcut(action); |
2107 m_toolActions[ViewManager::EditMode] = action; | 2142 m_toolActions[ViewManager::EditMode] = action; |
2108 | 2143 |
2144 m_keyReference->setCategory | |
2145 (tr("Edit Tool Mouse Actions")); | |
2146 m_keyReference->registerShortcut | |
2147 (tr("Move"), tr("Left"), | |
2148 tr("Click left button on an item or selected region and drag to move")); | |
2149 m_keyReference->registerShortcut | |
2150 (tr("Edit"), tr("Double-Click Left"), | |
2151 tr("Double-click left button on an item to edit it")); | |
2152 | |
2153 m_keyReference->setCategory(tr("Tool Selection")); | |
2109 action = toolbar->addAction(il.load("draw"), | 2154 action = toolbar->addAction(il.load("draw"), |
2110 tr("Draw")); | 2155 tr("Draw")); |
2111 action->setCheckable(true); | 2156 action->setCheckable(true); |
2112 action->setShortcut(tr("4")); | 2157 action->setShortcut(tr("4")); |
2113 action->setStatusTip(tr("Draw new items in layer")); | 2158 action->setStatusTip(tr("Draw new items in layer")); |
2115 connect(this, SIGNAL(canEditLayer(bool)), action, SLOT(setEnabled(bool))); | 2160 connect(this, SIGNAL(canEditLayer(bool)), action, SLOT(setEnabled(bool))); |
2116 group->addAction(action); | 2161 group->addAction(action); |
2117 m_keyReference->registerShortcut(action); | 2162 m_keyReference->registerShortcut(action); |
2118 m_toolActions[ViewManager::DrawMode] = action; | 2163 m_toolActions[ViewManager::DrawMode] = action; |
2119 | 2164 |
2165 m_keyReference->setCategory | |
2166 (tr("Draw Tool Mouse Actions")); | |
2167 m_keyReference->registerShortcut | |
2168 (tr("Draw"), tr("Left"), | |
2169 tr("Click left button and drag to create new item")); | |
2170 | |
2171 m_keyReference->setCategory(tr("Tool Selection")); | |
2120 action = toolbar->addAction(il.load("erase"), | 2172 action = toolbar->addAction(il.load("erase"), |
2121 tr("Erase")); | 2173 tr("Erase")); |
2122 action->setCheckable(true); | 2174 action->setCheckable(true); |
2123 action->setShortcut(tr("5")); | 2175 action->setShortcut(tr("5")); |
2124 action->setStatusTip(tr("Erase items from layer")); | 2176 action->setStatusTip(tr("Erase items from layer")); |
2126 connect(this, SIGNAL(canEditLayer(bool)), action, SLOT(setEnabled(bool))); | 2178 connect(this, SIGNAL(canEditLayer(bool)), action, SLOT(setEnabled(bool))); |
2127 group->addAction(action); | 2179 group->addAction(action); |
2128 m_keyReference->registerShortcut(action); | 2180 m_keyReference->registerShortcut(action); |
2129 m_toolActions[ViewManager::EraseMode] = action; | 2181 m_toolActions[ViewManager::EraseMode] = action; |
2130 | 2182 |
2183 m_keyReference->setCategory | |
2184 (tr("Erase Tool Mouse Actions")); | |
2185 m_keyReference->registerShortcut | |
2186 (tr("Erase"), tr("Left"), | |
2187 tr("Click left button on an item to remove it from the layer")); | |
2188 | |
2189 m_keyReference->setCategory(tr("Tool Selection")); | |
2131 action = toolbar->addAction(il.load("measure"), tr("Measure")); | 2190 action = toolbar->addAction(il.load("measure"), tr("Measure")); |
2132 action->setCheckable(true); | 2191 action->setCheckable(true); |
2133 action->setShortcut(tr("6")); | 2192 action->setShortcut(tr("6")); |
2134 action->setStatusTip(tr("Make measurements in layer")); | 2193 action->setStatusTip(tr("Make measurements in layer")); |
2135 connect(action, SIGNAL(triggered()), this, SLOT(toolMeasureSelected())); | 2194 connect(action, SIGNAL(triggered()), this, SLOT(toolMeasureSelected())); |
2136 connect(this, SIGNAL(canMeasureLayer(bool)), action, SLOT(setEnabled(bool))); | 2195 connect(this, SIGNAL(canMeasureLayer(bool)), action, SLOT(setEnabled(bool))); |
2137 group->addAction(action); | 2196 group->addAction(action); |
2138 m_keyReference->registerShortcut(action); | 2197 m_keyReference->registerShortcut(action); |
2139 m_toolActions[ViewManager::MeasureMode] = action; | 2198 m_toolActions[ViewManager::MeasureMode] = action; |
2199 | |
2200 m_keyReference->setCategory | |
2201 (tr("Measure Tool Mouse Actions")); | |
2202 m_keyReference->registerShortcut | |
2203 (tr("Measure Area"), tr("Left"), | |
2204 tr("Click left button and drag to measure a rectangular area")); | |
2205 m_keyReference->registerShortcut | |
2206 (tr("Measure Item"), tr("Double-Click Left"), | |
2207 tr("Click left button and drag to measure extents of an item or shape")); | |
2208 m_keyReference->registerShortcut | |
2209 (tr("Zoom to Area"), tr("Shift+Left"), | |
2210 tr("Shift-click left button and drag to zoom to a rectangular area")); | |
2140 | 2211 |
2141 toolNavigateSelected(); | 2212 toolNavigateSelected(); |
2142 | 2213 |
2143 Pane::registerShortcuts(*m_keyReference); | 2214 Pane::registerShortcuts(*m_keyReference); |
2144 } | 2215 } |