Bcx EDitor (BED)

Started by MrBcx, December 14, 2020, 07:46:53 PM

Previous topic - Next topic

jcfuller

Thank you Robert. Works as advertised
James

Robert

Quote from: jcfuller on November 20, 2025, 07:36:16 AMHow to build using the default msvc folders which have spaces?
James


Hi James:

The following works for me. In Bed\Bat\UCRT\config64.bat

@SET "MSVCFolder=C:\Program Files\Microsoft Visual Studio\18\Insiders\VC\Tools\MSVC\14.50.35717\bin\Hostx64\x64"

CALL "C:\Program Files\Microsoft Visual Studio\18\Insiders\VC\Auxiliary\Build\vcvars64.bat"

Note well: In the @SET statement, the initial quotation mark encloses the MSVCFolder variable with the assigned value.

jcfuller

How to build using the default msvc folders which have spaces?
James

MrBcx

BED_371.zip has been refreshed.  Specifically, only the \Bed\Bat\ folder has been updated.

https://bcxbasiccoders.com/smf/index.php?topic=420.0

Some of the batch files had hard-coded paths to the BCX Translator which is
probably not the same on your computers.  Hopefully, this will stabilize the
batch files for a while.  My apologies for any inconvenience this may have caused.   

 

MrBcx

#26
A brief announcement and a BED Update Version 3.71 zip file have been added to the top post.

https://bcxbasiccoders.com/smf/index.php?topic=420.0

MrBcx

A brief announcement and a 1.4MB BED Version 3.70 zip file have been added to the top post.

https://bcxbasiccoders.com/smf/index.php?topic=420.0



MrBcx

BED version 3.65 has been uploaded.

Find it at the usual link:  https://bcxbasiccoders.com/smf/index.php?topic=420.0

* Small improvements to the BUILD dialog box user interface

* Added new BCX commands and functions to the syntax highlighter

* More additions to the Win32 syntax file


* * Existing users only need to overwrite Bed.exe and the \Syntax\ folder.

MrBcx

BED version 3.62 has been uploaded.

Find it at the usual link:  https://bcxbasiccoders.com/smf/index.php?topic=420.0

' Added ALT-DownArrow and ALT-UpArrow for shifting focus between
' the current editor window and the OUTPUT window. 
' ALT-DownArrow will open the OUTPUT window, if it is closed.

' Added focus handling code to the main Event Loop

' More additions to the Win32 syntax file

airr

I did this a bit differently.

I added a new file, Sci_Custom_Shortcuts.inc (for future stuff) which contains:


FUNCTION NewSciProc(hwnd as HWND, msg as UINT, wParam as WPARAM, lParam as LPARAM, uIdSubclass as UINT_PTR, dwRefData as DWORD_PTR) as LRESULT STDCALL
    SELECT CASE msg
        CASE WM_KEYDOWN
            IF (GetKeyState(VK_CONTROL) AND &H8000) <> 0 THEN
                IF wParam = VK_OEM_2 THEN
                    ToggleComment()
                    RETURN 0
                END IF
            END IF
    END SELECT
    RETURN DefSubclassProc(hwnd, msg, wParam, lParam)
END FUNCTION


In Sets_Types.inc, I added this to the KeyTable ACCEL:


FCONTROL|FVIRTKEY       , VK_OEM_2, IDM_TOGGLE_COMMENT  ' Toggle Comments CTRL-/


In Sci_Enums.inc, I added the IDM_TOGGLE_COMMENT:


    IDM_COMMENT                       ' Block comment
    IDM_UNCOMMENT                     ' Block uncomment
    IDM_TOGGLE_COMMENT                ' Toggle Block comment




Finally, in Scintilla_Support.inc, between "pSciWinData" and "g_SciLexer" I added:


SetWindowSubclass(ScihWnd, NewSciProc, 0, 0)


And the ToggleComment() function:


SUB ToggleComment()
    DIM RAW i
    DIM RAW curpos
    DIM RAW Line$
    DIM RAW lch
    DIM RAW selStartPos = SCICMD (SCI_GETSELECTIONSTART, 0, 0)
    DIM RAW selEndPos   = SCICMD (SCI_GETSELECTIONEND, 0, 0)-1
    DIM RAW selStartLine = SCICMD (SCI_LINEFROMPOSITION, selStartPos, 0)
    DIM RAW selEndLine   = SCICMD (SCI_LINEFROMPOSITION, selEndPos, 0)
    DIM RAW allCommented = 1
    DIM RAW lineStartPos
    DIM RAW lineLength
    DIM RAW buffer$

    SCICMD (SCI_BEGINUNDOACTION, 0, 0)

    ' Check if all lines are commented
    FOR i = selStartLine TO selEndLine
        CLEAR (Line$)
        SCICMD (SCI_GETLINE, i, Line$)
        lch = *LTRIM$(Line$)
        IF lch THEN
            IF LEFT$(LTRIM$(Line$), 1) <> "'" THEN
                allCommented = 0
                EXIT FOR
            END IF
        END IF
    NEXT i

    ' Toggle comments
    FOR i = selStartLine TO selEndLine
        CLEAR (Line$)
        SCICMD (SCI_GETLINE, i, Line$)
        lch = *LTRIM$(Line$)
        IF lch THEN
            curpos = SCICMD (SCI_POSITIONFROMLINE, i, 0)
            IF allCommented THEN
                ' Uncomment the line
                IF LEFT$(LTRIM$(Line$), 1) = "'" THEN
                    lineStartPos = SCICMD (SCI_POSITIONFROMLINE, i, 0)
                    buffer$ = LTRIM$(Line$)
                    lineLength = LEN(buffer$)
                    buffer$ = MID$(buffer$, 2, lineLength - 1)
                    SCICMD (SCI_SETTARGETSTART, lineStartPos + (INSTR(Line$, "'") - 1), 0)
                    SCICMD (SCI_SETTARGETEND, lineStartPos + INSTR(Line$, "'"), 0)
                    SCICMD (SCI_REPLACETARGET, -1, "")
                END IF
            ELSE
                ' Comment the line
                SCICMD (SCI_INSERTTEXT, curpos, "'")
            END IF
        END IF
    NEXT i

    SCICMD (SCI_ENDUNDOACTION, 0, 0)
