Author Topic: A little brother of OxIde  (Read 24740 times)

0 Members and 1 Guest are viewing this topic.

Arnold

  • Hero Member
  • *****
  • Posts: 977
Re: A little brother of OxIde
« Reply #15 on: March 24, 2017, 04:24:00 am »
Hi Charles,

it seems that I am almost able to improve and extend the little editor by itself. I added some more features: displaying whitespace and eol, changing eol, set Highlight on/off, a little better F1 help. Find dialog seems to work, Find and Replace is in work.

I would like to use a different name for the editor. OxSciPed is a kind of joke, I just looked for a word which I did not find in Internet. My first choice was LazyPad but this is not quite correct. Although I spied many websites, there is still some work to put everything together. My purpose for this project is to learn more about Scintilla / Scilexer and how to use this with OxygenBasic.

What name could I use? OSPad (Oxygen/Syntilla), OxPed or something else which is meaningful? I have no idea.

Roland

Aurel

  • Guest
Re: A little brother of OxIde
« Reply #16 on: March 24, 2017, 09:47:55 pm »
Quote
Unfortuately the Find and Find/Replace dialog with Scintilla is a bit more complicated than I expected and will be a bit delayed.
hi Arnold ..
no..is not to much complex..i have it in OxyEdit ,,but OxyEdit isnot written in Oxygen basic
than in Emergence Basic.
I also made mistake when i use Dialog what complicate things
easier solution will be to use TOOLWINDOW as ALLWAYS_ONTOP style.

ok here is subroutine in EBasic ,,i think that you can translate this to Oxygen
Code: [Select]
SUB FindDialogProc
INT loc
SELECT @class
 CASE @idinitdialog
  SetWindowPos(findDialog.hWnd,-1,0,0,0,0,0x1 | 0x2) /*HWND_TOPMOST=-1,SWP_NOSIZE | SWP_NOMOVE*/
  CENTERWINDOW findDialog
  '__TooltipControl(findDialog,5,"Finds the next instance of string")
  '__TooltipControl(findDialog,6,"Replaces matching string with new string")
  '__TooltipControl(findDialog,7,"Replaces all matching strings with new string")
  SETSTATE findDialog,12,1
  SETFOCUS findDialog,2
 CASE @idclosewindow
  CLOSEDIALOG findDialog
 CASE @idcontrol
  IF @notifycode=0
   SELECT @controlid
'----------------------------------------------------------
    CASE 5
'MESSAGEBOX 0,"Control","5"
     IF GETSTATE(findDialog,12)
      loc=SENDMESSAGE(w1,SCI_GETSELECTIONEND,0,0,IDC_SCI)
     ELSE
      loc=SENDMESSAGE(w1,SCI_GETSELECTIONSTART,0,0,IDC_SCI)
     ENDIF
     SENDMESSAGE w1,SCI_SETANCHOR,loc,0,IDC_SCI
     SENDMESSAGE w1,SCI_SETCURRENTPOS,loc,0,IDC_SCI
     SENDMESSAGE w1,SCI_SEARCHANCHOR,0,0,IDC_SCI
     temp=SCFIND_REGEXP
     IF GETSTATE(findDialog,16) THEN temp=SCFIND_WHOLEWORD
     IF GETSTATE(findDialog,15) THEN temp|=SCFIND_MATCHCASE
     IF GETSTATE(findDialog,12)
      loc=SENDMESSAGE(w1,SCI_SEARCHNEXT,temp,GETCONTROLTEXT(findDialog,2),IDC_SCI)
     ELSE
      loc=SENDMESSAGE(w1,SCI_SEARCHPREV,temp,GETCONTROLTEXT(findDialog,2),IDC_SCI)
     ENDIF
     IF loc>-1
      SENDMESSAGE w1,SCI_SCROLLCARET,0,0,IDC_SCI
     ELSE
      SHOWWINDOW findDialog,@swhide
      MESSAGEBOX 0,"No matches found","Search"
      SHOWWINDOW findDialog,@swrestore
     ENDIF
'-------------------------------------------------------------------
    CASE 6
     SENDMESSAGE(w1,SCI_REPLACESEL,0,GETCONTROLTEXT(findDialog,4),IDC_SCI)
'-------------------------------------------------------------------
'------------------------------------------------------
    CASE 12 : CASE& 13
     SETSTATE findDialog,12,(@controlid=12)
     SETSTATE findDialog,13,(@controlid=13)
     ENABLECONTROL findDialog,16,GETSTATE(findDialog,12)
   ENDSELECT
  ENDIF
ENDSELECT
RETURN
ENDSUB

Arnold

  • Hero Member
  • *****
  • Posts: 977
Re: A little brother of OxIde
« Reply #17 on: March 25, 2017, 01:42:14 am »
Hi Aurel,

thank you for the code snippet. I will explore it. At the moment I use a combination of two other examples which seem to work but I am not quite satisfied with the Replace All functionality. Yet I noticed that there are several possibilities using the Scintilla control. Maybe I can use the replace functions of OxIde in some way. For now the dialogs should work.

