News:

As usual while waiting for the next release - don't forget to check the nightly builds in the forum.

Main Menu

Does Code::Blocks support multiple monitor editing?

Started by ollydbg, October 06, 2022, 12:17:39 PM

Previous topic - Next topic

ollydbg

I see some old thread here: multi-monitor editing

But is it possible currently.

Maybe, we can drag the wxAuiNotebook to another monitor?
Or a floating editor window in another monitor?
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Miguel Gimenez

The main editor window seems to be anchored, but other windows (Management, Open Files List, Watches or Logs & others) can be moved to other monitor. I have not tried to save their positions, though.

ollydbg

#2
Quote from: Miguel Gimenez on October 06, 2022, 12:41:45 PM
The main editor window seems to be anchored, but other windows (Management, Open Files List, Watches or Logs & others) can be moved to other monitor. I have not tried to save their positions, though.

Yes, the editor window(I guess it is wxAuiNotebook) is docked, and can't be floated. But even it can be floated, can we make two floated? We have add a new floating wxAuiNotebook window?

I'm going to check whether wx samples.

EDIT

I just checked the wxAui sample project.
In its menu: View->Notebook, a new floating notebook is created, I can maximize the new notebook in the second monitor, and I can drag the editor(panel) between the old and new wxNotebook.

EDIT2

I added the wxAui sample application screen shot.

The code in aui sample looks like simple:


void MyFrame::OnCreateNotebook(wxCommandEvent& WXUNUSED(event))
{
    m_mgr.AddPane(CreateNotebook(), wxAuiPaneInfo().
                  Caption("Notebook").
                  Float().FloatingPosition(GetStartPosition()).
                  //FloatingSize(FromDIP(wxSize(300,200))).
                  CloseButton(true).MaximizeButton(true));
    m_mgr.Update();
}

If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

ollydbg

#3
In the function: void MainFrame::CreateIDE()

There are some code snippets like:


    // editor manager
    m_LayoutManager.AddPane(m_pEdMan->GetNotebook(), wxAuiPaneInfo().Name("MainPane").
                            CentrePane());


So, this is the CentrePane, I think we can't make it float.

Edit:
It is a bit complex to construct the cbAuiNotebook, see the code below:

EditorManager::EditorManager()
        : m_pNotebook(nullptr),
        m_pNotebookStackHead(new cbNotebookStack),
        m_pNotebookStackTail(m_pNotebookStackHead),
        m_nNotebookStackSize(0),
        m_isCheckingForExternallyModifiedFiles(false)
{
    m_pData = new EditorManagerInternalData(this);

    m_pNotebook = new cbAuiNotebook(Manager::Get()->GetAppWindow(), ID_NBEditorManager, wxDefaultPosition, wxDefaultSize,
                                    wxAUI_NB_DEFAULT_STYLE | wxAUI_NB_WINDOWLIST_BUTTON | wxNO_FULL_REPAINT_ON_RESIZE | wxCLIP_CHILDREN);
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

ollydbg

I'm still thinking this feature, I'm not sure how you edit the code, but nowadays, I do have more time to have multiple monitors.

So, is there any way that I can "float" an CbEditor window? Or I can "float" a wxAuiNotebook(cbAuiNotebook) window?

With this way, I can view code on my two monitors.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

ollydbg

I did some hack on this issue.

The idea is to create a new cbAuiNotebook control, which can be "float" or docked. The original notebook is centered. I have to "Menu-View->Perspective->Delete current" to see the new added notebook window.

Here is the result screen shot and the patch file.

The issue here are:

I see that cbAuiNotebook can't be focused?

I mean when loading a file to a new editor, I would like to put the new editor to the "active cbAuiNotebook", but it just failed. So, I just toggle a "bool" variable, so half of the files were added to the original cbAuiNotebook, and the other files were added to another notebook.

Another issue is that I have enabled the option "wxAUI_NB_TAB_EXTERNAL_MOVE". When I am using the wxAui sample code, I see that editors can be dragged from one Notebook to another. But in my changes, I see can't see I can drag editors from one to another.

There are still many other things to handle, but I see this could be a simple hack and start.

Any ideas?

Thanks.

If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

ollydbg

This is some improved patch v2, the new cbAuiNotebook has a default "start page". I can drag the editors between the two notebook now.

But there are other issues, such as when a project get closed, C::B will hang. Because there are two many code which is handling the first(default) cbAuiNotebook.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

ollydbg

#7
This is the v3 patch.

It can load a project and close a project without crash, and I can drag the source file from one notebook to another.

Our "Start here" page is a very special editor we must handle it carefully. I try to fix some crashed here and there.

The remaining issue is that some plugins such as the CodeCompletion's toolbar does not work well(disabled) when I drag a file from the first notebook to the second notebook.

Another issue is that I can't drag a file to an empty notebook, see my bug report here: I can not drag a panel to an empty wxAuiNotebook from another wxAuiNotebook


EDIT


EditorBase* EditorManager::GetActiveEditor()
{
    // find which is the active cbAuiNotebook

    cbAuiNotebook* activeNotebook = m_pNotebook;
//    if (m_pNotebook2->IsActive())
//    {
//        activeNotebook = m_pNotebook2;
//    }
//    else
//    {
//        activeNotebook = m_pNotebook;
//    }

    // @fixme how can we determine which notebook is active?


    if (activeNotebook->GetPageCount() > 0)
    {
        return InternalGetEditorBase(activeNotebook, activeNotebook->GetSelection());
    }
    return nullptr;
}


The issue is that I don't know which is the "active" notebook. Any idea on how to solve this issue?

If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

ollydbg

v4 version, I can get the "active editor" correctly.

Quote
The remaining issue is that some plugins such as the CodeCompletion's toolbar does not work well(disabled) when I drag a file from the first notebook to the second notebook.

This issue is solved.  :)
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

omlk

Quote from: ollydbg on December 09, 2023, 05:34:32 AM
v4 version, I can get the "active editor" correctly.

Quote
The remaining issue is that some plugins such as the CodeCompletion's toolbar does not work well(disabled) when I drag a file from the first notebook to the second notebook.

This issue is solved.  :)
Are you intrigued as to how to implement synchronization between two cbAuiNotebook's so that files of the same project, opened or moved between two cbAuiNotebook`s, are parsed and compiled?

ollydbg

Quote from: omlk on December 09, 2023, 05:42:34 AM
Quote from: ollydbg on December 09, 2023, 05:34:32 AM
v4 version, I can get the "active editor" correctly.

Quote
The remaining issue is that some plugins such as the CodeCompletion's toolbar does not work well(disabled) when I drag a file from the first notebook to the second notebook.

This issue is solved.  :)
Are you intrigued as to how to implement synchronization between two cbAuiNotebook's so that files of the same project, opened or moved between two cbAuiNotebook`s, are parsed and compiled?

I think by design, only one file can be opened in the first notebook, you can drag the file to the second notebook.

But you can't open a file twice in those notebooks.

So, I never consider it has the synchronization issue.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Wkerry

ollydbg, I suspect you are responding to a help vampire as the posts from the poster do not make allot of sense and do not seem to written by a real person.

ollydbg

Quote from: Wkerry on December 09, 2023, 09:44:34 AM
ollydbg, I suspect you are responding to a help vampire as the posts from the poster do not make allot of sense and do not seem to written by a real person.

Thanks, may be.

Nowadays, it is really hard to distinguish whether the words is from AI or from a real person.  :)
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.