From 26387c3538c5a3607bfa553a866800878d548317 Mon Sep 17 00:00:00 2001 From: Albrecht Schlosser Date: Sun, 1 Feb 2026 18:17:13 +0100 Subject: Fix obvious indenting errors after removal of old code ... by commit e0405d2135939d08289205e3a38df329076e16c1 --- src/drivers/Cocoa/Fl_Cocoa_Gl_Window_Driver.mm | 22 ++++----- src/drivers/Cocoa/Fl_Cocoa_Printer_Driver.mm | 68 +++++++++++++------------- 2 files changed, 45 insertions(+), 45 deletions(-) (limited to 'src/drivers') diff --git a/src/drivers/Cocoa/Fl_Cocoa_Gl_Window_Driver.mm b/src/drivers/Cocoa/Fl_Cocoa_Gl_Window_Driver.mm index 6dff548f0..b3f7fcb61 100644 --- a/src/drivers/Cocoa/Fl_Cocoa_Gl_Window_Driver.mm +++ b/src/drivers/Cocoa/Fl_Cocoa_Gl_Window_Driver.mm @@ -478,18 +478,18 @@ Fl_RGB_Image* Fl_Cocoa_Gl_Window_Driver::capture_gl_rectangle(int x, int y, int if (factor != 1) { w *= factor; h *= factor; x *= factor; y *= factor; } - NSWindow *nswin = (NSWindow*)fl_mac_xid(pWindow); - CGImageRef img_full = Fl_Cocoa_Window_Driver::capture_decorated_window_10_5(nswin); - int bt = [nswin frame].size.height - [[nswin contentView] frame].size.height; - bt *= (factor / Fl_Graphics_Driver::default_driver().scale()); - CGRect cgr = CGRectMake(x, y + bt, w, h); // add vertical offset to bypass titlebar - CGImageRef cgimg = CGImageCreateWithImageInRect(img_full, cgr); // 10.4 - CGImageRelease(img_full); - Fl_RGB_Image *rgb = cgimage_to_rgb4(cgimg); - CGImageRelease(cgimg); - return rgb; + NSWindow *nswin = (NSWindow*)fl_mac_xid(pWindow); + CGImageRef img_full = Fl_Cocoa_Window_Driver::capture_decorated_window_10_5(nswin); + int bt = [nswin frame].size.height - [[nswin contentView] frame].size.height; + bt *= (factor / Fl_Graphics_Driver::default_driver().scale()); + CGRect cgr = CGRectMake(x, y + bt, w, h); // add vertical offset to bypass titlebar + CGImageRef cgimg = CGImageCreateWithImageInRect(img_full, cgr); // 10.4 + CGImageRelease(img_full); + Fl_RGB_Image *rgb = cgimage_to_rgb4(cgimg); + CGImageRelease(cgimg); + return rgb; [(NSOpenGLContext*)glw->context() makeCurrentContext]; -// to capture also the overlay and for directGL demo + // to capture also the overlay and for directGL demo [(NSOpenGLContext*)glw->context() flushBuffer]; // Read OpenGL context pixels directly. // For extra safety, save & restore OpenGL states that are changed diff --git a/src/drivers/Cocoa/Fl_Cocoa_Printer_Driver.mm b/src/drivers/Cocoa/Fl_Cocoa_Printer_Driver.mm index f1a769d75..a40f1feb4 100644 --- a/src/drivers/Cocoa/Fl_Cocoa_Printer_Driver.mm +++ b/src/drivers/Cocoa/Fl_Cocoa_Printer_Driver.mm @@ -107,40 +107,41 @@ int Fl_Cocoa_Printer_Driver::begin_job (int pagecount, int *frompage, int *topag OSStatus status = 0; fl_open_display(); Fl_Cocoa_Window_Driver::q_release_context(); - NSPrintInfo *info = [NSPrintInfo sharedPrintInfo]; - NSPrintPanel *panel = [NSPrintPanel printPanel]; - //from 10.5 - [panel setOptions:NSPrintPanelShowsCopies | NSPrintPanelShowsPageRange | - NSPrintPanelShowsPageSetupAccessory | NSPrintPanelShowsOrientation | NSPrintPanelShowsPaperSize]; - NSInteger retval = -1; - Fl_Window *top = Fl::first_window(); - NSWindow *main = (top ? (NSWindow*)fl_xid(top->top_window()) : nil); - if (main) { - [panel beginSheetWithPrintInfo:info - modalForWindow:main - delegate:[[[print_panel_delegate alloc] init] autorelease] - didEndSelector:@selector(printPanelDidEnd:returnCode:contextInfo:) - contextInfo:&retval]; - while (retval < 0) Fl::wait(100); - [main makeKeyAndOrderFront:nil]; - } else - retval = [panel runModalWithPrintInfo:info]; //from 10.5 + NSPrintInfo *info = [NSPrintInfo sharedPrintInfo]; + NSPrintPanel *panel = [NSPrintPanel printPanel]; + //from 10.5 + [panel setOptions:NSPrintPanelShowsCopies | NSPrintPanelShowsPageRange | + NSPrintPanelShowsPageSetupAccessory | NSPrintPanelShowsOrientation | NSPrintPanelShowsPaperSize]; + NSInteger retval = -1; + Fl_Window *top = Fl::first_window(); + NSWindow *main = (top ? (NSWindow*)fl_xid(top->top_window()) : nil); + if (main) { + [panel beginSheetWithPrintInfo:info + modalForWindow:main + delegate:[[[print_panel_delegate alloc] init] autorelease] + didEndSelector:@selector(printPanelDidEnd:returnCode:contextInfo:) + contextInfo:&retval]; + while (retval < 0) Fl::wait(100); + [main makeKeyAndOrderFront:nil]; + } else { + retval = [panel runModalWithPrintInfo:info]; //from 10.5 + } #if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_9 - const NSInteger NSModalResponseOK = NSOKButton; + const NSInteger NSModalResponseOK = NSOKButton; #endif - if (retval != NSModalResponseOK) return 1; - printSession = (PMPrintSession)[info PMPrintSession];//from 10.5 - pageFormat = (PMPageFormat)[info PMPageFormat];//from 10.5 - printSettings = (PMPrintSettings)[info PMPrintSettings];//from 10.5 - UInt32 from32, to32; - PMGetFirstPage(printSettings, &from32); - if (frompage) *frompage = (int)from32; - PMGetLastPage(printSettings, &to32); - if (topage) { - *topage = (int)to32; - if (*topage > pagecount && pagecount > 0) *topage = pagecount; - } - status = PMSessionBeginCGDocumentNoDialog(printSession, printSettings, pageFormat);//from 10.4 + if (retval != NSModalResponseOK) return 1; + printSession = (PMPrintSession)[info PMPrintSession]; //from 10.5 + pageFormat = (PMPageFormat)[info PMPageFormat]; //from 10.5 + printSettings = (PMPrintSettings)[info PMPrintSettings];//from 10.5 + UInt32 from32, to32; + PMGetFirstPage(printSettings, &from32); + if (frompage) *frompage = (int)from32; + PMGetLastPage(printSettings, &to32); + if (topage) { + *topage = (int)to32; + if (*topage > pagecount && pagecount > 0) *topage = pagecount; + } + status = PMSessionBeginCGDocumentNoDialog(printSession, printSettings, pageFormat);//from 10.4 if (status != noErr) { if (perr_message) { @@ -167,8 +168,7 @@ void Fl_Cocoa_Printer_Driver::margins(int *left, int *top, int *right, int *bott if (top) *top = (int)(margins.top / scale_y + 0.5); if (right) *right = (int)(margins.right / scale_x + 0.5); if (bottom) *bottom = (int)(margins.bottom / scale_y + 0.5); - } - else { + } else { if (left) *left = (int)(margins.top / scale_x + 0.5); if (top) *top = (int)(margins.left / scale_y + 0.5); if (right) *right = (int)(margins.bottom / scale_x + 0.5); -- cgit v1.2.3