| [ Return to Bugs & Features | Post Text | Post File | Prev | Next ]
STR #3405
Application: | FLTK Library |
Status: | 5 - New |
Priority: | 1 - Request for Enhancement, e.g. asking for a feature |
Scope: | 2 - Specific to an operating system |
Subsystem: | Core Library |
Summary: | Please add more comments to Fl_Native_File_Chooser_MAC.mm |
Version: | 1.4-feature |
Created By: | greg.ercolano |
Assigned To: | Unassigned |
Fix Version: | Unassigned |
Update Notification: | |
Trouble Report Files:
[ Post File ]No files
Trouble Report Comments:
[ Post Text ]
|
#1 | greg.ercolano 14:21 Sep 25, 2017 |
| This is probably one for Manolo, as I don't think any other FLTK devs knows ObjC.
Since FLTK is predominantly a C++ application, and other languages it uses, like ObjC, is foreign to most devs, it would help those devs not familiar with ObjC if code written in that language included prodigious comments in sections where the ObjC syntax becomes non-C like.
I'd like to think this code would be commented as if it were example code for people new to ObjC to understand, so that non-ObjC devs can read it.
I'm trying to debug a problem with the Fl_Native_File_Chooser (specifically, files not being selected on dialog open), and am fairly lost about what the code does most of the time.
At one time I could read objc kinda, but after a few years goes by, it's gone again.
If I were leaving myself breadcrumbs, I'd probably do something like this:
---- char *q = strdup( [[[(NSSavePanel*)_panel URL] path] UTF8String] ); // get complete URL.path member as a C string if ( !(_options & Fl_Native_File_Chooser::SAVEAS_CONFIRM) ) { const char *d = [[[[(NSSavePanel*)_panel URL] path] stringByDeletingLastPathComponent] UTF8String]; // get just directory part of URL.path as C string ----
..or if that's too much noise, perhaps instead, some /very/ descriptive header comments, e.g.
---- // NSSavePanel has a URL path member that contains the full pathname to the file. // Here we get the complete pathname as the C string 'q', // and the directory component of the path as the C string 'd'. // We use UTF8String to cast the objc NSString's into C strings. // char *q = strdup( [[[(NSSavePanel*)_panel URL] path] UTF8String] ); if ( !(_options & Fl_Native_File_Chooser::SAVEAS_CONFIRM) ) { const char *d = [[[[(NSSavePanel*)_panel URL] path] stringByDeletingLastPathComponent] UTF8String]; ----
That'd help a lot I think..? I'll see about also putting a link to Manolo's ObjC cheat sheet for C++ programmers at the head of our .mm files to help C++ folks; I think that was posted in a newsgroup or FLTK article. | |
[ Return to Bugs & Features | Post Text | Post File ]
|
| |