Author Topic: Does Code::Blocks support multiple monitor editing?  (Read 3550 times)

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Does Code::Blocks support multiple monitor editing?
« on: October 06, 2022, 12:17:39 pm »
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.

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1553
Re: Does Code::Blocks support multiple monitor editing?
« Reply #1 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.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Does Code::Blocks support multiple monitor editing?
« Reply #2 on: October 06, 2022, 12:58:55 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:

Code
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();
}
« Last Edit: October 06, 2022, 03:15:54 pm by ollydbg »
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.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Does Code::Blocks support multiple monitor editing?
« Reply #3 on: October 06, 2022, 03:01:32 pm »
In the function: void MainFrame::CreateIDE()

There are some code snippets like:

Code
    // 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:

Code
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);
« Last Edit: October 06, 2022, 03:07:39 pm by ollydbg »
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.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Does Code::Blocks support multiple monitor editing?
« Reply #4 on: December 02, 2023, 03:06:38 am »
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.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Does Code::Blocks support multiple monitor editing?
« Reply #5 on: December 02, 2023, 09:02:23 am »
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.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Does Code::Blocks support multiple monitor editing?
« Reply #6 on: December 02, 2023, 02:17:13 pm »
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.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Does Code::Blocks support multiple monitor editing?
« Reply #7 on: December 08, 2023, 03:37:20 pm »
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

Code
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?

« Last Edit: December 08, 2023, 03:51:31 pm by ollydbg »
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.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Does Code::Blocks support multiple monitor editing?
« Reply #8 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.  :)
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.

Offline omlk

  • Multiple posting newcomer
  • *
  • Posts: 110
Re: Does Code::Blocks support multiple monitor editing?
« Reply #9 on: December 09, 2023, 05:42:34 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?
« Last Edit: December 09, 2023, 05:45:00 am by omlk »

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Does Code::Blocks support multiple monitor editing?
« Reply #10 on: December 09, 2023, 07:46:12 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.

Offline Wkerry

  • Multiple posting newcomer
  • *
  • Posts: 42
Re: Does Code::Blocks support multiple monitor editing?
« Reply #11 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.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Does Code::Blocks support multiple monitor editing?
« Reply #12 on: December 09, 2023, 09:55:04 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.