IDE: Split-view on the same file

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
Kurzer
Enthusiast
Enthusiast
Posts: 664
Joined: Sun Jun 11, 2006 12:07 am
Location: Near Hamburg

IDE: Split-view on the same file

Post by Kurzer »

My wish for the next version of PB is a split-view like in Excel or Open Office calc.
Image

Sometimes I have to jump from top to bottom of the same source, only to check how I have solved a similar problem in another procedure.
Actually I write a network application and I often jump from the send routine to the receive routine. A multiple split-view would be a very big assistance.
PB 6.02 x64, OS: Win 7 Pro x64 & Win 11 x64, Desktopscaling: 125%, CPU: I7 6500, RAM: 16 GB, GPU: Intel Graphics HD 520, User age in 2023: 56y
"Happiness is a pet." | "Never run a changing system!"
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6161
Joined: Sat May 17, 2003 11:31 am
Contact:

Re: IDE: Split-view on the same file

Post by blueznl »

That's what I have CodeCaddy for :-)

But yes, that may be useful... (Don't ignore the power of F2 / Ctrl+L but you probably already know...)
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
User avatar
eddy
Addict
Addict
Posts: 1479
Joined: Mon May 26, 2003 3:07 pm
Location: Nantes

Re: IDE: Split-view on the same file

Post by eddy »

It's a cool feature supported by Scintilla.
but the main thing to update is the code parser. Perhaps it's complex to manage two views.

:roll: I haven't found some tutorials about this problem yet.

Here is an example. I modified the demo from Srod...
Image
Last edited by eddy on Wed Dec 16, 2009 12:06 am, edited 1 time in total.
Imagewin10 x64 5.72 | IDE | PB plugin | Tools | Sprite | JSON | visual tool
User avatar
Demivec
Addict
Addict
Posts: 4086
Joined: Mon Jul 25, 2005 3:51 pm
Location: Utah, USA

Re: IDE: Split-view on the same file

Post by Demivec »

eddy wrote:Scintilla supports this feature.
but the main thing to update is the code parser. Perhaps it's complex to manage two views.
jaPBe allows a second view in the right hand panel, where lists of variables and other stuff can also be shown.
User avatar
eddy
Addict
Addict
Posts: 1479
Joined: Mon May 26, 2003 3:07 pm
Location: Nantes

Re: IDE: Split-view on the same file

Post by eddy »

jaPBe allows a second view in the right hand panel, where lists of variables and other stuff can also be shown.
It's Good to know.
Argh! Japbe source code is big and coded in PB~3.94, it will be harsh to read. :mrgreen:
Imagewin10 x64 5.72 | IDE | PB plugin | Tools | Sprite | JSON | visual tool
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6161
Joined: Sat May 17, 2003 11:31 am
Contact:

Re: IDE: Split-view on the same file

Post by blueznl »

A dual view is nice, but to increase productivity, it should provide some things like a good search function, you don't want to scroll around looking for some code.

Also, dual screen users might appreciate a second window as opposed to a second view. A second window could then be placed opn the second monitor. If you have the screen real estate, then use it! :-)
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
Foz
Addict
Addict
Posts: 1359
Joined: Tue Nov 13, 2007 12:42 pm
Location: Manchester, UK

Re: IDE: Split-view on the same file

Post by Foz »

I do, the IDE in one monitor, and the app in the other monitor, when stepping through, it's h-h-h-heaven!
User avatar
DoubleDutch
Addict
Addict
Posts: 3219
Joined: Thu Aug 07, 2003 7:01 pm
Location: United Kingdom
Contact:

Re: IDE: Split-view on the same file

Post by DoubleDutch »

blueznl: I think Scintilla can also do the second window stuff too.
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
User avatar
Kurzer
Enthusiast
Enthusiast
Posts: 664
Joined: Sun Jun 11, 2006 12:07 am
Location: Near Hamburg

Re: IDE: Split-view on the same file

Post by Kurzer »

I want to re-activate my feature request, because it is IMHO a really helpful feature with a minimum of codechanges (I guess).

Scintilla is able to handle one document in multiple Editorgadgets. Scintilla handles text and the Gadget, which displays the text, separately. One can connect one Document instance to any number of scintilla gadgets. I tried to "hack" the IDE to connect the current document (sourcecode) to a own Scintilla Gadget, but unfortunately it is not possible due to memory accessvialoation. I can read the documentpointer, but the IDE and my program are separate processes, so it is not allowed for my Scintilla gadget to handle the document of the IDE.

So this will only work if you (Freak or Fred) open a second view (Scintialla Gadget) in the IDE panel and connect the current document (sourcecode) to this second view in the same process.

I have no idea if this second view interferes with existing functions of the PB-IDE, or whether there is to write additional code, but in principle it looks very very simple.

- Open second view
- Get the documentpointer of the current sourcecode
- Connect the document to the second view

For more informations see this section in the Scintilla docs please: http://www.scintilla.org/ScintillaDoc.h ... tipleViews

Here is a very simple example how it works (I exdented the Scintilla example):
Compile this code and enter some new text in one of the two Scintilla Gadgets. You will see that both Gadgets are handling the same document instance in realtime.

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

Because this feature has not been implemented for many years I would pay for it!
PB 6.02 x64, OS: Win 7 Pro x64 & Win 11 x64, Desktopscaling: 125%, CPU: I7 6500, RAM: 16 GB, GPU: Intel Graphics HD 520, User age in 2023: 56y
"Happiness is a pet." | "Never run a changing system!"
User avatar
Tenaja
Addict
Addict
Posts: 1948
Joined: Tue Nov 09, 2010 10:15 pm

Re: IDE: Split-view on the same file

Post by Tenaja »

+1

An uncomplicated way to do this (speaking from experience) is to add the secondary window to a tab in the Tools panel. Putting it there would allow any window to be duplicated, be it the one with focus or not.
Dude
Addict
Addict
Posts: 1907
Joined: Mon Feb 16, 2015 2:49 pm

Re: IDE: Split-view on the same file

Post by Dude »

Why can't you just open the same source twice? One for editing, one for looking?
User avatar
Kurzer
Enthusiast
Enthusiast
Posts: 664
Joined: Sun Jun 11, 2006 12:07 am
Location: Near Hamburg

Re: IDE: Split-view on the same file

Post by Kurzer »

For several reasons:

- The IDE does not allow to open the same source twice. If you try to load an already opened fiel thi IDE will bring the existing TAB in foreground instead of loading the file into a new TAB.

- If the problem above does not exists and I have a second TAB with my code, I have to switch every time between the TABs to have a look.

- I could load the source into an external editor and place this editor on top if the PB IDE (maybe in sticky mode). But then I have no syntax highlightning, the external editor covers a part of the IDE, I cannot edit the code in the extern editor because its not always the current version of the code - so if I want to edit the line which is shown in the external editor I have to switch to the PB IDE and have to scroll at this position and then I am able to edit the source at this line. It is not much flexible like in a split view solution with only one source instance.

Of cource, I have survived the last 6 years without this feature, but in my opinion it is a valuable feature and I guess the work to implement it is not to difficult. But this can judge only Freak or Fred.
PB 6.02 x64, OS: Win 7 Pro x64 & Win 11 x64, Desktopscaling: 125%, CPU: I7 6500, RAM: 16 GB, GPU: Intel Graphics HD 520, User age in 2023: 56y
"Happiness is a pet." | "Never run a changing system!"
Dude
Addict
Addict
Posts: 1907
Joined: Mon Feb 16, 2015 2:49 pm

Re: IDE: Split-view on the same file

Post by Dude »

kurzer wrote:The IDE does not allow to open the same source twice.
I meant in two different IDE instances. I do this all the time, so I can refer to the same source with full syntax highlighting.

But I admit that doing it from one source would be nicer, yes. :) So: +1
User avatar
Tenaja
Addict
Addict
Posts: 1948
Joined: Tue Nov 09, 2010 10:15 pm

Re: IDE: Split-view on the same file

Post by Tenaja »

Dude wrote:Why can't you just open the same source twice? One for editing, one for looking?
One of the "problems" with doing it this way is the line numbers do not match up. If you are working on data, asm, or repetitive code, it is critical that the line numbers match between windows.
User avatar
mhs
Enthusiast
Enthusiast
Posts: 101
Joined: Thu Jul 02, 2015 4:53 pm
Location: Germany
Contact:

Re: IDE: Split-view on the same file

Post by mhs »

+1
Post Reply