diff options
Diffstat (limited to 'src/MainWindow.cpp')
-rw-r--r-- | src/MainWindow.cpp | 142 |
1 files changed, 64 insertions, 78 deletions
diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index 34cc09f..48f65d4 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -468,10 +468,10 @@ void MainWindow::initIndenter() connect(m_indentHandler, SIGNAL(indenterSettingsChanged()), this, SLOT(indentSettingsChangedSlot())); -///-- // Set this true, so the indenter is called at first program start -///-- _indentSettingsChanged = true; -///-- m_previewToggled = true; -///-- + // Set this true, so the indenter is called at first program start + m_indentSettingsChanged = true; + m_previewToggled = true; + ///-- // Handle if indenter parameter tool tips are enabled ///-- _settings->registerObjectProperty(actionIndenterParameterTooltipsEnabled, ///-- "checked", "indenterParameterTooltipsEnabled"); @@ -683,8 +683,8 @@ void MainWindow::updateSourceView() void MainWindow::callIndenter() { TQApplication::setOverrideCursor(TQt::WaitCursor); -///-- m_sourceFormattedContent = m_indentHandler->callIndenter(m_sourceFileContent, -///-- m_currentSourceFileExtension); + m_sourceFormattedContent = m_indentHandler->callIndenter(m_sourceFileContent, + m_currentSourceFileExtension); updateSourceView(); TQApplication::restoreOverrideCursor(); } @@ -872,45 +872,38 @@ void MainWindow::sourceCodeChangedSlot() */ void MainWindow::indentSettingsChangedSlot() { -///-- _indentSettingsChanged = true; -///-- -///-- int cursorLine, cursorPos; -///-- m_qSciSourceCodeEditor->getCursorPosition(&cursorLine, &cursorPos); -///-- -///-- if (m_toolBarWidget->cbLivePreview->isChecked()) -///-- { -///-- callIndenter(); -///-- m_previewToggled = true; -///-- -///-- updateSourceView(); -///-- if (m_sourceCodeChanged) -///-- { -///-- /* savedCursor = m_qSciSourceCodeEditor->textCursor(); -///-- if ( cursorPos >= m_qSciSourceCodeEditor->text().count() ) { -///-- cursorPos = m_qSciSourceCodeEditor->text().count() - 1; -///-- } -///-- savedCursor.setPosition( cursorPos ); -///-- m_qSciSourceCodeEditor->setTextCursor( savedCursor ); -///-- */ -///-- m_sourceCodeChanged = false; -///-- } -///-- _indentSettingsChanged = false; -///-- } -///-- else -///-- { -///-- updateSourceView(); -///-- } -///-- -///-- if (m_savedSourceContent == m_qSciSourceCodeEditor->text()) -///-- { -///-- m_qSciSourceCodeEditor->setModified(false); -///-- m_documentModified = false; -///-- } -///-- else -///-- { -///-- m_qSciSourceCodeEditor->setModified(true); // Has no effect according to TQScintilla docs. -///-- m_documentModified = true; -///-- } + m_indentSettingsChanged = true; + + int cursorLine, cursorPos; + m_qSciSourceCodeEditor->getCursorPosition(&cursorLine, &cursorPos); + + if (m_toolBarWidget->cbLivePreview->isChecked()) + { + callIndenter(); + m_previewToggled = true; + + updateSourceView(); + if (m_sourceCodeChanged) + { + m_sourceCodeChanged = false; + } + m_indentSettingsChanged = false; + } + else + { + updateSourceView(); + } + + if (m_savedSourceContent == m_qSciSourceCodeEditor->text()) + { + m_qSciSourceCodeEditor->setModified(false); + m_documentModified = false; + } + else + { + m_qSciSourceCodeEditor->setModified(true); // Has no effect according to TQScintilla docs. + m_documentModified = true; + } } /* @@ -921,39 +914,32 @@ void MainWindow::indentSettingsChangedSlot() */ void MainWindow::previewTurnedOnOff(bool turnOn) { -///-- m_previewToggled = true; -///-- -///-- int cursorLine, cursorPos; -///-- m_qSciSourceCodeEditor->getCursorPosition(&cursorLine, &cursorPos); -///-- -///-- if (turnOn && (_indentSettingsChanged || m_sourceCodeChanged)) -///-- { -///-- callIndenter(); -///-- } -///-- updateSourceView(); -///-- if (m_sourceCodeChanged) -///-- { -///-- /* savedCursor = m_qSciSourceCodeEditor->textCursor(); -///-- if ( cursorPos >= m_qSciSourceCodeEditor->text().count() ) { -///-- cursorPos = m_qSciSourceCodeEditor->text().count() - 1; -///-- } -///-- savedCursor.setPosition( cursorPos ); -///-- m_qSciSourceCodeEditor->setTextCursor( savedCursor ); -///-- */ -///-- m_sourceCodeChanged = false; -///-- } -///-- _indentSettingsChanged = false; -///-- -///-- if (m_savedSourceContent == m_qSciSourceCodeEditor->text()) -///-- { -///-- m_qSciSourceCodeEditor->setModified(false); -///-- m_documentModified = false; -///-- } -///-- else -///-- { -///-- m_qSciSourceCodeEditor->setModified(true); -///-- m_documentModified = true; -///-- } + m_previewToggled = true; + + int cursorLine, cursorPos; + m_qSciSourceCodeEditor->getCursorPosition(&cursorLine, &cursorPos); + + if (turnOn && (m_indentSettingsChanged || m_sourceCodeChanged)) + { + callIndenter(); + } + updateSourceView(); + if (m_sourceCodeChanged) + { + m_sourceCodeChanged = false; + } + m_indentSettingsChanged = false; + + if (m_savedSourceContent == m_qSciSourceCodeEditor->text()) + { + m_qSciSourceCodeEditor->setModified(false); + m_documentModified = false; + } + else + { + m_qSciSourceCodeEditor->setModified(true); + m_documentModified = true; + } } /* |