20 #include "MessageEditorDlg.h"
21 #include "ShipClassEditorDlg.h"
22 #include "MissionNotesDlg.h"
30 static char THIS_FILE[] = __FILE__;
54 ON_COMMAND(ID_VIEW_STATUS_BAR, OnViewStatusBar)
55 ON_UPDATE_COMMAND_UI(ID_VIEW_STATUS_BAR, OnUpdateViewStatusBar)
60 ON_UPDATE_COMMAND_UI(IDR_MENU_POPUP_TOGGLE1, OnUpdateMenuPopupToggle1)
65 ON_COMMAND(ID_HELP_FINDER, OnFredHelp)
66 ON_COMMAND(ID_HELP, OnFredHelp)
73 #define FRED_HELP_URL "\\data\\freddocs\\index.html"
75 static UINT indicators[] =
108 if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
114 TRACE0(
"Failed to create toolbar\n");
121 m_wndToolBar.SetButtonInfo(z, ID_NEW_SHIP_TYPE, TBBS_SEPARATOR, 230);
127 rect.bottom = rect.top + 550;
128 if (!m_new_ship_type_combo_box.Create(CBS_DROPDOWNLIST | WS_VISIBLE | WS_VSCROLL | CBS_HASSTRINGS | LBS_OWNERDRAWFIXED,
131 TRACE0(
"Failed to create new ship type combo-box\n");
151 TRACE0(
"Failed to create status bar\n");
164 CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);
168 m_wndToolBar.EnableDocking(CBRS_ALIGN_TOP | CBRS_ALIGN_BOTTOM);
169 EnableDocking(CBRS_ALIGN_ANY);
172 Fred_main_wnd =
this;
177 LoadBarState(
"Tools state");
186 return CFrameWnd::PreCreateWindow(cs);
193 void CMainFrame::AssertValid()
const
195 CFrameWnd::AssertValid();
198 void CMainFrame::Dump(CDumpContext& dc)
const
251 CFrameWnd::OnLButtonUp(nFlags, point);
258 Fred_main_wnd = NULL;
259 CFrameWnd::OnDestroy();
275 pCmdUI->Enable(::GetKeyState(VK_LBUTTON) < 0);
280 pCmdUI->Enable(::GetKeyState(VK_RBUTTON) < 0);
294 if (Toggle1_var == 0)
303 pCmdUI->SetCheck(Toggle1_var);
311 point = * ((CPoint*) lParam);
313 ClientToScreen(&point);
316 menu.GetSubMenu(0)->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y,
this);
325 Global_point2 = point;
328 CFrameWnd::OnRButtonDown(nFlags, point);
341 SaveBarState(
"Tools state");
342 CFrameWnd::OnClose();
352 static int count = 0;
356 }
else if (count >= 3) {
357 Warning(
LOCATION,
"CMainFrame::init_tools was called more than twice! Trace out and fix.");
364 m_new_ship_type_combo_box.AddString(
"");
368 m_new_ship_type_combo_box.AddString(it->name);
372 m_new_ship_type_combo_box.AddString(
"Jump Node");
373 m_new_ship_type_combo_box.AddString(
"Waypoint");
387 m_new_ship_type_combo_box.SetCurSel(0);
396 void color_combo_box::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
398 int m_cyText = 24,
z;
403 ASSERT((GetStyle() & (LBS_OWNERDRAWFIXED | CBS_HASSTRINGS)) ==
404 (LBS_OWNERDRAWFIXED | CBS_HASSTRINGS));
406 CDC* pDC = CDC::FromHandle(lpDrawItemStruct->hDC);
409 if(lpDrawItemStruct->itemID >=
Ship_info.size()){
410 z = lpDrawItemStruct->itemID;
412 memset(ship_name, 0, 256);
413 GetLBText(lpDrawItemStruct->itemID, ship_name);
417 if ((
z >= 0) && (lpDrawItemStruct->itemAction & (ODA_DRAWENTIRE | ODA_SELECT)))
419 int cyItem = GetItemHeight(
z);
420 BOOL fDisabled = !IsWindowEnabled();
422 COLORREF newTextColor = RGB(0x80, 0x80, 0x80);
426 newTextColor = RGB(0, 0, 0);
434 COLORREF oldTextColor = pDC->SetTextColor(newTextColor);
435 COLORREF newBkColor = GetSysColor(COLOR_WINDOW);
436 COLORREF oldBkColor = pDC->SetBkColor(newBkColor);
438 if (newTextColor == newBkColor)
439 newTextColor = RGB(0xC0, 0xC0, 0xC0);
441 if (!fDisabled && ((lpDrawItemStruct->itemState & ODS_SELECTED) != 0))
443 pDC->SetTextColor(GetSysColor(COLOR_HIGHLIGHTTEXT));
444 pDC->SetBkColor(GetSysColor(COLOR_HIGHLIGHT));
448 VERIFY(cyItem >= CalcMinimumItemHeight());
451 strText = _T(
"Jump Node");
453 strText = _T(
"Player Start");
455 strText = _T(
"Waypoint");
460 pDC->ExtTextOut(lpDrawItemStruct->rcItem.left,
461 lpDrawItemStruct->rcItem.top + max(0, (cyItem - m_cyText) / 2),
462 ETO_OPAQUE, &(lpDrawItemStruct->rcItem), strText, strText.GetLength(), NULL);
464 pDC->SetTextColor(oldTextColor);
465 pDC->SetBkColor(oldBkColor);
468 if ((lpDrawItemStruct->itemAction & ODA_FOCUS) != 0)
469 pDC->DrawFocusRect(&(lpDrawItemStruct->rcItem));
472 int color_combo_box::CalcMinimumItemHeight()
476 if ((GetStyle() & (LBS_HASSTRINGS | LBS_OWNERDRAWFIXED)) ==
477 (LBS_HASSTRINGS | LBS_OWNERDRAWFIXED))
480 CFont* pOldFont = dc.SelectObject(GetFont());
482 VERIFY (dc.GetTextMetrics ( &tm ));
483 dc.SelectObject(pOldFont);
485 nResult = tm.tmHeight;
491 void color_combo_box::MeasureItem(LPMEASUREITEMSTRUCT)
494 ASSERT((GetStyle() & (LBS_OWNERDRAWFIXED | CBS_HASSTRINGS)) ==
495 (LBS_OWNERDRAWFIXED | CBS_HASSTRINGS));
500 if((model_index < 0) || (model_index >= static_cast<int>(
Ship_info.size()))){
501 return SetCurSel(model_index);
513 char *hmmm = ship_name;
516 cur_sel = GetCurSel();
517 if(cur_sel >= static_cast<int>(
Ship_info.size())){
522 memset(ship_name, 0, 256);
523 if(GetLBText(cur_sel, hmmm) == CB_ERR){
527 if((ship_info < 0) || (ship_info >= static_cast<int>(
Ship_info.size()))){
542 str =
"Undo\tCtrl+Z";
544 if (pMenu->GetMenuState(ID_EDIT_UNDO, MF_BYCOMMAND) != -1)
545 pMenu->ModifyMenu(ID_EDIT_UNDO, MF_BYCOMMAND, ID_EDIT_UNDO, str);
555 pMenu->ModifyMenu(ID_SHOW_IFF[i], MF_BYCOMMAND | MF_STRING, ID_SHOW_IFF[i], text);
559 pMenu->DeleteMenu(ID_SHOW_IFF[i], MF_BYCOMMAND);
563 CFrameWnd::OnInitMenu(pMenu);
571 r = (
int) ShellExecute(NULL,
"open", url, NULL, NULL, SW_SHOW);
573 const char *txt = NULL;
576 case 0: txt =
XSTR(
"The operating system is out of memory or resources.", 1107);
break;
577 case ERROR_BAD_FORMAT: txt =
XSTR(
"The .EXE file is invalid (non-Win32 .EXE or error in .EXE image).", 1108);
break;
578 case SE_ERR_ACCESSDENIED: txt =
XSTR(
"The operating system denied access to the specified file. ", 1109);
break;
579 case SE_ERR_ASSOCINCOMPLETE: txt =
XSTR(
"The filename association is incomplete or invalid.\r\n(You need to have a default Internet browser installed)", 1110);
break;
580 case SE_ERR_DDEBUSY: txt =
XSTR(
"The DDE transaction could not be completed because other DDE transactions were being processed.", 1111);
break;
581 case SE_ERR_DDEFAIL: txt =
XSTR(
"The DDE transaction failed.", 1112);
break;
582 case SE_ERR_DDETIMEOUT: txt =
XSTR(
"The DDE transaction could not be completed because the request timed out.", 1113);
break;
583 case SE_ERR_DLLNOTFOUND: txt =
XSTR(
"The specified dynamic-link library was not found.", 1114);
break;
584 case SE_ERR_OOM: txt =
XSTR(
"There was not enough memory to complete the operation.", 1115);
break;
585 case SE_ERR_SHARE: txt =
XSTR(
"A sharing violation occurred.", 1116);
break;
589 case ERROR_FILE_NOT_FOUND:
590 case ERROR_PATH_NOT_FOUND: txt =
XSTR(
"\r\nUnable to locate Fred Help file: \\data\\freddocs\\index.html\r\n", 1479);
break;
592 default: txt =
XSTR(
"Unknown error occurred.", 1118);
break;
607 char *last_slash = strrchr(buffer,
'\\');
608 if ( last_slash == NULL) {
afx_msg void OnFileMissionnotes()
int ship_info_lookup(const char *token)
color_combo_box m_new_ship_type_combo_box
afx_msg void OnEditorsMusic()
int Id_select_type_waypoint
#define IDR_MENU_POPUP_TOGGLE1
CShipEditorDlg Ship_editor_dialog
#define ID_EDITORS_TERRAIN
afx_msg void OnViewStatusBar()
afx_msg void OnEditorsGoals()
void _cdecl void void _cdecl void _cdecl Warning(char *filename, int line, SCP_FORMAT_STRING const char *format,...) SCP_FORMAT_STRING_ARGS(3
int Id_select_type_jump_node
CString undo_desc[BACKUP_DEPTH+1]
#define WM_MENU_POPUP_TEST
union species_info::@265 fred_color
void write_ini_file(int degree=0)
#define WM_MENU_POPUP_EDIT
afx_msg void OnUpdateViewStatusBar(CCmdUI *pCmdUI)
afx_msg void OnUpdateMenuPopupToggle1(CCmdUI *pCmdUI)
CMainFrame * Fred_main_wnd
UINT WPARAM LPARAM lParam
#define ID_INDICATOR_MODIFIED
iff_info Iff_info[MAX_IFFS]
afx_msg void OnMenuPopupToggle1()
typedef int(SCP_EXT_CALLCONV *SCPDLL_PFVERSION)(SCPDLL_Version *)
GLdouble GLdouble GLdouble r
afx_msg void OnUpdateRight(CCmdUI *pCmdUI)
afx_msg void OnLButtonUp(UINT nFlags, CPoint point)
sprintf(buf,"(%f,%f,%f)", v3->xyz.x, v3->xyz.y, v3->xyz.z)
int ID_SHOW_IFF[MAX_IFFS]
#define ID_MIKE_GRIDCONTROL
CStatusBar m_wndStatusBar
#define ID_INDICATOR_RIGHT
afx_msg void OnEditorsShipClasses()
void url_launch(char *url)
int SetCurSelNEW(int model_index)
#define ID_EDITORS_SHIP_CLASSES
CFREDView * Fred_view_wnd
afx_msg void OnHelpInputInterface()
afx_msg void OnUpdateLeft(CCmdUI *pCmdUI)
const char * XSTR(const char *str, int index)
#define ID_FILE_MISSIONNOTES
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct)
wing_editor Wing_editor_dialog
GLuint const GLchar * name
#define ID_EDITORS_AI_CLASSES
#define ID_HELP_INPUT_INTERFACE
LONG OnMenuPopupTest(UINT wParam, LONG lParam)
afx_msg void OnEditorsAiClasses()
afx_msg void OnInitMenu(CMenu *pMenu)
#define ID_INDICATOR_LEFT
afx_msg void OnEditorsSound()
afx_msg void OnEditorsTerrain()
waypoint_path_dlg Waypoint_editor_dialog
SCP_vector< ship_info > Ship_info
SCP_vector< species_info > Species_info
afx_msg void OnEditorsArt()
afx_msg void OnNewShipTypeChange()
afx_msg void OnRButtonDown(UINT nFlags, CPoint point)
struct species_info::@265::@266 rgb
virtual BOOL PreCreateWindow(CREATESTRUCT &cs)
afx_msg void OnMikeGridcontrol()
afx_msg void OnFredHelp()