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

0 Members and 1 Guest are viewing this topic.

Arnold

  • Hero Member
  • *****
  • Posts: 977
Re: A little brother of OxIde
« Reply #90 on: December 20, 2019, 10:31:19 am »
Hi Zlatko,

I have not touched the code in a while, it will not compile with the latest version of O2. From today's perspective, I have to admit that it is faulty and that I would start it differently from scratch. But it was just a learning exercise, and there are many good editors that work very well with Oxygenbasic.

Attached is a zip file with the (outdated) project and a 32-bit exe. The zip file  should be unzipped in a separate folder. The O2HEdit.cfg will look like this:

Code: Text
  1. $o2dir [c:\oxygenbasic]
  2. $compiler [c:\oxygenbasic\co2.exe]
  3. $scilexer [c:\oxygenbasic\SciLexer.dll]
  4. $reslinker [c:\oxygenbasic\tools\Linkres2exe.exe]
  5. $rccompiler [c:\oxygenbasic\tools\GoRc.exe]
  6. $reseditor [Resed.exe]
  7. $editor [Wordpad]
  8. $oxyhlp [c:\oxygenbasic\inf\oxygen_help.chm]
  9. $winapihlp [c:\oxygenbasic\inf\Win32.chm]
  10. $dir [c:\oxygenbasic\examples]
  11. $tabspaces [4]
  12. $font [Lucida Console]
  13. $fontsize [14]
  14. $ln_style_bold [0]
  15. $ln_style_italic [0]
  16. $clrscheme [1]
  17.  

Using an editor like notepad / wordpad / oxide all c:\oxygenbasic must be substituted with the correct path of oxygenbasic. Then O2Hedit.exe should start correctly.

As already stated, I consider this code buggy. But at the moment I will not continue / restart this project.

Roland

Aurel

  • Guest
Re: A little brother of OxIde
« Reply #91 on: December 20, 2019, 02:51:53 pm »
Hi Arnold
thanks for files but i was asking you about how to save config file
like a set of strings?

Arnold

  • Hero Member
  • *****
  • Posts: 977
Re: A little brother of OxIde
« Reply #92 on: December 21, 2019, 04:07:54 am »
The sub saveconfig() is located in O2HeditUtils.inc. The string s_cfg is intended to keep a string separated by carriage returns (cr). s_cfg is also used in sub loadConfig() which loads (not quite correctly) O2HEdit.cfg. The Environment Settings for the individual options are done in O2HEdit.inc in sub environment() and function environDlg().

However, the newer versions of Oxygen use #autodim off by default (which is less prone to errors) and include more utility functions in the O2 include files. Therefore, the entire files of the project should be revised.

Aurel

  • Guest
Re: A little brother of OxIde
« Reply #93 on: December 21, 2019, 07:45:22 am »
The sub saveconfig() is located in O2HeditUtils.inc.

-Thanks,i am looking but without your help and cannot figure where is it

sub loadConfig() which loads (not quite correctly)

- hmmm i will see why not because should do that
probably some string quirks
I have in editor separate window so I will test it outside of editor program.


For my editor i still use old 043 version
even i am not very happy with some things this version work for me.
I will download latest to see how respond on some old code...
« Last Edit: December 21, 2019, 07:56:14 am by Aurel »

Charles Pegge

  • Admin Support Member
  • *****
  • Posts: 4486
    • Oxygen Basic
Re: A little brother of OxIde
« Reply #94 on: December 21, 2019, 11:29:12 am »
Data strings combined. Very simple to save:

Code: [Select]
     s_cfg= "$o2dir [" & o2dir & "]" & cr &
        "$compiler [" & compiler & "]" & cr &
        "$scilexer [" & SciLib & "]" & cr &
        "$reslinker [" & ResLinker & "]" & cr &
        "$rccompiler [" & RcCompiler & "]" & cr &
        "$reseditor [" & ResEditor & "]" & cr &
        "$editor [" &  extEditor & "]" & cr &
        "$oxyhlp [" & OxyHelp & "]" & cr &
        "$winapihlp [" & WinapiHelp & "]" & cr &
        "$dir [" & dir & "]" & cr &
        "$tabspaces [" & tabspaces & "]" & cr &
        "$font [" & fnt & "]" & cr &
        "$fontsize [" & fnz & "]" & cr &
        "$ln_style_bold [" & LN_style_bold & "]" & cr &
        "$ln_style_italic [" & LN_style_italic & "]" & cr &
        "$clrscheme [" & scheme & "]" & cr

     putfile configdir  & "\O2HEdit.cfg", s_cfg     
     SetCurrentDirectory appdir
     mbox "O2HEdit.cfg saved"

Aurel

  • Guest
Re: A little brother of OxIde
« Reply #95 on: December 21, 2019, 12:09:06 pm »
Hi Charles
and thanks for code ...
my way would be little bit different, at first i will test how things work
then i will create simple string array and put in each element one of items
like :

~theme
~compiler
~etc
~etc

then i will  parse each item into array
so for now i will stay with theme and compiler path
so i tested this and work..  :)

Code: [Select]
SUB SaveConfig

string sConfig , dest
char   cdBuff[256]
GetCurrentDir 256, strptr cdBuff
print cdBuff   'show current folder
sConfig = "~theme " + "[" + str(theme) + "]"   ' res ->  ~theme[1]

   dest = cdBuff + "\AurelEditConf.cfg"
   putfile dest, sConfig


END SUB

Aurel

  • Guest
Re: A little brother of OxIde
« Reply #96 on: December 22, 2019, 11:48:27 am »
Hi
So far it looks that work OK
OK now i will test extractData() routine..

Code: [Select]
SUB LoadConfig

string sConfig , dest
char   cdBuff[256]
GetCurrentDir 256, strptr cdBuff
'print cdBuff   'show current folder
'sConfig = "~theme" + "[" + str(theme) + "]"   ' res ->  ~theme[1]

   dest = cdBuff + "\AurelEditConf.cfg"
's_cfg = getfile configdir & "\O2HEdit.cfg"
   'if s_cfg then
    ' o2dir=extractData s_cfg, "$o2dir "
    ' compiler=extractData s_cfg, "$compiler "
sConfig = getfile dest
IF sConfig = ""
   MsgBox "Configuration file is EMPTY" + crlf +
          "create new file by opening Option Window!" , "AurelEdit::INFO"
   Return
ELSE
   MsgBox "Configuration file Exists" + crlf + sConfig + crlf +
          "OK!" , "AurelEdit::INFO"
END IF


END SUB