Commit Graph

63242 Commits

Author SHA1 Message Date
Vadim Zeitlin
d1c15bfe0e Reformat JavaScript code in wxJSScriptWrapper
No real changes, but just use string concatenation instead of line
continuation backslashes and also replace hard TABs with spaces.

Notice that the code is still completely unreadable as JavaScript, but
this shouldn't be a problem as nobody will see it there anyhow, so it's
quite enough to have it more readable in its string form in C++.
2017-10-22 23:38:02 +02:00
Vadim Zeitlin
3907524098 Remove unused wxJSScriptWrapper::GetOutputJSVariable() method
There doesn't seem to be any reason to keep it.
2017-10-22 23:38:00 +02:00
Vadim Zeitlin
eff7a2e07f Improve wxJSScriptWrapper methods comments
Explain more clearly what each of them does.
2017-10-22 23:37:58 +02:00
Vadim Zeitlin
6563f38496 Make wxJSScriptWrapper methods const
Do not mark as const their returned values, which is useless, and seems
to have been a result of some confusion about how "const" works in C++.
2017-10-22 23:37:56 +02:00
Vadim Zeitlin
836c874c88 Escape JavaScript code in wxJSScriptWrapper constructor
We can prepare the escaped code directly here, instead of waiting for
GetWrappedCode() call, this is more clear and safer as it avoids
escaping the code twice accidentally if GetWrappedCode() ends up being
called twice somehow.
2017-10-22 23:37:54 +02:00
Vadim Zeitlin
1b7bb46568 Don't use dollar sign in the JavaScript variable name neither
While it is allowed there, it is confusing and unnecessary.

Also improve the comment explaining why do we need this output variable
name at all and why does it need to be unique.
2017-10-22 23:37:52 +02:00
Vadim Zeitlin
71522731c6 Fix typos in wxJSScriptWrapper comments
No real changes.
2017-10-22 23:37:50 +02:00
Vadim Zeitlin
c45e674fa0 Don't use dollar sign in C++ identifiers in wxJSScriptWrapper
This is a non-standard extension in the first place and the variable
name didn't make any sense too, so rename it to be standard-conforming
and actually correspond to what it contains.
2017-10-22 23:37:48 +02:00
Vadim Zeitlin
148c590017 Get rid of unnecessary "explicit" in wxJSScriptWrapper
This ctor has more than one argument and so can't be used implicitly.
2017-10-22 23:37:46 +02:00
Vadim Zeitlin
b22e361245 Restore explicit conversion to UTF-8 in wxGTK wxWebView code
This was somehow removed by af8f7f33c3 but
is needed: implicit conversion uses the current locale encoding, which
is often, but _not_ always, UTF-8, while we always need to use UTF-8
with WebKit functions.
2017-10-22 23:37:44 +02:00
Vadim Zeitlin
ae88141fa0 Don't define unnecessary constants in public webview_ie.h
There is no need to check that calling MSWSetModernEmulationLevel()
changed the registry key in the test, this is just an implementation
detail of this function.

This makes it unnecessary to define wxIE_EMULATION_LEVEL and
wxREGISTRY_IE_PATH (which are both badly named) in the public header.

Finally, improve the error message in MSWSetModernEmulationLevel() and
add another one for failing to reset the emulation level too.
2017-10-22 23:37:42 +02:00
Vadim Zeitlin
732cb97af3 Don't prompt before running canned JavaScript in the sample
This is more annoying than helpful, just run the script without
prompting and do remember the last snippet we ran to show it in the
interactive "Run Script" dialog later if necessary.
2017-10-22 23:37:38 +02:00
Vadim Zeitlin
9d6bd9a52d Fix webkit_web_view_run_javascript() callback signature
Don't use wrong types and then cast the function pointer to the right
type, but just use the correct type from the beginning.

Also make the callback extern "C", as it should be, to be called from C
code.
2017-10-22 23:37:36 +02:00
Vadim Zeitlin
b0d2375941 Revert "Changed url on webview sample"
This reverts commit 92ae25ec3c240217f5584372abadaabedd3952df.

There doesn't seem to be any good reason to use wiki.wxwidgets.org
instead of the main site.
2017-10-22 23:37:34 +02:00
Vadim Zeitlin
1bb8cd860a Improve and harmonize error reporting in RunScript()
Errors were reported in different ways (including not being reported at
all in wxMSW) in different ports. Try to consistently do it in the same
way now and use exactly the same sentences to facilitate translators
life.
2017-10-22 23:37:32 +02:00
Vadim Zeitlin
b3bd9c77af No changes, just declare the variable before its use
Move variable declaration where it's really needed.
2017-10-22 23:37:28 +02:00
Vadim Zeitlin
d047bf2beb Make CallEval() simpler to use by taking a string in it
Don't force the caller to convert the string to wxVariant when we can
perfectly well do it ourselves.
2017-10-22 23:37:26 +02:00
Vadim Zeitlin
8f42fec21a Pass wxAutomationObject by reference to CallEval()
Using pointer here makes no sense: this parameter can never be null and
we don't even have the excuse of making it simpler to call like this as
the caller has an object and not a pointer to it, so this even results
in extra typing.
2017-10-22 23:37:24 +02:00
Vadim Zeitlin
408ee0523c Move RunScriptInternal() out of wxWebViewIE and rename
There is no need for this function to be a class member.
2017-10-22 23:37:22 +02:00
Vadim Zeitlin
b66632fc6d Simplify RunScript()-related code in webview sample
There is no need to pass "result" to this function when it's never used
outside of it.

And it can use the correct message depending on the value of its input
instead of having to provide it in the caller.
2017-10-22 23:37:20 +02:00
Vadim Zeitlin
ce0de68f13 Fix recurring "messege" typo in webview sample 2017-10-22 23:37:16 +02:00
Vadim Zeitlin
70c8979223 Add wxCHECK_MSG() to wxGTK RunScript() implementation too
Don't crash if RunScript() is called on a not yet created object.

This is also consistent with the macOS version of the code.
2017-10-22 23:37:14 +02:00
Vadim Zeitlin
9884b0b4ea Remove redundant check for m_webView in wxOSX code
wxCHECK_MSG() is enough, there is really no need to check for the same
condition twice, this is just confusing.
2017-10-22 23:37:12 +02:00
Vadim Zeitlin
74e60b39f8 No changes, just get rid of gratuitous difference
Don't add an extra line unrelated to JavaScript changes on this branch.
2017-10-22 23:37:10 +02:00
Vadim Zeitlin
ee9615b9ac Consistently capitalize "JavaScript"
This is the proper name of the language, not "Javascript".
2017-10-22 00:26:33 +02:00
Vadim Zeitlin
ec54ddb66b No real changes, just reformat the code a little
Put long function calls on multiple lines.
2017-10-22 00:26:33 +02:00
Vadim Zeitlin
9d9f692024 Get rid of nonsensical "&*" construct in RunScriptSync()
Just pass JS result object directly to the WebKit function, there is
really no need to dereference it and then take its address for this.
2017-10-22 00:26:32 +02:00
Vadim Zeitlin
0e2f6e5c52 Fix memory leak in wxGTK RunScriptSync()
We must call g_object_unref() on an object that we called g_object_ref()
before.
2017-10-22 00:26:32 +02:00
Vadim Zeitlin
55beb9f7e8 Get rid of unnecessary casts in RunScriptSync()
No real changes, just simplify the code.
2017-10-22 00:26:32 +02:00
Vadim Zeitlin
4476bd646d Get rid of separate JSResultToString() function
This function was used only once and didn't really help understanding
the code and just required extra casts when passing arguments to it, for
some reason.

Just merge it into RunScriptSync() itself.
2017-10-22 00:26:30 +02:00
Vadim Zeitlin
b309487ef6 Rename RunScriptInternal() to RunScriptSync() in wxGTK
This helper function runs a JavaScript script and blocks until it
finishes executing, so try to use a name at least hinting at this
instead of being totally generic and useless.
2017-10-22 00:25:57 +02:00
Vadim Zeitlin
8c6ce2cd59 Improve RunScript() error message when using old WebKit
Don't put WebKit in all capitals and, more importantly, make it clear
that this is related to running JavaScript to the user.
2017-10-21 23:10:42 +02:00
Vadim Zeitlin
6930fff0f4 Minor style changes to private webkit helper classes
Include wx headers using quotes, not angle brackets.

Wrap over long lines.

Don't put space between the function name and its arguments.

Make wxJSStringRef::ToWxString() itself, not its return value, const.

Improve comments.
2017-10-21 23:09:22 +02:00
Jose Lorenzo
af8f7f33c3 Merge wxWebView JavaScript improvements branch
This is a squashed commit of the SOC2017_WEBVIEW_JS branch from
https://github.com/joseeloren/wxWidgets.git

