aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Editor.cxx
diff options
context:
space:
mode:
authornyamatongwe <devnull@localhost>2002-04-07 02:24:40 +0000
committernyamatongwe <devnull@localhost>2002-04-07 02:24:40 +0000
commitef5b2192b86405b14f7cc45f6d48b9f9889eedbe (patch)
treec4a4656a5cf4fdf8eeb37bf82ce19710a8d76dc3 /src/Editor.cxx
parentdbae5814b486802378c41ca4c095d0aa6dfcff86 (diff)
downloadscintilla-mirror-ef5b2192b86405b14f7cc45f6d48b9f9889eedbe.tar.gz
Added ZOOM notification. Added TextWidth method to allow clients to determine width of text items such as width needed for line numbers.
Diffstat (limited to 'src/Editor.cxx')
-rw-r--r--src/Editor.cxx38
1 files changed, 32 insertions, 6 deletions
diff --git a/src/Editor.cxx b/src/Editor.cxx
index 4e430b0d7..86b0aa1f2 100644
--- a/src/Editor.cxx
+++ b/src/Editor.cxx
@@ -2168,6 +2168,16 @@ long Editor::FormatRange(bool draw, RangeToFormat *pfr) {
return endPosPrint;
}
+int Editor::TextWidth(int style, const char *text) {
+ RefreshStyleData();
+ AutoSurface surface(IsUnicodeMode());
+ if (surface) {
+ return surface->WidthText(vs.styles[style].font, text, strlen(text));
+ } else {
+ return 1;
+ }
+}
+
// Empty method is overridden on GTK+ to show / hide scrollbars
void Editor::ReconfigureScrollBars() {}
@@ -2528,6 +2538,12 @@ void Editor::NotifyDwelling(Point pt, bool state) {
NotifyParent(scn);
}
+void Editor::NotifyZoom() {
+ SCNotification scn;
+ scn.nmhdr.code = SCN_ZOOM;
+ NotifyParent(scn);
+}
+
// Notifications from document
void Editor::NotifyModifyAttempt(Document*, void *) {
//Platform::DebugPrintf("** Modify Attempt\n");
@@ -3028,16 +3044,20 @@ int Editor::KeyCommand(unsigned int iMessage) {
SetLastXChosen();
break;
case SCI_ZOOMIN:
- if (vs.zoomLevel < 20)
+ if (vs.zoomLevel < 20) {
vs.zoomLevel++;
- NeedWrapping();
- InvalidateStyleRedraw();
+ NeedWrapping();
+ InvalidateStyleRedraw();
+ NotifyZoom();
+ }
break;
case SCI_ZOOMOUT:
- if (vs.zoomLevel > -10)
+ if (vs.zoomLevel > -10) {
vs.zoomLevel--;
- NeedWrapping();
- InvalidateStyleRedraw();
+ NeedWrapping();
+ InvalidateStyleRedraw();
+ NotifyZoom();
+ }
break;
case SCI_DELWORDLEFT: {
int startWord = pdoc->NextWordStart(currentPos, -1);
@@ -4679,6 +4699,11 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
case SCI_GETSCROLLWIDTH:
return scrollWidth;
+ case SCI_TEXTWIDTH:
+ PLATFORM_ASSERT((wParam >= 0) && (wParam <= STYLE_MAX));
+ PLATFORM_ASSERT(lParam);
+ return TextWidth(wParam, reinterpret_cast<char *>(lParam));
+
case SCI_GETCOLUMN:
return pdoc->GetColumn(wParam);
@@ -5178,6 +5203,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
vs.zoomLevel = wParam;
NeedWrapping();
InvalidateStyleRedraw();
+ NotifyZoom();
break;
case SCI_GETZOOM: