From 34db57b66f5338f5287bab7ea440d51d5c43cc59 Mon Sep 17 00:00:00 2001 From: corvid Date: Sun, 17 Jul 2011 20:52:09 +0000 Subject: clean up FltkViewBase::handle no change in behaviour intended --- dw/fltkviewbase.cc | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'dw') diff --git a/dw/fltkviewbase.cc b/dw/fltkviewbase.cc index f2fd96fc..a0dec2e1 100644 --- a/dw/fltkviewbase.cc +++ b/dw/fltkviewbase.cc @@ -241,9 +241,9 @@ int FltkViewBase::handle (int event) if (processed) { /* pressed dw content; give focus to the view */ Fl::focus(this); + return true; } - return processed ? true : Fl_Group::handle (event); - + break; case FL_RELEASE: processed = theLayout->buttonRelease (this, Fl::event_clicks () + 1, @@ -251,8 +251,9 @@ int FltkViewBase::handle (int event) translateViewYToCanvasY (Fl::event_y ()), getDwButtonState (), Fl::event_button ()); _MSG("RELEASE => %s\n", processed ? "true" : "false"); - return processed ? true : Fl_Group::handle (event); - + if (processed) + return true; + break; case FL_MOVE: mouse_x = Fl::event_x(); mouse_y = Fl::event_y(); @@ -262,8 +263,9 @@ int FltkViewBase::handle (int event) translateViewYToCanvasY (mouse_y), getDwButtonState ()); _MSG("MOVE => %s\n", processed ? "true" : "false"); - return processed ? true : Fl_Group::handle (event); - + if (processed) + return true; + break; case FL_DRAG: processed = theLayout->motionNotify (this, @@ -271,36 +273,34 @@ int FltkViewBase::handle (int event) translateViewYToCanvasY (Fl::event_y ()), getDwButtonState ()); _MSG("DRAG => %s\n", processed ? "true" : "false"); - return processed ? true : Fl_Group::handle (event); - + if (processed) + return true; + break; case FL_ENTER: theLayout->enterNotify (this, translateViewXToCanvasX (Fl::event_x ()), translateViewYToCanvasY (Fl::event_y ()), getDwButtonState ()); - return Fl_Group::handle (event); - + break; case FL_HIDE: /* WORKAROUND: strangely, the tooltip window is not automatically hidden * with its parent. Here we fake a LEAVE to achieve it. */ case FL_LEAVE: theLayout->leaveNotify (this, getDwButtonState ()); - return Fl_Group::handle (event); - + break; case FL_FOCUS: if (focused_child && find(focused_child) < children()) { /* strangely, find() == children() if the child is not found */ focused_child->take_focus(); } return 1; - case FL_UNFOCUS: focused_child = fl_oldfocus; return 0; - default: - return Fl_Group::handle (event); + break; } + return Fl_Group::handle (event); } // ---------------------------------------------------------------------- -- cgit v1.2.3 From 2a2c5a48f21e32d4b5232931a4c4a380f547b1ff Mon Sep 17 00:00:00 2001 From: corvid Date: Sun, 17 Jul 2011 21:14:30 +0000 Subject: selection press button 3, don't bother going through most of the link stuff It just had the effect of getting it confused sometimes -- pop up the link menu, and then click elsewhere, and it would select the text between A and B. --- dw/selection.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'dw') diff --git a/dw/selection.cc b/dw/selection.cc index 9702eee0..311c551b 100644 --- a/dw/selection.cc +++ b/dw/selection.cc @@ -94,7 +94,11 @@ bool SelectionState::buttonPress (Iterator *it, int charPos, int linkNo, if (!event) return ret; - if (linkNo != -1) { + if (event->button == 3) { + // menu popup + layout->emitLinkPress (itWidget, linkNo, -1, -1, -1, event); + ret = true; + } else if (linkNo != -1) { // link handling (void) layout->emitLinkPress (itWidget, linkNo, -1, -1, -1, event); resetLink (); @@ -134,10 +138,6 @@ bool SelectionState::buttonPress (Iterator *it, int charPos, int linkNo, toChar = correctCharPos (to, charPos); } ret = true; - } else if (event->button == 3) { - // menu popup - layout->emitLinkPress (itWidget, -1, -1, -1, -1, event); - ret = true; } return ret; -- cgit v1.2.3 From 08786bfed29fc9eb6bc65894bdfd50d16d9ea4c5 Mon Sep 17 00:00:00 2001 From: corvid Date: Sun, 17 Jul 2011 21:33:47 +0000 Subject: comment typo --- dw/selection.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'dw') diff --git a/dw/selection.cc b/dw/selection.cc index 311c551b..1552e80e 100644 --- a/dw/selection.cc +++ b/dw/selection.cc @@ -302,7 +302,7 @@ void SelectionState::adjustSelection (Iterator *it, int charPos) } } else { if (cmpOld * cmpDiff < 0) { - // The user has reduced the selection. Unighlight the difference. + // The user has reduced the selection. Unhighlight the difference. highlight0 (false, to, 0, newTo, 0, cmpDiff); } -- cgit v1.2.3 From 1c3f7bdff27c585aea5edb258c69d744504e35e5 Mon Sep 17 00:00:00 2001 From: corvid Date: Sun, 17 Jul 2011 21:53:01 +0000 Subject: more fl_toupper --- dw/fltkviewbase.cc | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'dw') diff --git a/dw/fltkviewbase.cc b/dw/fltkviewbase.cc index a0dec2e1..a01adf1a 100644 --- a/dw/fltkviewbase.cc +++ b/dw/fltkviewbase.cc @@ -25,8 +25,6 @@ #include #include -#include -#include #include "../lout/msg.h" extern Fl_Widget* fl_oldfocus; @@ -550,14 +548,14 @@ void FltkWidgetView::drawText (core::style::Font *font, viewY = translateCanvasYToViewY (Y); int curr = 0, next = 0, nb; char chbuf[4]; - wchar_t wc, wcu; + int c, cu; if (font->fontVariant == core::style::FONT_VARIANT_SMALL_CAPS) { int sc_fontsize = lout::misc::roundInt(ff->size * 0.78); for (curr = 0; next < len; curr = next) { next = theLayout->nextGlyph(text, curr); - wc = fl_utf8decode(text + curr, text + next, &nb); - if ((wcu = towupper(wc)) == wc) { + c = fl_utf8decode(text + curr, text + next, &nb); + if ((cu = fl_toupper(c)) == c) { /* already uppercase, just draw the character */ fl_font(ff->font, ff->size); fl_draw(text + curr, next - curr, viewX, viewY); @@ -565,7 +563,7 @@ void FltkWidgetView::drawText (core::style::Font *font, viewX += (int)fl_width(text + curr, next - curr); } else { /* make utf8 string for converted char */ - nb = fl_utf8encode(wcu, chbuf); + nb = fl_utf8encode(cu, chbuf); fl_font(ff->font, sc_fontsize); fl_draw(chbuf, nb, viewX, viewY); viewX += font->letterSpacing; -- cgit v1.2.3