diff options
81 files changed, 638 insertions, 638 deletions
diff --git a/dpi/downloads.cc b/dpi/downloads.cc index 59df6361..4c7162a7 100644 --- a/dpi/downloads.cc +++ b/dpi/downloads.cc @@ -107,7 +107,7 @@ class DLItem { enum { ST_newline, ST_number, ST_discard, ST_copy }; - + pid_t mPid; int LogPipe[2]; char *shortname, *fullname; @@ -744,7 +744,7 @@ void DLItem::update() /*! SIGCHLD handler */ static void raw_sigchld(int) -{ +{ caught_sigchld = 1; } @@ -976,7 +976,7 @@ void DLWin::add(const char *full_filename, const char *url, DLAction action) } else if (f_pid < 0) { perror("fork, "); exit(1); - } else { + } else { /* father */ dl_win->show(); dl_item->pid(f_pid); @@ -999,7 +999,7 @@ DLAction DLWin::check_filename(char **p_fullname) return DL_NEWFILE; ds = dStr_sized_new(128); - dStr_sprintf(ds, + dStr_sprintf(ds, "The file:\n %s (%d Bytes)\nalready exists. What do we do?", *p_fullname, (int)ss.st_size); ch = fltk::choice(ds->str, "Rename", "Continue", "Abort"); @@ -678,7 +678,7 @@ static int File_get_file(ClientInfo *Client, } File_close(fd); - + return 0; } diff --git a/dpid/dpid.c b/dpid/dpid.c index 2eed0f02..88b827c4 100644 --- a/dpid/dpid.c +++ b/dpid/dpid.c @@ -424,13 +424,13 @@ static int services_alpha_comp(const struct service *s1, return -strcmp(s1->name, s2->name); } -/*! Add services reading a dpidrc file - * each non empty or commented line has the form - * service = path_relative_to_dpidir - * \Return: - * \li Returns number of available services on success - * \li -1 on failure - */ +/*! Add services reading a dpidrc file + * each non empty or commented line has the form + * service = path_relative_to_dpidir + * \Return: + * \li Returns number of available services on success + * \li -1 on failure + */ int fill_services_list(struct dp *attlist, int numdpis, Dlist **services_list) { FILE *dpidrc_stream; @@ -509,7 +509,7 @@ int fill_services_list(struct dp *attlist, int numdpis, Dlist **services_list) s->dp_index = i; dFree(line); } - fclose(dpidrc_stream); + fclose(dpidrc_stream); dList_sort(*services_list, (dCompareFunc)services_alpha_comp); diff --git a/dw/alignedtextblock.cc b/dw/alignedtextblock.cc index a886aed2..66ce5bb6 100644 --- a/dw/alignedtextblock.cc +++ b/dw/alignedtextblock.cc @@ -63,7 +63,7 @@ int AlignedTextblock::CLASS_ID = -1; AlignedTextblock::AlignedTextblock (bool limitTextWidth): Textblock (limitTextWidth) { - registerName ("dw::AlignedTextblock", &CLASS_ID); + registerName ("dw::AlignedTextblock", &CLASS_ID); } void AlignedTextblock::setRefTextblock (AlignedTextblock *ref) @@ -76,7 +76,7 @@ void AlignedTextblock::setRefTextblock (AlignedTextblock *ref) listPos = list->add (this); updateValue (); } - + AlignedTextblock::~AlignedTextblock() { list->unref (listPos); @@ -86,7 +86,7 @@ void AlignedTextblock::updateValue () { if (list) { list->setValue (listPos, getValue ()); - + if (list->getValue (listPos) > list->getMaxValue ()) { // New value greater than current maximum -> apply it to others. list->setMaxValue (list->getValue (listPos)); diff --git a/dw/bullet.cc b/dw/bullet.cc index cc13867c..e3f265eb 100644 --- a/dw/bullet.cc +++ b/dw/bullet.cc @@ -21,7 +21,7 @@ #include "bullet.hh" - + #include <stdio.h> namespace dw { diff --git a/dw/bullet.hh b/dw/bullet.hh index 00912bd8..98854abb 100644 --- a/dw/bullet.hh +++ b/dw/bullet.hh @@ -15,8 +15,8 @@ class Bullet: public core::Widget { protected: void sizeRequestImpl (core::Requisition *requisition); - void draw (core::View *view, core::Rectangle *area); - core::Iterator *iterator (core::Content::Type mask, bool atEnd); + void draw (core::View *view, core::Rectangle *area); + core::Iterator *iterator (core::Content::Type mask, bool atEnd); public: Bullet (); diff --git a/dw/findtext.cc b/dw/findtext.cc index eb7dd2c0..ccc41fad 100644 --- a/dw/findtext.cc +++ b/dw/findtext.cc @@ -75,7 +75,7 @@ FindtextState::Result FindtextState::search (const char *key, bool caseSens, bool wasHighlighted = unhighlight (); bool newKey; - + // If the key (or the widget) changes (including case sensitivity), // the search is started from the beginning. if (this->key == NULL || this->caseSens != caseSens || @@ -89,7 +89,7 @@ FindtextState::Result FindtextState::search (const char *key, bool caseSens, if (nexttab) delete[] nexttab; nexttab = createNexttab (key, caseSens, backwards); - + if (iterator) delete iterator; iterator = new CharIterator (widget); @@ -149,7 +149,7 @@ void FindtextState::resetSearch () if (key) delete key; - key = NULL; + key = NULL; } /* @@ -221,7 +221,7 @@ bool FindtextState::search0 (bool backwards, bool firstTrial) { if (iterator->getChar () == CharIterator::END) return false; - + bool ret = false; const char* searchKey = (backwards) ? rev(key) : key; int j = 0; @@ -246,7 +246,7 @@ bool FindtextState::search0 (bool backwards, bool firstTrial) * If n is negative, we have to move backwards, but if it is * positive, we have to move forward. So, when l>=4, we start moving * the iterator forward. */ - + if (l==1) { iterator->prev(); iterator->prev(); @@ -262,7 +262,7 @@ bool FindtextState::search0 (bool backwards, bool firstTrial) /* Particular case where we can't find the last character */ iterator->next(); } - + do { if (j == -1 || charsEqual (iterator->getChar(),searchKey[j],caseSens)) { j++; @@ -270,7 +270,7 @@ bool FindtextState::search0 (bool backwards, bool firstTrial) } else j = nexttab[j]; } while (nextit && j < l); - + if (j >= l) { if (backwards) { //This is the location of the key diff --git a/dw/findtext.hh b/dw/findtext.hh index 83d22bd3..3a4ab2a7 100644 --- a/dw/findtext.hh +++ b/dw/findtext.hh @@ -48,19 +48,19 @@ private: * dw::core::Findtext::widget */ Widget *widget; - + /** \brief The position from where the next search will start. */ CharIterator *iterator; /** * \brief The position from where the characters are highlighted. - * + * * NULL, when no text is highlighted. */ - CharIterator *hlIterator; - + CharIterator *hlIterator; + static const char* rev(const char* _str); /* Function to reverse a C-string */ - + static int *createNexttab (const char *needle, bool caseSens, bool backwards); bool unhighlight (); bool search0 (bool backwards, bool firstTrial); diff --git a/dw/fltkflatview.cc b/dw/fltkflatview.cc index 7f5f88a6..60727c13 100644 --- a/dw/fltkflatview.cc +++ b/dw/fltkflatview.cc @@ -52,7 +52,7 @@ void FltkFlatView::setCanvasSize (int width, int ascent, int descent) #if 0 FltkWidgetView::setCanvasSize (width, ascent, descent); - + w (width); h (ascent + descent); #endif diff --git a/dw/fltkflatview.hh b/dw/fltkflatview.hh index dee5498f..5106cbdf 100644 --- a/dw/fltkflatview.hh +++ b/dw/fltkflatview.hh @@ -22,7 +22,7 @@ protected: public: FltkFlatView (int x, int y, int w, int h, const char *label = 0); ~FltkFlatView (); - + void setCanvasSize (int width, int ascent, int descent); bool usesViewport (); diff --git a/dw/fltkimgbuf.cc b/dw/fltkimgbuf.cc index 96164674..233a132b 100644 --- a/dw/fltkimgbuf.cc +++ b/dw/fltkimgbuf.cc @@ -123,7 +123,7 @@ inline void FltkImgbuf::scaleRow (int row, const core::byte *data) { int sr1 = scaledY (row); int sr2 = scaledY (row + 1); - + for (int sr = sr1; sr < sr2; sr++) { // Avoid multiple passes. if (copiedRows->get(sr)) continue; @@ -163,7 +163,7 @@ void FltkImgbuf::newScan () if (isRoot()) { for (Iterator<FltkImgbuf> it = scaledBuffers->iterator(); it.hasNext();){ FltkImgbuf *sb = it.getNext (); - sb->copiedRows->clear(); + sb->copiedRows->clear(); } } } @@ -172,7 +172,7 @@ core::Imgbuf* FltkImgbuf::getScaledBuf (int width, int height) { if (!isRoot()) return root->getScaledBuf (width, height); - + if (width == this->width && height == this->height) { ref (); return this; @@ -265,7 +265,7 @@ void FltkImgbuf::unref () bool FltkImgbuf::lastReference () { - return refCount == 1 && + return refCount == 1 && (scaledBuffers == NULL || scaledBuffers->isEmpty ()); } @@ -311,7 +311,7 @@ void FltkImgbuf::draw (::fltk::Widget *target, int xRoot, int yRoot, height = this->height - y; } - // Draw + // Draw ::fltk::Rectangle rect (xRoot + x, yRoot + y, width, height); PixelType ptype = (type == RGBA) ? ::fltk::RGBA : ::fltk::RGB; drawimage(rawdata+bpp*(y*this->width + x),ptype,rect,bpp*this->width); diff --git a/dw/fltkplatform.cc b/dw/fltkplatform.cc index 64229155..229fbcfa 100644 --- a/dw/fltkplatform.cc +++ b/dw/fltkplatform.cc @@ -60,7 +60,7 @@ FltkFont::FltkFont (core::style::FontAttrs *attrs) * means mono, and fltk::TIMES means serif. */ font = HELVETICA->plus (fa); - } + } setfont(font, size); spaceWidth = (int)getwidth(" "); @@ -141,7 +141,7 @@ FltkColor * FltkColor::create (int col) colorsTable->put (color, color); } - return color; + return color; } void FltkView::addFltkWidget (::fltk::Widget *widget, @@ -320,7 +320,7 @@ void FltkPlatform::generalIdle () /* Execute the first function in the list. */ idleFunc = idleQueue->getFirst (); (layout->*(idleFunc->func)) (); - + /* Remove this function. */ idleQueue->removeRef(idleFunc); } diff --git a/dw/fltkplatform.hh b/dw/fltkplatform.hh index 238af582..253f1bbd 100644 --- a/dw/fltkplatform.hh +++ b/dw/fltkplatform.hh @@ -24,7 +24,7 @@ class FltkFont: public core::style::Font public: ::fltk::Font *font; - + static FltkFont *create (core::style::FontAttrs *attrs); }; @@ -119,24 +119,24 @@ public: ~FltkPlatform (); void setLayout (core::Layout *layout); - + void attachView (core::View *view); void detachView (core::View *view); - + int textWidth (core::style::Font *font, const char *text, int len); int nextGlyph (const char *text, int idx); int prevGlyph (const char *text, int idx); float dpiX (); float dpiY (); - + int addIdle (void (core::Layout::*func) ()); void removeIdle (int idleId); - + core::style::Font *createFont (core::style::FontAttrs *attrs, bool tryEverything); core::style::Color *createColor (int color); - + core::Imgbuf *createImgbuf (core::Imgbuf::Type type, int width, int height); void copySelection(const char *text); diff --git a/dw/fltkpreview.cc b/dw/fltkpreview.cc index 3c383638..181ad05e 100644 --- a/dw/fltkpreview.cc +++ b/dw/fltkpreview.cc @@ -288,7 +288,7 @@ int FltkPreviewButton::handle (int event) case RELEASE: window->hideWindow (); return Button::handle (event); - + default: return Button::handle (event); } diff --git a/dw/fltkui.cc b/dw/fltkui.cc index d1a2c074..8c7ebcf3 100644 --- a/dw/fltkui.cc +++ b/dw/fltkui.cc @@ -100,7 +100,7 @@ void FltkResource::attachView (FltkView *view) if (view->usesFltkWidgets ()) { ViewAndWidget *viewAndWidget = new ViewAndWidget(); viewAndWidget->view = view; - + viewAndWidget->widget = createNewWidget (&allocation); viewAndWidget->view->addFltkWidget (viewAndWidget->widget, &allocation); viewsAndWidgets->append (viewAndWidget); @@ -323,7 +323,7 @@ static core::ButtonState getDwButtonState () { int s1 = ::fltk::event_state (); int s2 = (core::ButtonState)0; - + if (s1 & ::fltk::SHIFT) s2 |= core::SHIFT_MASK; if (s1 & ::fltk::CTRL) s2 |= core::CONTROL_MASK; if (s1 & ::fltk::ALT) s2 |= core::META_MASK; @@ -496,7 +496,7 @@ int FltkComplexButtonResource::reliefYThickness () if (!relief) button->box(::fltk::FLAT_BOX); - FltkFlatView *flatView = + FltkFlatView *flatView = new FltkFlatView (allocation->x + reliefXThickness (), allocation->y + reliefYThickness (), allocation->width - 2 * reliefXThickness (), @@ -514,13 +514,13 @@ int FltkComplexButtonResource::reliefYThickness () // ---------------------------------------------------------------------- FltkEntryResource::FltkEntryResource (FltkPlatform *platform, int maxLength, - bool password, const char *label): + bool password, const char *label): FltkSpecificResource <dw::core::ui::EntryResource> (platform) { this->maxLength = maxLength; this->password = password; this->label = label ? strdup(label) : NULL; - + initText = NULL; editable = false; @@ -636,7 +636,7 @@ void FltkEntryResource::setEditable (bool editable) // ---------------------------------------------------------------------- FltkMultiLineTextResource::FltkMultiLineTextResource (FltkPlatform *platform, - int cols, int rows): + int cols, int rows): FltkSpecificResource <dw::core::ui::MultiLineTextResource> (platform) { buffer = new ::fltk::TextBuffer; @@ -726,7 +726,7 @@ void FltkMultiLineTextResource::setEditable (bool editable) template <class I> FltkToggleButtonResource<I>::FltkToggleButtonResource (FltkPlatform *platform, bool activated): - FltkSpecificResource <I> (platform) + FltkSpecificResource <I> (platform) { initActivated = activated; } @@ -815,7 +815,7 @@ FltkCheckButtonResource::~FltkCheckButtonResource () ::fltk::Button *FltkCheckButtonResource::createNewButton (core::Allocation - *allocation) + *allocation) { ::fltk::CheckButton *cb = new ::fltk::CheckButton (allocation->x, allocation->y, allocation->width, @@ -854,7 +854,7 @@ FltkRadioButtonResource::Group::~Group () { delete list; } - + void FltkRadioButtonResource::Group::connect (FltkRadioButtonResource *radioButtonResource) { @@ -915,7 +915,7 @@ void FltkRadioButtonResource::buttonClicked () } ::fltk::Button *FltkRadioButtonResource::createNewButton (core::Allocation - *allocation) + *allocation) { /* * Groups of fltk::RadioButton must be added to one fltk::Group, which is @@ -1104,7 +1104,7 @@ template <class I> void FltkSelectionResource<I>::addItem (const char *str, } } } - + template <class I> void FltkSelectionResource<I>::pushGroup (const char *name, bool enabled) { @@ -1202,7 +1202,7 @@ void FltkOptionMenuResource::sizeRequest (core::Requisition *requisition) requisition->width = 1; requisition->ascent = 1; requisition->descent = 0; - } + } } void FltkOptionMenuResource::addItem (const char *str, @@ -1296,7 +1296,7 @@ void FltkListResource::sizeRequest (core::Requisition *requisition) requisition->width = 1; requisition->ascent = 1; requisition->descent = 0; - } + } } bool FltkListResource::isSelected (int index) diff --git a/dw/fltkui.hh b/dw/fltkui.hh index 77c8a7b0..68cb4923 100644 --- a/dw/fltkui.hh +++ b/dw/fltkui.hh @@ -27,7 +27,7 @@ using namespace lout; * edge [arrowhead="none", arrowtail="empty", labelfontname=Helvetica, * labelfontsize=10, color="#404040", labelfontcolor="#000080"]; * fontname=Helvetica; fontsize=10; - * + * * subgraph cluster_core { * style="dashed"; color="#000080"; fontname=Helvetica; fontsize=10; * label="dw::core::ui"; @@ -79,7 +79,7 @@ using namespace lout; * edge [arrowhead="none", arrowtail="empty", labelfontname=Helvetica, * labelfontsize=10, color="#404040", labelfontcolor="#000080"]; * fontname=Helvetica; fontsize=10; - * + * * subgraph cluster_core { * style="dashed"; color="#000080"; fontname=Helvetica; fontsize=10; * label="dw::core::ui"; @@ -120,7 +120,7 @@ using namespace lout; * edge [arrowhead="none", arrowtail="empty", labelfontname=Helvetica, * labelfontsize=10, color="#404040", labelfontcolor="#000080"]; * fontname=Helvetica; fontsize=10; - * + * * subgraph cluster_core { * style="dashed"; color="#000080"; fontname=Helvetica; fontsize=10; * label="dw::core::ui"; @@ -202,7 +202,7 @@ public: virtual void attachView (FltkView *view); virtual void detachView (FltkView *view); - + void sizeAllocate (core::Allocation *allocation); void draw (core::View *view, core::Rectangle *area); @@ -276,7 +276,7 @@ protected: dw::core::Platform *createPlatform (); void setLayout (dw::core::Layout *layout); - + int reliefXThickness (); int reliefYThickness (); @@ -356,7 +356,7 @@ private: protected: virtual ::fltk::Button *createNewButton (core::Allocation *allocation) = 0; ::fltk::Widget *createNewWidget (core::Allocation *allocation); - + public: FltkToggleButtonResource (FltkPlatform *platform, bool activated); @@ -413,7 +413,7 @@ private: public: Group (FltkRadioButtonResource *radioButtonResource); - + inline container::typed::Iterator <FltkRadioButtonResource> iterator () { return list->iterator (); @@ -496,10 +496,10 @@ public: FltkSelectionResource (FltkPlatform *platform); ~FltkSelectionResource (); - dw::core::Iterator *iterator (dw::core::Content::Type mask, bool atEnd); + dw::core::Iterator *iterator (dw::core::Content::Type mask, bool atEnd); void addItem (const char *str, bool enabled, bool selected); - + void pushGroup (const char *name, bool enabled); void popGroup (); diff --git a/dw/fltkviewbase.cc b/dw/fltkviewbase.cc index ae43b352..14984a3c 100644 --- a/dw/fltkviewbase.cc +++ b/dw/fltkviewbase.cc @@ -115,7 +115,7 @@ void FltkViewBase::draw (const core::Rectangle *rect, translateCanvasXToViewX (rect->x) + offsetX, translateCanvasYToViewY (rect->y) + offsetY, rect->width, rect->height); - + ::fltk::intersect_with_clip (viewRect); viewRect.x (viewRect.x () - offsetX); @@ -135,7 +135,7 @@ void FltkViewBase::draw (const core::Rectangle *rect, backBuffer->setsize (viewRect.w (), viewRect.h ()); backBuffer->make_current (); - translate (-viewRect.x (), -viewRect.y ()); + translate (-viewRect.x (), -viewRect.y ()); setcolor (bgColor); fillrect (viewRect); @@ -177,7 +177,7 @@ core::ButtonState getDwButtonState () { int s1 = event_state (); int s2 = (core::ButtonState)0; - + if (s1 & SHIFT) s2 |= core::SHIFT_MASK; if (s1 & CTRL) s2 |= core::CONTROL_MASK; if (s1 & ALT) s2 |= core::META_MASK; @@ -193,7 +193,7 @@ int FltkViewBase::handle (int event) bool processed; /** - * \todo Consider, whether this from the FLTK documentation has any + * \todo Consider, whether this from the FLTK documentation has any * impacts: "To receive fltk::RELEASE events you must return non-zero * when passed a fltk::PUSH event. " */ @@ -249,7 +249,7 @@ int FltkViewBase::handle (int event) case LEAVE: theLayout->leaveNotify (this, getDwButtonState ()); return Group::handle (event); - + default: return Group::handle (event); } @@ -410,7 +410,7 @@ void FltkViewBase::drawPolygon (core::style::Color *color, fillpath(); else strokepath(); - } + } } core::View *FltkViewBase::getClippingView (int x, int y, int width, int height) @@ -439,7 +439,7 @@ FltkWidgetView::~FltkWidgetView () void FltkWidgetView::layout () { /** - * pass layout to child widgets. This is needed for complex fltk + * pass layout to child widgets. This is needed for complex fltk * widgets as TextEditor. * We can't use Group::layout() as that would rearrange the widgets. */ diff --git a/dw/fltkviewbase.hh b/dw/fltkviewbase.hh index 4c1f98d8..3bdb1666 100644 --- a/dw/fltkviewbase.hh +++ b/dw/fltkviewbase.hh @@ -79,7 +79,7 @@ class FltkWidgetView: public FltkViewBase public: FltkWidgetView (int x, int y, int w, int h, const char *label = 0); ~FltkWidgetView (); - + void layout(); void drawText (core::style::Font *font, diff --git a/dw/fltkviewport.cc b/dw/fltkviewport.cc index 8e3eea71..53b22029 100644 --- a/dw/fltkviewport.cc +++ b/dw/fltkviewport.cc @@ -157,7 +157,7 @@ void FltkViewport::layout () { theLayout->viewportSizeChanged (this, w(), h()); adjustScrollbarsAndGadgetsAllocation (); - + FltkWidgetView::layout (); } @@ -206,8 +206,8 @@ void FltkViewport::draw () } } - scrollDX = 0; - scrollDY = 0; + scrollDX = 0; + scrollDY = 0; } int FltkViewport::handle (int event) @@ -262,12 +262,12 @@ int FltkViewport::handle (int event) case ::fltk:: MOUSEWHEEL: return (event_dx() ? hscrollbar : vscrollbar)->handle(event); break; - + case ::fltk::RELEASE: if (::fltk::event_button() == ::fltk::MiddleButton) { dragScrolling = 0; setCursor (core::style::CURSOR_DEFAULT); - } + } break; case ::fltk::ENTER: @@ -362,7 +362,7 @@ void FltkViewport::positionChanged () /* * For scrollbars, this currently sets the same step to both vertical and * horizontal. It may me differentiated if necessary. - */ + */ void FltkViewport::setScrollStep(int step) { vscrollbar->linesize(step); @@ -443,8 +443,8 @@ void FltkViewport::updateCanvasWidgets (int dx, int dy) // scroll all child widgets except scroll bars for (int i = children () - 1; i > 0; i--) { ::fltk::Widget *widget = child (i); - - if (widget == hscrollbar || widget == vscrollbar) + + if (widget == hscrollbar || widget == vscrollbar) continue; widget->x (widget->x () - dx); diff --git a/dw/fltkviewport.hh b/dw/fltkviewport.hh index 6af377d4..0e53c5be 100644 --- a/dw/fltkviewport.hh +++ b/dw/fltkviewport.hh @@ -26,7 +26,7 @@ private: ::fltk::Scrollbar *vscrollbar, *hscrollbar; GadgetOrientation gadgetOrientation[4]; - container::typed::List <object::TypedPointer < ::fltk::Widget> > *gadgets; + container::typed::List <object::TypedPointer < ::fltk::Widget> > *gadgets; void adjustScrollbarsAndGadgetsAllocation (); void adjustScrollbarValues (); @@ -49,7 +49,7 @@ protected: public: FltkViewport (int x, int y, int w, int h, const char *label = 0); ~FltkViewport (); - + void layout(); void draw (); int handle (int event); diff --git a/dw/image.cc b/dw/image.cc index 82fe7252..091292fc 100644 --- a/dw/image.cc +++ b/dw/image.cc @@ -232,7 +232,7 @@ void Image::enterNotifyImpl (core::EventCrossing *event) } void Image::leaveNotifyImpl (core::EventCrossing *event) -{ +{ clicking = false; if (currLink != -1) { @@ -273,7 +273,7 @@ bool Image::buttonPressImpl (core::EventButton *event) ret = true; } return ret; -} +} bool Image::buttonReleaseImpl (core::EventButton *event) { @@ -314,7 +314,7 @@ void Image::draw (core::View *view, core::Rectangle *area) if (altTextWidth == -1) altTextWidth = layout->textWidth (getStyle()->font, altText, strlen (altText)); - + core::View *clippingView = NULL, *usedView = view; if (allocation.width < altTextWidth || allocation.ascent < getStyle()->font->ascent || @@ -375,7 +375,7 @@ void Image::drawRow (int row) core::Rectangle area; assert (buffer != NULL); - + buffer->getRowArea (row, &area); if (area.width && area.height) queueDrawArea (area.x + getStyle()->boxOffsetX (), diff --git a/dw/image.hh b/dw/image.hh index 37c27e0d..054ba777 100644 --- a/dw/image.hh +++ b/dw/image.hh @@ -38,7 +38,7 @@ private: public: ImageMap (); ~ImageMap (); - + void add (core::Shape *shape, int link); void setDefaultLink (int link) { defaultLink = link; }; int link (int x, int y); @@ -47,7 +47,7 @@ private: lout::container::typed::HashTable <lout::object::Object, ImageMap> *imageMaps; ImageMap *currentMap; - + public: ImageMapsList (); ~ImageMapsList (); @@ -90,7 +90,7 @@ public: * dw::ImageMapsList::addShapeToCurrentMap adds a shape to the current * map. The \em link argument is a number, which is later passed to * the dw::core::Widget::LinkReceiver. - * + * * This map list is then, together with the key for the image, passed to * dw::Image::setUseMap. For HTML, a URL with the value of the "ismap" * attribute of \<IMG\> should be used. @@ -103,9 +103,9 @@ public: * Currently, only maps defined in the same document as the image may be * used, since the dw::ImageMapsList is stored in the HTML link block, and * contains only the image maps defined in the document. - * + * * <h4>Server Side %Image Maps</h4> - * + * * To use images for server side image maps, you must call * dw::Image::setIsMap, and the dw::Image::style must contain a valid link * (dw::core::style::Style::x_link). After this, motions and clicks are @@ -129,7 +129,7 @@ protected: void sizeRequestImpl (core::Requisition *requisition); void sizeAllocateImpl (core::Allocation *allocation); - void draw (core::View *view, core::Rectangle *area); + void draw (core::View *view, core::Rectangle *area); bool buttonPressImpl (core::EventButton *event); bool buttonReleaseImpl (core::EventButton *event); @@ -137,7 +137,7 @@ protected: void leaveNotifyImpl (core::EventCrossing *event); bool motionNotifyImpl (core::EventMotion *event); - //core::Iterator *iterator (Content::Type mask, bool atEnd); + //core::Iterator *iterator (Content::Type mask, bool atEnd); public: static int CLASS_ID; @@ -145,7 +145,7 @@ public: Image(const char *altText); ~Image(); - core::Iterator *iterator (core::Content::Type mask, bool atEnd); + core::Iterator *iterator (core::Content::Type mask, bool atEnd); inline core::Imgbuf *getBuffer () { return buffer; } void setBuffer (core::Imgbuf *buffer, bool resize = false); diff --git a/dw/imgbuf.hh b/dw/imgbuf.hh index 8948bbef..43320aeb 100644 --- a/dw/imgbuf.hh +++ b/dw/imgbuf.hh @@ -53,16 +53,16 @@ using namespace lout; * * * <h3>Scaling</h3> - * + * * The buffer with the original size, which was created by * dw::core::Platform::createImgbuf, is called root buffer. Imgbuf provides * the ability to scale buffers. Generally, both root buffers, as well as * scaled buffers, may be shared, memory management is done by reference * counters. - * + * * Via dw::core::Imgbuf::getScaledBuf, you can retrieve a scaled buffer. * Generally, something like this must work always, in an efficient way: - * + * * \code * dw::core::Imgbuf *curBuf, *oldBuf; * int width, heigt, @@ -71,15 +71,15 @@ using namespace lout; * curBuf = oldBuf->getScaledBuf(oldBuf, width, height); * oldBuf->unref(); * \endcode - * + * * \em oldBuf may both be a root buffer, or a scaled buffer. - * + * * The root buffer keeps a list of all children, and all methods * operating on the image data (dw::core::Imgbuf::copyRow and * dw::core::Imgbuf::setCMap) are delegated to the scaled buffers, when * processed, and inherited, when a new scaled buffer is created. This * means, that they must only be performed for the root buffer. - * + * * A possible implementation could be (dw::fltk::FltkImgbuf does it this way): * * <ul> @@ -92,7 +92,7 @@ using namespace lout; * <li> Otherwise, if this buffer has already been scaled to the given * size, return this scaled buffer, with an increased reference * counter. - * + * * <li> Otherwise, return a new scaled buffer with reference counter 1. * </ul> * @@ -120,7 +120,7 @@ using namespace lout; * \code * dw::fltk::FltkPlatform *platform = new dw::fltk::FltkPlatform (); * dw::core::Layout *layout = new dw::core::Layout (platform); - * + * * dw::core::Imgbuf *rootbuf = * layout->createImgbuf (dw::core::Imgbuf::RGB, 100, 100); * dw::core::Imgbuf *scaledbuf = rootbuf->getScaledBuf (50, 50); @@ -133,12 +133,12 @@ using namespace lout; * the scaled buffer, it is deleted, and after it, the root buffer. * * <h3>Drawing</h3> - * + * * dw::core::Imgbuf provides no methods for drawing, instead, this is * done by the views (implementation of dw::core::View). * * There are two situations, when drawing is necessary: - * + * * <ol> * <li> To react on expose events, the function dw::core::View::drawImage * should be used, with the following parameters: @@ -149,7 +149,7 @@ using namespace lout; * <li> the region within the image, which should be displayed (\em x, * \em y, \em width, \em height). * </ul> - * + * * <li> When a row has been copied, it has to be drawn. To determine the * area, which has to be drawn, the dw::core::Imgbuf::getRowArea * should be used. The result can then passed diff --git a/dw/iterator.cc b/dw/iterator.cc index 41c2c444..f9ecc750 100644 --- a/dw/iterator.cc +++ b/dw/iterator.cc @@ -159,7 +159,7 @@ void Iterator::scrollTo (Iterator *it1, Iterator *it2, int start, int end, // |----------| // width // - + /** \todo Changes in the viewport size, until the idle function is * called, are not regarded. */ @@ -468,7 +468,7 @@ DeepIterator::DeepIterator (Iterator *it) // since an DeepIterator should never return widgets. if (it->getContent()->type == Content::WIDGET) { Iterator *it2; - + // The second argument of searchDownward is actually a matter of // taste :-) if ((it2 = searchDownward (it, mask, false)) || @@ -484,7 +484,7 @@ DeepIterator::DeepIterator (Iterator *it) hasContents = false; } } - + //DEBUG_MSG (1, " => %s\n", a_Dw_iterator_text (it)); if (hasContents) { @@ -509,7 +509,7 @@ DeepIterator::DeepIterator (Iterator *it) break; } } - + stack.put (it, thisLevel); content = *(it->getContent()); } @@ -552,10 +552,10 @@ int DeepIterator::compareTo (misc::Comparable *other) while (stack.get(level)->getWidget () != otherDeepIterator->stack.get(level)->getWidget ()) level--; - + return stack.get(level)->compareTo (otherDeepIterator->stack.get(level)); } - + DeepIterator *DeepIterator::createVariant(Iterator *it) { /** \todo Not yet implemented, and actually not yet needed very much. */ @@ -574,7 +574,7 @@ bool DeepIterator::isEmpty () { bool DeepIterator::next () { Iterator *it = stack.getTop (); - + if (it->next ()) { if (it->getContent()->type == Content::WIDGET) { // Widget: new iterator on stack, to search in this widget. @@ -596,7 +596,7 @@ bool DeepIterator::next () content.type = Content::END; return false; } - } + } } /** @@ -607,7 +607,7 @@ bool DeepIterator::next () bool DeepIterator::prev () { Iterator *it = stack.getTop (); - + if (it->prev ()) { if (it->getContent()->type == Content::WIDGET) { // Widget: new iterator on stack, to search in this widget. @@ -629,7 +629,7 @@ bool DeepIterator::prev () content.type = Content::START; return false; } - } + } } // ----------------- @@ -708,9 +708,9 @@ bool CharIterator::next () return next (); } } - + return true; - } + } } bool CharIterator::prev () @@ -746,7 +746,7 @@ bool CharIterator::prev () pos--; ch = it->getContent()->text[pos]; return true; - } + } } void CharIterator::highlight (CharIterator *it1, CharIterator *it2, diff --git a/dw/iterator.hh b/dw/iterator.hh index 605217ec..1d4c2f98 100644 --- a/dw/iterator.hh +++ b/dw/iterator.hh @@ -65,7 +65,7 @@ public: /** * \brief Shrink highlighted region to no longer contain the * current content. - * + * * The direction parameter indicates whether the highlighted region should be * reduced from the start (direction > 0) or from the end (direction < 0). * If direction is 0 all content is unhighlighted. @@ -80,7 +80,7 @@ public: * DwIterator::highlight(). */ virtual void getAllocation (int start, int end, Allocation *allocation) = 0; - + inline Iterator *cloneIterator () { return (Iterator*)clone(); } static void scrollTo (Iterator *it1, Iterator *it2, int start, int end, @@ -96,10 +96,10 @@ class EmptyIterator: public Iterator { private: EmptyIterator (EmptyIterator &it); - + public: EmptyIterator (Widget *widget, Content::Type mask, bool atEnd); - + object::Object *clone(); int compareTo(misc::Comparable *other); bool next (); @@ -119,13 +119,13 @@ class TextIterator: public Iterator private: /** May be NULL, in this case, the next is skipped. */ const char *text; - + TextIterator (TextIterator &it); - + public: TextIterator (Widget *widget, Content::Type mask, bool atEnd, const char *text); - + int compareTo(misc::Comparable *other); bool next (); @@ -168,14 +168,14 @@ private: inline DeepIterator () { } -public: +public: DeepIterator(Iterator *it); ~DeepIterator(); object::Object *clone (); DeepIterator *createVariant(Iterator *it); - inline Iterator *getTopIterator () { return stack.getTop(); } + inline Iterator *getTopIterator () { return stack.getTop(); } inline Content *getContent () { return &content; } bool isEmpty (); @@ -188,7 +188,7 @@ public: /** * \brief Highlight a part of the current content. * - * Unhighlight the current content by passing -1 as start (see also + * Unhighlight the current content by passing -1 as start (see also * (dw::core::Iterator::unhighlight). For text, start and end define the * characters, otherwise, the shape is defined as [0, 1], i.e. for * highlighting a whole dw::core::Content, pass 0 and >= 1. diff --git a/dw/layout.cc b/dw/layout.cc index e7d7d913..c9856d58 100644 --- a/dw/layout.cc +++ b/dw/layout.cc @@ -55,7 +55,7 @@ bool Layout::Emitter::emitToReceiver (lout::signal::Receiver *receiver, misc::assertNotReached (); } - return false; + return false; } void Layout::Emitter::emitCanvasSizeChanged (int width, @@ -88,7 +88,7 @@ Layout::Layout (Platform *platform) cursor = style::CURSOR_DEFAULT; canvasWidth = canvasAscent = canvasDescent = 0; - + usesViewport = false; scrollX = scrollY = 0; viewportWidth = viewportHeight = 0; @@ -250,7 +250,7 @@ void Layout::detachView (View *view) } /** - * \brief Scrolls all viewports, so that the region [x, y, width, height] + * \brief Scrolls all viewports, so that the region [x, y, width, height] * is seen, according to hpos and vpos. */ void Layout::scrollTo (HPosition hpos, VPosition vpos, @@ -273,12 +273,12 @@ void Layout::scrollTo0 (HPosition hpos, VPosition vpos, scrollTargetY = y; scrollTargetWidth = width; scrollTargetHeight = height; - + if (scrollIdleId == -1) { scrollIdleId = platform->addIdle (&Layout::scrollIdle); scrollIdleNotInterrupted = true; } - + scrollIdleNotInterrupted = scrollIdleNotInterrupted || !scrollingInterrupted; } @@ -452,7 +452,7 @@ char *Layout::addAnchor (Widget *widget, const char* name, int y) void Layout::changeAnchor (Widget *widget, char* name, int y) { - String key (name); + String key (name); Anchor *anchor = anchorsTable->get (&key); assert (anchor); assert (anchor->widget == widget); @@ -490,7 +490,7 @@ void Layout::setCursor (style::Cursor cursor) { if (cursor != this->cursor) { this->cursor = cursor; - + for (typed::Iterator <View> it = views->iterator (); it.hasNext (); ) { View *view = it.getNext (); view->setCursor (cursor); @@ -566,7 +566,7 @@ void Layout::resizeIdle () (canvasAscent + canvasDescent > viewportHeight) ? vScrollbarThickness : 0; - if (!canvasHeightGreater && + if (!canvasHeightGreater && canvasAscent + canvasDescent > viewportHeight - actualHScrollbarThickness) { canvasHeightGreater = true; @@ -594,7 +594,7 @@ void Layout::resizeIdle () } void Layout::setSizeHints () -{ +{ if (topLevel) { topLevel->setWidth (viewportWidth - (canvasHeightGreater ? vScrollbarThickness : 0)); @@ -625,15 +625,15 @@ void Layout::queueDrawExcept (int x, int y, int width, int height, if (x == ex && y == ey && width == ewidth && height == eheight) return; - + // queueDraw() the four rectangles within rectangle (x, y, width, height) // around rectangle (ex, ey, ewidth, eheight). // Some or all of these may be empty. - // upper left corner of the intersection rectangle + // upper left corner of the intersection rectangle int ix1 = misc::max (x, ex); int iy1 = misc::max (y, ey); - // lower right corner of the intersection rectangle + // lower right corner of the intersection rectangle int ix2 = misc::min (x + width, ex + ewidth); int iy2 = misc::min (y + height, ey + eheight); @@ -661,10 +661,10 @@ void Layout::queueResize () bool Layout::buttonEvent (ButtonEventType type, View *view, int numPressed, int x, int y, ButtonState state, int button) - + { EventButton event; - + moveToWidgetAtPoint (x, y, state); event.xCanvas = x; @@ -672,7 +672,7 @@ bool Layout::buttonEvent (ButtonEventType type, View *view, int numPressed, event.state = state; event.button = button; event.numPressed = numPressed; - + return processMouseEvent (&event, type, true); } @@ -685,13 +685,13 @@ bool Layout::buttonEvent (ButtonEventType type, View *view, int numPressed, bool Layout::motionNotify (View *view, int x, int y, ButtonState state) { EventButton event; - + moveToWidgetAtPoint (x, y, state); event.xCanvas = x; event.yCanvas = y; event.state = state; - + return processMouseEvent (&event, MOTION_NOTIFY, true); } @@ -763,7 +763,7 @@ void Layout::moveToWidget (Widget *newWidgetAtPoint, ButtonState state) EventCrossing crossingEvent; if (newWidgetAtPoint != widgetAtPoint) { - // The mouse pointer has been moved into another widget. + // The mouse pointer has been moved into another widget. if (newWidgetAtPoint && widgetAtPoint) ancestor = newWidgetAtPoint->getNearestCommonAncestor (widgetAtPoint); @@ -803,13 +803,13 @@ void Layout::moveToWidget (Widget *newWidgetAtPoint, ButtonState state) crossingEvent.state = state; crossingEvent.currentWidget = widgetAtPoint; // ??? crossingEvent.lastWidget = widgetAtPoint; // ??? - + if (i != 0) track[i]->enterNotify (&crossingEvent); if (i != trackLen - 1) track[i]->leaveNotify (&crossingEvent); } - + delete[] track; widgetAtPoint = newWidgetAtPoint; @@ -862,7 +862,7 @@ void Layout::scrollPosChanged (View *view, int x, int y) if (x != scrollX || y != scrollY) { scrollX = x; scrollY = y; - + // Tell all views about the scrolling position, except the caller. for (container::typed::Iterator <View> it = views->iterator (); it.hasNext (); ) { diff --git a/dw/layout.hh b/dw/layout.hh index b66d653f..a4214220 100644 --- a/dw/layout.hh +++ b/dw/layout.hh @@ -70,7 +70,7 @@ private: int scrollX, scrollY, viewportWidth, viewportHeight; bool canvasHeightGreater; int hScrollbarThickness, vScrollbarThickness; - + HPosition scrollTargetHpos; VPosition scrollTargetVpos; int scrollTargetX, scrollTargetY, scrollTargetWidth, scrollTargetHeight; @@ -136,13 +136,13 @@ private: int ex, int ey, int ewidth, int eheight); void queueResize (); void removeWidget (); - + public: Layout (Platform *platform); ~Layout (); misc::ZoneAllocator *textZone; - + void addWidget (Widget *widget); void setWidget (Widget *widget); @@ -168,7 +168,7 @@ public: /** * \brief This function is called by a view, to delegate a button press * event. - * + * * \em numPressed is 1 for simple presses, 2 for double presses etc. (more * that 2 is never needed), \em x and \em y the world coordinates, and * \em button the number of the button pressed. diff --git a/dw/listitem.cc b/dw/listitem.cc index c31690a5..6e574518 100644 --- a/dw/listitem.cc +++ b/dw/listitem.cc @@ -49,7 +49,7 @@ void ListItem::initWithWidget (core::Widget *widget, void ListItem::initWithText (const char *text, core::style::Style *style) { addText (text, style); - addSpace (style); + addSpace (style); updateValue (); } diff --git a/dw/platform.hh b/dw/platform.hh index 156a602a..e1aec83c 100644 --- a/dw/platform.hh +++ b/dw/platform.hh @@ -27,7 +27,7 @@ public: * a layout. */ virtual void setLayout (Layout *layout) = 0; - + /* * ------------------------- * Operations on views @@ -45,7 +45,7 @@ public: * from the related layout. */ virtual void detachView (View *view) = 0; - + /* * ----------------------------------- * Platform dependant properties @@ -76,7 +76,7 @@ public: * \brief Return screen resolution in y-direction. */ virtual float dpiY () = 0; - + /* * --------------------------------------------------------- * These are to encapsulate some platform dependencies @@ -85,7 +85,7 @@ public: /** * \brief Add an idle function. - * + * * An idle function is called once, when no other * tasks are to be done (e.g. there are no events to process), and then * removed from the queue. The return value is a number, which can be @@ -118,7 +118,7 @@ public: */ virtual style::Font *createFont (style::FontAttrs *attrs, bool tryEverything) = 0; - + /** * \brief Create a color resource for a given 0xrrggbb value. */ diff --git a/dw/ruler.cc b/dw/ruler.cc index abefa1bf..d47ddd68 100644 --- a/dw/ruler.cc +++ b/dw/ruler.cc @@ -22,7 +22,7 @@ #include "ruler.hh" #include "../lout/misc.hh" - + #include <stdio.h> namespace dw { diff --git a/dw/ruler.hh b/dw/ruler.hh index a1ae67ea..32e859a1 100644 --- a/dw/ruler.hh +++ b/dw/ruler.hh @@ -17,12 +17,12 @@ class Ruler: public core::Widget { protected: void sizeRequestImpl (core::Requisition *requisition); - void draw (core::View *view, core::Rectangle *area); + void draw (core::View *view, core::Rectangle *area); public: Ruler (); - core::Iterator *iterator (core::Content::Type mask, bool atEnd); + core::Iterator *iterator (core::Content::Type mask, bool atEnd); }; } // namespace dw diff --git a/dw/selection.cc b/dw/selection.cc index 3153576f..7fb25e21 100644 --- a/dw/selection.cc +++ b/dw/selection.cc @@ -95,13 +95,13 @@ void SelectionState::resetLink () link = NULL; linkState = LINK_NONE; } - + bool SelectionState::buttonPress (Iterator *it, int charPos, int linkNo, EventButton *event, bool withinContent) { Widget *itWidget = it->getWidget (); bool ret = false; - + if (event && event->button == 1 && !withinContent && event->numPressed == 2) { // When the user double-clicks on empty parts, emit the double click diff --git a/dw/selection.hh b/dw/selection.hh index 9cc8d25f..5aa9dc48 100644 --- a/dw/selection.hh +++ b/dw/selection.hh @@ -15,23 +15,23 @@ using namespace lout; * which is closely related. * * <h3>General Overview</h3> - * + * * dw::core::SelectionState is associated with dw::core::Layout. The selection * state is controlled by "abstract events", which are sent by single * widgets by calling one of the following methods: - * + * * <ul> * <li> dw::core::SelectionState::buttonPress for button press events, * <li> dw::core::SelectionState::buttonRelease for button release events, and * <li> dw::core::SelectionState::buttonMotion for motion events (with pressed * mouse button). * </ul> - * + * * The widget must construct simple iterators (dw::core::Iterator), which will * be transferred to deep iterators (dw::core::DeepIterator), see below for * more details. All event handling methods have the same signature, the * arguments in detail are: - * + * * <table> * <tr><td>dw::core::Iterator *it <td>the iterator pointing on the item * under the mouse pointer; this @@ -64,26 +64,26 @@ using namespace lout; * simple iterator is discarded and instead the stack has an iterator * pointing to text at the top. As a result, only the first letter of the * ALT text would be copied. - * + * * To avoid this problem, widgets should in this case pass * dw::core::SelectionState::END_OF_WORD as \em charPos, which is then * automatically reduced to the actual length of the deep(!) iterator. - * + * * The return value is the same as in DwWidget event handling methods. * I.e., in most cases, they should simply return it. The events * dw::core::Widget::LinkReceiver::press, - * dw::core::Widget::LinkReceiver::release and + * dw::core::Widget::LinkReceiver::release and * dw::core::Widget::LinkReceiver::click (but not * dw::core::Widget::LinkReceiver::enter) are emitted by these methods, so * that widgets which let dw::core::SelectionState handle links, should only * emit dw::core::Widget::LinkReceiver::enter for themselves. - * + * * <h3>Selection State</h3> - * + * * Selection interferes with handling the activation of links, so the * latter is also handled by the dw::core::SelectionState. Details are based on * following guidelines: - * + * * <ol> * <li> It should be simple to select links and to start selection in * links. The rule to distinguish between link activation and @@ -91,18 +91,18 @@ using namespace lout; * the link. (This is, IMO, a useful feature. Even after drag and * drop has been implemented in dillo, this should be somehow * preserved.) - * + * * <li> The selection should stay as long as possible, i.e., the old * selection is only cleared when a new selection is started. * </ol> - * + * * The latter leads to a model with two states: the selection state and * the link handling state. - * + * * The general selection works, for events not pointing on links, like * this (numbers in parantheses after the event denote the button, "n" * means arbitrary button): - * + * * \dot * digraph G { * node [shape=ellipse, fontname=Helvetica, fontsize=10]; @@ -122,15 +122,15 @@ using namespace lout; * q -> SELECTED [label="yes"]; * q -> NONE [label="no"]; * SELECTED -> SELECTING [label="press(1)"]; - * + * * } * \enddot * * The selected region is represented by two instances of * dw::core::DeepIterator. - * + * * Links are handled by a different state machine: - * + * * \dot * digraph G { * node [shape=ellipse, fontname=Helvetica, fontsize=10]; @@ -170,16 +170,16 @@ using namespace lout; * eventually be SELECTED/SELECTING, with the original and the current * position making up the selection region. This happens for button 1, * events with buttons other than 1 do not affect selection at all. - * - * + * + * * \todo dw::core::SelectionState::buttonMotion currently always assumes * that button 1 has been pressed (since otherwise it would not do * anything). This should be made a bit cleaner. - * + * * \todo The selection should be cleared, when the user selects something * somewhere else (perhaps switched into "non-active" mode, as e.g. Gtk+ * does). - * + * */ class SelectionState { @@ -248,15 +248,15 @@ private: public: enum EventType { BUTTON_PRESS, BUTTON_RELEASE, BUTTON_MOTION }; - + SelectionState (); ~SelectionState (); - + inline void setLayout (Layout *layout) { this->layout = layout; } void reset (); inline void connectDoubleClick (DoubleClickReceiver *receiver) { doubleClickEmitter.connectDoubleClick (receiver); } - + bool buttonPress (Iterator *it, int charPos, int linkNo, EventButton *event, bool withinContent); bool buttonRelease (Iterator *it, int charPos, int linkNo, diff --git a/dw/style.cc b/dw/style.cc index 6cb93ef9..66b37c7b 100644 --- a/dw/style.cc +++ b/dw/style.cc @@ -150,7 +150,7 @@ int StyleAttrs::hashValue () { width + height + margin.hashValue () + - borderWidth.hashValue () + + borderWidth.hashValue () + padding.hashValue () + (intptr_t) borderColor.top + (intptr_t) borderColor.right + @@ -217,7 +217,7 @@ Style::~Style () x_tooltip->unref(); styleTable->remove (this); - totalRef--; + totalRef--; } void Style::copyAttrs (StyleAttrs *attrs) @@ -403,7 +403,7 @@ int Color::shadeColor (int color, Shading shading) } } - + Color *Color::create (Layout *layout, int col) { ColorAttrs attrs(col); diff --git a/dw/style.hh b/dw/style.hh index e8897b36..8d0b9df7 100644 --- a/dw/style.hh +++ b/dw/style.hh @@ -14,100 +14,100 @@ namespace core { * \brief Anything related to Dillo %Widget styles is defined here. * * <h3>Overview</h3> - * + * * dw::core::style::Style provides some resources and attributes for * drawing widgets, as well as for parts of a widget (e.g., dw::Textblock * uses styles for its words). Creating a style is done by filling a * dw::core::style::StyleAttrs with the attributes and calling * dw::core::style::Style::create: - * + * * \code * dw::core::style::Style styleAttrs; * dw::core::style::Style *style; * dw::core::Layout *layout; - * + * * // ... - * + * * styleAttrs.foo = bar; * // etc. * style = dw::core::style::Style::create (&styleAttrs, layout); * // do something with style * \endcode - * + * * After this, the attributes of a dw::core::style::Style should not be * changed anymore, since styles are often shared between different * widgets etc. (see below). Most times, you simply copy the attributes * of another style (possible, since dw::core::style::Style is a sub * class of dw::core::style::StyleAttrs), modify them and create a new * style: - * + * * \code * styleAttrs = *anotherStyle; * styleAttrs.foo = baz; * style = dw::core::style::Style::create (&styleAttrs, layout); * \endcode - * + * * The dw::core::style::Font structure can be created by * dw::core::style::Font::create, in a similar, with * dw::core::style::FontAttrs, and colors by * dw::core::style::Color::create, passing 0xrrggbb as an * argument. Furthermore, there is dw::core::style::Tooltip, created by * dw::core::style::Tooltip::create. - * + * * Notice that fonts, colors and tooltips are only intended to be used in * conjunction with dw::core::style::Style. - * - * + * + * * <h3>Naming</h3> - * + * * dw::core::style::Style will become important for CSS, each CSS * attribute, which is supported by dillo, will refer to an attribute in * dw::core::style::Style. For this reason, the attributes in * dw::core::style::Style get the names from the CSS attributes, with * "camelCase" instead of hythens (e.g. "background-color" becomes * "backgroundColor"). - * + * * However, dw::core::style::Style will be extended by some more * attributes, which are not defined by CSS. To distinguish them, they * get the prefix "x_", e.g. dw::core::style::Style::x_link. - * - * + * + * * <h3>Lengths and Percentages</h3> - * + * * dw::core::style::Length is a simple data type for lengths and * percentages: - * + * * <ul> * <li> A length refers to an absolute measurement. It is used to * represent the HTML type %Pixels; and the CSS type \<length\>. - * + * * For CSS lenghts, there are two units: (i) pixels and absolute * units, which have to be converted to pixels (a pixel is, unlike * in the CSS specification, treated as absolute unit), and (ii) the * relative units "em" and "ex" (see below). - * + * * <li> A percentage refers to a value relative to another value. It is * used for the HTML type %Length; (except %Pixels;), and the CSS * type \<percentage\>. - * + * * <li> A relative length can be used in lists of HTML MultiLengths. * </ul> - * + * * Since many values in CSS may be either lengths or percentages, a * single type is very useful. - * + * * <h4>Useful Functions</h4> - * + * * Creating lengths: - * + * * <ul> * <li> dw::core::style::createAbsLength * <li> dw::core::style::createPerLength * <li> dw::core::style::createRelLength * </ul> - * + * * Examine lengths: - * + * * <ul> * <li> dw::core::style::isAbsLength * <li> dw::core::style::isPerLength @@ -116,61 +116,61 @@ namespace core { * <li> dw::core::style::perLengthVal * <li> dw::core::style::relLengthVal * </ul> - * - * + * + * * <h3>Boxes</h3> - * + * * <h4>The CSS %Box Model</h4> - * + * * For borders, margins etc., the box model defined by CSS2 is * used. dw::core::style::Style contains some members defining these * attributes. A dw::core::Widget must use these values for any * calculation of sizes. There are some helper functions (see * dw/style.hh). A dw::core::style::Style box looks quite similar to a * CSS box: - * + * * \image html dw-style-box-model.png - * + * * <h4>Background colors</h4> - * + * * The background color is stored in * dw::core::style::Style::backgroundColor, which may be NULL (the * background color of the parent widget is shining through). - * + * * For toplevel widgets, this color is set as the background color of the * views (dw::core::View::setBgColor), for other widgets, a filled * rectangle is drawn, covering the content and padding. (This is * compliant with CSS2, the background color of the toplevel element * covers the whole canvas.) - * + * * <h4>Drawing</h4> - * + * * The following methods may be useful: - * + * * <ul> * <li> dw::core::Widget::drawWidgetBox for drawing the box of a widget * (typically at the beginning of the implementation of * dw::core::Widget::draw), and - * + * * <li> dw::core::Widget::drawBox, for drawing parts of a widget (e.g. * dw::Textblock::Word, which has its own dw::Textblock::Word::style). * </ul> - * - * + * + * * <h3>Notes on Memory Management</h3> - * + * * Memory management is done by reference counting, * dw::core::style::Style::create returns a pointer to * dw::core::style::Style with an increased reference counter, so you * should care about calling dw::core::style::Style::unref if it is not * used anymore. You do \em not need to care about the reference counters * of fonts and styles. - * + * * In detail: - * + * * <ul> * <li> dw::core::style::Style::ref is called in - * + * * <ul> * <li> dw::core::Widget::setStyle to assign a style to a widget, * <li> dw::Textblock::addText, dw::Textblock::addWidget, @@ -179,9 +179,9 @@ namespace core { * to assign a style to a dw::Textblock::Word, and * <li> by the HTML parser, when pushing an element on the stack. * </ul> - * + * * <li> dw::core::style::Style::unref is called in - * + * * <ul> * <li> dw::core::Widget::~Widget, dw::Textblock::~Textblock, by the * HTML parser, when popping an element fom the stack, and @@ -319,15 +319,15 @@ enum WhiteSpace { * This is an implementation detail, use one of the following functions: * * Creating lengths: - * + * * <ul> * <li> dw::core::style::createAbsLength * <li> dw::core::style::createPerLength * <li> dw::core::style::createRelLength * </ul> - * + * * Examine lengths: - * + * * <ul> * <li> dw::core::style::isAbsLength * <li> dw::core::style::isPerLength @@ -433,7 +433,7 @@ public: int x_link; int x_img; Tooltip *x_tooltip; - + void initValues (); void resetValues (); diff --git a/dw/table.cc b/dw/table.cc index b5e6f192..8c05cbc0 100644 --- a/dw/table.cc +++ b/dw/table.cc @@ -114,7 +114,7 @@ void Table::sizeRequestImpl (core::Requisition *requisition) getStyle()->boxDiffHeight () + cumHeight->get (numRows) + getStyle()->vBorderSpacing; requisition->descent = 0; - + } void Table::getExtremesImpl (core::Extremes *extremes) @@ -171,14 +171,14 @@ void Table::sizeAllocateImpl (core::Allocation *allocation) core::Allocation childAllocation; core::Requisition childRequisition; - + children->get(n)->cell.widget->sizeRequest (&childRequisition); childAllocation.x = x; childAllocation.y = cumHeight->get (row) + offy; childAllocation.width = width; childAllocation.ascent = childRequisition.ascent; - childAllocation.descent = + childAllocation.descent = cumHeight->get (row + children->get(n)->cell.rowspan) - cumHeight->get (row) - getStyle()->vBorderSpacing - childRequisition.ascent; @@ -187,7 +187,7 @@ void Table::sizeAllocateImpl (core::Allocation *allocation) } x += colWidths->get (col) + getStyle()->hBorderSpacing; - } + } } void Table::resizeDrawImpl () @@ -199,7 +199,7 @@ void Table::resizeDrawImpl () } void Table::setWidth (int width) -{ +{ // If limitTextWidth is set, a queueResize may also be necessary. if (availWidth != width || limitTextWidth) { _MSG(" Table::setWidth %d\n", width); @@ -255,7 +255,7 @@ void Table::draw (core::View *view, core::Rectangle *area) } } } - + void Table::removeChild (Widget *child) { /** \bug Not implemented. */ @@ -333,7 +333,7 @@ void Table::addCell (Widget *widget, int colspan, int rowspan) child->cell.colspanEff = colspanEff; child->cell.rowspan = rowspan; children->set (curRow * numCols + curCol, child); - + curCol += colspanEff; widget->setParent (this); @@ -454,7 +454,7 @@ void Table::reallocChildren (int newNumCols, int newNumRows) for (int row = numRows; row < newNumRows; row++) for (int col = 0; col < newNumCols; col++) children->set (row * newNumCols + col, NULL); - + // Simple arrays. rowStyle->setSize (newNumRows); for (int row = numRows; row < newNumRows; row++) @@ -481,7 +481,7 @@ void Table::forceCalcCellSizes () // Will also call calcColumnExtremes(), when needed. getExtremes (&extremes); - + if (core::style::isAbsLength (getStyle()->width)) { totalWidth = core::style::absLengthVal (getStyle()->width); } else if (core::style::isPerLength (getStyle()->width)) { @@ -1106,7 +1106,7 @@ int Table::TableIterator::compareTo(misc::Comparable *other) { return index - ((TableIterator*)other)->index; } - + bool Table::TableIterator::next () { Table *table = (Table*)getWidget(); @@ -1119,7 +1119,7 @@ bool Table::TableIterator::next () content.type = core::Content::END; return false; } - + do { index++; if (index >= table->children->size ()) { @@ -1146,7 +1146,7 @@ bool Table::TableIterator::prev () content.type = core::Content::START; return false; } - + do { index--; if (index < 0) { diff --git a/dw/table.hh b/dw/table.hh index ec2bacc8..73d362e5 100644 --- a/dw/table.hh +++ b/dw/table.hh @@ -11,22 +11,22 @@ namespace dw { * \brief A Widget for rendering tables. * * <h3>Introduction</h3> - * + * * The dw::Table widget is used to render HTML tables. - * + * * Each cell is itself an own widget. Any widget may be used, however, in * dillo, only instances of dw::Textblock and dw::TableCell are used as * children of dw::Table. - * - * + * + * * <h3>Sizes</h3> - * + * * <h4>General</h4> - * + * * The following diagram shows the dependencies between the different * functions, which are related to size calculation. Click on the boxes * for more informations. - * + * * \dot * digraph G { * node [shape=record, fontname=Helvetica, fontsize=10, color="#c0c0c0"]; @@ -34,125 +34,125 @@ namespace dw { * labelfontsize=10, color="#404040", labelfontcolor="#000080", * fontname=Helvetica, fontsize=10]; * fontname=Helvetica; fontsize=10; - * + * * sizeRequestImpl [color="#0000ff", URL="\ref dw::Table::sizeRequestImpl"]; * sizeAllocateImpl [color="#0000ff", * URL="\ref dw::Table::sizeAllocateImpl"]; * getExtremesImpl [color="#0000ff", URL="\ref dw::Table::getExtremesImpl"]; - * + * * subgraph cluster_sizes { * style="dashed"; color="#8080c0"; * calcCellSizes [URL="\ref dw::Table::calcCellSizes"]; * forceCalcCellSizes [URL="\ref dw::Table::forceCalcCellSizes"]; * } - * + * * subgraph cluster_extremes { * style="dashed"; color="#8080c0"; * calcColumnExtremes [URL="\ref dw::Table::calcColumnExtremes"]; * forceCalcColumnExtremes[URL="\ref dw::Table::forceCalcColumnExtremes"]; * } - * + * * sizeRequestImpl -> forceCalcCellSizes [label="[B]"]; * sizeAllocateImpl -> calcCellSizes [label="[A]"]; * getExtremesImpl -> forceCalcColumnExtremes [label="[B]"]; - * + * * forceCalcCellSizes -> calcColumnExtremes; - * + * * calcCellSizes -> forceCalcCellSizes [style="dashed", label="[C]"]; * calcColumnExtremes -> forceCalcColumnExtremes [style="dashed", * label="[C]"]; * } * \enddot - * + * * [A] In this case, the new calculation is \em not forced, but only * done, when necessary. - * + * * [B] In this case, the new calculation is allways necessary, since [C] * is the case. - * + * * [C] Whether this function is called, depends on NEEDS_RESIZE / * EXTREMES_CHANGED. - * - * + * + * * <h4>Apportionment</h4> - * + * * \sa\ref rounding-errors - * + * * Given two array \f$e_{i,\min}\f$ and \f$e_{i,\max}\f$, which * represent the column minima and maxima, and a total width \f$W\f$, \em * apportionment means to calculate column widths \f$w_{i}\f$, with - * + * * \f[e_{i,\min} \le w_{i} \le e_{i,\max}\f] - * + * * and - * + * * \f[\sum w_{i} = W\f] - * + * * There are different algorithms for apportionment, a simple one is * recommended in the HTML 4.0.1 specification * (http://www.w3.org/TR/REC-html40/appendix/notes.html#h-B.5.2.2): - * + * * \f[w_{i} = e_{i,\min} + * {e_{i,\max} - e_{i,\min}\over\sum e_{i,\max} - \sum e_{i,\min}} * (W - \sum e_{i,\min})\f] - * + * * This one is used currently, but another one will be used soon, which is * described below. The rest of this chapter is independant of the exact * apportionment algorithm. - * + * * When referring to the apportionment function, we will call it * \f$a_i (W, (e_{i,\min}), (e_{i,\min}))\f$ and write * something like this: - * + * * \f[w_{i} = a_i (W, (e_{i,\min}), (e_{i,\max})) \f] - * + * * It is implemented by dw::Table::apportion. - * + * * <h4>Column Extremes</h4> - * + * * \sa\ref rounding-errors - * + * * The sizes, which all other sizes depend on, are column extremes, which * define, how wide a column may be at min and at max. They are * calculated in the following way: - * + * * <ol> * <li> First, only cells with colspan = 1 are regarded: - * + * * \f[ e_{\hbox{base},i,\min} = \max \{ e_{\hbox{cell},i,j,\min} \} \f] * \f[ e_{\hbox{base},i,\max} = \max \{ e_{\hbox{cell},i,j,\max} \} \f] - * + * * only for cells \f$(i, j)\f$ with colspan = 1. - * + * * <li> Then, * \f$e_{\hbox{span},i,\min}\f$ (but not \f$e_{\hbox{span},i,\max}\f$) * are calculated from cells with colspan > 1. (In the following formulas, * the cell at \f$(i_1, j)\f$ always span from \f$i_1\f$ to \f$i_2\f$.) * If the minimal width of the column exeeds the sum of the column minima * calculated in the last step: - * + * * \f[e_{\hbox{cell},i_1,j,\min} > * \sum_{i=i_1}^{i=i_2} e_{\hbox{base},i,\min}\f] - * + * * then the minimal width of this cell is apportioned to the columns: - * + * * <ul> * <li> If the minimal width of this cell also exeeds the sum of the * column maxima: - * + * * \f[e_{\hbox{cell},i_1,j,\min} > * \sum_{i=i_1}^{i=i_2} e_{\hbox{base},i,\max}\f] - * + * * then \f$e_{\hbox{cell},i_1,j,\min}\f$ is apportioned in a simple * way: - * + * * \f[e_{\hbox{span},i,j,\min} = * e_{\hbox{base},i,\max} * {e_{\hbox{span},i,j,\min} \over * \sum_{i=i_1}^{i=i_2} e_{\hbox{base},i,\max}}\f] - * + * * <li> Otherwise, the apportionment function is used: - * + * * \f[e_{\hbox{span},i,j,\min} = * a_i (e_{\hbox{cell},i_1,j,\min}, * (e_{\hbox{cell},i_1,j,\min} \ldots @@ -160,10 +160,10 @@ namespace dw { * (e_{\hbox{cell},i_1,j,\max} \ldots * e_{\hbox{cell},i_2,j,\max}))\f] * </ul> - * + * * After this, \f$e_{\hbox{span},i,\min}\f$ is then the maximum of all * \f$e_{\hbox{span},i,j,\min}\f$. - * + * * <li> Finally, the maximum of both is used. * \f[ e_{i,\min} = * \max \{ e_{\hbox{base},i,\min}, e_{\hbox{span},i,\min} \} \f] @@ -173,7 +173,7 @@ namespace dw { * be assured, that the maximum is always greater or equal than/to the * minimum. * </ol> - * + * * Generally, if absolute widths are speficied, they are, instead of the * results of dw::core::Widget::getExtremes, taken for the minimal and * maximal width of a cell (minus the box difference, i.e. the difference @@ -181,106 +181,106 @@ namespace dw { * specification is smaller than the minimal content width of the widget * (determined by dw::core::Widget::getExtremes), the latter is used * instead. - * + * * If percentage widths are specified, they are also collected, as column * maxima. A similar method as for the extremes is used, for cells with * colspan > 1: - * + * * \f[w_{\hbox{span},i,j,\%} = * a_i (w_{\hbox{cell},i_1,j,\%}, * (e_{\hbox{cell},i_1,j,\min} \ldots e_{\hbox{cell},i_2,j,\min}), * (e_{\hbox{cell},i_1,j,\max} \ldots e_{\hbox{cell},i_2,j,\max}))\f] - * + * * <h4>Cell Sizes</h4> - * + * * <h5>Determining the Width of the Table</h5> - * + * * The total width is - * + * * <ul> * <li> the specified absolute width of the table, when given, or * <li> the available width (set by dw::Table::setWidth) times the specifies * percentage width pf t(at max 100%), if the latter is given, or * <li> otherwise the available width. * </ul> - * + * * In any case, it is corrected, if it is less than the minimal width * (but not if it is greater than the maximal width). - * + * * \bug The parantheses is not fully clear, look at the old code. - * + * * Details on differences because of styles are omitted. Below, this * total width is called \f$W\f$. - * + * * <h5>Evaluating percentages</h5> - * + * * The following algorithms are used to solve collisions between * different size specifications (absolute and percentage). Generally, * inherent sizes and specified absolute sizes are preferred. - * + * * <ol> * <li> First, calculate the sum of the minimal widths, for columns, where * no percentage width has been specified. The difference to the total * width is at max available to the columns with percentage width * specifications: - * + * * \f[W_{\hbox{columns}_\%,\hbox{available}} = W - \sum e_{i,\min}\f] - * + * * with only those columns \f$i\f$ with no percentage width specification. - * + * * <li> Then, calculate the sum of the widths, which the columns with * percentage width specification would allocate, when fully adhering to * then: - * + * * \f[W_{\hbox{columns}_\%,\hbox{best}} = W \sum w_{i,\%}\f] - * + * * with only those columns \f$i\f$ with a percentage width specification. - * + * * <li> Two cases are distinguished: - * + * * <ul> * <li> \f$W_{\hbox{columns}_\%,\hbox{available}} \ge * W_{\hbox{columns}_\%,\hbox{best}}\f$: In this case, the * percentage widths can be used without any modification, by * setting the extremes: - * + * * \f[e_{i,\min} = e_{i,\max} = W w_{i,\%}\f] - * + * * for only those columns \f$i\f$ with a percentage width * specification. - * + * * <li> \f$W_{\hbox{columns}_\%,\hbox{available}} < * W_{\hbox{columns}_\%,\hbox{best}}\f$: In this case, the widths * for these columns must be cut down: - * + * * \f[e_{i,\min} = e_{i,\max} = * w_{i,\%} * {W_{\hbox{columns}_\%,\hbox{available}} \over * w_{\hbox{total},\%}}\f] - * + * * with - * + * * \f[w_{\hbox{total},\%} = \sum w_{i,\%}\f] - * + * * in both cases for only those columns \f$i\f$ with a percentage - * width specification. + * width specification. * </ul> * </ol> - * + * * (\f$e_{i,\min}\f$ and \f$e_{i,\max}\f$ are set \em temporarily here, * the notation should be a bit clearer.) - * - * + * + * * <h5>Column Widths</h5> - * + * * The column widths are now simply calculated by applying the * apportenment function. - * - * + * + * * <h5>Row Heights</h5> - * + * * ... - * + * * <h3>Alternative Apportionment Algorithm</h3> * * The algorithm described here tends to result in more homogeneous column @@ -306,13 +306,13 @@ namespace dw { * Based on an initial value \f$w = {W\over n}\f$, \f$w\f$ can iteratively * adjusted, based on these rules. * - * + * * <h3>Borders, Paddings, Spacing</h3> - * + * * Currently, DwTable supports only the separated borders model (see CSS * specification). Borders, paddings, spacing is done by creating * dw::core::style::Style structures with values equivalent to following CSS: - * + * * <pre> * TABLE { * border: outset \em table-border; @@ -320,14 +320,14 @@ namespace dw { * border-spacing: \em table-cellspacing; * background-color: \em table-bgcolor; * } - * + * * TD TH { * border: inset \em table-border; * padding: \em table-cellspacing; * background-color: \em td/th-bgcolor; * } * </pre> - * + * * Here, \em foo-bar refers to the attribute \em bar of the tag \em foo foo. * Look at the HTML parser for more details. */ @@ -380,7 +380,7 @@ private: misc::SimpleVector<Child*> *children; int redrawX, redrawY; - + /** * \brief The extremes of all columns. */ @@ -460,7 +460,7 @@ protected: void setWidth (int width); void setAscent (int ascent); void setDescent (int descent); - void draw (core::View *view, core::Rectangle *area); + void draw (core::View *view, core::Rectangle *area); //bool buttonPressImpl (core::EventButton *event); //bool buttonReleaseImpl (core::EventButton *event); @@ -474,7 +474,7 @@ public: Table(bool limitTextWidth); ~Table(); - core::Iterator *iterator (core::Content::Type mask, bool atEnd); + core::Iterator *iterator (core::Content::Type mask, bool atEnd); void addCell (Widget *widget, int colspan, int rowspan); void addRow (core::style::Style *style); diff --git a/dw/tablecell.cc b/dw/tablecell.cc index b4d404f7..89c8c581 100644 --- a/dw/tablecell.cc +++ b/dw/tablecell.cc @@ -29,7 +29,7 @@ int TableCell::CLASS_ID = -1; TableCell::TableCell (TableCell *ref, bool limitTextWidth): AlignedTextblock (limitTextWidth) -{ +{ registerName ("dw::TableCell", &CLASS_ID); /** \bug ignoreLine1OffsetSometimes does not work? */ diff --git a/dw/textblock.cc b/dw/textblock.cc index 62d6d4ce..b80afb86 100644 --- a/dw/textblock.cc +++ b/dw/textblock.cc @@ -371,9 +371,9 @@ void Textblock::sizeAllocateImpl (core::Allocation *allocation) // + word->content.widget->getStyle()->margin.bottom; oldChildAllocation = word->content.widget->getAllocation(); - - if (childAllocation.x != oldChildAllocation->x || - childAllocation.y != oldChildAllocation->y || + + if (childAllocation.x != oldChildAllocation->x || + childAllocation.y != oldChildAllocation->y || childAllocation.width != oldChildAllocation->width) { /* The child widget has changed its position or its width * so we need to redraw from this line onwards. @@ -393,7 +393,7 @@ void Textblock::sizeAllocateImpl (core::Allocation *allocation) * end up redrawing the whole screen over and over. * The drawing of the child content is left to the child itself. */ - int childChangedY = + int childChangedY = misc::min(childAllocation.y - allocation->y + childAllocation.ascent + childAllocation.descent, oldChildAllocation->y - this->allocation.y + @@ -1662,7 +1662,7 @@ bool Textblock::addAnchor (const char *name, core::style::Style *style) char *copy; int y; - // Since an anchor does not take any space, it is safe to call + // Since an anchor does not take any space, it is safe to call // addAnchor already here. if (wasAllocated ()) { if (lines->size () == 0) @@ -1829,9 +1829,9 @@ void Textblock::addLinebreak (core::style::Style *style) /** * \brief Search recursively through widget. - * + * * This is an optimized version of the general - * dw::core::Widget::getWidgetAtPoint method. + * dw::core::Widget::getWidgetAtPoint method. */ core::Widget *Textblock::getWidgetAtPoint(int x, int y, int level) { @@ -2001,14 +2001,14 @@ int Textblock::TextblockIterator::compareTo(misc::Comparable *other) { return index - ((TextblockIterator*)other)->index; } - + bool Textblock::TextblockIterator::next () { Textblock *textblock = (Textblock*)getWidget(); if (content.type == core::Content::END) return false; - + do { index++; if (index >= textblock->words->size ()) { @@ -2027,7 +2027,7 @@ bool Textblock::TextblockIterator::prev () if (content.type == core::Content::START) return false; - + do { index--; if (index < 0) { diff --git a/dw/textblock.hh b/dw/textblock.hh index d3198b69..e65ce7b2 100644 --- a/dw/textblock.hh +++ b/dw/textblock.hh @@ -13,118 +13,118 @@ using namespace lout; * of paragraphs. * * <h3>Signals</h3> - * + * * dw::Textblock uses the signals defined in * dw::core::Widget::LinkReceiver, related to links. The coordinates are * always -1. - * - * + * + * * <h3>Collapsing Spaces</h3> - * + * * The idea behind this is that every paragraph has a specific vertical * space around and that they are combined to one space, according to * rules stated below. A paragraph consists either of the lines between * two paragraph breaks within a dw::Textblock, or of a dw::Textblock * within a dw::Textblock, in a single line; the latter is used for * indented boxes and list items. - * + * * The rules: - * + * * <ol> * <li> If a paragraph is following by another, the space between them is the * maximum of both box spaces: - * + * * \image html dw-textblock-collapsing-spaces-1-1.png - * + * * are combined like this: - * + * * \image html dw-textblock-collapsing-spaces-1-2.png - * + * * <li> a) If one paragraph is the first paragraph within another, the upper * space of these paragraphs collapse. b) The analogue is the case for the * last box: - * + * * \image html dw-textblock-collapsing-spaces-2-1.png - * + * * If B and C are put into A, the result is: - * + * * \image html dw-textblock-collapsing-spaces-2-2.png * </ol> - * + * * For achieving this, there are some features of dw::Textblock: - * + * * <ul> * <li> Consequent breaks are automatically combined, according to * rule 1. See the code of dw::Textblock::addParBreak for details. - * + * * <li> If a break is added as the first word of the dw::Textblock within * another dw::Textblock, collapsing according to rule 2a is done * automatically. See the code of dw::Textblock::addParBreak. - * + * * <li> To collapse spaces according to rule 2b, * dw::Textblock::addParBreak::handOverBreak must be called for * the \em inner widget. The HTML parser does this in * Html_eventually_pop_dw. * </ul> - * - * + * + * * <h3>Collapsing Margins</h3> - * + * * Collapsing margins, as defined in the CSS2 specification, are, * supported in addition to collapsing spaces. Also, spaces and margins * collapse themselves. I.e., the space between two paragraphs is the * maximum of the space calculated as described in "Collapsing Spaces" * and the space calculated according to the rules for collapsing margins. - * + * * (This is an intermediate hybrid state, collapsing spaces are used in * the current version of dillo, while I implemented collapsing margins * for the CSS prototype and integrated it already into the main trunk. For * a pure CSS-based dillo, collapsing spaces will not be needed anymore, and * may be removed for simplicity.) - * - * + * + * * <h3>Some Internals</h3> - * + * * There are two lists, dw::Textblock::words and * dw::Textblock::lines. The word list is quite static; only new words * may be added. A word is either text, a widget, a break or an * anchor. Anchors are stored in the text, because it may be necessary to * correct the scroller positions at rewrapping. - * + * * Lines refer to the word list (first and last), they are completely * redundant, i.e., they can be rebuilt from the words. Lines can be * rewrapped either completely or partially (see "Incremental Resizing" * below). For the latter purpose, several values are accumulated in the * lines. See dw::Textblock::Line for details. - * - * + * + * * <h4>Incremental Resizing</h4> - * + * * dw::Textblock makes use of incremental resizing as described in \ref * dw-widget-sizes. The parentRef is, for children of a dw::Textblock, simply * the number of the line. - * + * * Generally, there are three cases which may change the size of the * widget: - * + * * <ul> * <li> The available size of the widget has changed, e.g., because the * user has changed the size of the browser window. In this case, * it is necessary to rewrap all the lines. - * + * * <li> A child widget has changed its size. In this case, only a rewrap * down from the line where this widget is located is necessary. - * + * * (This case is very important for tables. Tables are quite at the * bottom, so that a partial rewrap is relevant. Otherwise, tables * change their size quite often, so that this is necessary for a * fast, non-blocking rendering) - * + * * <li> A word (or widget, break etc.) is added to the text block. This * makes it possible to reuse the old size by simply adjusting the * current width and height, so no rewrapping is necessary. * </ul> - * + * * The state of the size calculation is stored in wrapRef within * dw::Textblock, which has the value -1 if no rewrapping of lines * necessary, or otherwise the line from which a rewrap is necessary. @@ -282,7 +282,7 @@ protected: */ inline int lineXOffsetContents (Line *line) { - return innerPadding + line->leftOffset + + return innerPadding + line->leftOffset + (line == lines->getRef (0) ? line1OffsetEff : 0); } @@ -327,7 +327,7 @@ protected: { return lineYOffsetWidget (lines->getRef (lineIndex)); } - + inline int lineYOffsetCanvasI (int lineIndex) { return lineYOffsetCanvas (lines->getRef (lineIndex)); @@ -348,7 +348,7 @@ protected: void setWidth (int width); void setAscent (int ascent); void setDescent (int descent); - void draw (core::View *view, core::Rectangle *area); + void draw (core::View *view, core::Rectangle *area); bool buttonPressImpl (core::EventButton *event); bool buttonReleaseImpl (core::EventButton *event); @@ -364,7 +364,7 @@ public: Textblock(bool limitTextWidth); ~Textblock(); - core::Iterator *iterator (core::Content::Type mask, bool atEnd); + core::Iterator *iterator (core::Content::Type mask, bool atEnd); void flush (); diff --git a/dw/types.cc b/dw/types.cc index d72d46cf..31fae8aa 100644 --- a/dw/types.cc +++ b/dw/types.cc @@ -249,7 +249,7 @@ void Region::addRectangle (Rectangle *rPointer) r->y = misc::min(r->y, ownRect->y); r->width = combinedWidth; r->height = combinedHeight; - + rectangleList->removeRef (ownRect); } } diff --git a/dw/types.hh b/dw/types.hh index bdfca629..4687c7fc 100644 --- a/dw/types.hh +++ b/dw/types.hh @@ -100,7 +100,7 @@ private: /** * \brief Return the z-coordinate of the vector product of two - * vectors, whose z-coordinate is 0 (so that x and y of + * vectors, whose z-coordinate is 0 (so that x and y of * the vector product is 0, too). */ inline int zOfVectorProduct(int x1, int y1, int x2, int y2) { @@ -130,8 +130,8 @@ public: class Region { private: - container::typed::List <Rectangle> *rectangleList; - + container::typed::List <Rectangle> *rectangleList; + public: Region (); ~Region (); @@ -186,7 +186,7 @@ struct Content SELECTION_CONTENT = TEXT | WIDGET | BREAK }; /* Content is embedded in struct Word therefore we - * try to be space efficient. + * try to be space efficient. */ short type; bool space; @@ -14,24 +14,24 @@ namespace core { * UI resources are another abstraction for Dw widgets, which are not * fully implemented in a platform-independent way. Typically, they * involve creating widgets, which the underlying UI toolkit provides. - * + * * As you see in this diagram: - * + * * \dot * digraph G { * node [shape=record, fontname=Helvetica, fontsize=10]; * edge [arrowhead="none", arrowtail="empty", labelfontname=Helvetica, * labelfontsize=10, color="#404040", labelfontcolor="#000080"]; * fontname=Helvetica; fontsize=10; - * + * * subgraph cluster_core { * style="dashed"; color="#000080"; fontname=Helvetica; fontsize=10; * label="dw::core"; - * + * * subgraph cluster_ui { * style="dashed"; color="#000080"; fontname=Helvetica; fontsize=10; * label="dw::core::ui"; - * + * * Embed [URL="\ref dw::core::ui::Embed"]; * Resource [color="#a0a0a0", URL="\ref dw::core::ui::Resource"]; * LabelButtonResource [color="#a0a0a0", @@ -40,19 +40,19 @@ namespace core { * URL="\ref dw::core::ui::EntryResource"]; * etc [color="#a0a0a0", label="..."]; * } - * + * * Widget [URL="\ref dw::core::Widget", color="#a0a0a0"]; * } - * + * * subgraph cluster_fltk { * style="dashed"; color="#000080"; fontname=Helvetica; fontsize=10; * label="dw::fltk::ui"; - * + * * FltkLabelButtonResource * [URL="\ref dw::fltk::ui::FltkLabelButtonResource"]; * FltkEntryResource [URL="\ref dw::fltk::ui::FltkEntryResource"]; * } - * + * * Widget -> Embed; * Embed -> Resource [arrowhead="open", arrowtail="none", * headlabel="1", taillabel="1"]; @@ -63,16 +63,16 @@ namespace core { * EntryResource -> FltkEntryResource; * } * \enddot - * + * * <center>[\ref uml-legend "legend"]</center> - * + * * there are several levels: - * + * * <ol> * <li> The Dw widget is dw::core::ui::Embed. It delegates most to * dw::core::ui::Resource, which has similar methods like * dw::core::Widget. - * + * * <li> There are several sub interfaces of dw::core::ui::Resource, which * may provide methods, as e.g. dw::core::ui::ListResource::addItem. In a * platform independent context, you can cast the result of @@ -80,44 +80,44 @@ namespace core { * know, which one is used. E.g., if you know, that a given instance * dw::core::ui::Embed refers to a dw::core::ui::ListResource, you can * write something like: - * + * * \code * dw::core::ui::Embed *embed; * //... * ((dw::core::ui::ListResource*)embed->getResource ())->addItem ("Hello!"); * \endcode - * + * * <li> These sub classes are then fully implemented in a platform specific * way. For an example, look at dw::fltk::ui. * </ol> - * + * * There is a factory interface, dw::core::ui::ResourceFactory, which * provides methods for creating common resources. By calling * dw::core::Layout::getResourceFactory, which calls * dw::core::Platform::getResourceFactory, you get the factory for the used * platform. - * + * * It is possible to define additional sub classes of * dw::core::ui::Resource, but since they are not provided by * dw::core::ui::ResourceFactory, you have to define some other * abstractions, if you want to remain platform independent. - * - * + * + * * <h3>...</h3> - * - * + * + * * <h3>Resouces needed for HTML</h3> - * + * * This chapter describes, how the form controls defined by HTML are * implemented in Dw. Some of them do not refer to UI resources, but to * other widgets, links to the respective documentations are provided * here. - * + * * <h4>Resouces created with \<INPUT\></h4> - * + * * The HTML \<INPUT\> is always implemented by using UI * resources. \<INPUT\> element has the following attributes: - * + * * <table> * <tr><th>Attribute <th>Implementation * <tr><td>type <td>This defines the resource you have to instanciate. @@ -127,7 +127,7 @@ namespace core { * <tr><td>checked <td>Parameter to * dw::core::ui::ResourceFactory::createCheckButtonResource * and dw::core::ui::ResourceFactory::createRadioButtonResource. - * <tr><td>disabled <td>This is provided for all resources by + * <tr><td>disabled <td>This is provided for all resources by * dw::core::ui::Resource::setEnabled. * <tr><td>readonly <td>This is provided by * dw::core::ui::TextResource::setEditable. @@ -146,10 +146,10 @@ namespace core { * <tr><td>onchange <td>Not supported currently. * <tr><td>accept <td>Not supported currently. * </table> - * + * * For the different values of \em type, the following resources can be * used: - * + * * <table> * <tr><th>Type <th>Resource * <th>Factory Method @@ -175,35 +175,35 @@ namespace core { * <tr><td>file <td>Not supported currently. * <td>- * </table> - * + * * <h4>\<SELECT\>, \<OPTGROUP\>, and \<OPTION\></h4> - * + * * \<SELECT\> is implemented either by dw::core::ui::OptionMenuResource * (better suitable for \em size = 1 and single selection) or * dw::core::ui::ListResource, which have a common base, * dw::core::ui::SelectionResource. In the latter case, \em size must be * specified via dw::core::style::Style. - * + * * Factory methods are dw::core::ui::ResourceFactory::createListResource and * dw::core::ui::ResourceFactory::createOptionMenuResource. - * + * * \<OPTION\>'s are added via dw::core::ui::SelectionResource::addItem. - * + * * \<OPTGROUP\> are created by using dw::core::ui::SelectionResource::pushGroup * and dw::core::ui::SelectionResource::popGroup. - * + * * For lists, the selection mode must be set in * dw::core::ui::ResourceFactory::createListResource. - * + * * <h4>\<TEXTAREA\></h4> - * + * * \<TEXTAREA\> is implemented by dw::core::ui::MultiLineTextResource, * the factory method is * dw::core::ui::ResourceFactory::createMultiLineTextResource. * dw::core::ui::TextResource::setEditable can be used, as for entries. - * + * * <h4>\<BUTTON\></h4> - * + * * For handling \<BUTTON\>, dw::core::ui::ComplexButtonResource should be used, * with a dw::Textblock inside, and relief = true. The contents of \<BUTTON\> * is then added to the dw::Textblock. @@ -328,7 +328,7 @@ protected: public: inline Resource () { embed = NULL; } - + virtual ~Resource (); virtual void sizeRequest (Requisition *requisition) = 0; @@ -339,7 +339,7 @@ public: virtual void setDescent (int descent); virtual void setDisplayed (bool displayed); virtual void draw (View *view, Rectangle *area); - virtual Iterator *iterator (Content::Type mask, bool atEnd) = 0; + virtual Iterator *iterator (Content::Type mask, bool atEnd) = 0; virtual void setStyle (style::Style *style); virtual bool isEnabled () = 0; @@ -361,7 +361,7 @@ class ButtonResource: public Resource class LabelButtonResource: public ButtonResource { public: - Iterator *iterator (Content::Type mask, bool atEnd); + Iterator *iterator (Content::Type mask, bool atEnd); virtual const char *getLabel () = 0; virtual void setLabel (const char *label) = 0; @@ -391,7 +391,7 @@ protected: virtual Platform *createPlatform () = 0; virtual void setLayout (Layout *layout) = 0; - + virtual int reliefXThickness () = 0; virtual int reliefYThickness () = 0; @@ -413,14 +413,14 @@ public: }; /** - * \brief Base interface for dw::core::ui::ListResource and + * \brief Base interface for dw::core::ui::ListResource and * dw::core::ui::OptionMenuResource. */ class SelectionResource: public Resource { public: virtual void addItem (const char *str, bool enabled, bool selected) = 0; - + virtual void pushGroup (const char *name, bool enabled) = 0; virtual void popGroup () = 0; @@ -442,7 +442,7 @@ public: /** * \brief Exactly one item is selected, except possibly at the beginning. - * + * * If no item is selected initially, no one is selected automatically. * The user may not unselect the only selected item. */ @@ -470,7 +470,7 @@ class OptionMenuResource: public SelectionResource class TextResource: public Resource { public: - Iterator *iterator (Content::Type mask, bool atEnd); + Iterator *iterator (Content::Type mask, bool atEnd); virtual const char *getText () = 0; virtual void setText (const char *text) = 0; @@ -499,7 +499,7 @@ public: class CheckButtonResource: public ToggleButtonResource { public: - Iterator *iterator (Content::Type mask, bool atEnd); + Iterator *iterator (Content::Type mask, bool atEnd); }; class RadioButtonResource: public ToggleButtonResource @@ -523,7 +523,7 @@ public: */ virtual GroupIterator *groupIterator () = 0; - Iterator *iterator (Content::Type mask, bool atEnd); + Iterator *iterator (Content::Type mask, bool atEnd); }; @@ -34,7 +34,7 @@ public: virtual void setCanvasSize (int width, int ascent, int descent) = 0; /** - * \brief Set the cursor appearance. + * \brief Set the cursor appearance. */ virtual void setCursor (style::Cursor cursor) = 0; @@ -42,7 +42,7 @@ public: * \brief Set the background of the view. */ virtual void setBgColor (style::Color *color) = 0; - + /* * --------------------------------------------------------- * Scrolling and Related. Only usesViewport must be @@ -107,7 +107,7 @@ public: /** * \brief Called before drawing. * - * All actual drawing operations will be enclosed into calls of + * All actual drawing operations will be enclosed into calls of * dw::core:View::startDrawing and dw::core:View::finishDrawing. They * may be implemented, e.g. when a backing * pixmap is used, to prevent flickering. StartDrawing() will then diff --git a/dw/widget.cc b/dw/widget.cc index 9a77d0b1..7f50fa70 100644 --- a/dw/widget.cc +++ b/dw/widget.cc @@ -198,7 +198,7 @@ bool Widget::LinkEmitter::emitToReceiver (lout::signal::Receiver *receiver, return false; } -bool Widget::LinkEmitter::emitEnter (Widget *widget, int link, int img, +bool Widget::LinkEmitter::emitEnter (Widget *widget, int link, int img, int x, int y) { Integer ilink (link), iimg (img), ix (x), iy (y); @@ -238,7 +238,7 @@ int Widget::CLASS_ID = -1; Widget::Widget () { registerName ("dw::core::Widget", &CLASS_ID); - + flags = (Flags)(NEEDS_RESIZE | EXTREMES_CHANGED | HAS_CONTENTS); parent = NULL; layout = NULL; @@ -496,7 +496,7 @@ void Widget::leaveNotify (EventCrossing *event) * The old style is automatically unreferred, the new is referred. If this * call causes the widget to change its size, dw::core::Widget::queueResize * is called. - */ + */ void Widget::setStyle (style::Style *style) { bool sizeChanged; @@ -696,7 +696,7 @@ Widget *Widget::getNearestCommonAncestor (Widget *otherWidget) MSG_WARN("widgets in different trees\n"); return NULL; } - + widget1 = widget1->parent; widget2 = widget2->parent; } @@ -707,7 +707,7 @@ Widget *Widget::getNearestCommonAncestor (Widget *otherWidget) /** * \brief Search recursively through widget. - * + * * Used by dw::core::Layout:getWidgetAtPoint. */ Widget *Widget::getWidgetAtPoint (int x, int y, int level) @@ -739,7 +739,7 @@ Widget *Widget::getWidgetAtPoint (int x, int y, int level) level + 1); it->unref (); - + if (childAtPoint) return childAtPoint; else diff --git a/dw/widget.hh b/dw/widget.hh index 1bcfd032..0515f250 100644 --- a/dw/widget.hh +++ b/dw/widget.hh @@ -162,7 +162,7 @@ protected: /** * \brief Set, when dw::core::Widget::requisition is not up to date * anymore. - */ + */ NEEDS_RESIZE = 1 << 0, /** @@ -175,7 +175,7 @@ protected: /** * \brief Set, when dw::core::Widget::extremes is not up to date * anymore. - */ + */ EXTREMES_CHANGED = 1 << 2, /** @@ -183,7 +183,7 @@ protected: * methods are implemented. * * Will hopefully be removed, after redesigning the size model. - */ + */ USES_HINTS = 1 << 3, /** @@ -191,7 +191,7 @@ protected: * some contents, e.g. an image, as opposed to a horizontal ruler. * * Will hopefully be removed, after redesigning the size model. - */ + */ HAS_CONTENTS = 1 << 4, /** @@ -266,7 +266,7 @@ protected: inline void setFlags (Flags f) { flags = (Flags)(flags | f); } inline void unsetFlags (Flags f) { flags = (Flags)(flags & ~f); } - + inline void queueDraw () { @@ -343,7 +343,7 @@ protected: EventMotion *event, bool withinContent) { return layout->selectionState.buttonMotion (it, charPos, linkNo, event, withinContent); } - + inline bool selectionHandleEvent (SelectionState::EventType eventType, Iterator *it, int charPos, int linkNo, MousePositionEvent *event, @@ -375,7 +375,7 @@ public: inline void connectLink (LinkReceiver *receiver) { linkEmitter.connectLink (receiver); } - + inline bool emitLinkEnter (int link, int img, int x, int y) { return linkEmitter.emitEnter (this, link, img, x, y); } @@ -417,7 +417,7 @@ public: bool motionNotify (EventMotion *event); void enterNotify (EventCrossing *event); void leaveNotify (EventCrossing *event); - + virtual void setStyle (style::Style *style); void setBgColor (style::Color *bgColor); style::Color *getBgColor (); diff --git a/lout/container.cc b/lout/container.cc index 6c886baa..d44d92d4 100644 --- a/lout/container.cc +++ b/lout/container.cc @@ -77,7 +77,7 @@ Iterator &Iterator::operator=(Iterator &it2) Iterator::~Iterator() { if (impl) - impl->unref(); + impl->unref(); } // ---------------- @@ -241,7 +241,7 @@ void List::append(Object *element) if (last) { last->next = newLast; last = newLast; - } else + } else first = last = newLast; numElements++; diff --git a/lout/container.hh b/lout/container.hh index 26803e23..52c5019f 100644 --- a/lout/container.hh +++ b/lout/container.hh @@ -20,7 +20,7 @@ namespace lout { namespace container { /** - * \brief The container classes defined here contain instances of + * \brief The container classes defined here contain instances of * object::Object. * * Different sub-classes may be mixed, and you have to care about casting, @@ -44,13 +44,13 @@ protected: { private: int refcount; - + public: AbstractIterator() { refcount = 1; } - + void ref () { refcount++; } void unref () { refcount--; if (refcount == 0) delete this; } - + virtual bool hasNext () = 0; virtual Object *getNext () = 0; }; @@ -60,7 +60,7 @@ protected: }; /** - * \brief This is a small wrapper for AbstractIterator, which may be used + * \brief This is a small wrapper for AbstractIterator, which may be used * directly, not as a pointer, to makes memory management simpler. */ class Iterator @@ -271,7 +271,7 @@ protected: public: Stack (bool ownerOfObjects); ~Stack(); - + void push (object::Object *object); void pushUnder (object::Object *object); inline object::Object *getTop () { return top ? top->object : NULL; } @@ -421,7 +421,7 @@ public: inline Stack (bool ownerOfObjects) { this->base = new untyped::Stack (ownerOfObjects); } ~Stack() { delete this->base; } - + inline void push (T *object) { ((untyped::Stack*)this->base)->push (object); } inline void pushUnder (T *object) diff --git a/lout/identity.hh b/lout/identity.hh index 7dcdbac4..544656fc 100644 --- a/lout/identity.hh +++ b/lout/identity.hh @@ -131,11 +131,11 @@ public: * identity::IdentifiableObject::instanceOf are done. */ int getClassId () { return classId; } - + /** * \brief Return the name, under which the class of this object was * registered. - */ + */ const char *getClassName() { return classesById->get(classId)->className; } bool instanceOf (int otherClassId); diff --git a/lout/misc.cc b/lout/misc.cc index 435fe8be..2e4dfaf5 100644 --- a/lout/misc.cc +++ b/lout/misc.cc @@ -154,7 +154,7 @@ const char *StringBuffer::getChars() memcpy(p, node->data, l * sizeof(char)); p += l; } - + *p = 0; strValid = true; return str; @@ -183,7 +183,7 @@ void StringBuffer::clear () BitSet::BitSet(int initBits) { - numBytes = bytesForBits(initBits); + numBytes = bytesForBits(initBits); bits = (unsigned char*)malloc(numBytes * sizeof(unsigned char)); clear(); } @@ -220,7 +220,7 @@ void BitSet::set(int i, bool val) memset(bits + numBytes, 0, newNumBytes - numBytes); numBytes = newNumBytes; } - + if (val) bits[i / 8] |= (1 << (i % 8)); else diff --git a/lout/misc.hh b/lout/misc.hh index 730a47a4..aa32a4f5 100644 --- a/lout/misc.hh +++ b/lout/misc.hh @@ -51,7 +51,7 @@ class Comparable { public: virtual ~Comparable(); - + /** * \brief Compare two objects c1 and c2. * @@ -240,9 +240,9 @@ class BitSet private: unsigned char *bits; int numBytes; - + inline int bytesForBits(int bits) { return bits == 0 ? 1 : (bits + 7) / 8; } - + public: BitSet(int initBits); ~BitSet(); @@ -263,7 +263,7 @@ private: size_t poolSize, poolLimit, freeIdx; SimpleVector <char*> *pools; SimpleVector <char*> *bulk; - + public: ZoneAllocator (size_t poolSize) { this->poolSize = poolSize; diff --git a/lout/object.cc b/lout/object.cc index 684bb8fa..beef4005 100644 --- a/lout/object.cc +++ b/lout/object.cc @@ -271,7 +271,7 @@ int PairBase::hashValue() value ^= first->hashValue(); if (second) value ^= second->hashValue(); - + return value; } diff --git a/lout/object.hh b/lout/object.hh index 7d505c99..789542fe 100644 --- a/lout/object.hh +++ b/lout/object.hh @@ -40,7 +40,7 @@ class Pointer: public Object { private: void *value; - + public: Pointer(void *value) { this->value = value; } bool equals(Object *other); @@ -93,9 +93,9 @@ public: int hashValue(); int compareTo(Comparable *other); void intoStringBuffer(misc::StringBuffer *sb); - + inline const char *chars() { return str; } - + static int hashValue(const char *str); }; diff --git a/lout/signal.hh b/lout/signal.hh index c96247be..9a5635d0 100644 --- a/lout/signal.hh +++ b/lout/signal.hh @@ -160,7 +160,7 @@ * // ... * }; * \endcode - * + * * The constructor of Qix should then set \em qix: * * \code @@ -217,7 +217,7 @@ private: container::typed::List <Receiver> *receivers; void unconnect (Receiver *receiver); - + protected: void emitVoid (int signalNo, int argc, Object **argv); bool emitBool (int signalNo, int argc, Object **argv); diff --git a/src/IO/IO.c b/src/IO/IO.c index a0e18226..77790131 100644 --- a/src/IO/IO.c +++ b/src/IO/IO.c @@ -152,10 +152,10 @@ static void IO_close_fd(IOData_t *io, int CloseCode) /* Stop the polling on this FD */ if (CloseCode & IO_StopRd) { events |= DIO_READ; - } + } if (CloseCode & IO_StopWr) { events |= DIO_WRITE; - } + } a_IOwatch_remove_fd(io->FD, events); _MSG(" end IO close (%d) <=====\n", io->FD); } diff --git a/src/IO/http.c b/src/IO/http.c index 738937db..d8ef6113 100644 --- a/src/IO/http.c +++ b/src/IO/http.c @@ -362,7 +362,7 @@ static int Http_connect_socket(ChainLink *Info) struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)&name; socket_len = sizeof(struct sockaddr_in6); sin6->sin6_family = dh->af; - sin6->sin6_port = + sin6->sin6_port = S->port ? htons(S->port) : htons(DILLO_URL_HTTP_PORT); memcpy(&sin6->sin6_addr, dh->data, dh->alen); inet_ntop(dh->af, dh->data, buf, sizeof(buf)); diff --git a/src/cache.c b/src/cache.c index 8ab9e1a4..e634b337 100644 --- a/src/cache.c +++ b/src/cache.c @@ -668,7 +668,7 @@ static void Cache_parse_header(CacheEntry_t *entry) entry->Flags |= CA_ForceRedirect; /* 301 Moved Permanently */ else if (header[11] == '2') entry->Flags |= CA_TempRedirect; /* 302 Temporary Redirect */ - + location_url = a_Url_new(location_str, URL_STR_(entry->Url)); if (URL_FLAGS(location_url) & (URL_Post + URL_Get) && dStrcasecmp(URL_SCHEME(location_url), "dpi") == 0 && @@ -827,7 +827,7 @@ void a_Cache_process_dbuf(int Op, const char *buf, size_t buf_size, _MSG("__a_Cache_process_dbuf__\n"); if (Op == IORead) { - /* + /* * Cache_get_header() will set CA_GotHeader if it has a full header, and * Cache_parse_header() will unset it if the header ends being * merely an informational response from the server (i.e., 100 Continue) @@ -863,7 +863,7 @@ void a_Cache_process_dbuf(int Op, const char *buf, size_t buf_size, dStr_free(dstr1, 1); dStr_free(dstr2, 1); dStr_free(dstr3, 1); - + if (entry->Data->len) entry->Flags &= ~CA_IsEmpty; @@ -969,7 +969,7 @@ static void Cache_auth_callback(void *vdata) /* * Set a timeout function to ask for user/password. - */ + */ static void Cache_auth_entry(CacheEntry_t *entry, BrowserWindow *bw) { static int busy = 0; @@ -423,7 +423,7 @@ const char *a_Capi_get_content_type(const DilloUrl *url) } /* - * Set the Content-Type for the URL. + * Set the Content-Type for the URL. */ const char *a_Capi_set_content_type(const DilloUrl *url, const char *ctype, const char *from) @@ -554,7 +554,7 @@ void a_Capi_ccc(int Op, int Branch, int Dir, ChainLink *Info, if (Data2 && !strcmp(Data2, "DpidERROR")) a_UIcmd_set_msg(conn->bw, "ERROR: can't start dpid daemon " - "(URL scheme = '%s')!", + "(URL scheme = '%s')!", URL_SCHEME(conn->url)); /* finish conn */ Capi_conn_unref(conn); diff --git a/src/chain.c b/src/chain.c index 37f43a7f..1045bb9c 100644 --- a/src/chain.c +++ b/src/chain.c @@ -153,7 +153,7 @@ DataBuf *a_Chain_dbuf_new(void *buf, int size, int code) /* * Check whether the CCC is operative. * Also used to hook debug information. - * + * * Return value: 1 if ready to use, 0 if not operative. */ int a_Chain_check(char *FuncStr, int Op, int Branch, int Dir, @@ -98,7 +98,7 @@ bool CssSelector::match (Doctree *docTree, const DoctreeNode *node) { if (node == NULL) return false; - + switch (comb) { case CHILD: if (!sel->match (node)) @@ -125,8 +125,8 @@ bool CssSelector::match (Doctree *docTree, const DoctreeNode *node) { comb = cs->combinator; node = docTree->parent (node); - } - + } + return true; } @@ -196,7 +196,7 @@ bool CssSimpleSelector::match (const DoctreeNode *n) { return false; if (id != NULL && (n->id == NULL || dStrcasecmp (id, n->id) != 0)) return false; - + return true; } @@ -285,7 +285,7 @@ void CssStyleSheet::addRule (CssRule *rule) { CssSimpleSelector *top = rule->selector->top (); RuleList *ruleList = NULL; lout::object::ConstString *string; - + if (top->id) { string = new lout::object::ConstString (top->id); ruleList = idTable->get (string); @@ -318,7 +318,7 @@ void CssStyleSheet::apply (CssPropertyList *props, Doctree *docTree, const DoctreeNode *node) { RuleList *ruleList[4]; int numLists = 0, index[4] = {0, 0, 0, 0}; - + if (node->id) { lout::object::ConstString idString (node->id); @@ -412,7 +412,7 @@ void CssContext::apply (CssPropertyList *props, Doctree *docTree, if (nonCssHints) nonCssHints->apply (props); - + if (sheet[CSS_PRIMARY_AUTHOR]) sheet[CSS_PRIMARY_AUTHOR]->apply (props, docTree, node); @@ -441,7 +441,7 @@ void CssContext::addRule (CssSelector *sel, CssPropertyList *props, void CssContext::buildUserAgentStyle () { const char *cssBuf = - "body {background-color: #dcd1ba; font-family: sans-serif; color: black;" + "body {background-color: #dcd1ba; font-family: sans-serif; color: black;" " margin: 5px}" "big {font-size: 1.17em}" "blockquote, dd {margin-left: 40px; margin-right: 40px}" @@ -34,7 +34,7 @@ typedef enum { 'font-weight' */ CSS_TYPE_STRING, /* <string> */ CSS_TYPE_SYMBOL, /* Symbols, which are directly copied (as - opposed to CSS_TYPE_ENUM and + opposed to CSS_TYPE_ENUM and CSS_TYPE_MULTI_ENUM). Used for 'font-family'. */ CSS_TYPE_UNUSED /* Not yet used. Will itself get unused some @@ -43,7 +43,7 @@ typedef enum { /* * Lengths are represented as int in the following way: - * + * * +---+ - - - +---+---+- - - - - -+---+---+---+---+ * | integer part | decimal fraction | type | * +---+ - - - +---+---+- - - - - -+---+---+---+---+ @@ -213,7 +213,7 @@ class CssProperty { /** * \brief A list of CssProperty objects. - */ + */ class CssPropertyList : public lout::misc::SimpleVector <CssProperty> { int refCount; bool ownerOfStrings; diff --git a/src/cssparser.cc b/src/cssparser.cc index 81e289a2..625bb8a0 100644 --- a/src/cssparser.cc +++ b/src/cssparser.cc @@ -485,7 +485,7 @@ static void Css_next_token(CssParser * parser) escaped = true; d = Css_getc(parser); if (isxdigit(d)) { - /* Read hex Unicode char. (Actually, strings are yet only 8 + /* Read hex Unicode char. (Actually, strings are yet only 8 * bit.) */ hexbuf[0] = d; j = 1; @@ -1009,7 +1009,7 @@ static bool Css_parse_simple_selector(CssParser * parser, Css_next_token(parser); if (parser->space_separated) return true; - } else if (parser->ttype == CSS_TK_CHAR && + } else if (parser->ttype == CSS_TK_CHAR && (parser->tval[0] == '#' || parser->tval[0] == '.' || parser->tval[0] == ':')) { diff --git a/src/decode.c b/src/decode.c index 8b8d9081..1207d68d 100644 --- a/src/decode.c +++ b/src/decode.c @@ -244,7 +244,7 @@ Decode *a_Decode_content_init(const char *format) MSG("Content-Encoding '%s' not recognized.\n", format); } } - return dc; + return dc; } /* @@ -294,7 +294,7 @@ Decode *a_Decode_charset_init(const char *format) MSG("Unable to convert from character encoding: '%s'\n", format); } } - return dc; + return dc; } /* diff --git a/src/dialog.cc b/src/dialog.cc index 38854fb3..c02ee223 100644 --- a/src/dialog.cc +++ b/src/dialog.cc @@ -11,7 +11,7 @@ // UI dialogs -#include <math.h> // for rint() +#include <math.h> // for rint() #include <fltk/Window.h> #include <fltk/ask.h> @@ -129,11 +129,11 @@ void *a_Dialog_make_text_window(const char *txt, const char *title) int wh = prefs.height, ww = prefs.width, bh = 30; int lines, line_num_width; Font *textfont = font(prefs.font_monospace, 0); - + Window *window = new Window(ww, wh, title ? title : "Untitled"); window->callback(window_close_cb, window); window->begin(); - + TextDisplay *td = new TextDisplay(0,0,ww, wh-bh); td->buffer()->text(txt); diff --git a/src/dicache.c b/src/dicache.c index a95b1a52..86578ba1 100644 --- a/src/dicache.c +++ b/src/dicache.c @@ -408,7 +408,7 @@ static void *Dicache_image(int ImgType, const char *MimeType, void *Ptr, if (!DicEntry) { /* Let's create an entry for this image... */ DicEntry = a_Dicache_add_entry(web->url); - DicEntry->DecoderData = + DicEntry->DecoderData = (ImgType == DIC_Png) ? a_Png_new(web->Image, DicEntry->url, DicEntry->version) : (ImgType == DIC_Gif) ? diff --git a/src/findbar.cc b/src/findbar.cc index ea1c80f1..2045d2a0 100644 --- a/src/findbar.cc +++ b/src/findbar.cc @@ -89,7 +89,7 @@ void Findbar::search_cb2(Widget *widget, void *vfb) /* * Somehow fltk even regards the first loss of focus for the * window as a WHEN_ENTER_KEY_ALWAYS event. - */ + */ if (event_key() == ReturnKey) search_cb(widget, vfb); } diff --git a/src/findbar.hh b/src/findbar.hh index 90982ffd..84922ac0 100644 --- a/src/findbar.hh +++ b/src/findbar.hh @@ -20,7 +20,7 @@ class Findbar : public Group { CheckButton *check_btn; xpmImage *hideImg; Input *i; - + static void search_cb (Widget *, void *); static void searchBackwards_cb (Widget *, void *); static void search_cb2 (Widget *, void *); diff --git a/src/form.hh b/src/form.hh index fd48a18d..32ca88dd 100644 --- a/src/form.hh +++ b/src/form.hh @@ -4,7 +4,7 @@ #include "url.h" /* - * Typedefs + * Typedefs */ typedef enum { @@ -19,7 +19,7 @@ typedef enum { } DilloHtmlEnc; /* - * Classes + * Classes */ class DilloHtmlForm; @@ -27,7 +27,7 @@ class DilloHtmlInput; class DilloHtml; /* - * Form API + * Form API */ DilloHtmlForm *a_Html_form_new(DilloHtml *html, @@ -44,7 +44,7 @@ void a_Html_form_display_hiddens2(void *v_form, bool display); /* - * Form parsing functions + * Form parsing functions */ void Html_tag_open_form(DilloHtml *html, const char *tag, int tagsize); diff --git a/src/html.cc b/src/html.cc index fa46de34..92e6c196 100644 --- a/src/html.cc +++ b/src/html.cc @@ -48,7 +48,7 @@ #include "dw/ruler.hh" /*----------------------------------------------------------------------------- - * Defines + * Defines *---------------------------------------------------------------------------*/ /* Define to 1 to ignore white space immediately after an open tag, @@ -201,7 +201,7 @@ static void Html_free(void *data) /* * Used by the "Load images" page menuitem. - */ + */ void a_Html_load_images(void *v_html, DilloUrl *pattern) { DilloHtml *html = (DilloHtml*)v_html; @@ -210,7 +210,7 @@ void a_Html_load_images(void *v_html, DilloUrl *pattern) } /* - * Search for form + * Search for form */ static bool Html_contains_form(DilloHtml *html, void *v_form) { @@ -230,9 +230,9 @@ void a_Html_form_submit(void *v_html, void *v_form) DilloHtml *html = (DilloHtml*)v_html; if (Html_contains_form(html, v_form)) { - /* it's still valid */ + /* it's still valid */ a_Html_form_submit2(v_form); - } + } } /* @@ -243,7 +243,7 @@ void a_Html_form_reset(void *v_html, void *v_form) DilloHtml *html = (DilloHtml*)v_html; if (Html_contains_form(html, v_form)) { - /* it's still valid */ + /* it's still valid */ a_Html_form_reset2(v_form); } } @@ -306,7 +306,7 @@ static void Html_add_new_linkimage(DilloHtml *html, * sets the style at the top of the stack. */ void a_Html_tag_set_align_attr(DilloHtml *html, - CssPropertyList *props, + CssPropertyList *props, const char *tag, int tagsize) { const char *align; @@ -948,7 +948,7 @@ static int Html_parse_entity(DilloHtml *html, const char *token, /* strtol with base 16 accepts leading "0x" - we don't */ if (*s == '0' && s[1] == 'x') { s++; - isocode = 0; + isocode = 0; } else { isocode = strtol(s, &s, 16); } @@ -1041,7 +1041,7 @@ char *a_Html_parse_entities(DilloHtml *html, const char *token, int toksize) /* * Parse spaces */ -static void Html_process_space(DilloHtml *html, const char *space, +static void Html_process_space(DilloHtml *html, const char *space, int spacesize) { char *spc; @@ -1178,7 +1178,7 @@ static void Html_process_word(DilloHtml *html, const char *word, int size) if (strchr("\t\f\n\r", Pword[i])) { if (i == 0 || (i > 0 && Pword[i-1] != ' ')) Pword[i] = ' '; - else + else for (--i; strchr("\t\f\n\r", Pword[j+1]); ++j) ; } } @@ -1446,7 +1446,7 @@ static int * recognizes the "HTML Level" with or without the URL. The convention * comes from mozilla (see URLs below), but Dillo doesn't have the same * rendering modes, so it may be better to chose another behaviour. --Jcid - * + * * http://www.mozilla.org/docs/web-developer/quirks/doctypes.html * http://lists.auriga.wearlab.de/pipermail/dillo-dev/2004-October/002300.html * @@ -1881,7 +1881,7 @@ static void Html_tag_open_font(DilloHtml *html, const char *tag, int tagsize) if ((attrbuf = a_Html_get_attr(html, tag, tagsize, "color"))) { if (prefs.contrast_visited_color && html->InVisitedLink) { color = html->visited_color; - } else { + } else { /* use the tag-specified color */ color = a_Html_color_parse(html, attrbuf, -1); } @@ -2058,7 +2058,7 @@ DilloImage *a_Html_image_new(DilloHtml *html, const char *tag, /* * Tell cache to retrieve image */ -static void Html_load_image(BrowserWindow *bw, DilloUrl *url, +static void Html_load_image(BrowserWindow *bw, DilloUrl *url, DilloImage *Image) { DilloWeb *Web; @@ -2198,7 +2198,7 @@ static void Html_tag_open_area(DilloHtml *html, const char *tag, int tagsize) const char *attrbuf; int link = -1; Shape *shape = NULL; - + if (!(html->InFlags & IN_MAP)) { BUG_MSG("<area> element not inside <map>\n"); return; @@ -2260,7 +2260,7 @@ static void Html_tag_open_area(DilloHtml *html, const char *tag, int tagsize) dReturn_if_fail ( url != NULL ); if ((attrbuf = a_Html_get_attr(html, tag, tagsize, "alt"))) a_Url_set_alt(url, attrbuf); - + link = Html_set_new_link(html, &url); } if (type == BACKGROUND) @@ -2283,7 +2283,7 @@ static void Html_tag_open_object(DilloHtml *html, const char *tag, int tagsize) if ((attrbuf = a_Html_get_attr(html, tag, tagsize, "codebase"))) { base_url = a_Html_url_new(html, attrbuf, NULL, 0); } - + if ((attrbuf = a_Html_get_attr(html, tag, tagsize, "data"))) { url = a_Html_url_new(html, attrbuf, URL_STR(base_url), (base_url != NULL)); @@ -2294,7 +2294,7 @@ static void Html_tag_open_object(DilloHtml *html, const char *tag, int tagsize) } else { html->styleEngine->setPseudoLink (); } - + props.set(PROPERTY_X_LINK, CSS_TYPE_INTEGER, Html_set_new_link(html, &url)); html->styleEngine->setNonCssHints (&props); @@ -2418,7 +2418,7 @@ static void Html_tag_close_a(DilloHtml *html, int TagIdx) /* * <BLOCKQUOTE> */ -static void Html_tag_open_blockquote(DilloHtml *html, +static void Html_tag_open_blockquote(DilloHtml *html, const char *tag, int tagsize) { DW2TB(html->dw)->addParbreak (9, html->styleEngine->wordStyle ()); @@ -2474,7 +2474,7 @@ static void Html_tag_open_ul(DilloHtml *html, const char *tag, int tagsize) props.set(CSS_PROPERTY_LIST_STYLE_TYPE, CSS_TYPE_ENUM, list_style_type); html->styleEngine->setNonCssHints (&props); - } + } DW2TB(html->dw)->addParbreak (9, html->styleEngine->wordStyle ()); Html_add_textblock(html, 9); @@ -2561,7 +2561,7 @@ static void Html_tag_open_li(DilloHtml *html, const char *tag, int tagsize) int *list_number; const char *attrbuf; char buf[16]; - + if (S_TOP(html)->list_type == HTML_LIST_NONE) BUG_MSG("<li> outside <ul> or <ol>\n"); @@ -2622,7 +2622,7 @@ static void Html_tag_open_hr(DilloHtml *html, const char *tag, int tagsize) char *width_ptr; const char *attrbuf; int32_t size = 0; - + width_ptr = a_Html_get_attr_wdef(html, tag, tagsize, "width", NULL); if (width_ptr) { props.set (CSS_PROPERTY_WIDTH, CSS_TYPE_LENGTH_PERCENTAGE, @@ -2632,9 +2632,9 @@ static void Html_tag_open_hr(DilloHtml *html, const char *tag, int tagsize) if ((attrbuf = a_Html_get_attr(html, tag, tagsize, "size"))) size = strtol(attrbuf, NULL, 10); - - a_Html_tag_set_align_attr(html, &props, tag, tagsize); - + + a_Html_tag_set_align_attr(html, &props, tag, tagsize); + /* TODO: evaluate attribute */ if (a_Html_get_attr(html, tag, tagsize, "noshade")) { props.set (CSS_PROPERTY_BORDER_TOP_STYLE, CSS_TYPE_ENUM, BORDER_SOLID); @@ -2645,15 +2645,15 @@ static void Html_tag_open_hr(DilloHtml *html, const char *tag, int tagsize) if (size <= 0) size = 1; } - - if (size > 0) { + + if (size > 0) { CssLength size_top = CSS_CREATE_LENGTH ((size+1)/2, CSS_LENGTH_TYPE_PX); CssLength size_bottom = CSS_CREATE_LENGTH (size / 2, CSS_LENGTH_TYPE_PX); props.set (CSS_PROPERTY_BORDER_TOP_WIDTH, CSS_TYPE_LENGTH_PERCENTAGE, size_top); - props.set (CSS_PROPERTY_BORDER_LEFT_WIDTH, CSS_TYPE_LENGTH_PERCENTAGE, + props.set (CSS_PROPERTY_BORDER_LEFT_WIDTH, CSS_TYPE_LENGTH_PERCENTAGE, size_top); - props.set (CSS_PROPERTY_BORDER_BOTTOM_WIDTH, CSS_TYPE_LENGTH_PERCENTAGE, + props.set (CSS_PROPERTY_BORDER_BOTTOM_WIDTH, CSS_TYPE_LENGTH_PERCENTAGE, size_bottom); props.set (CSS_PROPERTY_BORDER_RIGHT_WIDTH, CSS_TYPE_LENGTH_PERCENTAGE, size_bottom); @@ -2808,7 +2808,7 @@ static void Html_tag_open_meta(DilloHtml *html, const char *tag, int tagsize) html->stop_parser = true; /* The cache buffer is no longer valid */ a_UIcmd_repush(html->bw); } - } + } } } @@ -3436,7 +3436,7 @@ static void Html_process_tag(DilloHtml *html, char *tag, int tagsize) (tag[tagsize-2] == '/' && /* XML: */ (strchr(" \"'", tag[tagsize-3]) || /* [ "']/> */ (size_t)tagsize == strlen(Tags[ni].name) + 3))) { /* <x/> */ - + _MSG("Close: %s\n", Tags[ni].name); Html_tag_cleanup_at_close(html, ni); /* This was a close tag */ diff --git a/src/html_common.hh b/src/html_common.hh index c69b0271..8856825d 100644 --- a/src/html_common.hh +++ b/src/html_common.hh @@ -16,7 +16,7 @@ #include "styleengine.hh" /* - * Macros + * Macros */ // Dw to Textblock @@ -52,18 +52,18 @@ old_style->unref (); \ } while (FALSE) #else -#define HTML_SET_TOP_ATTR(html, var, val) +#define HTML_SET_TOP_ATTR(html, var, val) #endif /* - * Typedefs + * Typedefs */ typedef struct _DilloLinkImage DilloLinkImage; typedef struct _DilloHtmlState DilloHtmlState; typedef enum { - DT_NONE, - DT_HTML, + DT_NONE, + DT_HTML, DT_XHTML } DilloHtmlDocumentType; @@ -105,7 +105,7 @@ typedef enum { } DilloHtmlProcessingState; /* - * Data Structures + * Data Structures */ struct _DilloLinkImage { @@ -140,7 +140,7 @@ struct _DilloHtmlState { }; /* - * Classes + * Classes */ class DilloHtml { @@ -237,7 +237,7 @@ public: }; /* - * Parser functions + * Parser functions */ int a_Html_tag_index(const char *tag); diff --git a/src/menu.cc b/src/menu.cc index 9d03c439..ee9a1bda 100644 --- a/src/menu.cc +++ b/src/menu.cc @@ -41,7 +41,7 @@ static BrowserWindow *popup_bw = NULL; // Where to place the filemenu popup static int popup_x, popup_y; // History popup direction (-1 = back, 1 = forward). -static int history_direction = -1; +static int history_direction = -1; // History popup, list of URL-indexes. static int *history_list = NULL; @@ -115,7 +115,7 @@ static void Menu_link_cb(Widget*, void *user_data) a_Menu_link_popup(popup_bw, url); } -/* +/* * Open URL */ static void Menu_open_url_cb(Widget* ) @@ -124,7 +124,7 @@ static void Menu_open_url_cb(Widget* ) a_UIcmd_open_url(popup_bw, popup_url); } -/* +/* * Open URL in new window */ static void Menu_open_url_nw_cb(Widget* ) @@ -133,7 +133,7 @@ static void Menu_open_url_nw_cb(Widget* ) a_UIcmd_open_url_nw(popup_bw, popup_url); } -/* +/* * Open URL in new Tab */ static void Menu_open_url_nt_cb(Widget* ) @@ -143,7 +143,7 @@ static void Menu_open_url_nt_cb(Widget* ) a_UIcmd_open_url_nt(popup_bw, popup_url, focus); } -/* +/* * Add bookmark */ static void Menu_add_bookmark_cb(Widget* ) @@ -151,7 +151,7 @@ static void Menu_add_bookmark_cb(Widget* ) a_UIcmd_add_bookmark(popup_bw, popup_url); } -/* +/* * Find text */ static void Menu_find_text_cb(Widget* ) @@ -159,7 +159,7 @@ static void Menu_find_text_cb(Widget* ) ((UI *)popup_bw->ui)->set_findbar_visibility(1); } -/* +/* * Save link */ static void Menu_save_link_cb(Widget* ) @@ -167,7 +167,7 @@ static void Menu_save_link_cb(Widget* ) a_UIcmd_save_link(popup_bw, popup_url); } -/* +/* * Save current page */ static void Menu_save_page_cb(Widget* ) @@ -175,7 +175,7 @@ static void Menu_save_page_cb(Widget* ) a_UIcmd_save(popup_bw); } -/* +/* * View current page source */ static void Menu_view_page_source_cb(Widget* ) @@ -183,7 +183,7 @@ static void Menu_view_page_source_cb(Widget* ) a_UIcmd_view_page_source(popup_url); } -/* +/* * View current page's bugs */ static void Menu_view_page_bugs_cb(Widget* ) @@ -238,7 +238,7 @@ static void Menu_form_hiddens_cb(Widget *w, void *user_data) a_Html_form_display_hiddens(doc, v_form, !visible); } -/* +/* * Validate URL with the W3C */ static void Menu_bugmeter_validate_w3c_cb(Widget* ) @@ -251,7 +251,7 @@ static void Menu_bugmeter_validate_w3c_cb(Widget* ) dStr_free(dstr, 1); } -/* +/* * Validate URL with the WDG */ static void Menu_bugmeter_validate_wdg_cb(Widget* ) @@ -265,7 +265,7 @@ static void Menu_bugmeter_validate_wdg_cb(Widget* ) dStr_free(dstr, 1); } -/* +/* * Show info page for the bug meter */ static void Menu_bugmeter_about_cb(Widget* ) @@ -323,7 +323,7 @@ static void Menu_popup_cb2(void *data) /* * Page popup menu (construction & popup) */ -void a_Menu_page_popup(BrowserWindow *bw, const DilloUrl *url, +void a_Menu_page_popup(BrowserWindow *bw, const DilloUrl *url, bool_t has_bugs) { // One menu for every browser window @@ -345,13 +345,13 @@ void a_Menu_page_popup(BrowserWindow *bw, const DilloUrl *url, i->callback(Menu_view_page_bugs_cb); i = new Item("Bookmark this page"); i->callback(Menu_add_bookmark_cb); - new Divider(); + new Divider(); i = new Item("Find Text"); i->callback(Menu_find_text_cb); //i->shortcut(CTRL+'f'); i = new Item("Jump to..."); i->deactivate(); - new Divider(); + new Divider(); i = new Item("Save page As..."); i->callback(Menu_save_page_cb); @@ -387,12 +387,12 @@ void a_Menu_link_popup(BrowserWindow *bw, const DilloUrl *url) i->callback(Menu_open_url_nw_cb); i = new Item("Open Link in New Tab"); i->callback(Menu_open_url_nt_cb); - new Divider(); + new Divider(); i = new Item("Bookmark this Link"); i->callback(Menu_add_bookmark_cb); i = new Item("Copy Link location"); i->callback(Menu_copy_urlstr_cb); - new Divider(); + new Divider(); i = new Item("Save Link As..."); i->callback(Menu_save_link_cb); @@ -425,7 +425,7 @@ void a_Menu_image_popup(BrowserWindow *bw, const DilloUrl *url, popup_page_url = a_Url_dup(page_url); a_Url_free(popup_link_url); popup_link_url = a_Url_dup(link_url); - + if (!pm) { Item *i; pm = new PopupMenu(0,0,0,0,"&IMAGE OPTIONS"); @@ -561,7 +561,7 @@ void a_Menu_bugmeter_popup(BrowserWindow *bw, const DilloUrl *url) i->callback(Menu_bugmeter_validate_w3c_cb); i = new Item("Validate URL with WDG"); i->callback(Menu_bugmeter_validate_wdg_cb); - new Divider(); + new Divider(); i = new Item("About Bug Meter..."); i->callback(Menu_bugmeter_about_cb); pm->type(PopupMenu::POPUP123); @@ -614,7 +614,7 @@ void a_Menu_history_popup(BrowserWindow *bw, int direction) /* * Toggle use of remote stylesheets - */ + */ static void Menu_remote_css_cb(Widget *wid) { _MSG("Menu_remote_css_cb\n"); @@ -624,7 +624,7 @@ static void Menu_remote_css_cb(Widget *wid) /* * Toggle use of embedded CSS style - */ + */ static void Menu_embedded_css_cb(Widget *wid) { prefs.parse_embedded_css = wid->state() ? 1 : 0; @@ -633,7 +633,7 @@ static void Menu_embedded_css_cb(Widget *wid) /* * Toggle loading of images -- and load them if enabling. - */ + */ static void Menu_imgload_toggle_cb(Widget *wid) { if ((prefs.load_images = wid->state() ? 1 : 0)) { @@ -667,7 +667,7 @@ void a_Menu_tools_popup(BrowserWindow *bw, void *v_wid) it = new ToggleItem("Use embedded CSS"); it->callback(Menu_embedded_css_cb); it->state(prefs.parse_embedded_css); - new Divider(); + new Divider(); it = new ToggleItem("Load images"); it->callback(Menu_imgload_toggle_cb); it->state(prefs.load_images); @@ -150,7 +150,7 @@ int a_Misc_get_content_type_from_data(void *Data, size_t Size, const char **PT) * All in the above set regard [00-31] as control characters. * LATIN1: [7F-9F] unused * CP-1251 {7F,98} unused (two characters). - * + * * We'll use [0-31] as indicators of non-text content. * Better heuristics are welcomed! :-) */ @@ -546,7 +546,7 @@ void a_Nav_save_url(BrowserWindow *bw, { DilloWeb *Web = a_Web_new(url); Web->bw = bw; - Web->filename = dStrdup(filename); + Web->filename = dStrdup(filename); Web->flags |= WEB_Download; /* TODO: keep track of this client */ a_Capi_open_url(Web, Nav_save_cb, Web); diff --git a/src/plain.cc b/src/plain.cc index eefc6614..2fb725a3 100644 --- a/src/plain.cc +++ b/src/plain.cc @@ -109,7 +109,7 @@ DilloPlain::DilloPlain(BrowserWindow *p_bw, const DilloUrl *p_url) styleAttrs.margin.setVal (5); styleAttrs.font = style::Font::create (layout, &fontAttrs); styleAttrs.color = style::Color::create (layout, prefs.text_color); - styleAttrs.backgroundColor = + styleAttrs.backgroundColor = style::Color::create (layout, prefs.bg_color); widgetStyle = style::Style::create (layout, &styleAttrs); diff --git a/src/styleengine.cc b/src/styleengine.cc index a4d5003a..c7d8a39e 100644 --- a/src/styleengine.cc +++ b/src/styleengine.cc @@ -34,7 +34,7 @@ StyleEngine::StyleEngine (dw::core::Layout *layout) { font_attrs.size = (int) (14 * prefs.font_factor + 0.5); font_attrs.weight = 400; font_attrs.style = FONT_STYLE_NORMAL; - + style_attrs.initValues (); style_attrs.font = Font::create (layout, &font_attrs); style_attrs.color = Color::create (layout, 0); @@ -146,11 +146,11 @@ void StyleEngine::endElement (int element) { if (n->wordStyle) n->wordStyle->unref (); if (n->id) - dFree ((void*) n->id); + dFree ((void*) n->id); if (n->klass) - dFree ((void*) n->klass); + dFree ((void*) n->klass); if (n->styleAttribute) - dFree ((void*) n->styleAttribute); + dFree ((void*) n->styleAttribute); stack->setSize (stack->size () - 1); } @@ -167,19 +167,19 @@ void StyleEngine::apply (StyleAttrs *attrs, CssPropertyList *props) { */ for (int i = 0; i < props->size (); i++) { CssProperty *p = props->getRef (i); - + switch (p->name) { case CSS_PROPERTY_FONT_FAMILY: // \todo handle comma separated lists of font names if (strcmp (p->value.strVal, "serif") == 0) fontAttrs.name = prefs.font_serif; - else if (strcmp (p->value.strVal, "sans-serif") == 0) + else if (strcmp (p->value.strVal, "sans-serif") == 0) fontAttrs.name = prefs.font_sans_serif; - else if (strcmp (p->value.strVal, "cursive") == 0) + else if (strcmp (p->value.strVal, "cursive") == 0) fontAttrs.name = prefs.font_cursive; - else if (strcmp (p->value.strVal, "fantasy") == 0) + else if (strcmp (p->value.strVal, "fantasy") == 0) fontAttrs.name = prefs.font_fantasy; - else if (strcmp (p->value.strVal, "monospace") == 0) + else if (strcmp (p->value.strVal, "monospace") == 0) fontAttrs.name = prefs.font_monospace; else fontAttrs.name = p->value.strVal; @@ -268,29 +268,29 @@ void StyleEngine::apply (StyleAttrs *attrs, CssPropertyList *props) { for (int i = 0; i < props->size (); i++) { CssProperty *p = props->getRef (i); - + switch (p->name) { /* \todo missing cases */ case CSS_PROPERTY_BACKGROUND_COLOR: attrs->backgroundColor = Color::create (layout, p->value.intVal); - break; + break; case CSS_PROPERTY_BORDER_TOP_COLOR: attrs->borderColor.top = Color::create (layout, p->value.intVal); - break; + break; case CSS_PROPERTY_BORDER_BOTTOM_COLOR: attrs->borderColor.bottom = Color::create (layout, p->value.intVal); - break; + break; case CSS_PROPERTY_BORDER_LEFT_COLOR: attrs->borderColor.left = Color::create (layout, p->value.intVal); - break; + break; case CSS_PROPERTY_BORDER_RIGHT_COLOR: attrs->borderColor.right = Color::create (layout, p->value.intVal); - break; + break; case CSS_PROPERTY_BORDER_BOTTOM_STYLE: attrs->borderStyle.bottom = (BorderStyle) p->value.intVal; break; @@ -321,10 +321,10 @@ void StyleEngine::apply (StyleAttrs *attrs, CssPropertyList *props) { break; case CSS_PROPERTY_COLOR: attrs->color = Color::create (layout, p->value.intVal); - break; + break; case CSS_PROPERTY_CURSOR: attrs->cursor = (Cursor) p->value.intVal; - break; + break; case CSS_PROPERTY_LIST_STYLE_TYPE: attrs->listStyleType = (ListStyleType) p->value.intVal; break; @@ -383,15 +383,15 @@ void StyleEngine::apply (StyleAttrs *attrs, CssPropertyList *props) { } /* make sure border colors are set */ - if (attrs->borderColor.top == NULL) + if (attrs->borderColor.top == NULL) attrs->borderColor.top = attrs->color; - if (attrs->borderColor.bottom == NULL) + if (attrs->borderColor.bottom == NULL) attrs->borderColor.bottom = attrs->color; - if (attrs->borderColor.left == NULL) + if (attrs->borderColor.left == NULL) attrs->borderColor.left = attrs->color; - if (attrs->borderColor.right == NULL) + if (attrs->borderColor.right == NULL) attrs->borderColor.right = attrs->color; - + } /** @@ -487,7 +487,7 @@ Style * StyleEngine::style0 (CssPropertyList *nonCssProperties) { if (styleAttributeProps) delete styleAttributeProps; - + return stack->getRef (stack->size () - 1)->style; } diff --git a/src/styleengine.hh b/src/styleengine.hh index a17a350c..ffa13ac9 100644 --- a/src/styleengine.hh +++ b/src/styleengine.hh @@ -32,7 +32,7 @@ class StyleEngine : public Doctree { public: StyleEngine (dw::core::Layout *layout); ~StyleEngine (); - + /* Doctree interface */ inline const DoctreeNode *top () { return stack->getRef (stack->size () - 1); diff --git a/src/table.cc b/src/table.cc index 96a4e0ca..20981fde 100644 --- a/src/table.cc +++ b/src/table.cc @@ -28,7 +28,7 @@ using namespace dw::core; using namespace dw::core::style; /* - * Forward declarations + * Forward declarations */ static void Html_tag_open_table_cell(DilloHtml *html, @@ -228,7 +228,7 @@ void Html_tag_open_th(DilloHtml *html, const char *tag, int tagsize) } /* - * Utilities + * Utilities */ /* diff --git a/src/table.hh b/src/table.hh index 8068c184..aca717ba 100644 --- a/src/table.hh +++ b/src/table.hh @@ -2,13 +2,13 @@ #define __TABLE_HH__ /* - * Classes + * Classes */ class DilloHtml; /* - * Table parsing functions + * Table parsing functions */ void Html_tag_open_table(DilloHtml *html, const char *tag, int tagsize); @@ -99,7 +99,7 @@ public: }; /* - * Disable: UpKey, DownKey, PageUpKey, PageDownKey and + * Disable: UpKey, DownKey, PageUpKey, PageDownKey and * CTRL+{o,r,HomeKey,EndKey} */ int CustInput::handle(int e) @@ -385,7 +385,7 @@ PackedGroup *UI::make_toolbar(int tw, int th) b->tooltip("Next page"); b->callback(b1_cb, (void *)UI_FORW); b->clear_tab_to_focus(); - + Home = b = new HighlightButton(xpos, 0, bw, bh, (lbl) ? "Home" : 0); b->image(icons->ImgHome); b->tooltip("Go to the Home page"); @@ -397,13 +397,13 @@ PackedGroup *UI::make_toolbar(int tw, int th) b->tooltip("Reload"); b->callback(b1_cb, (void *)UI_RELOAD); b->clear_tab_to_focus(); - + Save = b = new HighlightButton(xpos, 0, bw, bh, (lbl) ? "Save" : 0); b->image(icons->ImgSave); b->tooltip("Save this page"); b->callback(b1_cb, (void *)UI_SAVE); b->clear_tab_to_focus(); - + Stop = b = new HighlightButton(xpos, 0, bw, bh, (lbl) ? "Stop" : 0); b->image(icons->ImgStopMulti); b->tooltip("Stop loading"); @@ -531,7 +531,7 @@ Group *UI::make_panel(int ww) icons = &small_icons; else icons = &standard_icons; - + if (PanelSize == P_tiny) { if (Small_Icons) xpos = 0, bw = 22, bh = 22, fh = 0, lh = 22, lbl = 0; @@ -595,7 +595,7 @@ Group *UI::make_panel(int ww) g2->resizable(pg); g2->end(); - + // Toolbar g3 = new Group(0,fh+lh,ww,bh); g3->begin(); @@ -611,12 +611,12 @@ Group *UI::make_panel(int ww) w = make_progress_bars(1,0); } pg->add(w); - + g3->resizable(pg); // Better than 'w3' and it also works pg->box(BORDER_FRAME); //g3->box(EMBOSSED_BOX); g3->end(); - + g1->resizable(g3); g1->end(); } @@ -626,7 +626,7 @@ Group *UI::make_panel(int ww) /* * User Interface constructor - */ + */ UI::UI(int x, int y, int ww, int wh, const char* label, const UI *cur_ui) : Group(x, y, ww, wh, label) { @@ -640,7 +640,7 @@ UI::UI(int x, int y, int ww, int wh, const char* label, const UI *cur_ui) : add(TopGroup); resizable(TopGroup); set_flag(RAW_LABEL); - + if (cur_ui) { PanelSize = cur_ui->PanelSize; CuteColor = cur_ui->CuteColor; @@ -675,7 +675,7 @@ UI::UI(int x, int y, int ww, int wh, const char* label, const UI *cur_ui) : // Find text bar findbar = new Findbar(ww, 28); - TopGroup->add(findbar); + TopGroup->add(findbar); // Status Panel StatusPanel = new Group(0, 0, ww, s_h, 0); @@ -702,7 +702,7 @@ UI::UI(int x, int y, int ww, int wh, const char* label, const UI *cur_ui) : StatusPanel->resizable(Status); - TopGroup->add(StatusPanel); + TopGroup->add(StatusPanel); // Make the full screen button (to be attached to the viewport later) // TODO: attach to the viewport @@ -902,7 +902,7 @@ void UI::set_img_prog(int n_img, int t_img, int cmd) } else { IProg->activate(); if (cmd == 1) { - snprintf(str, 32, "%s%d of %d", + snprintf(str, 32, "%s%d of %d", (PanelSize == 0) ? "" : "Images\n", n_img, t_img); } else if (cmd == 2) { str[0] = '\0'; diff --git a/src/uicmd.cc b/src/uicmd.cc index 05b1a523..4bcbec7b 100644 --- a/src/uicmd.cc +++ b/src/uicmd.cc @@ -76,7 +76,7 @@ public: return 1; } // Avoid focus change. - return 0; + return 0; } } return TabGroup::handle(e); @@ -207,7 +207,7 @@ BrowserWindow *a_UIcmd_browser_window_new(int ww, int wh, const void *vbw) viewport->setBufferedDrawing (true); else viewport->setBufferedDrawing (false); - + layout->attachView (viewport); new_ui->set_render_layout(*viewport); @@ -259,7 +259,7 @@ static BrowserWindow *UIcmd_tab_new(const void *vbw) Layout *layout = new Layout (platform); FltkViewport *viewport = new FltkViewport (0, 0, 1, 1); - + layout->attachView (viewport); new_ui->set_render_layout(*viewport); @@ -508,7 +508,7 @@ void a_UIcmd_save(void *vbw) if (name) { a_Nav_save_url(bw, url, name); } - } + } } /* @@ -953,7 +953,7 @@ void a_UIcmd_fullscreen_toggle(BrowserWindow *bw) void a_UIcmd_findtext_search(BrowserWindow *bw, const char *key, int case_sens, int backwards) { Layout *l = (Layout *)bw->render_layout; - + switch (l->search(key, case_sens, backwards)) { case FindtextState::RESTART: a_UIcmd_set_msg(bw, "No further occurrences of \"%s\". " @@ -81,7 +81,7 @@ int a_Web_dispatch_by_type (const char *Type, DilloWeb *Web, styleAttrs.margin.setVal (5); styleAttrs.font = style::Font::create (layout, &fontAttrs); styleAttrs.color = style::Color::create (layout, 0xff0000); - styleAttrs.backgroundColor = + styleAttrs.backgroundColor = style::Color::create (layout, prefs.bg_color); widgetStyle = style::Style::create (layout, &styleAttrs); dw->setStyle (widgetStyle); |