Closes https://github.com/wxWidgets/wxWidgets/pull/538
2017-10-21 22:42:30 +02:00
Vadim Zeitlin
9f4f075034 Disable the use of precompiled headers under Unix by default
The speed advantage from using them is very variable, rarely big and
sometimes even negative, while the space penalty is consistently huge,
so it doesn't seem like a good trade-off to enable them by default.
2017-10-21 22:34:45 +02:00
Artur Wieczorek
afdfc02a49 Allow changing wxPropertyGridManager wxPG_EX_NO_TOOLBAR_DIVIDER style
Currently this style can be set only at toolbar creation and cannot
be changed afterwards.
2017-10-21 22:17:54 +02:00
Vadim Zeitlin
0a093193cf Merge branch 'mac-configure-fixes'
Miscellaneous improvements to configure under macOS, see
https://github.com/wxWidgets/wxWidgets/pull/568
2017-10-21 22:12:31 +02:00
Vadim Zeitlin
d5e1851a40 Merge branch 'remove-mac-res'
Remove all Mac resources and related stuff, see
https://github.com/wxWidgets/wxWidgets/pull/567
2017-10-21 22:11:42 +02:00
Vadim Zeitlin
e98d7181b5 Use wxDataViewCtrl::GetTopItem() and GetCountPerPage() in the sample
Demonstrate the use of these methods and also allow testing them easily.

See #17498.
2017-10-21 22:10:35 +02:00
Andreas Falkenhahn
eb035485d7 Add wxDataViewCtrl::GetTopItem() and GetCountPerPage()
Add methods doing the same thing for wxDataViewCtrl as the existing wxListBox
methods.

Closes #17498.
2017-10-21 22:10:35 +02:00
Andreas Falkenhahn
e77cb6f31f Improve wxListBox::GetCountPerPage() in wxGTK and wxOSX
Provide native implementation of this function instead of using the ad hoc one
in common code, which didn't really work -- so remove it completely now.

Closes #17189.
2017-10-21 22:10:35 +02:00
Andreas Falkenhahn
accf7ab117 Add wxFontPickerCtrl::SetMinPointSize()
Allow setting the minimal, as well as maximal, point size.

Closes #17126.
2017-10-21 22:10:35 +02:00
Vadim Zeitlin
60c93971b3 Merge branch 'dvc-compare-values'
Fix comparing items with checkboxes in wxTreeListCtrl and make it
simpler to correctly implement item comparison in other
wxDataViewCtrl-derived classes.

See https://github.com/wxWidgets/wxWidgets/pull/558
2017-10-21 19:59:12 +02:00
Vadim Zeitlin
6974280ee1 Merge branch 'better-assert-dialog'
Use wxRichMessageDialog for showing asserts if possible.
2017-10-21 19:55:15 +02:00
Vadim Zeitlin
d9e4f72fd2 Remove unused configure --enable-objc_uniquifying option
This was only ever used in the alternative wxCocoa port which was itself
removed quite a long time ago.
2017-10-21 19:06:33 +02:00
Vadim Zeitlin
7b373703f7 Only use macOS-specific options when configuring for macOS
Don't even check for options such as --with-macosx-xxx or
--enable-universal_binaries when not targeting macOS, as they only make
sense for this platform.
2017-10-21 19:04:20 +02:00
Vadim Zeitlin
4754621959 Do Mac-specific checks in configure for all ports under Darwin
Configure options such as --enable-universal_binary or
--with-macosx-version-min should be taken into account for any port
being built under macOS, not just wxOSX itself.

In particular, this ensures that PCH and dependencies tracking is
correctly disabled automatically when building universal wxGTK
libraries.

Closes #15454.
2017-10-21 18:59:16 +02:00
Vadim Zeitlin
a1a3efe03b Use wxRichMessageDialog for showing assertion failures
This allows to hide the long (and possibly not fitting on the screen)
call stack by default to avoid intimidating people not used to it and
provides a much more clear way to ignore the subsequent asserts, by
clicking a dedicated checkbox instead of having to choose the "Cancel"
button which didn't make much sense.

See #15430.
2017-10-21 18:19:35 +02:00
Vadim Zeitlin
352a06ad22 Remove old Carbon Mac resource files themselves
They are not used any longer.
2017-10-21 17:49:34 +02:00
Vadim Zeitlin
c77c43cf8c Remove checks for Carbon Mac tools not used any longer
We don't use Rez, DeRez and SetFile any longer and they are not
referenced in bakefile-generated makefiles any longer since the previous
commit.
2017-10-21 17:47:33 +02:00