Author Topic: Made a new "Sort Order" dialog...  (Read 26087 times)

Offline ouch

  • Almost regular
  • **
  • Posts: 223
Made a new "Sort Order" dialog...
« on: November 22, 2013, 09:26:19 am »
So I've been using Code Blocks for quite a few years now and it's always been a reliable solution for me through them all. I always wanted to contribute something to pay it back but I never had the time. Well I found time to do so and I wanted to start on the one dialog that always aggravated me when I used it. In my mind I should be spending a few seconds and a few clicks on the sort order dialog but instead I end up spending minutes and what seemed like hundreds of clicks rearranging  each item... So I set out to fix the problem by making the most robust Sort Order dialog the world of IDE's have seen! lol

Here is the result:



A bit more than a listbox and two buttons... But the best part is it's even easier to use than the old one and has advanced features to shave time off or outright semi-automate the rather boring task of sorting build targets.

Features include:
Multiple Selections (All other features work with this in mind as well)

Drag and drop for right mouse button. Also right clicking doubles as adding an item to a selection rather than clearing it like left click does.

Match based on standard search or even regex with selectable case sensitivity for both.

Searches can be added or removed from current selections allowing for multiple searches to narrow down what your looking for or to create entirely new selections from scratch. Simply by changing the mode.

Move to top and move to bottom buttons to compliment the original move and move down.

Alphabetical sorting of selections means a simple click will sort all those pesky version numbers.

Did someone list those release targets just above the debug version for every version in the project? Use the Collapse to Top or bottom buttons to move all the releases versions to the top and all the debug versions to the bottom in one click.

The number of selected items are also displayed so you don't accidentally move something you can't currently see.

Did you single single-handedly massively screw up your build target ordering beyond human comprehension? Just click the reset list button to put things back to when the dialog opened. No more canceling and then re-clicking the re-order button.

All settings and 10 previous searches are saved upon close so you can get right back to what you were doing last time.

And finally, of course no multiple selection listbox is complete without the standard select all and select none buttons.

you can download the patches and the whole source files here:

https://sites.google.com/site/ouchsdownloads/home/downloads/Sort%20Order.zip

I have not gone through the official patching process because it's my first Code Blocks patch and I would like to make sure it follows all the coding conventions. And to ask is it possible to have posix style searches? Seems like the normal document search uses scintilla for that but when I tried it it kept complaining that it needed an object associated with it. I'm assuming it's because it wants to highlight words in a document which doesn't exactly work for wxlistboxes...

I'm also not sure I implemented all the config manager stuff correctly... I basically just shamelessly copied it from the document search stuff. I'm mainly concerned because it seemed too easy... lol

Also, let me know if anyone finds any bugs or has any ideas for things to add.

Oh and this was made with  TDM mingw 4.7.1 and wxWidgets 2.8 SVN branch "WX_2_8_BRANCH" version 75268 on Win 7 64bit
« Last Edit: November 22, 2013, 09:31:00 am by ouch »

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5915
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Made a new "Sort Order" dialog...
« Reply #1 on: November 22, 2013, 04:33:02 pm »
When I see the screen shot, I see it is quite nice, great work.

Question: I just search occurrences of editarrayorderdlg.h in all source code of Codeblocks.cbp, but I can not find one. So, where does this kind of "Sort Order" dialog used for?
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 Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Made a new "Sort Order" dialog...
« Reply #2 on: November 22, 2013, 04:58:52 pm »
When I see the screen shot, I see it is quite nice, great work.

Question: I just search occurrences of editarrayorderdlg.h in all source code of Codeblocks.cbp, but I can not find one. So, where does this kind of "Sort Order" dialog used for?

"Project -> Properties -> Build targets -> Re-Order"
Called from void ProjectOptionsDlg::OnBuildOrderClick(cb_unused wxCommandEvent& event) in projectoptionsdlg.cpp:558

Offline beqroson

  • Multiple posting newcomer
  • *
  • Posts: 63
Re: Made a new "Sort Order" dialog...
« Reply #3 on: November 22, 2013, 05:05:04 pm »
Wow, now this I do not understand. So please enlighten me.

Is including such a dialogue worth the time coding it? What if it needs to be recoded in the future, how many combined minutes would that occupy if you also count in all the other features of CodeBlocks?  ???

So my question is; is it worth the time to code this thing to save time for the user, or is this to be considered more like a fun project disregarding what can be saved?

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Made a new "Sort Order" dialog...
« Reply #4 on: November 22, 2013, 05:12:30 pm »
Wow, now this I do not understand. So please enlighten me.

Is including such a dialogue worth the time coding it? What if it needs to be recoded in the future, how many combined minutes would that occupy if you also count in all the other features of CodeBlocks?  ???

So my question is; is it worth the time to code this thing to save time for the user, or is this to be considered more like a fun project disregarding what can be saved?
Is developping software ever worth the time ?
Almost everything we do with software is either totally useless or can also be done without computers.

Offline beqroson

  • Multiple posting newcomer
  • *
  • Posts: 63
Re: Made a new "Sort Order" dialog...
« Reply #5 on: November 22, 2013, 05:17:09 pm »
Wow, now this I do not understand. So please enlighten me.

Is including such a dialogue worth the time coding it? What if it needs to be recoded in the future, how many combined minutes would that occupy if you also count in all the other features of CodeBlocks?  ???

So my question is; is it worth the time to code this thing to save time for the user, or is this to be considered more like a fun project disregarding what can be saved?
Is developping software ever worth the time ?
Almost everything we do with software is either totally useless or can also be done without computers.

Such a cool answer, it made my day. My pondering just went away completely...   :D

Offline ouch

  • Almost regular
  • **
  • Posts: 223
Re: Made a new "Sort Order" dialog...
« Reply #6 on: November 26, 2013, 07:09:30 am »
Well since no one had any problems with it I went ahead and submitted it as a patch here: http://developer.berlios.de/patch/index.php?func=detailpatch&patch_id=3529&group_id=5358

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: Made a new "Sort Order" dialog...
« Reply #7 on: November 26, 2013, 03:02:30 pm »
This is fine for what it is, but if anything it's indicative of the larger problem that (IMHO) the project properties/build options/set program arguments dialogs are a total clusterf##k. I have spent a lot of frustrating hours in those dialogs messing around with settings trying to get different projects to compile and run. I would really like to see all of those features consolidated in one place, ideally using editor windows in tabs (a la the editor window) rather than dialogs so that we can have settings for more than one project open at once. I think Code::Block build system is terrific, but the GUI just sucks.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Made a new "Sort Order" dialog...
« Reply #8 on: November 26, 2013, 03:38:46 pm »
I would really like to see all of those features consolidated in one place, ideally using editor windows in tabs (a la the editor window) rather than dialogs so that we can have settings for more than one project open at once.
I've started work on this feature, but I've higher priority issues to tackle before I'm back at it.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline ouch

  • Almost regular
  • **
  • Posts: 223
Re: Made a new "Sort Order" dialog...
« Reply #9 on: October 02, 2014, 11:19:32 pm »
I was wondering why this never got added, then I remembered that the code::blocks berlios project died right around that time so my submitted patch no longer exists.

Was there an actual reason this was never added or should I re-submit it through sourceforge?

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: Made a new "Sort Order" dialog...
« Reply #10 on: October 02, 2014, 11:57:53 pm »
I was wondering why this never got added, then I remembered that the code::blocks berlios project died right around that time so my submitted patch no longer exists.
50% correct... patch #3529 exists, but when you uploaded it to BerliOS, it must have been compressed, and therefore corrupted within their database (BerliOS only handled plain text).  So, impossible to recover from there.

Was there an actual reason this was never added or should I re-submit it through sourceforge?
Though I personally would not make use of this feature, I would recommend uploading it again; you already put the work in and I believe others would benefit from it.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Made a new "Sort Order" dialog...
« Reply #11 on: October 03, 2014, 12:39:34 am »
Are you really spending all that time reordering build targets?
This is a monstrous dialog and if I have to use it I'd be really scared.

Probably a saner option would be to just add multiple selection support and "move to top"/"move to bottom" buttons.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline ouch

  • Almost regular
  • **
  • Posts: 223
Re: Made a new "Sort Order" dialog...
« Reply #12 on: September 24, 2015, 02:31:29 pm »


Finally got around to finishing this. There is now two modes, basic and advanced. In basic mode (the default) it only has the move, section and reset buttons available. Ticking the advanced checkbox brings up the view in the first post. That checkbox is also saved on exit so you can just set it and forget it. The multiple selection and dragging and dropping still works in both modes too. Additionally this version saves it's window size on exit. The minimum window size is calculated dynamically instead of having fixed numbers. So no one should see a horrible pile of controls stacked on top of one another regardless of platform. This is true even if the user tries to pull some config file shenanigans... :) Max size is not taken into consideration to prevent multi-monitor issues. The window also centers itself on whatever called it instead of the center of the screen which should also help multi-monitor users.

So yeah, this version should have something everyone will enjoy.

Patch files and whole files in link below.

https://sites.google.com/site/ouchsdownloads/home/downloads/EditOrder.zip

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5915
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Made a new "Sort Order" dialog...
« Reply #13 on: September 26, 2015, 04:19:41 pm »
Very good job, ouch. I don't have time to test it recently, but generally I'm fine with the UI.  ;)
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 oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Made a new "Sort Order" dialog...
« Reply #14 on: September 26, 2015, 04:53:57 pm »
I'll be fine with this patch, if you remove the advanced mode.
Also, I'm not sure that I like the resizing magick you're describing.
I've not looked at the patch, but I hope you're using sizers and you're not placing controls manually.

Also what does the reset list button do? Isn't it the same as cancel + reopening the dialog?

BTW: You've not answered my questions. Are you really spending all that time re-ordering targets? How many targets do you really have?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]