Author Topic: Some UI refactoring/tidy up  (Read 46689 times)

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Some UI refactoring/tidy up
« on: August 11, 2012, 05:07:31 am »
Hi guys,

I've been thinking about the following changes:

Find/Replace:
1. Possibly remove "Find uses selected text" check box <-- have no idea what this is supposed to do (the code is attributed to tiwag). We already have a scope option and if you select text before pressing control F it become the default search term. What does this do differently?
2. Add regular expression option: "." searches across newlines or within
3. Find/Replace in files: add option to specify project to search in (active or others)

Settings Dialogs:
4. Load XRC for each configuration panel on demand (i.e. as the user clicks the tab). Avoids some delay, esp. on slower Linux systems. (also means no changes written for config panels that were never opened and, hence, no changes were made).
5. Explore making the settings dialog a modeless editor tab
6. Explore replacing the settings dialog listbook with a single scrollable page where panels are folded away and unfold on click revealing their content

I have partial patches for 2 and 4.

5 & 6 I've talked about in the past and will take a bit of work, and not sure they will necessarily improve on what we have now, but worth a try (note that 4 is pretty much a pre-requisite for these)

Any thoughts?

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Some UI refactoring/tidy up
« Reply #1 on: August 11, 2012, 08:28:38 am »
2. Add regular expression option: "." searches across newlines or within
We have that already?!

3. Find/Replace in files: add option to specify project to search in (active or others)
Good - also an option to search int he files of the target is something I'd like to see... ;-)

4. Load XRC for each configuration panel on demand
Be careful here: We have a resource loader that kind off does such things already, but its not used. Something  I had in mind to investigate why that is...

5. Explore making the settings dialog a modeless editor tab
Again: Be careful: We disable some function s if the settings dialog is opened for good reasons. also, avoid race conditions, like changing the (project's) compiler options while compiling in the background. Modeless dialogs require to handle this carefully. As we have an event based system this is not so easy! Other than That: Fine.

6. Explore replacing the settings dialog listbook with a single scrollable page where panels are folded away and unfold on click revealing their content
This sounds like a very major change and I don't know how it affects plugins which provide panels as their foreign config dialogs. There was a very nice wxWidgets class though - I recall where you were able to shrink/unshrink parts of the window. But I didn't find it anymore... wxTreeSomewhat... wxScrolledSomewhat...?!
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 Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Some UI refactoring/tidy up
« Reply #2 on: August 11, 2012, 08:34:41 am »
1. is a very useful feature, I use a lot in find and replace dialog, because you get the posibility to select a range of text and only replace a keyword in this selection. Very good for manual refactoring after copy and paste. Please do not remove !

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Some UI refactoring/tidy up
« Reply #3 on: August 11, 2012, 11:18:58 am »
1. is a very useful feature, I use a lot in find and replace dialog, because you get the posibility to select a range of text and only replace a keyword in this selection. Very good for manual refactoring after copy and paste. Please do not remove !
Yes, but it is annoying that if you have accidentally selected some text and you start a search it is in this unexpected mode.
What about making it the non-automatically selected option and the user is explicitly required to switch to this mode?

I can will add 7 to the list:

7). See if it is possible to make the project properties and build options modeless or editors, so the user can edit multiple settings at once.
This will be pretty useful in multi project workspaces.
(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 dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: Some UI refactoring/tidy up
« Reply #4 on: August 11, 2012, 07:24:02 pm »
1. is a very useful feature, I use a lot in find and replace dialog, because you get the posibility to select a range of text and only replace a keyword in this selection. Very good for manual refactoring after copy and paste. Please do not remove !

Isn't this what "Scope: global / selected text" radio boxes let you do? In case it wasn't clear, I was referring to the check box labeled "Find uses selected text". I still can't figure out what it does.

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: Some UI refactoring/tidy up
« Reply #5 on: August 11, 2012, 07:28:34 pm »
Yes, but it is annoying that if you have accidentally selected some text and you start a search it is in this unexpected mode.
What about making it the non-automatically selected option and the user is explicitly required to switch to this mode?

I personally prefer the behavior that treats a multiline selection as the scope by default, but I can see how others might not. Rather than change default behavior for everyone, how about a check box in the editor settings to enable the ability to change default behavior. (I do realize settings are already pretty polluted)

Quote
I can will add 7 to the list:

7). See if it is possible to make the project properties and build options modeless or editors, so the user can edit multiple settings at once.
This will be pretty useful in multi project workspaces.

Sounds good to me. I will investigate that when I'm done with 5/6.

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: Some UI refactoring/tidy up
« Reply #6 on: August 11, 2012, 07:53:48 pm »
2. Add regular expression option: "." searches across newlines or within
We have that already?!

I don't  think so. Currently regex won't match a multiline expression. Sometimes that is useful, other times not. I put a partial patch here, but need to change the dialogs: http://forums.codeblocks.org/index.php/topic,16680.msg113282.html#msg113282

Quote
Good - also an option to search int he files of the target is something I'd like to see... ;-)

agree.

Quote
4. Load XRC for each configuration panel on demand
Be careful here: We have a resource loader that kind off does such things already, but its not used. Something  I had in mind to investigate why that is...

What I am actually doing is deferring instantiation of the whole panel (which also defers the XRC load)

Quote
5. Explore making the settings dialog a modeless editor tab
Again: Be careful: We disable some function s if the settings dialog is opened for good reasons. also, avoid race conditions, like changing the (project's) compiler options while compiling in the background. Modeless dialogs require to handle this carefully. As we have an event based system this is not so easy! Other than That: Fine.

Will be careful. The plan is that changed options won't be accepted until you hit apply. (And there will be an option cancel/reset the changes). It will take a little work to make sure the apply button is disabled if there are critical things happening.

Quote
6. Explore replacing the settings dialog listbook with a single scrollable page where panels are folded away and unfold on click revealing their content
This sounds like a very major change and I don't know how it affects plugins which provide panels as their foreign config dialogs. There was a very nice wxWidgets class though - I recall where you were able to shrink/unshrink parts of the window. But I didn't find it anymore... wxTreeSomewhat... wxScrolledSomewhat...?!

This coupled with modal dialogs is a pretty big change. I am hoping that changes for plugin writers will be very minimal (I think I can get it down to a simple change to how the plugin returns GetConfigurationPanel, GetProjectConfigurationPanel etc). This may not work well at all, hence "explore".

Btw, qtCreator does most of their settings modally in the main window (though still using notebooks). I also like the qtCreator start page.
« Last Edit: August 13, 2012, 09:12:44 am by dmoore »

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: Some UI refactoring/tidy up
« Reply #7 on: August 13, 2012, 09:10:06 am »
Attached is a patch that is a first stab at 4 -- uses a lot of templating to get things done, which isn't ideal.

This speeds up opening up editor and environment settings a bit on slow systems, but there is more to do in terms of the parts of the config that aren't supplied by plugins. The idea would be to break up the XRC into chunks that can be instantiated in pieces. I didn't mess with Project dialogs, they seem to open quickly enough even on slow systems. Most things still work fine. The dialogs will occasionally resize as you click on configs with big panels that haven't been opened yet, which looks a bit weird and could be remedied with size hints. BrowseTracker's config panel is screwed up for some reason. Shouldn't be difficult to fix.

In the end I'm not sure the performance is worth the pain, but I do have a good handle on how the config system works now, which will help implementing the other items on the list.

I do get an assertion on exit: 
Code
(codeblocks:9081): GLib-GObject-WARNING **: invalid uninstantiatable type `<invalid>' in cast to `GtkRadioMenuItem'

(codeblocks:9081): Gtk-CRITICAL **: IA__gtk_radio_menu_item_get_group: assertion `GTK_IS_RADIO_MENU_ITEM (radio_menu_item)' failed

(codeblocks:9081): GLib-GObject-WARNING **: invalid uninstantiatable type `<invalid>' in cast to `GtkRadioMenuItem'

(codeblocks:9081): Gtk-CRITICAL **: IA__gtk_radio_menu_item_get_group: assertion `GTK_IS_RADIO_MENU_ITEM (radio_menu_item)' failed
Aborted (core dumped)

Don't have time to check whether my changes caused this.

The big challenge will be #5 on my list. If settings change outside of the config (e.g. list of mimetypehandlers is modified when you double click on new file types in the project tree), the config will need to be notified if it is opened.

I plan to take a break from coding for a week or so, so won't be very active here.

[attachment deleted by admin]

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Some UI refactoring/tidy up
« Reply #8 on: August 13, 2012, 09:47:45 am »
I do get an assertion on exit:  
Code
(codeblocks:9081): GLib-GObject-WARNING **: invalid uninstantiatable type `<invalid>' in cast to `GtkRadioMenuItem'

(codeblocks:9081): Gtk-CRITICAL **: IA__gtk_radio_menu_item_get_group: assertion `GTK_IS_RADIO_MENU_ITEM (radio_menu_item)' failed

(codeblocks:9081): GLib-GObject-WARNING **: invalid uninstantiatable type `<invalid>' in cast to `GtkRadioMenuItem'

(codeblocks:9081): Gtk-CRITICAL **: IA__gtk_radio_menu_item_get_group: assertion `GTK_IS_RADIO_MENU_ITEM (radio_menu_item)' failed
Aborted (core dumped)

The core-dump is not related to this as far as I know, and it seems it has gone with the xm-compiler branch, so it might be related to compiler-plugin.
In most cases a bt shows an error while deleting a wxString and/or wxArrayString.

The GLIB and GTK stuff is related to a wxWidgets or gtk issue when removing menu-entries. It comes from debugger-menu.
There is a bug-report by Eran, because of a similar issue on wx-dev mailinglist.
« Last Edit: August 13, 2012, 09:49:46 am by jens »

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Some UI refactoring/tidy up
« Reply #9 on: August 13, 2012, 05:22:56 pm »
The core-dump is not related to this as far as I know, and it seems it has gone with the xm-compiler branch, so it might be related to compiler-plugin.
I've cleaned-up the resource file sin the compiler plugin. Maybe we can merge that part to trunk a little earlier, too... I seems wxSmith does strange things sometimes in combination with editing XRC files, but I did not iinvestigate any further.
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 dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: Some UI refactoring/tidy up
« Reply #10 on: August 21, 2012, 05:24:15 pm »
Returning to this... Was playing with Find/Replace. First step, I created a unified find and replace dialog that dynamically relabels relevant widgets to either "Find" or "Replace" and hides irrelevant options when it is created. This makes the UI more consistent. I will be adding the ability to search in targets and search in workspaces (fixing the current broken implementation).

A couple of Qs:
1. Is there a reason why we pre-size the replace dialog to the MinSize of the multiline text entries? This introduces a lot of ugly whitespace when the multiline option is unchecked. Why not just let the dialog grow using Fit?
2. Is there an easy way to insert widgets between radio box items in wxSmith. To handle the search scope, I wanted to do something like:

Code
o Open files
o Project files
    Project Combo\/   Target Combo\/
o Workspace
o Path
« Last Edit: August 21, 2012, 06:05:53 pm by dmoore »

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: Some UI refactoring/tidy up
« Reply #11 on: August 21, 2012, 05:28:37 pm »
There was a very nice wxWidgets class though - I recall where you were able to shrink/unshrink parts of the window. But I didn't find it anymore... wxTreeSomewhat... wxScrolledSomewhat...?!

wxCollapsiblePane? http://docs.wxwidgets.org/2.8/wx_wxcollapsiblepane.html

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Some UI refactoring/tidy up
« Reply #12 on: August 22, 2012, 06:19:08 am »
wxCollapsiblePane? http://docs.wxwidgets.org/2.8/wx_wxcollapsiblepane.html
Maybe that was it, yes. Just I recall that it didn't have buttons but tiny plusses for collapsing...?! Maybe it was an older version.
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 dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: Some UI refactoring/tidy up
« Reply #13 on: August 28, 2012, 04:45:25 am »
Here's a pretty extensive patch for Find/Replace.

What's changed:
1. Find and replace now share a common XRC file and class.
2. Layout of dialogs (still a few minor glitches with the layout that I need to fix)
3. Can now specify project and optionally a target to find/replace in (defaults to active project every time, could store last used settings)
4. Can now do replace in "search path"
5. Code::Blocks Project files (I haven't touched the make files)

Attaching 2 patches:
#1 is based on rev 8239, my working copy while I was working on these changes
#2 is based on rev 8250, the current rev

Hopefully either one will apply fine.

Please test and give me your thoughts.

[attachment deleted by admin]

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: Some UI refactoring/tidy up
« Reply #14 on: August 28, 2012, 04:04:10 pm »
There is an issue with my patches. Before you run them, you will first need to do:

Code
svn cp src/sdk/replacedlg.cpp  src/sdk/findreplacedlg.cpp 
svn cp src/include/replacedlg.h  src/include/findreplacedlg.h

I had used svn cp to do this, but the svn diff does not show up the need to copy replacedlg.* first.