Recent Posts

Pages: [1] 2 3 4 5 6 ... 10
1
@ christ

I've modified the code to use the scintilla editor hook rather than the CB editor modified event. It's working well.

I removed the RegisterEventSink() to your cbEVT_EDITOR_MODIFIED event and added code to simply emulate the event with a call to OnEditorModifiedEvent() when scintilla indicates a mod has been made(BrowseTracker.cpp:2724 see the line marked // (ph 25/09/17)) . Easy change.


Code
// ----------------------------------------------------------------------------
void BrowseTracker::OnEditorEventHook(cbEditor* pcbEditor, wxScintillaEvent& event)
// ----------------------------------------------------------------------------
{
    // Catch changes to the source and queue editor and line to update browse locations

    // **Debugging**
    //    wxString txt = _T("OnEditorModified(): ");
    //    int flags = event.GetModificationType();
    //    if (flags & wxSCI_MOD_CHANGEMARKER) txt << _T("wxSCI_MOD_CHANGEMARKER, ");
    //    if (flags & wxSCI_MOD_INSERTTEXT) txt   << _T("wxSCI_MOD_INSERTTEXT, ");
    //    if (flags & wxSCI_MOD_DELETETEXT) txt   << _T("wxSCI_MOD_DELETETEXT, ");
    //    if (flags & wxSCI_MOD_CHANGEFOLD) txt   << _T("wxSCI_MOD_CHANGEFOLD, ");
    //    if (flags & wxSCI_PERFORMED_USER) txt   << _T("wxSCI_PERFORMED_USER, ");
    //    if (flags & wxSCI_MOD_BEFOREINSERT) txt << _T("wxSCI_MOD_BEFOREINSERT, ");
    //    if (flags & wxSCI_MOD_BEFOREDELETE) txt << _T("wxSCI_MOD_BEFOREDELETE, ");
    //    if (flags == wxEVT_SCI_MODIFIED)    txt << _T("wxSCI_MODIFIED, ");
    //    if (flags == wxEVT_SCI_UPDATEUI)    txt << _T("wxEVT_SCI_UPDATEUI, ");
    //    txt << _T("EventFlags=")
    //        << wxString::Format(_T("%d"), flags)
    //        << _T(" pos=")
    //        << wxString::Format(_T("%d"), event.GetPosition())
    //        << _T(", line=")
    //        << wxString::Format(_T("%d"), event.GetLine())
    //        << _T(", linesAdded=")
    //        << wxString::Format(_T("%d"), event.GetLinesAdded());
    //    Manager::Get()->GetLogManager()->DebugLog(txt);
    //
    //    if      (event.GetEventType() == wxEVT_SCI_CHARADDED)
    //    {   Manager::Get()->GetLogManager()->DebugLog(_T("-- > OnEditorHook: wxEVT_SCI_CHARADDED")); }
    //    else if (event.GetEventType() == wxEVT_SCI_CHANGE)
    //    {   Manager::Get()->GetLogManager()->DebugLog(_T("-- > OnEditorHook: wxEVT_SCI_CHANGE")); }
    //    else if (event.GetEventType() == wxEVT_SCI_MODIFIED)
    //    {   Manager::Get()->GetLogManager()->DebugLog(_T("-- > OnEditorHook: wxEVT_SCI_MODIFIED")); }
    //    else if (event.GetEventType() == wxEVT_SCI_AUTOCOMP_SELECTION)
    //    {   Manager::Get()->GetLogManager()->DebugLog(_T("-- > OnEditorHook: wxEVT_SCI_AUTOCOMP_SELECTION")); }
    //    else if (event.GetEventType() == wxEVT_SCI_AUTOCOMP_CANCELLED)
    //    {   Manager::Get()->GetLogManager()->DebugLog(_T("-- > OnEditorHook: wxEVT_SCI_AUTOCOMP_CANCELLED")); }

    event.Skip();

    if (not IsBrowseMarksEnabled())
        return;

    cbStyledTextCtrl* control = pcbEditor->GetControl();
    if( m_bProjectIsLoading) return;

    if (event.GetEventType() != wxEVT_SCI_MODIFIED)
        return;

    // Record action in line only once
    if (control->GetCurrentLine() == m_EditorHookCurrentLine)
        return;

    //if ( event.GetEventType() != wxEVT_SCI_MODIFIED )
   // if ( event.GetEventType() == wxEVT_SCI_MODIFIED )
   if (event.GetEventType() == wxEVT_SCI_MODIFIED)
    {
        // Whenever event.GetLinesAdded() != 0, we must re-set BrowseMarks for lines greater
        // than LineFromPosition(event.GetPosition())
        int flags = event.GetModificationType();
        bool changed = false;
        changed |= flags & wxSCI_MOD_INSERTTEXT;
        changed |= flags & wxSCI_MOD_DELETETEXT;
        changed |= flags & wxSCI_PERFORMED_USER;
        changed |= (event.GetEventType() == wxEVT_SCI_CHARADDED);

        int linesAdded = event.GetLinesAdded();
        // **Debugging**
        //    if (linesAdded)
        //        Manager::Get()->GetLogManager()->DebugLog(wxString::Format("EditorHook Lines Added linesAdded:%d", linesAdded));

        if (changed or linesAdded)
        {
            #if defined(LOGGING)
            //LOGIT( _T("BT EditorEventHook isAdd[%d]isDel[%d]lines[%d]"), isAdd, isDel, linesAdded );
            #endif
            // rebuild BrowseMarks from scintilla marks
            m_EditorHookCurrentLine = control->GetCurrentLine();
            //RebuildBrowse_Marks( pcbEditor, isAdd );
            // Function to add an item to the map
            //std::lock_guard<std::mutex> lock(m_EditorHookmapMutex);  // Lock the mutex
            if (m_EditorHookmapMutex.try_lock())
            {
                // Mutex was successfully locked
                m_EditorHookFileLineMap.insert({pcbEditor, control->GetCurrentLine()});
                m_EditorHookmapMutex.unlock();
            } else {
                // Mutex is already locked, handle accordingly
                m_EditorHookCurrentLine = -1; //try again next later.
            }

            // Tell JumpTracker that this editor has been modified // (ph 25/09/17)
            if (m_pJumpTracker.get())
            {
                CodeBlocksEvent evt(cbEVT_EDITOR_MODIFIED);
                evt.SetEditor(pcbEditor);
                m_pJumpTracker->OnEditorModifiedEvent(evt);
            }

        }//endif changed
    }//endif wxEVT_SCI_MODIFIED

    // wxSCI_MOD_CHANGEMARKER is an extremely expensive call. It's called
    // for each line during a file load, and for every change to every
    // margin marker in the known cosmos. So here we allow a "one shot only"
    // to catch the marker changed by a margin context menu.
    // cf: CloneBookMarkFromEditor() and OnMarginContextMenu()
    //if ( event.GetEventType() == wxEVT_SCI_MODIFIED )
    if (event.GetEventType() == wxEVT_SCI_MODIFIED)
    do{
        if ( m_OnEditorEventHookIgnoreMarkerChanges )
            break;
        int flags = event.GetModificationType();
        if (flags & wxSCI_MOD_CHANGEMARKER )
        {
            m_OnEditorEventHookIgnoreMarkerChanges = true;
            int line = event.GetLine();
            #if defined(LOGGING)
            //LOGIT( _T("BT wxSCI_MOD_CHANGEMARKER line[%d]"), line );
            #endif
            CloneBookMarkFromEditor( line );
        }
    }while(false);

}//OnEditorEventHook

Your mod to BrowseTracker is a pleasing addition.
Will commit after using for some days.
2
Hi all,
I haven't used C::B for a while and surely my Ubuntu got a few updates meanwhile.

Now I'm experiencing the following: when typing code everything works fine until I use any non-alphanumeric key. Regardless of whether I press the cursor, backspace, or delete keys, alphanumeric (a...z & 0...9) keystrokes are no longer accepted until I press ctrl-s. After ctrl-s keys are accepted until next non-alphanumeric keystroke. Months ago everything worked absolutely fine.

I appreciate any helpful idea. Thanks in advance.

BR


Name                   : Code::Blocks
Version                : svn-r13046
SDK Version            : 2.23.0
Scintilla Version      : 3.7.5
Author                 : The Code::Blocks Team
E-mail                 : info@codeblocks.org
Website                : https://www.codeblocks.org
OS                     : Linux 6.14.0-29-generic x86_64
Desktop environment    : KDE
Scaling factor         : 3.000000
Detected scaling factor: 3.000000
Display PPI            : 288x288
Display count          : 1
Display 0              : XY=[0,0]; Size=[1707,960]; Primary

wxWidgets Library (wxGTK port)
Version 3.2.6 (Unicode: wchar_t, debug level: 1),
Runtime version of toolkit used is 3.24.
Compile-time GTK+ version is 3.24.43.
3
Thank you @Pecan

Yes, I can also reproduce that issue. I always save files, that might be the reason I didn't notice it before. Sorry about that.
4
@Christo

Unfortunately, this patch does not record the "last modified"
location in an editor.
It records the "first modified" in the editor and does not record any further mod locations for that editor until the modifed flag is cleared by a save.

This is because the event it is dependent upon (cbEVT_EDITOR_MODIFIED) is issued only on the first modification of an editor.

For example: Perform a mod in EditorA, then again in EditorB.
Go back to EditorA and make another mod.
If you click on "Jump to last modification" you'll end up in EditorB, not EditorA where the last mod was actually made because CB did not issue a second mod event for EditorA since the mod flag was already set.

I think this can be solved by depending on the editor hook instead of the CB event.

I'll look into it.
5
Development / Re: Mostly Successful Build CB 25 on GhostBSD 25
« Last post by stahta01 on September 14, 2025, 04:15:58 pm »
Code
--disable-pch
is an configure option

6
Development / Mostly Successful Build CB 25 on GhostBSD 25
« Last post by glen-the-grey on September 13, 2025, 09:56:24 pm »
OK so I had a day spare and a laptop spare which I've just installed GhostBSD 25 onto so thought I'd try and build Code::Blocks 25.03.  Specifically I have GhostBSD 25.02-R14.3p2 and while it does have Code::Blocks 20 available in its package repository I wanted something newer.

I didn't do a full build log but half-way through I thought I'd write some notes in case anyone else wanted to do this too.

Set up the build environment

Need to install the autotools and development tools (I wasn't sure exactly which packages so I just installed all the dev tools which is probably excessive).  Note that installing "gcc" will bring in GCC version 13 which will fail to compile because it complains about precompiled headers so I had to remove that and use "gcc15".  I think these are all the packages you will need from a fresh install (as root/sudo):
Code
pkg install autotools
pkg install -g 'GhostBSD*-dev'
pkg remove gcc13
pkg install gcc15

Now its necessary to build wx32-gtk from the Ports tree (I don't think the one available as a package has the config tool but maybe it does and this step is not necessary?)
Code
pkg install ports
cd /usr/ports/x11-toolkits/wxgtk32
sudo make
sudo make install

Finally add a symlink in /usr/local/bin so wx-config points to the right place:
Code
sudo ln -s /usr/local/bin/wxgtk3u-3.2-config /usr/local/bin/wx-config

That should be enough to get the build environment set up and now you can follow the build instructions (i.e., ./bootstrap then ./configure, etc.,) in the CB README, however, the build will fail because of an issue around fontconfig.h not being found and also because the linker can't find the correct location of the kvm libraries.  As far as I can tell this is because GhostBSD (perhaps also other BSDs) keep these in a slightly different location (i.e., /lib instead of /usr/lib for kvm).  I managed to get around these issues in a slightly kludgy way but it did work.

fontconfig.h
I found out after I'd done this that there is a post about this on the forum which is probably a better solution and it would probably be better to modify the Makefile include path, however, I was impatient to carry on building so I simply changed the source file in:

src/plugins/contrib/source_exporter/wxPdfDocument/src/pdffontmanager.cpp

so that the included file was the full path: "/usr/local/include/fontconfig/fontconfig.h"

kvm
I get an error from the linker when building clangd_client so I changed the Makefile in:

src/plugins/contrib/clangd_client so that WX_LIBS has the flags "-L/lib -lkvm":

Code
WX_LIBS = -L/lib -lkvm -L/usr/local/lib ....etc...

And doing all that got me a mostly working build of Code::Blocks...at least as far as I can tell it works, I haven't done any in-depth testing yet but will do that soon.  I say "mostly" working because a couple of the toolbars appear to have missing icons (also in GhostBSD which is using MATE changing the toolbar icon size doesn't actually change the size of the buttons, just the size of the graphics within the buttons).

I'll attach a screenshot if anyone has any suggestions as to where the icons have gone?
7
Nightly builds / The 13 September 2025 build (13733) is out.
« Last post by killerbot on September 13, 2025, 07:13:28 pm »
We switched to gcc 15.1.0 (on 23 May 2025) --> download the new wx/mingw dll's see link below

Get the compiler we use here : https://github.com/brechtsanders/winlibs_mingw/releases/download/15.1.0posix-12.0.0-ucrt-r1/winlibs-x86_64-posix-seh-gcc-15.1.0-mingw-w64ucrt-12.0.0-r1.7z

Get quick announcements through the RSS feed http://www.codeblocks.org/nightly/CodeBlock_RSS.xml

Before you use a nightly make sure you understand how it works.

A link to the unicode windows wxWidget dll(s) for Code::Blocks : https://sourceforge.net/projects/codeblocks/files/Binaries/Nightlies/Prerequisites/wxmsw32u_gcc_cb_wx328_2D_gcc1510-mingw64.7z
A link to Mingw64 dll's needed by Code::Blocks : http://sourceforge.net/projects/codeblocks/files/Binaries/Nightlies/Prerequisites/Mingw64dlls15.1.0.7z


The 13 September 2025 build is out.
  - Windows :
   http://sourceforge.net/projects/codeblocks/files/Binaries/Nightlies/2025/CB_20250913_rev13733_win64.7z
  - Linux :
   none

The current SDK version is : 2.25.0

Resolved Fixed:

  • CodeCompletion: Remove assertion in wxDir when the filename has no path (ticket #1544)
  • IncrementalSearch: Fix search bar resetting on Mac (ticket #1547, thanks Federico Perini).
  • applied patch #1549 by Christo: change visual state of file only if it is not controlled by vcs
  • applied patch #1548: update zlib 1.2.8 -> 1.3.1 by Federico Perini
  • updated two references of bzlib2 to Gitlab version (applied to help- and SpellChecker-plugin) and adopted C::B comments
  • adjust silent installer of release to validate against checks from MS App Store: Remove splash screen in silent install
  • ClangdClient: Apply patches 1551 and 1552 (Thanks Christo)
  • BrowseTracker: Add missing editor activations to jump tracker array
  • applied patch #1550: Bootstrap: C::B requires automake 1.13 or newer (by Carlo Bramini)
  • partially apply patch #1546 Fix crashes when building/running C::B on macOS-arm + clang++ (layout saving), by Federico Perini
  • applied patch #1545 Patch: enable GCC to parse Fortran warnings by Federico Perini
  • compilation fix for non-PCH compilers
  • provide convenience function to fix bug #1534: Running compiled program fails because of wrong PATH

Regressions/Confirmed/Annoying/Common bugs:


    8
    Hi Pecan, attaching modified files w.r.t svn revision 13733

    Really nice mod. Thanks, I'll test it for a couple of day, then commit.
    9
    Hi Pecan, attaching modified files w.r.t svn revision 13733
    10
    Hi Pecan, you can download it as a patch by adding .patch after commit hash.

    https://github.com/josephch/codeblocks/commit/029005671abfeb6d7c3c07390030605448a09dff.patch

    If this is not sufficient, I'll attach a proper patch later after work.

    Thanks

    Thanks. That looks like I can use that for cut and paste. I appreciate it.
    Pages: [1] 2 3 4 5 6 ... 10