| 173 | // CGrFontDialog message handlers |
| 174 | |
| 175 | void CGrFontDialog::OnNew() { |
| 176 | // TODO: Add your control notification handler code here |
| 177 | // Bring up Open TGA dialog. |
| 178 | CString filter = "D3 bitmap files (*.tga; *lbm; *.bbm)|*.tga; *.lbm; *.bbm|Targa files (*.tga)|*.tga|IFF files " |
| 179 | "(*.bbm; *.lbm)|*.bbm; *.lbm||"; |
| 180 | |
| 181 | CFileDialog dlg_open(TRUE, 0, 0, OFN_FILEMUSTEXIST, (LPCTSTR)filter, this); |
| 182 | |
| 183 | if (dlg_open.DoModal() == IDCANCEL) |
| 184 | return; |
| 185 | |
| 186 | // Okay, load in the proper picture for the font |
| 187 | char filename[255]; |
| 188 | int bm_handle; |
| 189 | |
| 190 | lstrcpy(filename, dlg_open.GetPathName()); |
| 191 | |
| 192 | if (m_FontPicBm > -1) |
| 193 | bm_FreeBitmap(m_FontPicBm); |
| 194 | m_FontPicBm = -1; |
| 195 | |
| 196 | mprintf(0, "Loading font template: %s...", filename); |
| 197 | bm_handle = bm_AllocLoadFileBitmap(filename, 0); |
| 198 | if (bm_handle < 0) { |
| 199 | mprintf(0, "shit!\n"); |
| 200 | OutrageMessageBox("Couldn't open the font template file."); |
| 201 | return; |
| 202 | } |
| 203 | mprintf(0, "finished!\n"); |
| 204 | |
| 205 | m_FontPicBm = bm_handle; |
| 206 | |
| 207 | // Get MinAscii and other needed info before extracting font. |
| 208 | |
| 209 | if (!extract_font(&m_FontRecord)) { |
| 210 | OutrageMessageBox("Unable to generate font from template %s.", filename); |
| 211 | return; |
| 212 | } |
| 213 | |
| 214 | UpdateDialog(); |
| 215 | |
| 216 | // Display font on screen. |
| 217 | CWnd::Invalidate(); |
| 218 | } |
| 219 | |
| 220 | void CGrFontDialog::OnPaint() { |
| 221 | CPaintDC dc(this); // device context for painting |
nothing calls this directly
no test coverage detected