diff --git a/admin/rfc.sh b/admin/rfc.sh index 24f720d26..5efbd0d46 100755 --- a/admin/rfc.sh +++ b/admin/rfc.sh @@ -316,7 +316,7 @@ function change_state() local state="$2" local nl=$'\n' - local comment="$state$nl//add reason$nl $(date +%c) $(git config --get user.name) <$(git config --get user.email)>$nl" + local comment=".State -> $state$nl//add reason$nl $(date +%c) $(git config --get user.name) <$(git config --get user.email)>$nl" edit_state "$name" "$state" "$comment" edit "$name" -4 "endof_comments" process "$name" diff --git a/doc/devel/rfc_pending/ApplicationInstall.txt b/doc/devel/rfc_pending/ApplicationInstall.txt new file mode 100644 index 000000000..44ed4cdea --- /dev/null +++ b/doc/devel/rfc_pending/ApplicationInstall.txt @@ -0,0 +1,225 @@ +ApplicationInstall +================== + +// please don't remove the //word: comments + +[grid="all"] +`------------`----------------------- +*State* _Draft_ +*Date* _Di 11 Jan 2011 17:00:55 CET_ +*Proposed by* Ichthyostega +------------------------------------- + +[abstract] +********************************************************************************* +Lumiera should be a _freely relocatable_ application bundle. +Relying only on the relative folder structure within this bundle, the application +will be fully functional at any location, provided that the external library +dependencies are resolvable using the standard mechanisms of the platform. +The setup mechanism must be obvious, self-explanatory and must not rely +on compiled in magic or buildsystem trickery. Yet packaging into a FSH conforming +installation location should be supported by the same mechanisms. +********************************************************************************* + +Description +----------- +//description: add a detailed description: +Lumiera is planned to become a large professional application bundle, relying +on several external resources for proper operation. An installed Lumiera +application will be more like Gimp, Blender, OpenOffice or Eclipse, +not like bash, autotools or emcas. + +Besides that, it can be expected that Lumiera frequently will be used in a +project or studio like setup, where the application isn't installed, but just +unZIPped / unTARed and used as-is. Thus, it should be sufficient to unpack +the application bundle and point it to the session file and maybe the +media storage. + +The Eclipse platform can serve as a model for the setup of an modern +application of that style: It can be just unpacked, and when looking +into the folder structure, the meaning of the parts is obvious, and the +basic bootstrap is controlled by two short text based INI files. +While Lumiera presumably won't get _that_ heavyweight and is clearly +not intended to become a general business application platform like OSGi -- +the underlying principles can serve as a point of reference for modern +development standards. + +This leads to the following conclusions: + +- we need to define a standard folder layout for the bundle +- the application must not rely on any compiled-in absolute paths +- the executable should fetch the directly accompanying shared modules +- all other lib dependencies should be handled by the system mechanisms +- the bootstrap configuration likewise must not be compiled-in +- this configuration must be human readable and clearly exhibit its purpose +- the same system must be able to adapt to a FSH conforming installation layout + +Judging from our current planning and the existing codebase, Lumiera +is on a good way in that direction, yet some cleanup needs to be done, +especially removing convenience shortcuts from the early days of development +and catching up with the repair of some traits of sloppyness here and there. + +Library resolution +~~~~~~~~~~~~~~~~~~ +In former days, it was common habit to compile-in a hard wired absolute ++RPATH+. This can be considered obsolete practice; for example, the Debian +policy forbids doing so. This is the result from numerous maintainability +problems in the past. On the other hand, the GNU linker and other modern +linkers support a relative resolution of shared modules directly accompanying +an specific executable. The Debian policy allows this, if and only if these +shared modules are installed with the same binary package and only used by +this specific executable(s). Together, this is exactly what we need to +solve our requirement. + +Thus, the build process enables the new-style DT-tags in the Elf binary +and sets the +DT_RUNPATH+ with an value relative to +$ORIGIN+, which resolves +to the path of the currently executing binary. Moreover, it is _sufficient_ +to set this on the initial executable _only,_ because this creates a common +searchpath for all lib resolution events in the scope of that loaded executable. +Besides that, we need to care that our private libraries have a unique +SONAME+, +in this case all starting with the prefix +liblumiera*+. Note moreover that this +new-style +DT_RUNPATH+ indeed _can_ be overridden by an +LD_LIBRARY_PATH+ in the +environment, should there be the need for very special experiments. + +Bootstrap location +~~~~~~~~~~~~~~~~~~ +Thus, a single relative library folder becomes the only hard wired start +configuration. In our case, the folder +$ORIGIN/modules+ was chosen. The +root of the package then holds all the binaries depending on these common +internal libraries, that is the +lumiera+ executable and any accompanying +special tools. As usual with such large application bundles, these get +only _symlinked_ into the +/usr/bin+ folder on installation. + +For sake of clarity, after starting the executable, the _same location_ +is used to load the bootstrap configuration. This configuration in turn +defines all further locations like the extended configuration, project +templates, plugin search path, the GUI module to load, the search path +for icons and GUI resources, project templates and similar basics. + +Relative paths and the location of the executable +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +According to the general requirements outlined above, most paths should +be given in a relative fashion. Unfortunately there is no portable solution +for self-discovering the currently running executable. But at least there +is a solution for all current major platforms. Under Linux, this information +can be retrieved from the kernel through the +/proc+ filesystem. + +Again for sake of clarity, the same token +$ORIGIN+ was chosen to denote +this executable location (note: this is _not_ the current working directory). +Moreover, due to the folder layout detailed above, this coincides with the +root of the application bundle, thus making for a self-explanatory convention. +Besides +$ORIGIN+, these search paths later on likely will contain locations +below the user's home directory, e.g. +~/.lumiera/themes+ + + +Tasks +~~~~~ +// List what needs to be done to implement this Proposal: +* identify what impedes such a modern setup procedure ([green]#✔ done#) +* rectify the folder structure created in the build target + directory ([green]#✔ done#) +* build the executables in a way to allow relative resolution of the + internal shared modules ([green]#✔ done#) +* replace the compiled-in path definitions for plugin loading by a + configurable bootstrap ([green]#✔#) +* add an working library implementation for a config loader ([green]#✔ done#) +* add a mechanism for establishing the path of the current execubable. + + This is _non-portable_ ([green]#✔ done#) +* wire the prepared API in the GUI to use this working config loader + for resolving GUI resources ([green]#✔ done#) +* try to extract the path search code from the existing config loader, + or build a new solution based on standard libraries ([green]#✔ done#) +* introduce an output root directory into the buildsystem, allowing + for package builds ([green]#✔#) +* define a _Debian packaging_ as proof-of-concept ([green]#✔ done#) + + +Discussion +~~~~~~~~~~ + +Pros +^^^^ +* self-contained +* self-explanatory +* based on _best practices_ +* conforming with FSH and Debian policy + + +Cons +^^^^ +* requires work +* raises the bar at the implementation side +* requires an bootstrap sequence to be explicitly performed + on application startup +* breaks with some beloved habits of the Unix community + + +Alternatives +^^^^^^^^^^^^ +//alternatives: explain alternatives and tell why they are not viable: +I can think of two alternatives + +. dealing with all those problems _later_ +. not making an concept, rather sticking to UNIX habits + +The first alternative is indeed worth considering, because we're settling +some things to be really implemented way later, which bears some dangers. +But, on the other hand, it is a common practice known from extreme programming +to deliver early and regularly, which effectively means to set up the deploy +path of an application really early in the development cycle. The rationale +is that -- according to general experience -- the deployment always turns +up some very specific problems and constraints, which can be a serious +threat when discovered late in the development process. + +The second alternative isn't really applicable IMHO. The original UNIX philosophy +breeds on an academic setup and really excels with small nifty commandline utils +combined by pipes, each specialised to do a single thing very well. These utils +are more like the objects within our implementation. The concept of large +application software bundles and desktop software was always a bit alien +within the classic UNIX environment. + + + +Rationale +--------- +//rationale: Give a concise summary why it should be done *this* way: + +This RfC can be seen as an commitment to an professional approach and as +clarification: Traditionally, the Unix community hailed a lot of _black magic_ +practices like compiled-in installation paths, macro magic, +sed+ and +awk+ +trickery, inline code compiled on-the-fly, relying on very specific and +un-obvious behaviour of some build script, configuration via environment +variables and a lot of similar idioms. These practices might be adequate +in a quickly moving Research & Development setup, but turned out to be +not so helpful when it comes to industrial strength development, +as they are known to lead to maintenance problems. + + + + +//Conclusion +//---------- +//conclusion: When approbate (this proposal becomes a Final) +// write some conclusions about its process: + + + + +Comments +-------- +//comments: append below + +.State -> Draft +There is now a complete implementation of this concept on my ``proc'' branch. + +Moreover, I was able to define an initial Debian packaging for Lumiera on top +of that implementation. + +During that work, I had opportunity to visit various areas of the existing codebase, +which reminded me of several small issues, which seem to become unhealthy when lying +around unfixed for such a long time. Probably I'll start a clean-up initiative and +try to bring these points to discussion separately. + + So 13 Feb 2011 20:04:00 CET Ichthyostega + + +//endof_comments: diff --git a/src/gui/dialogs/name-chooser.cpp b/src/gui/dialogs/name-chooser.cpp index c61527be8..634f2bd07 100644 --- a/src/gui/dialogs/name-chooser.cpp +++ b/src/gui/dialogs/name-chooser.cpp @@ -20,7 +20,7 @@ * *****************************************************/ -#include "../gtk-lumiera.hpp" +#include "gui/gtk-lumiera.hpp" #include "name-chooser.hpp" #include "dialog.hpp" diff --git a/src/gui/dialogs/name-chooser.hpp b/src/gui/dialogs/name-chooser.hpp index 0794e6427..52a156c03 100644 --- a/src/gui/dialogs/name-chooser.hpp +++ b/src/gui/dialogs/name-chooser.hpp @@ -27,7 +27,7 @@ #ifndef NAME_CHOOSER_H #define NAME_CHOOSER_H -#include "../gtk-lumiera.hpp" +#include "gui/gtk-lumiera.hpp" namespace gui { namespace dialogs { diff --git a/src/gui/dialogs/preferences-dialog.cpp b/src/gui/dialogs/preferences-dialog.cpp index 4db367360..183b4858d 100644 --- a/src/gui/dialogs/preferences-dialog.cpp +++ b/src/gui/dialogs/preferences-dialog.cpp @@ -20,7 +20,7 @@ * *****************************************************/ -#include "../gtk-lumiera.hpp" +#include "gui/gtk-lumiera.hpp" #include "preferences-dialog.hpp" #include "dialog.hpp" diff --git a/src/gui/dialogs/preferences-dialog.hpp b/src/gui/dialogs/preferences-dialog.hpp index 62a37ed07..1ba7d7f27 100644 --- a/src/gui/dialogs/preferences-dialog.hpp +++ b/src/gui/dialogs/preferences-dialog.hpp @@ -27,7 +27,7 @@ #ifndef PREFERENCES_DIALOG_HPP #define PREFERENCES_DIALOG_HPP -#include "../gtk-lumiera.hpp" +#include "gui/gtk-lumiera.hpp" namespace gui { namespace dialogs { diff --git a/src/gui/dialogs/render.cpp b/src/gui/dialogs/render.cpp index 6178c014c..e4a9b774b 100644 --- a/src/gui/dialogs/render.cpp +++ b/src/gui/dialogs/render.cpp @@ -20,7 +20,7 @@ * *****************************************************/ -#include "../gtk-lumiera.hpp" +#include "gui/gtk-lumiera.hpp" #include "render.hpp" #include "dialog.hpp" diff --git a/src/gui/dialogs/render.hpp b/src/gui/dialogs/render.hpp index 8d586c398..470cc5ae8 100644 --- a/src/gui/dialogs/render.hpp +++ b/src/gui/dialogs/render.hpp @@ -27,7 +27,7 @@ #ifndef RENDER_HPP #define RENDER_HPP -#include "../gtk-lumiera.hpp" +#include "gui/gtk-lumiera.hpp" namespace gui { namespace dialogs { diff --git a/src/gui/model/track.hpp b/src/gui/model/track.hpp index 6dc5d2b71..7517219a7 100644 --- a/src/gui/model/track.hpp +++ b/src/gui/model/track.hpp @@ -24,7 +24,7 @@ ** represents a track, and wraps proc layer data */ -#include "../gtk-lumiera.hpp" +#include "gui/gtk-lumiera.hpp" #ifndef TRACK_HPP #define TRACK_HPP diff --git a/src/gui/output/displayer.cpp b/src/gui/output/displayer.cpp index 251279a9a..fc82ebb3e 100644 --- a/src/gui/output/displayer.cpp +++ b/src/gui/output/displayer.cpp @@ -22,7 +22,7 @@ * *****************************************************/ -#include "../gtk-lumiera.hpp" +#include "gui/gtk-lumiera.hpp" #include "displayer.hpp" #include "xvdisplayer.hpp" #include "gdkdisplayer.hpp" diff --git a/src/gui/output/gdkdisplayer.cpp b/src/gui/output/gdkdisplayer.cpp index 1d6f96214..e07f4717b 100644 --- a/src/gui/output/gdkdisplayer.cpp +++ b/src/gui/output/gdkdisplayer.cpp @@ -22,7 +22,7 @@ * *****************************************************/ -#include "../gtk-lumiera.hpp" +#include "gui/gtk-lumiera.hpp" #include #include diff --git a/src/gui/output/xvdisplayer.cpp b/src/gui/output/xvdisplayer.cpp index 4c0780101..f9aa71553 100644 --- a/src/gui/output/xvdisplayer.cpp +++ b/src/gui/output/xvdisplayer.cpp @@ -22,7 +22,7 @@ * *****************************************************/ -#include "../gtk-lumiera.hpp" +#include "gui/gtk-lumiera.hpp" #include diff --git a/src/gui/panels/assets-panel.cpp b/src/gui/panels/assets-panel.cpp index 45d4887ee..12010d31c 100644 --- a/src/gui/panels/assets-panel.cpp +++ b/src/gui/panels/assets-panel.cpp @@ -20,7 +20,7 @@ * *****************************************************/ -#include "../gtk-lumiera.hpp" +#include "gui/gtk-lumiera.hpp" #include "assets-panel.hpp" namespace gui { diff --git a/src/gui/panels/panel.cpp b/src/gui/panels/panel.cpp index 4db7a2ff2..4a72e82ff 100644 --- a/src/gui/panels/panel.cpp +++ b/src/gui/panels/panel.cpp @@ -20,12 +20,14 @@ * *****************************************************/ -#include "panel.hpp" -#include "../gtk-lumiera.hpp" -#include "../workspace/panel-manager.hpp" -#include "../workspace/workspace-window.hpp" #include +#include "gui/gtk-lumiera.hpp" +#include "gui/workspace/panel-manager.hpp" +#include "gui/workspace/workspace-window.hpp" + +#include "panel.hpp" + using namespace Gtk; namespace gui { diff --git a/src/gui/panels/panel.hpp b/src/gui/panels/panel.hpp index 5b0ed2afe..0dd39e1e5 100644 --- a/src/gui/panels/panel.hpp +++ b/src/gui/panels/panel.hpp @@ -27,10 +27,10 @@ #ifndef PANEL_HPP #define PANEL_HPP -#include "../gtk-lumiera.hpp" #include -#include "../widgets/panel-bar.hpp" +#include "gui/gtk-lumiera.hpp" +#include "gui/widgets/panel-bar.hpp" namespace gui { diff --git a/src/gui/panels/timeline-panel.cpp b/src/gui/panels/timeline-panel.cpp index 5f564dd90..5c79bbe44 100644 --- a/src/gui/panels/timeline-panel.cpp +++ b/src/gui/panels/timeline-panel.cpp @@ -22,15 +22,15 @@ #include -#include "../gtk-lumiera.hpp" +#include "gui/gtk-lumiera.hpp" #include "timeline-panel.hpp" -#include "../workspace/workspace-window.hpp" -#include "../model/project.hpp" -#include "../controller/controller.hpp" +#include "gui/workspace/workspace-window.hpp" +#include "gui/model/project.hpp" +#include "gui/controller/controller.hpp" extern "C" { -#include "../../lib/time.h" +#include "lib/time.h" } using namespace Gtk; diff --git a/src/gui/panels/timeline-panel.hpp b/src/gui/panels/timeline-panel.hpp index 75df50cd5..afd3b9faa 100644 --- a/src/gui/panels/timeline-panel.hpp +++ b/src/gui/panels/timeline-panel.hpp @@ -27,8 +27,8 @@ #define TIMELINE_PANEL_HPP #include "panel.hpp" -#include "../widgets/timecode-widget.hpp" -#include "../widgets/timeline-widget.hpp" +#include "gui/widgets/timecode-widget.hpp" +#include "gui/widgets/timeline-widget.hpp" using namespace gui::widgets; diff --git a/src/gui/panels/viewer-panel.cpp b/src/gui/panels/viewer-panel.cpp index 01a94934f..692f82308 100644 --- a/src/gui/panels/viewer-panel.cpp +++ b/src/gui/panels/viewer-panel.cpp @@ -20,14 +20,14 @@ * *****************************************************/ -#include "../gtk-lumiera.hpp" -#include "viewer-panel.hpp" - -#include "../workspace/workspace-window.hpp" -#include "../controller/controller.hpp" -#include "../controller/playback-controller.hpp" +#include "gui/gtk-lumiera.hpp" +#include "gui/controller/controller.hpp" +#include "gui/controller/playback-controller.hpp" #include "gui/display-service.hpp" +#include "gui/workspace/workspace-window.hpp" + +#include "viewer-panel.hpp" using namespace Gtk; using namespace gui::widgets; diff --git a/src/gui/panels/viewer-panel.hpp b/src/gui/panels/viewer-panel.hpp index fd234a823..3a8e23b28 100644 --- a/src/gui/panels/viewer-panel.hpp +++ b/src/gui/panels/viewer-panel.hpp @@ -29,7 +29,7 @@ #include #include "panel.hpp" -#include "../widgets/video-display-widget.hpp" +#include "gui/widgets/video-display-widget.hpp" namespace gui { namespace panels { diff --git a/src/gui/util/rectangle.hpp b/src/gui/util/rectangle.hpp index ae77d2305..eb4110e83 100644 --- a/src/gui/util/rectangle.hpp +++ b/src/gui/util/rectangle.hpp @@ -27,7 +27,7 @@ #ifndef RECTANGLE_HPP #define RECTANGLE_HPP -#include "../gtk-lumiera.hpp" +#include "gui/gtk-lumiera.hpp" namespace gui { namespace util { diff --git a/src/gui/widgets/panel-bar.cpp b/src/gui/widgets/panel-bar.cpp index 7b41a4d32..94464e70d 100644 --- a/src/gui/widgets/panel-bar.cpp +++ b/src/gui/widgets/panel-bar.cpp @@ -21,10 +21,10 @@ * *****************************************************/ #include "panel-bar.hpp" -#include "../workspace/workspace-window.hpp" -#include "../workspace/panel-manager.hpp" -#include "../panels/panel.hpp" -#include "../util/rectangle.hpp" +#include "gui/workspace/workspace-window.hpp" +#include "gui/workspace/panel-manager.hpp" +#include "gui/panels/panel.hpp" +#include "gui/util/rectangle.hpp" #include #include diff --git a/src/gui/widgets/timecode-widget.cpp b/src/gui/widgets/timecode-widget.cpp index b43c9087f..fbf9c1eee 100644 --- a/src/gui/widgets/timecode-widget.cpp +++ b/src/gui/widgets/timecode-widget.cpp @@ -31,7 +31,7 @@ #include #include "timecode-widget.hpp" -#include "../util/convert.hpp" +#include "gui/util/convert.hpp" using namespace sigc; using namespace Gtk; diff --git a/src/gui/widgets/timeline-widget.hpp b/src/gui/widgets/timeline-widget.hpp index 2278f5ca9..ee9cd184a 100644 --- a/src/gui/widgets/timeline-widget.hpp +++ b/src/gui/widgets/timeline-widget.hpp @@ -37,7 +37,7 @@ #include "timeline/timeline-clip-track.hpp" #include "timeline/timeline-layout-helper.hpp" -#include "../model/sequence.hpp" +#include "gui/model/sequence.hpp" namespace gui { namespace widgets { diff --git a/src/gui/widgets/timeline/timeline-body.cpp b/src/gui/widgets/timeline/timeline-body.cpp index 0143ea627..35a58f011 100644 --- a/src/gui/widgets/timeline/timeline-body.cpp +++ b/src/gui/widgets/timeline/timeline-body.cpp @@ -24,9 +24,9 @@ #include #include "timeline-body.hpp" -#include "../timeline-widget.hpp" -#include "../../window-manager.hpp" -#include "../../util/cairo-util.hpp" +#include "gui/widgets/timeline-widget.hpp" +#include "gui/window-manager.hpp" +#include "gui/util/cairo-util.hpp" #include "timeline-arrow-tool.hpp" #include "timeline-ibeam-tool.hpp" diff --git a/src/gui/widgets/timeline/timeline-body.hpp b/src/gui/widgets/timeline/timeline-body.hpp index 71e22520b..f9adee189 100644 --- a/src/gui/widgets/timeline/timeline-body.hpp +++ b/src/gui/widgets/timeline/timeline-body.hpp @@ -26,7 +26,7 @@ #ifndef TIMELINE_BODY_HPP #define TIMELINE_BODY_HPP -#include "../../gtk-lumiera.hpp" +#include "gui/gtk-lumiera.hpp" #include "timeline-tool.hpp" namespace gui { diff --git a/src/gui/widgets/timeline/timeline-clip-track.hpp b/src/gui/widgets/timeline/timeline-clip-track.hpp index 90f63fc7d..a0c630018 100644 --- a/src/gui/widgets/timeline/timeline-clip-track.hpp +++ b/src/gui/widgets/timeline/timeline-clip-track.hpp @@ -31,7 +31,7 @@ #include #include "timeline-track.hpp" -#include "../../model/clip-track.hpp" +#include "gui/model/clip-track.hpp" namespace gui { namespace widgets { diff --git a/src/gui/widgets/timeline/timeline-clip.hpp b/src/gui/widgets/timeline/timeline-clip.hpp index c08d87c66..fbc128166 100644 --- a/src/gui/widgets/timeline/timeline-clip.hpp +++ b/src/gui/widgets/timeline/timeline-clip.hpp @@ -24,8 +24,8 @@ */ -#include "../../gtk-lumiera.hpp" -#include "../../model/clip.hpp" +#include "gui/gtk-lumiera.hpp" +#include "gui/model/clip.hpp" #include "timeline-view-window.hpp" #include "include/logging.h" diff --git a/src/gui/widgets/timeline/timeline-group-track.cpp b/src/gui/widgets/timeline/timeline-group-track.cpp index 6ecc20005..9407a41da 100644 --- a/src/gui/widgets/timeline/timeline-group-track.cpp +++ b/src/gui/widgets/timeline/timeline-group-track.cpp @@ -21,7 +21,7 @@ * *****************************************************/ #include "timeline-group-track.hpp" -#include "../timeline-widget.hpp" +#include "gui/widgets/timeline-widget.hpp" using namespace Gtk; using namespace boost; diff --git a/src/gui/widgets/timeline/timeline-group-track.hpp b/src/gui/widgets/timeline/timeline-group-track.hpp index 62e4d8d53..3cf079b47 100644 --- a/src/gui/widgets/timeline/timeline-group-track.hpp +++ b/src/gui/widgets/timeline/timeline-group-track.hpp @@ -27,7 +27,7 @@ #define TIMELINE_GROUP_TRACK_HPP #include "timeline-track.hpp" -#include "../../model/group-track.hpp" +#include "gui/model/group-track.hpp" namespace gui { namespace widgets { diff --git a/src/gui/widgets/timeline/timeline-header-container.cpp b/src/gui/widgets/timeline/timeline-header-container.cpp index 93f2e6aee..66732d383 100644 --- a/src/gui/widgets/timeline/timeline-header-container.cpp +++ b/src/gui/widgets/timeline/timeline-header-container.cpp @@ -25,8 +25,8 @@ #include "timeline-header-container.hpp" #include "timeline-track.hpp" -#include "../timeline-widget.hpp" -#include "../../util/rectangle.hpp" +#include "gui/widgets/timeline-widget.hpp" +#include "gui/util/rectangle.hpp" using namespace Gtk; using namespace std; diff --git a/src/gui/widgets/timeline/timeline-header-container.hpp b/src/gui/widgets/timeline/timeline-header-container.hpp index 921394eff..4bf03a1e9 100644 --- a/src/gui/widgets/timeline/timeline-header-container.hpp +++ b/src/gui/widgets/timeline/timeline-header-container.hpp @@ -28,7 +28,7 @@ #ifndef HEADER_CONTAINER_HPP #define HEADER_CONTAINER_HPP -#include "../../gtk-lumiera.hpp" +#include "gui/gtk-lumiera.hpp" #include "timeline-layout-helper.hpp" namespace gui { diff --git a/src/gui/widgets/timeline/timeline-header-widget.cpp b/src/gui/widgets/timeline/timeline-header-widget.cpp index ae5e85a98..5c9bf81bd 100644 --- a/src/gui/widgets/timeline/timeline-header-widget.cpp +++ b/src/gui/widgets/timeline/timeline-header-widget.cpp @@ -23,8 +23,8 @@ #include -#include "../timeline-widget.hpp" -#include "../../util/rectangle.hpp" +#include "gui/widgets/timeline-widget.hpp" +#include "gui/util/rectangle.hpp" using namespace Gtk; using namespace std; diff --git a/src/gui/widgets/timeline/timeline-header-widget.hpp b/src/gui/widgets/timeline/timeline-header-widget.hpp index 18dcfb78c..b9c6b9bf3 100644 --- a/src/gui/widgets/timeline/timeline-header-widget.hpp +++ b/src/gui/widgets/timeline/timeline-header-widget.hpp @@ -27,7 +27,7 @@ #ifndef HEADER_WIDGET_HPP #define HEADER_WIDGET_HPP -#include "../../gtk-lumiera.hpp" +#include "gui/gtk-lumiera.hpp" namespace gui { namespace widgets { diff --git a/src/gui/widgets/timeline/timeline-ibeam-tool.cpp b/src/gui/widgets/timeline/timeline-ibeam-tool.cpp index 5e37d4b4d..99e263ed7 100644 --- a/src/gui/widgets/timeline/timeline-ibeam-tool.cpp +++ b/src/gui/widgets/timeline/timeline-ibeam-tool.cpp @@ -21,7 +21,7 @@ * *****************************************************/ #include "timeline-ibeam-tool.hpp" -#include "../timeline-widget.hpp" +#include "gui/widgets/timeline-widget.hpp" using namespace boost; using namespace gui::widgets; diff --git a/src/gui/widgets/timeline/timeline-layout-helper.cpp b/src/gui/widgets/timeline/timeline-layout-helper.cpp index c9ff0ed03..372220ff9 100644 --- a/src/gui/widgets/timeline/timeline-layout-helper.cpp +++ b/src/gui/widgets/timeline/timeline-layout-helper.cpp @@ -24,9 +24,9 @@ #include #include "timeline-layout-helper.hpp" -#include "../timeline-widget.hpp" -#include "../../model/sequence.hpp" -#include "../../util/rectangle.hpp" +#include "gui/widgets/timeline-widget.hpp" +#include "gui/model/sequence.hpp" +#include "gui/util/rectangle.hpp" using namespace Gtk; using namespace std; diff --git a/src/gui/widgets/timeline/timeline-layout-helper.hpp b/src/gui/widgets/timeline/timeline-layout-helper.hpp index f8ac3f7bd..b488f8ced 100644 --- a/src/gui/widgets/timeline/timeline-layout-helper.hpp +++ b/src/gui/widgets/timeline/timeline-layout-helper.hpp @@ -27,8 +27,8 @@ #ifndef TIMELINE_LAYOUT_HELPER_HPP #define TIMELINE_LAYOUT_HELPER_HPP -#include "../../gtk-lumiera.hpp" -#include "../../../lib/tree.hpp" +#include "gui/gtk-lumiera.hpp" +#include "lib/tree.hpp" namespace gui { diff --git a/src/gui/widgets/timeline/timeline-ruler.cpp b/src/gui/widgets/timeline/timeline-ruler.cpp index f67f929bc..63d6ecc7a 100644 --- a/src/gui/widgets/timeline/timeline-ruler.cpp +++ b/src/gui/widgets/timeline/timeline-ruler.cpp @@ -23,12 +23,12 @@ #include #include "timeline-ruler.hpp" -#include "../timeline-widget.hpp" -#include "../../window-manager.hpp" -#include "../../util/cairo-util.hpp" +#include "gui/widgets/timeline-widget.hpp" +#include "gui/window-manager.hpp" +#include "gui/util/cairo-util.hpp" extern "C" { -#include "../../../lib/time.h" +#include "lib/time.h" } using namespace Gtk; diff --git a/src/gui/widgets/timeline/timeline-ruler.hpp b/src/gui/widgets/timeline/timeline-ruler.hpp index bdeb08f63..bad7625ca 100644 --- a/src/gui/widgets/timeline/timeline-ruler.hpp +++ b/src/gui/widgets/timeline/timeline-ruler.hpp @@ -27,7 +27,7 @@ #ifndef TIMELINE_RULER_HPP #define TIMELINE_RULER_HPP -#include "../../gtk-lumiera.hpp" +#include "gui/gtk-lumiera.hpp" namespace gui { namespace widgets { diff --git a/src/gui/widgets/timeline/timeline-tool.cpp b/src/gui/widgets/timeline/timeline-tool.cpp index bc1092e53..0e8a95542 100644 --- a/src/gui/widgets/timeline/timeline-tool.cpp +++ b/src/gui/widgets/timeline/timeline-tool.cpp @@ -21,7 +21,7 @@ * *****************************************************/ #include "timeline-tool.hpp" -#include "../timeline-widget.hpp" +#include "gui/widgets/timeline-widget.hpp" using namespace Gdk; using namespace boost; diff --git a/src/gui/widgets/timeline/timeline-tool.hpp b/src/gui/widgets/timeline/timeline-tool.hpp index af9e61146..25d3e3263 100644 --- a/src/gui/widgets/timeline/timeline-tool.hpp +++ b/src/gui/widgets/timeline/timeline-tool.hpp @@ -27,7 +27,7 @@ #ifndef TIMELINE_TOOL_HPP #define TIMELINE_TOOL_HPP -#include "../../gtk-lumiera.hpp" +#include "gui/gtk-lumiera.hpp" namespace gui { namespace widgets { diff --git a/src/gui/widgets/timeline/timeline-track.cpp b/src/gui/widgets/timeline/timeline-track.cpp index 240a62a2b..ea76eb1ea 100644 --- a/src/gui/widgets/timeline/timeline-track.cpp +++ b/src/gui/widgets/timeline/timeline-track.cpp @@ -21,9 +21,9 @@ * *****************************************************/ #include "timeline-track.hpp" -#include "../timeline-widget.hpp" -#include "../../window-manager.hpp" -#include "../../dialogs/name-chooser.hpp" +#include "gui/widgets/timeline-widget.hpp" +#include "gui/window-manager.hpp" +#include "gui/dialogs/name-chooser.hpp" #include "include/logging.h" using namespace boost; diff --git a/src/gui/widgets/timeline/timeline-track.hpp b/src/gui/widgets/timeline/timeline-track.hpp index f550b2c80..474b74e41 100644 --- a/src/gui/widgets/timeline/timeline-track.hpp +++ b/src/gui/widgets/timeline/timeline-track.hpp @@ -23,11 +23,11 @@ ** This file contains the definition of timeline track object */ -#include "../../gtk-lumiera.hpp" -#include "../../model/track.hpp" -#include "../menu-button.hpp" -#include "../mini-button.hpp" -#include "../button-bar.hpp" +#include "gui/gtk-lumiera.hpp" +#include "gui/model/track.hpp" +#include "gui/widgets/menu-button.hpp" +#include "gui/widgets/mini-button.hpp" +#include "gui/widgets/button-bar.hpp" #include "timeline-header-container.hpp" #include "timeline-header-widget.hpp" diff --git a/src/gui/widgets/timeline/timeline-view-window.cpp b/src/gui/widgets/timeline/timeline-view-window.cpp index dcaf8845c..2a62fcc90 100644 --- a/src/gui/widgets/timeline/timeline-view-window.cpp +++ b/src/gui/widgets/timeline/timeline-view-window.cpp @@ -21,7 +21,7 @@ * *****************************************************/ #include "timeline-view-window.hpp" -#include "../timeline-widget.hpp" +#include "gui/widgets/timeline-widget.hpp" using namespace Gtk; using namespace gui::widgets; diff --git a/src/gui/widgets/timeline/timeline-view-window.hpp b/src/gui/widgets/timeline/timeline-view-window.hpp index 972f30edb..e0513bd15 100644 --- a/src/gui/widgets/timeline/timeline-view-window.hpp +++ b/src/gui/widgets/timeline/timeline-view-window.hpp @@ -27,7 +27,7 @@ #ifndef TIMELINE_VIEW_WINDOW_HPP #define TIMELINE_VIEW_WINDOW_HPP -#include "../../gtk-lumiera.hpp" +#include "gui/gtk-lumiera.hpp" namespace gui { namespace widgets { diff --git a/src/gui/widgets/video-display-widget.cpp b/src/gui/widgets/video-display-widget.cpp index 5b6d59b1f..0be796233 100644 --- a/src/gui/widgets/video-display-widget.cpp +++ b/src/gui/widgets/video-display-widget.cpp @@ -24,10 +24,9 @@ #include #include -#include "../gtk-lumiera.hpp" - -#include "../output/xvdisplayer.hpp" -#include "../output/gdkdisplayer.hpp" +#include "gui/gtk-lumiera.hpp" +#include "gui/output/xvdisplayer.hpp" +#include "gui/output/gdkdisplayer.hpp" #include "video-display-widget.hpp" diff --git a/src/gui/widgets/video-display-widget.hpp b/src/gui/widgets/video-display-widget.hpp index 9eea972f2..8e6e9a5e4 100644 --- a/src/gui/widgets/video-display-widget.hpp +++ b/src/gui/widgets/video-display-widget.hpp @@ -28,7 +28,7 @@ #include -#include "../output/displayer.hpp" +#include "gui/output/displayer.hpp" using namespace gui::output; diff --git a/src/gui/workspace/actions.cpp b/src/gui/workspace/actions.cpp index 2c8e205da..4260b40ad 100644 --- a/src/gui/workspace/actions.cpp +++ b/src/gui/workspace/actions.cpp @@ -23,13 +23,13 @@ #include "actions.hpp" #include "workspace-window.hpp" -#include "../window-manager.hpp" +#include "gui/window-manager.hpp" -#include "../dialogs/render.hpp" -#include "../dialogs/preferences-dialog.hpp" -#include "../dialogs/name-chooser.hpp" +#include "gui/dialogs/render.hpp" +#include "gui/dialogs/preferences-dialog.hpp" +#include "gui/dialogs/name-chooser.hpp" -#include "../model/project.hpp" +#include "gui/model/project.hpp" #include "include/logging.h" diff --git a/src/gui/workspace/actions.hpp b/src/gui/workspace/actions.hpp index e60557b3f..3076fedcb 100644 --- a/src/gui/workspace/actions.hpp +++ b/src/gui/workspace/actions.hpp @@ -29,7 +29,7 @@ #ifndef ACTIONS_HPP #define ACTIONS_HPP -#include "../gtk-lumiera.hpp" +#include "gui/gtk-lumiera.hpp" namespace gui { namespace workspace { diff --git a/src/gui/workspace/panel-manager.cpp b/src/gui/workspace/panel-manager.cpp index 4df663ba2..dca33505b 100644 --- a/src/gui/workspace/panel-manager.cpp +++ b/src/gui/workspace/panel-manager.cpp @@ -22,9 +22,9 @@ #include "panel-manager.hpp" -#include "../panels/assets-panel.hpp" -#include "../panels/viewer-panel.hpp" -#include "../panels/timeline-panel.hpp" +#include "gui/panels/assets-panel.hpp" +#include "gui/panels/viewer-panel.hpp" +#include "gui/panels/timeline-panel.hpp" #include "include/logging.h" diff --git a/src/gui/workspace/panel-manager.hpp b/src/gui/workspace/panel-manager.hpp index 9362b66aa..9e3687513 100644 --- a/src/gui/workspace/panel-manager.hpp +++ b/src/gui/workspace/panel-manager.hpp @@ -31,7 +31,7 @@ #include #include -#include "../panels/panel.hpp" +#include "gui/panels/panel.hpp" using namespace gui::panels; diff --git a/src/gui/workspace/workspace-window.cpp b/src/gui/workspace/workspace-window.cpp index c84ca228c..b8ef1ea56 100644 --- a/src/gui/workspace/workspace-window.cpp +++ b/src/gui/workspace/workspace-window.cpp @@ -32,7 +32,7 @@ #include #include -#include "../gtk-lumiera.hpp" +#include "gui/gtk-lumiera.hpp" #include "workspace-window.hpp" #include "include/logging.h" diff --git a/src/gui/workspace/workspace-window.hpp b/src/gui/workspace/workspace-window.hpp index 38ddab9f9..d68d1d3fd 100644 --- a/src/gui/workspace/workspace-window.hpp +++ b/src/gui/workspace/workspace-window.hpp @@ -34,9 +34,9 @@ #include "actions.hpp" #include "panel-manager.hpp" -#include "../panels/assets-panel.hpp" -#include "../panels/viewer-panel.hpp" -#include "../panels/timeline-panel.hpp" +#include "gui/panels/assets-panel.hpp" +#include "gui/panels/viewer-panel.hpp" +#include "gui/panels/timeline-panel.hpp" using namespace gui::panels; diff --git a/src/lib/time/lumitime.cpp b/src/lib/time/lumitime.cpp index 6f1a7ac23..5794b445e 100644 --- a/src/lib/time/lumitime.cpp +++ b/src/lib/time/lumitime.cpp @@ -34,6 +34,16 @@ extern "C" { using std::string; +namespace lib { +namespace time { + + const Time Time::MAX ( TimeValue (+std::numeric_limits::max()) ); + const Time Time::MIN ( TimeValue (-std::numeric_limits::max()) ); + + +}} // namespace lib::Time + +///////////////////////////////////////////////////////////////////////////TODO leftover of the existing/initial lumitime-Implementation namespace lumiera { diff --git a/src/lib/time/quantiser.hpp b/src/lib/time/quantiser.hpp index b511ed53f..9db7d88c2 100644 --- a/src/lib/time/quantiser.hpp +++ b/src/lib/time/quantiser.hpp @@ -24,6 +24,8 @@ #ifndef LIB_TIME_QUANTISER_H #define LIB_TIME_QUANTISER_H +#include "lib/time/timevalue.hpp" + //#include #include diff --git a/src/lib/time/timecode.hpp b/src/lib/time/timecode.hpp index 2a8ef6750..d4aebf8c1 100644 --- a/src/lib/time/timecode.hpp +++ b/src/lib/time/timecode.hpp @@ -24,6 +24,8 @@ #ifndef LIB_TIME_TIMECODE_H #define LIB_TIME_TIMECODE_H +#include "lib/time/timevalue.hpp" + //#include #include diff --git a/src/lib/time/timevalue.hpp b/src/lib/time/timevalue.hpp index 58095f85e..47ee097e9 100644 --- a/src/lib/time/timevalue.hpp +++ b/src/lib/time/timevalue.hpp @@ -36,33 +36,48 @@ extern "C" { namespace lib { namespace time { - using lumiera::Time; - /** - * fixed format time specification. - * - * @todo WIP-WIP-WIP + * basic constant internal time value. + * These time values provide the implementation base + * for all further time types. They can be created by + * wrapping up a raw micro tick value (gavl_time_t), + * are totally ordered, but besides that, + * they are opaque and non-mutable. + * @note clients should prefer to use Time instances, + * which explicitly denote an Lumiera internal + * time value and are easier to use. + * @see TimeVar when full arithmetics are required */ class TimeValue - : boost::totally_ordered > + : boost::totally_ordered > { protected: + /** the raw (internal) time value + * used to implement the time types */ gavl_time_t t_; - public: - static const Time MAX ; - static const Time MIN ; + /** Assigning of time values is not allowed, + * but derived classed might allow that */ + TimeValue& + operator= (TimeValue const& o) + { + t_ = o.t_; + return *this; + } + + public: explicit TimeValue (gavl_time_t val=0) : t_(val) { } - // using standard copy operations - - operator gavl_time_t () const { return t_; } + /** copy initialisation allowed */ + TimeValue (TimeValue const& o) + : t_(o.t_) + { } // Supporting totally_ordered friend bool operator< (TimeValue const& t1, TimeValue const& t2) { return t1.t_ < t2.t_; } @@ -73,48 +88,74 @@ namespace time { }; + + /** a mutable time value, + * behaving like a plain number, + * allowing copy and re-accessing + */ class TimeVar : public TimeValue - , boost::additive + , boost::additive + > > { - + public: - TimeVar (TimeValue time) + TimeVar (TimeValue time = TimeValue()) : TimeValue(time) { } + // Allowing copy and assignment + TimeVar (TimeVar const& o) + : TimeValue(o) + { } + + TimeVar& + operator= (TimeValue const& o) + { + t_ = TimeVar(o); + return *this; + } + + + // Supporting mixing with plain long int arithmetics + operator gavl_time_t () const { return t_; } // Supporting additive TimeVar& operator+= (TimeVar const& tx) { t_ += tx.t_; return *this; } TimeVar& operator-= (TimeVar const& tx) { t_ -= tx.t_; return *this; } // Supporting multiplication with integral factor - TimeVar& operator*= (int64_t fact) { t_ *= fact; return *this; } + TimeVar& operator*= (int fact) { t_ *= fact; return *this; } // baseclass TimeValue is already totally_ordered }; - class Offset; + class Offset; /** * Lumiera's internal time value datatype */ -//class Time -// : public TimeValue -// { -// public: -// explicit -// Time (TimeValue val=0) -// : TimeValue(val) -// { } -// -// Time ( long millis -// , uint secs -// , uint mins =0 -// , uint hours=0 -// ); -// }; + class Time + : public TimeValue + { + public: + static const Time MAX ; + static const Time MIN ; + + explicit + Time (TimeValue val= TimeValue(0)) + : TimeValue(val) + { } + + Time ( long millis + , uint secs + , uint mins =0 + , uint hours=0 + ); + }; class Offset @@ -123,18 +164,21 @@ namespace time { public: explicit - Offset (TimeValue distance) + Offset (TimeValue const& distance) : TimeValue(distance) { } }; - - inline Offset - operator- (Time const& end, Time const& start) - { + + +//////////////////////////////////////////////////////////////TODO this seems rather like a bad idea, +// because it opens a lot of implicit conversions which we don't want! +//inline Offset +//operator- (TimeValue const& end, TimeValue const& start) +//{ // TimeVar distance(end); // distance -= start; // return Offset(distance); - } +//} typedef const Offset TimeDistance; diff --git a/src/lib/variant.hpp b/src/lib/variant.hpp index 7a964c5db..b4eef9b76 100644 --- a/src/lib/variant.hpp +++ b/src/lib/variant.hpp @@ -27,18 +27,22 @@ ** doesn't deal with alignment issues and is not threadsafe. ** ** Values can be stored using \c operator= . In order to access the value - ** stored in lumiera::Variant, you additionally need to define a "functor" - **
  • with a typedef "Ret" for the return type
  • - **
  • providing a static Ret access(ELM&) function - ** for each of the types used in the Variant
  • - **
