PureBasic Forum
http://forums.purebasic.com/english/

Can I have 2 times opened the same source?
http://forums.purebasic.com/english/viewtopic.php?f=18&t=75771
Page 1 of 1

Author:  AMpos [ Mon Jul 27, 2020 10:16 pm ]
Post subject:  Can I have 2 times opened the same source?

I have a proyect, and I would like to have the same source file opened 2 times in the editor, as I have to check two parts of the source, and it is a pain to be jumping with markers.

Is it posible?

Author:  Joris [ Tue Jul 28, 2020 6:46 am ]
Post subject:  Re: Can I have 2 times opened the same source?

Open a new tab in the editor and ...

Author:  BarryG [ Tue Jul 28, 2020 8:34 am ]
Post subject:  Re: Can I have 2 times opened the same source?

Joris wrote:
Open a new tab in the editor and ...

...nothing. That doesn't open a second copy for me. It just switches back to the old tab with the source. Tested with a default PureBasic install and with my existing Prefs file. I need to run PureBasic twice to have the same source open twice.

Author:  Marc56us [ Tue Jul 28, 2020 8:58 am ]
Post subject:  Re: Can I have 2 times opened the same source?

Yes, you can't open the same file twice in the PB IDE.

In the Feature Request, it was asked if it was possible to add a horizontal splitter. This should not be possible easily because most Scintilla-based editors don't have this feature either.

In the meantime, personally, I open a read-only copy in Notepad++ with automatic synchronization of changes.

PS. In PB IDE, in addition to the markers you already use (F2) I also often use the return to the last position (CTRL+L) as well as the tool panel "Issue Browser" . Very useful.

Author:  Demivec [ Tue Jul 28, 2020 9:12 am ]
Post subject:  Re: Can I have 2 times opened the same source?

Marc56us wrote:
In the Feature Request, it was asked if it was possible to add a horizontal splitter. This should not be possible easily because most Scintilla-based editors don't have this feature either.

jaPBe has this feature and had a Scintilla-based editor, though the source is a bit out dated. I think it would be possible to implement it in the the editor if jaPBe was used as an example (it was also open-source).

Author:  Rinzwind [ Tue Jul 28, 2020 9:18 am ]
Post subject:  Re: Can I have 2 times opened the same source?

Scintella supports it by connecting two Scintella gadgets.

Very raw example:
Code:


Procedure Callback_Scintilla_0()
 
EndProcedure

Procedure Callback_Scintilla_1()
 
EndProcedure

;;
; This code is automatically generated by the FormDesigner.
; Manual modification is possible to adjust existing commands, but anything else will be dropped when the code is compiled.
; Event procedures needs to be put in another source file.
;

InitScintilla()

Enumeration FormWindow
  #Window_0
EndEnumeration

Enumeration FormGadget
  #Scintilla_0
  #Scintilla_1
EndEnumeration


Procedure OpenWindow_0(x = 0, y = 0, width = 600, height = 400)
  OpenWindow(#Window_0, x, y, width, height, "", #PB_Window_SystemMenu)
  ScintillaGadget(#Scintilla_0, 10, 10, 578, 174, @Callback_Scintilla_0())
  ScintillaGadget(#Scintilla_1, 14, 190, 574, 194, @Callback_Scintilla_1())
EndProcedure

Procedure Window_0_Events(event)
  Select event
    Case #PB_Event_CloseWindow
      ProcedureReturn #False

    Case #PB_Event_Menu
      Select EventMenu()
      EndSelect

    Case #PB_Event_Gadget
      Select EventGadget()
      EndSelect
  EndSelect
  ProcedureReturn #True
EndProcedure

;;

OpenWindow_0()

Define pdoc
pdoc = SendMessage_(GadgetID(#Scintilla_0), #SCI_GETDOCPOINTER, 0, 0)
Debug pdoc
SendMessage_(GadgetID(#Scintilla_1), #SCI_SETDOCPOINTER, 0, pdoc)

Repeat
  e = WaitWindowEvent()
  Window_0_Events(e)
Until e = #PB_Event_CloseWindow


PowerBasic example:
https://www.garybeene.com/code/gbsnippets_gbs_00644.htm

Can't even split tabs into multiple simultaneous views (left/right would be a start).

Kind of part workaround: disable "Run only one Instance" in Preferences/General

offtopic About the IDE github project: would be wise for PB to spend some time to get it to compile easy. Check out is one, getting it to run is quite hard from what I have read. Missing EnableExplicit in almost all sources is a shock for me personally. A source of bugs. Aah found an github issue about it: https://github.com/fantaisie-software/p ... /issues/26 . Seems they open sourced it without proper source cleanup/preparation and instructions which hinders community efforts.

Author:  Marc56us [ Tue Jul 28, 2020 9:32 am ]
Post subject:  Re: Can I have 2 times opened the same source?

Yes, it seems that Scintilla can open several views of the same file and synchronize them.

https://www.scintilla.org/ScintillaDoc.html#MultipleViews

Author:  Denis [ Tue Jul 28, 2020 10:17 am ]
Post subject:  Re: Can I have 2 times opened the same source?

Sometime i opened the same project into 32 and 64 PB ide (i always work in 64 bit mode).
If I modify the code in one editor and switch to the other, the modified file will be displayed on the same line because of the PB ide synchronization, so i still have to jump to the part i want to see ...
If you want to see another part of the file in the second editor, that's not the right way to do it.
That's why I do like Marc56us, I use NotePad++ to do the job (sometimes i modify the code in notepad ++ and it works fine when i'm back to PB ide.)

Author:  BarryG [ Tue Jul 28, 2020 10:30 am ]
Post subject:  Re: Can I have 2 times opened the same source?

RSBasic created a tool to do split-view -> viewtopic.php?f=27&t=73110

But it had a data-losing bug and was discontinued. A shame.

Author:  Joris [ Tue Jul 28, 2020 11:31 am ]
Post subject:  Re: Can I have 2 times opened the same source?

BarryG wrote:
Joris wrote:
Open a new tab in the editor and ...

...nothing. That doesn't open a second copy for me. It just switches back to the old tab with the source. Tested with a default PureBasic install and with my existing Prefs file. I need to run PureBasic twice to have the same source open twice.
I haven't try that yet, but can't you do a copy past then ?
It works with different sources, so...

Author:  spikey [ Tue Jul 28, 2020 12:49 pm ]
Post subject:  Re: Can I have 2 times opened the same source?

Give NotePad++ a try https://notepad-plus-plus.org/. It supports dual views - select "Clone to other view" from the document's tab context menu. It automatically synchronises edits across both so it doesn't matter if you edit in the wrong view by mistake.

If you supply "%FILE" (include the quotes) as the arguments you can set it up as a custom tool in the PB IDE and have the current file opened directly in NPP from within the IDE.

Author:  Shardik [ Tue Jul 28, 2020 1:39 pm ]
Post subject:  Re: Can I have 2 times opened the same source?

Rinzwind wrote:
offtopic About the IDE github project: would be wise for PB to spend some time to get it to compile easy. Check out is one, getting it to run is quite hard from what I have read.

For MacOS it can't be much easier: copy my bash script from GitHub directly into TextEdit, save it and start it from your Terminal. It downloads the purebasic-master from GitHub automagically, compiles it and directly launches the newly compiled IDE...:wink:

Author:  AMpos [ Tue Jul 28, 2020 10:05 pm ]
Post subject:  Re: Can I have 2 times opened the same source?

In the end I cut/copy one procedure to another source, so I have only to switch between source tabs.

Page 1 of 1 All times are UTC + 1 hour
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/