Explore Enterprise Education Gitee Premium Gitee AI AI teammates
Fetch the repository succeeded.
Create your Gitee Account
Explore and code with more than 14 million developers,Free private repositories !:)
Sign up
Already have an account? Sign in
文件
devel
Branches (25)
devel
spiderbasic-3.10
v6.21
v6.20
spiderbasic-3.02
qt
v6.12
spiderbasic-3.01
enablejs-ignore-formatting
master
spiderbasic-3.00
webview-tool
v6.11
v6.10
v6.04
spiderbasic-2.51
v6.03
editor-fix-3
editor-slow-fix2
editor-slow-fix
devel
Branches (25)
devel
spiderbasic-3.10
v6.21
v6.20
spiderbasic-3.02
qt
v6.12
spiderbasic-3.01
enablejs-ignore-formatting
master
spiderbasic-3.00
webview-tool
v6.11
v6.10
v6.04
spiderbasic-2.51
v6.03
editor-fix-3
editor-slow-fix2
editor-slow-fix
Clone or Download
Clone/Download
Prompt
To download the code, please copy the following command and execute it in the terminal
To ensure that your submitted code identity is correctly recognized by Gitee, please execute the following command.
When using the SSH protocol for the first time to clone or push code, follow the prompts below to complete the SSH configuration.
1 Generate RSA keys.
2 Obtain the content of the RSA public key and configure it in SSH Public Keys
To use SVN on Gitee, please visit the usage guide
When using the HTTPS protocol, the command line will prompt for account and password verification as follows. For security reasons, Gitee recommends configure and use personal access tokens instead of login passwords for cloning, pushing, and other operations.
Username for 'https://gitee.com': userName
Password for 'https://userName@gitee.com': # Private Token
devel
Branches (25)
devel
spiderbasic-3.10
v6.21
v6.20
spiderbasic-3.02
qt
v6.12
spiderbasic-3.01
enablejs-ignore-formatting
master
spiderbasic-3.00
webview-tool
v6.11
v6.10
v6.04
spiderbasic-2.51
v6.03
editor-fix-3
editor-slow-fix2
editor-slow-fix
purebasic
/
PureBasicIDE
/
WebView.pb
purebasic
/
PureBasicIDE
/
WebView.pb
WebView.pb 10.41 KB
Copy Edit Raw Blame History
Fred Laboureur authored 2025年02月12日 18:07 +08:00 . [SpiderBasic] - Some doc fixes for 3.02
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314
; --------------------------------------------------------------------------------------------
; Copyright (c) Fantaisie Software. All rights reserved.
; Dual licensed under the GPL and Fantaisie Software licenses.
; See LICENSE and LICENSE-FANTAISIE in the project root for license information.
; --------------------------------------------------------------------------------------------
Structure WebViewBaseParameter
command.i
EndStructure
Structure WebViewInitParameter Extends WebViewBaseParameter
filename.s
sourcePath.s
List includes.s()
EndStructure
Structure WebViewErrorParameter Extends WebViewBaseParameter
lineId.i
text.s
EndStructure
Structure WebViewWarningParameter Extends WebViewBaseParameter
lineId.i
text.s
EndStructure
Structure WebViewDebugParameter Extends WebViewBaseParameter
text.s
EndStructure
Structure WebViewControlDebugOutputParameter Extends WebViewBaseParameter
value.i
filename.s
EndStructure
; Settings here are also in Global variables because they are needed elsewhere
Procedure WebView_Callback(JsonParameters$)
Debug JsonParameters$
; The callback always returns an array of parameters. In our case, we always have only one parameter, with a specific object
;
ParseJSON(0, JsonParameters$)
; Get the first element of the parameter array
ParameterJSON = GetJSONElement(JSONValue(0), 0)
; Get the base parameter, common to all commands
ExtractJSONStructure(ParameterJSON, @BaseParameter.WebViewBaseParameter, WebViewBaseParameter)
Debug BaseParameter\command
; Update the debugger structure
*WebViewDebugger\Command\Command = BaseParameter\command
*WebViewDebugger\Command\TimeStamp = Date()
Select BaseParameter\command
Case #COMMAND_Init ; Init
; Map the JSON to a PB structure
;
ExtractJSONStructure(ParameterJSON, @InitParameter.WebViewInitParameter, WebViewInitParameter)
Debug "****** Init"
Debug "filename: "+ InitParameter\filename
Debug "sourcePath: "+ InitParameter\sourcePath
Debug "ListSize " + ListSize(InitParameter\Includes())
ForEach InitParameter\Includes()
Debug InitParameter\Includes()
Next
; Map to the internal IDE debugger structure format, so we can reuse most of the code for the debugger
; It's a bit complex as it was though for native PureBasic executable
;
*WebViewDebugger\FileName$ = InitParameter\filename
*WebViewDebugger\NbIncludedFiles = ListSize(InitParameter\includes())
; Calc the needed size. The buffer contains the source path, the main filename and all included files as UTF-8
IncludeLength = Len(InitParameter\sourcePath) + 1
IncludeLength + Len(InitParameter\filename) + 1
ForEach InitParameter\Includes()
IncludeLength + Len(InitParameter\Includes()) + 1 ; Include the null terminated char
Next
*WebViewDebugger\IncludedFiles = ReAllocateMemory(*WebViewDebugger\IncludedFiles, IncludeLength * 4) ; At most the UTF-8 encoding take 4 bytes per char
*Output = *WebViewDebugger\IncludedFiles
; Write the source path as UTF-8 in the buffer
*Output + PokeS(*Output, InitParameter\sourcePath, -1, #PB_UTF8) + 1
; Write the main filename as UTF-8 in the buffer
*Output + PokeS(*Output, InitParameter\filename, -1, #PB_UTF8) + 1
; Write the includes as UTF-8 in the buffer
ForEach InitParameter\Includes()
*Output + PokeS(*Output, InitParameter\Includes(), -1, #PB_UTF8) + 1
Next
; Close any previous window before launching a new one
;
If IsWindow(*WebViewDebugger\Windows[#DEBUGGER_WINDOW_Debug])
CloseWindow(*WebViewDebugger\Windows[#DEBUGGER_WINDOW_Debug])
EndIf
; The output window is always created
CreateDebugWindow(*WebViewDebugger)
Case #COMMAND_Error
; Map the JSON To a PB Structure
;
ExtractJSONStructure(ParameterJSON, @ErrorParameter.WebViewErrorParameter, WebViewErrorParameter)
Debug "****** Error"
; Map to the internal IDE debugger structure format, so we can reuse most of the code for the debugger
;
*WebViewDebugger\Command\Value1 = ErrorParameter\lineId
*WebViewDebugger\CommandData = UTF8(ErrorParameter\text)
DebuggerCallback(*WebViewDebugger)
Case #COMMAND_Warning
; Map the JSON To a PB Structure
;
ExtractJSONStructure(ParameterJSON, @WarningParameter.WebViewWarningParameter, WebViewWarningParameter)
Debug "****** Warning"
; Map to the internal IDE debugger structure format, so we can reuse most of the code for the debugger
;
*WebViewDebugger\Command\Value1 = WarningParameter\lineId
*WebViewDebugger\CommandData = UTF8(WarningParameter\text)
DebuggerCallback(*WebViewDebugger)
Case #COMMAND_Debug
; Map the JSON To a PB Structure
;
ExtractJSONStructure(ParameterJSON, @DebugParameter.WebViewDebugParameter, WebViewDebugParameter)
Debug "****** Debug"
Debug DebugParameter\text
*WebViewDebugger\IsDebugMessage = #True
*WebViewDebugger\DebugMessage$ = DebugParameter\text
UpdateDebugOutputWindow(*WebViewDebugger)
; show the debug window if needed.
; Warning it needs to be the very last command of the 'Debug' block or the callback can recurse of HideWindow() and the message will be displayed out of order: https://forums.spiderbasic.com/viewtopic.php?t=2675
; It looks like activating a window process some event and the WebView callback is called again.
;
If *WebViewDebugger\OutputFirstVisible
OpenDebugWindow(*WebViewDebugger, #True)
EndIf
Case #COMMAND_ControlDebugOutput
; Map the JSON To a PB Structure
;
ExtractJSONStructure(ParameterJSON, @ControlDebugOutputParameter.WebViewControlDebugOutputParameter, WebViewControlDebugOutputParameter)
Debug "****** ControlDebugOutput"
Debug ControlDebugOutputParameter\value
*WebViewDebugger\Command\Value1 = ControlDebugOutputParameter\value
; Use a dynamic allocated memory for 'CommandData' as it could be automatically freed
*WebViewDebugger\CommandData = AllocateMemory((Len(ControlDebugOutputParameter\filename)+1)*SizeOf(Character))
PokeS(*WebViewDebugger\CommandData, ControlDebugOutputParameter\filename)
*WebViewDebugger\Command\DataSize = Len(ControlDebugOutputParameter\filename)
DebugOutput_DebuggerEvent(*WebViewDebugger)
EndSelect
ProcedureReturn UTF8("")
EndProcedure
Procedure WebView_CreateFunction(*Entry.ToolsPanelEntry)
StringGadget(#GADGET_WebView_Url, 4, 4, 0, 25, "", #PB_String_ReadOnly)
ButtonImageGadget(#GADGET_WebView_OpenBrowser, 0, 4, 25, 25, ImageID(#IMAGE_WebView_OpenBrowser))
WebViewGadget(#GADGET_WebView_WebView, 0, 33, 0, 0, #PB_WebView_Debug)
BindWebViewCallback(#GADGET_WebView_WebView, "spiderDebug", @WebView_Callback())
WebViewOpen = #True
EndProcedure
Procedure WebView_DestroyFunction(*Entry.ToolsPanelEntry)
WebViewOpen = #False
EndProcedure
Procedure WebView_ResizeHandler(*Entry.ToolsPanelEntry, PanelWidth, PanelHeight)
ResizeGadget(#GADGET_WebView_Url , #PB_Ignore , #PB_Ignore, PanelWidth-35, #PB_Ignore)
ResizeGadget(#GADGET_WebView_OpenBrowser, PanelWidth-27, #PB_Ignore, #PB_Ignore , #PB_Ignore)
ResizeGadget(#GADGET_WebView_WebView, #PB_Ignore, #PB_Ignore, PanelWidth, PanelHeight-GadgetY(#GADGET_WebView_WebView))
EndProcedure
Procedure WebView_EventHandler(*Entry.ToolsPanelEntry, EventGadgetID)
Select EventGadgetID
Case #GADGET_WebView_OpenBrowser
OpenSpiderWebBrowser(GetGadgetText(#GADGET_WebView_Url))
EndSelect
EndProcedure
Procedure WebView_PreferenceStart(*Entry.ToolsPanelEntry)
EndProcedure
Procedure WebView_PreferenceApply(*Entry.ToolsPanelEntry)
EndProcedure
Procedure WebView_PreferenceCreate(*Entry.ToolsPanelEntry)
EndProcedure
Procedure WebView_PreferenceDestroy(*Entry.ToolsPanelEntry)
EndProcedure
Procedure WebView_PreferenceEvents(*Entry.ToolsPanelEntry, EventGadgetID)
EndProcedure
Procedure WebView_PreferenceChanged(*Entry.ToolsPanelEntry, IsConfigOpen)
EndProcedure
Procedure SetWebViewUrl(Url$)
SetGadgetText(#GADGET_WebView_Url, Url$)
SetGadgetText(#GADGET_WebView_WebView, Url$)
ActivateTool("WebView")
SetActiveGadget(#GADGET_WebView_WebView)
EndProcedure
Procedure OpenSpiderWebBrowser(Url$)
If Url$ = ""
ProcedureReturn
EndIf
CompilerIf #CompileWindows
If OptionWebBrowser$
RunProgram(OptionWebBrowser,ドル Url,ドル "")
Else
RunProgram(Url$) ; Will launch the default browser
EndIf
CompilerElseIf #CompileLinux
If OptionWebBrowser$
RunProgram(OptionWebBrowser,ドル Url,ドル "")
Else
RunProgram("xdg-open", Url,ドル "") ; Will launch the default browser
EndIf
CompilerElseIf #CompileMac
If OptionWebBrowser$
RunProgram("open", "-a " + OptionWebBrowser$ + " " + Url,ドル "")
Else
RunProgram("open", Url,ドル "") ; Will launch the default browser
EndIf
CompilerEndIf
EndProcedure
;- Initialisation code
; This will make this Tool available to the editor
;
WebView_VT.ToolsPanelFunctions
WebView_VT\CreateFunction = @WebView_CreateFunction()
WebView_VT\DestroyFunction = @WebView_DestroyFunction()
WebView_VT\ResizeHandler = @WebView_ResizeHandler()
WebView_VT\EventHandler = @WebView_EventHandler()
WebView_VT\PreferenceStart = @WebView_PreferenceStart()
WebView_VT\PreferenceApply = @WebView_PreferenceApply()
WebView_VT\PreferenceCreate = @WebView_PreferenceCreate()
WebView_VT\PreferenceDestroy = @WebView_PreferenceDestroy()
WebView_VT\PreferenceEvents = @WebView_PreferenceEvents()
WebView_VT\PreferenceChanged = @WebView_PreferenceChanged()
AddElement(AvailablePanelTools())
AvailablePanelTools()\FunctionsVT = @WebView_VT
AvailablePanelTools()\NeedPreferences = 0 ; the one setting is stored in the global section
AvailablePanelTools()\NeedConfiguration = 0
AvailablePanelTools()\PreferencesWidth = 320
AvailablePanelTools()\PreferencesHeight = 80
AvailablePanelTools()\NeedDestroyFunction = 1
AvailablePanelTools()\ToolID$ = "WebView"
AvailablePanelTools()\PanelTitle$ = "WebViewShort"
AvailablePanelTools()\ToolName$ = "WebViewLong"
AvailablePanelTools()\PanelTabOrder = 5
Loading...
Report
Report success
We will send you the feedback within 2 working days through the letter!
Please fill in the reason for the report carefully. Provide as detailed a description as possible.
Please select a report type
Cancel
Send
误判申诉

此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。

如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。

取消
提交

About

PureBasic是由Fantaisie Software所开发的商用BASIC程序语言及集成开发环境。特点是语法简单直接,不依赖运行时库,因此能编译出相当小巧的程序,包含命令列或GUI执行档、DLL等。而且不使用各系统的API,所以有高度的跨平台特性,支持Windows 32/64位元、Linux 32/64位元、Mac OS X、Amiga。
Cancel

Releases

No release

Contributors

All

Activities

can not load any more
Edit
About
Homepage
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/PureBasic/purebasic.git
git@gitee.com:PureBasic/purebasic.git
PureBasic
purebasic
PureBASIC
devel
Going to Help Center

Search

Comment
Repository Report
Back to the top
Login prompt
This operation requires login to the code cloud account. Please log in before operating.
Go to login
No account. Register

AltStyle によって変換されたページ (->オリジナル) /