Author Topic: Made a new "Sort Order" dialog...  (Read 26096 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: 5916
  • 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: 5916
  • 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!]

Offline ouch

  • Almost regular
  • **
  • Posts: 223
Re: Made a new "Sort Order" dialog...
« Reply #15 on: September 28, 2015, 08:57:14 am »
Really don't know what you have against advanced mode... Just don't click the box and you will never see it anyway. That's sort of the whole point to this updated patch. Because you were right, it may be too scary of a window for new users. That's why it defaults to basic mode now.

The resizing "magic" works by just calling the layout and fit functions built into wxWidgets. It then gets the resulting window size and sets that as a minimum size. And yes everything is all neatly nestled into sizers.

The reset list button just reloads the list as it was before the window was opened. It's basically like canceling and reopening the window. But now you can just click the button to reset the list.

Why I need the advanced mode? Most of my project files probably look a lot like yours. Just a release and debug target. Maybe a couple more if I had to support different platforms.

But my library project files usually look vastly different. For example here is a screen shot of my SQLite project file:



You can probably see just from that screenshot why being able to automatically sort build targets is crucial to me. And this is just a windows project file. Imagine what the linux one would look like with multiple platforms on it...

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Made a new "Sort Order" dialog...
« Reply #16 on: September 28, 2015, 10:01:28 am »
Really don't know what you have against advanced mode...
Because very few people will use it, most probably only you, but its complexity adds maintenance burden.
More features to test, more bugs to creep in, harder to change stuff.

The reset list button just reloads the list as it was before the window was opened. It's basically like canceling and reopening the window. But now you can just click the button to reset the list.
Another useless feature, for most people.

But my library project files usually look vastly different. For example here is a screen shot of my SQLite project file:



You can probably see just from that screenshot why being able to automatically sort build targets is crucial to me. And this is just a windows project file. Imagine what the linux one would look like with multiple platforms on it...
I have a feeling that you need scripting support for re-ordering targets instead of this monstrous dialog.
There you can implement the logic you want with just a single click.
Have you considered this option?

I still don't know why you have some many targets. You want to build against every version of your libraries?
(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 #17 on: September 28, 2015, 11:02:40 pm »
Because very few people will use it, most probably only you, but its complexity adds maintenance burden.
More features to test, more bugs to creep in, harder to change stuff.

How often would this need to be changed? Or more importantly I guess, how often has the old one been updated? I've been using this one for a couple years now on my own, so I can't imagine many, if any bugs remain in it. But feel free to test it.

Another useless feature, for most people.

It almost sounds like you think having the user cancel and reopen the dialog is acceptable UI design... While I suppose that it works, it seems fiddly, feels clunky, and more importantly is disrespectful of your end users time in my opinion.

I have a feeling that you need scripting support for re-ordering targets instead of this monstrous dialog.
There you can implement the logic you want with just a single click.
Have you considered this option?

I still don't know why you have some many targets. You want to build against every version of your libraries?

A monstrous dialog? Advanced mode is a handful of buttons with a few check boxes... If the user can navigate their way through the project options dialog to even get to it then advanced mode of this is a walk in the park by comparison. And even then they have to turn advanced mode on to even see it. Otherwise it's just as simple as the original dialog with a couple of time saving options.

Why would I write a script to make up for an open source program's UI shortcomings? Wouldn't it be more beneficial to me, the project, and it's users to just update the UI and submit a patch? I mean it would be like writing a script to overcome a bug instead of just fixing the bug and then submitting a patch...

And yes I need all those versions, they wouldn't be there if I didn't... I often don't even know who I'm going to be working for tomorrow let alone which version of whatever library they use. I only work at my steady job part time. So to make up for the lost income I often take up side projects here and there. And thus that's why I like to have a bunch of releases spanning the last 5 years or so on hand. Because you have no idea often I hear "We have not upgraded to version x in 6 years because version y broke everything"...

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Made a new "Sort Order" dialog...
« Reply #18 on: September 28, 2015, 11:36:14 pm »
Why would I write a script to make up for an open source program's UI shortcomings?
Because it allows different use cases to be handled without the need for specific UI for every one.
I guess you have some kind of algorithm to sort your targets, if you write it as a script you'll waste less time in the long run.

Maintenance is not only related to code - we need to write documentation for new features (we rarely do unfortunately), we have to answer question about it on the forum and so on.
(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 MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Made a new "Sort Order" dialog...
« Reply #19 on: October 01, 2015, 08:52:09 am »
Please note that this patch does not work for wx30+ so it won't be accepted "as-is".
The problem is that EVT_TEXT_ENTER is not available and causes a compilation error in editarrayorderdlg.cpp, unfortunately.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline ouch

  • Almost regular
  • **
  • Posts: 223
Re: Made a new "Sort Order" dialog...
« Reply #20 on: October 23, 2015, 01:21:48 am »
Ok, should be fixed. Should compile against wx2.8 and wx3.x

Get the update below.

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

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Made a new "Sort Order" dialog...
« Reply #21 on: October 23, 2015, 02:48:01 pm »
Because it allows different use cases to be handled without the need for specific UI for every one.
I guess you have some kind of algorithm to sort your targets, if you write it as a script you'll waste less time in the long run.

Maintenance is not only related to code - we need to write documentation for new features (we rarely do unfortunately), we have to answer question about it on the forum and so on.
Teodor is very right, indeed. However, I personally have had quite some use-cases for the advanced options since I am trying this patch myself. So I am not sure if the number of people that would use the advanced features is really that small. Whenever you start to re-organise projects this comes in very handy.

So while I agreed with Teodor in the fist place, meanwhile I tend to leave it as-it-is... meaning with the advanced feature included, but hidden.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