Changeset 1292
- Timestamp:
- 2000-07-21T16:58:12+12:00 (24 years ago)
- Location:
- trunk/gsdl/src/w32server
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/src/w32server/fnord.cpp
r1288 r1292 37 37 #define MAINWINDOWHEIGHT 200 38 38 39 #define RESTHEIGHT 45 // Extra window size reqd below logo40 39 #define WASTEHEIGHT 44 // Error in ht due to caption and menu bar 41 40 #define WASTEWIDTH 6 41 #define SPACERWIDTH 5 42 42 43 43 // size and position of the collection title … … 56 56 #define LOGOWIDTH 135 57 57 #define LOGOHEIGHT 55 58 #define LOGOX (MAINWINDOWWIDTH-LOGOWIDTH-20) 59 #define LOGOY (MAINWINDOWHEIGHT-LOGOHEIGHT-RESTHEIGHT) 60 61 // size and position of the status string 62 #define STATUSX 20 63 #define STATUSY ((LOGOY-VERSIONY-VERSIONHEIGHT)/2+VERSIONY+VERSIONHEIGHT) 64 #define STATUSWIDTH MAINWINDOWWIDTH-STATUSX 65 #define STATUSHEIGHT (MAINWINDOWHEIGHT-RESTHEIGHT-STATUSY) 66 67 // size and position of the info string (same position as the button) 58 #define LOGOX (MAINWINDOWWIDTH-(LOGOWIDTH+SPACERWIDTH)) 59 #define LOGOY (MAINWINDOWHEIGHT-(LOGOHEIGHT+SPACERWIDTH)) 60 61 // size and position of the enter button 62 #define ENTERBUTTONWIDTH 160 63 #define ENTERBUTTONHEIGHT 30 64 #define ENTERBUTTONX SPACERWIDTH 65 #define ENTERBUTTONY ((MAINWINDOWHEIGHT-(LOGOHEIGHT+SPACERWIDTH))-(ENTERBUTTONHEIGHT+SPACERWIDTH)) 66 67 // size and position of the enter string 68 #define ENTERSTRINGX (ENTERBUTTONX+ENTERBUTTONWIDTH+SPACERWIDTH) 69 #define ENTERSTRINGY ENTERBUTTONY 70 #define ENTERSTRINGWIDTH (MAINWINDOWWIDTH-(ENTERBUTTONWIDTH+SPACERWIDTH+SPACERWIDTH+SPACERWIDTH)) 71 #define ENTERSTRINGHEIGHT ENTERBUTTONHEIGHT 72 73 // size and position of the info string 68 74 #define INFOWIDTH MAINWINDOWWIDTH 69 75 #define INFOHEIGHT (MAINWINDOWHEIGHT-INFOY) 70 76 #define INFOX 0 71 #define INFOY ((MAINWINDOWHEIGHT-RESTHEIGHT)+10) 72 73 // size and position of the button 74 #define ENTERBUTTONWIDTH 150 75 #define ENTERBUTTONHEIGHT 30 76 #define ENTERBUTTONX ((MAINWINDOWWIDTH-ENTERBUTTONWIDTH)/2) 77 #define ENTERBUTTONY ((MAINWINDOWHEIGHT-RESTHEIGHT)+5) 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) 77 #define INFOY ENTERBUTTONY 78 79 // size and position of restricted buttons 80 #define ALTERNATIVEBUTTONWIDTH 160 81 #define ALTERNATIVEBUTTONHEIGHT 30 82 #define ALTERNATIVEBUTTONX SPACERWIDTH 83 #define ALTERNATIVEBUTTONY LOGOY 84 85 #define INFOBUTTONWIDTH 30 86 87 // size and position of restart button 88 #define RESTARTBUTTONWIDTH 160 89 #define RESTARTBUTTONHEIGHT 30 90 #define RESTARTBUTTONX 50 91 #define RESTARTBUTTONY (MAINWINDOWHEIGHT-RESTARTBUTTONHEIGHT-15) 88 92 89 93 … … 94 98 const char strinit[] = "Initialising..."; 95 99 const char strsb[] = "Starting browser..."; 96 const char strenterlib[] = "Press the 'Enter Library' button to start a browser\n" 97 "and begin using this library"; 98 const char strenterstaticlib[] = "Press the 'Enter Library' button to start a browser\n" 99 "and begin using the static version\n" 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"; 104 const char *statusstring = NULL; // points to the current status string 100 const char strrestartlib[] = "Press the 'Restart Library' button to start a browser\n" 101 "and enter library"; 102 const char strenterlib[] = "Press this button to begin using\n" 103 "the library"; 104 const char *enterstring = NULL; // points to the current enter string 105 105 const char *infostring = NULL; // points to the current info string 106 106 … … 128 128 129 129 HWND GoButton = NULL; 130 HWND Gold = NULL; 131 HWND Silver = NULL; 130 HWND Enter = NULL; 131 HWND EnterRestricted = NULL; 132 HWND InfoRestricted = NULL; 132 133 int init_type = 0; 133 134 int init_done = 0; … … 191 192 } 192 193 193 194 if (init_done && (overlap ( GOLDBUTTONX, GOLDBUTTONY, GOLDBUTTONX+GOLDBUTTONWIDTH,195 SILVERBUTTONY+SILVERBUTTONHEIGHT, updateRect))) {194 // remove any remaining sign of initial buttons 195 if (init_done && (overlap (ENTERBUTTONX, ENTERBUTTONY, ENTERBUTTONX+ENTERBUTTONWIDTH, 196 ALTERNATIVEBUTTONY+ALTERNATIVEBUTTONHEIGHT, updateRect))) { 196 197 RECT initRect; 197 initRect.left = GOLDBUTTONX;198 initRect.top = GOLDBUTTONY;199 initRect.right = GOLDBUTTONX+GOLDBUTTONWIDTH;200 initRect.bottom = SILVERBUTTONY+SILVERBUTTONHEIGHT;198 initRect.left = ENTERBUTTONX; 199 initRect.top = ENTERBUTTONY; 200 initRect.right = ENTERBUTTONX+ENTERBUTTONWIDTH; 201 initRect.bottom = ALTERNATIVEBUTTONY+ALTERNATIVEBUTTONHEIGHT; 201 202 FillRect(pdc, &initRect, (HBRUSH)GetStockObject(WHITE_BRUSH)); 202 203 } 203 204 204 205 206 205 // update the collection title if needed 207 206 if (overlap(COLTITLEX, COLTITLEY, … … 240 239 // we want to draw a "plain" window 241 240 242 // update the statusstring if needed243 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)) {241 // update the enter string if needed 242 if (overlap (ENTERSTRINGX, ENTERSTRINGY, ENTERSTRINGX+ENTERSTRINGWIDTH, 243 ENTERSTRINGY+ENTERSTRINGHEIGHT, updateRect)) { 244 245 RECT enterstringRect; 246 enterstringRect.left = ENTERSTRINGX; 247 enterstringRect.top = ENTERSTRINGY; 248 enterstringRect.right = ENTERSTRINGX+ENTERSTRINGWIDTH; 249 enterstringRect.bottom = ENTERSTRINGY+ENTERSTRINGHEIGHT; 250 FillRect(pdc, &enterstringRect, (HBRUSH)GetStockObject(WHITE_BRUSH)); 251 252 if ((enterstring != NULL) && (strlen(enterstring) > 0)) { 254 253 255 int cury = STATUSY;254 int cury = ENTERSTRINGY; 256 255 int startline = 0, here = 0; 257 while ( statusstring[here] != '\0') {258 if ( statusstring[here] < ' ') {256 while (enterstring[here] != '\0') { 257 if (enterstring[here] < ' ') { 259 258 if (here - startline > 0) { 260 259 // output the text 261 TextOut (pdc, STATUSX, cury,262 & statusstring[startline], here-startline);260 TextOut (pdc, ENTERSTRINGX, cury, 261 &enterstring[startline], here-startline); 263 262 cury += line_spacing; 264 263 } … … 269 268 // output any remaining text 270 269 if (here - startline > 0) { 271 TextOut (pdc, STATUSX, cury, &statusstring[startline], here-startline);270 TextOut (pdc, ENTERSTRINGX, cury, &enterstring[startline], here-startline); 272 271 } 273 272 } 274 273 } 275 274 276 // update the logo (always)277 BitBlt (pdc, LOGOX, LOGOY, LOGOX+LOGOWIDTH, LOGOY+LOGOHEIGHT,278 logodc, 0, 0, SRCCOPY);279 280 275 window_state = plain_window; 281 276 } 282 277 283 284 278 // update the info string if needed 285 if (init_done && ((GoButton == NULL) && (infostring != NULL) &&286 287 288 279 if (init_done && !gsdl_show_console && 280 ((infostring != NULL) && overlap (INFOX, INFOY, 281 INFOX+INFOWIDTH, INFOY+INFOHEIGHT, 282 updateRect))) { 289 283 RECT infoRect; 290 284 infoRect.left = INFOX; … … 295 289 DrawText(pdc, infostring, -1, &infoRect, DT_CENTER); 296 290 } 291 292 // update the logo (always) 293 BitBlt (pdc, LOGOX, LOGOY, LOGOX+LOGOWIDTH, LOGOY+LOGOHEIGHT, 294 logodc, 0, 0, SRCCOPY); 297 295 } 298 296 … … 344 342 delete cstr_url; 345 343 346 } else {347 /*348 char staticpath[256];349 350 // try to find the static pages351 strcpy (url, gsdl_staticpages);352 353 // remove any slashes from the static pathname354 int len = strlen (url);355 while ((len > 0) && ((url[len-1] == '\\') || (url[len-1] == '/'))) {356 len--;357 }358 url[len] = '\0';359 360 // add one slash to the end361 strcat (url, "\\");362 363 // check to make sure the static directory is available364 strcpy (staticpath, url);365 strcat (staticpath, "static\\");366 367 // check this directory368 if (!cstrcheckdir(staticpath)) {369 PostMessage(Window,WM_CLOSE,0,0);370 return 0;371 }372 373 // add filename of the first page374 strcat (url, "niupepa.htm");375 376 res = startbrowser (url, gsdl_browser_exe, NULL);377 startbrowserdir[0] = '\0'; // doesn't make sense for non-networked case378 */379 344 } 380 345 … … 520 485 break; 521 486 522 // case WM_CHAR:523 // if the user hit the return key and if this is not a524 // repeat key press then attempt to start a browser525 // 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 535 487 case WM_COMMAND: 536 488 if ((GoButton != NULL) && ((HWND)LParam == GoButton)) { 537 489 // attempt to start a browser 538 490 if (enter_library (Window) && !gsdl_show_console) 539 ShowWindow(Window,SW_MINIMIZE);540 541 } else if (( HWND)LParam == Gold) {491 ShowWindow(Window,SW_MINIMIZE); 492 493 } else if ((Enter != NULL) && ((HWND)LParam == Enter)) { 542 494 init_done = 1; 543 495 init_type = 1; 544 496 545 } else if (( HWND)LParam == Silver) {497 } else if ((EnterRestricted != NULL) && ((HWND)LParam == EnterRestricted)) { 546 498 init_done = 1; 547 499 init_type = 0; 500 501 } else if ((InfoRestricted != NULL) && ((HWND)LParam == InfoRestricted)) { 502 MessageBox (NULL, "The Greenstone system automatically determines whether your computer has\n" 503 "network software installed or is connected to a network. It operates correctly\n" 504 "under any of these conditions.\n\n" 505 "The restricted version is intended for use when the standard one\n\n" 506 " (a) causes an unwanted telephone dialup operation;\n" 507 " (b) fails to run because network software is installed, but installed\n" 508 " incorrectly.\n\n" 509 "The restricted version only works with Netscape (not Internet Explorer).\n\n" 510 "Unless these problems arise, you should always use the standard version\n" 511 "(press the 'Enter Library' button).\n", 512 "Greenstone Digital Library Software", 513 MB_OK | MB_ICONINFORMATION | MB_APPLMODAL); 548 514 549 515 } else { … … 782 748 783 749 strcat (message, "\n\n" 784 // no static library for this collection785 // "You will still be able to use the static version of this\n"786 // "collection, however, searching will be unavailable.");787 750 "Please submit a bug report using the support.htm file\n" 788 751 "on the CD-ROM."); … … 865 828 return 0; 866 829 830 867 831 // Load various bitmaps 868 832 coltitlebitmap = LoadBitmap (Instance, MAKEINTRESOURCE(GSDL_COL_TITLE)); … … 870 834 871 835 // Create the main window 872 MainWindow = CreateWindow Ex(WS_EX_CONTROLPARENT,"Greenstone Digital Library Software",836 MainWindow = CreateWindow("Greenstone Digital Library Software", 873 837 "Greenstone Digital Library Software", 874 838 WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | … … 882 846 text_rect.top = VERSIONY+VERSIONHEIGHT + 5; 883 847 text_rect.right = MAINWINDOWWIDTH; 884 text_rect.bottom = MAINWINDOWHEIGHT-RESTHEIGHT - 1;848 text_rect.bottom = LOGOY-SPACERWIDTH; 885 849 886 850 window_state = undefined_window; … … 900 864 GSDL_Window = MainWindow; 901 865 866 // init various modules 867 read_settings (0); // don't know if netscape is needed at this point 868 869 if (!gsdl_auto_enter) { 870 871 // add the select version checkbox 872 Enter = CreateWindow("BUTTON", // predefined class 873 "Enter Library", // button text 874 WS_VISIBLE | WS_CHILD | WS_TABSTOP | BS_DEFPUSHBUTTON, // styles 875 ENTERBUTTONX, // starting x position 876 ENTERBUTTONY, // starting y position 877 ENTERBUTTONWIDTH, // button width 878 ENTERBUTTONHEIGHT, // button height 879 MainWindow, // parent window 880 NULL, // No menu 881 Instance, 882 NULL); // pointer not needed 883 884 EnterRestricted = CreateWindow("Button", // predefined class 885 "Restricted Version", // button text 886 WS_VISIBLE | WS_CHILD | WS_TABSTOP | BS_PUSHBUTTON, // styles 887 ALTERNATIVEBUTTONX, // starting x position 888 ALTERNATIVEBUTTONY, // starting y position 889 ALTERNATIVEBUTTONWIDTH-(INFOBUTTONWIDTH+SPACERWIDTH), // button width 890 ALTERNATIVEBUTTONHEIGHT, // button height 891 MainWindow, // parent window 892 (HMENU)NULL, // No menu 893 Instance, 894 NULL); // pointer not needed 895 896 InfoRestricted = CreateWindow("Button", // predefined class 897 NULL, 898 WS_VISIBLE | WS_CHILD | WS_TABSTOP | BS_BITMAP, // styles 899 ALTERNATIVEBUTTONWIDTH-INFOBUTTONWIDTH+SPACERWIDTH, // starting x position 900 ALTERNATIVEBUTTONY, // starting y position 901 INFOBUTTONWIDTH, // button width 902 ALTERNATIVEBUTTONHEIGHT, // button height 903 MainWindow, // parent window 904 (HMENU)NULL, // No menu 905 Instance, 906 NULL); // pointer not needed 907 908 HANDLE i_icon = LoadImage (Instance, MAKEINTRESOURCE(GSDL_ICBMP), IMAGE_BITMAP, 909 INFOBUTTONWIDTH-4, ALTERNATIVEBUTTONHEIGHT-4, LR_DEFAULTCOLOR); 910 SendMessage (InfoRestricted, BM_SETIMAGE, IMAGE_BITMAP, (LPARAM)i_icon); 911 912 SetFocus (Enter); 913 914 enterstring = strenterlib; 915 paint_window (pdc, windowRect); 916 917 // message loop for init buttons 918 while (!init_done) { 919 if (PeekMessage(&Message, NULL, 0, 0, PM_REMOVE)) { 920 if (Message.message == WM_QUIT) return Message.wParam; 921 if (!IsDialogMessage (MainWindow, &Message)) { 922 TranslateMessage(&Message); /* translate keyboard messages */ 923 DispatchMessage(&Message); /* return control to Windows NT */ 924 } 925 } else { 926 Sleep (1); 927 } 928 } 929 930 // don't want these buttons anymore 931 DestroyWindow (Enter); 932 DestroyWindow (EnterRestricted); 933 DestroyWindow (InfoRestricted); 934 935 enterstring = strnothing; 936 paint_window (pdc, windowRect); 937 938 } else { 939 // auto enter is enabled - start up standard version 940 init_type = 1; 941 init_done = 1; 942 } 943 902 944 // draw the main window containing an init message 903 945 infostring = strinit; 904 946 paint_window (pdc, windowRect); 905 947 DWORD lastcheck = GetTickCount(); 906 907 // init various modules 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); 959 960 // attempt to initialise the network 961 // we do this first now as gsdl_init 962 // needs networking initialized to 963 // set httpprefix - Stefan. 964 // -- gsdl_init doesn't currently set httpprefix, 965 // it did for a brief time when I was using some 966 // scary html that didn't like relative links 948 967 949 have_networking = initnetwork (Instance, MainWindow); 968 950 if (!have_networking) { … … 970 952 "Failed to initialize networking.", 971 953 "Greenstone Digital Library Software",MB_OK|MB_SYSTEMMODAL); 972 exit (0); // there is no static library for this collection954 exit (0); 973 955 } 974 956 … … 983 965 } 984 966 985 // if autoenter is enabled attempt to start a browser 986 if (have_networking && gsdl_auto_enter) { 987 infostring = strsb; 988 paint_window (pdc, windowRect); 989 lastcheck = GetTickCount(); 990 if (enter_library (MainWindow) && !gsdl_show_console) { 991 // stay maximised for at least 1 second 992 while (DiffTickCounts (lastcheck, GetTickCount()) < 1000) Sleep (1); 993 ShowWindow(MainWindow,SW_MINIMIZE); 994 } 995 } 996 997 // remove the last info message 998 infostring = strnothing; 967 // attempt to start a browser 968 if (gsdl_show_console) infostring = strnothing; 969 else infostring = strsb; 999 970 paint_window (pdc, windowRect); 1000 1001 // add the "enter library" button 971 lastcheck = GetTickCount(); 972 if (enter_library (MainWindow) && !gsdl_show_console) { 973 // stay maximised for at least 1 second 974 while (DiffTickCounts (lastcheck, GetTickCount()) < 1000) Sleep (1); 975 ShowWindow(MainWindow,SW_MINIMIZE); 976 } 977 978 // add the "restart library" button 1002 979 GoButton = CreateWindow("BUTTON", // predefined class 1003 " Enter Library",// button text980 "Restart Library", // button text 1004 981 WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON, // styles 1005 ENTERBUTTONX,// starting x position1006 ENTERBUTTONY,// starting y position1007 ENTERBUTTONWIDTH,// button width1008 ENTERBUTTONHEIGHT,// button height982 RESTARTBUTTONX, // starting x position 983 RESTARTBUTTONY, // starting y position 984 RESTARTBUTTONWIDTH, // button width 985 RESTARTBUTTONHEIGHT, // button height 1009 986 MainWindow, // parent window 1010 987 NULL, // No menu 1011 988 Instance, 1012 989 NULL); // pointer not needed 1013 1014 SetFocus (GoButton); 1015 1016 if (have_networking) statusstring = strenterlib; 1017 else statusstring = strenterstaticlib; 990 991 infostring = strrestartlib; 1018 992 paint_window (pdc, windowRect); 1019 993 … … 1024 998 lastcheck = GetTickCount(); 1025 999 int seenbrowser = 0; // if we see a browser then it disappears 1026 // we will ask if they want to close the1027 // the library down1000 // we will ask if they want to close the 1001 // the library down 1028 1002 char last_gsdl_browser_exe[MAX_FILENAME_SIZE]; // need to notice when the 1029 // browser setting changes1003 // browser setting changes 1030 1004 strcpy (last_gsdl_browser_exe, gsdl_browser_exe); 1031 1005 … … 1068 1042 } else { 1069 1043 // no browser was found 1044 1070 1045 if (seenbrowser) { 1071 1046 // we have seen a browser in the past -
trunk/gsdl/src/w32server/resource.h
r902 r1292 11 11 #define GSDL_COL_TITLE 109 12 12 #define IDD_DIALOG1 118 13 #define GSDL_ICBMP 126 13 14 #define APPLY_BUTTON 1000 14 15 #define REMOTE_CHECK 1001 … … 42 43 #ifdef APSTUDIO_INVOKED 43 44 #ifndef APSTUDIO_READONLY_SYMBOLS 44 #define _APS_NEXT_RESOURCE_VALUE 1 1945 #define _APS_NEXT_COMMAND_VALUE 400 0846 #define _APS_NEXT_CONTROL_VALUE 102 445 #define _APS_NEXT_RESOURCE_VALUE 127 46 #define _APS_NEXT_COMMAND_VALUE 40011 47 #define _APS_NEXT_CONTROL_VALUE 1026 47 48 #define _APS_NEXT_SYMED_VALUE 102 48 49 #endif
Note:
See TracChangeset
for help on using the changeset viewer.