Page 1 of 2
Posted: Wed Nov 13, 2002 8:40 pm
by BackupUser
Restored from previous forum. Originally posted by Andre.
Hi!
I got this suggestion by a PB user, who isn't on the forum.
He has following wish for editor improvement:
Selecting of a source area with the mouse and fold it to its first line (Excel function: hide lines). So you get better overview in your source.
Maybe a simpler addition would be procedure folding, which could possibly be combined with the current procedure browser. The user could "open/close (fold)" the procedure code in the editor area with a click in the browser...
Discussion is welcome.
Regards
André
*** German PureBasic Support ***
Posted: Wed Nov 13, 2002 8:48 pm
by BackupUser
Restored from previous forum. Originally posted by Berikco.
Hi André
yes me too
Asked this also couple of times.
It is not so easy in current editor with richedit Fred told me
Regards,
Berikco
http://www.benny.zeb.be
Posted: Wed Nov 13, 2002 8:49 pm
by BackupUser
Restored from previous forum. Originally posted by PB.
> Discussion is welcome.
The editor uses a standard RichEdit control -- is it even possible for
it to "fold" or "hide" text? If not, then I don't see how folding
procedures can ever be possible.
PB - Registered PureBasic Coder
Posted: Wed Nov 13, 2002 8:57 pm
by BackupUser
Restored from previous forum. Originally posted by Berikco.
It could work like this in richedit.
Keep copy of source in a buffer.
Cut selected lines in richedit.
Leave the first line in the richedit, give it another syntax coloring, with a marker before it to show its folded state.
if the line is unfolded or edited, copy text back from buffer to richedit.
for save or compile or edit, the source in buffer is used.
But the editor would need a huge rework ...
Like a read sometimes here....everything is possible ...
Regards,
Berikco
http://www.benny.zeb.be
Posted: Wed Nov 13, 2002 10:29 pm
by BackupUser
Restored from previous forum. Originally posted by PB.
Yes, a disk-based buffer (using the TEMP directory) should be fine.
You can't use the current source folder because the user might be
editing a 1.40 MB app stored on a floppy, and a RAM-based buffer runs
the risk of data loss if your PC crashes.
PB - Registered PureBasic Coder
Posted: Wed Nov 13, 2002 11:04 pm
by BackupUser
Restored from previous forum. Originally posted by freak.
> and a RAM-based buffer runs the risk of data loss if your PC crashes.
That is allready the case. If you edit some code that isn't saved and your PC
crashes, you'll lose it all. So where is the problem with a Memory-based buffer?
Timo
Posted: Wed Nov 13, 2002 11:38 pm
by BackupUser
Restored from previous forum. Originally posted by PB.
> If you edit some code that isn't saved and your PC crashes, you'll
> lose it all. So where is the problem with a Memory-based buffer?
It means we have to save our apps whenever we're about to fold a
procedure, which will be very inconvenient...
PB - Registered PureBasic Coder
Posted: Thu Nov 14, 2002 12:32 pm
by BackupUser
Restored from previous forum. Originally posted by freak.
????
I didn't says that.
You were saying, that a RAM-based buffer will cause loss of Data, when he PC crashes. And I said that this is allready the case. All data that isn't saved is lost, no matter if it is in a
Richedit control (like it is now) or in a Memory Buffer (that's how it could be).
It doesn't mean, you'll have to save all the time, becourse the right code remains in Memory, just the Richedit changes.
Timo
Posted: Thu Nov 14, 2002 1:40 pm
by BackupUser
Restored from previous forum. Originally posted by PB.
> All data that isn't saved is lost, no matter if it is in a Richedit
> control (like it is now) or in a Memory Buffer (that's how it could
> be).
What I mean is this:
RAM-Based: User edits a procedure and then folds it. The folded data
is saved in RAM. If the PC crashes now, then all changes are lost,
because the user didn't save it before folding.
Disk-Based: User edits a procedure and then folds it. The folded data
is saved to disk. If the PC crashes now, then all changes can be
recovered from disk from wherever the folded procedures are stored.
That's what I mean.
PB - Registered PureBasic Coder
Posted: Thu Nov 14, 2002 3:52 pm
by BackupUser
Restored from previous forum. Originally posted by plouf.
but anyway atm that fold/unfold is not supported if you dont save your data and your
pc crashes you lost them you must save it
Christos
Posted: Thu Nov 14, 2002 7:33 pm
by BackupUser
Restored from previous forum. Originally posted by Berikco.
Disk based, not needed, in ram is much faster.
There would be no difference to the current situation, now you also lose changes if pc chrash (hapened only ones to me with PB)
If you type a key, it must be inserted in Richedit, and in the buffer.
Also some place to store the point where to start and end the folding state, and save this with the source.
could be like this in PB file:
; ExecutableFormat=Windows
; Fold=10,23
; Fold=53,75
; EOF
Line 10 to 23 folded
Line 53 to 75 folded
So the folded state is not lost if you load source again.
And much, much more...
Regards,
Berikco
http://www.benny.zeb.be
Posted: Thu Nov 14, 2002 8:30 pm
by BackupUser
Restored from previous forum. Originally posted by Berikco.
It could look like this
Code: Select all
Global hwnd
Global buf$
Global Fold
buf$ = "{\rtf1\ansi\ansicpg1252\deff0\deflang2067{\fonttbl{\f0\fswiss\fcharset0 Arial;}{\f1\fnil\fcharset0 Courier;}}{\colortbl ;\red0\green102\blue102;\red0\green0\blue0;\red0\green170\blue170;\red146\green75\blue114;}{\*\generator Msftedit 5.41.15.1503;}\viewkind4\uc1\pard\cf1\b\f1\fs20 Global\cf2\b0 hwnd\line\cf1\b Global\cf2\b0 buf$\line Buf$=\cf1 " + Chr(34) + "\{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang2067\{\\fonttbl\{\\f0\\fswiss\\fcharset0 Arial;\}\}" + Chr(34) + "\cf2\line buf$+\cf1 " + Chr(34) + "\{\\colortbl ;\\red255\\green0\\blue0;\}" + Chr(34) + "\cf2\line buf$+\cf1 " + Chr(34) + "\\viewkind4\\uc1\\pard\\cf1\\f0\\fs40 PB, feel the pure power\\cf0\\fs20\\par\}" + Chr(34) + "\cf2\line\cf3 ;\cf2\line\cf1\b Procedure\cf2\b0 \cf1 MyWindowCallback\cf2 (WindowID, Message, wParam, lParam) \line Result = \cf4 #PB_ProcessPureBasicEvents\cf2 \line \cf1\b Select\cf2\b0 WindowID\line \cf1\b Case\cf2\b0 hwnd\line \cf1\b Select\cf2\b0 message\line \cf1\b Case\cf2\b0 \cf4 #WM_TIMER\cf2 \line \cf1\b Select\cf2\b0 wparam\line \cf1\b Case\cf2\b0 1 \cf3 ; 1 sec timer\cf2\line \cf1 SetGadgetText\cf2 (\cf4 #1\cf2 , \cf1 " + Chr(34) + "Please resize window 2" + Chr(34) + "\cf2 )\line \cf1\b Case\cf2\b0 2 \cf3 ; 50 ms timer \cf2\line \cf3 ; do your stuff here every 50 ms\cf2\line \cf1\b EndSelect\cf2\b0\line \cf1\b EndSelect\cf2\b0\line \cf1\b EndSelect\cf2\b0\line \cf1\b ProcedureReturn\cf2\b0 Result \line\cf1\b EndProcedure\cf2\b0 \line\cf3 ;\cf2\line hwnd= \cf1 OpenWindow\cf2 (1, 200, 100, 500, 250 ,\cf4 #PB_Window_SystemMenu\cf2 | \cf4 #PB_Window_MinimizeGadget\cf2 | \cf4 #PB_Window_MaximizeGadget\cf2 | \cf4 #PB_Window_SizeGadget\cf2 ,\cf1 " + Chr(34) + "PB Window 1" + Chr(34) + "\cf2 )\line\cf1\b If\cf2\b0 hwnd\line *RichEditGadget = \cf1 CreateWindowEx_\cf2 (\cf4 #WS_EX_CLIENTEDGE\cf2 , \cf1 " + Chr(34) + "RichEdit20A" + Chr(34) + "\cf2 , 0, \cf4 #WS_CHILD\cf2 | \cf4 #WS_VISIBLE\cf2 | \cf4 #ES_MULTILINE\cf2 | \cf4 #ES_AUTOHSCROLL\cf2 | \cf4 #ES_AUTOVSCROLL\cf2 | \cf4 #ES_WANTRETURN\cf2 | \cf4 #WS_HSCROLL\cf2 | \cf4 #WS_VSCROLL\cf2 , 10, 10, 400, 200, \cf1 WindowID\cf2 (), 1, \cf1 GetModuleHandle_\cf2 (0), 0)\line \cf1 SendMessage_\cf2 (*RichEditGadget, \cf4 #WM_SETTEXT\cf2 ,0, @buf$)\line \cf1 SetWindowCallback\cf2 (@\cf1 MyWindowCallback\cf2 ()) \line \cf1\b Repeat\cf2\b0\line \cf1\b Until\cf2\b0 \cf1 WaitWindowEvent\cf2 ()=\cf4 #PB_Event_CloseWindow\cf2 \line\cf1\b EndIf\cf2\b0\line\cf3 ;\cf2\line\cf1\b End\cf2\b0 \line\cf0\f0\par}"
buf2$ = "{\rtf1\ansi\ansicpg1252\deff0\deflang2067{\fonttbl{\f0\fnil\fcharset0 Courier;}{\f1\fswiss\fcharset0 Arial;}}{\colortbl ;\red0\green102\blue102;\red0\green0\blue0;\red0\green170\blue170;\red128\green128\blue0;\red146\green75\blue114;}{\*\generator Msftedit 5.41.15.1503;}\viewkind4\uc1\pard\cf1\b\f0\fs20 Global\cf2\b0 hwnd\line\cf1\b Global\cf2\b0 buf$\line Buf$=\cf1 " + Chr(34) + "\{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang2067\{\\fonttbl\{\\f0\\fswiss\\fcharset0 Arial;\}\}" + Chr(34) + "\cf2\line buf$+\cf1 " + Chr(34) + "\{\\colortbl ;\\red255\\green0\\blue0;\}" + Chr(34) + "\cf2\line buf$+\cf1 " + Chr(34) + "\\viewkind4\\uc1\\pard\\cf1\\f0\\fs40 PB, feel the pure power\\cf0\\fs20\\par\}" + Chr(34) + "\cf2\line\cf3 ;\cf2\line\cf4\b *>> Procedure\b0 MyWindowCallback(WindowID, Message, wParam, lParam) \cf2\line\cf3 ;\cf2\line hwnd= \cf1 OpenWindow\cf2 (1, 200, 100, 500, 250 ,\cf5 #PB_Window_SystemMenu\cf2 | \cf5 #PB_Window_MinimizeGadget\cf2 | \cf5 #PB_Window_MaximizeGadget\cf2 | \cf5 #PB_Window_SizeGadget\cf2 ,\cf1 " + Chr(34) + "PB Window 1" + Chr(34) + "\cf2 )\line\cf1\b If\cf2\b0 hwnd\line *RichEditGadget = \cf1 CreateWindowEx_\cf2 (\cf5 #WS_EX_CLIENTEDGE\cf2 , \cf1 " + Chr(34) + "RichEdit20A" + Chr(34) + "\cf2 , 0, \cf5 #WS_CHILD\cf2 | \cf5 #WS_VISIBLE\cf2 | \cf5 #ES_MULTILINE\cf2 | \cf5 #ES_AUTOHSCROLL\cf2 | \cf5 #ES_AUTOVSCROLL\cf2 | \cf5 #ES_WANTRETURN\cf2 | \cf5 #WS_HSCROLL\cf2 | \cf5 #WS_VSCROLL\cf2 , 10, 10, 400, 200, \cf1 WindowID\cf2 (), 1, \cf1 GetModuleHandle_\cf2 (0), 0)\line \cf1 SendMessage_\cf2 (*RichEditGadget, \cf5 #WM_SETTEXT\cf2 ,0, @buf$)\line \cf1 SetWindowCallback\cf2 (@\cf1 MyWindowCallback\cf2 ()) \line \cf1\b Repeat\cf2\b0\line \cf1\b Until\cf2\b0 \cf1 WaitWindowEvent\cf2 ()=\cf5 #PB_Event_CloseWindow\cf2 \line\cf1\b EndIf\cf2\b0\line\cf3 ;\cf2\line\cf1\b End\cf2\b0 \line\cf0\f1\par}"
;
hwnd= OpenWindow(1, 20, 100, 700, 450 ,#PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget| #PB_Window_SizeGadget,"PB Window 1")
If hwnd
LoadLibrary_("RICHED32.DLL")
*RichEditGadget = CreateWindowEx_(#WS_EX_CLIENTEDGE, "RichEdit20A", 0, #WS_CHILD | #WS_VISIBLE | #ES_MULTILINE | #ES_AUTOHSCROLL | #ES_AUTOVSCROLL | #ES_WANTRETURN | #WS_HSCROLL | #WS_VSCROLL, 10, 10, 600, 400, WindowID(), 1, GetModuleHandle_(0), 0)
SendMessage_(*RichEditGadget, #WM_SETTEXT,0, @buf$)
If CreateGadgetList(WindowID())
ButtonGadget(1,620, 15, 70, 25, "Fold")
While WindowEvent() : Wend
Repeat
EventID= WaitWindowEvent()
If EventID = #PB_EventGadget
Select EventGadgetID()
Case 1
If fold=0
fold=1
SendMessage_(*RichEditGadget, #WM_SETTEXT,0, @buf2$)
SetGadgetText(1,"UnFold")
While WindowEvent() : Wend
Else
fold=0
SendMessage_(*RichEditGadget, #WM_SETTEXT,0, @buf$)
SetGadgetText(1,"Fold")
While WindowEvent() : Wend
EndIf
EndSelect
EndIf
Until EventID=#PB_Event_CloseWindow
EndIf
EndIf
;
End
Regards,
Berikco
http://www.benny.zeb.be
Posted: Wed Mar 19, 2003 8:24 pm
by BackupUser
Restored from previous forum. Originally posted by GPI.
The example doesn't work on my system.
(There is only a fold/Unfold-Button, nothing more)
PB 3.61
PII 333, 256MB, Asus TNT2Ultra 32MB, AWE Gold 64 4MB
Posted: Wed Mar 19, 2003 8:37 pm
by BackupUser
Restored from previous forum. Originally posted by El_Choni.
Change:
to:
El_Choni
Posted: Fri Mar 21, 2003 3:09 am
by BackupUser
Restored from previous forum. Originally posted by isidoro.
it was me with that folder idear... i was working in that time on a solution and i resolved with a small program, wich i integrated into the editor source and this code cut the whole procedure out and instead it put a xinclude with the same name as the procedure and thats it. The code is still complete and working but you see only 1 line with the xinclude. changing the text inside the memory becomes for me very dangerous, so i am still content with this solution, wich does moreless what i wanted to do... looking on only some parts of the code and the rest i dont need to see. sorry, my english is not the best
