initial import
[bbkeys.git] / main.cc
blobce1ff742ba678f69cb8e8a00b31427ca8183a41b
1 // Basewindow.cc for bbtools.
2 //
3 // Copyright (c) 1998-1999 by John Kennis, jkennis@chello.nl
4 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 2 of the License, or
8 // (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 // (See the included file COPYING / GPL-2.0)
22 #include "bbkeys.hh"
23 #include "main.hh"
25 void Usage()
27 fprintf(stderr, "\n%s version %s \n", BBTOOL, BBTOOL_VERSION);
28 fprintf(stderr, "Usage: %s [options]\n", BBTOOL);
29 fprintf(stderr, "Options:\n");
30 fprintf(stderr,
31 "-display <display name> X server to connect to\n");
32 fprintf(stderr, "-c[onfig] <filename> Alternate config file\n");
33 fprintf(stderr,
34 "-n[obb] Fall back on default configuration\n");
35 fprintf(stderr,
36 "-v[ersion] Display version number\n");
37 fprintf(stderr, "-h[elp] Display this help\n");
38 fprintf(stderr,
39 "-geom[etry] <geometry> Set geometry of window\n");
40 fprintf(stderr,
41 "-d[ecorated] Show 'normal' decorated window\n");
42 fprintf(stderr,
43 "-w[ithdrawn] Place bbtool in the Slit\n");
44 fprintf(stderr,
45 "-i[conic] Start bbkeys in a minimized state\n"
46 " (will override -withdrawn directive)\n");
47 fprintf(stderr,
48 "-s[hape] Don't display groundplate\n");
49 fprintf(stderr,
50 "-no[qt] Use non-qt configuration tool.\n");
51 fprintf(stderr,
52 "-m[iniMe] Like Austin Powers 2. bbkeys, "
53 "but smaller.\n");
54 fprintf(stderr,
55 "-t[inyMe] All you can see is his keyhole *sniff*.\n\n");
59 int main(int argc, char **argv)
61 int i;
62 struct CMDOPTIONS options;
63 options.display_name = NULL;
64 options.geometry = NULL;
65 options.withdrawn = False;
66 options.iconic = False;
67 options.shape = False;
68 options.config_file = NULL;
69 options.nobb_config = False;
70 options.decorated = False;
71 options.noQt = False;
72 options.miniMe = False;
73 options.tinyMe = False;
76 for (i = 1; i < argc; i++) {
77 if ((!strcmp(argv[i], "-display"))) {
78 if (++i == argc) {
79 Usage();
80 exit(2);
82 options.display_name = argv[i];
84 else if ((!strcmp(argv[i], "-config")) |
85 (!strcmp(argv[i], "-c"))) {
86 if (++i == argc) {
87 Usage();
88 exit(2);
90 options.config_file = argv[i];
91 } else if ((!strcmp(argv[i], "-nobb")) | (!strcmp(argv[i], "-n"))) {
92 options.nobb_config = True;
93 } else if ((!strcmp(argv[i], "-v"))
94 || (!strcmp(argv[i], "-version"))) {
95 fprintf(stderr, " %s version %s\n", BBTOOL, BBTOOL_VERSION);
96 exit(2);
97 } else if ((!strcmp(argv[i], "-h")) || (!strcmp(argv[i], "-help"))) {
98 Usage();
99 exit(2);
100 } else if ((!strcmp(argv[i], "-geometry"))
101 || (!strcmp(argv[i], "-geom"))) {
102 if (++i == argc) {
103 Usage();
104 exit(2);
106 options.geometry = argv[i];
107 } else if ((!strcmp(argv[i], "-withdrawn"))
108 || (!strcmp(argv[i], "-w"))) {
109 options.withdrawn = True;
110 } else if ((!strcmp(argv[i], "-iconic"))
111 || (!strcmp(argv[i], "-i"))) {
112 options.iconic = True;
113 } else if ((!strcmp(argv[i], "-shape"))
114 || (!strcmp(argv[i], "-s"))) {
115 options.shape = True;
116 } else if ((!strcmp(argv[i], "-decorated"))
117 || (!strcmp(argv[i], "-d"))) {
118 options.decorated = True;
119 } else if ((!strcmp(argv[i], "-noqt"))
120 || (!strcmp(argv[i], "-no"))) {
121 options.noQt = True;
122 } else if ((!strcmp(argv[i], "-miniMe"))
123 || (!strcmp(argv[i], "-m"))) {
124 options.miniMe = True;
125 options.tinyMe = False;
126 } else if ((!strcmp(argv[i], "-tinyMe"))
127 || (!strcmp(argv[i], "-t"))) {
128 options.tinyMe = True;
129 options.miniMe = False;
130 } else {
131 Usage();
132 exit(2);
136 if (options.iconic) {
137 options.withdrawn = False;
140 ToolWindow bbkeys(argc, argv, &options);