END SUB



Different way, same result?

AIR.

Robert


GUI "GetKey"

SUB FORMLOAD
  GLOBAL Form1 AS HWND
  Form1 = BCX_FORM("GetKey", 0, 0, 110, 110)
  BCX_SET_FORM_COLOR(Form1,QBCOLOR(31))
  CENTER(Form1)
  SHOW(Form1)
END SUB

BEGIN EVENTS
  SELECT CASE CBMSG
  CASE WM_GETDLGCODE
    FUNCTION=DLGC_WANTALLKEYS
  CASE WM_KEYDOWN
    IF ((wParam BAND VK_CONTROL) AND (wParam BAND 0xBF)) THEN
      MSGBOX "Beware The Slash !"
    END IF
    SELECT CASE wParam
    CASE VK_CONTROL
      IF (wParam BAND 0xBF) THEN
        MSGBOX "Control The Slash !"
      END IF
    END SELECT
  END SELECT
END EVENTS


MrBcx

#20
Armando, et al

This subclass proc is working now and should give you the springboard you were looking for.

My original code has been update:  https://bcxbasiccoders.com/smf/index.php?topic=420.msg5601#msg5601


CALLBACK FUNCTION NewSciProc
    SELECT CASE CBMSG

    CASE WM_KEYDOWN
        IF CBWPARAM = VK_CONTROL THEN
            ctrlPressed = TRUE
        END IF
        IF ctrlPressed AND CBWPARAM = VK_OEM_2  THEN    ' VK_OEM_2 is the / key
            toggleState = NOT toggleState
            ToggleAction(CBHWND)
            FUNCTION = 0
        END IF

    CASE WM_KEYUP
        IF CBWPARAM = VK_CONTROL THEN
            ctrlPressed = FALSE
        END IF
        IF ctrlPressed AND CBWPARAM = VK_OEM_2 THEN     ' VK_OEM_2 is the / key
            toggleState = NOT toggleState
            ToggleAction(CBHWND)
            FUNCTION = 0
        END IF

    END SELECT

    FUNCTION = CallWindowProc(oldSciProc, CBHWND, CBMSG, CBWPARAM, CBLPARAM)
END FUNCTION



It will popup the MSGBOX's but you need to click back into the editor window to
give the window focus after you close the MSGBOX.  Of course when you implement
your comments on/off toggle, focus should not change.




airr

#19
Kevin, I have a question.

I've implemented a function that toggles comments.  It works well from the menu (so far),
but even though I set up an Accelerator for it, the key sequence doesn't work.

I'm trying to use CTRL-/ (what VSCode uses, so muscle memory is at work here!) but it
seems that the Scintilla control uses that.

Would you happen to know how to over-ride the Scintilla built-in shortcuts?

Thanks!

Armando (aka AIR).

MrBcx

I uploaded a new BED.zip (3.59)

I added code that automatically sets a black cursor on any light colored background and vice-versa.

The latest 64-bit Bcx Editor (BED.zip) can always be found here:  https://bcxbasiccoders.com/smf/index.php?topic=420.0

BED USERS only need to overwrite their existing Bed.exe with the revised Bed.exe found in this archive.


Thanks to George Deluca for prompting me to provide this small but important revision.


MrBcx

BED version 3.57 has been uploaded.

Find it at the usual link:  https://bcxbasiccoders.com/smf/index.php?topic=420.0

' Replaced the Snippets Navigation Menu with a much better version
' Added "Run App" F4 to "Build and Run" on main menu
' Added MENUCOLOR macro for easily changing -all- menus BG color
' Did a little work on BCX function tips file in \Syntax\
' Ongoing additions / revisions of keywords and syntax files

MrBcx

BED version 3.54 has been uploaded. 

Find it at the usual link:  https://bcxbasiccoders.com/smf/index.php?topic=420.0

Several important bug fixes.  If you use BED, you will want this new executable.


' Scintilla will now always convert TABS to SPACES (TAB = 4 spaces)
' Corrected app closing behaviors for IDYES, IDNO, IDCANCEL
' Added and updated several keywords
' Restored Accelerators - thanks to Johan Klassen for reporting bug
' Fixed bug in SUB ChangeDocTab -- was goofing up BUILD process
' when multiple tabs were loaded.  bcxout.txt was being created in
' the wrong folder location.  Seems to be working correctly now.