diff options
| author | Albrecht Schlosser <albrechts.fltk@online.de> | 2020-07-01 18:03:10 +0200 |
|---|---|---|
| committer | Albrecht Schlosser <albrechts.fltk@online.de> | 2020-07-06 20:28:20 +0200 |
| commit | f09e17c3c564e8310125a10c03397cbf473ff643 (patch) | |
| tree | 8d0fd4a28e3686c33aaa140d07ddba26ab28bdc2 /src/Fl_arg.cxx | |
| parent | b0e0c355edaa2e23148cb0260ada907aec930f05 (diff) | |
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.
Diffstat (limited to 'src/Fl_arg.cxx')
| -rw-r--r-- | src/Fl_arg.cxx | 82 |
1 files changed, 38 insertions, 44 deletions
diff --git a/src/Fl_arg.cxx b/src/Fl_arg.cxx index 4ab6bfe4a..347faee63 100644 --- a/src/Fl_arg.cxx +++ b/src/Fl_arg.cxx @@ -1,6 +1,4 @@ // -// "$Id$" -// // Optional argument initialization code for the Fast Light Tool Kit (FLTK). // // 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 // // OPTIONAL initialization code for a program using FLTK. @@ -49,68 +47,68 @@ extern const char *fl_bg2; /** Parse a single switch from \p argv, starting at word \p i. Returns the number of words eaten (1 or 2, or 0 if it is not - recognized) and adds the same value to \p i. - + recognized) and adds the same value to \p i. + This is the default argument handler used internally by Fl::args(...), but you can use this function if you prefer to step through the standard FLTK switches yourself. - + All standard FLTK switches except -bg2 may be abbreviated to just one letter and case is ignored: - + \li -bg color or -background color <br> Sets the background color using Fl::background(). - + \li -bg2 color or -background2 color <br> Sets the secondary background color using Fl::background2(). - + \li -display host:n.n <br> Sets the X display to use; this option is silently ignored under Windows and MacOS. - + \li -dnd and -nodnd <br> Enables or disables drag and drop text operations using Fl::dnd_text_ops(). - + \li -fg color or -foreground color <br> Sets the foreground color using Fl::foreground(). - + \li -geometry WxH+X+Y <br> Sets the initial window position and size according to the standard X geometry string. - + \li -iconic <br> Iconifies the window using Fl_Window::iconize(). - + \li -kbd and -nokbd <br> Enables or disables visible keyboard focus for non-text widgets using Fl::visible_focus(). - + \li -name string <br> Sets the window class using Fl_Window::xclass(). - + \li -scheme string <br> Sets the widget scheme using Fl::scheme(). - + \li -title string <br> Sets the window title using Fl_Window::label(). - + \li -tooltips and -notooltips <br> Enables or disables tooltips using Fl_Tooltip::enable(). - - + + If your program requires other switches in addition to the standard FLTK options, you will need to pass your own argument handler to Fl::args(int,char**,int&,Fl_Args_Handler) explicitly. @@ -119,7 +117,7 @@ int Fl::arg(int argc, char **argv, int &i) { arg_called = 1; const char *s = argv[i]; - if (!s) {i++; return 1;} // something removed by calling program? + if (!s) {i++; return 1;} // something removed by calling program? // a word that does not start with '-', or a word after a '--', or // the word '-' by itself all start the "non-switch arguments" to @@ -164,7 +162,7 @@ int Fl::arg(int argc, char **argv, int &i) { const char *v = argv[i+1]; if (i >= argc-1 || !v) - return 0; // all the rest need an argument, so if missing it is an error + return 0; // all the rest need an argument, so if missing it is an error if (fl_match(s, "geometry")) { @@ -208,20 +206,20 @@ int Fl::arg(int argc, char **argv, int &i) { /** Parse command line switches using the \p cb argument handler. - + Returns 0 on error, or the number of words processed. - + FLTK provides this as an <i>entirely optional</i> command line switch parser. You don't have to call it if you don't want to. Everything it can do can be done with other calls to FLTK. - + To use the switch parser, call Fl::args(...) near the start of your program. This does \b not open the display, instead switches that need the display open are stashed into static variables. Then you \b must display your first window by calling <tt>window->show(argc,argv)</tt>, which will do anything stored in the static variables. - + Providing an argument handler callback \p cb lets you define your own switches. It is called with the same \p argc and \p argv, and with \p i set to the index of the switch to be processed. @@ -230,33 +228,33 @@ int Fl::arg(int argc, char **argv, int &i) { number of words processed if the switch is recognized, i.e. 1 for just the switch, and more than 1 for the switch plus associated parameters. \p i should be incremented by the same amount. - + The \p cb handler is called \b before any other tests, so <i>you can also override any standard FLTK switch</i> (this is why FLTK can use very short switches instead of the long ones all other toolkits force you to use). See Fl::arg() for descriptions of the standard switches. - + On return \p i is set to the index of the first non-switch. This is either: - + \li The first word that does not start with '-'. \li The word '-' (used by many programs to name stdin as a file) \li The first unrecognized switch (return value is 0). \li \p argc - + The return value is \p i unless an unrecognized switch is found, in which case it is zero. If your program takes no arguments other than switches you should produce an error if the return value is less than \p argc. - - + + A usage string is displayed if Fl::args() detects an invalid argument on the command-line. You can change the message by setting the Fl::help pointer. - + A very simple command line parser can be found in <tt>examples/howto-parse-args.cxx</tt> - + The simpler Fl::args(int argc, char **argv) form is useful if your program does not have command line switches of its own. */ @@ -294,9 +292,9 @@ void Fl_Window::show(int argc, char **argv) { if (!r) resizable(this); // for Windows we assume window is not mapped yet: if (fl & (Fl_System_Driver::fl_XValue | Fl_System_Driver::fl_YValue)) - x(-1), resize(gx,gy,gw,gh); + x(-1), resize(gx,gy,gw,gh); else - size(gw,gh); + size(gw,gh); resizable(r); } } @@ -343,16 +341,12 @@ const char * const Fl::help = helpmsg+13; /** Parse all command line switches matching standard FLTK options only. - + It parses all the switches, and if any are not recognized it calls Fl::abort(Fl::help), i.e. unlike the long form, an unrecognized switch generates an error message and causes the program to exit. - + */ void Fl::args(int argc, char **argv) { int i; if (Fl::args(argc,argv,i) < argc) Fl::error(helpmsg); } - -// -// End of "$Id$". -// |
