PB interface for CodeMax Code Editor Control.

Working on new editor enhancements?
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Eikeland.

Hi,
While I wait for a new version of BP for Linux, did I familiar my self more with the Windows Version.
In earlier projects (VB and VB.NET) have I used a modified version CodeSence of the CodeMax Control its a powerfull control with ton's of functionalities.
The free CodeMax is released in two version a ActiveX version and a native DLL version.
I have now tried my best to trancelate the C++ declaration to Purebasic (the native dll version).
Please note that this is my first try to "play" with the API and pointers, so please do expect bugs! :)
you can download the "kit" here: http://www.badazcorvettes.com/pb/codemax_pb.zip

Please let me know how you like it and keep me updated if you find/fix bugs.

Enjoy
Richard
Here is a copy from the readme file:

Revision 1 - March 23, 2003
Interface and translationfor
CodeMax (CodeSence) Control 2.x Native DLL Version
Written in PureBasic 3.61 - http://www.purebasic.com

CodeMax is a free powerful Win32-based custom control that allows
developers To add code editing And syntax highlighting
capabilities To their applications quickly And easily.
For detailed and license CodeMax information see http://groups.yahoo.com/group/codemax/

CodeSense is a free "branch" of the original CodeMax development
that adds IntelliSense-style support to the CodeMax control.
It is a separate product.
For detailed and license CodeSence information, see: http://www.ticz.com/homes/users/nlewis/

This PureBasic "translation" is written against the CodeSense Version Spec.
This version use the C++ Syntax (The Native DLL Version)
PureBasic Translation by Richard Eikeland [url]mailto:richard_eikeland@msn.com">richard_eikeland@msn.com
UserID 'eikeland' on the <a href="http://forums.purebasic.com[/url]

Note: This is the first release of this kit,I have NOT tested all functionalities in this kit,
so please use it carefull and check especialy all pointer declarations And Hex values.
The kit is transelated from the CodeSence.h File.


To use this "kit" you will need the following files:

1. CodeCense Dll Control File version 2.2x 'cmcs21.dll'
The DLL should be stored in your '\%WinDir%\%SYSDIR%' Folder.

2. PureBasic Library File 'CMCS21"
This file should be stored in the folder: '%PureBasic Program Folder%\PureLibraries\Windows\'

3. PureBasic Library File 'cmcs21.lib"
This file should be stored in the folder: '%PureBasic Program Folder%\PureLibraries\Windows\Libraries\'


This kit use a PureBasic Imported library for the Exported Functions (Procedures) in the CodeMax\CodeSence dll file.

The Exported Functions is:
Generic Return Codes 'Result (LONG)' = #CME_SUCCESS, #CME_FAILURE, #CME_BADARGUMENT

CMRegisterControl_(Long dwVersion ) return Result
CMUnregisterControl_() return Result
CMSetFindReplaceMRUList_(String pszMRUList, Long bFind) return void (nothing)
CMGetFindReplaceMRUList_(String pszMRUList, Long bFind) return void (nothing)
CMRegisterLanguage_(String pszName, CM_LANGUAGE *pLang) return Result
CMUnregisterLanguage_(String pszName) return Result
CMGetHotKeys_(Byte pBuff) return LONG
CMSetHotKeys_(Byte pBuff) return Result
CMResetDefaultHotKeys_() return void (nothing)
CMGetHotKeysForCmd_(Word wCmd, CM_HOTKEY *pHotKeys) return Long
CMRegisterHotKey_(CM_HOTKEY *pHotKey, Word wCmd) return Result
CMUnregisterHotKey_(CM_HOTKEY *pHotKey) retrun Result
CMGetCommandString_(Word wCmd, Long bDescription, String pszBuff, Long nBuffLen) return void (nothing)
CMGetMacro_(Long nMacro, Byte pMacroBuff) return Long
CMSetMacro_(Long nMacro, Byte pMacroBuff) return Long
CMUnregisterAllLanguages_() return Result
CMGetLanguageDef_(String pszName, CM_LANGUAGE *pLang) return Long
CMRegisterCommand_(Word wCmd, String pszName, String pszDesc) return Result
CMUnregisterCommand_(Word wCmd) return Result

+131 SendMessage Driven Functions, they are all declared in the "CodeMax_Procedures.pb)
All CodeMax EventHandlers is declared in the "CodeMax_EventHandler.pb"
All CodeMax Declarations is Declared in the "CodeMax_Declaration.pb"
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Eikeland.

Update:
Hi, I discovered..em to many bugs
All Variables in the following structures need's to be declared with a pointer(*):
CM_LANGUAGE
CM_POSITION
CM_RANGE

I'm sure it's more there, it would be nice if some of you API guru's could take a look at it (Compare against CodeSence.h and the included CodeMax\CodeSence doc.

I will post a more detailed example tomorow included a customized language (PB of course)

Richard
Post Reply