User forums > Nightly builds

The 11 January 2006 build is out.

<< < (2/3) > >>

This is from yesterday:

--- Quote ---1. Launch Code::Blocks and load the default layout (I'm using the default default layout, nothing changed).
2. Drag the management window so it will undock.
3. Dock the management window again to its default place.
4. Minimize Code::Blocks.
5. When Code::Blocks is minimizing quickly press the Code::Blocks taskbar button. You have to hit it before Code::Blocks is fully minimized. If you did it right Code::Blocks will be unrestoreable from the taskbar by pressing the taskbar button (you can actually restore it by right clicking the taskbar icon with mouse and selecting Restore).

This unrestoreable state only happens if you move the docking windows around.

--- End quote ---

It was hard to reproduce it back then but no I can reproduce it every time with ease:

1. Open Code::Blocks and load the default layout (again I'm using the very default layout).
2. Drag and drop the Open files list so it will undock.
3. Dock it back to the default place.
4. Press the editor (or start page) so any docking windows does not get focus.
5. Minimize Code::Blocks using the taskbar button, not the minimize button!
6. Try to maximize Code::Blocks by clicking taskbar button. Code::Blocks won't maximize.

Can anybody confirm? :(


--- Quote from: artoj on January 12, 2006, 09:00:37 pm ---...
Can anybody confirm? :(

--- End quote ---

you are right, i confirm.


--- Quote ---Quote
1. Launch Code::Blocks and open project with some files.
2. Open two random files from the project.
3. Now try to open these files again in the project view. When clicking those files the tab right activates, but the application title bar shows only one file name and opened files list selection remains the same.

#1403642 App title bar / Open files list show wrong selected file
--- End quote ---

Okay flks, I have found the cause of the poblem and I have a solution (proposal). I did NOT specify it as a patch, because a second opinion is need from the devs. They might have a better solution for this.

Let's take as an example the Keybinder plug-in project.

What is the corect behaviour : In the project tree you double click on a file nod, and an aeditor should open up in the editors pane showing the contents of that file, AND !!! the title of the Cb window should say :
file.cpp [Project] - Code::Blocks v1.0

Now let's start our excursion. Open up the keybinder project, double click on cbkeybinder.cpp i nthe project tree. It opens up [see REMARK 1 (below)] and look at the title bar (yes, I know, but hold your breath, wait till REMARK 1). What happened behind the scenes : at a given moment we ended up at :
cbEditor* EditorManager::Open(const wxString& filename, int pos,ProjectFile* data) which in the case the file is not open yet in CB ends up in the following :
        ed = new cbEditor(m_pNotebook, fname, m_Theme);
This cbEditor constructor will call the Open function :
bool cbEditor::Open()
and this function will do the following at the end :
Thie Notify function loops over all plug-ins, and already the first plug-in it looked at result in a call to :
void MainFrame::DoUpdateAppTitle()
And this method sets the (new) title.
-- >So apart from the REMARK1 we made it.

Next double click keybinder.cpp in the project tree, and the story repeats.

Alrighty, time fo the instrumental break which instruments do you want u to break Cliff ... ).
Double click on cbkeybinder.cpp, the story 'nearly repeats' itself. Again we end up at :
cbEditor* EditorManager::Open(const wxString& filename, int pos,ProjectFile* data) which in the case the
BUT .... This time the opening tests ome to the conclusion that this 'to construct' cbEditor already exists, so no need to the new call --> woops, the rest of the story remains untold, no cookies,no drinks, no MainFrame::DoUpdateAppTitle() :-(

So my first experiments was to change :

--- Code: ---        if (eb->IsBuiltinEditor())
            ed = (cbEditor*)eb;

--- End code ---
into :

--- Code: ---        if (eb->IsBuiltinEditor())
            ed = (cbEditor*)eb;

--- End code ---
No luck : we notify a little bit to early,in the MainFrame::DoUpdateAppTitle() they ask for the active editor, but out reopend file did not receive the state of active editor yet. SO be patient, let's just signal that we want to update the plug-ins as follows :

--- Code: ---    bool bNotifyPlugIns = false;
    if (eb)
        if (eb->IsBuiltinEditor())
ed = (cbEditor*)eb;
bNotifyPlugIns = true;
            return 0; // is open but not a builtin editor

--- End code ---
And at the end of our EditorManager::Open(), when the reopened editor has achieved the active editor state, we check our flag and act accordingly :

--- Code: --- if(bNotifyPlugIns)
    // we 're done
    s_CanShutdown = true;

    return ed;

--- End code ---

With this adjustments ....... Problem fixed, and and and it shows in the title :
cbkeybinder.cpp [C::B KeyBinder] - Code::Blocks v1.0 :-) :-) :-) :-)

Well it is time for that remark :
Ater opening that cbkeybinder.cpp for the first time, you will notice that the project name i no shown, it only shows :
cbkeybinder.cpp - Code::Blocks v1.0   :-( :-(

Why ? Well I know why, didn't find a solution yet, Yiannis, this is where you come in ;-)
Look at this code (from MainFrame::DoUpdateAppTitle() ):

--- Code: --- EditorBase* ed = Manager::Get()->GetEditorManager() ? Manager::Get()->GetEditorManager()->GetActiveEditor() : 0L;
cbProject* prj = 0;
if(ed && ed->IsBuiltinEditor())
    ProjectFile* prjf = ((cbEditor*)ed)->GetProjectFile();
            prj = prjf->GetParentProject();
        prj = Manager::Get()->GetProjectManager() ? Manager::Get()->GetProjectManager()->GetActiveProject() : 0L;

--- End code ---
We have an active editor (ourfile), but it seems that the editor doe not have a projectfile associated to it yet -> so no parent project -> no project name. So that's the problem my dear Watson, elementary ...

How come it worked in our fixed 'reopen' path, well then the project file was associated. So it seems, we have something like this :
- open in editor
- notify plug-ins -> app title adjustements
- ...
- somewhere now the projectfile is associated
- ...

time to go back to the debugger ;-)

[EDIT] back from debugger : solution for the rmark 1 :
In EditorManager::Open() :
Change :

--- Code: ---        if(data)

--- End code ---
By :

--- Code: --- if(data)

--- End code ---

:-) :-) :-) :-)

PS : lot of Notifying ;-)

Thanks a lot for the insight Lieven (although I kinda of knew this stuff) ;)

There 's one fundamental flaw in your solution though: EVT_EDITOR_OPEN is supposed to fire only once, just when the editor opens. That's why you don't see it anywhere else.
The event you 're looking for is EVT_EDITOR_ACTIVATED. So the actual bug is that MainFrame doesn't hook to EVT_EDITOR_ACTIVATED and the following one liner is the fix.

In main.cpp event table, add:


that's why I did not make a patch out of it, because I did not like to tell something opens when it actually already open.
I knew you would have something better, hope the explanation was helpfull. ;-)

And how about the second part : attachement of projectfile ?


[0] Message Index

[#] Next page

[*] Previous page

Go to full version