Mercurial > hg > sonic-visualiser
comparison main/MainWindow.cpp @ 717:c2b9b781f006
Merge from branch "tony_integration"
author | Chris Cannam |
---|---|
date | Fri, 09 May 2014 17:54:16 +0100 |
parents | d1c5444be23d |
children | b959148258a4 |
comparison
equal
deleted
inserted
replaced
711:0db5796a41da | 717:c2b9b781f006 |
---|---|
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 |
944 action = new QAction(tr("Show &Minimal Overlays"), this); | 945 action = new QAction(tr("Show &Minimal Overlays"), this); |
945 action->setShortcut(tr("9")); | 946 action->setShortcut(tr("9")); |
946 action->setStatusTip(tr("Show times and basic scale")); | 947 action->setStatusTip(tr("Show times and basic scale")); |
947 connect(action, SIGNAL(triggered()), this, SLOT(showMinimalOverlays())); | 948 connect(action, SIGNAL(triggered()), this, SLOT(showMinimalOverlays())); |
948 action->setCheckable(true); | 949 action->setCheckable(true); |
949 action->setChecked(mode == ViewManager::MinimalOverlays); | 950 action->setChecked(mode == ViewManager::StandardOverlays); |
950 overlayGroup->addAction(action); | 951 overlayGroup->addAction(action); |
951 m_keyReference->registerShortcut(action); | 952 m_keyReference->registerShortcut(action); |
952 menu->addAction(action); | 953 menu->addAction(action); |
953 | 954 |
954 action = new QAction(tr("Show &All Overlays"), this); | 955 action = new QAction(tr("Show &All Overlays"), this); |
2068 m_rightButtonPlaybackMenu->addAction(normalAction); | 2069 m_rightButtonPlaybackMenu->addAction(normalAction); |
2069 | 2070 |
2070 toolbar = addToolBar(tr("Edit Toolbar")); | 2071 toolbar = addToolBar(tr("Edit Toolbar")); |
2071 CommandHistory::getInstance()->registerToolbar(toolbar); | 2072 CommandHistory::getInstance()->registerToolbar(toolbar); |
2072 | 2073 |
2073 m_keyReference->setCategory(tr("Tool Selection")); | |
2074 | |
2075 toolbar = addToolBar(tr("Tools Toolbar")); | 2074 toolbar = addToolBar(tr("Tools Toolbar")); |
2076 QActionGroup *group = new QActionGroup(this); | 2075 QActionGroup *group = new QActionGroup(this); |
2077 | 2076 |
2077 m_keyReference->setCategory(tr("Tool Selection")); | |
2078 QAction *action = toolbar->addAction(il.load("navigate"), | 2078 QAction *action = toolbar->addAction(il.load("navigate"), |
2079 tr("Navigate")); | 2079 tr("Navigate")); |
2080 action->setCheckable(true); | 2080 action->setCheckable(true); |
2081 action->setChecked(true); | 2081 action->setChecked(true); |
2082 action->setShortcut(tr("1")); | 2082 action->setShortcut(tr("1")); |
2084 connect(action, SIGNAL(triggered()), this, SLOT(toolNavigateSelected())); | 2084 connect(action, SIGNAL(triggered()), this, SLOT(toolNavigateSelected())); |
2085 connect(this, SIGNAL(replacedDocument()), action, SLOT(trigger())); | 2085 connect(this, SIGNAL(replacedDocument()), action, SLOT(trigger())); |
2086 group->addAction(action); | 2086 group->addAction(action); |
2087 m_keyReference->registerShortcut(action); | 2087 m_keyReference->registerShortcut(action); |
2088 m_toolActions[ViewManager::NavigateMode] = action; | 2088 m_toolActions[ViewManager::NavigateMode] = action; |
2089 | 2089 |
2090 m_keyReference->setCategory | |
2091 (tr("Navigate Tool Mouse Actions")); | |
2092 m_keyReference->registerShortcut | |
2093 (tr("Navigate"), tr("Left"), | |
2094 tr("Click left button and drag to move around")); | |
2095 m_keyReference->registerShortcut | |
2096 (tr("Zoom to Area"), tr("Shift+Left"), | |
2097 tr("Shift-click left button and drag to zoom to a rectangular area")); | |
2098 m_keyReference->registerShortcut | |
2099 (tr("Relocate"), tr("Double-Click Left"), | |
2100 tr("Double-click left button to jump to clicked location")); | |
2101 m_keyReference->registerShortcut | |
2102 (tr("Edit"), tr("Double-Click Left"), | |
2103 tr("Double-click left button on an item to edit it")); | |
2104 | |
2105 m_keyReference->setCategory(tr("Tool Selection")); | |
2090 action = toolbar->addAction(il.load("select"), | 2106 action = toolbar->addAction(il.load("select"), |
2091 tr("Select")); | 2107 tr("Select")); |
2092 action->setCheckable(true); | 2108 action->setCheckable(true); |
2093 action->setShortcut(tr("2")); | 2109 action->setShortcut(tr("2")); |
2094 action->setStatusTip(tr("Select ranges")); | 2110 action->setStatusTip(tr("Select ranges")); |
2095 connect(action, SIGNAL(triggered()), this, SLOT(toolSelectSelected())); | 2111 connect(action, SIGNAL(triggered()), this, SLOT(toolSelectSelected())); |
2096 group->addAction(action); | 2112 group->addAction(action); |
2097 m_keyReference->registerShortcut(action); | 2113 m_keyReference->registerShortcut(action); |
2098 m_toolActions[ViewManager::SelectMode] = action; | 2114 m_toolActions[ViewManager::SelectMode] = action; |
2099 | 2115 |
2116 m_keyReference->setCategory | |
2117 (tr("Select Tool Mouse Actions")); | |
2118 m_keyReference->registerShortcut | |
2119 (tr("Select"), tr("Left"), | |
2120 tr("Click left button and drag to select region; drag region edge to resize")); | |
2121 #ifdef Q_OS_MAC | |
2122 m_keyReference->registerShortcut | |
2123 (tr("Multi Select"), tr("Ctrl+Left"), | |
2124 tr("Cmd-click left button and drag to select an additional region")); | |
2125 #else | |
2126 m_keyReference->registerShortcut | |
2127 (tr("Multi Select"), tr("Ctrl+Left"), | |
2128 tr("Ctrl-click left button and drag to select an additional region")); | |
2129 #endif | |
2130 m_keyReference->registerShortcut | |
2131 (tr("Fine Select"), tr("Shift+Left"), | |
2132 tr("Shift-click left button and drag to select without snapping to items or grid")); | |
2133 | |
2134 m_keyReference->setCategory(tr("Tool Selection")); | |
2100 action = toolbar->addAction(il.load("move"), | 2135 action = toolbar->addAction(il.load("move"), |
2101 tr("Edit")); | 2136 tr("Edit")); |
2102 action->setCheckable(true); | 2137 action->setCheckable(true); |
2103 action->setShortcut(tr("3")); | 2138 action->setShortcut(tr("3")); |
2104 action->setStatusTip(tr("Edit items in layer")); | 2139 action->setStatusTip(tr("Edit items in layer")); |
2105 connect(action, SIGNAL(triggered()), this, SLOT(toolEditSelected())); | 2140 connect(action, SIGNAL(triggered()), this, SLOT(toolEditSelected())); |
2106 connect(this, SIGNAL(canEditLayer(bool)), action, SLOT(setEnabled(bool))); | 2141 connect(this, SIGNAL(canEditLayer(bool)), action, SLOT(setEnabled(bool))); |
2107 group->addAction(action); | 2142 group->addAction(action); |
2108 m_keyReference->registerShortcut(action); | 2143 m_keyReference->registerShortcut(action); |
2109 m_toolActions[ViewManager::EditMode] = action; | 2144 m_toolActions[ViewManager::EditMode] = action; |
2110 | 2145 |
2146 m_keyReference->setCategory | |
2147 (tr("Edit Tool Mouse Actions")); | |
2148 m_keyReference->registerShortcut | |
2149 (tr("Move"), tr("Left"), | |
2150 tr("Click left button on an item or selected region and drag to move")); | |
2151 m_keyReference->registerShortcut | |
2152 (tr("Edit"), tr("Double-Click Left"), | |
2153 tr("Double-click left button on an item to edit it")); | |
2154 | |
2155 m_keyReference->setCategory(tr("Tool Selection")); | |
2111 action = toolbar->addAction(il.load("draw"), | 2156 action = toolbar->addAction(il.load("draw"), |
2112 tr("Draw")); | 2157 tr("Draw")); |
2113 action->setCheckable(true); | 2158 action->setCheckable(true); |
2114 action->setShortcut(tr("4")); | 2159 action->setShortcut(tr("4")); |
2115 action->setStatusTip(tr("Draw new items in layer")); | 2160 action->setStatusTip(tr("Draw new items in layer")); |
2117 connect(this, SIGNAL(canEditLayer(bool)), action, SLOT(setEnabled(bool))); | 2162 connect(this, SIGNAL(canEditLayer(bool)), action, SLOT(setEnabled(bool))); |
2118 group->addAction(action); | 2163 group->addAction(action); |
2119 m_keyReference->registerShortcut(action); | 2164 m_keyReference->registerShortcut(action); |
2120 m_toolActions[ViewManager::DrawMode] = action; | 2165 m_toolActions[ViewManager::DrawMode] = action; |
2121 | 2166 |
2167 m_keyReference->setCategory | |
2168 (tr("Draw Tool Mouse Actions")); | |
2169 m_keyReference->registerShortcut | |
2170 (tr("Draw"), tr("Left"), | |
2171 tr("Click left button and drag to create new item")); | |
2172 | |
2173 m_keyReference->setCategory(tr("Tool Selection")); | |
2122 action = toolbar->addAction(il.load("erase"), | 2174 action = toolbar->addAction(il.load("erase"), |
2123 tr("Erase")); | 2175 tr("Erase")); |
2124 action->setCheckable(true); | 2176 action->setCheckable(true); |
2125 action->setShortcut(tr("5")); | 2177 action->setShortcut(tr("5")); |
2126 action->setStatusTip(tr("Erase items from layer")); | 2178 action->setStatusTip(tr("Erase items from layer")); |
2128 connect(this, SIGNAL(canEditLayer(bool)), action, SLOT(setEnabled(bool))); | 2180 connect(this, SIGNAL(canEditLayer(bool)), action, SLOT(setEnabled(bool))); |
2129 group->addAction(action); | 2181 group->addAction(action); |
2130 m_keyReference->registerShortcut(action); | 2182 m_keyReference->registerShortcut(action); |
2131 m_toolActions[ViewManager::EraseMode] = action; | 2183 m_toolActions[ViewManager::EraseMode] = action; |
2132 | 2184 |
2185 m_keyReference->setCategory | |
2186 (tr("Erase Tool Mouse Actions")); | |
2187 m_keyReference->registerShortcut | |
2188 (tr("Erase"), tr("Left"), | |
2189 tr("Click left button on an item to remove it from the layer")); | |
2190 | |
2191 m_keyReference->setCategory(tr("Tool Selection")); | |
2133 action = toolbar->addAction(il.load("measure"), tr("Measure")); | 2192 action = toolbar->addAction(il.load("measure"), tr("Measure")); |
2134 action->setCheckable(true); | 2193 action->setCheckable(true); |
2135 action->setShortcut(tr("6")); | 2194 action->setShortcut(tr("6")); |
2136 action->setStatusTip(tr("Make measurements in layer")); | 2195 action->setStatusTip(tr("Make measurements in layer")); |
2137 connect(action, SIGNAL(triggered()), this, SLOT(toolMeasureSelected())); | 2196 connect(action, SIGNAL(triggered()), this, SLOT(toolMeasureSelected())); |
2138 connect(this, SIGNAL(canMeasureLayer(bool)), action, SLOT(setEnabled(bool))); | 2197 connect(this, SIGNAL(canMeasureLayer(bool)), action, SLOT(setEnabled(bool))); |
2139 group->addAction(action); | 2198 group->addAction(action); |
2140 m_keyReference->registerShortcut(action); | 2199 m_keyReference->registerShortcut(action); |
2141 m_toolActions[ViewManager::MeasureMode] = action; | 2200 m_toolActions[ViewManager::MeasureMode] = action; |
2201 | |
2202 m_keyReference->setCategory | |
2203 (tr("Measure Tool Mouse Actions")); | |
2204 m_keyReference->registerShortcut | |
2205 (tr("Measure Area"), tr("Left"), | |
2206 tr("Click left button and drag to measure a rectangular area")); | |
2207 m_keyReference->registerShortcut | |
2208 (tr("Measure Item"), tr("Double-Click Left"), | |
2209 tr("Click left button and drag to measure extents of an item or shape")); | |
2210 m_keyReference->registerShortcut | |
2211 (tr("Zoom to Area"), tr("Shift+Left"), | |
2212 tr("Shift-click left button and drag to zoom to a rectangular area")); | |
2142 | 2213 |
2143 toolNavigateSelected(); | 2214 toolNavigateSelected(); |
2144 | 2215 |
2145 Pane::registerShortcuts(*m_keyReference); | 2216 Pane::registerShortcuts(*m_keyReference); |
2146 } | 2217 } |
2648 NoteModel *nm = dynamic_cast<NoteModel *>(model); | 2719 NoteModel *nm = dynamic_cast<NoteModel *>(model); |
2649 | 2720 |
2650 if (!nm) { | 2721 if (!nm) { |
2651 error = tr("Can't export non-note layers to MIDI"); | 2722 error = tr("Can't export non-note layers to MIDI"); |
2652 } else { | 2723 } else { |
2653 MIDIFileWriter writer(path, nm); | 2724 MIDIFileWriter writer(path, nm, nm->getSampleRate()); |
2654 writer.write(); | 2725 writer.write(); |
2655 if (!writer.isOK()) { | 2726 if (!writer.isOK()) { |
2656 error = writer.getError(); | 2727 error = writer.getError(); |
2657 } | 2728 } |
2658 } | 2729 } |