void On_DlgDDescCommand(HWND hdlgP, int id, HWND hwndCtrl, UINT codeNotify) { char *ptr = NULL; int retval; char text[_MAX_PATH]; BOOL fok; std::string str; std::stringstream strstr; switch (id) { case IDC_BT_DDESC_BROWSE: ptr = GetBrowseFilePath(hdlgP); if (!ptr) { break; } strcpy(text, appendbackslash(ptr)); if (text[strlen(text) - 1] == '\\') { text[strlen(text) - 1] = 0; } if (!check_wok_root_folder(text)) { posix_print_mb("%s,不是有效的kingdom-src-x.x.x源数据目录,请重新选择", appendbackslash(text)); break; } if (strcasecmp(ptr, game_config::path.c_str())) { game_config::path = ptr; gdmgr.heros_.set_path(game_config::path.c_str()); Edit_SetText(GetDlgItem(hdlgP, IDC_ET_DDESC_WWWROOT), appendbackslash(ptr)); OnLSBt(TRUE); if (gdmgr._da != da_sync) { title_select(da_sync); } else { sync_enter_ui(); } update_locale_dir(); } break; case IDM_NEW_EXTRAINSDIST: sprintf(text, "Do you want to extract install-material to C:\\kingdom-ins?"); retval = MessageBox(hdlgP, text, "Confirm Generate", MB_YESNO | MB_DEFBUTTON2); if (retval == IDYES) { fok = extra_kingdom_ins_disk(gdmgr._menu_text, "c:\\kingdom-ins", "c:\\kingdom-ins-android\\com.freeors.kingdom"); posix_print_mb("Extract install-material from %s to C:\\kingdom-ins, %s!!", gdmgr._menu_text, fok? "Success": "Fail"); } break; case IDM_NEW_CAMPAIGN: if (campaign_new()) { // title_select(da_sync); } break; case IDM_EXPLORER_WML: if (!_stricmp(gdmgr._menu_text, "hero.dat")) { if (gdmgr._da != da_wgen) { title_select(da_wgen); } else { wgen_enter_ui(); } } else if (!_stricmp(gdmgr._menu_text, "tb.dat")) { editor_config::type = BIN_BUILDINGRULE; if (gdmgr._da != da_visual) { title_select(da_visual); } else { visual_enter_ui(); } } else if (!_stricmp(extname(gdmgr._menu_text), "bin")) { if (wml_checksum_from_file(std::string(gdmgr._menu_text))) { editor_config::type = BIN_WML; if (gdmgr._da != da_visual) { title_select(da_visual); } else { visual_enter_ui(); } } } break; case IDM_DELETE_ITEM0: // 册除指定的文件/目录 strstr.str(""); str = gdmgr._menu_text; strstr << str.substr(0, str.rfind("\\xwml")); strstr << "\\data\\campaigns\\" << offextname(basename(gdmgr._menu_text)); strcpy(text, strstr.str().c_str()); strstr.str(""); strstr << "您想删除文件:" << gdmgr._menu_text << ",以及目录:"; strstr << text << "?"; // Confirm Multiple File Delete retval = MessageBox(hdlgP, strstr.str().c_str(), "确认删除", MB_YESNO | MB_DEFBUTTON2); if (retval == IDYES) { if (delfile1(gdmgr._menu_text)) { TreeView_DeleteItem(GetDlgItem(hdlgP, IDC_TV_DDESC_EXPLORER), (HTREEITEM)(UINT_PTR)gdmgr._menu_lparam); TreeView_SetChilerenByPath(GetDlgItem(hdlgP, IDC_TV_DDESC_EXPLORER), (HTREEITEM)(UINT_PTR)gdmgr._menu_lparam, dirname(gdmgr._menu_text)); } else { posix_print_mb("Failed delete %s !", gdmgr._menu_text); } if (!delfile1(text)) { posix_print_mb("Failed delete %s !", text); } sync_refresh_sync(); } break; case IDM_DELETE_ITEM1: strstr.str(""); strstr << "将产生不同步,您想删除文件:" << gdmgr._menu_text << "?"; // Confirm Multiple File Delete retval = MessageBox(hdlgP, strstr.str().c_str(), "确认删除", MB_YESNO | MB_DEFBUTTON2); if (retval == IDYES) { if (delfile1(gdmgr._menu_text)) { TreeView_DeleteItem(GetDlgItem(hdlgP, IDC_TV_DDESC_EXPLORER), (HTREEITEM)(UINT_PTR)gdmgr._menu_lparam); TreeView_SetChilerenByPath(GetDlgItem(hdlgP, IDC_TV_DDESC_EXPLORER), (HTREEITEM)(UINT_PTR)gdmgr._menu_lparam, dirname(gdmgr._menu_text)); } else { posix_print_mb("Failed delete %s !", gdmgr._menu_text); } // inform user, there is non sync. if (gdmgr._da != da_sync) { title_select(da_sync); } else { // forbid refresh sync_enter_ui(); } } break; default: break; } return; }
// -------------------------------------------------- void title_select(do_action_t da) { if (gdmgr._da == da) { return; } if (gdmgr._da == da_sync) { sync_hide_ui(); } else if (gdmgr._da == da_wgen) { #ifndef _ROSE_EDITOR wgen_hide_ui(); #endif } else if (gdmgr._da == da_core) { if (!core_hide_ui()) { return; } } else if (gdmgr._da == da_visual) { visual_hide_ui(); } else if (gdmgr._da == da_campaign) { #ifndef _ROSE_EDITOR if (!campaign_hide_ui()) { return; } #endif } else if (gdmgr._da == da_integrate) { if (!integrate_hide_ui()) { return; } } ToolBar_CheckButton(gdmgr._htb_sys, IDM_SYS_SYNC, 0); ToolBar_CheckButton(gdmgr._htb_sys, IDM_SYS_WGEN, 0); ToolBar_CheckButton(gdmgr._htb_sys, IDM_SYS_CORE, 0); ToolBar_CheckButton(gdmgr._htb_sys, IDM_SYS_PLAY, 0); ToolBar_CheckButton(gdmgr._htb_sys, IDM_SYS_TBOX, 0); ToolBar_CheckButton(gdmgr._htb_sys, IDM_SYS_BUILDER, 0); ShowWindow(gdmgr._hdlg_sync, SW_HIDE); ShowWindow(gdmgr._hdlg_wgen, SW_HIDE); ShowWindow(gdmgr._hdlg_core, SW_HIDE); ShowWindow(gdmgr._hdlg_visual, SW_HIDE); ShowWindow(gdmgr._hdlg_campaign, SW_HIDE); ShowWindow(gdmgr._hdlg_integrate, SW_HIDE); // 记住当前正在执行的会话 gdmgr._da = da; if (da == da_sync) { ShowWindow(gdmgr._hdlg_sync, SW_RESTORE); ToolBar_CheckButton(gdmgr._htb_sys, IDM_SYS_SYNC, 1); sync_enter_ui(); } else if (da == da_wgen) { ShowWindow(gdmgr._hdlg_wgen, SW_RESTORE); ToolBar_CheckButton(gdmgr._htb_sys, IDM_SYS_WGEN, 1); #ifndef _ROSE_EDITOR wgen_enter_ui(); #endif } else if (da == da_core) { ShowWindow(gdmgr._hdlg_core, SW_RESTORE); ToolBar_CheckButton(gdmgr._htb_sys, IDM_SYS_CORE, 1); core_enter_ui(); } else if (da == da_visual) { ShowWindow(gdmgr._hdlg_visual, SW_RESTORE); ToolBar_CheckButton(gdmgr._htb_sys, IDM_SYS_PLAY, 1); visual_enter_ui(); } else if (da == da_campaign) { ShowWindow(gdmgr._hdlg_campaign, SW_RESTORE); ToolBar_CheckButton(gdmgr._htb_sys, IDM_SYS_TBOX, 1); #ifndef _ROSE_EDITOR campaign_enter_ui(); #endif } else if (da == da_integrate) { ShowWindow(gdmgr._hdlg_integrate, SW_RESTORE); integrate_enter_ui(); } return; }
// -------------------------------------------------- void title_select(do_action_t da) { if (gdmgr._da == da) { // 当前已正在运行选择的操作,不执行任何动作 return; } if (gdmgr._da == da_sync) { sync_hide_ui(); } else if (gdmgr._da == da_wgen) { wgen_hide_ui(); } else if (gdmgr._da == da_core) { if (!core_hide_ui()) { return; } } else if (gdmgr._da == da_visual) { visual_hide_ui(); } else if (gdmgr._da == da_campaign) { if (!campaign_hide_ui()) { return; } } ToolBar_CheckButton(gdmgr._htb_sys, IDM_SYS_SYNC, 0); ToolBar_CheckButton(gdmgr._htb_sys, IDM_SYS_WGEN, 0); ToolBar_CheckButton(gdmgr._htb_sys, IDM_SYS_XCHG, 0); ToolBar_CheckButton(gdmgr._htb_sys, IDM_SYS_PLAY, 0); ToolBar_CheckButton(gdmgr._htb_sys, IDM_SYS_TBOX, 0); ToolBar_CheckButton(gdmgr._htb_sys, IDM_SYS_ABOUT, 0); ShowWindow(gdmgr._hdlg_sync, SW_HIDE); ShowWindow(gdmgr._hdlg_wgen, SW_HIDE); ShowWindow(gdmgr._hdlg_core, SW_HIDE); ShowWindow(gdmgr._hdlg_visual, SW_HIDE); ShowWindow(gdmgr._hdlg_campaign, SW_HIDE); ShowWindow(gdmgr._hdlg_about, SW_HIDE); // 记住当前正在执行的会话 gdmgr._da = da; if (da == da_sync) { ShowWindow(gdmgr._hdlg_sync, SW_RESTORE); ToolBar_CheckButton(gdmgr._htb_sys, IDM_SYS_SYNC, 1); sync_enter_ui(); } else if (da == da_wgen) { ShowWindow(gdmgr._hdlg_wgen, SW_RESTORE); ToolBar_CheckButton(gdmgr._htb_sys, IDM_SYS_WGEN, 1); wgen_enter_ui(); } else if (da == da_core) { ShowWindow(gdmgr._hdlg_core, SW_RESTORE); ToolBar_CheckButton(gdmgr._htb_sys, IDM_SYS_XCHG, 1); core_enter_ui(); } else if (da == da_visual) { ShowWindow(gdmgr._hdlg_visual, SW_RESTORE); ToolBar_CheckButton(gdmgr._htb_sys, IDM_SYS_PLAY, 1); visual_enter_ui(); } else if (da == da_campaign) { ShowWindow(gdmgr._hdlg_campaign, SW_RESTORE); ToolBar_CheckButton(gdmgr._htb_sys, IDM_SYS_TBOX, 1); campaign_enter_ui(); } else if (da == da_about) { ShowWindow(gdmgr._hdlg_about, SW_RESTORE); ToolBar_CheckButton(gdmgr._htb_sys, IDM_SYS_ABOUT, 1); } return; }