[Dda-cvs] ntdda/src/win32gui winmain.c,1.43,1.44
Status: Beta
Brought to you by:
doolin
From: David M. D. <do...@us...> - 2006-07-01 17:48:28
|
Update of /cvsroot/dda/ntdda/src/win32gui In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv8627 Modified Files: winmain.c Log Message: Cleaned up title bar handling for main window using a function call with arguments for setting text. Index: winmain.c =================================================================== RCS file: /cvsroot/dda/ntdda/src/win32gui/winmain.c,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** winmain.c 1 Jul 2006 14:58:07 -0000 1.43 --- winmain.c 1 Jul 2006 15:20:58 -0000 1.44 *************** *** 57,67 **** /* Whole bunch of global variables that need to disappear fast. */ ! char szAppName[] = "Berkeley DDA for Windows"; char mess[80]; /* mess appears to be a temporary variable. Might be able to get rid of it. */ // Get rid of this as well. - char mainWinTitle[120]; - #define ABOUT "UC Berkeley DDA for Windows 95/NT,\n", \ --- 57,65 ---- /* Whole bunch of global variables that need to disappear fast. */ ! char szAppName[] = "DDA for Windows"; char mess[80]; /* mess appears to be a temporary variable. Might be able to get rid of it. */ // Get rid of this as well. #define ABOUT "UC Berkeley DDA for Windows 95/NT,\n", \ *************** *** 144,147 **** --- 142,154 ---- + void + set_mainwindow_titlebar(HWND hwMain, char * filetype, char * filename) { + + char mainWinTitle[120]; + + sprintf(mainWinTitle, "%s --- %s: %s",szAppName,filetype,filepath.gfile); + SetWindowText(hwMain, (LPCTSTR) mainWinTitle); + } + void *************** *** 625,630 **** whatToDraw = NOTHING; filepath.gfile[0] = '\0'; ! sprintf(mainWinTitle, "%s for Windows 95/NT", (LPSTR) szAppName); ! SetWindowText(hwMain, (LPCTSTR) mainWinTitle); dda_set_menu_state(dda,GEOM_STATE | ABORTED); } --- 632,639 ---- whatToDraw = NOTHING; filepath.gfile[0] = '\0'; ! //sprintf(mainWinTitle, "%s for Windows 95/NT", (LPSTR) szAppName); ! //SetWindowText(hwMain, (LPCTSTR) mainWinTitle); ! set_mainwindow_titlebar(hwMain,NULL,NULL); ! dda_set_menu_state(dda,GEOM_STATE | ABORTED); } *************** *** 645,650 **** strcpy(filepath.oldfile, filepath.gfile); filepath.gfile[0] = '\0'; ! sprintf(mainWinTitle, "%s for Windows 95/NT", (LPSTR) szAppName); ! SetWindowText(hwMain, (LPCTSTR) mainWinTitle); hInst = (HINSTANCE) GetWindowLong(hwMain, GWL_HINSTANCE); --- 654,660 ---- strcpy(filepath.oldfile, filepath.gfile); filepath.gfile[0] = '\0'; ! //sprintf(mainWinTitle, "%s for Windows 95/NT", (LPSTR) szAppName); ! //SetWindowText(hwMain, (LPCTSTR) mainWinTitle); ! set_mainwindow_titlebar(hwMain,NULL,NULL); hInst = (HINSTANCE) GetWindowLong(hwMain, GWL_HINSTANCE); *************** *** 655,660 **** if(DialogBoxParam(hInst, "DRAWDLG", hwMain, (DLGPROC)DrawDlgProc, (LPARAM)12 ) ) { ! sprintf(mainWinTitle, "%s for Windows 95/NT --- Geometry = %s", (LPSTR) szAppName, filepath.gfile); ! SetWindowText(hwMain, (LPCTSTR) mainWinTitle); } --- 665,672 ---- if(DialogBoxParam(hInst, "DRAWDLG", hwMain, (DLGPROC)DrawDlgProc, (LPARAM)12 ) ) { ! //sprintf(mainWinTitle, "%s for Windows 95/NT --- Geometry = %s", (LPSTR) szAppName, filepath.gfile); ! //SetWindowText(hwMain, (LPCTSTR) mainWinTitle); ! set_mainwindow_titlebar(hwMain, "Geometry",filepath.gfile); ! } *************** *** 680,685 **** if(filepath.gfile[0] != '\0') { ! sprintf(mainWinTitle, "%s for Windows 95/NT --- Geometry = %s", (LPSTR) szAppName, filepath.gfile); ! SetWindowText(hwMain, (LPCTSTR) mainWinTitle); if (strcmp(filepath.gfile, filepath.oldfile) != 0 && MessageBox(hwMain, "Apply geometry?", "GEOMETRY", MB_YESNO) == IDYES) { --- 692,699 ---- if(filepath.gfile[0] != '\0') { ! //sprintf(mainWinTitle, "%s for Windows 95/NT --- Geometry = %s", (LPSTR) szAppName, filepath.gfile); ! //SetWindowText(hwMain, (LPCTSTR) mainWinTitle); ! set_mainwindow_titlebar(hwMain, "Geometry",filepath.gfile); ! if (strcmp(filepath.gfile, filepath.oldfile) != 0 && MessageBox(hwMain, "Apply geometry?", "GEOMETRY", MB_YESNO) == IDYES) { *************** *** 707,713 **** else { ! sprintf(mainWinTitle, "%s for Windows 95/NT --- Geometry = %s", (LPSTR) szAppName, (LPSTR) filepath.gfile); ! ! SetWindowText(hwMain, (LPCTSTR) mainWinTitle); dda_set_menu_state(dda,GEOM_STATE); --- 721,727 ---- else { ! //sprintf(mainWinTitle, "%s for Windows 95/NT --- Geometry = %s", (LPSTR) szAppName, (LPSTR) filepath.gfile); ! //SetWindowText(hwMain, (LPCTSTR) mainWinTitle); ! set_mainwindow_titlebar(hwMain, "Geometry",filepath.gfile); dda_set_menu_state(dda,GEOM_STATE); *************** *** 805,813 **** else { ! sprintf(mainWinTitle, ! "%s for Windows 95/NT --- Geometry = %s, Analysis File = %s", ! (LPSTR) szAppName, (LPSTR) filepath.gfile, (LPSTR) filepath.afile); ! ! SetWindowText(hwMain, (LPCTSTR) mainWinTitle); //updateMainMenu(hwMain, anastate*readystate); //dda->menustate = ANA_STATE | READY_STATE; --- 819,830 ---- else { ! ! // TODO: Find a way to handle both Geometry and Analysis files ! // with a titlebar call. ! //sprintf(mainWinTitle, "%s for Windows 95/NT --- Geometry = %s, Analysis File = %s", (LPSTR) szAppName, (LPSTR) filepath.gfile, (LPSTR) filepath.afile); ! //SetWindowText(hwMain, (LPCTSTR) mainWinTitle); ! ! set_mainwindow_titlebar(hwMain, "Analysis",filepath.afile); ! //updateMainMenu(hwMain, anastate*readystate); //dda->menustate = ANA_STATE | READY_STATE; *************** *** 926,936 **** Geometrydata * geomdata = dda_get_geometrydata(dda); strcpy(filepath.oldfile, filepath.afile); ! filepath.afile[0] = '\0'; ! sprintf(mainWinTitle, "%s for Windows 95/NT --- Geometry = %s", ! (LPSTR) szAppName, filepath.gfile); ! ! hInst = (HINSTANCE) GetWindowLong(hwMain, GWL_HINSTANCE); ! SetWindowText(hwMain, (LPCTSTR) mainWinTitle); if (!DialogBoxParam(hInst, "ANALDLG2", hwMain, (DLGPROC)AnalDlgProc,(LPARAM)geomdata )) --- 943,952 ---- Geometrydata * geomdata = dda_get_geometrydata(dda); strcpy(filepath.oldfile, filepath.afile); ! filepath.afile[0] = '\0'; ! hInst = (HINSTANCE) GetWindowLong(hwMain, GWL_HINSTANCE); ! //sprintf(mainWinTitle, "%s for Windows 95/NT --- Geometry = %s", LPSTR) szAppName, filepath.gfile); ! //SetWindowText(hwMain, (LPCTSTR) mainWinTitle); ! set_mainwindow_titlebar(hwMain, "Geometry",filepath.gfile); if (!DialogBoxParam(hInst, "ANALDLG2", hwMain, (DLGPROC)AnalDlgProc,(LPARAM)geomdata )) *************** *** 939,949 **** } ! if(filepath.afile[0] != '\0') ! { ! sprintf(mainWinTitle, ! "%s for Windows 95/NT --- Geometry = %s, Analysis File = %s", ! (LPSTR) szAppName, filepath.gfile, filepath.afile); ! SetWindowText(hwMain, (LPCTSTR) mainWinTitle); if (MessageBox(hwMain, "Run analysis?", "ANALYSIS", MB_YESNO) == IDYES) --- 955,963 ---- } ! if(filepath.afile[0] != '\0') { ! //sprintf(mainWinTitle, "%s for Windows 95/NT --- Geometry = %s, Analysis File = %s", (LPSTR) szAppName, filepath.gfile, filepath.afile); ! //SetWindowText(hwMain, (LPCTSTR) mainWinTitle); ! set_mainwindow_titlebar(hwMain, "Analysis",filepath.afile); if (MessageBox(hwMain, "Run analysis?", "ANALYSIS", MB_YESNO) == IDYES) *************** *** 974,982 **** //iface->setdisplay((unsigned int)hwMain); ! if(filepath.afile[0] != '\0') ! { ! sprintf(mainWinTitle, "%s for Windows 95/NT --- Geometry = %s, Analysis File = %s", ! (LPSTR) szAppName, filepath.gfile, filepath.afile); ! SetWindowText(hwMain, (LPCTSTR) mainWinTitle); if (MessageBox(hwMain, "Run analysis?", "ANALYSIS", MB_YESNO) == IDYES) { --- 988,997 ---- //iface->setdisplay((unsigned int)hwMain); ! if(filepath.afile[0] != '\0') { ! ! //sprintf(mainWinTitle, "%s for Windows 95/NT --- Geometry = %s, Analysis File = %s", LPSTR) szAppName, filepath.gfile, filepath.afile); ! //SetWindowText(hwMain, (LPCTSTR) mainWinTitle); ! set_mainwindow_titlebar(hwMain, "Analysis",filepath.afile); ! if (MessageBox(hwMain, "Run analysis?", "ANALYSIS", MB_YESNO) == IDYES) { *************** *** 1713,1717 **** - // This subroutine is wrote by Roozbeh to read the .dxf // format and to create the .geo format --- 1728,1731 ---- *************** *** 1724,1728 **** DDA * dda = (DDA *)GetWindowLong(hwMain,GWL_USERDATA); ! LPCTSTR szFilter[] = {"Autocad Dxf files (*.dxf)\0*.dxf\0All files (*.*)\0*.*\0\0"}; fileBrowse(hwMain, &ofn, szFilter, filepath.gpath, filepath.gfile, "dxf"); --- 1738,1744 ---- DDA * dda = (DDA *)GetWindowLong(hwMain,GWL_USERDATA); ! LPCTSTR szFilter[] = {"Autocad Dxf files (*.dxf)\0*.dxf\0All files (*.*)\0*.*\0\0"}; ! // TODO: Add a dxf file type for this, instead of shoving into the geometry file. ! // That way, the dxf file can be modified independently at a future date. fileBrowse(hwMain, &ofn, szFilter, filepath.gpath, filepath.gfile, "dxf"); *************** *** 1731,1737 **** return 0; /* user pressed cancel */ } ! ! sprintf(mainWinTitle, "%s for Windows --- Geometry = %s", (LPSTR) szAppName, (LPSTR) filepath.gfile); ! SetWindowText(hwMain, (LPCTSTR) mainWinTitle); dda_set_menu_state(dda,GEOM_STATE); --- 1747,1752 ---- return 0; /* user pressed cancel */ } ! ! set_mainwindow_titlebar(hwMain,"DXF",filepath.gfile); dda_set_menu_state(dda,GEOM_STATE); *************** *** 2112,2117 **** hddawin = CreateWindowEx(WS_EX_ACCEPTFILES, ! szAppName, ! "Berkeley DDA for Windows NT", WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN, --- 2127,2132 ---- hddawin = CreateWindowEx(WS_EX_ACCEPTFILES, ! szAppName, ! szAppName, WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN, |