I hopefully will be ready until tomorrow to upload a compilation of the code at it's present stage. My problem is still to find a meaningful name. Maybe I will use OSPed.

Roland

Charles Pegge

  • Admin Support Member
  • *****
  • Posts: 4486
    • Oxygen Basic
Re: A little brother of OxIde
« Reply #18 on: March 25, 2017, 10:31:40 am »
Hi Roland, a few names to contemplate:


oxpad
oxypad
minoxide
oxscite
oxscide
oxcoder
oxgen
--
minide
mincoder
codepad


Aurel

  • Guest
Re: A little brother of OxIde
« Reply #19 on: March 25, 2017, 11:15:47 am »
WOW
Insteresting names Charles  :D
anyway ...i figured that i dont have this in AurelEdit (ASciO2)...
so i do sme investigation how to do that ..
and i figured that if i wish to use toolwindow as Find/Replace form i must use
window extended style:..then work ..
more mumbo jumbo comming soon.. :D

.

Arnold

  • Hero Member
  • *****
  • Posts: 977
Re: A little brother of OxIde
« Reply #20 on: March 26, 2017, 11:24:04 am »
Hi Charles,

thank you for your suggestions. This issue indeed caused me quite a headache. I see the project as a simple editor example which should be usable with OxygenBasic applying Scintilla and pure WinApi functions. Another goal will be to learn more about Scintilla and SciLexer.dll. Finally I decided on O2HEdit. The project in it's current stage will be attached with my next message.

Roland

Arnold

  • Hero Member
  • *****
  • Posts: 977
Re: A little brother of OxIde
« Reply #21 on: March 26, 2017, 11:34:55 am »
Hello,

attached is the editor project with all sources to build either a resource dll or to build a standalone application.

The original code of O2HEdit.o2bas will need a resource.dll. To create the dll the file \src\MakeDll\MakeDll.bat must be executed. If the path of OxygenBasic is different then in the batchfile the line:
set o2_dir=c:\OxygenBasic
must be changed to the correct path.

To create a standalone executable the two lines in the beginning of O2HEdit.o2bas must be changed to read like this:
...
'#define use_dll
#define make_exe
...
and the file must be saved.

In the file \src\MakeExe\MakeExe.bat the path of OxygenBasic must be perhaps changed too. After executing the batch file a standalone executable will be created.

There are more combinations possible. Everything should also work within O2HEdit. I am curious if there are any difficulties to use O2HEdit.

At the moment there are at least two problems which must be checked:
Opening the find/replace dialogs I do not manage to get focus on the Edit fields. I do not yet know what is missing. Replace All in very long text files will take too much time.
There is also a problem with ctrl chars like ctrl-b, ctrl-w etc which I cannot hide at the moment without loosing the view of the EOL chars. I know it must be possible but I have not yet found out how this will work.

The next steps will be to work out the Settings Menuitem. Then the code must be tightened a little bit.

Then SciLexer will say hello.

Roland

Edit: Deleted and attached new version with later message
« Last Edit: April 03, 2017, 05:53:41 am by Arnold »

Aurel

  • Guest
Re: A little brother of OxIde
« Reply #22 on: March 28, 2017, 02:04:16 pm »
ok Arnold
scilexer i used 1.6.8.0 work with O2HEdit even syntax is highlited is ok
well not exactlly like i have in AurelEdit but that is probably because you use newer version,
I dont try yet version  which comes with Oxygen zip but i will .
Probably require some setting with  using different base lexer not 40 i used in  AurelEdit.
But after  config i also cannot compile with O2Hdit..why?
Second when resizing scintilla flickering ,maybe because Dialog box?   

Arnold

  • Hero Member
  • *****
  • Posts: 977
Re: A little brother of OxIde
« Reply #23 on: March 29, 2017, 12:32:10 am »
Hi Charles,

in the meantime I found out how to set focus in the Find/Replace dialogs. I had to move the ids and index of the edit fields in the .rc file to the start of the dialogs (simple solution).

Can you help out with this problem? For calling F1 help I use the HtmlHelp function of hhctrl.ocx library and a code snippet of OxIde. This works in some way but I assume I missed something important. This is the code in O2HEdit.o2bas file:

Code: OxygenBasic
  1.         case IDM_HELP_OXYGEN
  2.            zstring wd
  3.            sys st,en,le,lw
  4.            s=GetText hSci
  5.            le=len s
  6.            SendMessage hSci,EM_GETSEL,@st,@en
  7.            if asc(s,st) > 32 then      
  8.              st++ : en++
  9.              wd=ExtractWord s,st,en,lw
  10.              HtmlHelp null ,o2dir+"\inf\oxygen_help.chm", HH_DISPLAY_INDEX, @wd
  11.            else
  12.              HtmlHelp null, o2dir+"\inf\oxygen_help.chm", HH_DISPLAY_TOC, 0
  13.            end if        
  14.  

