Changeset View
Changeset View
Standalone View
Standalone View
src/utils/ktexteditor.cpp
Show All 26 Lines | |||||
27 | 27 | | |||
28 | #include "document.h" | 28 | #include "document.h" | ||
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" | ||||
36 | #include "inlinenote.h" | ||||
37 | #include "inlinenoteprovider.h" | ||||
35 | #include "markinterface.h" | 38 | #include "markinterface.h" | ||
36 | #include "modificationinterface.h" | 39 | #include "modificationinterface.h" | ||
37 | #include "sessionconfiginterface.h" | 40 | #include "sessionconfiginterface.h" | ||
38 | #include "texthintinterface.h" | 41 | #include "texthintinterface.h" | ||
39 | 42 | | |||
40 | #include "annotationinterface.h" | 43 | #include "annotationinterface.h" | ||
41 | 44 | | |||
42 | #include "kateglobal.h" | 45 | #include "kateglobal.h" | ||
▲ Show 20 Lines • Show All 162 Lines • ▼ Show 20 Line(s) | |||||
205 | {} | 208 | {} | ||
206 | 209 | | |||
207 | TextHintProvider::TextHintProvider() | 210 | TextHintProvider::TextHintProvider() | ||
208 | {} | 211 | {} | ||
209 | 212 | | |||
210 | TextHintProvider::~TextHintProvider() | 213 | TextHintProvider::~TextHintProvider() | ||
211 | {} | 214 | {} | ||
212 | 215 | | |||
216 | InlineNoteInterface::InlineNoteInterface() | ||||
217 | {} | ||||
218 | | ||||
219 | InlineNoteInterface::~InlineNoteInterface() | ||||
220 | {} | ||||
221 | | ||||
222 | InlineNoteProvider::InlineNoteProvider() | ||||
223 | {} | ||||
224 | | ||||
225 | InlineNoteProvider::~InlineNoteProvider() | ||||
226 | {} | ||||
227 | | ||||
228 | InlineNote::InlineNote(InlineNoteProvider* provider, const KTextEditor::Cursor& position, int index, | ||||
229 | const KTextEditor::View* view, QFont font, int lineHeight, bool hasFocus) | ||||
230 | : m_provider(provider) | ||||
231 | , m_view(view) | ||||
232 | , m_position(position) | ||||
233 | , m_index(index) | ||||
234 | , m_hasFocus(hasFocus) | ||||
235 | , m_font(font) | ||||
236 | , m_lineHeight(lineHeight) | ||||
237 | { | ||||
238 | } | ||||
239 | | ||||
240 | InlineNote::InlineNote() = default; | ||||
dhaumann: When members are initialized in the header file, you can write here:
InlineNote… | |||||
241 | | ||||
242 | int InlineNote::column() const | ||||
243 | { | ||||
244 | return m_position.column(); | ||||
245 | } | ||||
246 | | ||||
247 | qreal InlineNote::width() const | ||||
248 | { | ||||
249 | return m_provider->inlineNoteSize(*this).width(); | ||||
250 | } | ||||
251 | | ||||
252 | bool KTextEditor::InlineNote::hasFocus() const | ||||
253 | { | ||||
254 | return m_hasFocus; | ||||
255 | } | ||||
256 | | ||||
257 | void KTextEditor::InlineNoteProvider::inlineNoteActivated(const InlineNote& note, Qt::MouseButtons buttons, const QPoint& pos) | ||||
258 | { | ||||
259 | Q_UNUSED(note); | ||||
260 | Q_UNUSED(buttons); | ||||
261 | Q_UNUSED(pos); | ||||
262 | } | ||||
263 | | ||||
264 | void KTextEditor::InlineNoteProvider::inlineNoteFocusInEvent(const KTextEditor::InlineNote& note, const QPoint& pos) | ||||
265 | { | ||||
266 | Q_UNUSED(note); | ||||
267 | Q_UNUSED(pos); | ||||
268 | } | ||||
269 | | ||||
270 | void KTextEditor::InlineNoteProvider::inlineNoteFocusOutEvent(const KTextEditor::InlineNote& note) | ||||
271 | { | ||||
272 | Q_UNUSED(note); | ||||
273 | } | ||||
274 | | ||||
275 | void KTextEditor::InlineNoteProvider::inlineNoteMouseMoveEvent(const KTextEditor::InlineNote& note, const QPoint& pos) | ||||
276 | { | ||||
277 | Q_UNUSED(note); | ||||
278 | Q_UNUSED(pos); | ||||
279 | } | ||||
280 | | ||||
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 | ||||
291 | { | ||||
292 | auto localPos = static_cast<const ViewPrivate*>(m_view)->inlineNoteRect(*this).topLeft() + pos; | ||||
293 | return m_view->mapToGlobal(localPos); | ||||
294 | } | ||||
295 | | ||||
296 | KTextEditor::InlineNoteProvider* InlineNote::provider() const | ||||
297 | { | ||||
298 | return m_provider; | ||||
299 | } | ||||
300 | | ||||
301 | const KTextEditor::View* InlineNote::view() const | ||||
302 | { | ||||
303 | return m_view; | ||||
304 | } | ||||
305 | | ||||
306 | QFont InlineNote::font() const | ||||
307 | { | ||||
308 | return m_font; | ||||
309 | } | ||||
310 | | ||||
311 | int InlineNote::index() const | ||||
312 | { | ||||
313 | return m_index; | ||||
314 | } | ||||
315 | | ||||
316 | int InlineNote::lineHeight() const | ||||
317 | { | ||||
318 | return m_lineHeight; | ||||
319 | } | ||||
320 | | ||||
321 | KTextEditor::Cursor InlineNote::position() const | ||||
322 | { | ||||
323 | return m_position; | ||||
324 | } | ||||
325 | | ||||
213 | Command::Command(const QStringList &cmds, QObject *parent) | 326 | Command::Command(const QStringList &cmds, QObject *parent) | ||
214 | : QObject(parent) | 327 | : QObject(parent) | ||
215 | , m_cmds (cmds) | 328 | , m_cmds (cmds) | ||
216 | , d(nullptr) | 329 | , d(nullptr) | ||
217 | { | 330 | { | ||
218 | // register this command | 331 | // register this command | ||
219 | static_cast<KTextEditor::EditorPrivate *> (KTextEditor::Editor::instance())->cmdManager()->registerCommand (this); | 332 | static_cast<KTextEditor::EditorPrivate *> (KTextEditor::Editor::instance())->cmdManager()->registerCommand (this); | ||
220 | } | 333 | } | ||
▲ Show 20 Lines • Show All 56 Lines • Show Last 20 Lines |
When members are initialized in the header file, you can write here: