BOOL CHtmlWnd::OnCommand(WPARAM wParam, LPARAM lParam) { if(wParam == ID_HTMLPOPMENU_REFRESH) { Refresh(); return TRUE; } else if(wParam == ID_HTMLPOPMENU_PREPAGE) { HistoryBack(1); return TRUE; } else if(wParam == ID_HTMLPOPMENU_NEXTPAGE) { HistoryForward(1); return TRUE; } else { return CDialog::OnCommand(wParam, lParam); } }
/**************************************************************************** PARAMETERS: URL - New URL for the page to load RETURNS: True if page loaded successfully, false if not REMARKS: Remove an applet from the manager. Called during applet destruction ****************************************************************************/ bool wxHtmlAppletWindow::LoadPage( const wxString& link) { wxString href(link); if (link.GetChar(0) == '?'){ wxString cmd = link.BeforeFirst('='); wxString cmdValue = link.AfterFirst('='); // Launches the default Internet browser for the system. if(!(cmd.CmpNoCase("?EXTERNAL"))) { return wxSpawnBrowser(this, cmdValue.c_str()); } // Launches an external program on the system. if (!(cmd.CmpNoCase("?EXECUTE"))) { int waitflag = P_NOWAIT; bool ret; wxString currentdir; wxString filename, path, ext; // Parse the params sent to the execute command. For now the only // parm is "wait". wait will cause spawn wait, default is nowait. // Since we only need one param for now I am not going to make this // any smater then it needs to be. If we need more params later i'll // fix it. int i = cmdValue.Find('('); if (i != -1) { wxString param = cmdValue.AfterFirst('('); cmdValue.Truncate(i); if (!param.CmpNoCase("wait)")) waitflag = P_WAIT; } currentdir = wxGetCwd(); //we don't want to change the path of the virtual file system so we have to use these //functions rather than the filesystem wxSplitPath(cmdValue, &path, &filename, &ext); if (path.CmpNoCase("") != 0) wxSetWorkingDirectory(path); ret = !spawnl( waitflag, cmdValue , NULL ); //HACK should use wxExecute //ret = wxExecute(filename, bool sync = FALSE, wxProcess *callback = NULL) wxSetWorkingDirectory(currentdir); return ret; } // Looks for a href in a variable stored as a cookie. The href can be // changed on the fly. if (!(cmd.CmpNoCase("?VIRTUAL"))){ wxObject *obj = FindCookie(cmdValue); VirtualData *virtData = wxDynamicCast(obj,VirtualData); if (virtData) { // recurse and loadpage, just in case the link is like another // ? link return LoadPage(virtData->GetHref()); } else { #ifdef CHECKED wxLogError(_T("VIRTUAL LINK ERROR: '%s' does not exist."), cmdValue.c_str()); #endif return true; } } // This launches a qlet - It is like an applet but is more generic in that it // can be of any wxWin type so it then has the freedom to do more stuff. if (!(cmd.CmpNoCase("?WXPLUGIN"))){ if (!cmdValue.IsNull()) { // TODO: We are going to need to add code to parse the command line // parameters string in here in the future... wxString cmdLine = link.AfterFirst('('); cmdLine = cmdLine.BeforeLast(')'); if (!CreatePlugIn(cmdValue,cmdLine)) { #ifdef CHECKED wxLogError(_T("Launch PlugIn ERROR: '%s' does not exist."), cmdValue.c_str()); #endif } } return true; } // This used in a link or href will take you back in the history. if (!(cmd.CmpNoCase("?BACK"))){ HistoryBack(); return true; } // This used in a link or href will take you forward in the history if (!(cmd.CmpNoCase("?FORWARD"))){ HistoryForward(); return true; } } // Inform all the applets that the new page is being loaded for (wxAppletList::Node *node = m_AppletList.GetFirst(); node; node = node->GetNext()) (node->GetData())->OnLinkClicked(wxHtmlLinkInfo(href)); Show(false); m_openedlast = href; bool stat = wxHtmlWindow::LoadPage(href); Show(true); // Enable/Dis the navbar tools if (m_NavBarEnabled) { m_NavBar->EnableTool(m_NavForwardId,HistoryCanForward()); m_NavBar->EnableTool(m_NavBackId,HistoryCanBack()); } return stat; }
//-------------------------------------------------------------------------- Widget ScriptConsole::Init() { int i; Widget layoutRoot = CreateWidgets("gui/layouts/script_console.layout", NULL); m_Tabs[TAB_SQF] = layoutRoot.FindAnyWidget("SQFPanel"); m_Tabs[TAB_ITEMS] = layoutRoot.FindAnyWidget("ItemsPanel"); m_Tabs[TAB_CONFIGS] = layoutRoot.FindAnyWidget("ConfigsPanel"); m_Tabs[TAB_ENSCRIPT] = layoutRoot.FindAnyWidget("EnScriptPanel"); m_Tabs[TABS_GENERAL] = layoutRoot.FindAnyWidget("GeneralPanel"); m_Tabs[TABS_OUTPUT] = layoutRoot.FindAnyWidget("OutputPanel"); m_Tabs[TABS_SERVER] = layoutRoot.FindAnyWidget("ServerLogPanel"); m_Tab_buttons[TAB_SQF] = (ButtonWidget)layoutRoot.FindAnyWidget("SQFButtonWidget"); m_Tab_buttons[TAB_ITEMS] = (ButtonWidget)layoutRoot.FindAnyWidget("ItemsButtonWidget"); m_Tab_buttons[TAB_CONFIGS] = (ButtonWidget)layoutRoot.FindAnyWidget("ConfigsButtonWidget"); m_Tab_buttons[TAB_ENSCRIPT] = (ButtonWidget)layoutRoot.FindAnyWidget("EnScriptButtonWidget"); m_Tab_buttons[TABS_GENERAL] = (ButtonWidget)layoutRoot.FindAnyWidget("GeneralButtonWidget"); m_Tab_buttons[TABS_OUTPUT] = (ButtonWidget)layoutRoot.FindAnyWidget("OutputButtonWidget"); m_Tab_buttons[TABS_SERVER] = (ButtonWidget)layoutRoot.FindAnyWidget("ServerLogButtonWidget"); m_ClientLogListbox = layoutRoot.FindAnyWidget("TextListbox"); m_ClientLogClearButton = layoutRoot.FindAnyWidget("ButtonClear"); m_ClientLogScrollCheckbox = layoutRoot.FindAnyWidget("CheckBoxAutoScroll"); m_ServerLogListbox = layoutRoot.FindAnyWidget("ServerTextListbox"); m_ServerLogClearButton = layoutRoot.FindAnyWidget("ServerButtonClear"); m_ServerLogScrollCheckbox = layoutRoot.FindAnyWidget("ServerCheckBoxAutoScroll"); m_DiagToggleTextListbox = layoutRoot.FindAnyWidget("DiagToggle"); m_DiagToggleButton = layoutRoot.FindAnyWidget("ButtonDiagToggle"); m_DiagDrawmodeTextListbox = layoutRoot.FindAnyWidget("DiagDrawmode"); m_DiagDrawButton = layoutRoot.FindAnyWidget("ButtonDiagDraw"); m_PositionsListbox = layoutRoot.FindAnyWidget("PositionsList"); m_TeleportButton = layoutRoot.FindAnyWidget("ButtonTeleport"); m_TeleportX = layoutRoot.FindAnyWidget("TeleportX"); m_TeleportY = layoutRoot.FindAnyWidget("TeleportY"); m_ObjectFilter = layoutRoot.FindAnyWidget("ObjectFilter"); m_SpawnDistanceEditBox = layoutRoot.FindAnyWidget("SpawnDistance"); m_SelectedObjectText = layoutRoot.FindAnyWidget("SelectedObject"); m_ObjectsTextListbox = layoutRoot.FindAnyWidget("ObjectsList"); m_PresetsTextListbox = layoutRoot.FindAnyWidget("PresetList"); m_PresetItemsTextListbox = layoutRoot.FindAnyWidget("PresetItemsList"); m_PresetNewButton = layoutRoot.FindAnyWidget("NewPresetButton"); m_PresetDeleteButton = layoutRoot.FindAnyWidget("DeletePresetButton"); m_PresetRenameButton = layoutRoot.FindAnyWidget("RenamePresetButton"); m_PresetSetDefaultButton = layoutRoot.FindAnyWidget("SetDefaultPresetButton"); m_PresetAddItemtButton = layoutRoot.FindAnyWidget("AddToPresetButton"); m_PresetRemoveItemButton = layoutRoot.FindAnyWidget("RemoveFromPresetButton"); m_ItemMoveUpButton = layoutRoot.FindAnyWidget("ItemMoveUpButton"); m_ItemMoveDownButton = layoutRoot.FindAnyWidget("ItemMoveDownButton"); m_QuantityEditBox = layoutRoot.FindAnyWidget("QuantityValue"); m_DamageEditBox = layoutRoot.FindAnyWidget("DamageValue"); m_ItemDamageLabel = layoutRoot.FindAnyWidget("DamageLabel"); m_ItemQuantityLabel = layoutRoot.FindAnyWidget("QuantityLabel"); m_SpawnInInvButton = layoutRoot.FindAnyWidget("ButtonSpawnInInv"); m_SpawnGroundButton = layoutRoot.FindAnyWidget("ButtonSpawnInGround"); m_SQFEditBox = layoutRoot.FindAnyWidget("EditBoxSQF"); m_SQFOKButton = layoutRoot.FindAnyWidget("ButtonSQFOK"); m_SQFApplyButton = layoutRoot.FindAnyWidget("ButtonSQFApply"); m_CloseConsoleButton = layoutRoot.FindAnyWidget("CloseConsoleButtonWidget"); MissionBase mission = GetGame().GetMission(); // copy content back to console if (mission.m_consoleClientLogStorage) { for ( i = 0; i < mission.m_consoleClientLogStorage.Count(); i++) { this.Add(mission.m_consoleClientLogStorage.Get(i)); } } // copy content back to console if (mission.m_consoleServerLogStorage) { for ( i = 0; i < mission.m_consoleServerLogStorage.Count(); i++) { this.AddServer(mission.m_consoleServerLogStorage.Get(i)); } } // lock controls if (g_Game) { g_Game.GetInput().ChangeGameFocus(1); g_Game.GetUIManager().ShowCursor(true); } m_Developer = (ModuleDeveloper)GetModule(Type("ModuleDeveloper")); m_ProfileUI = (ModuleLocalProfileUI)GetModule(Type("ModuleLocalProfileUI")); m_ProfileUIFixed = (ModuleLocalProfileUIFixed)GetModule(Type("ModuleLocalProfileUIFixed")); autoptr TStringArray diag_names = new TStringArray; GetGame().GetDiagModeNames( diag_names ); for ( i = 0; i < diag_names.Count(); i++) { m_DiagToggleTextListbox.AddItem(diag_names.Get(i), NULL, 0); } GetGame().GetDiagDrawModeNames( diag_names ); for ( i = 0; i < diag_names.Count(); i++) { m_DiagDrawmodeTextListbox.AddItem(diag_names.Get(i), NULL, 0); } m_ObjectFilter.SetText( m_ProfileUI.GetItemSearch() ); m_SpawnDistanceEditBox.SetText( ftoa( m_ProfileUI.GetSpawnDistance() ) ); ChangeFilter(); m_Rows = 0; m_ServerRows = 0; m_HistoryRow = 0; // load history file m_ConsoleHistory = new TStringArray; m_ConsoleHistory = m_ModuleLocalSqfHistory.GetAllLines(); // load data from profile SelectTab( m_ProfileUI.GetTabSelected() ); RenderPresets(); HideItemButtons(); m_PresetDeleteButton.Show( false ); m_PresetRenameButton.Show( false ); ShowItemTransferButtons(); HistoryBack(); TStringArray positions_array = m_ProfileUIFixed.GetAllPositionsNames(); for ( i = 0; i < positions_array.Count(); i++ ) { m_PositionsListbox.AddItem( positions_array.Get(i), new PresetParams ( positions_array.Get(i), true, false), 0); } /* // BUG EXAMPLE autoptr TStringArray testTable = new TStringArray; testTable.Insert("index1"); testTable.Insert("index2"); testTable.Insert("index4"); // testTable.Debug(); testTable.InsertAt("index3",2); // testTable.Debug(); testTable.Insert("index5" ); testTable.Remove(0); // testTable.Debug(); for ( i = 0; i < testTable.Count(); i++ ) { Print( testTable.Get(i) ); } testTable.Insert("index4"); testTable.Debug(); */ return layoutRoot; }