STR #2714: remove new shadow lint for MacOS

This commit is contained in:
Matthias Melcher
2019-02-02 17:47:55 +01:00
parent 76668c7cc1
commit 452a410a3e
22 changed files with 135 additions and 133 deletions
+5 -5
View File
@@ -360,13 +360,13 @@ public:
/** see fl_color(uchar, uchar, uchar) */
virtual void color(uchar r, uchar g, uchar b) {}
/** see fl_draw(const char *str, int n, int x, int y) */
virtual void draw(const char *str, int n, int x, int y) {}
virtual void draw(const char *str, int nChars, int x, int y) {}
/** Draw the first \p n bytes of the string \p str starting at position \p x , \p y */
virtual void draw(const char *str, int n, float x, float y) { draw(str, n, (int)(x+0.5), (int)(y+0.5));}
virtual void draw(const char *str, int nChars, float x, float y) { draw(str, nChars, (int)(x+0.5), (int)(y+0.5));}
/** see fl_draw(int angle, const char *str, int n, int x, int y) */
virtual void draw(int angle, const char *str, int n, int x, int y) { draw(str, n, x, y); }
virtual void draw(int angle, const char *str, int nChars, int x, int y) { draw(str, nChars, x, y); }
/** see fl_rtl_draw(const char *str, int n, int x, int y) */
virtual void rtl_draw(const char *str, int n, int x, int y) { draw(str, n, x, y); }
virtual void rtl_draw(const char *str, int nChars, int x, int y) { draw(str, nChars, x, y); }
/** Returns non-zero if the graphics driver possesses the \p feature */
virtual int has_feature(driver_feature feature) { return 0; }
/** see fl_font(Fl_Font, Fl_Fontsize) */
@@ -376,7 +376,7 @@ public:
/** Return the current font size */
virtual Fl_Fontsize size() {return size_; }
/** Compute the width of the first \p n bytes of the string \p str if drawn with current font */
virtual double width(const char *str, int n) { return 0; }
virtual double width(const char *str, int nChars) { return 0; }
/** Compute the width of Unicode character \p c if drawn with current font */
virtual double width(unsigned int c) { char ch = (char)c; return width(&ch, 1); }
virtual void text_extents(const char*, int n, int& dx, int& dy, int& w, int& h);
+1 -1
View File
@@ -228,7 +228,7 @@ public:
~Fl_PostScript_Graphics_Driver();
// ---
Fl_Bitmask create_bitmask(int w, int h, const uchar *array) { return 0L; }
virtual int has_feature(driver_feature mask) { return mask & PRINTER; }
virtual int has_feature(driver_feature feature_mask) { return feature_mask & PRINTER; }
};
/**
+3 -3
View File
@@ -798,9 +798,9 @@ Fl_File_Chooser::fileNameCB()
}
// Make sure we have an absolute path...
int condition = directory_[0] != '\0' && filename[0] != '/';
if (condition && Fl::system_driver()->colon_is_drive()) condition = !(isalpha(filename[0] & 255) && (!filename[1] || filename[1] == ':'));
if (condition) {
int dirIsRelative = directory_[0] != '\0' && filename[0] != '/';
if (dirIsRelative && Fl::system_driver()->colon_is_drive()) dirIsRelative = !(isalpha(filename[0] & 255) && (!filename[1] || filename[1] == ':'));
if (dirIsRelative) {
fl_filename_absolute(pathname, sizeof(pathname), filename);
value(pathname);
fileName->mark(fileName->position()); // no selection after expansion
+2 -2
View File
@@ -61,9 +61,9 @@ Fl_Graphics_Driver &Fl_Graphics_Driver::default_driver()
/** see fl_text_extents() */
void Fl_Graphics_Driver::text_extents(const char*t, int n, int& dx, int& dy, int& w, int& h)
void Fl_Graphics_Driver::text_extents(const char*t, int nChars, int& dx, int& dy, int& w, int& h)
{
w = (int)width(t, n);
w = (int)width(t, nChars);
h = - height();
dx = 0;
dy = descent();
+8 -8
View File
@@ -123,25 +123,25 @@ const char *Fl_Mac_App_Menu::quit = "Quit %@";
[self setState:(item->value() ? NSOnState : NSOffState)];
}
else if ( item->flags & FL_MENU_RADIO ) { // update the menu radio symbols
NSMenu* menu = [self menu];
NSInteger flRank = [menu indexOfItem:self];
NSInteger last = [menu numberOfItems] - 1;
NSMenu* this_menu = [self menu];
NSInteger flRank = [this_menu indexOfItem:self];
NSInteger last = [this_menu numberOfItems] - 1;
int from = flRank;
while(from > 0) {
if ([[menu itemAtIndex:from-1] isSeparatorItem]) break;
item = [(FLMenuItem*)[menu itemAtIndex:from-1] getFlItem];
if ([[this_menu itemAtIndex:from-1] isSeparatorItem]) break;
item = [(FLMenuItem*)[this_menu itemAtIndex:from-1] getFlItem];
if ( !(item->flags & FL_MENU_RADIO) ) break;
from--;
}
int to = flRank;
while (to < last) {
if ([[menu itemAtIndex:to+1] isSeparatorItem]) break;
item = [(FLMenuItem*)[menu itemAtIndex:to+1] getFlItem];
if ([[this_menu itemAtIndex:to+1] isSeparatorItem]) break;
item = [(FLMenuItem*)[this_menu itemAtIndex:to+1] getFlItem];
if (!(item->flags & FL_MENU_RADIO)) break;
to++;
}
for(int i = from; i <= to; i++) {
NSMenuItem *nsitem = [menu itemAtIndex:i];
NSMenuItem *nsitem = [this_menu itemAtIndex:i];
[nsitem setState:(nsitem != self ? NSOffState : NSOnState)];
}
}
+14 -12
View File
@@ -1028,30 +1028,32 @@ const Fl_Menu_Item* Fl_Menu_Item::pulldown(
The selected item (or NULL if none) is returned. <I>This does not
do the callbacks or change the state of check or radio items.</I>
X,Y is the position of the mouse cursor, relative to the
window that got the most recent event (usually you can pass
Fl::event_x() and Fl::event_y() unchanged here).
\p title is a character string title for the menu. If
non-zero a small box appears above the menu with the title in it.
The menu is positioned so the cursor is centered over the item
The menu is positioned so the cursor is centered over the item
picked. This will work even if \p picked is in a submenu.
If \p picked is zero or not in the menu item table the menu is
positioned with the cursor in the top-left corner.
\p button is a pointer to an Fl_Menu_ from which the color and
\param[in] X,Y the position of the mouse cursor, relative to the
window that got the most recent event (usually you can pass
Fl::event_x() and Fl::event_y() unchanged here).
\param[in] title a character string title for the menu. If
non-zero a small box appears above the menu with the title in it.
\param[in] menu_button is a pointer to an Fl_Menu_ from which the color and
boxtypes for the menu are pulled. If NULL then defaults are used.
\return a pointer to the menu item selected by the user, or NULL
*/
const Fl_Menu_Item* Fl_Menu_Item::popup(
int X, int Y,
const char* title,
const Fl_Menu_Item* picked,
const Fl_Menu_* button
) const {
const Fl_Menu_* menu_button
) const {
static Fl_Menu_Item dummy; // static so it is all zeros
dummy.text = title;
return pulldown(X, Y, 0, 0, picked, button, title ? &dummy : 0);
return pulldown(X, Y, 0, 0, picked, menu_button, title ? &dummy : 0);
}
/**
+3 -3
View File
@@ -192,9 +192,9 @@ Fl_RGB_Image *Fl_Screen_Driver::traverse_to_gl_subwindows(Fl_Group *g, int x, in
Fl_RGB_Image *full_img)
{
if ( g->as_gl_window() ) {
Fl_Device_Plugin *pi = Fl_Device_Plugin::opengl_plugin();
if (!pi) return full_img;
full_img = pi->rectangle_capture(g, x, y, w, h);
Fl_Device_Plugin *plugin = Fl_Device_Plugin::opengl_plugin();
if (!plugin) return full_img;
full_img = plugin->rectangle_capture(g, x, y, w, h);
}
else if ( g->as_window() ) {
if (Fl_Window::current() != g) g->as_window()->make_current();
+2 -2
View File
@@ -204,7 +204,7 @@ int Fl_Tabs::handle(int event) {
return 1;
case FL_MOVE: {
int ret = Fl_Group::handle(event);
Fl_Widget *o = Fl_Tooltip::current(), *n = o;
Fl_Widget *tooltip_widget = Fl_Tooltip::current(), *n = tooltip_widget;
int H = tab_height();
if ( (H>=0) && (Fl::event_y()>y()+H) )
return ret;
@@ -214,7 +214,7 @@ int Fl_Tabs::handle(int event) {
n = which(Fl::event_x(), Fl::event_y());
if (!n) n = this;
}
if (n!=o)
if (n!=tooltip_widget)
Fl_Tooltip::enter(n);
return ret; }
case FL_FOCUS:
+6 -6
View File
@@ -71,7 +71,7 @@ public:
Fl_Widget* Fl_Tooltip::widget_ = 0;
static Fl_TooltipBox *window = 0;
static int Y,H;
static int currentTooltipY, currentTooltipH;
Fl_Window *Fl_Tooltip::current_window(void)
{
@@ -88,7 +88,7 @@ void Fl_TooltipBox::layout() {
// find position on the screen of the widget:
int ox = Fl::event_x_root();
int oy = Y + H+2;
int oy = currentTooltipY + currentTooltipH+2;
for (Fl_Widget* p = Fl_Tooltip::current(); p; p = p->window()) {
oy += p->y();
}
@@ -96,11 +96,11 @@ void Fl_TooltipBox::layout() {
Fl::screen_xywh(scr_x, scr_y, scr_w, scr_h);
if (ox+ww > scr_x+scr_w) ox = scr_x+scr_w - ww;
if (ox < scr_x) ox = scr_x;
if (H > 30) {
if (currentTooltipH > 30) {
oy = Fl::event_y_root()+13;
if (oy+hh > scr_y+scr_h) oy -= 23+hh;
} else {
if (oy+hh > scr_y+scr_h) oy -= (4+hh+H);
if (oy+hh > scr_y+scr_h) oy -= (4+hh+currentTooltipH);
}
if (oy < scr_y) oy = scr_y;
@@ -277,11 +277,11 @@ void Fl_Tooltip::enter_area(Fl_Widget* wid, int x,int y,int w,int h, const char*
return;
}
// do nothing if it is the same:
if (wid==widget_ /*&& x==X && y==Y && w==W && h==H*/ && t==tip) return;
if (wid==widget_ /*&& x==X && y==currentTooltipY && w==W && h==currentTooltipH*/ && t==tip) return;
Fl::remove_timeout(tooltip_timeout);
Fl::remove_timeout(recent_timeout);
// remember it:
widget_ = wid; Y = y; H = h; tip = t;
widget_ = wid; currentTooltipY = y; currentTooltipH = h; tip = t;
// popup the tooltip immediately if it was recently up:
if (recent_tooltip) {
if (window) window->hide();
+5 -5
View File
@@ -1163,17 +1163,17 @@ void Fl_Tree_Item::draw(int X, int &Y, int W, Fl_Tree_Item *itemfocus,
int child_w = W - (child_x-X);
int child_y_start = Y;
for ( int t=0; t<children(); t++ ) {
int lastchild = ((t+1)==children()) ? 1 : 0;
_children[t]->draw(child_x, Y, child_w, itemfocus, tree_item_xmax, lastchild, render);
int is_lastchild = ((t+1)==children()) ? 1 : 0;
_children[t]->draw(child_x, Y, child_w, itemfocus, tree_item_xmax, is_lastchild, render);
}
if ( has_children() && is_open() ) {
Y += prefs.openchild_marginbottom(); // offset below open child tree
}
if ( ! lastchild ) {
// Special 'clipped' calculation. (intentional variable shadowing)
int clipped = ((child_y_start < tree_top) && (Y < tree_top)) ||
((child_y_start > tree_bot) && (Y > tree_bot));
if (render && !clipped )
int is_clipped = ((child_y_start < tree_top) && (Y < tree_top)) ||
((child_y_start > tree_bot) && (Y > tree_bot));
if (render && !is_clipped )
draw_vertical_connector(hconn_x, child_y_start, Y, prefs);
}
}
+10 -10
View File
@@ -68,9 +68,9 @@ void Fl_Widget_Surface::draw(Fl_Widget* widget, int delta_x, int delta_y)
// we do some trickery to recognize OpenGL windows and draw them via a plugin
int drawn_by_plugin = 0;
if (widget->as_gl_window()) {
Fl_Device_Plugin *pi = Fl_Device_Plugin::opengl_plugin();
if (pi) {
drawn_by_plugin = pi->print(widget);
Fl_Device_Plugin *plugin = Fl_Device_Plugin::opengl_plugin();
if (plugin) {
drawn_by_plugin = plugin->print(widget);
}
}
if (!drawn_by_plugin) {
@@ -177,11 +177,11 @@ int Fl_Widget_Surface::printable_rect(int *w, int *h) {return 1;}
/** Draws a window with its title bar and frame if any.
\p x_offset and \p y_offset are optional coordinates of where to position the window top left.
\p win_offset_x and \p win_offset_y are optional coordinates of where to position the window top left.
Equivalent to draw() if \p win is a subwindow or has no border.
Use Fl_Window::decorated_w() and Fl_Window::decorated_h() to get the size of the window.
*/
void Fl_Widget_Surface::draw_decorated_window(Fl_Window *win, int x_offset, int y_offset)
void Fl_Widget_Surface::draw_decorated_window(Fl_Window *win, int win_offset_x, int win_offset_y)
{
Fl_RGB_Image *top=0, *left=0, *bottom=0, *right=0;
if (win->border() && !win->parent()) {
@@ -190,22 +190,22 @@ void Fl_Widget_Surface::draw_decorated_window(Fl_Window *win, int x_offset, int
int wsides = left ? left->w() : 0;
int toph = top ? top->h() : 0;
if (top) {
top->draw(x_offset, y_offset);
top->draw(win_offset_x, win_offset_y);
delete top;
}
if (left) {
left->draw(x_offset, y_offset + toph);
left->draw(win_offset_x, win_offset_y + toph);
delete left;
}
if (right) {
right->draw(x_offset + wsides + win->w(), y_offset + toph);
right->draw(win_offset_x + wsides + win->w(), win_offset_y + toph);
delete right;
}
if (bottom) {
bottom->draw(x_offset, y_offset + toph + win->h());
bottom->draw(win_offset_x, win_offset_y + toph + win->h());
delete bottom;
}
this->draw(win, x_offset + wsides, y_offset + toph);
this->draw(win, win_offset_x + wsides, win_offset_y + toph);
}
//
+25 -25
View File
@@ -587,23 +587,7 @@ int Fl_Window::handle(int ev)
/**
Sets the allowable range the user can resize this window to.
This only works for top-level windows.
<UL>
<LI>\p minw and \p minh are the smallest the window can be.
Either value must be greater than 0.</LI>
<LI>\p maxw and \p maxh are the largest the window can be. If either is
<I>equal</I> to the minimum then you cannot resize in that direction.
If either is zero then FLTK picks a maximum size in that direction
such that the window will fill the screen.</LI>
<LI>\p dw and \p dh are size increments. The window will be constrained
to widths of minw + N * dw, where N is any non-negative integer.
If these are less or equal to 1 they are ignored (this is ignored
on Windows).</LI>
<LI>\p aspect is a flag that indicates that the window should preserve its
aspect ratio. This only works if both the maximum and minimum have
the same aspect ratio (ignored on Windows and by many X window managers).
</LI>
</UL>
If this function is not called, FLTK tries to figure out the range
from the setting of resizable():
<UL>
@@ -619,15 +603,31 @@ int Fl_Window::handle(int ev)
It is undefined what happens if the current size does not fit in the
constraints passed to size_range().
\param[in] minWidth, minHeight The smallest the window can be.
Either value must be greater than 0.
\param[in] maxWidth, maxHeight The largest the window can be. If either is
equal to the minimum then you cannot resize in that direction.
If either is zero then FLTK picks a maximum size in that direction
such that the window will fill the screen.
\param[in] deltaX, deltaY These are size increments. The window will be
constrained to widths of <tt>minWidth + N * deltaX</tt>, where N is any
non-negative integer. If these are less or equal to 1 they are ignored.
(this is ignored on Windows)
\param[in] aspectRatio A flag that indicates that the window should preserve
its aspect ratio. This only works if both the maximum and minimum have
the same aspect ratio (ignored on Windows and by many X window managers).
*/
void Fl_Window::size_range(int minw, int minh, int maxw, int maxh, int dw, int dh, int aspect) {
this->minw = minw;
this->minh = minh;
this->maxw = maxw;
this->maxh = maxh;
this->dw = dw;
this->dh = dh;
this->aspect = aspect;
void Fl_Window::size_range(int minWidth, int minHeight,
int maxWidth, int maxHeight,
int deltaX, int deltaY, int aspectRatio) {
minw = minWidth;
minh = minHeight;
maxw = maxWidth;
maxh = maxHeight;
dw = deltaX;
dh = deltaY;
aspect = aspectRatio;
pWindowDriver->size_range();
}
+6 -6
View File
@@ -2204,9 +2204,9 @@ static FLTextInputContext* fltextinputcontext_instance = nil;
Fl_Cocoa_Window_Driver *d = Fl_Cocoa_Window_Driver::driver(window);
[self did_view_resolution_change];
if (d->wait_for_expose_value) { // 1st drawing of layer-backed GL window
Fl_Device_Plugin *pi = Fl_Device_Plugin::opengl_plugin();
if (pi) {
[pi->context(window) update]; // layer-backed GL windows may be empty without this
Fl_Device_Plugin *plugin = Fl_Device_Plugin::opengl_plugin();
if (plugin) {
[plugin->context(window) update]; // layer-backed GL windows may be empty without this
}
d->wait_for_expose_value = 0;
}
@@ -4265,9 +4265,9 @@ static NSBitmapImageRep* GL_rect_to_nsbitmap(Fl_Window *win, int x, int y, int w
// captures a rectangle from a GL window and returns it as an allocated NSBitmapImageRep
// the capture has high res on retina
{
Fl_Device_Plugin *pi = Fl_Device_Plugin::opengl_plugin();
if (!pi) return nil;
Fl_RGB_Image *img = pi->rectangle_capture(win, x, y, w, h);
Fl_Device_Plugin *plugin = Fl_Device_Plugin::opengl_plugin();
if (!plugin) return nil;
Fl_RGB_Image *img = plugin->rectangle_capture(win, x, y, w, h);
NSBitmapImageRep* bitmap = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL pixelsWide:img->w() pixelsHigh:img->h() bitsPerSample:8 samplesPerPixel:4 hasAlpha:YES isPlanar:NO colorSpaceName:NSDeviceRGBColorSpace bytesPerRow:4*img->w() bitsPerPixel:32];
memset([bitmap bitmapData], 0xFF, [bitmap bytesPerPlane]);
const uchar *from = img->array;
+5 -5
View File
@@ -106,13 +106,13 @@ void Fl_Cocoa_Window_Driver::destroy_double_buffer()
void Fl_Cocoa_Window_Driver::draw_begin()
{
if (!Fl_Surface_Device::surface()->driver()->has_feature(Fl_Graphics_Driver::NATIVE)) return;
CGContextRef gc = (CGContextRef)Fl_Surface_Device::surface()->driver()->gc();
CGContextRef my_gc = (CGContextRef)Fl_Surface_Device::surface()->driver()->gc();
if (shape_data_) {
# if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
if (shape_data_->mask && (&CGContextClipToMask != NULL)) {
CGContextClipToMask(gc, CGRectMake(0,0,w(),h()), shape_data_->mask); // requires Mac OS 10.4
CGContextClipToMask(my_gc, CGRectMake(0,0,w(),h()), shape_data_->mask); // requires Mac OS 10.4
}
CGContextSaveGState(gc);
CGContextSaveGState(my_gc);
# endif
}
}
@@ -143,8 +143,8 @@ void Fl_Cocoa_Window_Driver::draw_end()
}
# if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
if (Fl_Surface_Device::surface()->driver()->has_feature(Fl_Graphics_Driver::NATIVE)) {
CGContextRef gc = (CGContextRef)Fl_Surface_Device::surface()->driver()->gc();
if (shape_data_) CGContextRestoreGState(gc);
CGContextRef my_gc = (CGContextRef)Fl_Surface_Device::surface()->driver()->gc();
if (shape_data_) CGContextRestoreGState(my_gc);
}
# endif
}
+5 -5
View File
@@ -974,9 +974,9 @@ void Fl_PostScript_Graphics_Driver::color(unsigned char r, unsigned char g, unsi
}
}
void Fl_PostScript_Graphics_Driver::draw(int angle, const char *str, int n, int x, int y)
void Fl_PostScript_Graphics_Driver::draw(int rotation, const char *str, int n, int x, int y)
{
fprintf(output, "GS %d %d translate %d rotate\n", x, y, - angle);
fprintf(output, "GS %d %d translate %d rotate\n", x, y, -rotation);
this->transformed_draw(str, n, 0, 0);
fprintf(output, "GR\n");
}
@@ -1046,7 +1046,7 @@ void Fl_PostScript_Graphics_Driver::transformed_draw_extra(const char* str, int
font(fontnum, old_size);
fl_delete_offscreen(off);
// compute the mask of what is not the background
uchar *mask = calc_mask(img, w2, h, bg_color);
uchar *img_mask = calc_mask(img, w2, h, bg_color);
delete[] img;
// write the string image to PostScript as a scaled bitmask
scale = w2 / float(w);
@@ -1055,14 +1055,14 @@ void Fl_PostScript_Graphics_Driver::transformed_draw_extra(const char* str, int
int wmask = (w2+7)/8;
void *rle85 = prepare_rle85();
for (int j = h - 1; j >= 0; j--){
di = mask + j * wmask;
di = img_mask + j * wmask;
for (int i = 0; i < wmask; i++){
write_rle85(*di, rle85);
di++;
}
}
close_rle85(rle85); fputc('\n', output);
delete[] mask;
delete[] img_mask;
}
static int is_in_table(unsigned utf) {
@@ -152,8 +152,8 @@ const char* Fl_Quartz_Graphics_Driver::get_font_name(Fl_Font fnum, int* ap) {
Fl_Fontdesc *f = fl_fonts + fnum;
if (!f->fontname[0]) {
this->set_fontname_in_fontdesc(f);
const char* p = f->name;
if (!p || !*p) {if (ap) *ap = 0; return "";}
const char* thisFont = f->name;
if (!thisFont || !*thisFont) {if (ap) *ap = 0; return "";}
int type = 0;
if (strstr(f->name, "Bold")) type |= FL_BOLD;
if (strstr(f->name, "Italic") || strstr(f->name, "Oblique")) type |= FL_ITALIC;
@@ -310,8 +310,8 @@ void Fl_Quartz_Graphics_Driver::draw_CGImage(CGImageRef cgimg, int x, int y, int
CGContextRestoreGState(gc_);
}
void Fl_Quartz_Graphics_Driver::uncache_pixmap(fl_uintptr_t p) {
CGImageRelease((CGImageRef)p);
void Fl_Quartz_Graphics_Driver::uncache_pixmap(fl_uintptr_t pixmap_ref) {
CGImageRelease((CGImageRef)pixmap_ref);
}
//
@@ -56,8 +56,8 @@ void Fl_Quartz_Graphics_Driver::line_style(int style, int width, char* dashes) {
char *d = dashes;
static CGFloat pattern[16];
if (d && *d) {
CGFloat *p = pattern;
while (*d) { *p++ = (float)*d++; }
CGFloat *pDst = pattern;
while (*d) { *pDst++ = (float)*d++; }
quartz_line_pattern = pattern;
quartz_line_pattern_size = d-dashes;
} else if (style & 0xff) {
@@ -71,14 +71,14 @@ void Fl_Quartz_Graphics_Driver::line_style(int style, int width, char* dashes) {
dash = char(3*width);
dot = gap = char(width);
}
CGFloat *p = pattern;
CGFloat *pDst = pattern;
switch (style & 0xff) {
case FL_DASH: *p++ = dash; *p++ = gap; break;
case FL_DOT: *p++ = dot; *p++ = gap; break;
case FL_DASHDOT: *p++ = dash; *p++ = gap; *p++ = dot; *p++ = gap; break;
case FL_DASHDOTDOT: *p++ = dash; *p++ = gap; *p++ = dot; *p++ = gap; *p++ = dot; *p++ = gap; break;
case FL_DASH: *pDst++ = dash; *pDst++ = gap; break;
case FL_DOT: *pDst++ = dot; *pDst++ = gap; break;
case FL_DASHDOT: *pDst++ = dash; *pDst++ = gap; *pDst++ = dot; *pDst++ = gap; break;
case FL_DASHDOTDOT: *pDst++ = dash; *pDst++ = gap; *pDst++ = dot; *pDst++ = gap; *pDst++ = dot; *pDst++ = gap; break;
}
quartz_line_pattern_size = p-pattern;
quartz_line_pattern_size = pDst-pattern;
quartz_line_pattern = pattern;
} else {
quartz_line_pattern = 0;
+5 -5
View File
@@ -60,11 +60,11 @@ void Fl_Graphics_Driver::curve(double X0, double Y0,
if (b > a) a = b;
// use that to guess at the number of segments:
int n = int(sqrt(a)/4);
if (n > 1) {
if (n > 100) n = 100; // make huge curves not hang forever
int nSeg = int(sqrt(a)/4);
if (nSeg > 1) {
if (nSeg > 100) nSeg = 100; // make huge curves not hang forever
double e = 1.0/n;
double e = 1.0/nSeg;
// calculate the coefficients of 3rd order equation:
double xa = (x3-3*x2+3*x1-x);
@@ -85,7 +85,7 @@ void Fl_Graphics_Driver::curve(double X0, double Y0,
double dy2 = dy3 + 2*yb*e*e;
// draw points 1 .. n-2:
for (int m=2; m<n; m++) {
for (int i=2; i<n; i++) {
x += dx1;
dx1 += dx2;
dx2 += dx3;
+7 -7
View File
@@ -240,19 +240,19 @@ int fl_draw_pixmap(const char*const* cdata, int x, int y, Fl_Color bg) {
int W = (w+7)/8;
uchar* bitmap = new uchar[W * h];
*p = bitmap;
const uchar *p = &buffer[3];
const uchar *alphaPtr = &buffer[3];
uchar b = 0;
for (int Y = 0; Y < h; Y++) {
b = 0;
for (int X = 0, bit = 1; X < w; X++, p += 4) {
if (*p > 127)
for (int X = 0, bit = 1; X < w; X++, alphaPtr += 4) {
if (*alphaPtr > 127)
b |= bit;
bit <<= 1;
bit <<= 1;
if (bit > 0x80 || X == w-1) {
*bitmap++ = b;
*bitmap++ = b;
bit = 1;
b = 0;
}
b = 0;
}
} // if chars_per_pixel
} // for Y
}
+3 -3
View File
@@ -34,14 +34,14 @@ static void callback(Fl_File_Chooser *, void*) {
}
// Pop up a file chooser dialog window and wait until it is closed...
static void popup(Fl_File_Chooser *fc) {
fc->show();
static void popup(Fl_File_Chooser *filechooser) {
filechooser->show();
// deactivate Fl::grab(), because it is incompatible with modal windows
Fl_Window* g = Fl::grab();
if (g) Fl::grab(0);
while (fc->shown())
while (filechooser->shown())
Fl::wait();
if (g) // regrab the previous popup menu, if there was one
+8 -8
View File
@@ -295,7 +295,7 @@ void dobut(Fl_Widget *, long arg) {
#elif defined __APPLE__
char *cmd = strdup(menus[men].icommand[bn]);
char *arg = strchr(cmd, ' ');
char *macosArg = strchr(cmd, ' ');
char command[2048], path[2048], app_path[2048];
@@ -309,21 +309,21 @@ void dobut(Fl_Widget *, long arg) {
CFRelease(cc_app_path);
if (*app_path) {
if (memcmp(app_path + strlen(app_path) - 4, ".app", 4) == 0) {
char *n = strrchr(app_path, '/');
if (n) *n = 0;
char *lastSlash = strrchr(app_path, '/');
if (lastSlash) *lastSlash = 0;
}
fl_chdir(app_path);
}
char *name = new char[strlen(cmd) + 5];
strcpy(name, cmd);
if (arg) name[arg-cmd] = 0;
if (macosArg) name[macosArg-cmd] = 0;
strcat(name, ".app");
// check whether app bundle exists
if ( ! fl_filename_isdir(name) ) strcpy(name, cmd);
if (arg) {
if (macosArg) {
const char *fluidpath;
*arg = 0;
*macosArg = 0;
#if defined USING_XCODE
fl_filename_absolute(path, 2048, "../../../../test/");
fluidpath = "fluid.app";
@@ -334,9 +334,9 @@ void dobut(Fl_Widget *, long arg) {
if ( ! fl_filename_isdir(fluidpath) ) fluidpath = "../fluid";
#endif
if (strcmp(cmd, "../fluid/fluid")==0) {
sprintf(command, "open %s --args %s%s", fluidpath, path, arg+1);
sprintf(command, "open %s --args %s%s", fluidpath, path, macosArg+1);
} else {
sprintf(command, "open %s --args %s%s", name, path, arg+1);
sprintf(command, "open %s --args %s%s", name, path, macosArg+1);
}
} else {
sprintf(command, "open %s", name);