-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Editor Refactoring #1426
Editor Refactoring #1426
Conversation
Provides a toolbar with play, record and stop buttons.
Split AutomationEditor -> AutomationEditor + AutomationEditorWindow
@@ -89,6 +88,14 @@ class AutomationEditor : public QWidget, public JournallingObject | |||
void setVertexColor( const QColor & c ); | |||
void setScaleColor( const QBrush & c ); | |||
|
|||
enum editModes | |||
{ | |||
DRAW, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think our convention is to use CapitalCase for enum members...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't invent that enum, I just moved it to public ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I know, just thought that since you're already refactoring things,
you wouldn't mind some extra work ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I'll do some style updates sooner or later ;) I think you renamed that particular enum in lmms2
already.
Btw, I suggest dropping the convention about parentheses being followed/preceded by a space character (like printf( "Hello World!" );
instead of printf("Hello World!");
). It can get really hard to stick to, and it doesn't really add much to readability.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On 12/08/2014 09:55 PM, Lukas W wrote:
Sure, I'll do some style updates sooner or later ;) I think you
renamed that particular enum in |lmms2| already.
Did I? Can't remember if I've touched AutomationEditor in lmms2 yet...
Btw, I suggest dropping the convention about parentheses being
followed/preceded by a space character (like |printf( "Hello World!"
);| instead of |printf("Hello World!");|). It can get really hard to
stick to, and it doesn't really add much to readability.
Sorry but personally, I have to disagree with that. I actually think it
clears up the code a lot... it adds some separation between arguments
and it makes it a whole lot easier to read especially when there are a
lot of nested function calls. Or complex equations with lots of
parentheses. For example, compare this:
m_b1 = ( 4.0f * ( m_wc4 + sq_tmp1 - m_k4 - sq_tmp2 ) ) / m_a;
m_b2 = ( 6.0f * m_wc4 - 8.0f * wc2 * k2 + 6.0f * m_k4 ) / m_a;
m_b3 = ( 4.0f * ( m_wc4 - sq_tmp1 + sq_tmp2 - m_k4 ) ) / m_a;
m_b4 = ( m_k4 - 2.0f * sq_tmp1 + m_wc4 - 2.0f * sq_tmp2 + 4.0f * wc2 * k2 ) / m_a;
to this:
b1=(4*(wc4+sq_tmp1-k4-sq_tmp2))/a_tmp;
b2=(6*wc4-8*wc2*k2+6*k4)/a_tmp;
b3=(4*(wc4-sq_tmp1+sq_tmp2-k4))/a_tmp;
b4=(k4-2*sq_tmp1+wc4-2*sq_tmp2+4*wc2*k2)/a_tmp;
The first one looks a whole lot more readable to me...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I never suggested removing spaces between operators.
My vote shouldn't really count here (since I contribute very little new C/C++ code) but as you can see from my last pull request, this bites me a lot too. 👍 -Tres |
I think your vote should count. I updated the Coding Conventions in the wiki. :) |
I think this issue needs some more discussion first (maybe on its own issue or the mailing list)... I think it's important we adhere to a style that is tolerable to all of us, especially to those of us that have to grind through a lot of code... but at the same time, we should maybe first try to get the whole codebase into a consistent style before we start changing it up again. Perhaps as a compromise we could leave the spaces out when there's only one argument in a function call, or no nested calls, or for things like casts that only have a single item, but I really think the spaces should be kept in more complex calls/expressions. |
I disagree. At the current sate, the code already is ugly and inconsistent, and we're in the process of fixing this, which is not even half finished. Better agree on a final style while we're at it, not when we're finished and have to go through all the code again. Let's not make this a big deal. I only removed the requirement of adding spaces inside parenthesis. For instance, this: void setParent( QObject* parent ); is not really easier to read or understand than void setParent(QObject* parent); but it takes twice the time to write and many editors don't like it. I'm not saying we should never use spaces. Of course there are complex cases where adding spaces around the arguments can improve readability. |
On 12/09/2014 12:22 AM, Lukas W wrote:
So maybe we should do like I suggested, and write it down that it's And since we're apparently talking about coding style guidelines, a
x = condition
x = condition ? value : othervalue;
Does this all sound reasonable? |
Sure, even though I consider this to be something that goes without saying.
I'm not sure what you mean. Is it this: void main(int argc, const char*[] argv)
{
...
} vs this? void main(int argc, const char*[] argv) {
...
} If that's what you mean, this is in the coding conventions, but only for
Not at all, I think complex ternary expressions should generally be avoided. Use if/else instead.
This is in the guidelines already ;) |
On 12/09/2014 01:10 AM, Lukas W wrote:
Cool. While it might seem obvious to you or me, there's lots of people
Yes, that. I think we should just edit it to apply to all curly braces.
Hm, I'm not so sure they should be. Ternary expressions can sometimes be
Cool. |
Is this still WIP? Seems like some kind of conflict here, you may need to rebase this... |
Yes it's still in progress. I expected those merge conflicts, I'll fix them soon (already did twice in this PR). |
Conflicts: plugins/audio_file_processor/audio_file_processor.cpp plugins/delay/delaycontrols.cpp plugins/delay/delaycontrolsdialog.cpp plugins/delay/delayeffect.cpp src/gui/MainWindow.cpp
Conflicts: include/AutomationEditor.h include/SongEditor.h plugins/delay/delaycontrols.cpp plugins/delay/delaycontrolsdialog.cpp src/gui/editors/AutomationEditor.cpp src/gui/editors/BBEditor.cpp src/gui/editors/PianoRoll.cpp
Conflicts: src/core/Song.cpp src/gui/MainWindow.cpp
The last few commits (0df3998, 1ee9340, e0dbfa6) might be interesting for developers. I moved most GUI related code in the Engine::mainWindow()->workspace(); is now gui->mainWindow()->workspace(); Of course this should check whether |
Conflicts: src/gui/editors/PianoRoll.cpp
Merging as it becomes too difficult to resolve the conflicts. |
Refactoring the editors' code. Introduced a new superclass for them providing a toolbar.
This is a try to make the code somewhat maintainable, but there's just so much done wrong there, it's still a long way.