Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
aa630932
Commit
aa630932
authored
Jun 17, 2009
by
mae
Browse files
make zoom-in/-out apply to all editors
parent
69ff0eeb
Changes
8
Hide whitespace changes
Inline
Side-by-side
src/plugins/texteditor/basetexteditor.cpp
View file @
aa630932
...
...
@@ -45,7 +45,7 @@
#include <coreplugin/stylehelper.h>
#include <extensionsystem/pluginmanager.h>
#include <find/basetextfind.h>
#include <texteditor/fontsettings.h>
#include <utils/reloadpromptutils.h>
#include <aggregation/aggregate.h>
#endif
...
...
@@ -3114,8 +3114,9 @@ void BaseTextEditor::zoomIn(int range)
const
int
newSize
=
f
.
pointSize
()
+
range
;
if
(
newSize
<=
0
)
return
;
f
.
setPointSize
(
newSize
);
setFont
(
f
);
emit
requestFontSize
(
newSize
);
// f.setPointSize(newSize);
// setFont(f);
}
void
BaseTextEditor
::
zoomOut
(
int
range
)
...
...
@@ -3837,6 +3838,24 @@ void BaseTextEditor::unCommentSelection()
{
}
void
BaseTextEditor
::
showEvent
(
QShowEvent
*
e
)
{
if
(
!
d
->
m_fontSettings
.
isEmpty
())
{
setFontSettings
(
d
->
m_fontSettings
);
d
->
m_fontSettings
.
clear
();
}
QPlainTextEdit
::
showEvent
(
e
);
}
void
BaseTextEditor
::
setFontSettingsIfVisible
(
const
TextEditor
::
FontSettings
&
fs
)
{
if
(
!
isVisible
())
{
d
->
m_fontSettings
=
fs
;
return
;
}
setFontSettings
(
fs
);
}
void
BaseTextEditor
::
setFontSettings
(
const
TextEditor
::
FontSettings
&
fs
)
{
const
QTextCharFormat
textFormat
=
fs
.
toTextCharFormat
(
QLatin1String
(
Constants
::
C_TEXT
));
...
...
src/plugins/texteditor/basetexteditor.h
View file @
aa630932
...
...
@@ -408,6 +408,8 @@ protected:
void
wheelEvent
(
QWheelEvent
*
e
);
void
changeEvent
(
QEvent
*
e
);
void
showEvent
(
QShowEvent
*
);
// reimplemented to support block selection
QMimeData
*
createMimeDataFromSelection
()
const
;
bool
canInsertFromMimeData
(
const
QMimeData
*
source
)
const
;
...
...
@@ -483,6 +485,7 @@ public slots:
virtual
void
format
();
virtual
void
unCommentSelection
();
virtual
void
setFontSettings
(
const
TextEditor
::
FontSettings
&
);
void
setFontSettingsIfVisible
(
const
TextEditor
::
FontSettings
&
);
virtual
void
setTabSettings
(
const
TextEditor
::
TabSettings
&
);
virtual
void
setDisplaySettings
(
const
TextEditor
::
DisplaySettings
&
);
virtual
void
setStorageSettings
(
const
TextEditor
::
StorageSettings
&
);
...
...
@@ -511,6 +514,7 @@ protected slots:
virtual
void
slotUpdateBlockNotify
(
const
QTextBlock
&
);
signals:
void
requestFontSize
(
int
pointSize
);
void
requestBlockUpdate
(
const
QTextBlock
&
);
void
requestAutoCompletion
(
ITextEditable
*
editor
,
bool
forced
);
void
requestQuickFix
(
ITextEditable
*
editor
);
...
...
@@ -534,6 +538,7 @@ private:
QTextBlock
collapsedBlockAt
(
const
QPoint
&
pos
,
QRect
*
box
=
0
)
const
;
// parentheses matcher
private
slots
:
void
_q_matchParentheses
();
...
...
src/plugins/texteditor/basetexteditor_p.h
View file @
aa630932
...
...
@@ -31,6 +31,7 @@
#define BASETEXTEDITOR_P_H
#include "basetexteditor.h"
#include <texteditor/fontsettings.h>
#include <QtCore/QBasicTimer>
#include <QtCore/QSharedData>
...
...
@@ -174,6 +175,7 @@ public:
QWidget
*
m_extraArea
;
DisplaySettings
m_displaySettings
;
TextEditor
::
FontSettings
m_fontSettings
;
int
extraAreaSelectionAnchorBlockNumber
;
int
extraAreaToggleMarkBlockNumber
;
...
...
src/plugins/texteditor/fontsettings.cpp
View file @
aa630932
...
...
@@ -136,12 +136,11 @@ bool Format::equals(const Format &f) const
}
// -- FontSettings
FontSettings
::
FontSettings
(
const
FormatDescriptions
&
fd
)
:
FontSettings
::
FontSettings
()
:
m_family
(
defaultFixedFontFamily
()),
m_fontSize
(
DEFAULT_FONT_SIZE
),
m_antialias
(
DEFAULT_ANTIALIAS
)
{
Q_UNUSED
(
fd
);
}
void
FontSettings
::
clear
()
...
...
@@ -149,7 +148,8 @@ void FontSettings::clear()
m_family
=
defaultFixedFontFamily
();
m_fontSize
=
DEFAULT_FONT_SIZE
;
m_antialias
=
DEFAULT_ANTIALIAS
;
qFill
(
m_formats
.
begin
(),
m_formats
.
end
(),
Format
());
m_formats
.
clear
();
//qFill(m_formats.begin(), m_formats.end(), Format());
}
void
FontSettings
::
toSettings
(
const
QString
&
category
,
...
...
src/plugins/texteditor/fontsettings.h
View file @
aa630932
...
...
@@ -88,8 +88,9 @@ class TEXTEDITOR_EXPORT FontSettings
public:
typedef
QList
<
FormatDescription
>
FormatDescriptions
;
FontSettings
(
const
FormatDescriptions
&
fd
);
FontSettings
();
void
clear
();
inline
bool
isEmpty
()
const
{
return
m_formats
.
isEmpty
();
}
void
toSettings
(
const
QString
&
category
,
const
FormatDescriptions
&
descriptions
,
...
...
src/plugins/texteditor/fontsettingspage.cpp
View file @
aa630932
...
...
@@ -91,8 +91,6 @@ FontSettingsPagePrivate::FontSettingsPagePrivate(const TextEditor::FormatDescrip
m_category
(
category
),
m_trCategory
(
trCategory
),
m_descriptions
(
fd
),
m_value
(
fd
),
m_lastValue
(
fd
),
m_curItem
(
-
1
)
{
bool
settingsFound
=
false
;
...
...
src/plugins/texteditor/texteditorsettings.cpp
View file @
aa630932
...
...
@@ -152,7 +152,7 @@ void TextEditorSettings::initializeEditor(BaseTextEditor *editor)
{
// Connect to settings change signals
connect
(
this
,
SIGNAL
(
fontSettingsChanged
(
TextEditor
::
FontSettings
)),
editor
,
SLOT
(
setFontSettings
(
TextEditor
::
FontSettings
)));
editor
,
SLOT
(
setFontSettings
IfVisible
(
TextEditor
::
FontSettings
)));
connect
(
this
,
SIGNAL
(
tabSettingsChanged
(
TextEditor
::
TabSettings
)),
editor
,
SLOT
(
setTabSettings
(
TextEditor
::
TabSettings
)));
connect
(
this
,
SIGNAL
(
storageSettingsChanged
(
TextEditor
::
StorageSettings
)),
...
...
@@ -160,6 +160,9 @@ void TextEditorSettings::initializeEditor(BaseTextEditor *editor)
connect
(
this
,
SIGNAL
(
displaySettingsChanged
(
TextEditor
::
DisplaySettings
)),
editor
,
SLOT
(
setDisplaySettings
(
TextEditor
::
DisplaySettings
)));
connect
(
editor
,
SIGNAL
(
requestFontSize
(
int
)),
this
,
SLOT
(
fontSizeRequested
(
int
)));
// Apply current settings (tab settings depend on font settings)
editor
->
setFontSettings
(
fontSettings
());
editor
->
setTabSettings
(
tabSettings
());
...
...
@@ -167,6 +170,14 @@ void TextEditorSettings::initializeEditor(BaseTextEditor *editor)
editor
->
setDisplaySettings
(
displaySettings
());
}
void
TextEditorSettings
::
fontSizeRequested
(
int
pointSize
)
{
FontSettings
&
fs
=
const_cast
<
FontSettings
&>
(
m_fontSettingsPage
->
fontSettings
());
fs
.
setFontSize
(
pointSize
);
emit
fontSettingsChanged
(
m_fontSettingsPage
->
fontSettings
());
}
FontSettings
TextEditorSettings
::
fontSettings
()
const
{
return
m_fontSettingsPage
->
fontSettings
();
...
...
src/plugins/texteditor/texteditorsettings.h
View file @
aa630932
...
...
@@ -73,6 +73,9 @@ signals:
void
storageSettingsChanged
(
const
TextEditor
::
StorageSettings
&
);
void
displaySettingsChanged
(
const
TextEditor
::
DisplaySettings
&
);
private
slots
:
void
fontSizeRequested
(
int
pointSize
);
private:
FontSettingsPage
*
m_fontSettingsPage
;
BehaviorSettingsPage
*
m_behaviorSettingsPage
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment