Developer forums (C::B DEVELOPMENT STRICTLY!) > Plugins development

ToDo plugin patch doing some refactoring

<< < (5/6) > >>

MortenMacFly:

--- Quote from: frithjofh on January 21, 2016, 11:57:27 am ---so, should I edit the patch accordingly or leave it as is?

--- End quote ---
I would prefer to edit it for the mentioned reasons.

frithjofh:
attached the modified patch

blauzahn:

Trying a C:B compiled with wx-3.0 I get an error, that I have not seen before:


--- Code: ---ASSERT INFO:
/usr/include/wx-3.0/wx/string.h(1536): assert "!empty()" failed in Last(): wxString: index out of bounds

--- End code ---

clean vanilla trunk svn10781, ubuntu-16.04 x64. Full log including backtrace is attached.

in file todolistview.cpp:569 there is:

--- Code: ---item.user.Last()

--- End code ---
It must have been called on an empty wxString user.

In the attached patch I inserted check for being empty.

Unfortunately, I am stuck in starting C::B from within C::B. Somehow I can not get the CODEBLOCKS_DATA_DIR right.
I Tried to enter the proposed path via global settings and from a shell via --prefix and environment variable there.
Usually, I compile C::B always via makefile. Please bear with me, that I am not used to do it.


--- Code: ---error while loading shared libraries: libwxpropgrid.so cannot open shared object file: No such file or directory.

--- End code ---
I checked. It is in the same directory as the newly created codeblocks binary.

If possible, can somebody give me a hint, please?

Thank you.

oBFusCATed:

--- Quote from: blauzahn on February 21, 2016, 05:48:08 pm ---In the attached patch I inserted check for being empty.

--- End quote ---
The attached patch is not 100% correct, next time please at least try to compile the code. :)
Anyway, I'll commit the proper patch, soon...


--- Quote from: blauzahn on February 21, 2016, 05:48:08 pm ---Unfortunately, I am stuck in starting C::B from within C::B. Somehow I can not get the CODEBLOCKS_DATA_DIR right.....

--- End quote ---
You have to run the update or update30 script in the src folder.  8)

ollydbg:
I see such code change:

--- Code: ---@ -215,24 +184,26 @@ void AddTodoDlg::EndModal(int retVal)
 void AddTodoDlg::OnAddUser(wxCommandEvent&)
 {
     // ask for the new user to be added to the "choice" list
-    const wxString &User = cbGetTextFromUser(_T("Enter the user you wish to add"), _T("Add user"), wxEmptyString, this);
-    if (!User.empty())
+    wxTextEntryDialog dlg(this, _T("Enter the user you wish to add"), _T("Add user"), _T(""), wxOK|wxCANCEL);
+    if(dlg.ShowModal() == wxID_OK)
+    {
+        const wxString User = dlg.GetValue();
+        if(!User.empty())
             XRCCTRL(*this, "chcUser", wxChoice)->Append(User);
-}
+    }

--- End code ---
It looks like we use cbGetTextFromUser in many places in our C::B's source code, so why do you use wxTextEntryDialog?

In global.cpp, this is the code:

--- Code: ---wxString cbGetTextFromUser(const wxString& message, const wxString& caption, const wxString& defaultValue,
                           wxWindow *parent, wxCoord x, wxCoord y, bool centre)
{
    if (!parent)
        parent = Manager::Get()->GetAppWindow();

    long style = wxTextEntryDialogStyle;
    if (centre)
        style |= wxCENTRE;
    else
        style &= ~wxCENTRE;

    wxTextEntryDialog dialog(parent, message, caption, defaultValue, style, wxPoint(x, y));
    PlaceWindow(&dialog);
    wxString str;
    if (dialog.ShowModal() == wxID_OK)
        str = dialog.GetValue();
    return str;
}

--- End code ---

PS1: please add a SF ticket, so this contribution won't lost.
PS2: I think the big patch need to split into some small ones.  :)

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version