Difference between revisions of "Refactoring projects"
Jump to navigation
Jump to search
(55 intermediate revisions by 3 users not shown) | |||
Line 7: | Line 7: | ||
See [[Refactoring plan]] for guidelines on how to refactor. | See [[Refactoring plan]] for guidelines on how to refactor. | ||
'''''Attention: Some of these suggestions might not make sense''' or have better solutions. For example instead of moving some unused function to a different file, you should remove it. Apply the [[Refactoring plan#Principles|principles]] of adding unit tests and adding documentation (doxygen comments).'' | |||
= Little Projects = | = Little Projects = | ||
* Derive SPStar from SPShape (not SPPolygon), update 'object/README'. | * <strike>Derive SPStar from SPShape (not SPPolygon), update 'object/README'.</strike> | ||
* Move sp-item-transform.h functions into SPItem. | * <strike>Move sp-item-transform.h functions into SPItem.</strike> See: https://gitlab.com/inkscape/inkscape/-/merge_requests/2976 | ||
* Move sp-item-update-cns.h function into SPItem. | * <strike>Move sp-item-update-cns.h function into SPItem.</strike> [https://gitlab.com/inkscape/inkscape/-/commit/fc026649f3667eb840b995ef2f61e829036c20ba Removed] | ||
* Move sp-item-rm-unsatisfied-cns.h function into SPItem. | * <strike>Move sp-item-rm-unsatisfied-cns.h function into SPItem.</strike> [https://gitlab.com/inkscape/inkscape/-/commit/fc026649f3667eb840b995ef2f61e829036c20ba Removed] | ||
* Remove config.h code (or document why it is needed). DOCUMENT/Autogenerated | * <strike>Remove config.h code (or document why it is needed).</strike> DOCUMENT/Autogenerated | ||
* Remove macros.h (or document why it is needed). | * <strike>Remove macros.h (or document why it is needed).</strike> [https://gitlab.com/inkscape/inkscape/-/commit/d6b062f355dd643012f4870727813965cd142978 Removed] | ||
* Remove dependence on Glib::object in ResourceManager(). | * <strike>Remove dependence on Glib::object in ResourceManager().</strike> | ||
* Simplify ResourceManager... it does only one thing: fix broken links. | * <strike>Simplify ResourceManager... it does only one thing: fix broken links.</strike> [https://gitlab.com/inkscape/inkscape/-/commit/9444a1174912fbe6e5c7380cf6500464b06a6e16 Replaced] | ||
* In SPObject one can write: | * In SPObject one can write: | ||
getRepr()->setAttribute("x", "y"); | getRepr()->setAttribute("x", "y"); | ||
Line 24: | Line 26: | ||
These are redundant and neither is really convenient. SPObject perhaps should have it's own setAttribute() function. | These are redundant and neither is really convenient. SPObject perhaps should have it's own setAttribute() function. | ||
* Rename helper-fns.h with a better discriptive name and move to util(?). MOVE/RENAME | * Rename helper-fns.h with a better discriptive name and move to util(?). MOVE/RENAME | ||
* Remove dependence on object-set.h in | * Remove dependence on object-set.h in files in src/livarot directory. | ||
* Evaluate all the functions in io/sys.h/.cpp. See if we can't use standard glib functions. | |||
* <strike>Remove helper/ucompose.hpp and it's use in src/event-log.cpp.</strike> [https://gitlab.com/inkscape/inkscape/-/commit/62b2e789da04bfddd3bc8f5f12b4b627623c78e6 Removed] | |||
* Move functionality of src/line-geometry.h/.cpp into lib2geom or elsewhere. | |||
* <strike>Remove deprecated GDK_POINTER_MOTION_HINT_MASK (motion events are compressed since Gdk 3.8).</strike> [https://gitlab.com/inkscape/inkscape/-/commit/28587f2d2fb0c83bd12c8364994332dea100143b Removed] | |||
* Turn DrawAnchor into a proper class (or figure out how to get rid of it all together). | |||
* Clean up constructors and signals in selcue.cpp. | |||
* <strike>Remove need to write out and read back in a PNG file with createBitmapImage().</strike> [https://gitlab.com/inkscape/inkscape/-/commit/09f2b4a77169d172b81a30b8c638124aeac77e8a Done] | |||
* Remove SPObject::setKeyValue() which only calls set(), refactor duplicate code in two versions of SPObject::readAttr(). | |||
* Move Behavior-Dashes into Behavior-Transforms in Preferences dialog. | |||
* Move Pixbuf out of cairo_utils.h/.cpp into it's on files. Fix ''g_object_unref: assertion 'G_IS_OBJECT (object)' failed'' from destructor. | |||
* Remove global variables from ui/tools/tool-base.cpp | |||
* Removed desktop dependency from hiding/unhiding, locking/unlocking objects and layers. | |||
* Remove widgets/widget-sizes.h Most of this should be replaced by CSS. | |||
* Move spw_label and spw_hbox to stroke-style.cpp (only place they are used) and rename (or maybe don't use). Give better names to sp_search_xxxx and move to ui/?. | |||
* Remove Desktop::setToolboxAdjustmentValue() (used mostly by spray tool, one use each in calligraphic and eraser tools). | |||
* Convert ColorSlider to be derived from Gtk::DrawingArea rather than a GdkWindow. | |||
= Medium Projects = | = Medium Projects = | ||
* Remove god-awful SPWidget (only used for selection). | * <strike>Remove god-awful SPWidget (only used for selection).</strike> Yeah!!! [https://gitlab.com/inkscape/inkscape/-/commit/013141efcf5a6146b2f1f0a889c28c456a45aefe Removed] | ||
* Move most files in 'src' to subdirectories, add ''README'' for each directory with description of contents. (Tav) | * Move most files in 'src' to subdirectories, add ''README'' for each directory with description of contents. (Tav) | ||
* In toolbars, use ''dataKludge'' or ''data'' or ''tbl'' or ''holder'' ... but not all four! (Side benefit of C++ify toolbars.) (Alex) | * <strike>In toolbars, use ''dataKludge'' or ''data'' or ''tbl'' or ''holder'' ... but not all four!</strike> (Side benefit of C++ify toolbars.) (Alex) | ||
* Remove InkAction class. Normal GTK button actions should be able to handle SVG icons... no need for derived class. (Alex) | * <strike>Remove InkAction class. Normal GTK button actions should be able to handle SVG icons... no need for derived class.</strike> (Alex) Done | ||
* Make data members private in SPI::Base and derived class. Add set() function. Default to SP_STYLE_UNSET in constructor, setting to SP_STYLE_SRC_PROP in set(). (Tav) | * Make data members private in SPI::Base and derived class. Add set() function. Default to SP_STYLE_UNSET in constructor, setting to SP_STYLE_SRC_PROP in set(). (Tav) | ||
* Sort out URL/file handling. See [[URIs and Filenames]]. | * Sort out URL/file handling. See [[URIs and Filenames]]. | ||
* Find all the ways we output error/status messages to users (this does not include developer focused error messages that use std::cerr). Pick one and use it everywhere. The goal should be to be able to build Inkscape without a GUI but if the GUI is used, the user will see the messages on the desktop. | |||
* Look at Inkscape::URIReference and derived classes to see if they can't be simplified/templated/etc. | |||
* <strike>Make sp_repr_set_svg_double etc. member functions of Inkscape::XML::Node. [sp_repr_set_svg_double() -> setAttributeSvgDouble()].</strike> | |||
* Redo Save/Export separating Lossless vs Lossy formats. Create one path for all Exports that share processing so that all options (that make sense) are available to all output formats. | |||
* Refactor toolbase and derived classes. The conversion from C to C++ seems to be only partially done. | |||
* Move the functionality found in SPDesktop to SPCanvas or InkscapeWindow, then kill it as well as View! | |||
* Divide display directory into: | |||
** canvas: GUI related routines, move to ui/ | |||
** drawing: Generic rendering routines | |||
* Clean-up Key events. Check to see if get_latin_keyval() can be moved to InkscapeWindow::on_key_press() and removed everywhere else. (Must make sure it doesn't interfere with typing text.) | |||
* Get rid of all Glib::wrap's. | |||
* Git rid of all gobj()'s. | |||
* <strike>Make liblcms2 a hard dependency and git rid of 92 #ifdefs.</strike> [https://gitlab.com/inkscape/inkscape/-/commit/3b4c7c84baecf0f7f75d1dc2db58a0b4555696f5 Done] | |||
* Merge old knot code with "new" control-point code. | |||
* Figure out why the cursor SVG file is reloaded when a drawing file is reverted and stop it from happening. | |||
*Remove GUI dependencies in SPObjects (SPNamedView and Grid for example). | |||
= Large Projects = | = Large Projects = | ||
* C++ify toolbars. (Alex) | * <strike>C++ify toolbars.</strike> (Alex) Multiple commits. | ||
* Convert all GtkActions's and Gtk::Action's to Gio::Action's. See [[GtkAction migration]] (Alex) | * <strike>Convert all GtkActions's and Gtk::Action's to Gio::Action's.</strike> See [[GtkAction migration]] (Alex) Done | ||
* Add a one or two line description of what each file contains at the top of the file if it is missing. (Everyone) | * Add a one or two line description of what each file contains at the top of the file if it is missing. (Everyone) | ||
* Remove livarot, moving any needed functionality into lib2geom or other files. | * Remove livarot, moving any needed functionality into lib2geom or other files. | ||
* Remove desktop dependence on reading and setting style on a document. In particular remove sp_desktop_set_style(). | |||
* <strike>C++ify SPCanvasItem and all its derived class.</strike> [https://gitlab.com/inkscape/inkscape/-/commit/17b002864216f3f5db4a7ccf10fffb154a99fe7b Done] | |||
= Super Large Projects = | = Super Large Projects = | ||
* Convert verbs to Gio::Action's. | * <strike>Convert verbs to Gio::Action's.<strike> Done | ||
* Convert GUI to XML files. (Long term.) | * Convert GUI to XML files. (Long term.) | ||
* <strike>Invert 'y' coordinate system to match SVG. (Look at previous patch... link?)</strike> | * <strike>Invert 'y' coordinate system to match SVG. (Look at previous patch... link?)</strike> |
Latest revision as of 07:16, 15 April 2023
A List of Refactoring Projects
See Development Project Ideas and Funded Project Ideas for more possible projects.
See Refactoring plan for guidelines on how to refactor.
Attention: Some of these suggestions might not make sense or have better solutions. For example instead of moving some unused function to a different file, you should remove it. Apply the principles of adding unit tests and adding documentation (doxygen comments).
Little Projects
Derive SPStar from SPShape (not SPPolygon), update 'object/README'.Move sp-item-transform.h functions into SPItem.See: https://gitlab.com/inkscape/inkscape/-/merge_requests/2976Move sp-item-update-cns.h function into SPItem.RemovedMove sp-item-rm-unsatisfied-cns.h function into SPItem.RemovedRemove config.h code (or document why it is needed).DOCUMENT/AutogeneratedRemove macros.h (or document why it is needed).RemovedRemove dependence on Glib::object in ResourceManager().Simplify ResourceManager... it does only one thing: fix broken links.Replaced- In SPObject one can write:
getRepr()->setAttribute("x", "y");
or
setKeyValue( sp_attribute_lookup("x"), "y");
These are redundant and neither is really convenient. SPObject perhaps should have it's own setAttribute() function.
- Rename helper-fns.h with a better discriptive name and move to util(?). MOVE/RENAME
- Remove dependence on object-set.h in files in src/livarot directory.
- Evaluate all the functions in io/sys.h/.cpp. See if we can't use standard glib functions.
Remove helper/ucompose.hpp and it's use in src/event-log.cpp.Removed- Move functionality of src/line-geometry.h/.cpp into lib2geom or elsewhere.
Remove deprecated GDK_POINTER_MOTION_HINT_MASK (motion events are compressed since Gdk 3.8).Removed- Turn DrawAnchor into a proper class (or figure out how to get rid of it all together).
- Clean up constructors and signals in selcue.cpp.
Remove need to write out and read back in a PNG file with createBitmapImage().Done- Remove SPObject::setKeyValue() which only calls set(), refactor duplicate code in two versions of SPObject::readAttr().
- Move Behavior-Dashes into Behavior-Transforms in Preferences dialog.
- Move Pixbuf out of cairo_utils.h/.cpp into it's on files. Fix g_object_unref: assertion 'G_IS_OBJECT (object)' failed from destructor.
- Remove global variables from ui/tools/tool-base.cpp
- Removed desktop dependency from hiding/unhiding, locking/unlocking objects and layers.
- Remove widgets/widget-sizes.h Most of this should be replaced by CSS.
- Move spw_label and spw_hbox to stroke-style.cpp (only place they are used) and rename (or maybe don't use). Give better names to sp_search_xxxx and move to ui/?.
- Remove Desktop::setToolboxAdjustmentValue() (used mostly by spray tool, one use each in calligraphic and eraser tools).
- Convert ColorSlider to be derived from Gtk::DrawingArea rather than a GdkWindow.
Medium Projects
Remove god-awful SPWidget (only used for selection).Yeah!!! Removed- Move most files in 'src' to subdirectories, add README for each directory with description of contents. (Tav)
In toolbars, use dataKludge or data or tbl or holder ... but not all four!(Side benefit of C++ify toolbars.) (Alex)Remove InkAction class. Normal GTK button actions should be able to handle SVG icons... no need for derived class.(Alex) Done- Make data members private in SPI::Base and derived class. Add set() function. Default to SP_STYLE_UNSET in constructor, setting to SP_STYLE_SRC_PROP in set(). (Tav)
- Sort out URL/file handling. See URIs and Filenames.
- Find all the ways we output error/status messages to users (this does not include developer focused error messages that use std::cerr). Pick one and use it everywhere. The goal should be to be able to build Inkscape without a GUI but if the GUI is used, the user will see the messages on the desktop.
- Look at Inkscape::URIReference and derived classes to see if they can't be simplified/templated/etc.
Make sp_repr_set_svg_double etc. member functions of Inkscape::XML::Node. [sp_repr_set_svg_double() -> setAttributeSvgDouble()].- Redo Save/Export separating Lossless vs Lossy formats. Create one path for all Exports that share processing so that all options (that make sense) are available to all output formats.
- Refactor toolbase and derived classes. The conversion from C to C++ seems to be only partially done.
- Move the functionality found in SPDesktop to SPCanvas or InkscapeWindow, then kill it as well as View!
- Divide display directory into:
- canvas: GUI related routines, move to ui/
- drawing: Generic rendering routines
- Clean-up Key events. Check to see if get_latin_keyval() can be moved to InkscapeWindow::on_key_press() and removed everywhere else. (Must make sure it doesn't interfere with typing text.)
- Get rid of all Glib::wrap's.
- Git rid of all gobj()'s.
Make liblcms2 a hard dependency and git rid of 92 #ifdefs.Done- Merge old knot code with "new" control-point code.
- Figure out why the cursor SVG file is reloaded when a drawing file is reverted and stop it from happening.
- Remove GUI dependencies in SPObjects (SPNamedView and Grid for example).
Large Projects
C++ify toolbars.(Alex) Multiple commits.Convert all GtkActions's and Gtk::Action's to Gio::Action's.See GtkAction migration (Alex) Done- Add a one or two line description of what each file contains at the top of the file if it is missing. (Everyone)
- Remove livarot, moving any needed functionality into lib2geom or other files.
- Remove desktop dependence on reading and setting style on a document. In particular remove sp_desktop_set_style().
C++ify SPCanvasItem and all its derived class.Done
Super Large Projects
Convert verbs to Gio::Action's.Done- Convert GUI to XML files. (Long term.)
Invert 'y' coordinate system to match SVG. (Look at previous patch... link?)