MCPcopy Create free account
hub / github.com/dail8859/NotepadNext / DockedEditor

Method DockedEditor

src/DockedEditor.cpp:47–95  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

45
46
47DockedEditor::DockedEditor(QWidget *parent) : QObject(parent)
48{
49 ads::CDockComponentsFactory::setFactory(new DockedEditorComponentsFactory());
50
51 ads::CDockManager::setConfigFlag(ads::CDockManager::AllTabsHaveCloseButton, true);
52 ads::CDockManager::setConfigFlag(ads::CDockManager::AlwaysShowTabs, true);
53 ads::CDockManager::setConfigFlag(ads::CDockManager::OpaqueSplitterResize, true);
54 ads::CDockManager::setConfigFlag(ads::CDockManager::DragPreviewIsDynamic, true);
55 ads::CDockManager::setConfigFlag(ads::CDockManager::DragPreviewShowsContentPixmap, true);
56 ads::CDockManager::setConfigFlag(ads::CDockManager::DockAreaHasCloseButton, false);
57 ads::CDockManager::setConfigFlag(ads::CDockManager::DockAreaHasUndockButton, false);
58 // When tabs title/text elide disabled and lots of tabs opened, tabs menu button will not show
59 // as it only shows when tab title elided.
60 // So disable dynamic tabs menu visibility.
61 ads::CDockManager::setConfigFlag(ads::CDockManager::DockAreaDynamicTabsMenuButtonVisibility, false);
62 ads::CDockManager::setConfigFlag(ads::CDockManager::FocusHighlighting, true);
63 ads::CDockManager::setConfigFlag(ads::CDockManager::EqualSplitOnInsertion, true);
64 ads::CDockManager::setConfigFlag(ads::CDockManager::MiddleMouseButtonClosesTab, true);
65
66 dockManager = new ads::CDockManager(parent);
67 dockManager->setStyleSheet("");
68
69 connect(dockManager, &ads::CDockManager::focusedDockWidgetChanged, this, [=](ads::CDockWidget* old, ads::CDockWidget* now) {
70 Q_UNUSED(old)
71
72 ScintillaNext *editor = qobject_cast<ScintillaNext *>(now->widget());
73
74 currentEditor = editor;
75 editor->grabFocus();
76 emit editorActivated(editor);
77 });
78
79 connect(dockManager, &ads::CDockManager::dockAreaCreated, this, [=](ads::CDockAreaWidget* DockArea) {
80 DockedEditorTitleBar *titleBar = qobject_cast<DockedEditorTitleBar *>(DockArea->titleBar());
81 connect(titleBar, &DockedEditorTitleBar::doubleClicked, this, &DockedEditor::titleBarDoubleClicked);
82
83 connect(DockArea->titleBar()->tabBar(), &ads::CDockAreaTabBar::tabMoved, this, [=](int from, int to) {
84 Q_UNUSED(from);
85 Q_UNUSED(to);
86
87 emit editorOrderChanged();
88 });
89
90 // In theory the order changes when a new dock area is created (e.g. editor is dragged and dropped),
91 // but the dockAreaCreated() signal is triggered before it is actually added to the CDockManager,
92 // so interrogating the dock manager during the signal doesn't help.
93 //emit editorOrderChanged();
94 });
95}
96
97
98ScintillaNext *DockedEditor::getCurrentEditor() const

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected