diff options
Diffstat (limited to 'src/drivers/Cocoa')
| -rw-r--r-- | src/drivers/Cocoa/Fl_Cocoa_Printer_Driver.mm | 34 | ||||
| -rw-r--r-- | src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.H | 20 | ||||
| -rw-r--r-- | src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.cxx | 120 | ||||
| -rw-r--r-- | src/drivers/Cocoa/Fl_Cocoa_Window_Driver.H | 20 | ||||
| -rw-r--r-- | src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx | 12 | ||||
| -rw-r--r-- | src/drivers/Cocoa/Fl_MacOS_Sys_Menu_Bar_Driver.H | 12 |
6 files changed, 91 insertions, 127 deletions
diff --git a/src/drivers/Cocoa/Fl_Cocoa_Printer_Driver.mm b/src/drivers/Cocoa/Fl_Cocoa_Printer_Driver.mm index 4fa639d6a..ab3d90fb0 100644 --- a/src/drivers/Cocoa/Fl_Cocoa_Printer_Driver.mm +++ b/src/drivers/Cocoa/Fl_Cocoa_Printer_Driver.mm @@ -1,6 +1,4 @@ // -// "$Id$" -// // Mac OS X-specific printing support (objective-c++) for the Fast Light Tool Kit (FLTK). // // Copyright 2010-2018 by Bill Spitzak and others. @@ -9,11 +7,11 @@ // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // -// http://www.fltk.org/COPYING.php +// https://www.fltk.org/COPYING.php // -// Please report all bugs and problems to: +// Please see the following page on how to report bugs and issues: // -// http://www.fltk.org/str.php +// https://www.fltk.org/bugs.php // #include <FL/Fl_Paged_Device.H> @@ -132,9 +130,9 @@ int Fl_Cocoa_Printer_Driver::begin_job (int pagecount, int *frompage, int *topag pageFormat = (PMPageFormat)[info PMPageFormat];//from 10.5 printSettings = (PMPrintSettings)[info PMPrintSettings];//from 10.5 UInt32 from32, to32; - PMGetFirstPage(printSettings, &from32); + PMGetFirstPage(printSettings, &from32); if (frompage) *frompage = (int)from32; - PMGetLastPage(printSettings, &to32); + PMGetLastPage(printSettings, &to32); if (topage) { *topage = (int)to32; if (*topage > pagecount && pagecount > 0) *topage = pagecount; @@ -176,9 +174,9 @@ int Fl_Cocoa_Printer_Driver::begin_job (int pagecount, int *frompage, int *topag return 1; } UInt32 from32, to32; - PMGetFirstPage(printSettings, &from32); + PMGetFirstPage(printSettings, &from32); if (frompage) *frompage = (int)from32; - PMGetLastPage(printSettings, &to32); + PMGetLastPage(printSettings, &to32); if (topage) *topage = (int)to32; if(topage && *topage > pagecount) *topage = pagecount; CFStringRef mystring[1]; @@ -234,10 +232,10 @@ int Fl_Cocoa_Printer_Driver::printable_rect(int *w, int *h) OSStatus status; PMRect pmRect; int x, y; - + status = PMGetAdjustedPageRect(pageFormat, &pmRect); if (status != noErr) return 1; - + x = (int)pmRect.left; y = (int)pmRect.top; *w = int((int)(pmRect.right - x) / scale_x + 1); @@ -303,7 +301,7 @@ void Fl_Cocoa_Printer_Driver::untranslate(void) } int Fl_Cocoa_Printer_Driver::begin_page (void) -{ +{ OSStatus status = PMSessionBeginPageNoDialog(printSession, pageFormat, NULL); CGContextRef gc; #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 @@ -330,11 +328,11 @@ int Fl_Cocoa_Printer_Driver::begin_page (void) PMPaperGetMargins(paper, &margins); PMOrientation orientation; PMGetOrientation(pageFormat, &orientation); - + status = PMGetAdjustedPageRect(pageFormat, &pmRect); double h = pmRect.bottom - pmRect.top; x_offset = 0; - y_offset = 0; + y_offset = 0; angle = 0; scale_x = scale_y = 1; win_scale_x = win_scale_y = 1; @@ -354,7 +352,7 @@ int Fl_Cocoa_Printer_Driver::begin_page (void) } int Fl_Cocoa_Printer_Driver::end_page (void) -{ +{ CGContextRef gc = (CGContextRef)driver()->gc(); CGContextFlush(gc); CGContextRestoreGState(gc); @@ -368,7 +366,7 @@ int Fl_Cocoa_Printer_Driver::end_page (void) void Fl_Cocoa_Printer_Driver::end_job (void) { OSStatus status; - + status = PMSessionError(printSession); if (status != noErr) { fl_alert ("PM Session error %d", (int)status); @@ -471,7 +469,3 @@ void Fl_Cocoa_Printer_Driver::draw_decorated_window(Fl_Window *win, int x_offset [title release]; this->print_widget(win, x_offset, y_offset + bt); // print the window inner part } - -// -// End of "$Id$". -// diff --git a/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.H b/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.H index 97dd28a77..23af18f6f 100644 --- a/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.H +++ b/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.H @@ -1,6 +1,4 @@ // -// "$Id$" -// // Definition of Apple Cocoa Screen interface // for the Fast Light Tool Kit (FLTK). // @@ -10,11 +8,11 @@ // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // -// http://www.fltk.org/COPYING.php +// 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: // -// http://www.fltk.org/str.php +// https://www.fltk.org/bugs.php // /** @@ -29,9 +27,9 @@ /* Move everything here that manages the native screen interface. - + There is exactly one screen driver in the system. - + - screen configuration and sizes - multiple screens - native dialog boxes @@ -47,7 +45,7 @@ class Fl_RGB_Image; class NSImage; #endif -class FL_EXPORT Fl_Cocoa_Screen_Driver : public Fl_Screen_Driver +class FL_EXPORT Fl_Cocoa_Screen_Driver : public Fl_Screen_Driver { protected: struct XRectangle {int x, y, width, height;}; @@ -101,7 +99,7 @@ public: // --- compute dimensions of an Fl_Offscreen virtual void offscreen_size(Fl_Offscreen o, int &width, int &height); virtual float retina_factor() { return 2; } - + virtual APP_SCALING_CAPABILITY rescalable() { return SYSTEMWIDE_APP_SCALING; } virtual float scale(int n) {return scale_;} virtual void scale(int n, float f) { scale_ = f;} @@ -113,7 +111,3 @@ private: #endif // FL_COCOA_SCREEN_DRIVER_H - -// -// End of "$Id$". -// diff --git a/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.cxx b/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.cxx index 71743d7cb..bf85d0efc 100644 --- a/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.cxx +++ b/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.cxx @@ -1,6 +1,4 @@ // -// "$Id$" -// // Definition of Apple Cocoa Screen interface. // // Copyright 1998-2018 by Bill Spitzak and others. @@ -9,11 +7,11 @@ // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // -// http://www.fltk.org/COPYING.php +// 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: // -// http://www.fltk.org/str.php +// https://www.fltk.org/bugs.php // @@ -44,7 +42,7 @@ int Fl_Cocoa_Screen_Driver::next_marked_length = 0; /** Creates a driver that manages all screen and display related calls. - + This function must be implemented once for every platform. */ Fl_Screen_Driver *Fl_Screen_Driver::newScreenDriver() @@ -265,72 +263,72 @@ int Fl_Cocoa_Screen_Driver::input_widget_handle_key(int key, unsigned mods, unsi { switch (key) { case FL_Delete: { - if (mods==0) return input->kf_delete_char_right(); // Delete (OSX-HIG,TE,SA,WOX) - if (mods==FL_CTRL) return input->kf_delete_char_right(); // Ctrl-Delete (??? TE,!SA,!WOX) - if (mods==FL_ALT) return input->kf_delete_word_right(); // Alt-Delete (OSX-HIG,TE,SA) - return 0; // ignore other combos, pass to parent + if (mods==0) return input->kf_delete_char_right(); // Delete (OSX-HIG,TE,SA,WOX) + if (mods==FL_CTRL) return input->kf_delete_char_right(); // Ctrl-Delete (??? TE,!SA,!WOX) + if (mods==FL_ALT) return input->kf_delete_word_right(); // Alt-Delete (OSX-HIG,TE,SA) + return 0; // ignore other combos, pass to parent } - + case FL_Left: - if (mods==0) return input->kf_move_char_left(); // Left (OSX-HIG) - if (mods==FL_ALT) return input->kf_move_word_left(); // Alt-Left (OSX-HIG) - if (mods==FL_META) return input->kf_move_sol(); // Meta-Left (OSX-HIG) - if (mods==FL_CTRL) return input->kf_move_sol(); // Ctrl-Left (TE/SA) - return 0; // ignore other combos, pass to parent - + if (mods==0) return input->kf_move_char_left(); // Left (OSX-HIG) + if (mods==FL_ALT) return input->kf_move_word_left(); // Alt-Left (OSX-HIG) + if (mods==FL_META) return input->kf_move_sol(); // Meta-Left (OSX-HIG) + if (mods==FL_CTRL) return input->kf_move_sol(); // Ctrl-Left (TE/SA) + return 0; // ignore other combos, pass to parent + case FL_Right: - if (mods==0) return input->kf_move_char_right(); // Right (OSX-HIG) - if (mods==FL_ALT) return input->kf_move_word_right(); // Alt-Right (OSX-HIG) - if (mods==FL_META) return input->kf_move_eol(); // Meta-Right (OSX-HIG) - if (mods==FL_CTRL) return input->kf_move_eol(); // Ctrl-Right (TE/SA) - return 0; // ignore other combos, pass to parent - + if (mods==0) return input->kf_move_char_right(); // Right (OSX-HIG) + if (mods==FL_ALT) return input->kf_move_word_right(); // Alt-Right (OSX-HIG) + if (mods==FL_META) return input->kf_move_eol(); // Meta-Right (OSX-HIG) + if (mods==FL_CTRL) return input->kf_move_eol(); // Ctrl-Right (TE/SA) + return 0; // ignore other combos, pass to parent + case FL_Up: - if (mods==0) return input->kf_lines_up(1); // Up (OSX-HIG) - if (mods==FL_CTRL) return input->kf_page_up(); // Ctrl-Up (TE !HIG) - if (mods==FL_ALT) return input->kf_move_up_and_sol(); // Alt-Up (OSX-HIG) - if (mods==FL_META) return input->kf_top(); // Meta-Up (OSX-HIG) - return 0; // ignore other combos, pass to parent - + if (mods==0) return input->kf_lines_up(1); // Up (OSX-HIG) + if (mods==FL_CTRL) return input->kf_page_up(); // Ctrl-Up (TE !HIG) + if (mods==FL_ALT) return input->kf_move_up_and_sol(); // Alt-Up (OSX-HIG) + if (mods==FL_META) return input->kf_top(); // Meta-Up (OSX-HIG) + return 0; // ignore other combos, pass to parent + case FL_Down: - if (mods==0) return input->kf_lines_down(1); // Dn (OSX-HIG) - if (mods==FL_CTRL) return input->kf_page_down(); // Ctrl-Dn (TE !HIG) - if (mods==FL_ALT) return input->kf_move_down_and_eol(); // Alt-Dn (OSX-HIG) - if (mods==FL_META) return input->kf_bottom(); // Meta-Dn (OSX-HIG) - return 0; // ignore other combos, pass to parent - + if (mods==0) return input->kf_lines_down(1); // Dn (OSX-HIG) + if (mods==FL_CTRL) return input->kf_page_down(); // Ctrl-Dn (TE !HIG) + if (mods==FL_ALT) return input->kf_move_down_and_eol(); // Alt-Dn (OSX-HIG) + if (mods==FL_META) return input->kf_bottom(); // Meta-Dn (OSX-HIG) + return 0; // ignore other combos, pass to parent + case FL_Page_Up: // Fl_Input has no scroll control, so instead we move the cursor by one page // OSX-HIG recommends Alt increase one semantic unit, Meta next higher.. - if (mods==0) return input->kf_page_up(); // PgUp (OSX-HIG) - if (mods==FL_ALT) return input->kf_page_up(); // Alt-PageUp (OSX-HIG) - if (mods==FL_META) return input->kf_top(); // Meta-PageUp (OSX-HIG,!TE) - return 0; // ignore other combos, pass to parent - + if (mods==0) return input->kf_page_up(); // PgUp (OSX-HIG) + if (mods==FL_ALT) return input->kf_page_up(); // Alt-PageUp (OSX-HIG) + if (mods==FL_META) return input->kf_top(); // Meta-PageUp (OSX-HIG,!TE) + return 0; // ignore other combos, pass to parent + case FL_Page_Down: // Fl_Input has no scroll control, so instead we move the cursor by one page // OSX-HIG recommends Alt increase one semantic unit, Meta next higher.. - if (mods==0) return input->kf_page_down(); // PgDn (OSX-HIG) - if (mods==FL_ALT) return input->kf_page_down(); // Alt-PageDn (OSX-HIG) - if (mods==FL_META) return input->kf_bottom(); // Meta-PageDn (OSX-HIG,!TE) - return 0; // ignore other combos, pass to parent - + if (mods==0) return input->kf_page_down(); // PgDn (OSX-HIG) + if (mods==FL_ALT) return input->kf_page_down(); // Alt-PageDn (OSX-HIG) + if (mods==FL_META) return input->kf_bottom(); // Meta-PageDn (OSX-HIG,!TE) + return 0; // ignore other combos, pass to parent + case FL_Home: - if (mods==0) return input->kf_top(); // Home (OSX-HIG) - if (mods==FL_ALT) return input->kf_top(); // Alt-Home (???) - return 0; // ignore other combos, pass to parent - + if (mods==0) return input->kf_top(); // Home (OSX-HIG) + if (mods==FL_ALT) return input->kf_top(); // Alt-Home (???) + return 0; // ignore other combos, pass to parent + case FL_End: - if (mods==0) return input->kf_bottom(); // End (OSX-HIG) - if (mods==FL_ALT) return input->kf_bottom(); // Alt-End (???) - return 0; // ignore other combos, pass to parent - + if (mods==0) return input->kf_bottom(); // End (OSX-HIG) + if (mods==FL_ALT) return input->kf_bottom(); // Alt-End (???) + return 0; // ignore other combos, pass to parent + case FL_BackSpace: - if (mods==0) return input->kf_delete_char_left(); // Backspace (OSX-HIG) - if (mods==FL_CTRL) return input->kf_delete_char_left(); // Ctrl-Backspace (TE/SA) - if (mods==FL_ALT) return input->kf_delete_word_left(); // Alt-Backspace (OSX-HIG) - if (mods==FL_META) return input->kf_delete_sol(); // Meta-Backspace (OSX-HIG,!TE) - return 0; // ignore other combos, pass to parent + if (mods==0) return input->kf_delete_char_left(); // Backspace (OSX-HIG) + if (mods==FL_CTRL) return input->kf_delete_char_left(); // Ctrl-Backspace (TE/SA) + if (mods==FL_ALT) return input->kf_delete_word_left(); // Alt-Backspace (OSX-HIG) + if (mods==FL_META) return input->kf_delete_sol(); // Meta-Backspace (OSX-HIG,!TE) + return 0; // ignore other combos, pass to parent } return -1; } @@ -460,7 +458,7 @@ static void do_timer(CFRunLoopTimerRef timer, void* data) if (current_timer && current_timer->pending == 0) delete_timer(*current_timer); current_timer = NULL; - + Fl_Cocoa_Screen_Driver::breakMacEventLoop(); fl_unlock_function(); } @@ -550,7 +548,3 @@ void Fl_Cocoa_Screen_Driver::remove_timeout(Fl_Timeout_Handler cb, void* data) } } } - -// -// End of "$Id$". -// diff --git a/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.H b/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.H index 9ef5d46c9..dedc7bb34 100644 --- a/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.H +++ b/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.H @@ -1,6 +1,4 @@ // -// "$Id$" -// // Definition of Apple Cocoa window driver // for the Fast Light Tool Kit (FLTK). // @@ -10,11 +8,11 @@ // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // -// http://www.fltk.org/COPYING.php +// 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: // -// http://www.fltk.org/str.php +// https://www.fltk.org/bugs.php // /** @@ -57,13 +55,13 @@ class NSOpenGLPixelFormat; There is one window driver for each Fl_Window. Window drivers manage window actions such as resizing, events, decoration, fullscreen modes, etc. . All - drawing and rendering is managed by the Surface device and the associated + drawing and rendering is managed by the Surface device and the associated graphics driver. - window specific event handling - window types and styles, depth, etc. - decorations - + ? where do we handle the interface between OpenGL/DirectX and Cocoa/Windows/Glx? */ struct Fl_Window_Driver::shape_data_type { @@ -144,7 +142,7 @@ public: CALayer *get_titlebar_layer(); static void draw_layer_to_context(CALayer *layer, CGContextRef gc, int w, int h); virtual int scroll(int src_x, int src_y, int src_w, int src_h, int dest_x, int dest_y, void (*draw_area)(void*, int,int,int,int), void* data); - + // these functions are OpenGL-related and use objective-c // they are put here to avoid libfltk_gl dependency in Fl_cocoa.mm static NSOpenGLContext* create_GLcontext_for_window(NSOpenGLPixelFormat *pixelformat, NSOpenGLContext *shared_ctx, Fl_Window *window); @@ -155,14 +153,10 @@ public: static void GLcontext_makecurrent(NSOpenGLContext*); // uses Objective-c static void GL_cleardrawable(void); // uses Objective-c static void gl_start(NSOpenGLContext*); // uses Objective-c - + //icons virtual void icons(const Fl_RGB_Image *icons[], int count); NSImage *icon_image; }; #endif // FL_COCOA_WINDOW_DRIVER_H - -// -// End of "$Id$". -// diff --git a/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx b/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx index 0611e630e..97ff298f3 100644 --- a/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx +++ b/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx @@ -1,6 +1,4 @@ // -// "$Id$" -// // Definition of Apple Cocoa window driver. // // Copyright 1998-2018 by Bill Spitzak and others. @@ -9,11 +7,11 @@ // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // -// http://www.fltk.org/COPYING.php +// 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: // -// http://www.fltk.org/str.php +// https://www.fltk.org/bugs.php // @@ -359,7 +357,3 @@ void Fl_Cocoa_Window_Driver::capture_titlebar_and_borders(Fl_RGB_Image*& top, Fl top->scale(w(),htop, s <1 ? 0 : 1, 1); CGContextRelease(auxgc); } - -// -// End of "$Id$". -// diff --git a/src/drivers/Cocoa/Fl_MacOS_Sys_Menu_Bar_Driver.H b/src/drivers/Cocoa/Fl_MacOS_Sys_Menu_Bar_Driver.H index 7502947d2..27f34e226 100644 --- a/src/drivers/Cocoa/Fl_MacOS_Sys_Menu_Bar_Driver.H +++ b/src/drivers/Cocoa/Fl_MacOS_Sys_Menu_Bar_Driver.H @@ -1,6 +1,4 @@ // -// "$Id$" -// // Definition of class Fl_MacOS_Sys_Menu_Bar_Driver for the Fast Light Tool Kit (FLTK). // // Copyright 2017 by Bill Spitzak and others. @@ -9,11 +7,11 @@ // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // -// http://www.fltk.org/COPYING.php +// 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: // -// http://www.fltk.org/str.php +// https://www.fltk.org/bugs.php // #ifndef Fl_MacOS_Sys_Menu_Bar_Driver_H @@ -49,7 +47,3 @@ public: #endif /* Fl_MacOS_Sys_Menu_Bar_Driver_H */ - -// -// End of "$Id$". -// |
