Commit 2c899011 authored by Eric Armbruster's avatar Eric Armbruster 🍁
Browse files

Allow setting breakpoints from the icon border

Adds a convenient way to set a breakpoint.
parent f515898b
......@@ -292,6 +292,13 @@ KatePluginGDBView::KatePluginGDBView(KTextEditor::Plugin *plugin, KTextEditor::M
connect(m_mainWin, &KTextEditor::MainWindow::unhandledShortcutOverride, this, &KatePluginGDBView::handleEsc);
const auto documents = KTextEditor::Editor::instance()->application()->documents();
for (auto doc : documents) {
enableBreakpointMarks(doc);
}
connect(KTextEditor::Editor::instance()->application(), &KTextEditor::Application::documentCreated, this, &KatePluginGDBView::enableBreakpointMarks);
m_toolView->installEventFilter(this);
m_mainWin->guiFactory()->addClient(this);
......@@ -396,8 +403,6 @@ void KatePluginGDBView::slotBreakpointSet(const QUrl &file, int line)
KTextEditor::MarkInterfaceV2 *iface = qobject_cast<KTextEditor::MarkInterfaceV2 *>(m_kateApplication->findUrl(file));
if (iface) {
iface->setMarkDescription(KTextEditor::MarkInterface::BreakpointActive, i18n("Breakpoint"));
iface->setMarkIcon(KTextEditor::MarkInterface::BreakpointActive, QIcon::fromTheme(QStringLiteral("media-playback-pause")));
iface->addMark(line, KTextEditor::MarkInterface::BreakpointActive);
}
}
......@@ -818,6 +823,17 @@ void KatePluginGDBView::handleEsc(QEvent *e)
}
}
void KatePluginGDBView::enableBreakpointMarks(KTextEditor::Document *document)
{
KTextEditor::MarkInterfaceV2 *iface = qobject_cast<KTextEditor::MarkInterfaceV2 *>(document);
if (iface) {
iface->setEditableMarks(iface->editableMarks() | KTextEditor::MarkInterface::BreakpointActive);
iface->setMarkDescription(KTextEditor::MarkInterface::BreakpointActive, i18n("Breakpoint"));
iface->setMarkIcon(KTextEditor::MarkInterface::BreakpointActive, QIcon::fromTheme(QStringLiteral("media-playback-pause")));
}
}
void KatePluginGDBView::displayMessage(const QString &msg, KTextEditor::Message::MessageType level)
{
KTextEditor::View *kv = m_mainWin->activeView();
......
......@@ -90,6 +90,7 @@ private Q_SLOTS:
void addErrorText(QString const &text);
void clearMarks();
void handleEsc(QEvent *e);
void enableBreakpointMarks(KTextEditor::Document *document);
protected:
bool eventFilter(QObject *obj, QEvent *ev) override;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment