Changeset View
Changeset View
Standalone View
Standalone View
src/utils/ktexteditor.cpp
Show All 28 Lines | |||||
29 | 29 | | |||
30 | #include "view.h" | 30 | #include "view.h" | ||
31 | 31 | | |||
32 | #include "plugin.h" | 32 | #include "plugin.h" | ||
33 | 33 | | |||
34 | #include "command.h" | 34 | #include "command.h" | ||
35 | #include "inlinenoteinterface.h" | 35 | #include "inlinenoteinterface.h" | ||
36 | #include "inlinenote.h" | 36 | #include "inlinenote.h" | ||
37 | #include "inlinenotedata.h" | ||||
37 | #include "inlinenoteprovider.h" | 38 | #include "inlinenoteprovider.h" | ||
38 | #include "markinterface.h" | 39 | #include "markinterface.h" | ||
39 | #include "modificationinterface.h" | 40 | #include "modificationinterface.h" | ||
40 | #include "sessionconfiginterface.h" | 41 | #include "sessionconfiginterface.h" | ||
41 | #include "texthintinterface.h" | 42 | #include "texthintinterface.h" | ||
42 | 43 | | |||
43 | #include "annotationinterface.h" | 44 | #include "annotationinterface.h" | ||
44 | 45 | | |||
▲ Show 20 Lines • Show All 175 Lines • ▼ Show 20 Line(s) | |||||
220 | {} | 221 | {} | ||
221 | 222 | | |||
222 | InlineNoteProvider::InlineNoteProvider() | 223 | InlineNoteProvider::InlineNoteProvider() | ||
223 | {} | 224 | {} | ||
224 | 225 | | |||
225 | InlineNoteProvider::~InlineNoteProvider() | 226 | InlineNoteProvider::~InlineNoteProvider() | ||
226 | {} | 227 | {} | ||
227 | 228 | | |||
228 | InlineNote::InlineNote(InlineNoteProvider* provider, const KTextEditor::Cursor& position, int index, | 229 | KateInlineNoteData::KateInlineNoteData(KTextEditor::InlineNoteProvider* provider, | ||
229 | const KTextEditor::View* view, QFont font, int lineHeight, bool hasFocus) | 230 | const KTextEditor::View* view, | ||
231 | const KTextEditor::Cursor& position, | ||||
232 | int index, | ||||
233 | bool underMouse, | ||||
234 | const QFont& font, | ||||
235 | int lineHeight) | ||||
230 | : m_provider(provider) | 236 | : m_provider(provider) | ||
231 | , m_view(view) | 237 | , m_view(view) | ||
232 | , m_position(position) | 238 | , m_position(position) | ||
233 | , m_index(index) | 239 | , m_index(index) | ||
234 | , m_hasFocus(hasFocus) | 240 | , m_underMouse(underMouse) | ||
235 | , m_font(font) | 241 | , m_font(font) | ||
236 | , m_lineHeight(lineHeight) | 242 | , m_lineHeight(lineHeight) | ||
237 | { | 243 | {} | ||
238 | } | | |||
239 | | ||||
240 | InlineNote::InlineNote() = default; | | |||
241 | 244 | | |||
242 | int InlineNote::column() const | 245 | InlineNote::InlineNote(const KateInlineNoteData& data) | ||
246 | : d(data) | ||||
243 | { | 247 | { | ||
244 | return m_position.column(); | | |||
245 | } | 248 | } | ||
246 | 249 | | |||
247 | qreal InlineNote::width() const | 250 | qreal InlineNote::width() const | ||
248 | { | 251 | { | ||
249 | return m_provider->inlineNoteSize(*this).width(); | 252 | return d.m_provider->inlineNoteSize(*this).width(); | ||
250 | } | 253 | } | ||
251 | 254 | | |||
252 | bool KTextEditor::InlineNote::hasFocus() const | 255 | bool KTextEditor::InlineNote::underMouse() const | ||
253 | { | 256 | { | ||
254 | return m_hasFocus; | 257 | return d.m_underMouse; | ||
255 | } | 258 | } | ||
256 | 259 | | |||
257 | void KTextEditor::InlineNoteProvider::inlineNoteActivated(const InlineNote& note, Qt::MouseButtons buttons, const QPoint& pos) | 260 | void KTextEditor::InlineNoteProvider::inlineNoteActivated(const InlineNote& note, Qt::MouseButtons buttons, const QPoint& pos) | ||
258 | { | 261 | { | ||
259 | Q_UNUSED(note); | 262 | Q_UNUSED(note); | ||
260 | Q_UNUSED(buttons); | 263 | Q_UNUSED(buttons); | ||
261 | Q_UNUSED(pos); | 264 | Q_UNUSED(pos); | ||
262 | } | 265 | } | ||
Show All 10 Lines | |||||
273 | } | 276 | } | ||
274 | 277 | | |||
275 | void KTextEditor::InlineNoteProvider::inlineNoteMouseMoveEvent(const KTextEditor::InlineNote& note, const QPoint& pos) | 278 | void KTextEditor::InlineNoteProvider::inlineNoteMouseMoveEvent(const KTextEditor::InlineNote& note, const QPoint& pos) | ||
276 | { | 279 | { | ||
277 | Q_UNUSED(note); | 280 | Q_UNUSED(note); | ||
278 | Q_UNUSED(pos); | 281 | Q_UNUSED(pos); | ||
279 | } | 282 | } | ||
280 | 283 | | |||
281 | bool InlineNote::isValid() const | | |||
282 | { | | |||
283 | return m_provider != nullptr && m_position.isValid(); | | |||
284 | } | | |||
285 | | ||||
286 | bool InlineNote::operator==(const InlineNote& other) const { | | |||
287 | return m_provider == other.m_provider && m_position == other.m_position && m_index == other.m_index; | | |||
288 | } | | |||
289 | | ||||
290 | QPoint InlineNote::mapToGlobal(const QPoint& pos) const | 284 | QPoint InlineNote::mapToGlobal(const QPoint& pos) const | ||
291 | { | 285 | { | ||
292 | auto localPos = static_cast<const ViewPrivate*>(m_view)->inlineNoteRect(*this).topLeft() + pos; | 286 | auto localPos = static_cast<const ViewPrivate*>(d.m_view)->inlineNoteRect(d).topLeft() + pos; | ||
293 | return m_view->mapToGlobal(localPos); | 287 | return d.m_view->mapToGlobal(localPos); | ||
294 | } | 288 | } | ||
295 | 289 | | |||
296 | KTextEditor::InlineNoteProvider* InlineNote::provider() const | 290 | KTextEditor::InlineNoteProvider* InlineNote::provider() const | ||
297 | { | 291 | { | ||
298 | return m_provider; | 292 | return d.m_provider; | ||
299 | } | 293 | } | ||
300 | 294 | | |||
301 | const KTextEditor::View* InlineNote::view() const | 295 | const KTextEditor::View* InlineNote::view() const | ||
302 | { | 296 | { | ||
303 | return m_view; | 297 | return d.m_view; | ||
304 | } | 298 | } | ||
305 | 299 | | |||
306 | QFont InlineNote::font() const | 300 | QFont InlineNote::font() const | ||
307 | { | 301 | { | ||
308 | return m_font; | 302 | return d.m_font; | ||
309 | } | 303 | } | ||
310 | 304 | | |||
311 | int InlineNote::index() const | 305 | int InlineNote::index() const | ||
312 | { | 306 | { | ||
313 | return m_index; | 307 | return d.m_index; | ||
314 | } | 308 | } | ||
315 | 309 | | |||
316 | int InlineNote::lineHeight() const | 310 | int InlineNote::lineHeight() const | ||
317 | { | 311 | { | ||
318 | return m_lineHeight; | 312 | return d.m_lineHeight; | ||
319 | } | 313 | } | ||
320 | 314 | | |||
321 | KTextEditor::Cursor InlineNote::position() const | 315 | KTextEditor::Cursor InlineNote::position() const | ||
322 | { | 316 | { | ||
323 | return m_position; | 317 | return d.m_position; | ||
324 | } | 318 | } | ||
325 | 319 | | |||
326 | Command::Command(const QStringList &cmds, QObject *parent) | 320 | Command::Command(const QStringList &cmds, QObject *parent) | ||
327 | : QObject(parent) | 321 | : QObject(parent) | ||
328 | , m_cmds (cmds) | 322 | , m_cmds (cmds) | ||
329 | , d(nullptr) | 323 | , d(nullptr) | ||
330 | { | 324 | { | ||
331 | // register this command | 325 | // register this command | ||
▲ Show 20 Lines • Show All 58 Lines • Show Last 20 Lines |