Skip to content

Commit

Permalink
v0.0.65
Browse files Browse the repository at this point in the history
  • Loading branch information
yousefvand committed Dec 4, 2024
1 parent 4bddf26 commit 9700d48
Show file tree
Hide file tree
Showing 6 changed files with 85 additions and 13 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

============

## 0.0.65

- Implemented:
- View Menu -> Zoom

## 0.0.64

- Implemented:
Expand Down
26 changes: 13 additions & 13 deletions CMakeLists.txt.user
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 14.0.2, 2024-12-04T13:34:42. -->
<!-- Written by QtCreator 14.0.2, 2024-12-04T14:45:50. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
Expand Down Expand Up @@ -102,14 +102,14 @@
<value type="int" key="CMake.Configure.BaseEnvironment">2</value>
<value type="bool" key="CMake.Configure.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="CMake.Configure.UserEnvironmentChanges"/>
<value type="QString" key="CMake.Initial.Parameters">-DCMAKE_PROJECT_INCLUDE_BEFORE:FILEPATH=%{BuildConfig:BuildDirectory:NativeFilePath}/.qtc/package-manager/auto-setup.cmake
-DQT_QMAKE_EXECUTABLE:FILEPATH=%{Qt:qmakeExecutable}
<value type="QString" key="CMake.Initial.Parameters">-DCMAKE_GENERATOR:STRING=Ninja
-DCMAKE_BUILD_TYPE:STRING=Debug
-DCMAKE_CXX_FLAGS_INIT:STRING=%{Qt:QML_DEBUG_FLAG}
-DCMAKE_CXX_COMPILER:FILEPATH=%{Compiler:Executable:Cxx}
-DCMAKE_PROJECT_INCLUDE_BEFORE:FILEPATH=%{BuildConfig:BuildDirectory:NativeFilePath}/.qtc/package-manager/auto-setup.cmake
-DQT_QMAKE_EXECUTABLE:FILEPATH=%{Qt:qmakeExecutable}
-DCMAKE_PREFIX_PATH:PATH=%{Qt:QT_INSTALL_PREFIX}
-DCMAKE_CXX_FLAGS_INIT:STRING=%{Qt:QML_DEBUG_FLAG}
-DCMAKE_BUILD_TYPE:STRING=Debug
-DCMAKE_C_COMPILER:FILEPATH=%{Compiler:Executable:C}
-DCMAKE_GENERATOR:STRING=Ninja</value>
-DCMAKE_C_COMPILER:FILEPATH=%{Compiler:Executable:C}</value>
<value type="QString" key="CMake.Source.Directory">/data/Code/Qt/Notepad--</value>
<value type="int" key="EnableQmlDebugging">0</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/data/Code/Qt/Notepad--/build/Desktop-Debug</value>
Expand Down Expand Up @@ -160,14 +160,14 @@
<value type="int" key="CMake.Configure.BaseEnvironment">2</value>
<value type="bool" key="CMake.Configure.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="CMake.Configure.UserEnvironmentChanges"/>
<value type="QString" key="CMake.Initial.Parameters">-DCMAKE_PROJECT_INCLUDE_BEFORE:FILEPATH=%{BuildConfig:BuildDirectory:NativeFilePath}/.qtc/package-manager/auto-setup.cmake
-DQT_QMAKE_EXECUTABLE:FILEPATH=%{Qt:qmakeExecutable}
<value type="QString" key="CMake.Initial.Parameters">-DCMAKE_GENERATOR:STRING=Ninja
-DCMAKE_BUILD_TYPE:STRING=Release
-DCMAKE_CXX_FLAGS_INIT:STRING=%{Qt:QML_DEBUG_FLAG}
-DCMAKE_CXX_COMPILER:FILEPATH=%{Compiler:Executable:Cxx}
-DCMAKE_PROJECT_INCLUDE_BEFORE:FILEPATH=%{BuildConfig:BuildDirectory:NativeFilePath}/.qtc/package-manager/auto-setup.cmake
-DQT_QMAKE_EXECUTABLE:FILEPATH=%{Qt:qmakeExecutable}
-DCMAKE_PREFIX_PATH:PATH=%{Qt:QT_INSTALL_PREFIX}
-DCMAKE_CXX_FLAGS_INIT:STRING=%{Qt:QML_DEBUG_FLAG}
-DCMAKE_BUILD_TYPE:STRING=Release
-DCMAKE_C_COMPILER:FILEPATH=%{Compiler:Executable:C}
-DCMAKE_GENERATOR:STRING=Ninja</value>
-DCMAKE_C_COMPILER:FILEPATH=%{Compiler:Executable:C}</value>
<value type="QString" key="CMake.Source.Directory">/data/Code/Qt/Notepad--</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/data/Code/Qt/Notepad--/build/Desktop-Release</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
Expand Down
27 changes: 27 additions & 0 deletions src/codeeditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,7 @@ void CodeEditor::paintSpaces(QPainter& painter, const QTextBlock& block, int top
}

