mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-25 16:50:50 +01:00
Fixed some conflicts
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
#include "editor_view.h"
|
||||
#include <apps/global_preferences.h>
|
||||
#include <poincare/integer.h>
|
||||
#include <escher/app.h>
|
||||
#include <poincare/preferences.h>
|
||||
@@ -10,50 +11,47 @@ namespace Code {
|
||||
EditorView::EditorView(Responder * parentResponder, App * pythonDelegate) :
|
||||
Responder(parentResponder),
|
||||
View(),
|
||||
m_textArea(parentResponder, pythonDelegate, Poincare::Preferences::sharedPreferences()->KDPythonFont()),
|
||||
m_gutterView(Poincare::Preferences::sharedPreferences()->KDPythonFont())
|
||||
m_textArea(parentResponder, pythonDelegate, GlobalPreferences::sharedGlobalPreferences()->font()),
|
||||
m_gutterView(GlobalPreferences::sharedGlobalPreferences()->font())
|
||||
{
|
||||
m_textArea.setScrollViewDelegate(this);
|
||||
}
|
||||
|
||||
void EditorView::resetSelection() {
|
||||
m_textArea.resetSelection();
|
||||
}
|
||||
|
||||
void EditorView::scrollViewDidChangeOffset(ScrollViewDataSource * scrollViewDataSource) {
|
||||
m_gutterView.setOffset(scrollViewDataSource->offset().y());
|
||||
}
|
||||
|
||||
int EditorView::numberOfSubviews() const {
|
||||
return 2;
|
||||
}
|
||||
|
||||
View * EditorView::subviewAtIndex(int index) {
|
||||
View * subviews[] = {&m_textArea, &m_gutterView};
|
||||
return subviews[index];
|
||||
if (index == 0) {
|
||||
return &m_textArea;
|
||||
}
|
||||
assert(index == 1);
|
||||
return &m_gutterView;
|
||||
}
|
||||
|
||||
void EditorView::didBecomeFirstResponder() {
|
||||
Container::activeApp()->setFirstResponder(&m_textArea);
|
||||
}
|
||||
|
||||
void EditorView::layoutSubviews() {
|
||||
void EditorView::layoutSubviews(bool force) {
|
||||
m_gutterView.setOffset(0);
|
||||
KDCoordinate gutterWidth = m_gutterView.minimalSizeForOptimalDisplay().width();
|
||||
m_gutterView.setFrame(KDRect(0, 0, gutterWidth, bounds().height()));
|
||||
m_gutterView.setFrame(KDRect(0, 0, gutterWidth, bounds().height()), force);
|
||||
|
||||
m_textArea.setFrame(KDRect(
|
||||
gutterWidth,
|
||||
0,
|
||||
bounds().width()-gutterWidth,
|
||||
bounds().height()
|
||||
));
|
||||
gutterWidth,
|
||||
0,
|
||||
bounds().width()-gutterWidth,
|
||||
bounds().height()),
|
||||
force);
|
||||
}
|
||||
|
||||
/* EditorView::GutterView */
|
||||
|
||||
EditorView::GutterView::GutterView(const KDFont * font) :
|
||||
View(),
|
||||
m_offset(0)
|
||||
{
|
||||
}
|
||||
|
||||
void EditorView::GutterView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
KDColor textColor = KDColor::RGB24(0x919EA4);
|
||||
KDColor backgroundColor = KDColor::RGB24(0xE4E6E7);
|
||||
|
||||
Reference in New Issue
Block a user