changeset 1142:fd2b0634abe9

style
author Johannes Hofmann <Johannes.Hofmann@gmx.de>
date Fri, 29 May 2009 07:51:19 +0200
parents 37306557a63c
children fb3c5485a863
files src/plain.cc src/xembed.cc src/xembed.hh
diffstat 3 files changed, 29 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/src/plain.cc	Fri May 29 03:23:34 2009 +0000
+++ b/src/plain.cc	Fri May 29 07:51:19 2009 +0200
@@ -135,6 +135,7 @@
    return false;
 }
 
+#define MAXWORD 500
 /*
  * Here we parse plain text and put it into the page structure.
  * (This function is called by Plain_callback whenever there's new data)
@@ -161,7 +162,15 @@
          break;
       case ST_Eol:
          data = a_Misc_expand_tabs(Start + i - len, len);
-         DW2TB(dw)->addText(data, widgetStyle);
+         char *dp = data;
+         while (strlen (dp) > MAXWORD) {
+            char save = data[MAXWORD];
+            dp[MAXWORD] = '\0';
+            DW2TB(dw)->addText(dp, widgetStyle);
+            dp[MAXWORD] = save;
+            dp += MAXWORD;
+         }
+         DW2TB(dw)->addText(dp, widgetStyle);
          DW2TB(dw)->addParbreak(0, widgetStyle);
          dFree(data);
          if (Start[i] == '\r' && Start[i + 1] == '\n') ++i;
@@ -174,7 +183,15 @@
    Start_Ofs += i - len;
    if (Eof && len) {
       data = a_Misc_expand_tabs(Start + i - len, len);
-      DW2TB(dw)->addText(data, widgetStyle);
+      char *dp = data;
+      while (strlen (dp) > MAXWORD) {
+         char save = data[MAXWORD];
+         dp[MAXWORD] = '\0';
+         DW2TB(dw)->addText(dp, widgetStyle);
+         dp[MAXWORD] = save;
+         dp += MAXWORD;
+      }
+      DW2TB(dw)->addText(dp, widgetStyle);
       DW2TB(dw)->addParbreak(0, widgetStyle);
       dFree(data);
       Start_Ofs += len;
--- a/src/xembed.cc	Fri May 29 03:23:34 2009 +0000
+++ b/src/xembed.cc	Fri May 29 07:51:19 2009 +0200
@@ -37,16 +37,16 @@
   buffer[1] = flags;
 
   XChangeProperty (fltk::xdisplay,
-           xid,
-           xembed_info_atom, xembed_info_atom, 32,
-           PropModeReplace,
-           (unsigned char *)buffer, 2);
+     xid,
+     xembed_info_atom, xembed_info_atom, 32,
+     PropModeReplace,
+     (unsigned char *)buffer, 2);
 }
 
 void
 Xembed::sendXembedEvent(uint32_t message) {
    XClientMessageEvent xclient;
-   
+
    memset (&xclient, 0, sizeof (xclient));
    xclient.window = xid;
    xclient.type = ClientMessage;
@@ -94,12 +94,12 @@
 // TODO; Implement more XEMBED support;
 
 void Xembed::create() {
-   create_internal(xid);
+   createInternal(xid);
    setXembedInfo(1);
    fltk::add_event_handler(event_handler);
 }
 
-void Xembed::create_internal(uint32_t parent) {
+void Xembed::createInternal(uint32_t parent) {
    fltk::Window *window = this;
    Colormap colormap = fltk::xcolormap;
 
--- a/src/xembed.hh	Fri May 29 03:23:34 2009 +0000
+++ b/src/xembed.hh	Fri May 29 07:51:19 2009 +0200
@@ -6,14 +6,15 @@
 #include "d_size.h"
 
 class Xembed : public fltk::Window {
+   private:
       uint32_t xid;
-      void create_internal(uint32_t parent);
+      void createInternal(uint32_t parent);
       void setXembedInfo(unsigned long flags);
       void sendXembedEvent(uint32_t message);
 
    public:
       Xembed(uint32_t xid, int _w, int _h) : fltk::Window(_w, _h) {
-           this->xid = xid;
+         this->xid = xid;
       };
       void create();
       int handle(int event);