void CodeEditor::paintEOL(QPainter& painter, const QTextBlock& block, int top, int bottom) {
Q_UNUSED(bottom);
QFontMetrics metrics(font());
QString text = block.text();
QTextCursor blockCursor(block);
Expand Down Expand Up @@ -460,3 +461,29 @@ void CodeEditor::paintEvent(QPaintEvent* event) {
block = block.next();
}
}

void CodeEditor::zoomIn() {
QFont currentFont = this->font();
int currentSize = currentFont.pointSize();
if (currentSize < 72) {
currentFont.setPointSize(currentSize + 1);
this->setFont(currentFont);
}
}

void CodeEditor::zoomOut() {
QFont currentFont = this->font();
int currentSize = currentFont.pointSize();
if (currentSize > 8) {
currentFont.setPointSize(currentSize - 1);
this->setFont(currentFont);
}
}

void CodeEditor::defaultZoom() {
QFont currentFont = this->font();
currentFont.setPointSize(12);
this->setFont(currentFont);
}


3 changes: 3 additions & 0 deletions src/codeeditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ class CodeEditor : public QPlainTextEdit {
void setShowIndentGuide(bool enabled);
void setShowWrapSymbol(bool enabled);
void setTabWidth(int width);
void zoomIn();
void zoomOut();
void defaultZoom();

protected:
void resizeEvent(QResizeEvent *event) override;
Expand Down
31 changes: 31 additions & 0 deletions src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,37 @@ void MainWindow::on_actionShow_Wrap_Symbol_triggered(bool checked)
}
}

void MainWindow::on_actionZoom_In_triggered()
{
for (int i = 0; i < ui->documentsTab->count(); ++i) {
Document *doc = qobject_cast<Document *>(ui->documentsTab->widget(i));
if (doc) {
doc->editor()->zoomIn();
}
}
}

void MainWindow::on_actionoom_Out_triggered()
{
for (int i = 0; i < ui->documentsTab->count(); ++i) {
Document *doc = qobject_cast<Document *>(ui->documentsTab->widget(i));
if (doc) {
doc->editor()->zoomOut();
}
}
}

void MainWindow::on_action_Restore_Default_Zoom_triggered()
{
for (int i = 0; i < ui->documentsTab->count(); ++i) {
Document *doc = qobject_cast<Document *>(ui->documentsTab->widget(i));
if (doc) {
doc->editor()->defaultZoom();
}
}
}





Expand Down
6 changes: 6 additions & 0 deletions src/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,12 @@ private slots:

void on_actionShow_Wrap_Symbol_triggered(bool checked);

void on_actionZoom_In_triggered();

void on_actionoom_Out_triggered();

void on_action_Restore_Default_Zoom_triggered();

private:
Ui::MainWindow* ui;
FileOperations* fileOperations;
Expand Down

0 comments on commit 9700d48

Please sign in to comment.