summaryrefslogtreecommitdiff
path: root/src/editor.cc
diff options
context:
space:
mode:
authordon bright <hugh.m.bright@gmail.com>2012-07-23 01:16:37 (GMT)
committerdon bright <hugh.m.bright@gmail.com>2012-07-23 01:16:37 (GMT)
commit3c7a85af570e5609f4a6625e06410f31fa4d4f0f (patch)
tree6f2f97a520d356bba65bc4b66e824f3e5c05dd99 /src/editor.cc
parent255190589527a6dbe4a6ef26f39abb126d348649 (diff)
debugging and rearranging to find issue
Diffstat (limited to 'src/editor.cc')
-rw-r--r--src/editor.cc41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/editor.cc b/src/editor.cc
index 4482558..5cf5b42 100644
--- a/src/editor.cc
+++ b/src/editor.cc
@@ -1,4 +1,7 @@
#include "editor.h"
+#include "Preferences.h"
+
+#include <iostream>
#ifndef _QCODE_EDIT_
void Editor::indentSelection()
@@ -70,4 +73,42 @@ void Editor::uncommentSelection()
cursor.setPosition(p2, QTextCursor::KeepAnchor);
setTextCursor(cursor);
}
+
+void Editor::zoomIn()
+{
+ // We have the fontsize in two places. one, in the in-memory window font
+ // information that the user sees on the screen, and two, in the
+ // settings which are persistent on disk. Here we make sure they are
+ // in sync - we assume the fontsize from the in-memory window to be accurate,
+ // and trust that there is code elsewhere in OpenSCAD that has initialized
+ // it properly. We update the on-disk Settings with whatever is in the window.
+ //
+ // And of course we increment by one before we do all this.
+ // See also QT's implementation of QEditor
+ QSettings settings;
+ QFont tmp_font = this->font() ;
+ std::cout << "in fontsize cur" << tmp_font.pointSize() << "\n";
+ if ( font().pointSize() >= 1 )
+ tmp_font.setPointSize( 1 + font().pointSize() );
+ else
+ tmp_font.setPointSize( 1 );
+ std::cout << "in new fontsize cur" << tmp_font.pointSize() << "\n";
+ settings.setValue("editor/fontsize", tmp_font.pointSize());
+ this->setFont( tmp_font );
+}
+
+void Editor::zoomOut()
+{
+ QSettings settings;
+ QFont tmp_font = this->font();
+ std::cout << "out fontsize cur" << tmp_font.pointSize() << "\n";
+ if ( font().pointSize() >= 2 )
+ tmp_font.setPointSize( -1 + font().pointSize() );
+ else
+ tmp_font.setPointSize( 1 );
+ std::cout << "out new fontsize cur" << tmp_font.pointSize() << "\n";
+ settings.setValue("editor/fontsize", tmp_font.pointSize());
+ this->setFont( tmp_font );
+}
+
#endif
contact: Jan Huwald // Impressum