-
Notifications
You must be signed in to change notification settings - Fork 195
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
Copy solely the text string when TextEdit is active (DnD). #499
Copy solely the text string when TextEdit is active (DnD). #499
Conversation
That seems very similar code then.. should that be pulled into a function? |
e59b37a
to
8ff3e99
Compare
This is a fantastic idea. I have merged the code for clipboard and drag and drop in into one main control flow. |
That required so many conditionals, that is definitely worse :) What I meant is that I saw this code being identical in 2 places:
So that could possibly be in a function, and maybe other parts of the code too. |
8ff3e99
to
7d0dafa
Compare
@aardappel |
I am not sure what you're asking. |
Ok. I updated the PR (see commit). Is it ok now? |
src/document.h
Outdated
@@ -496,6 +480,23 @@ struct Document { | |||
return; | |||
} | |||
|
|||
#ifdef __WXGTK__ |
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.
why did you split it up by duplicating the code? the old code was better
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.
The return types differ between WXGTK and other platforms.
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.
Ok I changed that. But I need to set the return type and differentiate between WXGTK and others as also within the function body, there is a second differentiation then.
d01b8ef
to
c939f14
Compare
@aardappel |
c939f14
to
1e88aff
Compare
src/document.h
Outdated
@@ -496,6 +480,22 @@ struct Document { | |||
return; | |||
} | |||
|
|||
#ifdef __WXGTK__ |
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.
just use a -> auto
return type
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.
And put the helper function above the caller did the "trick"!
Thanks for your feedback! :-)
src/document.h
Outdated
sys->clipboardcopy = s; | ||
wxString html = selected.g->ConvertToText(selected, 0, A_EXPHTMLT, this); | ||
#ifdef __WXGTK__ | ||
wxCustomDataObject *htmlobj = new wxCustomDataObject(wxDF_HTML); |
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.
auto *htmlobj =
outside the ifdef like the original.. and indent
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.
Thanks for your reply. I also left the asterik now out because it is also deduced that it is a pointer type.
1e88aff
to
5e85c75
Compare
@aardappel |
Much nicer, thanks! |
Thank you for your review making it much better! |
Same as 7f68776 but for Drag and Drop operation.