Page 1 of 1

Splitview or opening the same file twice in the IDE

Posted: Sun Jan 28, 2018 12:43 am
by Kurzer
Like requested in 2015 (http://www.purebasic.fr/english/viewtop ... 15&start=0)

I would prefer a splitview in the PureBasic IDE or at least the ability to open the same file in two IDE tabs.

Scintilla supports multi view of one document. See the following example code.
Run this code and edit the text. It will be changed in both views, because its internally only one document.

Code: Select all

EnableExplicit

Procedure MakeScintillaText(text.s)
   Static sciText.s
   CompilerIf #PB_Compiler_Unicode
      sciText = Space(StringByteLength(text, #PB_UTF8))
      PokeS(@sciText, text, -1, #PB_UTF8)
   CompilerElse
      sciText = text
   CompilerEndIf
   ProcedureReturn @sciText
EndProcedure


If OpenWindow(0, 0, 0, 320, 180, "ScintillaGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
   
   If InitScintilla()
      ScintillaGadget(0, 10, 10, 300, 70, 0)
      ScintillaGadget(1, 10, 100, 300, 70, 0)
      
      ; Ausgabe auf rote Farbe setzen
      ScintillaSendMessage(0, #SCI_STYLESETFORE, 0, RGB(255, 0, 0))
      
      ; Anfänglichen Text des ScintillaGadgets festlegen
      ScintillaSendMessage(0, #SCI_SETTEXT, 0, MakeScintillaText("Please type in some text in the top Scintilla Gadget"))
      
      ; Hinzufügen einer zweiten Zeile mit einem vorherigen Zeilenumbruch
      Define Text$
      Define *DocPointer
      
      ScintillaSendMessage(0, #SCI_APPENDTEXT, Len(Text$), MakeScintillaText(Text$))
      
      *DocPointer = ScintillaSendMessage(0, #SCI_GETDOCPOINTER, 0, 0)
      
      Debug *DocPointer
      
      ScintillaSendMessage(1, #SCI_SETDOCPOINTER, 0, *DocPointer)
      
   EndIf
   
   Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
   
EndIf
Image

Re: Splitview or opening the same file twice in the IDE

Posted: Sun Jan 28, 2018 1:38 am
by oreopa
+1 (for the split view... loading two documents is an ugly kludge)

Nice example also.

Re: Splitview or opening the same file twice in the IDE

Posted: Sun Jan 28, 2018 2:21 am
by skywalk
Another +100.
I would love to have 2 sections available at the same time.
I miss this from Visual Studio way back.

Re: Splitview or opening the same file twice in the IDE

Posted: Sun Jan 28, 2018 11:05 am
by #NULL
+1
I often wished i had that too.

Re: Splitview or opening the same file twice in the IDE

Posted: Sun Jan 28, 2018 11:27 am
by Marc56us
Hi,

I would like to be able to use both TAB mode and/or MDI mode.

Notepad++ (who use scintilla too) can do it: Right-click on one of the tabs and select "Move to other window" or "Clone to other window".

Then, you can even synch the movement in View > Synchonize vertical (and) horizontal scrolling.

Very useful to work on two versions of the same code

:wink: