Changeset 5889
- Timestamp:
- 2003-11-19T12:14:36+13:00 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/src/w32server/fnord.cpp
r4642 r5889 140 140 int init_done = 0; 141 141 142 void finish_up() { 142 143 // Added an argument so you can specify not to do any of the windows orientated clean up - jmt12 18/11/2003 144 void finish_up(bool init_only) { 143 145 // remember the current preferences 144 146 write_settings(""); 145 147 146 // Shutdown the HTTP server 148 if(init_only) { 149 return; 150 } 151 152 // Shutdown the HTTP server 147 153 EndHTTPServer(); 148 154 … … 539 545 break; 540 546 case ID_PROJECT_EXIT: 541 finish_up( );547 finish_up(false); 542 548 break; 543 549 default: … … 556 562 557 563 case WM_DESTROY: 558 finish_up( );564 finish_up(false); 559 565 break; 560 566 … … 669 675 "Greenstone Digital Library Software", MB_OK|MB_APPLMODAL); 670 676 PostMessage(MsgWindow,WM_CLOSE,0,0); 671 finish_up( ); // will unload winsock677 finish_up(false); // will unload winsock 672 678 exit(0); // nothing more to do 673 679 } … … 831 837 // --config=file (the path to the configuration file to use which defaults 832 838 // to GSDLHOME\gsdlsite.cfg) 833 static void parse_args(const text_t cmdline, text_t &location, text_t &config_file) { 839 // --cmd=init Used to initialize the gsdlsite.cfg file onlt - jmt12 18/11/2003 840 static void parse_args(const text_t cmdline, text_t &location, text_t &config_file, text_t &command) { 834 841 835 842 location.clear(); 836 843 config_file.clear(); 844 command.clear(); // jmt12 18/11/2003 837 845 838 846 if (cmdline.size() < 3) return; … … 849 857 } else if (name == "config") { 850 858 config_file = val; 859 } 860 // jmt12 18/11/2003 861 else if(name == "cmd") { 862 command = val; 851 863 } 852 864 foundname = false; … … 869 881 config_file = val; 870 882 } 871 } 872 873 883 // jmt12 18/11/2003 884 else if(name == "cmd") { 885 command = val; 886 } 887 } 888 889 // Added code to allow for an 'init' run of the server which just creates the gsdlsite.cfg file 874 890 int __stdcall WinMain(HINSTANCE Instance, HINSTANCE /*PrevInstance*/, LPSTR CmdLineStr, int /*CmdShow*/) { 875 891 HWND MainWindow; MSG Message; WNDCLASS MainClass; 876 892 877 893 // parse arguments 878 text_t location, config_file ;879 parse_args(CmdLineStr, location, config_file );894 text_t location, config_file, command; 895 parse_args(CmdLineStr, location, config_file, command); 880 896 gsdl_conffile = config_file; 897 898 // jmt12 18/11/2003 899 if(command == "init") { 900 // init various modules 901 read_settings(0); // don't know if netscape is needed at this point 902 finish_up(true); 903 exit(0); 904 } 881 905 882 906 //Create a window class … … 894 918 return 0; 895 919 896 920 897 921 // Load various bitmaps 898 922 coltitlebitmap = LoadBitmap (Instance, MAKEINTRESOURCE(GSDL_COL_TITLE)); 899 923 logobitmap= LoadBitmap (Instance, MAKEINTRESOURCE(GSDL_LOGO)); 900 924 901 925 // Create the main window 902 926 MainWindow = CreateWindow("Greenstone Digital Library Software", … … 928 952 GetTextMetrics(pdc, &tm); 929 953 line_spacing = tm.tmHeight + tm.tmExternalLeading; 930 GSDL_Window = MainWindow; 931 954 GSDL_Window = MainWindow; 955 932 956 // init various modules 933 957 read_settings (0); // don't know if netscape is needed at this point 934 958 935 959 if (!gsdl_auto_enter) { 936 960 937 961 // add the select version checkbox 938 962 Enter = CreateWindow("BUTTON", // predefined class … … 971 995 Instance, 972 996 NULL); // pointer not needed 973 997 974 998 HANDLE i_icon = LoadImage (Instance, MAKEINTRESOURCE(GSDL_ICBMP), IMAGE_BITMAP, 975 999 INFOBUTTONWIDTH-4, ALTERNATIVEBUTTONHEIGHT-4, LR_DEFAULTCOLOR); 976 1000 SendMessage (InfoRestricted, BM_SETIMAGE, IMAGE_BITMAP, (LPARAM)i_icon); 977 1001 978 1002 SetFocus (Enter); 979 1003 980 1004 enterstring = strenterlib; 981 1005 paint_window (pdc, windowRect); 982 1006 983 1007 // message loop for init buttons 984 1008 while (!init_done) { … … 993 1017 } 994 1018 } 995 1019 996 1020 // don't want these buttons anymore 997 1021 DestroyWindow (Enter); 998 1022 DestroyWindow (EnterRestricted); 999 1023 DestroyWindow (InfoRestricted); 1000 1024 1001 1025 enterstring = strnothing; 1002 1026 paint_window (pdc, windowRect); 1003 1027 1004 1028 } else { 1005 1029 // auto enter is enabled - start up standard version … … 1007 1031 init_done = 1; 1008 1032 } 1009 1033 1010 1034 // draw the main window containing an init message 1011 1035 infostring = strinit; 1012 1036 paint_window (pdc, windowRect); 1013 1037 DWORD lastcheck = GetTickCount(); 1014 1038 1015 1039 have_networking = initnetwork (Instance, MainWindow); 1016 1040 if (!have_networking) { … … 1020 1044 exit (0); 1021 1045 } 1022 1046 1023 1047 if (!gsdl_init()) // quit if can't initialise the library correctly 1024 1048 exit (0); 1025 1049 initstartbrowser(); 1026 1050 log_computer_info (); 1027 1051 1028 1052 // show the initialising message for at least 1 second 1029 1053 while (DiffTickCounts (lastcheck, GetTickCount()) < 1000) { … … 1057 1081 infostring = strrestartlib; 1058 1082 paint_window (pdc, windowRect); 1059 1083 1060 1084 // release the DC used to display the init messages 1061 1085 ReleaseDC (MainWindow, pdc); … … 1110 1134 } else { 1111 1135 // no browser was found 1112 1136 1113 1137 if (seenbrowser) { 1114 1138 // we have seen a browser in the past … … 1130 1154 return Message.wParam; 1131 1155 } 1156
Note:
See TracChangeset
for help on using the changeset viewer.