File tree 3 files changed +53
-5
lines changed
3 files changed +53
-5
lines changed Original file line number Diff line number Diff line change @@ -714,6 +714,9 @@ void MainWindow::setupWindowStructure()
714
714
mainWidget->setObjectName (" mainWidget" );
715
715
716
716
setCentralWidget (mainWidget);
717
+
718
+ incomingPane->setZoomLevel (gui_settings->value (" prefs/cue-zoom" , 0 ).toInt ());
719
+ outputPane->setZoomLevel (gui_settings->value (" prefs/log-zoom" , 0 ).toInt ());
717
720
}
718
721
719
722
void MainWindow::docLinkClicked (const QUrl& url)
@@ -4344,7 +4347,8 @@ void MainWindow::writeSettings()
4344
4347
gui_settings->setValue (" prefs/show-log" , piSettings->show_log );
4345
4348
gui_settings->setValue (" prefs/show-context" , piSettings->show_context );
4346
4349
gui_settings->setValue (" prefs/shortcut-mode" , piSettings->shortcut_mode );
4347
-
4350
+ gui_settings->setValue (" prefs/log-zoom" , outputPane->currentZoomLevel ());
4351
+ gui_settings->setValue (" prefs/cue-zoom" , incomingPane->currentZoomLevel ());
4348
4352
for (auto name : piSettings->scope_names )
4349
4353
{
4350
4354
gui_settings->setValue (" prefs/scope/show-" + name.toLower (), piSettings->isScopeActive (name));
Original file line number Diff line number Diff line change 19
19
#include " model/sonicpitheme.h"
20
20
#include < QScrollBar>
21
21
22
- SonicPiLog::SonicPiLog (QWidget *parent) : QPlainTextEdit(parent)
22
+ SonicPiLog::SonicPiLog (QWidget* parent)
23
+ : QPlainTextEdit(parent)
23
24
{
24
- forceScroll = true ;
25
+ forceScroll = true ;
26
+ zoomLevel = 0 ;
25
27
}
26
28
27
- void SonicPiLog::forceScrollDown ( bool force )
29
+ void SonicPiLog::zoomIn ( )
28
30
{
29
- forceScroll = force ;
31
+ setZoomLevel (zoomLevel + 1 ) ;
30
32
}
31
33
34
+ void SonicPiLog::zoomOut ()
35
+ {
36
+ setZoomLevel (zoomLevel - 1 );
37
+ }
38
+
39
+ void SonicPiLog::setZoomLevel (int zoom)
40
+ {
41
+ const int MIN_ZOOM = -10 ;
42
+ const int MAX_ZOOM = 10 ;
43
+
44
+ // Clamp the desired zoom to your range
45
+ int targetZoom = std::clamp (zoom, MIN_ZOOM, MAX_ZOOM);
46
+
47
+ int delta = targetZoom - zoomLevel;
48
+
49
+ if (delta > 0 )
50
+ {
51
+ QPlainTextEdit::zoomIn (delta);
52
+ }
53
+ else if (delta < 0 )
54
+ {
55
+
56
+ QPlainTextEdit::zoomOut (-delta);
57
+ }
58
+ zoomLevel = targetZoom;
59
+ }
60
+
61
+ int SonicPiLog::currentZoomLevel () const
62
+ {
63
+ return zoomLevel;
64
+ }
65
+
66
+ void SonicPiLog::forceScrollDown (bool force)
67
+ {
68
+ forceScroll = force;
69
+ }
32
70
33
71
void SonicPiLog::setTextColor (QColor c)
34
72
{
Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ class SonicPiLog : public QPlainTextEdit
24
24
public:
25
25
explicit SonicPiLog (QWidget *parent = 0 );
26
26
bool forceScroll;
27
+ int zoomLevel;
27
28
28
29
struct Message
29
30
{
@@ -51,6 +52,11 @@ public slots:
51
52
void handleMultiMessage (SonicPiLog::MultiMessage mm);
52
53
void forceScrollDown (bool force);
53
54
void appendPlainText (QString text);
55
+ void zoomIn ();
56
+ void zoomOut ();
57
+ void setZoomLevel (int zoom);
58
+ int currentZoomLevel () const ;
59
+
54
60
55
61
protected:
56
62
};
You can’t perform that action at this time.
0 commit comments