; --------------------------------------------------------------------------------------------; 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.; --------------------------------------------------------------------------------------------; linux only fileCompilerIf #CompileLinux; The splitter makes the IDE crash on 24.04. According to valgring it's some memory freed in scintilla; which cause that, but it's unclear why it does crash in the help window and not in the session history; as it uses the same setup (panel/scintilla and splitter); So for now, disable the splitter until we find a way to fix it (we could change the scintilla by webgadget; and use proper HTML help, which would allow images and other enhancement);#UseHelpSplitter = #False#HelpPanelWidth = 400 ; Fixed width of the Panel when the splitter isn't used.UseBriefLZPacker()Structure Help_ContentsSubLevel.lName$link$EndStructureStructure Help_IndexName$link$EndStructureStructure Help_Directorylink$Pointer.iLength.lEndStructureStructure Help_LinkLinkStart.l ; start position in the text bufferLinkEnd.l ; end position in the text bufferLink$ ; target of the linkEndStructureStructure Help_StyleInfoStyle.lLength.lEndStructureGlobal Dim Help_Contents.Help_Contents(0)Global Dim Help_Index.Help_Index(0)Global Dim Help_Directory.Help_Directory(0)Global NewList Help_Links.Help_Link()Global NewList Help_Styles.Help_StyleInfo()Global Help_Contents_Size, Help_Index_Size, Help_Directory_Size, Help_LinkCountGlobal *LinkMask, LinkCursor, HelpLanguage,ドル Help_LoadedGlobal HelpButtonHeightGlobal NewList Help_History.s()Global NewList Help_Search.s(); styles for the help;Enumeration#STYLE_Normal ; {TEXT} - use normal text font#STYLE_Normal_Function; {COLOR:color:text} - colored text. color values: FUNCTION CONSTANT COMMENT KEYWORD#STYLE_Normal_Constant#STYLE_Normal_Comment#STYLE_Normal_Keyword#STYLE_Normal_Red ; for @Orange etc#STYLE_Normal_Green#STYLE_Normal_Blue#STYLE_Normal_Orange#STYLE_Code ; {EXAMPLE} - use fixed example font#STYLE_Code_Function ; {COLOR:color:text} - colored text. color values: FUNCTION CONSTANT COMMENT KEYWORD#STYLE_Code_Constant#STYLE_Code_Comment#STYLE_Code_Keyword ; No red/green/blue in code sections#STYLE_Bold ; {BOLD} - for the bold/black header lines#STYLE_Title ; {TITLE} - for the big/bold title line#STYLE_Function ; {FUNCTION} - for the bold function header#STYLE_Link ; {LINK:target:text} - linkEndEnumerationProcedure GetNextPackFile(Pack)If NextPackEntry(Pack)EntrySize = PackEntrySize(Pack, #PB_Packer_UncompressedSize)*Buffer = AllocateMemory(EntrySize)If *BufferIf UncompressPackMemory(Pack, *Buffer, EntrySize, "") = EntrySize; Uncompress the current entryProcedureReturn *BufferEndIfFreeMemory(*Buffer) ; FailedEndIfEndIfEndProcedureProcedure InitLinuxHelp()If Help_Loaded = 0HelpLanguage$ = CurrentLanguage$ ; to know when to update the helpCompilerIf #SpiderBasic; For now we ship only english help in SpiderBasicFile$ = LCase(#ProductName$)+".help"CompilerElseIf UCase(HelpLanguage$) = "DEUTSCH"File$ = LCase(#ProductName$)+"_german.help"ElseIf UCase(HelpLanguage$) = "FRANCAIS"File$ = LCase(#ProductName$)+"_french.help"ElseFile$ = LCase(#ProductName$)+".help"EndIfCompilerEndIfIf FileSize(PureBasicPath$ + File$) <= 0 ; just in case someone renamed the files (like was done in 3.94)File$ = LCase(#ProductName$)+".help"EndIfIf OpenPack(0, PureBasicPath$ + File,ドル #PB_PackerPlugin_BriefLZ)ExaminePack(0); Structure of the packed archive;; 1) contents table : LONG (sublevel) + STRING (name) + STRING (link); 2) index table : STRING (functionname) + STRING (link); 3) directory table: LONG (pointer) + LONG (length) + STRING (link); 4) data;; Note: The directorytable pointer is still a long on x64 (as it is just relative to the data start); so we have a compatible format. In memory, it is stored in an integer though as the base will be; added to have a real pointer.;; contents table;*Buffer = GetNextPackFile(0)*BufferEnd = *Buffer + PackEntrySize(0, #PB_Packer_UncompressedSize)If *Buffer = 0MessageRequester(#ProductName,ドルLanguage("Misc","ReadError")+" '"+PureBasicPath$+File$+"' !", #FLAG_Error)Help_Contents_Size = 0Help_Index_Size = 0Help_Directory_Size= 0ProcedureReturnEndIf; do a count first*Cursor = *BufferHelp_Contents_Size = 0While *Cursor < *BufferEndHelp_Contents_Size + 1*Cursor + 4 ; sublevel*Cursor + MemoryStringLength(*Cursor, #PB_Ascii) + 1 ; name*Cursor + MemoryStringLength(*Cursor, #PB_Ascii) + 1 ; linkWend; now read the dataDim Help_Contents.Help_Contents(Help_Contents_Size-1)*Cursor = *BufferFor i = 0 To Help_Contents_Size-1Help_Contents(i)\Sublevel = PeekL(*Cursor): *Cursor + 4Help_Contents(i)\Name$ = PeekS(*Cursor, -1, #PB_Ascii): *Cursor + MemoryStringLength(*Cursor, #PB_Ascii) + 1Help_Contents(i)\link$ = PeekS(*Cursor, -1, #PB_Ascii): *Cursor + MemoryStringLength(*Cursor, #PB_Ascii) + 1Next iFreeMemory(*Buffer); index table;*Buffer = GetNextPackFile(0)*BufferEnd = *Buffer + PackEntrySize(0, #PB_Packer_UncompressedSize)If *Buffer = 0MessageRequester(#ProductName,ドルLanguage("Misc","ReadError")+" '"+PureBasicPath$+File$+"' !", #FLAG_Error)Help_Contents_Size = 0Help_Index_Size = 0Help_Directory_Size= 0ProcedureReturnEndIf; do a count first*Cursor = *BufferHelp_Index_Size = 0While *Cursor < *BufferEndHelp_Index_Size + 1*Cursor + MemoryStringLength(*Cursor, #PB_Ascii) + 1 ; name*Cursor + MemoryStringLength(*Cursor, #PB_Ascii) + 1 ; linkWend; now read the dataDim Help_Index.Help_Index(Help_Index_Size-1)*Cursor = *BufferFor i = 0 To Help_Index_Size-1Help_Index(i)\Name$ = PeekS(*Cursor, -1, #PB_Ascii): *Cursor + MemoryStringLength(*Cursor, #PB_Ascii) + 1Help_Index(i)\link$ = PeekS(*Cursor, -1, #PB_Ascii): *Cursor + MemoryStringLength(*Cursor, #PB_Ascii) + 1Next iFreeMemory(*Buffer); directory table;*Buffer = GetNextPackFile(0)*BufferEnd = *Buffer + PackEntrySize(0, #PB_Packer_UncompressedSize)If *Buffer = 0MessageRequester(#ProductName,ドルLanguage("Misc","ReadError")+" '"+PureBasicPath$+File$+"' !", #FLAG_Error)Help_Contents_Size = 0Help_Index_Size = 0Help_Directory_Size= 0ProcedureReturnEndIf; do a count first*Cursor = *BufferHelp_Directory_Size = 0While *Cursor < *BufferEndHelp_Directory_Size + 1*Cursor + 8 ; pointer + length*Cursor + MemoryStringLength(*Cursor, #PB_Ascii) + 1 ; linkWend; now read the dataDim Help_Directory.Help_Directory(Help_Directory_Size-1)*Cursor = *BufferFor i = 0 To Help_Directory_Size-1Help_Directory(i)\Pointer = PeekL(*Cursor): *Cursor + 4 ; pointer stored as long in the fileHelp_Directory(i)\Length = PeekL(*Cursor): *Cursor + 4Help_Directory(i)\link$ = PeekS(*Cursor, -1, #PB_Ascii): *Cursor + MemoryStringLength(*Cursor, #PB_Ascii) + 1Next iFreeMemory(*Buffer); help data;*Buffer = GetNextPackFile(0)If *Buffer = 0MessageRequester(#ProductName,ドルLanguage("Misc","ReadError")+" '"+PureBasicPath$+File$+"' !", #FLAG_Error)Help_Contents_Size = 0Help_Index_Size = 0Help_Directory_Size= 0ProcedureReturnEndIf; copy the buffer as it is*Help_Data = *Buffer; update the pointers in Help_Directory for direct access, and find the size of the largest page;MaxLength = 0For i = 0 To Help_Directory_Size-1Help_Directory(i)\Pointer + *Help_DataIf Help_Directory(i)\Length > MaxLengthMaxLength = Help_Directory(i)\LengthEndIfNext iClosePack(0)Help_Loaded = 1ElseMessageRequester(#ProductName,ドルLanguage("Misc","ReadError")+" '"+PureBasicPath$+File$+"' !", #FLAG_Error)EndIfEndIfEndProcedureProcedure LoadHelpPage(Link,ドル AddToHistory)If Link$ <> ""Found = 0Link$ = LCase(Link$)For index = 0 To Help_Directory_Size-1If Link$ = Help_Directory(index)\link$Found = 1BreakEndIfNext indexIf Found*PageBuffer = AllocateMemory(Help_Directory(index)\Length+1)If *PageBuffer; Keywords;; {TITLE} - for the big/bold title line; {BOLD} - for the bold/black header lines; {FUNCTION} - for the bold function header; {EXAMPLE} - use fixed example font; {TEXT} - use normal text font; {LINK:target:text} - link; {COLOR:color:text} - colored text. color values: FUNCTION CONSTANT COMMENT KEYWORD RED GREEN BLUE ORANGE;; Images are not supported.IsCodeSection = 0CurrentStyle = #STYLE_NormalClearList(Help_Links())ClearList(Help_Styles())*Cursor.BYTE = Help_Directory(index)\Pointer*StringStart = *Cursor*BufferEnd = *Cursor + Help_Directory(index)\Length*PageCursor.BYTE = *PageBufferWhile *Cursor < *BufferEndIf *Cursor\b = '{'; add styling info for the previous textIf *Cursor-*StringStart > 0AddElement(Help_Styles())Help_Styles()\Style = CurrentStyleHelp_Styles()\Length = *Cursor-*StringStartEndIfIf CompareMemory(*Cursor, ToAscii("{TITLE}"), 7) = 1*Cursor + 7*StringStart = *CursorIsCodeSection = 0CurrentStyle = #STYLE_TitleElseIf CompareMemory(*Cursor, ToAscii("{BOLD}"), 6) = 1*Cursor + 6*StringStart = *CursorIsCodeSection = 0CurrentStyle = #STYLE_BoldElseIf CompareMemory(*Cursor, ToAscii("{FUNCTION}"), 10) = 1*Cursor + 10*StringStart = *CursorIsCodeSection = 0CurrentStyle = #STYLE_FunctionElseIf CompareMemory(*Cursor, ToAscii("{EXAMPLE}"), 9) = 1*Cursor + 9*StringStart = *CursorIsCodeSection = 1CurrentStyle = #STYLE_CodeElseIf CompareMemory(*Cursor, ToAscii("{TEXT}"), 6) = 1*Cursor + 6*StringStart = *CursorIsCodeSection = 0CurrentStyle = #STYLE_NormalElseIf CompareMemory(*Cursor, ToAscii("{COLOR:"), 7) = 1*Cursor + 7Color$ = ""While *Cursor\b <> ':'Color$ + Chr(*Cursor\b & $FF)*Cursor + 1Wend*Cursor + 1AddElement(Help_Styles())If IsCodeSectionSelect Color$Case "FUNCTION": Help_Styles()\Style = #STYLE_Code_FunctionCase "CONSTANT": Help_Styles()\Style = #STYLE_Code_ConstantCase "COMMENT" : Help_Styles()\Style = #STYLE_Code_CommentCase "KEYWORD" : Help_Styles()\Style = #STYLE_Code_KeywordEndSelectElseSelect Color$Case "FUNCTION": Help_Styles()\Style = #STYLE_Normal_FunctionCase "CONSTANT": Help_Styles()\Style = #STYLE_Normal_ConstantCase "COMMENT" : Help_Styles()\Style = #STYLE_Normal_CommentCase "KEYWORD" : Help_Styles()\Style = #STYLE_Normal_KeywordCase "RED" : Help_Styles()\Style = #STYLE_Normal_RedCase "GREEN" : Help_Styles()\Style = #STYLE_Normal_GreenCase "BLUE" : Help_Styles()\Style = #STYLE_Normal_BlueCase "ORANGE" : Help_Styles()\Style = #STYLE_Normal_OrangeEndSelectEndIf*StringStart = *CursorWhile *Cursor\b <> '}'*PageCursor\b = *Cursor\b*PageCursor + 1*Cursor + 1WendHelp_Styles()\Length = *Cursor - *StringStart*Cursor + 1*StringStart = *CursorElseIf CompareMemory(*Cursor, ToAscii("{LINK:"), 6) = 1*Cursor + 6*StringStart = *CursorWhile *Cursor\b <> ':'*Cursor + 1WendAddElement(Help_Links())Help_Links()\Link$ = PeekS(*StringStart, *Cursor - *StringStart, #PB_Ascii)Help_Links()\LinkStart = *PageCursor - *PageBuffer*Cursor + 1*StringStart = *CursorWhile *Cursor\b <> '}'*PageCursor\b = *Cursor\b*PageCursor + 1*Cursor + 1WendHelp_Links()\LinkEnd = *PageCursor - *PageBufferAddElement(Help_Styles())Help_Styles()\Style = #STYLE_LinkHelp_Styles()\Length = *Cursor-*StringStart*Cursor + 1*StringStart = *CursorElse ; literal char, just skip it*StringStart = *Cursor ; as we finished the last style, we need to update this!*PageCursor\b = *Cursor\b*PageCursor + 1*Cursor + 1EndIfElse*PageCursor\b = *Cursor\b*PageCursor + 1*Cursor + 1EndIfWendIf *StringStart < *CursorAddElement(Help_Styles())If *StringStart = Help_Directory(index)\Pointer; the whole file has no coloring/formatting marks, so it is probably an example file, use the fixed fontHelp_Styles()\Style = #STYLE_CodeElseHelp_Styles()\Style = CurrentStyleEndIfHelp_Styles()\Length = *Cursor-*StringStartEndIf*PageCursor\b = 0 ; 0-terminate the bufferScintillaSendMessage(#GADGET_Help_Editor, #SCI_SETREADONLY, 0, 0) ; must be off for the stylingScintillaSendMessage(#GADGET_Help_Editor, #SCI_SETCODEPAGE, 0, 0) ; All help are in ASCII form for nowScintillaSendMessage(#GADGET_Help_Editor, #SCI_SETTEXT, 0, *PageBuffer)FreeMemory(*PageBuffer); now do the styling;ScintillaSendMessage(#GADGET_Help_Editor, #SCI_STARTSTYLING, 0, $FFFFFF)ForEach Help_Styles()ScintillaSendMessage(#GADGET_Help_Editor, #SCI_SETSTYLING, Help_Styles()\Length, Help_Styles()\Style)Next Help_Styles()ClearList(Help_Styles())ScintillaSendMessage(#GADGET_Help_Editor, #SCI_SETREADONLY, 1, 0)If AddToHistoryIf ListSize(Help_History()) > 0If Help_History() <> Link$AddElement(Help_History())Help_History() = Link$EndIfElseAddElement(Help_History())Help_History() = Link$EndIfEndIf; select right item in tree if possibleFor i = 0 To Help_Contents_Size-1If Link$ = Help_Contents(i)\Link$SetGadgetState(#GADGET_Help_Tree, i)BreakEndIfNext iIf PageTitle$ <> ""If Left(PageTitle,ドル 12) = "PureBasic - " ; library commandlistPageTitle$ = Trim(Right(PageTitle,ドル Len(PageTitle$)-12))EndIfSetWindowTitle(#WINDOW_Help, Language("Help","Title") + " - "+PageTitle$)ElseSetWindowTitle(#WINDOW_Help, Language("Help","Title"))EndIfEndIfEndIfEndIfEndProcedureCompilerIf #CompileLinuxGtkProcedureC HelpMouseEventsGtk(*Window.GtkWidget, *Event.GdkEventButton, user_type)If *Event\button = 1position = ScintillaSendMessage(#GADGET_Help_Editor, #SCI_POSITIONFROMPOINTCLOSE, WindowMouseX(#WINDOW_Help)-GadgetX(#GADGET_Help_Editor)-GadgetX(#GADGET_Help_Splitter), WindowMouseY(#WINDOW_Help)-GadgetY(#GADGET_Help_Editor)-GadgetY(#GADGET_Help_Splitter))If position <> -1ForEach Help_Links()If Help_Links()\LinkStart <= position And Help_Links()\LinkEnd >= position;LoadHelpPage(Help_Links()\Link,ドル 1) move to HelpWindowEventsPostEvent(#PB_Event_Gadget, #WINDOW_Help, #GADGET_Help_Editor, #EVENTTYPE_LoadHelpPage)ProcedureReturn 1 ; ignore eventEndIfNext Help_Links()EndIfEndIfProcedureReturn 0EndProcedureCompilerEndIfCompilerIf #CompileLinuxQtProcedureC HelpMouseEventsQt(*Event)If QT_EventType(*Event) = 2 And QT_EventButton(*Event) = 1 ; QEvent::MouseButtonPress on Qt::LeftButtonposition = ScintillaSendMessage(#GADGET_Help_Editor, #SCI_POSITIONFROMPOINTCLOSE, WindowMouseX(#WINDOW_Help)-GadgetX(#GADGET_Help_Editor, #PB_Gadget_WindowCoordinate), WindowMouseY(#WINDOW_Help)-GadgetY(#GADGET_Help_Editor, #PB_Gadget_WindowCoordinate))If position <> -1ForEach Help_Links()If Help_Links()\LinkStart <= position And Help_Links()\LinkEnd >= position;LoadHelpPage(Help_Links()\Link,ドル 1) move to HelpWindowEventsPostEvent(#PB_Event_Gadget, #WINDOW_Help, #GADGET_Help_Editor, #EVENTTYPE_LoadHelpPage)ProcedureReturn 1 ; ignore eventEndIfNext Help_Links()EndIfEndIfProcedureReturn 0EndProcedureCompilerEndIfProcedure ResizePanelContent()PanelWidth = GetGadgetAttribute(#GADGET_Help_Panel, #PB_Panel_ItemWidth)PanelHeight = GetGadgetAttribute(#GADGET_Help_Panel, #PB_Panel_ItemHeight)GetRequiredSize(#GADGET_Help_SearchGo, @ButtonWidth, @ButtonHeight)ButtonWidth = Max(ButtonWidth, 100)StringHeight = GetRequiredHeight(#GADGET_Help_SearchValue)ResizeGadget(#GADGET_Help_Tree , 0, 0, PanelWidth, PanelHeight)ResizeGadget(#GADGET_Help_Index , 0, 0, PanelWidth, PanelHeight)ResizeGadget(#GADGET_Help_SearchValue , 10, 10, PanelWidth-20, StringHeight)ResizeGadget(#GADGET_Help_SearchGo , (PanelWidth-ButtonWidth)/2, 20+StringHeight, ButtonWidth, ButtonHeight)ResizeGadget(#GADGET_Help_SearchResults, 0, 30+StringHeight+ButtonHeight, PanelWidth, PanelHeight-30-StringHeight-ButtonHeight)EndProcedureProcedure ResizeHelpContent()CompilerIf #UseHelpSplitterResizeGadget(#GADGET_Help_Splitter, 5, 10+HelpButtonHeight, WindowWidth(#WINDOW_Help)-10, WindowHeight(#WINDOW_Help)-15-HelpButtonHeight)CompilerElseResizeGadget(#GADGET_Help_Panel , 5, 10+HelpButtonHeight, #HelpPanelWidth, WindowHeight(#WINDOW_Help)-15-HelpButtonHeight)ResizePanelContent()ResizeGadget(#GADGET_Help_Editor, #HelpPanelWidth+10, 10+HelpButtonHeight, WindowWidth(#WINDOW_Help)-#HelpPanelWidth-10, WindowHeight(#WINDOW_Help)-15-HelpButtonHeight)CompilerEndIfEndProcedureProcedure OpenHelpWindow()If IsWindow(#WINDOW_Help) = 0Flags = #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_MaximizeGadget | #PB_Window_MinimizeGadget | #PB_Window_InvisibleIf HelpWindowX = -1 And HelpWindowY = -1Flags | #PB_Window_ScreenCenteredEndIfIf HelpWindowMaximizedFlags | #PB_Window_MaximizeEndIfIf OpenWindow(#WINDOW_Help, HelpWindowX, HelpWindowY, HelpWindowWidth, HelpWindowHeight, Language("Help","Title"), Flags)ButtonGadget(#GADGET_Help_Parent, 5, 5, 80, 25, Language("Help", "Parent"))ButtonGadget(#GADGET_Help_Back, 90, 5, 80, 25, Language("Help", "Back"))ButtonGadget(#GADGET_Help_Previous, 185, 5, 80, 25, "<<")ButtonGadget(#GADGET_Help_Next, 270, 5, 80, 25, ">>")GetRequiredSize(#GADGET_Help_Parent, @ButtonWidth, @HelpButtonHeight)ButtonWidth = Max(ButtonWidth, 80)ButtonWidth = Max(ButtonWidth, GetRequiredWidth(#GADGET_Help_Back))ButtonWidth = Max(ButtonWidth, GetRequiredWidth(#GADGET_Help_Previous))ButtonWidth = Max(ButtonWidth, GetRequiredWidth(#GADGET_Help_Next))ResizeGadget(#GADGET_Help_Parent, 5, 5, ButtonWidth, HelpButtonHeight)ResizeGadget(#GADGET_Help_Back, 10+ButtonWidth, 5, ButtonWidth, HelpButtonHeight)ResizeGadget(#GADGET_Help_Previous, 20+ButtonWidth*2, 5, ButtonWidth, HelpButtonHeight)ResizeGadget(#GADGET_Help_Next, 25+ButtonWidth*3, 5, ButtonWidth, HelpButtonHeight)PanelGadget(#GADGET_Help_Panel, 0, 0, 0, 0)AddGadgetItem(#GADGET_Help_Panel, -1, Language("Help", "Contents"))TreeGadget(#GADGET_Help_Tree, 0, 0, 0, 0)AddGadgetItem(#GADGET_Help_Panel, -1, Language("Help", "Index"))ListViewGadget(#GADGET_Help_Index, 0, 0, 0, 0)AddGadgetItem(#GADGET_Help_Panel, -1, Language("Help", "Search"))StringGadget(#GADGET_Help_SearchValue, 10, 10, 0, 25, "")ButtonGadget(#GADGET_Help_SearchGo, 0, 45, 100, 25, Language("Help", "StartSearch"))ListViewGadget(#GADGET_Help_SearchResults, 0, 80, 0, 0)CloseGadgetList()ScintillaGadget(#GADGET_Help_Editor, 0, 0, 0, 0, 0)CompilerIf #CompileLinuxGtk; GTKSignalConnect(GadgetID(#GADGET_Help_Panel), "size-allocate", @PanelSizeChangeSignal(), 0)GTKSignalConnect(GadgetID(#GADGET_Help_Editor), "button-press-event", @HelpMouseEventsGtk(), 0)CompilerElse; Note: The mouse events happen on the QAbstractScrollArea::viewport() instead of the main widget!QT_SetEventFilter(QT_GetViewPort(GadgetID(#GADGET_Help_Editor)), @HelpMouseEventsQt())CompilerEndIfScintillaSendMessage(#GADGET_Help_Editor, #SCI_SETCARETSTYLE, 0); Hide the blinking caretScintillaSendMessage(#GADGET_Help_Editor, #SCI_USEPOPUP, 1, 0) ; use the scintilla popupScintillaSendMessage(#GADGET_Help_Editor, #SCI_SETMARGINWIDTHN, 0, 0)ScintillaSendMessage(#GADGET_Help_Editor, #SCI_SETMARGINWIDTHN, 1, 0)ScintillaSendMessage(#GADGET_Help_Editor, #SCI_SETWRAPMODE, 1, 0) ; wrap at word boundariesFontSize = 10TitleSize = 14;ScintillaSendMessage(#GADGET_Help_Editor, #SCI_STYLESETFONT, #STYLE_DEFAULT, "") - do not call this, use the default fontScintillaSendMessage(#GADGET_Help_Editor, #SCI_STYLESETSIZE, #STYLE_DEFAULT, FontSize)ScintillaSendMessage(#GADGET_Help_Editor, #SCI_STYLESETBACK, #STYLE_DEFAULT, Colors(#COLOR_GlobalBackground)\DisplayValue)ScintillaSendMessage(#GADGET_Help_Editor, #SCI_STYLESETFORE, #STYLE_DEFAULT, Colors(#COLOR_NormalText)\DisplayValue)ScintillaSendMessage(#GADGET_Help_Editor, #SCI_STYLECLEARALL, 0, 0) ; apply these settings to all stylesScintillaSendMessage(#GADGET_Help_Editor, #SCI_STYLESETFORE, #STYLE_Normal_Function, Colors(#COLOR_PureKeyword)\DisplayValue)ScintillaSendMessage(#GADGET_Help_Editor, #SCI_STYLESETFORE, #STYLE_Normal_Constant, Colors(#COLOR_Constant)\DisplayValue)ScintillaSendMessage(#GADGET_Help_Editor, #SCI_STYLESETFORE, #STYLE_Normal_Comment, Colors(#COLOR_Comment)\DisplayValue)ScintillaSendMessage(#GADGET_Help_Editor, #SCI_STYLESETFORE, #STYLE_Normal_Keyword, Colors(#COLOR_BasicKeyword)\DisplayValue)ScintillaSendMessage(#GADGET_Help_Editor, #SCI_STYLESETBOLD, #STYLE_Normal_Keyword, 1)ScintillaSendMessage(#GADGET_Help_Editor, #SCI_STYLESETFORE, #STYLE_Normal_Red, 000099ドル)ScintillaSendMessage(#GADGET_Help_Editor, #SCI_STYLESETFORE, #STYLE_Normal_Green, 009900ドル)ScintillaSendMessage(#GADGET_Help_Editor, #SCI_STYLESETFORE, #STYLE_Normal_Blue, 990000ドル)ScintillaSendMessage(#GADGET_Help_Editor, #SCI_STYLESETFORE, #STYLE_Normal_Orange, 009999ドル)ScintillaSendMessage(#GADGET_Help_Editor, #SCI_STYLESETFORE, #STYLE_Code_Function, Colors(#COLOR_PureKeyword)\DisplayValue)ScintillaSendMessage(#GADGET_Help_Editor, #SCI_STYLESETFORE, #STYLE_Code_Constant, Colors(#COLOR_Constant)\DisplayValue)ScintillaSendMessage(#GADGET_Help_Editor, #SCI_STYLESETFORE, #STYLE_Code_Comment, Colors(#COLOR_Comment)\DisplayValue)ScintillaSendMessage(#GADGET_Help_Editor, #SCI_STYLESETFORE, #STYLE_Code_Keyword, Colors(#COLOR_BasicKeyword)\DisplayValue)ScintillaSendMessage(#GADGET_Help_Editor, #SCI_STYLESETFONT, #STYLE_Code, ToAscii(EditorFontName$))ScintillaSendMessage(#GADGET_Help_Editor, #SCI_STYLESETFONT, #STYLE_Code_Function, ToAscii(EditorFontName$))ScintillaSendMessage(#GADGET_Help_Editor, #SCI_STYLESETFONT, #STYLE_Code_Constant, ToAscii(EditorFontName$))ScintillaSendMessage(#GADGET_Help_Editor, #SCI_STYLESETFONT, #STYLE_Code_Comment, ToAscii(EditorFontName$))ScintillaSendMessage(#GADGET_Help_Editor, #SCI_STYLESETFONT, #STYLE_Code_Keyword, ToAscii(EditorFontName$))ScintillaSendMessage(#GADGET_Help_Editor, #SCI_STYLESETSIZE, #STYLE_Code, EditorFontSize)ScintillaSendMessage(#GADGET_Help_Editor, #SCI_STYLESETSIZE, #STYLE_Code_Function, EditorFontSize)ScintillaSendMessage(#GADGET_Help_Editor, #SCI_STYLESETSIZE, #STYLE_Code_Constant, EditorFontSize)ScintillaSendMessage(#GADGET_Help_Editor, #SCI_STYLESETSIZE, #STYLE_Code_Comment, EditorFontSize)ScintillaSendMessage(#GADGET_Help_Editor, #SCI_STYLESETSIZE, #STYLE_Code_Keyword, EditorFontSize)ScintillaSendMessage(#GADGET_Help_Editor, #SCI_STYLESETBOLD, #STYLE_Bold, 1)ScintillaSendMessage(#GADGET_Help_Editor, #SCI_STYLESETSIZE, #STYLE_Title, TitleSize)ScintillaSendMessage(#GADGET_Help_Editor, #SCI_STYLESETBOLD, #STYLE_Title, 1)ScintillaSendMessage(#GADGET_Help_Editor, #SCI_STYLESETFORE, #STYLE_Function, Colors(#COLOR_PureKeyword)\DisplayValue)ScintillaSendMessage(#GADGET_Help_Editor, #SCI_STYLESETBOLD, #STYLE_Function, 1)ScintillaSendMessage(#GADGET_Help_Editor, #SCI_STYLESETFORE, #STYLE_Link, Colors(#COLOR_PureKeyword)\DisplayValue)ScintillaSendMessage(#GADGET_Help_Editor, #SCI_STYLESETHOTSPOT, #STYLE_Link, 1)ScintillaSendMessage(#GADGET_Help_Editor, #SCI_STYLESETUNDERLINE, #STYLE_Link, 1)CompilerIf #UseHelpSplitterSplitterGadget(#GADGET_Help_Splitter, 5, 10+HelpButtonHeight, HelpWindowWidth-10, HelpWindowHeight-15-HelpButtonHeight, #GADGET_Help_Panel, #GADGET_Help_Editor, #PB_Splitter_Vertical)CompilerEndIfInitLinuxHelp() ; load the help file and prepare the data;SubLevel = 0For i = 0 To Help_Contents_Size-1AddGadgetItem(#GADGET_Help_Tree, -1, Help_Contents(i)\Name,ドル 0, Help_Contents(i)\Sublevel)Next iFor i = 0 To Help_Index_Size-1AddGadgetItem(#GADGET_Help_Index, -1, Help_Index(i)\Name$)Next iAddKeyboardShortcut(#WINDOW_Help, #PB_Shortcut_Return, #MENU_Help_Enter)EnsureWindowOnDesktop(#WINDOW_Help)HideWindow(#WINDOW_Help, 0)LoadHelpPage("", -1) ; make sure the colors are initializedResizeHelpContent()CompilerIf #UseHelpSplitterSetGadgetState(#GADGET_Help_Splitter, HelpWindowSplitter)CompilerEndIfClearList(Help_History())SetWindowForeground(#WINDOW_Help)EndIfElseSetWindowForeground(#WINDOW_Help)EndIfEndProcedureProcedure HelpWindowEvents(EventID)If EventID = #PB_Event_GadgetEventGadget = EventGadget()ElseIf EventID = #PB_Event_MenuIf EventMenu() = #MENU_Help_Enter And GetActiveGadget() = #GADGET_Help_SearchValueEventID = #PB_Event_GadgetEventGadget = #GADGET_Help_SearchGoEndIfEndIfSelect EventIDCase #PB_Event_CloseWindowIf MemorizeWindow And IsWindowMinimized(#WINDOW_Help) = 0HelpWindowMaximized = IsWindowMaximized(#WINDOW_Help)If HelpWindowMaximized = 0HelpWindowX = WindowX(#WINDOW_Help)HelpWindowY = WindowY(#WINDOW_Help)HelpWindowWidth = WindowWidth(#WINDOW_Help)HelpWindowHeight = WindowHeight(#WINDOW_Help)EndIfCompilerIf #UseHelpSplitterHelpWindowSplitter = GetGadgetState(#GADGET_Help_Splitter)CompilerEndIfEndIfCloseWindow(#WINDOW_Help)Case #PB_Event_GadgetSelect EventGadgetCase #GADGET_Help_Treeindex = GetGadgetState(#GADGET_Help_Tree)If index <> -1LoadHelpPage( Help_Contents(index)\link$ , 1)EndIfCase #GADGET_Help_Indexindex = GetGadgetState(#GADGET_Help_Index)If index <> -1LoadHelpPage( Help_Index(index)\link$ , 1)EndIfCase #GADGET_Help_ParentFound = 0For i = 0 To Help_Contents_Size-1If Help_Contents(i)\Link$ = Help_History()Found = 1BreakEndIfNext iIf Found And i > 0SubLevel = Help_Contents(i)\SubLevel - 1For i = i-1 To 0 Step -1If Help_Contents(i)\SubLevel = SubLevelLoadHelpPage(Help_Contents(i)\Link,ドル 1)BreakEndIfNext iEndIfCase #GADGET_Help_BackIf ListSize(Help_History()) > 1DeleteElement(Help_History())LoadHelpPage(Help_History(), 0)EndIfCase #GADGET_Help_PreviousFound = 0For i = 0 To Help_Contents_Size-1If Help_Contents(i)\Link$ = Help_History()Found = 1BreakEndIfNext iIf Found And i > 0If Help_Contents(i-1)\SubLevel = Help_Contents(i)\SubLevelLoadHelpPage(Help_Contents(i-1)\Link,ドル 1)EndIfEndIfCase #GADGET_Help_NextFound = 0For i = 0 To Help_Contents_Size-1If Help_Contents(i)\Link$ = Help_History()Found = 1BreakEndIfNext iIf Found And i < Help_Contents_Size-1If Help_Contents(i+1)\SubLevel = Help_Contents(i)\SubLevelLoadHelpPage(Help_Contents(i+1)\Link,ドル 1)EndIfEndIfCase #GADGET_Help_SearchGoSearch$ = GetGadgetText(#GADGET_Help_SearchValue)SearchLength = Len(Search$)ClearList(Help_Search())ClearGadgetItems(#GADGET_Help_SearchResults)If Search$For page = 0 To Help_Directory_Size-1*Cursor = Help_Directory(page)\Pointer*BufferEnd = *Cursor + Help_Directory(page)\Length - SearchLengthword_found = 0title_found = 0While *Cursor < *BufferEndIf word_found = 0 And CompareMemoryString(ToAscii(Search$), *Cursor, #PB_String_NoCase, SearchLength, #PB_Ascii) = 0; page matches search.word_found = 1If title_found = 1AddElement(Help_Search())Help_Search() = Help_Directory(page)\link$AddGadgetItem(#GADGET_Help_SearchResults, -1, PageTitle$)BreakEndIfElseIf title_found = 0 And CompareMemoryString(ToAscii("{TITLE}"), *Cursor, #PB_String_CaseSensitive, 7, #PB_Ascii) = 0*Cursor + 7*Cursor2.BYTE = *CursorWhile *Cursor2\b <> '{'*Cursor2 + 1WendPageTitle$ = PeekS(*Cursor, *Cursor2-*Cursor, #PB_Ascii)title_found = 1If word_found = 1AddElement(Help_Search())Help_Search() = Help_Directory(page)\link$AddGadgetItem(#GADGET_Help_SearchResults, -1, PageTitle$)BreakEndIfEndIf*Cursor + 1WendIf word_found = 1 And title_found = 0AddElement(Help_Search())Help_Search() = Help_Directory(page)\link$AddGadgetItem(#GADGET_Help_SearchResults, -1, Help_Search())EndIfNext pageEndIfCase #GADGET_Help_SearchResultsindex = GetGadgetState(#GADGET_Help_SearchResults)If index <> -1SelectElement(Help_Search(), index)LoadHelpPage( Help_Search() , 1)EndIfCase #GADGET_Help_SplitterResizePanelContent()Case #GADGET_HELP_EditorSelect EventType()Case #EVENTTYPE_LoadHelpPageLoadHelpPage(Help_Links()\Link,ドル 1)EndSelectEndSelectCase #PB_Event_SizeWindowResizeHelpContent()EndSelectEndProcedureProcedure UpdateHelpWindow()SetWindowTitle(#WINDOW_Help, Language("Help","Title"))SetGadgetText(#GADGET_Help_Parent, Language("Help", "Parent"))SetGadgetText(#GADGET_Help_Back, Language("Help", "Back"))SetGadgetText(#GADGET_Help_SearchGo, Language("Help", "StartSearch"))SetGadgetItemText(#GADGET_Help_Panel, 0, Language("Help", "Contents"), 0)SetGadgetItemText(#GADGET_Help_Panel, 1, Language("Help", "Index"), 0)SetGadgetItemText(#GADGET_Help_Panel, 2, Language("Help", "Search"), 0); Update sizes of the buttonsGetRequiredSize(#GADGET_Help_Parent, @ButtonWidth, @HelpButtonHeight)ButtonWidth = Max(ButtonWidth, 80)ButtonWidth = Max(ButtonWidth, GetRequiredWidth(#GADGET_Help_Back))ButtonWidth = Max(ButtonWidth, GetRequiredWidth(#GADGET_Help_Previous))ButtonWidth = Max(ButtonWidth, GetRequiredWidth(#GADGET_Help_Next))ResizeGadget(#GADGET_Help_Parent, 5, 5, ButtonWidth, HelpButtonHeight)ResizeGadget(#GADGET_Help_Back, 10+ButtonWidth, 5, ButtonWidth, HelpButtonHeight)ResizeGadget(#GADGET_Help_Previous, 20+ButtonWidth*2, 5, ButtonWidth, HelpButtonHeight)ResizeGadget(#GADGET_Help_Next, 25+ButtonWidth*3, 5, ButtonWidth, HelpButtonHeight)ResizeHelpContent(); Reload the helpfile if the language really changed;If HelpLanguage$ <> CurrentLanguage$If ListSize(Help_History()) > 0Link$ = Help_History()ElseLink$ = "reference/reference"EndIfHelpWindowEvents(#PB_Event_CloseWindow)Help_Loaded = 0 ; will cause a reload of the fileOpenHelpWindow() ; will load the new helpfileLoadHelpPage(Link,ドル #True)EndIfEndProcedureProcedure DisplayHelp(CurrentWord$)OpenHelpWindow()If CurrentWord$ = ""LoadHelpPage("reference/reference", 1) ; load the default pageElseIf CheckPureBasicKeyWords(CurrentWord$) <> ""LoadHelpPage(LCase(CheckPureBasicKeyWords(CurrentWord$)), 1)ElseFound = 0CurrentWord$ = LCase(CurrentWord$)For i = 0 To Help_Index_Size-1If CurrentWord$ = LCase(Help_Index(i)\Name$)Found = 1BreakEndIfNext iIf FoundLoadHelpPage(Help_Index(i)\Link,ドル 1)ElseLoadHelpPage("reference/reference", 1) ; load the default pageEndIfEndIfEndProcedureCompilerEndIf
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。