+ ** stored in lib::Variant, you additionally need to define a "functor" + ** - with a typedef "Ret" for the return type + ** - providing a \code static Ret access(ELM&) \endcode function + ** for each of the types used in the Variant ** + ** @todo the instance handling for the accessor seems somewhat + ** misaligned: why do we create another accessor as static var + ** within the access() function?? Why not putting that into the + ** Holder::Storage instance created by the client code? + ** @todo write an unit test ///////////////////////////////////////TICKET #141 ** @see wrapperptr.hpp usage example */ -#ifndef LUMIERA_VARIANT_H -#define LUMIERA_VARIANT_H +#ifndef LIB_VARIANT_H +#define LIB_VARIANT_H #include "lib/meta/typelist-util.hpp" @@ -48,7 +52,7 @@ -namespace lumiera { +namespace lib { namespace variant { @@ -100,13 +104,13 @@ namespace lumiera { put (T const& toStore) { BASE::deleteCurrent(); // remove old content, if any - + // T& storedObj = *new(BASE::buffer_) T (toStore); BASE::which_ = idx; // remember the actual type selected return storedObj; } - using BASE::put; + using BASE::put; // inherited alternate put() for other types T }; typedef InstantiateWithIndex< TYPES @@ -122,9 +126,9 @@ namespace lumiera { struct CaseSelect { typedef typename FUNCTOR::Ret Ret; - typedef Ret (*Func)(Buffer&); + typedef Ret (Func)(Buffer&); - Func table_[TYPECNT]; + Func* table_[TYPECNT]; CaseSelect () { @@ -146,11 +150,16 @@ namespace lumiera { if (TYPECNT <= storage.which_) return FUNCTOR::ifEmpty (); else - return (*table_[storage.which_]) (storage); + { + Func& access = *table_[storage.which_]; + return access (storage); + } } }; + /** initialise the dispatcher (trampoline) + * for the case of accessing type T */ template< class T, class BASE, uint i > struct CasePrepare : BASE @@ -161,7 +170,14 @@ namespace lumiera { } }; - + + /** access the variant's inline buffer, + * using the configured access functor. + * @note the actual accessor instance + * is created on demand (static) + * @todo shouldn't this rather be located within + * the Holder::Storage created by clients?? + */ template static typename FUNCTOR::Ret access (Buffer& buf) @@ -205,7 +221,7 @@ namespace lumiera { - /** + /** * A variant wrapper (typesafe union) capable of holding a value of any * of a bounded collection of types. The value is stored in a local buffer * directly within the object and may be accessed by a typesafe visitation. @@ -273,5 +289,5 @@ namespace lumiera { } }; -} // namespace lumiera +} // namespace lib #endif diff --git a/src/lib/wrapperptr.hpp b/src/lib/wrapperptr.hpp index 1032045b0..16a20a2f2 100644 --- a/src/lib/wrapperptr.hpp +++ b/src/lib/wrapperptr.hpp @@ -55,7 +55,7 @@ namespace lumiera { * error reporting is similar to the behaviour of dynamic_cast: when retrieving * a pointer, NULL is returned in case of mismatch. */ - typedef lumiera::Variant WrapperPtr; + typedef lib::Variant WrapperPtr; diff --git a/src/tool/rsvg-convert.c b/src/tool/rsvg-convert.c index d8216e608..9fcf67b9c 100644 --- a/src/tool/rsvg-convert.c +++ b/src/tool/rsvg-convert.c @@ -37,8 +37,8 @@ #include #include -#include -#include +#include +#include #ifdef CAIRO_HAS_PS_SURFACE #include diff --git a/tests/40components.tests b/tests/40components.tests index 078556126..b61a98aed 100644 --- a/tests/40components.tests +++ b/tests/40components.tests @@ -633,7 +633,7 @@ return: 0 END -PLANNED "Times and time intervals" TimeValue_test < (arg[1]); - Time ref (refval); + TimeValue ref (refval); checkBasics (ref); checkComparisons (ref); @@ -65,13 +63,13 @@ namespace test{ void - checkBasics (Time const& ref) + checkBasics (TimeValue ref) { } void - checkComparisons (Time const& ref) + checkComparisons (TimeValue ref) { } diff --git a/tests/lib/time/time-quantisation-test.cpp b/tests/lib/time/time-quantisation-test.cpp index ac3dd9393..e490661dd 100644 --- a/tests/lib/time/time-quantisation-test.cpp +++ b/tests/lib/time/time-quantisation-test.cpp @@ -40,8 +40,6 @@ namespace lib { namespace time{ namespace test{ - using lumiera::Time; - /******************************************************** * @test verify handling of time values, time intervals. @@ -56,7 +54,7 @@ namespace test{ { long refval= isnil(arg)? 1 : lexical_cast (arg[1]); - Time ref (refval); + TimeValue ref (refval); checkBasics (ref); checkComparisons (ref); @@ -65,13 +63,13 @@ namespace test{ void - checkBasics (Time const& ref) + checkBasics (TimeValue ref) { } void - checkComparisons (Time const& ref) + checkComparisons (TimeValue ref) { } diff --git a/tests/lib/time/time-value-test.cpp b/tests/lib/time/time-value-test.cpp index e9e602d17..d939ea525 100644 --- a/tests/lib/time/time-value-test.cpp +++ b/tests/lib/time/time-value-test.cpp @@ -49,27 +49,96 @@ namespace test{ */ class TimeValue_test : public Test { + gavl_time_t + random_or_get (Arg arg) + { + if (isnil(arg)) + return (rand() % 10000); + else + return lexical_cast (arg[1]); + } + + virtual void run (Arg arg) { - long refval= isnil(arg)? 1 : lexical_cast (arg[1]); + TimeValue ref (random_or_get(arg)); - Time ref (refval); - - checkBasics (ref); + checkBasicTimeValues (ref); + checkMutableTime (ref); checkComparisons (ref); checkComponentAccess(); } + /** @test creating some time values and performing trivial comparisons. + * @note you can't do much beyond that, because TimeValues as such + * are a "dead end": they are opaque and can't be altered. + */ void - checkBasics (Time const& ref) + checkBasicTimeValues (TimeValue org) { + TimeValue zero; + TimeValue one (1); + TimeValue max (Time::MAX); + TimeValue min (Time::MIN); + + TimeValue val (org); + + CHECK (zero == zero); + CHECK (zero <= zero); + CHECK (zero >= zero); + + CHECK (zero < one); + CHECK (min < max); + CHECK (min < val); + CHECK (val < max); + + // mixed comparisons with raw numeric time + gavl_time_t g2 (-2); + CHECK (zero > g2); + CHECK (one > g2); + CHECK (one >= g2); + CHECK (g2 < max); + + CHECK (!(g2 > max)); + CHECK (!(g2 < min)); } void - checkComparisons (Time const& ref) + checkMutableTime (TimeValue org) + { + TimeVar zero; + TimeVar one = TimeValue(1); + TimeVar two = TimeValue(2); + + TimeVar var (org); + + var += two; + var *= 2; + CHECK (zero == (var - 2*(org + two)) ); + + // the transient vars caused no side-effects + CHECK (var == 2*two + org + org); + CHECK (two == TimeValue(2)); + + var = org; // assign new value + CHECK (zero == (var - org)); + + CHECK (zero < one); + CHECK (one < two); + CHECK (var < Time::MAX); + CHECK (var > Time::MIN); + + gavl_time_t raw (var); + CHECK (raw == org); + CHECK (raw > org - two); + } + + + void + checkComparisons (TimeValue org) { }