If I move the cursor to a word and press F1, Oxygen_help will show the index with the word. But if I select the whole word then only the TOC is displayed. Can you point me to the right direction?

At the moment I experiment a little bit with the HH_AKLINK structure. I want to display the info of the keyword directly.

Roland

.

Arnold

  • Hero Member
  • *****
  • Posts: 977
Re: A little brother of OxIde
« Reply #24 on: March 29, 2017, 12:57:04 am »
Hi Aurel,

the editor expects all files in the folder/subfolders of \Oxygenbasic:

co2.exe: \OxygenBasic\
oxygen.dll: \OxygenBasic\
scilexer.dll: \OxygenBasic\
gorc.exe: \OxygenBasic\tools\
linkRes2exe.exe: \OxygenBasic\tools\
Oxygen_help.chm: \OxygenBasic\inf\
and of course Oxygen's include files in \OxygenBasic\inc\

If you use another structure then you are at your own at the moment, because I have not yet worked out the Settings option.

Setting the styles and extended styles is indeed a problem and must be checked. I intend to explore this issue if I have added and tested some more features for the editor. Maybe I can get some hints in the meantime?

Roland
« Last Edit: March 29, 2017, 02:13:23 am by Arnold »

Aurel

  • Guest
Re: A little brother of OxIde
« Reply #25 on: March 29, 2017, 07:10:00 am »
Hi Arnold
It is not problem in folder structure
then in your command line :
ShellExecute (null,"open", compiler, "-c " & openFile, null, SW_SHOW)
what exactly is compiler - is that full path to compiler or just compiler name?
also argument "-c " not work on my both computers and this one work "-c"
..and you not answer me why sci control flickering when is resizing?
 :)

Arnold

  • Hero Member
  • *****
  • Posts: 977
Re: A little brother of OxIde
« Reply #26 on: March 29, 2017, 08:44:41 am »
Hi Aurel,

I think the ShellExecute statements work (at least for me).
It depends on what you want to do.

1) Run a .o2bas file in JIT mode: use MenuItem: Compile, Run .o2bas file or press F5 or use the Tool button "!".
2) Compile a .o2bas file to a binary: MenuItem: Compile, Compile to Binary. Will need eventually oxygen.dll
The ShellExecute which you refer to is for this MenuItem. You can check what it does by including these statements:

Code: OxygenBasic
  1.            'Compile source code
  2.           SendMessage(hStatus, SB_SETTEXT, 3, " Compiling " openFile " with " & compiler " to binary")
  3.            if not exist compiler then mbox compiler " does not exist" : exit function
  4. print compiler
  5. print openfile
  6.            ShellExecute (null,"open", compiler, "-c " & openFile, null, SW_SHOW)
  7.  

If you want to compile to an independent exe file you must use the first option (e.g. F5) and include something like this in your code:

$filename "MyFilename.exe"
#include "$\inc\RTL32.inc"

If you want to use the second MenuItem (compile to binary) you can do this also but you will need the include statement for RTL32.inc too, if you do not want to use Oxygen.dll for running the created exe file.

Referring the flickering: I am waiting for some hints?

Roland
« Last Edit: March 29, 2017, 09:16:17 am by Arnold »

Aurel

  • Guest
Re: A little brother of OxIde
« Reply #27 on: March 29, 2017, 11:17:04 am »
Hi Arnold
I am asking you about compiler because i dont see what is this from source
is that full path to compiler or is name.
Of course I always do compile to standalone exe ... nothing else.
so that is why I ask.. :)
I am not sure why full path to compiler not work as in some other compilers
but probably Charles have explanation.

Quote
Referring the flickering: I am waiting for some hints?
In fact nothing special ,you must add in main window style WS_CLIPCHILDREN
BUT i am not sure is that work for Dialog form too.
« Last Edit: March 29, 2017, 11:31:13 am by Aurel »

Arnold

  • Hero Member
  • *****
  • Posts: 977
Re: A little brother of OxIde
« Reply #28 on: March 29, 2017, 02:07:16 pm »
Hi Aurel,

if the path of your Oxygen is e.g. d:\OxygenBasic (which is kept in O2HEdit.cfg) and you added the two print statements of my last reply in O2HEdit.o2bas in about line 433 then the MenuItem: Compile, Compile to binary should show these results:

D:\OxygenBasic\\co2.exe      (one backslash too much but works nevertheless)
drive:\path\yourProgram.o2bas

So the editor does use the full path of the OxygenBasic compiler. Maybe I should have used compilername instead of compiler, but I thought this would be sufficient.

Roland

Aurel

  • Guest
Re: A little brother of OxIde
« Reply #29 on: March 29, 2017, 10:48:14 pm »
Hi Arnold
To clear some things:
Your explanation is ( don't get me wrong)  very  confusing and a way
how you explain not work for me.
If O2HEdit is created as folder in Oxygen Basic folder then O2HEdit.exe not
work properly on my computer.
If O2HEdit.zip is extracted directly into Oxygen Basic  folder then O2HEdit editor work fiine.  :)