From f09e17c3c564e8310125a10c03397cbf473ff643 Mon Sep 17 00:00:00 2001 From: Albrecht Schlosser Date: Wed, 1 Jul 2020 18:03:10 +0200 Subject: Remove $Id$ tags, update URL's, and more - remove obsolete svn '$Id$' tags from all source files - update .fl files and generated files accordingly - replace 'http://www.fltk.org' URL's with 'https://...' - replace bug report URL 'str.php' with 'bugs.php' - remove trailing whitespace - fix other whitespace errors flagged by Git - add and/or fix missing or wrong standard headers - convert tabs to spaces in all source files The only relevant code changes are in the fluid/ folder where some .fl files and other source files were used to generate the '$Id' headers and footers. --- src/fl_draw.cxx | 56 +++++++++++++++++++++++++------------------------------- 1 file changed, 25 insertions(+), 31 deletions(-) (limited to 'src/fl_draw.cxx') diff --git a/src/fl_draw.cxx b/src/fl_draw.cxx index 79a1f990a..64d78f849 100644 --- a/src/fl_draw.cxx +++ b/src/fl_draw.cxx @@ -1,6 +1,4 @@ // -// "$Id$" -// // Label drawing code for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2020 by Bill Spitzak and others. @@ -11,9 +9,9 @@ // // https://www.fltk.org/COPYING.php // -// Please report all bugs and problems on the following page: +// Please see the following page on how to report bugs and issues: // -// https://www.fltk.org/str.php +// https://www.fltk.org/bugs.php // // Implementation of fl_draw(const char*,int,int,int,int,Fl_Align) @@ -27,14 +25,14 @@ #include #include #include -#include // fl_open_display() +#include // fl_open_display() #include "flstring.h" #include #include -char fl_draw_shortcut; // set by fl_labeltypes.cxx +char fl_draw_shortcut; // set by fl_labeltypes.cxx static char* underline_at; @@ -42,7 +40,7 @@ static char* underline_at; Otherwise, use buf as buffer but don't go beyond its length of maxbuf. */ static const char* expand_text_(const char* from, char*& buf, int maxbuf, double maxw, int& n, - double &width, int wrap, int draw_symbols) { + double &width, int wrap, int draw_symbols) { char* e = buf+(maxbuf-4); underline_at = 0; double w = 0; @@ -64,14 +62,14 @@ static const char* expand_text_(const char* from, char*& buf, int maxbuf, double if (!c || c == ' ' || c == '\n') { // test for word-wrap: if (word_start < p && wrap) { - double newwidth = w + fl_width(word_end, (int) (o-word_end) ); - if (word_end > buf && int(newwidth) > maxw) { // break before this word - o = word_end; - p = word_start; - break; - } - word_end = o; - w = newwidth; + double newwidth = w + fl_width(word_end, (int) (o-word_end) ); + if (word_end > buf && int(newwidth) > maxw) { // break before this word + o = word_end; + p = word_start; + break; + } + word_end = o; + w = newwidth; } if (!c) break; else if (c == '\n') {p++; break;} @@ -123,7 +121,7 @@ static const char* expand_text_(const char* from, char*& buf, int maxbuf, double */ const char* fl_expand_text(const char* from, char* buf, int maxbuf, double maxw, int& n, - double &width, int wrap, int draw_symbols) { + double &width, int wrap, int draw_symbols) { return expand_text_(from, buf, maxbuf, maxw, n, width, wrap, draw_symbols); } @@ -133,8 +131,8 @@ fl_expand_text(const char* from, char* buf, int maxbuf, double maxw, int& n, function such as fl_draw(const char*, int, int, int) to do the real work */ void fl_draw( - const char* str, // the (multi-line) string - int x, int y, int w, int h, // bounding box + const char* str, // the (multi-line) string + int x, int y, int w, int h, // bounding box Fl_Align align, void (*callthis)(const char*,int,int,int), Fl_Image* img, int draw_symbols) @@ -252,7 +250,7 @@ void fl_draw( int desc = fl_descent(); for (p=str; ; ypos += height) { if (lines>1) e = expand_text_(p, linebuf, 0, w - symtotal - imgtotal, buflen, - width, align&FL_ALIGN_WRAP, draw_symbols); + width, align&FL_ALIGN_WRAP, draw_symbols); else e = ""; if (width > symoffset) symoffset = (int)(width + 0.5); @@ -264,7 +262,7 @@ void fl_draw( callthis(linebuf,buflen,xpos,ypos-desc); if (underline_at && underline_at >= linebuf && underline_at < (linebuf + buflen)) - callthis("_",1,xpos+int(fl_width(linebuf,(int) (underline_at-linebuf))),ypos-desc); + callthis("_",1,xpos+int(fl_width(linebuf,(int) (underline_at-linebuf))),ypos-desc); if (!*e || (*e == '@' && e[1] != '@')) break; p = e; @@ -379,16 +377,16 @@ void fl_measure(const char* str, int& w, int& h, int draw_symbols) { int W = 0; int symwidth[2], symtotal; - symwidth[0] = 0; // size of symbol at beginning of string (if any) - symwidth[1] = 0; // size of symbol at end of string (if any) + symwidth[0] = 0; // size of symbol at beginning of string (if any) + symwidth[1] = 0; // size of symbol at end of string (if any) if (draw_symbols) { // Symbol at beginning of string? - const char *sym2 = (str[0]=='@' && str[1]=='@') ? str+2 : str; // sym2 check will skip leading @@ + const char *sym2 = (str[0]=='@' && str[1]=='@') ? str+2 : str; // sym2 check will skip leading @@ if (str[0] == '@' && str[1] != '@') { - while (*str && !isspace(*str)) { ++str; } // skip over symbol - if (isspace(*str)) ++str; // skip over trailing space - sym2 = str; // sym2 check will skip leading symbol + while (*str && !isspace(*str)) { ++str; } // skip over symbol + if (isspace(*str)) ++str; // skip over trailing space + sym2 = str; // sym2 check will skip leading symbol symwidth[0] = h; } // Symbol at end of string? @@ -402,7 +400,7 @@ void fl_measure(const char* str, int& w, int& h, int draw_symbols) { for (p = str, lines=0; p;) { // e = expand(p, linebuf, w - symtotal, buflen, width, w != 0, draw_symbols); e = expand_text_(p, linebuf, 0, w - symtotal, buflen, width, - w != 0, draw_symbols); + w != 0, draw_symbols); if ((int)ceil(width) > W) W = (int)ceil(width); lines++; if (!*e || (*e == '@' && e[1] != '@' && draw_symbols)) break; @@ -460,7 +458,3 @@ int fl_height(int font, int size) { fl_font(tf,ts); // restore return(height); } - -// -// End of "$Id$". -// -- cgit v1.2.3