John Ralls
fba0248548
Support different GncOptionMultichoiceValue key types.
...
Scheme can use strings, symbols, or ints as keys in multichoice options,
but C++ can handle only strings. Add conversion and tracking so that the
right key type gets sent back to Scheme.
2021-07-31 17:54:29 -07:00
John Ralls
55a2ed1df8
gnc-optiondb.i uses functions declared in gnc-optiondb.h.
...
So it needs it declared in the swig file.
2021-07-31 17:54:29 -07:00
John Ralls
18b83874fd
Another bit of Remove test-option-utils
2021-07-31 17:54:29 -07:00
John Ralls
0b7ccfbd5b
Create gnc-make-foo-option functions.
...
For compatibility with current Scheme code.
2021-07-31 17:54:29 -07:00
John Ralls
a602f64b17
SFINAE-constrain the GncOption constructor templates.
...
So that one can't instantiate an invalid constructor.
Unfortunately Swig doesn't understand SFINAE and will try to create the
invalid constructors anyway but at least this generates a compile-time
error when it tries to.
2021-07-31 17:54:29 -07:00
John Ralls
43f4bcb610
Make GncOptionUIType an enum class.
...
So that Swig will create properly constrained identifiers for its values.
2021-07-31 17:54:29 -07:00
John Ralls
7fa6778b4b
Add a register_option overload to GncOptionDB
...
For compatibility with existing scheme code.
2021-07-31 17:54:29 -07:00
John Ralls
cb7270cafe
Fix myriad gcc10 complaints.
2021-07-31 17:54:29 -07:00
John Ralls
76b0001cbe
Remove option-util.
2021-07-31 17:54:29 -07:00
John Ralls
e2c87f23c3
Convert optiondb users in gnome and gnome-utils to C++.
...
To enable using std::unique_ptr<GncObjectDB> and avoid memory management
problems.
2021-07-31 17:54:29 -07:00
John Ralls
ea835b31b7
Provide GncOptionPtr& overloads for register-option functions.
...
Simplifies and makes safer calls from Scheme and C++ by not requiring
a raw pointer.
2021-07-31 17:54:29 -07:00
John Ralls
472814d315
Change the normal internal option ValueType to SCM.
...
Internal options are used as a Scheme hack and don't need to be interpreted
on the C side so there's no point in converting them to C types.
2021-07-31 17:54:29 -07:00
John Ralls
e48416010d
Remove redundant GncOptionDB decl.
2021-07-31 17:54:29 -07:00
John Ralls
7022f5222d
Revert gnc_option_db_lookup|set_glist_value to ...scm_value.
...
GLists and SCM lists are not interchangeable.
2021-07-31 17:54:29 -07:00
John Ralls
8c77ce967b
Implement and test obsolete option name aliasing.
2021-07-31 17:54:29 -07:00
John Ralls
90b8fce59f
Fix build after merge.
2021-07-31 17:54:29 -07:00
John Ralls
4f3fd665cf
Fix counter and counter_format storage in KVP.
...
So that they go to their own slots instead of to the options slot.
2021-07-31 17:54:29 -07:00
John Ralls
b19f3d383c
Protect some exceptions from being passed to Swig.
2021-07-31 17:54:29 -07:00
John Ralls
52600bbd1f
Instantiate gnc_register_number_range_option templates in SWIG.
2021-07-31 17:54:28 -07:00
John Ralls
31a0153fec
Another GncOptionDBPtr fix.
2021-07-31 17:54:28 -07:00
John Ralls
85db341afe
Remove test-option-utils
...
It no longer works. Since that's all that test-app-utils called,
delete it too.
2021-07-31 17:54:28 -07:00
John Ralls
21398dfda1
Testing fixups for using GncOptionDB* in register_option functions.
2021-07-31 17:54:28 -07:00
John Ralls
7dab089d49
Fix miscalculation of prev_quarter_end for the first quarter.
...
If the current quarter ends June 30 backing up 3 months from there
gets March 30, one day off. Back up first and calculate the end
of the actual quarter of interest.
Changed pre_quarter_start for consistency, it doesn't matter.
2021-07-31 17:54:28 -07:00
John Ralls
d1cfd62f31
Fix loading text fields from KVP into options.
2021-07-31 17:54:28 -07:00
John Ralls
276d33975a
Remove dialog-options.c, replaced by dialog-options.cpp.
...
Adds new function reset_default_value to GncOption; doing it outside
of the class requires knowing the Type of m_value.
2021-07-31 17:54:28 -07:00
John Ralls
5f9c66aa61
Save all options to KVP if clear_options is true.
2021-07-31 17:54:28 -07:00
John Ralls
6491c98563
Clean up some omitted type-forcing in set_option_from_ui_type() instances.
2021-07-31 17:54:28 -07:00
John Ralls
245a8fccc7
Correctly select UI types for GUID output.
2021-07-31 17:54:28 -07:00
John Ralls
c751e56184
Fix fail to load or save number-range values in KVP.
2021-07-31 17:54:28 -07:00
John Ralls
010ab1a965
Fix free of unallocated ptr crash.
2021-07-31 17:54:28 -07:00
John Ralls
4a4e5d36f8
Enable gnc_register_owner_option to handle the three types that GncOwner aliases.
2021-07-31 17:54:28 -07:00
John Ralls
d8f83d6ee6
Boolean simple won't work if its UI type is INTERNAL.
2021-07-31 17:54:28 -07:00
John Ralls
3514725a97
Make gnc_register_number_range_option a template on ValueType.
...
GtkSpinButton works with doubles, but we want to preserve the
ability to use other types.
It really should have enable_if<is_arithmetic(ValueType)>.
2021-07-31 17:54:28 -07:00
John Ralls
e78c012699
Fill in the book options.
2021-07-31 17:54:28 -07:00
John Ralls
ae79fd016d
More skeletons
2021-07-31 17:54:28 -07:00
John Ralls
28438e3126
Rewire gnome and gnome-utils to use GncOptionDB.
2021-07-31 17:54:28 -07:00
John Ralls
41e59df71f
Remove unused and un-needed function.
2021-07-31 17:54:28 -07:00
John Ralls
1eef796f09
Add some skeleton functions to make the option-using code in gnucash/gnome-utils and gnucash/gnome happy.
2021-07-31 17:54:28 -07:00
John Ralls
99103ffd10
Change gnc-register-option functions to take GncOptionDB*.
...
Instead of std::unique_ptr<GncOptionDB> because there's no way
to get a unique_ptr through a C call.
2021-07-31 17:54:28 -07:00
John Ralls
9111f118e0
Business option create_option_widget specializations.
...
Required creating a registration class for create_option_widget
overload functions because without it the dispatch function
complained of missing symbols at link time.
2021-07-31 17:54:28 -07:00
John Ralls
01c0fe2364
Include what we use.
2021-07-31 17:54:28 -07:00
John Ralls
25b717d47a
Add a rudimentary C API for GncOptionDB.
...
So that most of the gnome-util and gnome consumers don't need to
be converted to C++.
Hide the corresponding functions in options-utils to stop the
compiler whining.
Note that this commit breaks the build but is necessary at
least temporarily to compartmentalize the changes.
2021-07-31 17:54:28 -07:00
John Ralls
4451f58bd6
Rename RelativeDatePeriods missed earlier.
2021-07-31 17:54:28 -07:00
John Ralls
6feb92d4e8
Provide scheme function new-gnc-optiondb.
...
Wraps creating a GncOptionDBPtr, freeing up gnc_option_db_new() to
return a GncOptionDB* for use in C code. Convert gnc_option_db_new()
calls in gtest-gnc-optiondb to call std::make_unique() as well.
2021-07-31 17:54:28 -07:00
John Ralls
f9e136dbac
Get the spelling of GncMultichoiceOptionEntry consistent.
2021-07-31 17:54:28 -07:00
John Ralls
eb6e31f803
dialog-options: Change signature of gnc_option_get_gtk_widget()
...
So that it can be called from C.
2021-07-31 17:54:28 -07:00
John Ralls
67508ea039
Reimplement dialog-options for C++.
2021-07-31 17:54:28 -07:00
John Ralls
3b4785e744
Convert GncOptionSection from a std::pair to a class.
...
Provides find_option(const char*) and foreach_option(func) for easy
iteration. find_option and find_section now return plain const ptrs
instead of std::optionals. Much less cumbersome though the compiler
won't nag if you forget the nullptr check.
2021-07-31 17:54:28 -07:00
John Ralls
c63db36a60
Rename string_equal_charptr to operator==(const std::string&, const char*)
...
Much prettier and more idiomatic as well as being a lot less typing.
2021-07-31 17:54:28 -07:00
John Ralls
0106176436
Provide GncOption::is_alternate() for GncOptionRangeValue<>.
...
Needed for GncOptionUIType::PLOT_SIZE to indicate whether the option
value represents pixels or percent.
2021-07-31 17:54:28 -07:00