Changeset 1288
- Timestamp:
- 2000-07-18T10:59:21+12:00 (24 years ago)
- Location:
- trunk/gsdl/src/w32server
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/src/w32server/fnord.cpp
r1203 r1288 77 77 #define ENTERBUTTONY ((MAINWINDOWHEIGHT-RESTHEIGHT)+5) 78 78 79 // size and position of version buttons 80 #define GOLDBUTTONWIDTH 150 81 #define SILVERBUTTONWIDTH 150 82 #define GOLDBUTTONHEIGHT 25 83 #define SILVERBUTTONHEIGHT GOLDBUTTONHEIGHT 84 #define GOLDBUTTONX STATUSX 85 #define SILVERBUTTONX GOLDBUTTONX 86 #define GOLDBUTTONY ((MAINWINDOWHEIGHT-RESTHEIGHT)-15) 87 #define SILVERBUTTONY ((GOLDBUTTONY+GOLDBUTTONHEIGHT)+3) 88 89 79 90 #define VERSIONSTRING "version x.xx" 80 91 const char versionstring[] = VERSIONSTRING; … … 88 99 "and begin using the static version\n" 89 100 "of this library"; 101 const char strinitstatus[] = "Select 'Gold' or 'Silver' version. Use the 'Gold' version\n" 102 "unless your computer doesn't\n" 103 "have networking installed\n"; 90 104 const char *statusstring = NULL; // points to the current status string 91 105 const char *infostring = NULL; // points to the current info string … … 114 128 115 129 HWND GoButton = NULL; 116 130 HWND Gold = NULL; 131 HWND Silver = NULL; 132 int init_type = 0; 133 int init_done = 0; 117 134 118 135 void finish_up() { … … 173 190 deflogobitmap = (HBITMAP)SelectObject (logodc, logobitmap); 174 191 } 192 193 194 if (init_done && (overlap (GOLDBUTTONX, GOLDBUTTONY, GOLDBUTTONX+GOLDBUTTONWIDTH, 195 SILVERBUTTONY+SILVERBUTTONHEIGHT, updateRect))) { 196 RECT initRect; 197 initRect.left = GOLDBUTTONX; 198 initRect.top = GOLDBUTTONY; 199 initRect.right = GOLDBUTTONX+GOLDBUTTONWIDTH; 200 initRect.bottom = SILVERBUTTONY+SILVERBUTTONHEIGHT; 201 FillRect(pdc, &initRect, (HBRUSH)GetStockObject(WHITE_BRUSH)); 202 } 203 204 175 205 176 206 // update the collection title if needed … … 196 226 197 227 // decide what we want to draw 198 if ( gsdl_show_console) {228 if (init_done && gsdl_show_console) { 199 229 // we want to draw a "console" window 200 230 if (window_state != console_window || … … 211 241 212 242 // update the status string if needed 213 if ((statusstring != NULL) && (strlen(statusstring) > 0) 214 && overlap (STATUSX, STATUSY, 215 STATUSX+STATUSWIDTH, STATUSY+STATUSHEIGHT, 216 updateRect)) { 217 RECT statusRect; 218 statusRect.left = STATUSX; 219 statusRect.top = STATUSY; 220 statusRect.right = STATUSX+STATUSWIDTH; 221 statusRect.bottom = STATUSY+STATUSHEIGHT; 222 FillRect(pdc, &statusRect, (HBRUSH)GetStockObject(WHITE_BRUSH)); 243 if (overlap (STATUSX, STATUSY, STATUSX+STATUSWIDTH, 244 STATUSY+STATUSHEIGHT, updateRect)) { 245 246 RECT statusRect; 247 statusRect.left = STATUSX; 248 statusRect.top = STATUSY; 249 statusRect.right = STATUSX+STATUSWIDTH; 250 statusRect.bottom = STATUSY+STATUSHEIGHT; 251 FillRect(pdc, &statusRect, (HBRUSH)GetStockObject(WHITE_BRUSH)); 252 253 if ((statusstring != NULL) && (strlen(statusstring) > 0)) { 223 254 224 int cury = STATUSY; 225 int startline = 0, here = 0; 226 while (statusstring[here] != '\0') { 227 if (statusstring[here] < ' ') { 255 int cury = STATUSY; 256 int startline = 0, here = 0; 257 while (statusstring[here] != '\0') { 258 if (statusstring[here] < ' ') { 259 if (here - startline > 0) { 260 // output the text 261 TextOut (pdc, STATUSX, cury, 262 &statusstring[startline], here-startline); 263 cury += line_spacing; 264 } 265 startline = here+1; 266 } 267 here++; 268 } 269 // output any remaining text 228 270 if (here - startline > 0) { 229 // output the text 230 TextOut (pdc, STATUSX, cury, 231 &statusstring[startline], here-startline); 232 cury += line_spacing; 271 TextOut (pdc, STATUSX, cury, &statusstring[startline], here-startline); 233 272 } 234 startline = here+1;235 273 } 236 here++;237 }238 // output any remaining text239 if (here - startline > 0) {240 TextOut (pdc, STATUSX, cury, &statusstring[startline], here-startline);241 }242 274 } 243 275 … … 251 283 252 284 // update the info string if needed 253 if ( (GoButton == NULL) && (infostring != NULL) &&254 255 256 updateRect)) {285 if (init_done && ((GoButton == NULL) && (infostring != NULL) && 286 overlap (INFOX, INFOY, 287 INFOX+INFOWIDTH, INFOY+INFOHEIGHT, 288 updateRect))) { 257 289 RECT infoRect; 258 290 infoRect.left = INFOX; … … 488 520 break; 489 521 490 case WM_CHAR:522 // case WM_CHAR: 491 523 // if the user hit the return key and if this is not a 492 524 // repeat key press then attempt to start a browser 493 if ((WParam == '\r') && !(LParam & 0xe0000000)) { 494 if (enter_library (Window) && !gsdl_show_console) 495 ShowWindow(Window,SW_MINIMIZE); 496 } 497 525 // if ((WParam == '\r') && !(LParam & 0xe0000000)) { 526 // if (init_done) { 527 // if (enter_library (Window) && !gsdl_show_console) 528 // ShowWindow(Window,SW_MINIMIZE); 529 // } else { 530 // init_done = 1; 531 // init_type = 1; 532 // } 533 // } 534 498 535 case WM_COMMAND: 499 if (( HWND)LParam == GoButton) {536 if ((GoButton != NULL) && ((HWND)LParam == GoButton)) { 500 537 // attempt to start a browser 501 538 if (enter_library (Window) && !gsdl_show_console) 502 539 ShowWindow(Window,SW_MINIMIZE); 540 541 } else if ((HWND)LParam == Gold) { 542 init_done = 1; 543 init_type = 1; 544 545 } else if ((HWND)LParam == Silver) { 546 init_done = 1; 547 init_type = 0; 503 548 504 549 } else { … … 597 642 startbrowserdir[0] = '\0'; 598 643 netscapeneeded = 0; 599 // int err = tryinitnetwork (Instance, MsgWindow, NULL);600 644 int err = 1; 645 if (init_type == 1) err = tryinitnetwork (Instance, MsgWindow, NULL); 601 646 602 647 // if an error occurred, try again with billsock … … 743 788 "on the CD-ROM."); 744 789 745 MessageBox (NULL, message, "Gree stone Digital Library Software", MB_OK);790 MessageBox (NULL, message, "Greenstone Digital Library Software", MB_OK); 746 791 } 747 792 … … 823 868 coltitlebitmap = LoadBitmap (Instance, MAKEINTRESOURCE(GSDL_COL_TITLE)); 824 869 logobitmap= LoadBitmap (Instance, MAKEINTRESOURCE(GSDL_LOGO)); 825 870 826 871 // Create the main window 827 MainWindow = CreateWindow ("Greenstone Digital Library Software",872 MainWindow = CreateWindowEx(WS_EX_CONTROLPARENT, "Greenstone Digital Library Software", 828 873 "Greenstone Digital Library Software", 829 874 WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | … … 862 907 // init various modules 863 908 read_settings (0); // don't know if netscape is needed at this point 909 910 // add the select version checkbox 911 Gold = CreateWindow("BUTTON", // predefined class 912 "Gold Version", // button text 913 WS_VISIBLE | WS_CHILD | WS_TABSTOP | BS_DEFPUSHBUTTON, // styles 914 GOLDBUTTONX, // starting x position 915 GOLDBUTTONY, // starting y position 916 GOLDBUTTONWIDTH, // button width 917 GOLDBUTTONHEIGHT, // button height 918 MainWindow, // parent window 919 NULL, // No menu 920 Instance, 921 NULL); // pointer not needed 922 923 Silver = CreateWindow("BUTTON", // predefined class 924 "Silver Version", // button text 925 WS_VISIBLE | WS_CHILD | WS_TABSTOP | BS_PUSHBUTTON, // styles 926 SILVERBUTTONX, // starting x position 927 SILVERBUTTONY, // starting y position 928 SILVERBUTTONWIDTH, // button width 929 SILVERBUTTONHEIGHT, // button height 930 MainWindow, // parent window 931 NULL, // No menu 932 Instance, 933 NULL); // pointer not needed 934 935 SetFocus (Gold); 936 937 statusstring = strinitstatus; 938 paint_window (pdc, windowRect); 939 940 // message loop for init buttons 941 while (!init_done) { 942 if (PeekMessage(&Message, NULL, 0, 0, PM_REMOVE)) { 943 if (Message.message == WM_QUIT) return Message.wParam; 944 if (!IsDialogMessage (MainWindow, &Message)) { 945 TranslateMessage(&Message); /* translate keyboard messages */ 946 DispatchMessage(&Message); /* return control to Windows NT */ 947 } 948 } else { 949 Sleep (1); 950 } 951 } 952 953 // don't want these buttons anymore 954 DestroyWindow (Gold); 955 DestroyWindow (Silver); 956 957 statusstring = ""; 958 paint_window (pdc, windowRect); 864 959 865 960 // attempt to initialise the network … … 905 1000 906 1001 // add the "enter library" button 907 GoButton = CreateWindow( 908 "BUTTON", // predefined class 909 "Enter Library", // button text 910 WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON, // styles 911 ENTERBUTTONX, // starting x position 912 ENTERBUTTONY, // starting y position 913 ENTERBUTTONWIDTH, // button width 914 ENTERBUTTONHEIGHT, // button height 915 MainWindow, // parent window 916 NULL, // No menu 1002 GoButton = CreateWindow("BUTTON", // predefined class 1003 "Enter Library", // button text 1004 WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON, // styles 1005 ENTERBUTTONX, // starting x position 1006 ENTERBUTTONY, // starting y position 1007 ENTERBUTTONWIDTH, // button width 1008 ENTERBUTTONHEIGHT, // button height 1009 MainWindow, // parent window 1010 NULL, // No menu 917 1011 Instance, 918 NULL); // pointer not needed 1012 NULL); // pointer not needed 1013 1014 SetFocus (GoButton); 919 1015 920 1016 if (have_networking) statusstring = strenterlib; 921 1017 else statusstring = strenterstaticlib; 922 1018 paint_window (pdc, windowRect); 923 1019 924 1020 // release the DC used to display the init messages 925 1021 ReleaseDC (MainWindow, pdc); … … 937 1033 if (PeekMessage(&Message, NULL, 0, 0, PM_REMOVE)) { 938 1034 if (Message.message == WM_QUIT) break; 939 TranslateMessage(&Message); /* translate keyboard messages */ 940 DispatchMessage(&Message); /* return control to Windows NT */ 1035 if (!IsDialogMessage (MainWindow, &Message)) { 1036 TranslateMessage(&Message); /* translate keyboard messages */ 1037 DispatchMessage(&Message); /* return control to Windows NT */ 1038 } 941 1039 942 1040 } else {
Note:
See TracChangeset
for help on using the changeset viewer.