On Tue, Dec 18, 2007 at 05:44:30PM +0000, Jeremy Henty wrote:
On Tue, Dec 18, 2007 at 04:48:27PM +0100, Johannes Hofmann wrote:
On Tue, Dec 18, 2007 at 08:28:45AM +0000, Jeremy Henty wrote:
I think there must be something about the way DW creates widgets that means the TextEditor isn't being managed properly; it can't be right that layout() is not being called.
Thoughts?
Please try this patch:
Success! Well, sort of: Dillo works fine, but test/dw-ui-test is broken. Here's the TextEditor patch anyway. It depends on my previous patch to remove the special behaviour of the <Enter>. Johannes' patch in the previous message is also necessary for things to work.
Now we just have to fix test/dw-ui-test , but I think that's probably a lower priority than completing Dillo's functionality.
Ooops, you are right! There is a problem with my proposed fix. When we call Group::layout (), the Group code starts to reposition / resize the widgets. But we want to control the layout on our own. Please try this instead: diff -r 3d6ba14ceb96 dw/fltkviewport.cc --- a/dw/fltkviewport.cc Tue Dec 18 16:42:42 2007 +0100 +++ b/dw/fltkviewport.cc Tue Dec 18 22:56:50 2007 +0100 @@ -154,6 +154,16 @@ void FltkViewport::layout () { theLayout->viewportSizeChanged (this, w(), h()); adjustScrollbarsAndGadgetsAllocation (); + + for(Iterator <TypedPointer < ::fltk::Widget> > it + = canvasWidgets->iterator (); + it.hasNext (); ) { + ::fltk::Widget *widget = it.getNext()->getTypedValue (); + + if (widget->layout_damage ()) { + widget->layout (); + } + } } Regards, Johannes PS: I start thinking that fltkviewbase should not inherit from Group at all. fltkviewbase hardly uses any functionality from Group anymore.
Regards,
Jeremy Henty
diff -pru -- dw2-ref/dw/fltkui.cc dw2-cur/dw/fltkui.cc --- dw2-ref/dw/fltkui.cc 2007-12-18 17:22:38.000000000 +0000 +++ dw2-cur/dw/fltkui.cc 2007-12-18 17:31:03.000000000 +0000 @@ -30,7 +30,7 @@ #include <fltk/Group.h> #include <fltk/Input.h> #include <fltk/SecretInput.h> -#include <fltk/MultiLineInput.h> +#include <fltk/TextEditor.h> #include <fltk/RadioButton.h> #include <fltk/CheckButton.h> #include <fltk/Choice.h> @@ -533,7 +533,7 @@ FltkMultiLineTextResource::FltkMultiLine FltkSpecificResource <dw::core::ui::MultiLineTextResource> (platform), numCols(cols), numRows(rows) { - initText = NULL; + buffer = new ::fltk::TextBuffer; editable = false;
init (platform); @@ -541,27 +541,18 @@ FltkMultiLineTextResource::FltkMultiLine
FltkMultiLineTextResource::~FltkMultiLineTextResource () { - if (initText) - delete initText; + delete buffer; }
::fltk::Widget *FltkMultiLineTextResource::createNewWidget (core::Allocation *allocation) { - ::fltk::MultiLineInput *input = - new ::fltk::MultiLineInput (allocation->x, allocation->y, - allocation->width, - allocation->ascent + allocation->descent); - - if (viewsAndWidgets->isEmpty ()) { - // First widget created, attach the set text. - if (initText) - input->value (initText); - } else - input->value - (((::fltk::MultiLineInput*)viewsAndWidgets->getFirst()->widget)->value ()); - - return input; + ::fltk::TextEditor *text = + new ::fltk::TextEditor (allocation->x, allocation->y, + allocation->width, + allocation->ascent + allocation->descent); + text->buffer (buffer); + return text; }
void FltkMultiLineTextResource::sizeRequest (core::Requisition *requisition) @@ -586,23 +577,12 @@ void FltkMultiLineTextResource::sizeRequ
const char *FltkMultiLineTextResource::getText () { - if (viewsAndWidgets->isEmpty ()) - return initText; - else - return ((::fltk::MultiLineInput*)viewsAndWidgets->getFirst()->widget)->value (); + return buffer->text (); }
void FltkMultiLineTextResource::setText (const char *text) { - if (initText) - delete initText; - initText = strdup (text); - - for (Iterator <ViewAndWidget> it = viewsAndWidgets->iterator (); - it.hasNext(); ) { - ViewAndWidget *viewAndWidget = it.getNext (); - ((::fltk::MultiLineInput*)viewAndWidget->widget)->value (initText); - } + buffer->text (text); }
bool FltkMultiLineTextResource::isEditable () diff -pru -- dw2-ref/dw/fltkui.hh dw2-cur/dw/fltkui.hh --- dw2-ref/dw/fltkui.hh 2007-12-18 17:22:38.000000000 +0000 +++ dw2-cur/dw/fltkui.hh 2007-12-18 17:26:59.000000000 +0000 @@ -7,6 +7,7 @@
#include <fltk/Button.h> #include <fltk/Menu.h> +#include <fltk/TextBuffer.h>
namespace dw { namespace fltk { @@ -317,7 +318,7 @@ class FltkMultiLineTextResource: public FltkSpecificResource <dw::core::ui::MultiLineTextResource> { private: - const char *initText; + ::fltk::TextBuffer *buffer; bool editable; int numCols, numRows;
_______________________________________________ Dillo-dev mailing list Dillo-dev@dillo.org http://lists.auriga.wearlab.de/cgi-bin/mailman/listinfo/dillo-dev