Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to use ComboBoxes instead of Tabs and enable re-ordering of documents in the Documents Docklet #2555

Merged
merged 29 commits into from
Jan 13, 2017

Conversation

LucaDanieli
Copy link
Contributor

@LucaDanieli LucaDanieli commented Dec 12, 2016

Scott Wilson, Scott Carver and I developed the management of the documents in SuperCollider, connecting the Documents Docklet to the TabBar.

Here, 2 new options are added to Preferences->Editor :

  • Use ComboBox
  • Convert automatically to ComboBox when splitting

The documents docklet is dynamic and permits the re-ordering of documents. Furthermore, the TabBar and the Documents Docklet always show the documents in the same order, and any re-ordering in the TabBar affects the order of the documents in the docklet (and viceversa).

ComboBoxes are implemented to make clearer what is the document visualised by each split. Following a discussion in 2014, we have sorted each ComboBox alphabetically - to quickly find specific documents in performance.

In this way there are now 3 different types of ordering:

  1. The TabBar and the Documents Docklet automatically order documents by "last opened", letting the user to reorder them;
  2. Each editor has an optional ComboBox with documents sorted in Lexical Order;
  3. ctrl+Tab / ctrl+shift+tab present a list of documents ordered by "last document used".

clean

better implementation using show()/hide()
comboBox disappears (if option selected) when removing splits
clean connection from Docklet to Tabs
@LucaDanieli LucaDanieli changed the title Ide rework sqc Add option to use ComboBoxes instead of Tabs and enable re-ordering of documents in the Documents Docklet Dec 12, 2016
@nhthn nhthn added this to the 3.9 milestone Dec 15, 2016
@@ -353,7 +361,9 @@ Document *DocumentManager::open( const QString & path, int initialCursorPosition
doc->mDoc->setPlainText( decodeDocument(bytes) );
doc->mDoc->setModified(false);
doc->mFilePath = filePath;
doc->mTitle = info.fileName();
QString fileTitle = info.fileName();
doc->mTitle = fileTitle;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This appears to be redundant, as setTitle() also sets the member variable.

doc->mTitle = info.fileName();
QString fileTitle = info.fileName();
doc->setTitle(fileTitle);
doc->mTitle = fileTitle;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This appears to be redundant (see above)

document->mTitle = QString::fromUtf8(title.c_str());
QString newTitle = QString::fromUtf8(title.c_str());
document->setTitle(newTitle);
document->mTitle = newTitle;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This appears to be redundant (see above)

@@ -55,7 +55,7 @@ class GenericCodeEditor : public QPlainTextEdit

void showPosition( int charPosition, int selectionLength = 0 );
QString symbolUnderCursor();
int inactiveFadeAlpha() { return mInactiveFadeAlpha; }
int inactiveFadeAlpha() { return mInactiveFadeAlpha; };
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The semi-colon is not required here, so I'd undo this change to avoid adding noise to git blame.

@@ -91,6 +97,7 @@ class DocumentsDocklet : public Docklet
private:

DocumentListWidget *mDocList;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd lose this line, as it's just additional unnecessary whitespace

@telephon
Copy link
Member

telephon commented Jan 4, 2017

maybe solves this (?): #2612

@muellmusik
Copy link
Contributor

@LucaDanieli, that's good. Before merging we should just do a clean PR which combines those adjustments with the original commits (I can show you how) in order to avoid polluting the commit log with no-ops.

Any other comments on this?

@muellmusik muellmusik merged commit 54ae367 into supercollider:master Jan 13, 2017
@nhthn
Copy link
Contributor

nhthn commented Jan 13, 2017

I understand this mostly, but I'm not clear on what is meant by "Convert automatically to ComboBox when splitting." What is a "split"?

@LucaDanieli
Copy link
Contributor Author

LucaDanieli commented Jan 13, 2017

Hi Nathan.

Splitting is the ability to "split" the editor docklet into many editors, so to show different documents at once. You can find if in "view->split to right, view->split to bottom".

Previously, all splits were sharing the same tab bar. This could be confusing. So, we wanted to add the possibility of making clearer the association document/editor for each split, providing the option to keep the original behaviour.

@nhthn
Copy link
Contributor

nhthn commented Jan 13, 2017

Ok, makes sense. Thanks for your work on this. I've filed a PR (#2639) to reword some of the checkboxes so they're easier to understand at a glance.

@mossheim
Copy link
Contributor

I think this was merged prematurely. There are a couple of issues:

  • The preferences options are vague, especially "Use ComboBox"
  • The proper name for this graphical element is a drop-down or drop-down list.
  • If I have two editors (one split) with the tab bar active and apply the "Use ComboBox" option, nothing happens.
  • If I have "Use ComboBox" checked and not "Convert automatically to ComboBox when splitting" when I activate a split, I have a tab bar instead of combo boxes now.
  • Is Ctrl in Ctrl+Tab and Ctrl+Shift+Tab meant to be Cmd on macOS? Ctrl+Tab does nothing for me.

@mossheim
Copy link
Contributor

Not sure how you want to fix this re: separate issues or PRs so I thought I would just raise them here first.

@LucaDanieli
Copy link
Contributor Author

Thank you Brian for your review.

About the first two points: I am not English mothertongue and for me naming things is one of the most difficult things. I apologise.
About point 3 and 4: I can fix that now. Should I push to this branch? Or should I push to PR(#2639), Nathan?
About point 5: Yes, it is Cmd+Tab and Cmd+Shift+Tab

@nhthn
Copy link
Contributor

nhthn commented Jan 13, 2017

@LucaDanieli I think you should just keep working on this branch.

@mossheim
Copy link
Contributor

mossheim commented Jan 13, 2017

@LucaDanieli

About the first two points: I am not English mothertongue and for me naming things is one of the most difficult things. I apologise.

No need to apologize, this is a fantastic feature and I'm really glad you guys added it! Text strings are the easiest things to change so it's no big deal. :)

About point 5: Yes, it is Cmd+Tab and Cmd+Shift+Tab

Unfortunately these are macOS-specific commands for moving between applications, similar to Alt+Tab on Linux and Windows, so they won't be useful to most macOS users. In fact, you could probably just add some code to change it to Alt+(Shift+)Tab for macOS specifically--I don't think there are any common macOS commands with that shortcut.

@LucaDanieli
Copy link
Contributor Author

LucaDanieli commented Jan 13, 2017

@brianlheim

The Ctrl+Tab shortcut was already implemented, so I thought it was already working on different platforms. @muellmusik can you check what is the shortcut in Mac for switching among "last documents used"? This menu was working on your Mac, if I remember well.

@LucaDanieli
Copy link
Contributor Author

LucaDanieli commented Jan 13, 2017

I didn't know how to cue the fix in this PR, so the fix is in this PR: #2641

@mossheim
Copy link
Contributor

@LucaDanieli @muellmusik My apologies, the shortcut for macOS is already Alt+(Shift+)Tab, and I can see that now looking at the View menu in my running build. So that should be documented in the changelog, but there's nothing to change in the code. Thanks for helping to clear that up!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants