diff options
author | David Robillard <d@drobilla.net> | 2008-02-17 22:47:12 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2008-02-17 22:47:12 +0000 |
commit | a54ee5d3aef9425f5c5955b3c9b5ea30c9da078f (patch) | |
tree | 97d6c034ab778aa15e09450cd349d35933df02e7 /libs | |
parent | 15936ab6d9569838024a2d83145052d1e495b2ed (diff) |
Fix incorrect comment.
Remove ancient, rotting, flowcanvas.
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@3080 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r-- | libs/ardour/globals.cc | 2 | ||||
-rw-r--r-- | libs/flowcanvas/AUTHORS | 4 | ||||
-rw-r--r-- | libs/flowcanvas/ChangeLog | 1 | ||||
-rw-r--r-- | libs/flowcanvas/Doxyfile | 1153 | ||||
-rw-r--r-- | libs/flowcanvas/NEWS | 4 | ||||
-rw-r--r-- | libs/flowcanvas/README | 1 | ||||
-rw-r--r-- | libs/flowcanvas/SConscript | 47 | ||||
-rw-r--r-- | libs/flowcanvas/doc/port_offsets.dia | bin | 1324 -> 0 bytes | |||
-rw-r--r-- | libs/flowcanvas/flowcanvas/Connection.h | 72 | ||||
-rw-r--r-- | libs/flowcanvas/flowcanvas/FlowCanvas.h | 152 | ||||
-rw-r--r-- | libs/flowcanvas/flowcanvas/Module.h | 128 | ||||
-rw-r--r-- | libs/flowcanvas/flowcanvas/Port.h | 102 | ||||
-rw-r--r-- | libs/flowcanvas/src/Connection.cpp | 679 | ||||
-rw-r--r-- | libs/flowcanvas/src/FlowCanvas.cpp | 884 | ||||
-rw-r--r-- | libs/flowcanvas/src/Module.cpp | 472 | ||||
-rw-r--r-- | libs/flowcanvas/src/Port.cpp | 189 |
16 files changed, 1 insertions, 3889 deletions
diff --git a/libs/ardour/globals.cc b/libs/ardour/globals.cc index fdba3b29c9..c873ac02ab 100644 --- a/libs/ardour/globals.cc +++ b/libs/ardour/globals.cc @@ -531,7 +531,7 @@ static bool sae_binding_filter (const string& str, void* arg) static bool binding_filter (const string& str, void* arg) { - /* Not a dotfile, has a prefix before a period, suffix is ".bindings" and contains -sae- */ + /* Not a dotfile, has a prefix before a period, suffix is ".bindings" */ return str[0] != '.' && str.length() > 9 && str.find (".bindings") == (str.length() - 9); } diff --git a/libs/flowcanvas/AUTHORS b/libs/flowcanvas/AUTHORS deleted file mode 100644 index d4d803bdf4..0000000000 --- a/libs/flowcanvas/AUTHORS +++ /dev/null @@ -1,4 +0,0 @@ -Author: - -Dave Robillard <drobilla@connect.carleton.ca> - diff --git a/libs/flowcanvas/ChangeLog b/libs/flowcanvas/ChangeLog deleted file mode 100644 index c37c459862..0000000000 --- a/libs/flowcanvas/ChangeLog +++ /dev/null @@ -1 +0,0 @@ -Changes? What changes? diff --git a/libs/flowcanvas/Doxyfile b/libs/flowcanvas/Doxyfile deleted file mode 100644 index 1e6b267b9b..0000000000 --- a/libs/flowcanvas/Doxyfile +++ /dev/null @@ -1,1153 +0,0 @@ -# Doxyfile 1.3.8 - -# This file describes the settings to be used by the documentation system -# doxygen (www.doxygen.org) for a project -# -# All text after a hash (#) is considered a comment and will be ignored -# The format is: -# TAG = value [value, ...] -# For lists items can also be appended using: -# TAG += value [value, ...] -# Values that contain spaces should be placed between quotes (" ") - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- - -# The PROJECT_NAME tag is a single word (or a sequence of words surrounded -# by quotes) that should identify the project. - -PROJECT_NAME = FlowCanvas - -# The PROJECT_NUMBER tag can be used to enter a project or revision number. -# This could be handy for archiving the generated documentation or -# if some version control system is used. - -PROJECT_NUMBER = 0.0.1 - -# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) -# base path where the generated documentation will be put. -# If a relative path is entered, it will be relative to the location -# where doxygen was started. If left blank the current directory will be used. - -OUTPUT_DIRECTORY = doc - -# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create -# 4096 sub-directories (in 2 levels) under the output directory of each output -# format and will distribute the generated files over these directories. -# Enabling this option can be useful when feeding doxygen a huge amount of source -# files, where putting all generated files in the same directory would otherwise -# cause performance problems for the file system. - -CREATE_SUBDIRS = NO - -# The OUTPUT_LANGUAGE tag is used to specify the language in which all -# documentation generated by doxygen is written. Doxygen will use this -# information to generate all constant output in the proper language. -# The default language is English, other supported languages are: -# Brazilian, Catalan, Chinese, Chinese-Traditional, Croatian, Czech, Danish, -# Dutch, Finnish, French, German, Greek, Hungarian, Italian, Japanese, -# Japanese-en (Japanese with English messages), Korean, Korean-en, Norwegian, -# Polish, Portuguese, Romanian, Russian, Serbian, Slovak, Slovene, Spanish, -# Swedish, and Ukrainian. - -OUTPUT_LANGUAGE = English - -# This tag can be used to specify the encoding used in the generated output. -# The encoding is not always determined by the language that is chosen, -# but also whether or not the output is meant for Windows or non-Windows users. -# In case there is a difference, setting the USE_WINDOWS_ENCODING tag to YES -# forces the Windows encoding (this is the default for the Windows binary), -# whereas setting the tag to NO uses a Unix-style encoding (the default for -# all platforms other than Windows). - -USE_WINDOWS_ENCODING = NO - -# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will -# include brief member descriptions after the members that are listed in -# the file and class documentation (similar to JavaDoc). -# Set to NO to disable this. - -BRIEF_MEMBER_DESC = YES - -# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend -# the brief description of a member or function before the detailed description. -# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the -# brief descriptions will be completely suppressed. - -REPEAT_BRIEF = YES - -# This tag implements a quasi-intelligent brief description abbreviator -# that is used to form the text in various listings. Each string -# in this list, if found as the leading text of the brief description, will be -# stripped from the text and the result after processing the whole list, is used -# as the annotated text. Otherwise, the brief description is used as-is. If left -# blank, the following values are used ("$name" is automatically replaced with the -# name of the entity): "The $name class" "The $name widget" "The $name file" -# "is" "provides" "specifies" "contains" "represents" "a" "an" "the" - -ABBREVIATE_BRIEF = - -# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then -# Doxygen will generate a detailed section even if there is only a brief -# description. - -ALWAYS_DETAILED_SEC = NO - -# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all inherited -# members of a class in the documentation of that class as if those members were -# ordinary class members. Constructors, destructors and assignment operators of -# the base classes will not be shown. - -INLINE_INHERITED_MEMB = NO - -# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full -# path before files name in the file list and in the header files. If set -# to NO the shortest path that makes the file name unique will be used. - -FULL_PATH_NAMES = YES - -# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag -# can be used to strip a user-defined part of the path. Stripping is -# only done if one of the specified strings matches the left-hand part of -# the path. The tag can be used to show relative paths in the file list. -# If left blank the directory from which doxygen is run is used as the -# path to strip. - -STRIP_FROM_PATH = - -# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of -# the path mentioned in the documentation of a class, which tells -# the reader which header file to include in order to use a class. -# If left blank only the name of the header file containing the class -# definition is used. Otherwise one should specify the include paths that -# are normally passed to the compiler using the -I flag. - -STRIP_FROM_INC_PATH = - -# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter -# (but less readable) file names. This can be useful is your file systems -# doesn't support long names like on DOS, Mac, or CD-ROM. - -SHORT_NAMES = NO - -# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen -# will interpret the first line (until the first dot) of a JavaDoc-style -# comment as the brief description. If set to NO, the JavaDoc -# comments will behave just like the Qt-style comments (thus requiring an -# explicit @brief command for a brief description. - -JAVADOC_AUTOBRIEF = YES - -# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen -# treat a multi-line C++ special comment block (i.e. a block of //! or /// -# comments) as a brief description. This used to be the default behaviour. -# The new default is to treat a multi-line C++ comment block as a detailed -# description. Set this tag to YES if you prefer the old behaviour instead. - -MULTILINE_CPP_IS_BRIEF = NO - -# If the DETAILS_AT_TOP tag is set to YES then Doxygen -# will output the detailed description near the top, like JavaDoc. -# If set to NO, the detailed description appears after the member -# documentation. - -DETAILS_AT_TOP = NO - -# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented -# member inherits the documentation from any documented member that it -# re-implements. - -INHERIT_DOCS = YES - -# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC -# tag is set to YES, then doxygen will reuse the documentation of the first -# member in the group (if any) for the other members of the group. By default -# all members of a group must be documented explicitly. - -DISTRIBUTE_GROUP_DOC = NO - -# The TAB_SIZE tag can be used to set the number of spaces in a tab. -# Doxygen uses this value to replace tabs by spaces in code fragments. - -TAB_SIZE = 4 - -# This tag can be used to specify a number of aliases that acts -# as commands in the documentation. An alias has the form "name=value". -# For example adding "sideeffect=\par Side Effects:\n" will allow you to -# put the command \sideeffect (or @sideeffect) in the documentation, which -# will result in a user-defined paragraph with heading "Side Effects:". -# You can put \n's in the value part of an alias to insert newlines. - -ALIASES = - -# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources -# only. Doxygen will then generate output that is more tailored for C. -# For instance, some of the names that are used will be different. The list -# of all members will be omitted, etc. - -OPTIMIZE_OUTPUT_FOR_C = NO - -# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java sources -# only. Doxygen will then generate output that is more tailored for Java. -# For instance, namespaces will be presented as packages, qualified scopes -# will look different, etc. - -OPTIMIZE_OUTPUT_JAVA = NO - -# Set the SUBGROUPING tag to YES (the default) to allow class member groups of -# the same type (for instance a group of public functions) to be put as a -# subgroup of that type (e.g. under the Public Functions section). Set it to -# NO to prevent subgrouping. Alternatively, this can be done per class using -# the \nosubgrouping command. - -SUBGROUPING = YES - -#--------------------------------------------------------------------------- -# Build related configuration options -#--------------------------------------------------------------------------- - -# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in -# documentation are documented, even if no documentation was available. -# Private class members and static file members will be hidden unless -# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES - -EXTRACT_ALL = YES - -# If the EXTRACT_PRIVATE tag is set to YES all private members of a class -# will be included in the documentation. - -EXTRACT_PRIVATE = YES - -# If the EXTRACT_STATIC tag is set to YES all static members of a file -# will be included in the documentation. - -EXTRACT_STATIC = NO - -# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) -# defined locally in source files will be included in the documentation. -# If set to NO only classes defined in header files are included. - -EXTRACT_LOCAL_CLASSES = YES - -# This flag is only useful for Objective-C code. When set to YES local -# methods, which are defined in the implementation section but not in -# the interface are included in the documentation. -# If set to NO (the default) only methods in the interface are included. - -EXTRACT_LOCAL_METHODS = NO - -# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all -# undocumented members of documented classes, files or namespaces. -# If set to NO (the default) these members will be included in the -# various overviews, but no documentation section is generated. -# This option has no effect if EXTRACT_ALL is enabled. - -HIDE_UNDOC_MEMBERS = NO - -# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all -# undocumented classes that are normally visible in the class hierarchy. -# If set to NO (the default) these classes will be included in the various -# overviews. This option has no effect if EXTRACT_ALL is enabled. - -HIDE_UNDOC_CLASSES = NO - -# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all -# friend (class|struct|union) declarations. -# If set to NO (the default) these declarations will be included in the -# documentation. - -HIDE_FRIEND_COMPOUNDS = NO - -# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any -# documentation blocks found inside the body of a function. -# If set to NO (the default) these blocks will be appended to the -# function's detailed documentation block. - -HIDE_IN_BODY_DOCS = NO - -# The INTERNAL_DOCS tag determines if documentation -# that is typed after a \internal command is included. If the tag is set -# to NO (the default) then the documentation will be excluded. -# Set it to YES to include the internal documentation. - -INTERNAL_DOCS = NO - -# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate -# file names in lower-case letters. If set to YES upper-case letters are also -# allowed. This is useful if you have classes or files whose names only differ -# in case and if your file system supports case sensitive file names. Windows -# and Mac users are advised to set this option to NO. - -CASE_SENSE_NAMES = YES - -# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen -# will show members with their full class and namespace scopes in the -# documentation. If set to YES the scope will be hidden. - -HIDE_SCOPE_NAMES = NO - -# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen -# will put a list of the files that are included by a file in the documentation -# of that file. - -SHOW_INCLUDE_FILES = YES - -# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] -# is inserted in the documentation for inline members. - -INLINE_INFO = YES - -# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen -# will sort the (detailed) documentation of file and class members -# alphabetically by member name. If set to NO the members will appear in -# declaration order. - -SORT_MEMBER_DOCS = NO - -# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the -# brief documentation of file, namespace and class members alphabetically -# by member name. If set to NO (the default) the members will appear in -# declaration order. - -SORT_BRIEF_DOCS = NO - -# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be -# sorted by fully-qualified names, including namespaces. If set to -# NO (the default), the class list will be sorted only by class name, -# not including the namespace part. -# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. -# Note: This option applies only to the class list, not to the -# alphabetical list. - -SORT_BY_SCOPE_NAME = YES - -# The GENERATE_TODOLIST tag can be used to enable (YES) or -# disable (NO) the todo list. This list is created by putting \todo -# commands in the documentation. - -GENERATE_TODOLIST = YES - -# The GENERATE_TESTLIST tag can be used to enable (YES) or -# disable (NO) the test list. This list is created by putting \test -# commands in the documentation. - -GENERATE_TESTLIST = YES - -# The GENERATE_BUGLIST tag can be used to enable (YES) or -# disable (NO) the bug list. This list is created by putting \bug -# commands in the documentation. - -GENERATE_BUGLIST = YES - -# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or -# disable (NO) the deprecated list. This list is created by putting -# \deprecated commands in the documentation. - -GENERATE_DEPRECATEDLIST= YES - -# The ENABLED_SECTIONS tag can be used to enable conditional -# documentation sections, marked by \if sectionname ... \endif. - -ENABLED_SECTIONS = - -# The MAX_INITIALIZER_LINES tag determines the maximum number of lines -# the initial value of a variable or define consists of for it to appear in -# the documentation. If the initializer consists of more lines than specified -# here it will be hidden. Use a value of 0 to hide initializers completely. -# The appearance of the initializer of individual variables and defines in the -# documentation can be controlled using \showinitializer or \hideinitializer -# command in the documentation regardless of this setting. - -MAX_INITIALIZER_LINES = 30 - -# Set the SHOW_USED_FILES tag to NO to disable the list of files generated -# at the bottom of the documentation of classes and structs. If set to YES the -# list will mention the files that were used to generate the documentation. - -SHOW_USED_FILES = YES - -#--------------------------------------------------------------------------- -# configuration options related to warning and progress messages -#--------------------------------------------------------------------------- - -# The QUIET tag can be used to turn on/off the messages that are generated -# by doxygen. Possible values are YES and NO. If left blank NO is used. - -QUIET = NO - -# The WARNINGS tag can be used to turn on/off the warning messages that are -# generated by doxygen. Possible values are YES and NO. If left blank -# NO is used. - -WARNINGS = YES - -# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings -# for undocumented members. If EXTRACT_ALL is set to YES then this flag will -# automatically be disabled. - -WARN_IF_UNDOCUMENTED = NO - -# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for -# potential errors in the documentation, such as not documenting some -# parameters in a documented function, or documenting parameters that -# don't exist or using markup commands wrongly. - -WARN_IF_DOC_ERROR = YES - -# The WARN_FORMAT tag determines the format of the warning messages that -# doxygen can produce. The string should contain the $file, $line, and $text -# tags, which will be replaced by the file and line number from which the -# warning originated and the warning text. - -WARN_FORMAT = "$file:$line: $text" - -# The WARN_LOGFILE tag can be used to specify a file to which warning -# and error messages should be written. If left blank the output is written -# to stderr. - -WARN_LOGFILE = - -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- - -# The INPUT tag can be used to specify the files and/or directories that contain -# documented source files. You may enter file names like "myfile.cpp" or -# directories like "/usr/src/myproject". Separate the files or directories -# with spaces. - -INPUT = src flowcanvas - -# If the value of the INPUT tag contains directories, you can use the -# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank the following patterns are tested: -# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx *.hpp -# *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm - -FILE_PATTERNS = - -# The RECURSIVE tag can be used to turn specify whether or not subdirectories -# should be searched for input files as well. Possible values are YES and NO. -# If left blank NO is used. - -RECURSIVE = NO - -# The EXCLUDE tag can be used to specify files and/or directories that should -# excluded from the INPUT source files. This way you can easily exclude a -# subdirectory from a directory tree whose root is specified with the INPUT tag. - -EXCLUDE = - -# The EXCLUDE_SYMLINKS tag can be used select whether or not files or directories -# that are symbolic links (a Unix filesystem feature) are excluded from the input. - -EXCLUDE_SYMLINKS = NO - -# If the value of the INPUT tag contains directories, you can use the -# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude -# certain files from those directories. - -EXCLUDE_PATTERNS = - -# The EXAMPLE_PATH tag can be used to specify one or more files or -# directories that contain example code fragments that are included (see -# the \include command). - -EXAMPLE_PATH = - -# If the value of the EXAMPLE_PATH tag contains directories, you can use the -# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank all files are included. - -EXAMPLE_PATTERNS = - -# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be -# searched for input files to be used with the \include or \dontinclude -# commands irrespective of the value of the RECURSIVE tag. -# Possible values are YES and NO. If left blank NO is used. - -EXAMPLE_RECURSIVE = NO - -# The IMAGE_PATH tag can be used to specify one or more files or -# directories that contain image that are included in the documentation (see -# the \image command). - -IMAGE_PATH = - -# The INPUT_FILTER tag can be used to specify a program that doxygen should -# invoke to filter for each input file. Doxygen will invoke the filter program -# by executing (via popen()) the command <filter> <input-file>, where <filter> -# is the value of the INPUT_FILTER tag, and <input-file> is the name of an -# input file. Doxygen will then use the output that the filter program writes -# to standard output. If FILTER_PATTERNS is specified, this tag will be -# ignored. - -INPUT_FILTER = - -# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern -# basis. Doxygen will compare the file name with each pattern and apply the -# filter if there is a match. The filters are a list of the form: -# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further -# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER -# is applied to all files. - -FILTER_PATTERNS = - -# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using -# INPUT_FILTER) will be used to filter the input files when producing source -# files to browse (i.e. when SOURCE_BROWSER is set to YES). - -FILTER_SOURCE_FILES = NO - -#--------------------------------------------------------------------------- -# configuration options related to source browsing -#--------------------------------------------------------------------------- - -# If the SOURCE_BROWSER tag is set to YES then a list of source files will -# be generated. Documented entities will be cross-referenced with these sources. -# Note: To get rid of all source code in the generated output, make sure also -# VERBATIM_HEADERS is set to NO. - -SOURCE_BROWSER = NO - -# Setting the INLINE_SOURCES tag to YES will include the body -# of functions and classes directly in the documentation. - -INLINE_SOURCES = NO - -# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct -# doxygen to hide any special comment blocks from generated source code -# fragments. Normal C and C++ comments will always remain visible. - -STRIP_CODE_COMMENTS = YES - -# If the REFERENCED_BY_RELATION tag is set to YES (the default) -# then for each documented function all documented -# functions referencing it will be listed. - -REFERENCED_BY_RELATION = YES - -# If the REFERENCES_RELATION tag is set to YES (the default) -# then for each documented function all documented entities -# called/used by that function will be listed. - -REFERENCES_RELATION = YES - -# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen -# will generate a verbatim copy of the header file for each class for -# which an include is specified. Set to NO to disable this. - -VERBATIM_HEADERS = YES - -#--------------------------------------------------------------------------- -# configuration options related to the alphabetical class index -#--------------------------------------------------------------------------- - -# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index -# of all compounds will be generated. Enable this if the project -# contains a lot of classes, structs, unions or interfaces. - -ALPHABETICAL_INDEX = NO - -# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then -# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns -# in which this list will be split (can be a number in the range [1..20]) - -COLS_IN_ALPHA_INDEX = 5 - -# In case all classes in a project start with a common prefix, all -# classes will be put under the same header in the alphabetical index. -# The IGNORE_PREFIX tag can be used to specify one or more prefixes that -# should be ignored while generating the index headers. - -IGNORE_PREFIX = - -#--------------------------------------------------------------------------- -# configuration options related to the HTML output -#--------------------------------------------------------------------------- - -# If the GENERATE_HTML tag is set to YES (the default) Doxygen will -# generate HTML output. - -GENERATE_HTML = YES - -# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `html' will be used as the default path. - -HTML_OUTPUT = html - -# The HTML_FILE_EXTENSION tag can be used to specify the file extension for -# each generated HTML page (for example: .htm,.php,.asp). If it is left blank -# doxygen will generate files with .html extension. - -HTML_FILE_EXTENSION = .html - -# The HTML_HEADER tag can be used to specify a personal HTML header for -# each generated HTML page. If it is left blank doxygen will generate a -# standard header. - -HTML_HEADER = - -# The HTML_FOOTER tag can be used to specify a personal HTML footer for -# each generated HTML page. If it is left blank doxygen will generate a -# standard footer. - -HTML_FOOTER = - -# The HTML_STYLESHEET tag can be used to specify a user-defined cascading -# style sheet that is used by each HTML page. It can be used to -# fine-tune the look of the HTML output. If the tag is left blank doxygen -# will generate a default style sheet. Note that doxygen will try to copy -# the style sheet file to the HTML output directory, so don't put your own -# stylesheet in the HTML output directory as well, or it will be erased! - -HTML_STYLESHEET = - -# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, -# files or namespaces will be aligned in HTML using tables. If set to -# NO a bullet list will be used. - -HTML_ALIGN_MEMBERS = YES - -# If the GENERATE_HTMLHELP tag is set to YES, additional index files -# will be generated that can be used as input for tools like the -# Microsoft HTML help workshop to generate a compressed HTML help file (.chm) -# of the generated HTML documentation. - -GENERATE_HTMLHELP = NO - -# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can -# be used to specify the file name of the resulting .chm file. You -# can add a path in front of the file if the result should not be -# written to the html output directory. - -CHM_FILE = - -# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can -# be used to specify the location (absolute path including file name) of -# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run -# the HTML help compiler on the generated index.hhp. - -HHC_LOCATION = - -# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag -# controls if a separate .chi index file is generated (YES) or that -# it should be included in the master .chm file (NO). - -GENERATE_CHI = NO - -# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag -# controls whether a binary table of contents is generated (YES) or a -# normal table of contents (NO) in the .chm file. - -BINARY_TOC = NO - -# The TOC_EXPAND flag can be set to YES to add extra items for group members -# to the contents of the HTML help documentation and to the tree view. - -TOC_EXPAND = NO - -# The DISABLE_INDEX tag can be used to turn on/off the condensed index at -# top of each HTML page. The value NO (the default) enables the index and -# the value YES disables it. - -DISABLE_INDEX = NO - -# This tag can be used to set the number of enum values (range [1..20]) -# that doxygen will group on one line in the generated HTML documentation. - -ENUM_VALUES_PER_LINE = 4 - -# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be -# generated containing a tree-like index structure (just like the one that -# is generated for HTML Help). For this to work a browser that supports -# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, -# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are -# probably better off using the HTML help feature. - -GENERATE_TREEVIEW = NO - -# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be -# used to set the initial width (in pixels) of the frame in which the tree -# is shown. - -TREEVIEW_WIDTH = 250 - -#--------------------------------------------------------------------------- -# configuration options related to the LaTeX output -#--------------------------------------------------------------------------- - -# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will -# generate Latex output. - -GENERATE_LATEX = NO - -# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `latex' will be used as the default path. - -LATEX_OUTPUT = latex - -# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be -# invoked. If left blank `latex' will be used as the default command name. - -LATEX_CMD_NAME = latex - -# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to -# generate index for LaTeX. If left blank `makeindex' will be used as the -# default command name. - -MAKEINDEX_CMD_NAME = makeindex - -# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact -# LaTeX documents. This may be useful for small projects and may help to -# save some trees in general. - -COMPACT_LATEX = NO - -# The PAPER_TYPE tag can be used to set the paper type that is used -# by the printer. Possible values are: a4, a4wide, letter, legal and -# executive. If left blank a4wide will be used. - -PAPER_TYPE = a4wide - -# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX -# packages that should be included in the LaTeX output. - -EXTRA_PACKAGES = - -# The LATEX_HEADER tag can be used to specify a personal LaTeX header for -# the generated latex document. The header should contain everything until -# the first chapter. If it is left blank doxygen will generate a -# standard header. Notice: only use this tag if you know what you are doing! - -LATEX_HEADER = - -# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated -# is prepared for conversion to pdf (using ps2pdf). The pdf file will -# contain links (just like the HTML output) instead of page references -# This makes the output suitable for online browsing using a pdf viewer. - -PDF_HYPERLINKS = NO - -# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of -# plain latex in the generated Makefile. Set this option to YES to get a -# higher quality PDF documentation. - -USE_PDFLATEX = NO - -# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. -# command to the generated LaTeX files. This will instruct LaTeX to keep -# running if errors occur, instead of asking the user for help. -# This option is also used when generating formulas in HTML. - -LATEX_BATCHMODE = NO - -# If LATEX_HIDE_INDICES is set to YES then doxygen will not -# include the index chapters (such as File Index, Compound Index, etc.) -# in the output. - -LATEX_HIDE_INDICES = NO - -#--------------------------------------------------------------------------- -# configuration options related to the RTF output -#--------------------------------------------------------------------------- - -# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output -# The RTF output is optimized for Word 97 and may not look very pretty with -# other RTF readers or editors. - -GENERATE_RTF = NO - -# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `rtf' will be used as the default path. - -RTF_OUTPUT = rtf - -# If the COMPACT_RTF tag is set to YES Doxygen generates more compact -# RTF documents. This may be useful for small projects and may help to -# save some trees in general. - -COMPACT_RTF = NO - -# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated -# will contain hyperlink fields. The RTF file will -# contain links (just like the HTML output) instead of page references. -# This makes the output suitable for online browsing using WORD or other -# programs which support those fields. -# Note: wordpad (write) and others do not support links. - -RTF_HYPERLINKS = NO - -# Load stylesheet definitions from file. Syntax is similar to doxygen's -# config file, i.e. a series of assignments. You only have to provide -# replacements, missing definitions are set to their default value. - -RTF_STYLESHEET_FILE = - -# Set optional variables used in the generation of an rtf document. -# Syntax is similar to doxygen's config file. - -RTF_EXTENSIONS_FILE = - -#--------------------------------------------------------------------------- -# configuration options related to the man page output -#--------------------------------------------------------------------------- - -# If the GENERATE_MAN tag is set to YES (the default) Doxygen will -# generate man pages - -GENERATE_MAN = NO - -# The MAN_OUTPUT tag is used to specify where the man pages will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `man' will be used as the default path. - -MAN_OUTPUT = man - -# The MAN_EXTENSION tag determines the extension that is added to -# the generated man pages (default is the subroutine's section .3) - -MAN_EXTENSION = .3 - -# If the MAN_LINKS tag is set to YES and Doxygen generates man output, -# then it will generate one additional man file for each entity -# documented in the real man page(s). These additional files -# only source the real man page, but without them the man command -# would be unable to find the correct page. The default is NO. - -MAN_LINKS = NO - -#--------------------------------------------------------------------------- -# configuration options related to the XML output -#--------------------------------------------------------------------------- - -# If the GENERATE_XML tag is set to YES Doxygen will -# generate an XML file that captures the structure of -# the code including all documentation. - -GENERATE_XML = NO - -# The XML_OUTPUT tag is used to specify where the XML pages will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `xml' will be used as the default path. - -XML_OUTPUT = xml - -# The XML_SCHEMA tag can be used to specify an XML schema, -# which can be used by a validating XML parser to check the -# syntax of the XML files. - -XML_SCHEMA = - -# The XML_DTD tag can be used to specify an XML DTD, -# which can be used by a validating XML parser to check the -# syntax of the XML files. - -XML_DTD = - -# If the XML_PROGRAMLISTING tag is set to YES Doxygen will -# dump the program listings (including syntax highlighting -# and cross-referencing information) to the XML output. Note that -# enabling this will significantly increase the size of the XML output. - -XML_PROGRAMLISTING = YES - -#--------------------------------------------------------------------------- -# configuration options for the AutoGen Definitions output -#--------------------------------------------------------------------------- - -# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will -# generate an AutoGen Definitions (see autogen.sf.net) file -# that captures the structure of the code including all -# documentation. Note that this feature is still experimental -# and incomplete at the moment. - -GENERATE_AUTOGEN_DEF = NO - -#--------------------------------------------------------------------------- -# configuration options related to the Perl module output -#--------------------------------------------------------------------------- - -# If the GENERATE_PERLMOD tag is set to YES Doxygen will -# generate a Perl module file that captures the structure of -# the code including all documentation. Note that this -# feature is still experimental and incomplete at the -# moment. - -GENERATE_PERLMOD = NO - -# If the PERLMOD_LATEX tag is set to YES Doxygen will generate -# the necessary Makefile rules, Perl scripts and LaTeX code to be able -# to generate PDF and DVI output from the Perl module output. - -PERLMOD_LATEX = NO - -# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be -# nicely formatted so it can be parsed by a human reader. This is useful -# if you want to understand what is going on. On the other hand, if this -# tag is set to NO the size of the Perl module output will be much smaller -# and Perl will parse it just the same. - -PERLMOD_PRETTY = YES - -# The names of the make variables in the generated doxyrules.make file -# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. -# This is useful so different doxyrules.make files included by the same -# Makefile don't overwrite each other's variables. - -PERLMOD_MAKEVAR_PREFIX = - -#--------------------------------------------------------------------------- -# Configuration options related to the preprocessor -#--------------------------------------------------------------------------- - -# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will -# evaluate all C-preprocessor directives found in the sources and include -# files. - -ENABLE_PREPROCESSING = YES - -# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro -# names in the source code. If set to NO (the default) only conditional -# compilation will be performed. Macro expansion can be done in a controlled -# way by setting EXPAND_ONLY_PREDEF to YES. - -MACRO_EXPANSION = NO - -# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES -# then the macro expansion is limited to the macros specified with the -# PREDEFINED and EXPAND_AS_PREDEFINED tags. - -EXPAND_ONLY_PREDEF = NO - -# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files -# in the INCLUDE_PATH (see below) will be search if a #include is found. - -SEARCH_INCLUDES = YES - -# The INCLUDE_PATH tag can be used to specify one or more directories that -# contain include files that are not input files but should be processed by -# the preprocessor. - -INCLUDE_PATH = - -# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard -# patterns (like *.h and *.hpp) to filter out the header-files in the -# directories. If left blank, the patterns specified with FILE_PATTERNS will -# be used. - -INCLUDE_FILE_PATTERNS = - -# The PREDEFINED tag can be used to specify one or more macro names that -# are defined before the preprocessor is started (similar to the -D option of -# gcc). The argument of the tag is a list of macros of the form: name -# or name=definition (no spaces). If the definition and the = are -# omitted =1 is assumed. - -PREDEFINED = - -# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then -# this tag can be used to specify a list of macro names that should be expanded. -# The macro definition that is found in the sources will be used. -# Use the PREDEFINED tag if you want to use a different macro definition. - -EXPAND_AS_DEFINED = - -# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then -# doxygen's preprocessor will remove all function-like macros that are alone -# on a line, have an all uppercase name, and do not end with a semicolon. Such -# function macros are typically used for boiler-plate code, and will confuse the -# parser if not removed. - -SKIP_FUNCTION_MACROS = YES - -#--------------------------------------------------------------------------- -# Configuration::additions related to external references -#--------------------------------------------------------------------------- - -# The TAGFILES option can be used to specify one or more tagfiles. -# Optionally an initial location of the external documentation -# can be added for each tagfile. The format of a tag file without -# this location is as follows: -# TAGFILES = file1 file2 ... -# Adding location for the tag files is done as follows: -# TAGFILES = file1=loc1 "file2 = loc2" ... -# where "loc1" and "loc2" can be relative or absolute paths or -# URLs. If a location is present for each tag, the installdox tool -# does not have to be run to correct the links. -# Note that each tag file must have a unique name -# (where the name does NOT include the path) -# If a tag file is not located in the directory in which doxygen -# is run, you must also specify the path to the tagfile here. - -TAGFILES = - -# When a file name is specified after GENERATE_TAGFILE, doxygen will create -# a tag file that is based on the input files it reads. - -GENERATE_TAGFILE = - -# If the ALLEXTERNALS tag is set to YES all external classes will be listed -# in the class index. If set to NO only the inherited external classes -# will be listed. - -ALLEXTERNALS = NO - -# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed -# in the modules index. If set to NO, only the current project's groups will -# be listed. - -EXTERNAL_GROUPS = YES - -# The PERL_PATH should be the absolute path and name of the perl script -# interpreter (i.e. the result of `which perl'). - -PERL_PATH = /usr/bin/perl - -#--------------------------------------------------------------------------- -# Configuration options related to the dot tool -#--------------------------------------------------------------------------- - -# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will -# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base or -# super classes. Setting the tag to NO turns the diagrams off. Note that this -# option is superseded by the HAVE_DOT option below. This is only a fallback. It is -# recommended to install and use dot, since it yields more powerful graphs. - -CLASS_DIAGRAMS = YES - -# If set to YES, the inheritance and collaboration graphs will hide -# inheritance and usage relations if the target is undocumented -# or is not a class. - -HIDE_UNDOC_RELATIONS = YES - -# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is -# available from the path. This tool is part of Graphviz, a graph visualization -# toolkit from AT&T and Lucent Bell Labs. The other options in this section -# have no effect if this option is set to NO (the default) - -HAVE_DOT = YES - -# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for each documented class showing the direct and -# indirect inheritance relations. Setting this tag to YES will force the -# the CLASS_DIAGRAMS tag to NO. - -CLASS_GRAPH = YES - -# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for each documented class showing the direct and -# indirect implementation dependencies (inheritance, containment, and -# class references variables) of the class with other documented classes. - -COLLABORATION_GRAPH = YES - -# If the UML_LOOK tag is set to YES doxygen will generate inheritance and -# collaboration diagrams in a style similar to the OMG's Unified Modeling -# Language. - -UML_LOOK = NO - -# If set to YES, the inheritance and collaboration graphs will show the -# relations between templates and their instances. - -TEMPLATE_RELATIONS = NO - -# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT -# tags are set to YES then doxygen will generate a graph for each documented -# file showing the direct and indirect include dependencies of the file with -# other documented files. - -INCLUDE_GRAPH = YES - -# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and -# HAVE_DOT tags are set to YES then doxygen will generate a graph for each -# documented header file showing the documented files that directly or -# indirectly include this file. - -INCLUDED_BY_GRAPH = YES - -# If the CALL_GRAPH and HAVE_DOT tags are set to YES then doxygen will -# generate a call dependency graph for every global function or class method. -# Note that enabling this option will significantly increase the time of a run. -# So in most cases it will be better to enable call graphs for selected -# functions only using the \callgraph command. - -CALL_GRAPH = NO - -# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen -# will graphical hierarchy of all classes instead of a textual one. - -GRAPHICAL_HIERARCHY = YES - -# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images -# generated by dot. Possible values are png, jpg, or gif -# If left blank png will be used. - -DOT_IMAGE_FORMAT = png - -# The tag DOT_PATH can be used to specify the path where the dot tool can be -# found. If left blank, it is assumed the dot tool can be found on the path. - -DOT_PATH = - -# The DOTFILE_DIRS tag can be used to specify one or more directories that -# contain dot files that are included in the documentation (see the -# \dotfile command). - -DOTFILE_DIRS = - -# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width -# (in pixels) of the graphs generated by dot. If a graph becomes larger than -# this value, doxygen will try to truncate the graph, so that it fits within -# the specified constraint. Beware that most browsers cannot cope with very -# large images. - -MAX_DOT_GRAPH_WIDTH = 1024 - -# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height -# (in pixels) of the graphs generated by dot. If a graph becomes larger than -# this value, doxygen will try to truncate the graph, so that it fits within -# the specified constraint. Beware that most browsers cannot cope with very -# large images. - -MAX_DOT_GRAPH_HEIGHT = 1024 - -# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the -# graphs generated by dot. A depth value of 3 means that only nodes reachable -# from the root by following a path via at most 3 edges will be shown. Nodes that -# lay further from the root node will be omitted. Note that setting this option to -# 1 or 2 may greatly reduce the computation time needed for large code bases. Also -# note that a graph may be further truncated if the graph's image dimensions are -# not sufficient to fit the graph (see MAX_DOT_GRAPH_WIDTH and MAX_DOT_GRAPH_HEIGHT). -# If 0 is used for the depth value (the default), the graph is not depth-constrained. - -MAX_DOT_GRAPH_DEPTH = 0 - -# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will -# generate a legend page explaining the meaning of the various boxes and -# arrows in the dot generated graphs. - -GENERATE_LEGEND = YES - -# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will -# remove the intermediate dot files that are used to generate -# the various graphs. - -DOT_CLEANUP = YES - -#--------------------------------------------------------------------------- -# Configuration::additions related to the search engine -#--------------------------------------------------------------------------- - -# The SEARCHENGINE tag specifies whether or not a search engine should be -# used. If set to NO the values of all tags below this one will be ignored. - -SEARCHENGINE = NO diff --git a/libs/flowcanvas/NEWS b/libs/flowcanvas/NEWS deleted file mode 100644 index bc0da0a6d4..0000000000 --- a/libs/flowcanvas/NEWS +++ /dev/null @@ -1,4 +0,0 @@ -LibFlowCanvas NEWS file - -0.0.1: - * Initial release, forked out of Om and Patchage codebases diff --git a/libs/flowcanvas/README b/libs/flowcanvas/README deleted file mode 100644 index 57cd0f2605..0000000000 --- a/libs/flowcanvas/README +++ /dev/null @@ -1 +0,0 @@ -A Gtkmm/Gnomecanvasmm widget for modular dataflow environments diff --git a/libs/flowcanvas/SConscript b/libs/flowcanvas/SConscript deleted file mode 100644 index 18b061ef82..0000000000 --- a/libs/flowcanvas/SConscript +++ /dev/null @@ -1,47 +0,0 @@ -# -*- python -*- - -import os -import os.path -import glob - -Import('env final_prefix install_prefix libraries') - -flowcanvas = env.Copy() -flowcanvas.Merge ([ - libraries['sigc2'], - libraries['gtk2'], - libraries['glibmm2'], - libraries['pangomm'], - libraries['atkmm'], - libraries['gdkmm2'], - libraries['gtkmm2'], - libraries['libgnomecanvas2'], - libraries['libgnomecanvasmm'] - ]) - -# -# this defines the version number of libflowcanvas -# - -domain = 'libflowcanvas' - -flowcanvas.Append(DOMAIN=domain,MAJOR=0,MINOR=0,MICRO=1) -flowcanvas.Append(CXXFLAGS="-DFLOWCANVAS_AA") - -flowcanvas_files = Split(""" -src/Connection.cpp -src/FlowCanvas.cpp -src/Module.cpp -src/Port.cpp -""") - -libflowcanvas = flowcanvas.SharedLibrary('flowcanvas', flowcanvas_files) - -Default(libflowcanvas) - -env.Alias('install', env.Install(os.path.join(install_prefix, env['LIBDIR'], 'ardour2'), libflowcanvas)) - -env.Alias('tarball', env.Distribute (env['DISTTREE'], - ['SConscript'] + - flowcanvas_files + - glob.glob('flowcanvas/*.h'))) diff --git a/libs/flowcanvas/doc/port_offsets.dia b/libs/flowcanvas/doc/port_offsets.dia Binary files differdeleted file mode 100644 index d50cd45fb0..0000000000 --- a/libs/flowcanvas/doc/port_offsets.dia +++ /dev/null diff --git a/libs/flowcanvas/flowcanvas/Connection.h b/libs/flowcanvas/flowcanvas/Connection.h deleted file mode 100644 index 9d50288a98..0000000000 --- a/libs/flowcanvas/flowcanvas/Connection.h +++ /dev/null @@ -1,72 +0,0 @@ -/* This file is part of FlowCanvas. Copyright (C) 2005 Dave Robillard. - * - * FlowCanvas is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * FlowCanvas is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - - -#ifndef CONNECTION_H -#define CONNECTION_H - -#include <libgnomecanvasmm.h> -#include <libgnomecanvasmm/bpath.h> -#include <libgnomecanvasmm/path-def.h> -#include <list> -#include "Port.h" - -using std::list; - -namespace LibFlowCanvas { - -class FlowCanvas; - - -/** A connection between two ports. - * - * \ingroup FlowCanvas - */ -class Connection : public Gnome::Canvas::Bpath -{ -public: - Connection(FlowCanvas* patch_bay, Port* source_port, Port* dest_port); - virtual ~Connection(); - - void update_location(); - void disconnect(); - void hilite(bool b); - - bool selected() { return m_selected; } - void selected(bool b); - - void source_port(Port* p) { m_source_port = p; } - const Port* source_port() const { return m_source_port; } - void dest_port(Port* p) { m_dest_port = p; } - const Port* dest_port() const { return m_dest_port; } - -private: - FlowCanvas* m_patch_bay; - Port* m_source_port; - Port* m_dest_port; - int m_colour; - bool m_selected; - - //Glib::RefPtr<Gnome::Canvas::PathDef> m_path; - GnomeCanvasPathDef* m_path; -}; - -typedef list<Connection*> ConnectionList; - - -} // namespace LibFlowCanvas - -#endif // CONNECTION_H diff --git a/libs/flowcanvas/flowcanvas/FlowCanvas.h b/libs/flowcanvas/flowcanvas/FlowCanvas.h deleted file mode 100644 index ab6c85f410..0000000000 --- a/libs/flowcanvas/flowcanvas/FlowCanvas.h +++ /dev/null @@ -1,152 +0,0 @@ -/* This file is part of FlowCanvas. Copyright (C) 2005 Dave Robillard. - * - * FlowCanvas is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * FlowCanvas is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - - -#ifndef FLOWCANVAS_H -#define FLOWCANVAS_H - -#include <string> -#include <list> -#include <libgnomecanvasmm.h> -#include "Connection.h" -#include "Module.h" - -using std::string; -using std::list; - - -/** FlowCanvas namespace, everything is defined under this. - * - * \ingroup FlowCanvas - */ -namespace LibFlowCanvas { - -class Port; -class Module; - - -/** \defgroup FlowCanvas Canvas widget for dataflow systems. - * - * A generic dataflow widget using libgnomecanvas. It's used by Om and - * Patchage, but could be used by anyone. - */ - - -/** The canvas widget. - * - * Applications must override some virtual methods to make the widget actually - * do anything (ie connect). - * - * \ingroup FlowCanvas - */ -#ifdef FLOWCANVAS_AA -class FlowCanvas : public Gnome::Canvas::CanvasAA -#else -class FlowCanvas : public Gnome::Canvas::Canvas -#endif // FLOWCANVAS_AA -{ -public: - FlowCanvas(double width, double height); - virtual ~FlowCanvas(); - - void destroy(); - - void add_module(Module* m); - void remove_module(const string& name); - - void add_connection(const string& mod1_name, const string& port1_name, const string& mod2_name, const string& port2_name); - bool remove_connection(const string& mod1_name, const string& port1_name, const string& mod2_name, const string& port2_name); - - void add_connection(Port* port1, Port* port2); - bool remove_connection(Port* port1, Port* port2); - - Module* find_module(const string& name); - Port* find_port(const string& module_name, const string& port_name); - - void rename_module(const string& old_name, const string& new_name); - - void set_default_placement(Module* m); - - float zoom() { return m_zoom; } - void zoom(float pix_per_unit); - - double width() const { return m_width; } - double height() const { return m_height; } - - void clear_selection(); - void select_module(Module* m); - void unselect_module(Module* m); - - ModuleMap& modules() { return m_modules; } - list<Module*>& selected_modules() { return m_selected_modules; } - list<Connection*>& selected_connections() { return m_selected_connections; } - - /** Dash applied to selected items. - * Always animating, set a rect's property_dash() to this and it - * will automagically do the rubber band thing. */ - ArtVpathDash* const select_dash() { return m_select_dash; } - - virtual bool port_event(GdkEvent* event, Port* port); - - /** Make a connection. Should be overridden by an implementation to do something. */ - virtual void connect(const Port* const port1, const Port* const port2) = 0; - - /** Disconnect two ports. Should be overridden by an implementation to do something */ - virtual void disconnect(const Port* const port1, const Port* const port2) = 0; - -protected: - ModuleMap m_modules; ///< All modules on this canvas - ConnectionList m_connections; ///< All connections on this canvas - list<Module*> m_selected_modules; ///< All currently selected modules - list<Connection*> m_selected_connections; ///< All currently selected connections - - virtual bool canvas_event(GdkEvent* event) { return false; } - -private: - Connection* get_connection(const Port* port1, const Port* port2); - void remove_connection(Connection* c); - void selected_port(Port* p); - Port* selected_port() { return m_selected_port; } - bool are_connected(const Port* port1, const Port* port2); - Port* get_port_at(double x, double y); - - //bool scroll_drag_handler(GdkEvent* event); - virtual bool select_drag_handler(GdkEvent* event); - virtual bool connection_drag_handler(GdkEvent* event); - - void ports_joined(Port* port1, Port* port2); - bool animate_selected(); - - Port* m_selected_port; ///< Selected port (hilited red from clicking once) - Port* m_connect_port; ///< Port for which a connection is being made (if applicable) - - float m_zoom; ///< Current zoom level - double m_width; - double m_height; - - enum DragState { NOT_DRAGGING, CONNECTION, SCROLL, SELECT }; - DragState m_drag_state; - - Gnome::Canvas::Rect m_base_rect; ///< Background - - Gnome::Canvas::Rect* m_select_rect; ///< Rectangle for drag selection - ArtVpathDash* m_select_dash; ///< Animated selection dash style -}; - - -} // namespace LibFlowCanvas - -#endif // FLOWCANVAS_H diff --git a/libs/flowcanvas/flowcanvas/Module.h b/libs/flowcanvas/flowcanvas/Module.h deleted file mode 100644 index 8f4d516610..0000000000 --- a/libs/flowcanvas/flowcanvas/Module.h +++ /dev/null @@ -1,128 +0,0 @@ -/* This file is part of FlowCanvas. Copyright (C) 2005 Dave Robillard. - * - * FlowCanvas is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * FlowCanvas is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - - -#ifndef MODULE_H -#define MODULE_H - -#include <string> -#include <map> -#include <libgnomecanvasmm.h> -#include "Port.h" - -using std::string; using std::multimap; - -namespace LibFlowCanvas { - -class FlowCanvas; - - -/** A module on the canvas. - * - * \ingroup FlowCanvas - */ -class Module : public Gnome::Canvas::Group -{ -public: - Module(FlowCanvas* patch_bay, const string& name, double x=0, double y=0); - virtual ~Module(); - - inline Port* const port(const string& port_name) const; - - void add_port(Port* port, bool resize=true); - void remove_port(const string& port_name, bool resize = true); - //virtual void add_port(const string& port_name, bool is_input, int colour, bool resize = true); - - void zoom(float z); - void resize(); - - void move(double dx, double dy); - virtual void move_to(double x, double y); - - bool is_within(const Gnome::Canvas::Rect* const rect); - - virtual void load_location() {} - virtual void store_location() {} - virtual void on_double_click() {} - virtual void show_menu(GdkEventButton*) {} - - // For connection drawing - double port_connection_point_offset(Port* port); - double port_connection_points_range(); - - double width() { return m_width; } - void width(double w); - double height() { return m_height; } - void height(double h); - - void hilite(bool b); - void selected(bool b); - bool selected() const { return m_selected; } - - virtual void name(const string& n); - const string& name() const { return m_name; } - - FlowCanvas* patch_bay() const { return m_patch_bay; } - int num_ports() const { return m_ports.size(); } - int base_colour() const { return 0x1F2A3CFF; } - PortList& ports() { return m_ports; } - double border_width() const { return m_border_width; } - void border_width(double w); - - Gnome::Canvas::Rect* rect() { return &m_module_box; } - Gnome::Canvas::Text* title() { return &m_canvas_title; } - -protected: - - bool module_event(GdkEvent* event); - - double m_border_width; - double m_width; - double m_height; - string m_name; - bool m_selected; - - FlowCanvas* m_patch_bay; - PortList m_ports; - - Gnome::Canvas::Rect m_module_box; - Gnome::Canvas::Text m_canvas_title; -}; - - -typedef multimap<string,Module*> ModuleMap; - - - -/** Find a port on this module. - * - * Profiling has shown this to be performance critical, hence the inlining. - * Making this faster would be a very good idea - better data structure? - */ -inline Port* const -Module::port(const string& port_name) const -{ - for (PortList::const_iterator i = m_ports.begin(); i != m_ports.end(); ++i) - if ((*i)->name() == port_name) - return (*i); - return NULL; -} - - - -} // namespace LibFlowCanvas - -#endif // MODULE_H diff --git a/libs/flowcanvas/flowcanvas/Port.h b/libs/flowcanvas/flowcanvas/Port.h deleted file mode 100644 index 69f2c426c3..0000000000 --- a/libs/flowcanvas/flowcanvas/Port.h +++ /dev/null @@ -1,102 +0,0 @@ -/* This file is part of FlowCanvas. Copyright (C) 2005 Dave Robillard. - * - * FlowCanvas is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * FlowCanvas is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - - -#ifndef PORT_H -#define PORT_H - -#include <string> -#include <list> -#include <libgnomecanvasmm.h> - -using std::string; using std::list; - -namespace LibFlowCanvas { - -class Connection; -class Module; - - -static const int PORT_LABEL_SIZE = 8000; // in thousandths of a point - - -/** A port on a module on the canvas. - * - * This is a group that contains both the label and rectangle for a port. - * - * \ingroup FlowCanvas - */ -class Port : public Gnome::Canvas::Group -{ -public: - Port(Module* module, const string& name, bool is_input, int colour); - virtual ~Port() {}; - - void add_connection(Connection* c) { m_connections.push_back(c); } - void remove_connection(Connection* c); - void move_connections(); - void raise_connections(); - void disconnect_all(); - - Gnome::Art::Point connection_coords(); - - void hilite(bool b); - void zoom(float z); - - void popup_menu(guint button, guint32 activate_time) { - m_menu.popup(button, activate_time); - } - - Module* module() const { return m_module; } - list<Connection*>& connections() { return m_connections; } - Gnome::Canvas::Rect* rect() { return &m_rect; } - Gnome::Canvas::Text* label() { return &m_label; } - bool is_input() const { return m_is_input; } - bool is_output() const { return !m_is_input; } - int colour() const { return m_colour; } - double border_width() const { return m_border_width; } - void border_width(double w); - - const string& name() const { return m_name; } - virtual void name(const string& n); - - double width() const { return m_width; } - void width(double w); - - double height() const { return m_height; } - -protected: - Module* m_module; - string m_name; - bool m_is_input; - double m_width; - double m_height; - double m_border_width; - int m_colour; - - list<Connection*> m_connections; // needed for dragging - - Gnome::Canvas::Text m_label; - Gnome::Canvas::Rect m_rect; - Gtk::Menu m_menu; -}; - - -typedef list<Port*> PortList; - -} // namespace LibFlowCanvas - -#endif // PORT_H diff --git a/libs/flowcanvas/src/Connection.cpp b/libs/flowcanvas/src/Connection.cpp deleted file mode 100644 index d792545a05..0000000000 --- a/libs/flowcanvas/src/Connection.cpp +++ /dev/null @@ -1,679 +0,0 @@ -/* This file is part of FlowCanvas. Copyright (C) 2005 Dave Robillard. - * - * FlowCanvas is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * FlowCanvas is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "flowcanvas/Connection.h" -#include <cassert> -#include <math.h> -#include <libgnomecanvasmm/libgnomecanvasmm.h> -#include "flowcanvas/FlowCanvas.h" - -// FIXME: remove -#include <iostream> -using std::cerr; using std::endl; - -namespace LibFlowCanvas { - - -Connection::Connection(FlowCanvas* patch_bay, Port* source_port, Port* dest_port) -: Gnome::Canvas::Bpath(*patch_bay->root()), - m_patch_bay(patch_bay), - m_source_port(source_port), - m_dest_port(dest_port), - m_selected(false), -// m_path(Gnome::Canvas::PathDef::create()) - m_path(gnome_canvas_path_def_new()) -{ - assert(m_source_port->is_output()); - assert(m_dest_port->is_input()); - - m_colour = m_source_port->colour() + 0x44444400; - property_width_units() = 1.0; - property_outline_color_rgba() = m_colour; - property_cap_style() = (Gdk::CapStyle)GDK_CAP_ROUND; - - update_location(); -} - - -Connection::~Connection() -{ - if (m_selected) { - for (list<Connection*>::iterator c = m_patch_bay->selected_connections().begin(); - c != m_patch_bay->selected_connections().end(); ++c) - { - if ((*c) == this) { - m_patch_bay->selected_connections().erase(c); - break; - } - } - } -} - - -#undef MIN -#define MIN(x,y) (((x) < (y)) ? (x) : (y)) - -#undef MAX -#define MAX(x,y) (((x) > (y)) ? (x) : (y)) - -#if 0 -/** Updates the connection's location to match it's source/dest ports. - * - * This is used when modules are dragged, to keep the connections attached - * to their ports. - * - * You are not expected to understand this. - */ -void -Connection::update_location() -{ - const double src_x = m_source_port->connection_coords().get_x(); - const double src_y = m_source_port->connection_coords().get_y(); - const double dst_x = m_dest_port->connection_coords().get_x(); - const double dst_y = m_dest_port->connection_coords().get_y(); - - const double src_mod_x = m_source_port->module()->property_x(); - const double src_mod_y = m_source_port->module()->property_y(); - const double src_mod_w = m_source_port->module()->width(); - const double src_mod_h = m_source_port->module()->height(); - const double dst_mod_x = m_dest_port->module()->property_x(); - const double dst_mod_y = m_dest_port->module()->property_y(); - const double dst_mod_w = m_dest_port->module()->width(); - const double dst_mod_h = m_dest_port->module()->height(); - - // Y Modifier (-1 if src module is below dst module) - double y_mod = (src_y < dst_y) ? 1.0 : -1.0; - - // Added in various places to keep things parallel - /*double src_port_offset = src_y - src_mod_y - src_title_h; - double dst_port_offset = dst_y - dst_mod_y - dst_title_h; - if (y_mod < 0.0) { - src_port_offset = src_mod_y + src_mod_h - src_y; - dst_port_offset = dst_mod_y + dst_mod_h - dst_y; - }*/ - double src_port_offset = m_source_port->module()->port_connection_point_offset(m_source_port); - double src_offset_range = m_source_port->module()->port_connection_points_range(); - double dst_port_offset = m_dest_port->module()->port_connection_point_offset(m_dest_port); - double dst_offset_range = m_dest_port->module()->port_connection_points_range(); - - /* - double smallest_offset = (src_port_offset < dst_port_offset) - ? src_port_offset : dst_port_offset; - - double smallest_offset_range = (src_port_offset < dst_port_offset) - ? m_source_port->module()->port_connection_points_range() - : m_dest_port->module()->port_connection_points_range(); - */ - double smallest_offset = (src_offset_range < dst_offset_range) - ? src_port_offset : dst_port_offset; - - double smallest_offset_range = (src_offset_range < dst_offset_range) - ? m_source_port->module()->port_connection_points_range() - : m_dest_port->module()->port_connection_points_range(); - - //double largest_offset_range = (src_offset_range > dst_offset_range) - // ? m_source_port->module()->port_connection_points_range() - // : m_dest_port->module()->port_connection_points_range(); - - double x_dist = fabs(dst_x - src_x); - double y_dist = fabs(dst_y - src_y); - - // Vertical distance between modules - double y_mod_dist = dst_mod_y - src_mod_y - src_mod_h; - if (dst_y < src_y) - y_mod_dist = src_mod_y - dst_mod_y - dst_mod_h; - if (y_mod_dist < 1.0) - y_mod_dist = 1.0; - - // Horizontal distance between modules - double x_mod_dist = dst_mod_x - src_mod_x - src_mod_w; - if (src_x > dst_x + src_mod_w) - x_mod_dist = src_mod_x - dst_mod_x - dst_mod_w; - if (x_mod_dist < 1.0) - x_mod_dist = 1.0; - - double tallest_mod_h = m_source_port->module()->height(); - if (m_dest_port->module()->height() > tallest_mod_h) - tallest_mod_h = m_dest_port->module()->height(); - - double src_x1, src_y1, src_x2, src_y2, join_x, join_y; // Path 1 - double dst_x2, dst_y2, dst_x1, dst_y1; // Path 2 - - src_x1 = src_y1 = src_x2 = src_y2 = join_x = join_y = dst_x2 = dst_y2 = dst_x1 = dst_y1 = 0.0; - - static const double join_range = 15.0; - - double src_offset = (src_y < dst_y) - ? src_port_offset : src_offset_range - src_port_offset; - double dst_offset = (src_y < dst_y) - ? dst_port_offset : dst_offset_range - dst_port_offset; - - - // Wrap around connections - if (dst_x < src_x && y_mod_dist < join_range*3.0) { - - static const double module_padding = 20.0; - - // FIXME: completely different meanings in this case than the normal case - // (this one is better though) - smallest_offset = (src_offset_range < dst_offset_range) - ? src_offset : dst_offset; - - // Limit straight out distance - if (x_dist > 60.0) - x_dist = 60.0; - if (x_dist < 80.0 && y_dist > 40.0) - x_dist = 80.0; - - // Calculate join point - join_x = dst_mod_x + dst_mod_w + x_mod_dist/2.0; - join_y = (src_y < dst_y) - ? MIN(src_mod_y, dst_mod_y) - : MAX(src_mod_y + src_mod_h, dst_mod_y + dst_mod_h); - join_y -= (smallest_offset/smallest_offset_range*join_range + module_padding) * y_mod; - - if (join_x > src_mod_x) - join_x = src_mod_x; - - // Path 1 (src_x, src_y) -> (join_x, join_y) - src_x1 = src_x + x_dist/5.0 + src_offset/src_offset_range*join_range; - src_y1 = src_y - (x_dist/3.0 + src_offset) * y_mod; - src_x2 = src_x + x_dist/3.0 + src_offset/src_offset_range*join_range; - src_y2 = join_y; - - // Path 2, (join_x, join_y) -> (dst_x, dst_y) - dst_x1 = MIN(dst_x, src_mod_x) - x_dist/5.0 - dst_offset/dst_offset_range*join_range; - dst_y1 = MIN(dst_y, src_mod_y + src_mod_h) - (x_dist/3.0 + dst_offset) * y_mod; - dst_x2 = MIN(dst_x, src_mod_x) - x_dist/3.0 - dst_offset/dst_offset_range*join_range; - dst_y2 = join_y; - - - // Curve through connections and normal (left->right) connections - // (These two cases are continuous) - } else { - /* The trick with this one is to define each curve's points exclusively in terms - * of the join point (ie nothing about the other module), and choose the join point - * cleverly */ - - // Calculate join point - double ratio = (x_dist - y_dist) / (y_dist + x_dist); - join_x = (src_x + dst_x)/2.0; - join_y = (src_y + dst_y)/2.0; - - // Vertical centre point between the modules - join_y = (src_y < dst_y) - ? (dst_mod_y - (dst_mod_y - (src_mod_y + src_mod_h)) / 2.0) - : (src_mod_y - (src_mod_y - (dst_mod_y + dst_mod_h)) / 2.0); - - join_y -= (smallest_offset / smallest_offset_range * join_range) - join_range/2.0; - - // Interpolate between (src_x < dst_x) case and (src_y == dst_y) case - if (src_x < dst_x && x_dist > y_dist) { - join_y *= (1.0-ratio); - join_y += (src_y + dst_y)/2.0 * ratio; - } - - if (src_x < dst_x) { - join_y += ((smallest_offset/smallest_offset_range)) * join_range * (1.0-fabs(ratio)); - join_x -= ((smallest_offset/smallest_offset_range)) * join_range * (1.0-fabs(ratio)) * y_mod; - } - - //cerr << "ratio: " << ratio << endl; - - // Curve through connections - if (dst_x < src_x) { - double src_x_offset = fabs(src_x - join_x)/8.0 + src_offset_range - src_offset/src_offset_range*join_range; - double dst_x_offset = fabs(dst_x - join_x)/8.0 + dst_offset_range + dst_offset/dst_offset_range*join_range; - double src_y_offset = fabs(src_y - join_y)/4.0 + src_offset/src_offset_range*(src_offset_range+join_range)/2.0; - double dst_y_offset = fabs(dst_y - join_y)/2.0 + (dst_offset_range-dst_offset)/dst_offset_range*(dst_offset_range+join_range)/2.0; - - // Path 1 (src_x, src_y) -> (join_x, join_y) - src_x1 = src_x + src_x_offset; - src_y1 = join_y - src_y_offset * y_mod; - src_x2 = src_x + src_x_offset; - src_y2 = join_y; - - // Path 2, (join_x, join_y) -> (dst_x, dst_y) - dst_x1 = dst_x - dst_x_offset; - dst_y1 = join_y + dst_y_offset * y_mod; - dst_x2 = dst_x - dst_x_offset; - dst_y2 = join_y; - - // Normal connections - } else { - double src_x_offset = fabs(src_x - join_x)/8.0 + src_offset_range - src_offset/src_offset_range*join_range; - double dst_x_offset = fabs(dst_x - join_x)/8.0 + dst_offset_range + dst_offset/dst_offset_range*join_range; - double src_y_offset = fabs(src_y - join_y)/4.0 + src_offset/src_offset_range*(src_offset_range+join_range)/2.0; - double dst_y_offset = fabs(dst_y - join_y)/2.0 + (dst_offset_range-dst_offset)/dst_offset_range*(dst_offset_range+join_range)/2.0; - - // Path 1 (src_x, src_y) -> (join_x, join_y) - src_x1 = src_x + src_x_offset; - // Interpolate from curve through case - if (x_dist < y_dist) { - // Smooth transition from (src_y) to (join_y - src_y_offset * y_mod) - src_y1 = (src_y * (1.0-fabs(ratio))) + ((join_y - src_y_offset * y_mod) * -ratio); - // Smooth transition from (join_x + src_offset_range/4.0 * -ratio) to (src_x + src_x_offset) - src_x2 = (join_x + src_offset_range/4.0 * -ratio)*(1.0-fabs(ratio)) + (src_x + src_x_offset)*-ratio; - } else { - src_y1 = src_y; - src_x2 = join_x + src_offset_range/4.0 * -ratio; - } - src_y2 = join_y - src_y_offset*(1.0-fabs(ratio)) * y_mod; - - // Path 2, (join_x, join_y) -> (dst_x, dst_y) - dst_x1 = dst_x - dst_x_offset; - dst_y1 = dst_y; - // Interpolate from curve through case - if (x_dist < y_dist) { - // Smooth transition from (dst_y) to (join_y - dst_y_offset * y_mod) - dst_y1 = (dst_y * (1.0-fabs(ratio))) + ((join_y + dst_y_offset * y_mod) * -ratio); - // Smooth transition from (join_x + dst_offset_range/4.0 * -ratio) to (dst_x + dst_x_offset) - dst_x2 = (join_x - dst_offset_range/4.0 * -ratio)*(1.0-fabs(ratio)) + (dst_x - dst_x_offset)*-ratio; - } else { - dst_y1 = dst_y; - dst_x2 = join_x - dst_offset_range/4.0 * -ratio; - } - dst_y2 = join_y + dst_y_offset*(1.0-fabs(ratio)) * y_mod; - } - /* - } else { - double src_x_offset = fabs(src_x - join_x)/4.0 + src_offset_range*2.0 - src_offset; - double dst_x_offset = fabs(dst_x - join_x)/4.0 + dst_offset + dst_offset_range; - double y_offset = fabs(join_y - src_y)/2.0; - - // Path 1 (src_x, src_y) -> (join_x, join_y) - src_x1 = src_x + src_x_offset/2.0; - src_y1 = src_y; - if (x_dist < y_dist) - src_x2 = join_x + src_x_offset * -ratio; - else - src_x2 = join_x + src_offset_range/4.0 * -ratio; - src_y2 = join_y - y_offset*(1.0-fabs(ratio)) * y_mod; - - // Path 2, (join_x, join_y) -> (dst_x, dst_y) - dst_x1 = dst_x - dst_x_offset/2.0; - dst_y1 = dst_y; - if (x_dist < y_dist) - dst_x2 = join_x - dst_x_offset * -ratio; - else - dst_x2 = join_x - dst_x_offset/4.0 * -ratio; - dst_y2 = join_y + y_offset*(1.0-fabs(ratio)) * y_mod; - }*/ - } - - /* - cerr << "src_x1: " << src_x1 << endl; - cerr << "src_y1: " << src_y1 << endl; - cerr << "src_x2: " << src_x2 << endl; - cerr << "src_y2: " << src_x2 << endl; - cerr << "join_x: " << join_x << endl; - cerr << "join_y: " << join_y << endl; - cerr << "dst_x1: " << dst_x1 << endl; - cerr << "dst_y1: " << dst_y1 << endl; - cerr << "dst_x2: " << dst_x2 << endl; - cerr << "dst_y2: " << dst_x2 << endl << endl; - */ - - m_path->reset(); - - //m_path->moveto(0,0); - - - m_path->moveto(src_x, src_y); - //m_path->lineto(join_x, join_y); - m_path->curveto(src_x1, src_y1, src_x2, src_y2, join_x, join_y); - m_path->curveto(dst_x2, dst_y2, dst_x1, dst_y1, dst_x, dst_y); - set_bpath(m_path); -} -#endif - - -/** Updates the path of the connection to match it's ports if they've moved. - */ -void -Connection::update_location() -{ - const double src_x = m_source_port->connection_coords().get_x(); - const double src_y = m_source_port->connection_coords().get_y(); - const double dst_x = m_dest_port->connection_coords().get_x(); - const double dst_y = m_dest_port->connection_coords().get_y(); - - const double src_mod_x = m_source_port->module()->property_x(); - const double src_mod_y = m_source_port->module()->property_y(); - const double src_mod_w = m_source_port->module()->width(); - const double src_mod_h = m_source_port->module()->height(); - const double dst_mod_x = m_dest_port->module()->property_x(); - const double dst_mod_y = m_dest_port->module()->property_y(); - const double dst_mod_w = m_dest_port->module()->width(); - const double dst_mod_h = m_dest_port->module()->height(); - - // Vertical distance between modules - double y_mod_dist = dst_mod_y - src_mod_y - src_mod_h; - if (dst_y < src_y) - y_mod_dist = src_mod_y - dst_mod_y - dst_mod_h; - if (y_mod_dist < 1.0) - y_mod_dist = 1.0; - - // Horizontal distance between modules - double x_mod_dist = dst_mod_x - src_mod_x - src_mod_w; - if (src_x > dst_x + src_mod_w) - x_mod_dist = src_mod_x - dst_mod_x - dst_mod_w; - if (x_mod_dist < 1.0) - x_mod_dist = 1.0; - - // Y Modifier (-1 if src module is below dst module) - double y_mod = (src_y < dst_y) ? 1.0 : -1.0; - - double x_dist = fabsl(src_x - dst_x); - double y_dist = fabsl(src_y - dst_y); - - double src_port_offset = m_source_port->module()->port_connection_point_offset(m_source_port); - double src_offset_range = m_source_port->module()->port_connection_points_range(); - double dst_port_offset = m_dest_port->module()->port_connection_point_offset(m_dest_port); - double dst_offset_range = m_dest_port->module()->port_connection_points_range(); - - double smallest_offset = (src_offset_range < dst_offset_range) - ? src_port_offset : dst_port_offset; - - double smallest_offset_range = (src_offset_range < dst_offset_range) - ? m_source_port->module()->port_connection_points_range() - : m_dest_port->module()->port_connection_points_range(); - - double tallest_module_height = m_source_port->module()->height(); - if (m_dest_port->module()->height() > tallest_module_height) - tallest_module_height = m_dest_port->module()->height(); - - double src_x1, src_y1, src_x2, src_y2, join_x, join_y; // Path 1 - double dst_x2, dst_y2, dst_x1, dst_y1; // Path 2 - src_x1 = src_y1 = src_x2 = src_y2 = join_x = join_y = dst_x2 = dst_y2 = dst_x1 = dst_y1 = 0.0; - - double join_range = 20.0; - - double src_offset = (src_y < dst_y) - ? src_port_offset : src_offset_range - src_port_offset; - double dst_offset = (src_y < dst_y) - ? dst_port_offset : dst_offset_range - dst_port_offset; - - // Wrap around connections - if ((src_x > dst_x) - && y_mod_dist < join_range*3.0 - && ((dst_x > src_mod_x+src_mod_w+join_range*2.0) || src_x > dst_x) - && (! ((src_mod_y + src_mod_h < dst_mod_y - join_range*3.0) || (dst_mod_y + dst_mod_h < src_mod_h - join_range*3.0)))) { - //|| (dst_x < src_x)) { - - static const double module_padding = 20.0; - - // FIXME: completely different meanings in this case than the normal case - // (this one is better though) - smallest_offset = (src_offset_range < dst_offset_range) - ? src_offset : dst_offset; - - // Limit straight out distance - if (x_dist > 60.0) - x_dist = 60.0; - if (x_dist < 80.0 && y_dist > 40.0) - x_dist = 80.0; - - // Calculate join point - join_x = dst_mod_x + dst_mod_w + x_mod_dist/2.0; - join_y = (src_y < dst_y) - ? MIN(src_mod_y, dst_mod_y) - : MAX(src_mod_y + src_mod_h, dst_mod_y + dst_mod_h); - join_y -= (smallest_offset/smallest_offset_range*join_range + module_padding) * y_mod; - - if (join_x > src_mod_x) - join_x = src_mod_x; - - // Path 1 (src_x, src_y) -> (join_x, join_y) - src_x1 = src_x + x_dist/5.0 + src_offset/src_offset_range*join_range; - src_y1 = src_y - (x_dist/3.0 + src_offset) * y_mod; - src_x2 = src_x + x_dist/3.0 + src_offset/src_offset_range*join_range; - src_y2 = join_y; - - // Path 2, (join_x, join_y) -> (dst_x, dst_y) - dst_x1 = MIN(dst_x, src_mod_x) - x_dist/5.0 - dst_offset/dst_offset_range*join_range; - dst_y1 = MIN(dst_y, src_mod_y + src_mod_h) - (x_dist/3.0 + dst_offset) * y_mod; - dst_x2 = MIN(dst_x, src_mod_x) - x_dist/3.0 - dst_offset/dst_offset_range*join_range; - dst_y2 = join_y; - - - // Curve through connections - } else if (dst_x < src_x) { - - join_range = MIN(join_range, smallest_offset_range); - - // Calculate join point - double ratio = (x_dist - y_dist) / (y_dist + x_dist); - join_x = (src_x + dst_x)/2.0; - join_y = (src_y + dst_y)/2.0; - - // Vertical centre point between the modules - join_y = (src_y < dst_y) - ? (dst_mod_y - (dst_mod_y - (src_mod_y + src_mod_h)) / 2.0) - : (src_mod_y - (src_mod_y - (dst_mod_y + dst_mod_h)) / 2.0); - - join_y -= (smallest_offset / smallest_offset_range * join_range) - join_range/2.0; - - // Interpolate between (src_x < dst_x) case and (src_y == dst_y) case - if (src_x < dst_x && x_dist > y_dist) { - join_y *= (1.0-ratio); - join_y += (src_y + dst_y)/2.0 * ratio; - } - - if (src_x < dst_x) { - join_y += ((smallest_offset/smallest_offset_range)) * join_range * (1.0-fabs(ratio)); - join_x -= ((smallest_offset/smallest_offset_range)) * join_range * (1.0-fabs(ratio)) * y_mod; - } - - //cerr << "ratio: " << ratio << endl; - - double src_x_offset = fabs(src_x - join_x)/8.0 + MAX(src_offset_range,join_range) - src_offset/src_offset_range*join_range; - double dst_x_offset = fabs(dst_x - join_x)/8.0 + MAX(dst_offset_range,join_range) + dst_offset/dst_offset_range*join_range; - double src_y_offset = fabs(src_y - join_y)/4.0 + src_offset/src_offset_range*(src_offset_range+join_range)/2.0; - double dst_y_offset = fabs(dst_y - join_y)/4.0 + (dst_offset_range-dst_offset)/dst_offset_range*(dst_offset_range+join_range)/2.0; - - // Path 1 (src_x, src_y) -> (join_x, join_y) - src_x1 = src_x + src_x_offset; - src_y1 = join_y - src_y_offset * y_mod; - src_x2 = src_x + src_x_offset; - src_y2 = join_y; - - // Path 2, (join_x, join_y) -> (dst_x, dst_y) - dst_x1 = dst_x - dst_x_offset; - dst_y1 = join_y + dst_y_offset * y_mod; - dst_x2 = dst_x - dst_x_offset; - dst_y2 = join_y; - - - // In between curve through and normal connections -/* } else if (x_dist < y_dist && src_mod_y + src_mod_h < dst_mod_y) { - // Calculate join point - double ratio = (x_dist - y_dist) / (y_dist + x_dist); - join_x = (src_x + dst_x)/2.0; - join_y = (src_y + dst_y)/2.0; - - // Vertical centre point between the modules - join_y = (src_y < dst_y) - ? (dst_mod_y - (dst_mod_y - (src_mod_y + src_mod_h)) / 2.0) - : (src_mod_y - (src_mod_y - (dst_mod_y + dst_mod_h)) / 2.0); - - join_y -= (smallest_offset / smallest_offset_range * join_range) - join_range/2.0; - - // Interpolate between (src_x < dst_x) case and (src_y == dst_y) case - if (src_x < dst_x && x_dist > y_dist) { - join_y *= (1.0-ratio); - join_y += (src_y + dst_y)/2.0 * ratio; - } - - if (src_x < dst_x) { - join_y += ((smallest_offset/smallest_offset_range)) * join_range * (1.0-fabs(ratio)); - join_x -= ((smallest_offset/smallest_offset_range)) * join_range * (1.0-fabs(ratio)) * y_mod; - } - double src_x_offset = fabs(src_x - join_x)/8.0 + src_offset_range - src_offset/src_offset_range*join_range; - double dst_x_offset = fabs(dst_x - join_x)/8.0 + dst_offset_range + dst_offset/dst_offset_range*join_range; - double src_y_offset = fabs(src_y - join_y)/4.0 + src_offset/src_offset_range*(src_offset_range+join_range)/2.0; - double dst_y_offset = fabs(dst_y - join_y)/2.0 + (dst_offset_range-dst_offset)/dst_offset_range*(dst_offset_range+join_range)/2.0; - - // Path 1 (src_x, src_y) -> (join_x, join_y) - src_x1 = src_x + src_x_offset; - // Interpolate from curve through case - if (x_dist < y_dist) { - // Smooth transition from (src_y) to (join_y - src_y_offset * y_mod) - src_y1 = (src_y * (1.0-fabs(ratio))) + ((join_y - src_y_offset * y_mod) * -ratio); - // Smooth transition from (join_x + src_offset_range/4.0 * -ratio) to (src_x + src_x_offset) - src_x2 = (join_x + src_offset_range/4.0 * -ratio)*(1.0-fabs(ratio)) + (src_x + src_x_offset)*-ratio; - } else { - src_y1 = src_y; - src_x2 = join_x + src_offset_range/4.0 * -ratio; - } - src_y2 = join_y - src_y_offset*(1.0-fabs(ratio)) * y_mod; - - // Path 2, (join_x, join_y) -> (dst_x, dst_y) - dst_x1 = dst_x - dst_x_offset; - dst_y1 = dst_y; - // Interpolate from curve through case - if (x_dist < y_dist) { - // Smooth transition from (dst_y) to (join_y - dst_y_offset * y_mod) - dst_y1 = (dst_y * (1.0-fabs(ratio))) + ((join_y + dst_y_offset * y_mod) * -ratio); - // Smooth transition from (join_x + dst_offset_range/4.0 * -ratio) to (dst_x + dst_x_offset) - dst_x2 = (join_x - dst_offset_range/4.0 * -ratio)*(1.0-fabs(ratio)) + (dst_x - dst_x_offset)*-ratio; - } else { - dst_y1 = dst_y; - dst_x2 = join_x - dst_offset_range/4.0 * -ratio; - } - dst_y2 = join_y + dst_y_offset*(1.0-fabs(ratio)) * y_mod; -*/ - - // "Normal" connections - } else { - - join_x = (src_x + dst_x)/2.0; - join_y = (src_y + dst_y)/2.0; -#if 0 - join_range = MIN(join_range, x_dist/2.0); - - - - /************ Find join point **************/ - - //const double join_range = 15.0; - //const double join_range = MIN(smallest_offset_range, x_dist/2.0); - //const double join_range = MIN(30.0, x_dist/2.0); - - // Calculate join point - double ratio = (x_dist - y_dist) / (y_dist + x_dist); - - cerr << "ratio: " << ratio << endl; - - /* if (MAX(x_dist, y_dist) > smallest_offset_range * 2.0) { - // Vertical centre point between the modules - join_y = (src_y < dst_y) - ? (dst_mod_y - (dst_mod_y - (src_mod_y + src_mod_h)) / 2.0) - : (src_mod_y - (src_mod_y - (dst_mod_y + dst_mod_h)) / 2.0); - - join_y -= (smallest_offset / smallest_offset_range * join_range) - join_range/2.0; - - // Interpolate between (src_x < dst_x) case and (src_y == dst_y) case - if (src_x < dst_x && x_dist > y_dist) { - join_y *= (1.0-ratio); - join_y += (src_y + dst_y)/2.0 * ratio; - } - }*/ - - if (src_x < dst_x) { - // join_y += ((smallest_offset/smallest_offset_range)) * join_range * (1.0-fabs(ratio)); - join_x -= ((smallest_offset/smallest_offset_range)) * join_range * (1.0-fabs(ratio)) * y_mod; - join_x += join_range/2.0 * (1.0-fabs(ratio)); // center - } -#endif - - /*************************************************/ - - - // Path 1 (src_x, src_y) -> (join_x, join_y) - // Control point 1 - src_x1 = src_x + fabs(join_x - src_x) / 2.0; - src_y1 = src_y; - // Control point 2 - src_x2 = join_x - fabs(join_x - src_x) / 4.0; - src_y2 = join_y - fabs(join_y - src_y) / 2.0 * y_mod; - - // Path 2, (join_x, join_y) -> (dst_x, dst_y) - // Control point 1 - dst_x1 = dst_x - fabs(join_x - dst_x) / 2.0; - dst_y1 = dst_y; - // Control point 2 - dst_x2 = join_x + fabs(join_x - dst_x) / 4.0; - dst_y2 = join_y + fabs(join_y - dst_y) / 2.0 * y_mod; - } - - // This was broken in libgnomecanvasmm with GTK 2.8. Nice work, guys. - /* - m_path->reset(); - m_path->moveto(src_x, src_y); - m_path->curveto(src_x1, src_y1, src_x2, src_y2, join_x, join_y); - m_path->curveto(dst_x2, dst_y2, dst_x1, dst_y1, dst_x, dst_y); - set_bpath(m_path); - */ - - // Work around it w/ the C API - gnome_canvas_path_def_reset(m_path); - gnome_canvas_path_def_moveto(m_path, src_x, src_y); - gnome_canvas_path_def_curveto(m_path, src_x1, src_y1, src_x2, src_y2, join_x, join_y); - gnome_canvas_path_def_curveto(m_path, dst_x2, dst_y2, dst_x1, dst_y1, dst_x, dst_y); - - GnomeCanvasBpath* c_obj = gobj(); - gnome_canvas_item_set(GNOME_CANVAS_ITEM(c_obj), "bpath", m_path, NULL); -} - - -/** Removes the reference to this connection contained in the ports. - * - * Must be called before destroying a connection. - */ -void -Connection::disconnect() -{ - m_source_port->remove_connection(this); - m_dest_port->remove_connection(this); - m_source_port = NULL; - m_dest_port = NULL; -} - - -void -Connection::hilite(bool b) -{ - if (b) - property_outline_color_rgba() = 0xFF0000FF; - else - property_outline_color_rgba() = m_colour; -} - - -void -Connection::selected(bool selected) -{ - m_selected = selected; - if (selected) - property_dash() = m_patch_bay->select_dash(); - else - property_dash() = NULL; -} - - -} // namespace LibFlowCanvas - diff --git a/libs/flowcanvas/src/FlowCanvas.cpp b/libs/flowcanvas/src/FlowCanvas.cpp deleted file mode 100644 index 0410450a71..0000000000 --- a/libs/flowcanvas/src/FlowCanvas.cpp +++ /dev/null @@ -1,884 +0,0 @@ -/* This file is part of FlowCanvas. Copyright (C) 2005 Dave Robillard. - * - * FlowCanvas is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * FlowCanvas is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - - -#include "flowcanvas/FlowCanvas.h" -#include <cassert> -#include <map> -#include <iostream> -#include <cmath> -#include "flowcanvas/Port.h" -#include "flowcanvas/Module.h" - -using std::cerr; using std::cout; using std::endl; - -namespace LibFlowCanvas { - - -FlowCanvas::FlowCanvas(double width, double height) -: m_selected_port(NULL), - m_connect_port(NULL), - m_zoom(1.0), - m_width(width), - m_height(height), - m_drag_state(NOT_DRAGGING), - m_base_rect(*root(), 0, 0, width, height), - m_select_rect(NULL), - m_select_dash(NULL) -{ - set_scroll_region(0.0, 0.0, width, height); - set_center_scroll_region(true); - - m_base_rect.property_fill_color_rgba() = 0x000000FF; - m_base_rect.show(); - //m_base_rect.signal_event().connect(sigc::mem_fun(this, &FlowCanvas::scroll_drag_handler)); - m_base_rect.signal_event().connect(sigc::mem_fun(this, &FlowCanvas::select_drag_handler)); - m_base_rect.signal_event().connect(sigc::mem_fun(this, &FlowCanvas::connection_drag_handler)); - m_base_rect.signal_event().connect(sigc::mem_fun(this, &FlowCanvas::canvas_event)); - - set_dither(Gdk::RGB_DITHER_NORMAL); // NONE or NORMAL or MAX - - // Dash style for selected modules and selection box - m_select_dash = new ArtVpathDash(); - m_select_dash->n_dash = 2; - m_select_dash->dash = art_new(double, 2); - m_select_dash->dash[0] = 5; - m_select_dash->dash[1] = 5; - - Glib::signal_timeout().connect( - sigc::mem_fun(this, &FlowCanvas::animate_selected), 150); -} - - -FlowCanvas::~FlowCanvas() -{ - destroy(); -} - - -void -FlowCanvas::zoom(float pix_per_unit) -{ - // Round to .25 - m_zoom = static_cast<int>(pix_per_unit*4) / 4.0; - if (m_zoom < 0.25) - m_zoom = 0.25; - - set_pixels_per_unit(m_zoom); - - for (ModuleMap::iterator m = m_modules.begin(); m != m_modules.end(); ++m) - (*m).second->zoom(m_zoom); -} - - -void -FlowCanvas::clear_selection() -{ - for (list<Module*>::iterator m = m_selected_modules.begin(); m != m_selected_modules.end(); ++m) - (*m)->selected(false); - - for (list<Connection*>::iterator c = m_selected_connections.begin(); c != m_selected_connections.end(); ++c) - (*c)->selected(false); - - m_selected_modules.clear(); - m_selected_connections.clear(); -} - - -/** Add a module to the current selection, and automagically select any connections - * between selected modules */ -void -FlowCanvas::select_module(Module* m) -{ - assert(! m->selected()); - - m_selected_modules.push_back(m); - - Connection* c; - for (ConnectionList::iterator i = m_connections.begin(); i != m_connections.end(); ++i) { - c = (*i); - if ( !c->selected()) { - if (c->source_port()->module() == m && c->dest_port()->module()->selected()) { - c->selected(true); - m_selected_connections.push_back(c); - } else if (c->dest_port()->module() == m && c->source_port()->module()->selected()) { - c->selected(true); - m_selected_connections.push_back(c); - } - } - } - - m->selected(true); -} - - -void -FlowCanvas::unselect_module(Module* m) -{ - assert(m->selected()); - - // Remove any connections that aren't selected anymore because this module isn't - Connection* c; - for (ConnectionList::iterator i = m_selected_connections.begin(); i != m_selected_connections.end();) { - c = (*i); - if (c->selected() - && ((c->source_port()->module() == m && c->dest_port()->module()->selected()) - || c->dest_port()->module() == m && c->source_port()->module()->selected())) - { - c->selected(false); - i = m_selected_connections.erase(i); - } else { - ++i; - } - } - - // Remove the module - for (list<Module*>::iterator i = m_selected_modules.begin(); i != m_selected_modules.end(); ++i) { - if ((*i) == m) { - m_selected_modules.erase(i); - break; - } - } - - m->selected(false); -} - - -/** Removes all ports and connections and modules. - */ -void -FlowCanvas::destroy() -{ - for (ModuleMap::iterator m = m_modules.begin(); m != m_modules.end(); ++m) - delete (*m).second; - for (ConnectionList::iterator c = m_connections.begin(); c != m_connections.end(); ++c) - delete (*c); - - m_modules.clear(); - m_connections.clear(); - - m_selected_port = NULL; - m_connect_port = NULL; -} - - -void -FlowCanvas::selected_port(Port* p) -{ - if (m_selected_port != NULL) - m_selected_port->rect()->property_fill_color_rgba() = m_selected_port->colour(); // "turn off" the old one - - m_selected_port = p; - - if (p != NULL) - m_selected_port->rect()->property_fill_color() = "red"; -} - - -Module* -FlowCanvas::find_module(const string& name) -{ - ModuleMap::iterator m = m_modules.find(name); - - if (m != m_modules.end()) - return (*m).second; - else - return NULL; -} - - -/** Sets the passed module's location to a reasonable default. - */ -void -FlowCanvas::set_default_placement(Module* m) -{ - assert(m != NULL); - - // Simple cascade. This will get more clever in the future. - double x = ((m_width / 2.0) + (m_modules.size() * 25)); - double y = ((m_height / 2.0) + (m_modules.size() * 25)); - - m->move_to(x, y); -} - - -void -FlowCanvas::add_module(Module* m) -{ - assert(m != NULL); - std::pair<string, Module*> p(m->name(), m); - m_modules.insert(p); -} - - -void -FlowCanvas::remove_module(const string& name) -{ - ModuleMap::iterator m = m_modules.find(name); - - if (m != m_modules.end()) { - delete (*m).second; - m_modules.erase(m); - } else { - cerr << "[FlowCanvas::remove_module] Unable to find module!" << endl; - } -} - - -Port* -FlowCanvas::find_port(const string& node_name, const string& port_name) -{ - Module* module = NULL; - Port* port = NULL; - - for (ModuleMap::iterator i = m_modules.begin(); i != m_modules.end(); ++i) { - module = (*i).second; - port = module->port(port_name); - if (module->name() == node_name && port != NULL) - return port; - } - - cerr << "[FlowCanvas::find_port] Failed to find port " << - node_name << ":" << port_name << endl; - - return NULL; -} - - -void -FlowCanvas::rename_module(const string& old_name, const string& new_name) -{ - Module* module = NULL; - - for (ModuleMap::iterator i = m_modules.begin(); i != m_modules.end(); ++i) { - module = (*i).second; - assert(module != NULL); - if (module->name() == old_name) { - m_modules.erase(i); - module->name(new_name); - add_module(module); - return; - } - } - - cerr << "[FlowCanvas::rename_module] Failed to find module " << - old_name << endl; -} - - -/** Add a connection. - */ -void -FlowCanvas::add_connection(const string& node1_name, const string& port1_name, - const string& node2_name, const string& port2_name) -{ - Port* port1 = find_port(node1_name, port1_name); - Port* port2 = find_port(node2_name, port2_name); - - if (port1 == NULL) { - cerr << "Unable to find port " << node1_name << ":" << port1_name - << " to make connection." << endl; - } else if (port2 == NULL) { - cerr << "Unable to find port " << node2_name << ":" << port2_name - << " to make connection." << endl; - } else { - add_connection(port1, port2); - } -} - - -bool -FlowCanvas::remove_connection(Port* port1, Port* port2) -{ - assert(port1 != NULL); - assert(port2 != NULL); - - Connection* c = get_connection(port1, port2); - if (c == NULL) { - cerr << "Couldn't find connection.\n"; - return false; - } else { - remove_connection(c); - return true; - } -} - - -/** Remove a connection. - * - * Returns whether or not the connection was found (and removed). - */ -bool -FlowCanvas::remove_connection(const string& mod1_name, const string& port1_name, const string& mod2_name, const string& port2_name) -{ - Connection* c = get_connection(find_port(mod1_name, port1_name), - find_port(mod2_name, port2_name)); - if (c == NULL) { - cerr << "Couldn't find connection.\n"; - return false; - } else { - remove_connection(c); - return true; - } -} - - -bool -FlowCanvas::are_connected(const Port* port1, const Port* port2) -{ - assert(port1 != NULL); - assert(port2 != NULL); - - ConnectionList::const_iterator c; - const Connection* connection; - - - for (c = m_connections.begin(); c != m_connections.end(); ++c) { - connection = *c; - if (connection->source_port() == port1 && connection->dest_port() == port2) - return true; - if (connection->source_port() == port2 && connection->dest_port() == port1) - return true; - } - - return false; -} - - -Connection* -FlowCanvas::get_connection(const Port* port1, const Port* port2) -{ - assert(port1 != NULL); - assert(port2 != NULL); - - for (ConnectionList::iterator i = m_connections.begin(); i != m_connections.end(); ++i) { - if ( (*i)->source_port() == port1 && (*i)->dest_port() == port2 ) - return *i; - else if ( (*i)->dest_port() == port1 && (*i)->source_port() == port2 ) - return *i; - } - - return NULL; -} - - -void -FlowCanvas::add_connection(Port* port1, Port* port2) -{ - assert(port1->is_input() != port2->is_input()); - assert(port1->is_output() != port2->is_output()); - Port* src_port = NULL; - Port* dst_port = NULL; - if (port1->is_output() && port2->is_input()) { - src_port = port1; - dst_port = port2; - } else { - src_port = port2; - dst_port = port1; - } - - // Create (graphical) connection object - if (get_connection(port1, port2) == NULL) { - Connection* c = new Connection(this, src_port, dst_port); - port1->add_connection(c); - port2->add_connection(c); - m_connections.push_back(c); - } -} - - -void -FlowCanvas::remove_connection(Connection* connection) -{ - assert(connection != NULL); - - ConnectionList::iterator i = find(m_connections.begin(), m_connections.end(), connection); - Connection* c = *i; - - c->disconnect(); - m_connections.erase(i); - delete c; -} - - -/** Called when two ports are 'toggled' (connected or disconnected) - */ -void -FlowCanvas::ports_joined(Port* port1, Port* port2) -{ - assert(port1 != NULL); - assert(port2 != NULL); - - port1->hilite(false); - port2->hilite(false); - - string src_mod_name, dst_mod_name, src_port_name, dst_port_name; - - Port* src_port = NULL; - Port* dst_port = NULL; - - if (port2->is_input() && ! port1->is_input()) { - src_port = port1; - dst_port = port2; - } else if ( ! port2->is_input() && port1->is_input()) { - src_port = port2; - dst_port = port1; - } else { - return; - } - - if (are_connected(src_port, dst_port)) - disconnect(src_port, dst_port); - else - connect(src_port, dst_port); -} - - -/** Event handler for ports. - * - * These events can't be handled in the Port class because they have to do with - * connections etc. which deal with multiple ports (ie m_selected_port). Ports - * pass their events on to this function to get around this. - */ -bool -FlowCanvas::port_event(GdkEvent* event, Port* port) -{ - static bool port_dragging = false; - bool handled = true; - - switch (event->type) { - - case GDK_BUTTON_PRESS: - if (event->button.button == 1) { - port_dragging = true; - } else if (event->button.button == 3) { - m_selected_port = port; - port->popup_menu(event->button.button, event->button.time); - } else { - handled = false; - } - break; - - case GDK_BUTTON_RELEASE: - if (port_dragging) { - if (m_connect_port == NULL) { - selected_port(port); - m_connect_port = port; - } else { - ports_joined(port, m_connect_port); - m_connect_port = NULL; - selected_port(NULL); - } - port_dragging = false; - } else { - handled = false; - } - break; - - case GDK_ENTER_NOTIFY: - if (port != m_selected_port) - port->hilite(true); - break; - - case GDK_LEAVE_NOTIFY: - if (port_dragging) { - m_drag_state = CONNECTION; - m_connect_port = port; - - m_base_rect.grab(GDK_POINTER_MOTION_MASK | GDK_BUTTON_RELEASE_MASK, - Gdk::Cursor(Gdk::CROSSHAIR), event->button.time); - - port_dragging = false; - } else { - if (port != m_selected_port) - port->hilite(false); - } - break; - - default: - handled = false; - } - - return handled; -} - - -/* -bool -FlowCanvas::canvas_event(GdkEvent* event) -{ - if (m_connection_dragging) { - return connection_drag_handler(event); - } else if (m_scroll_dragging) { - return scroll_drag_handler(event); - } else if (event->type == GDK_BUTTON_PRESS && event->button.button == 2) { - get_scroll_offsets(m_scroll_offset_x, m_scroll_offset_y); - //double x, y; - //window_to_world(event->button.x, event->button.y, x, y); - //w2c(x, y, m_scroll_origin_x, m_scroll_origin_y); - m_scroll_origin_x = event->button.x; - m_scroll_origin_y = event->button.y; - //root()->w2i(m_scroll_origin_x, m_scroll_origin_y); - //window_to_world(event->button.x, event->button.y, x, y); - //w2c(x, y, m_scroll_origin_x, m_scroll_origin_y); - m_scroll_dragging = true; - } - return false; -} -*/ - - -/* I can not get this to work for the life of me. - * Man I hate gnomecanvas. -bool -FlowCanvas::scroll_drag_handler(GdkEvent* event) -{ - - bool handled = true; - - static int original_scroll_x = 0; - static int original_scroll_y = 0; - static double origin_x = 0; - static double origin_y = 0; - static double x_offset = 0; - static double y_offset = 0; - static double scroll_offset_x = 0; - static double scroll_offset_y = 0; - static double last_x = 0; - static double last_y = 0; - - bool first_motion = true; - - if (event->type == GDK_BUTTON_PRESS && event->button.button == 2) { - m_base_rect.grab(GDK_POINTER_MOTION_MASK | GDK_BUTTON_RELEASE_MASK | GDK_BUTTON_PRESS_MASK, - Gdk::Cursor(Gdk::FLEUR), event->button.time); - get_scroll_offsets(original_scroll_x, original_scroll_y); - scroll_offset_x = original_scroll_x; - scroll_offset_y = original_scroll_y; - origin_x = event->button.x; - origin_y = event->button.y; - last_x = origin_x; - last_y = origin_y; - first_motion = true; - m_scroll_dragging = true; - - } else if (event->type == GDK_MOTION_NOTIFY && m_scroll_dragging) { - // These are world-relative coordinates - double x = event->motion.x_root; - double y = event->motion.y_root; - - //c2w(x, y, x, y); - //world_to_window(x, y, x, y); - //window_to_world(event->button.x, event->button.y, x, y); - //w2c(x, y, x, y); - - x_offset += last_x - x;//x + original_scroll_x; - y_offset += last_y - y;// + original_scroll_y; - - //cerr << "Coord: (" << x << "," << y << ")\n"; - //cerr << "Offset: (" << x_offset << "," << y_offset << ")\n"; - - int temp_x; - int temp_y; - w2c(lrint(x_offset), lrint(y_offset), - temp_x, temp_y); - scroll_offset_x += temp_x; - scroll_offset_y += temp_y; - scroll_to(scroll_offset_x, - scroll_offset_y); - last_x = x; - last_y = y; - } else if (event->type == GDK_BUTTON_RELEASE && m_scroll_dragging) { - m_base_rect.ungrab(event->button.time); - m_scroll_dragging = false; - } else { - handled = false; - } - - return handled; - return false; -} -*/ - - -bool -FlowCanvas::select_drag_handler(GdkEvent* event) -{ - Module* module = NULL; - - if (event->type == GDK_BUTTON_PRESS && event->button.button == 1) { - assert(m_select_rect == NULL); - m_drag_state = SELECT; - if ( !(event->button.state & GDK_CONTROL_MASK)) - clear_selection(); - m_select_rect = new Gnome::Canvas::Rect(*root(), - event->button.x, event->button.y, event->button.x, event->button.y); - m_select_rect->property_fill_color_rgba() = 0x273344FF; - m_select_rect->property_outline_color_rgba() = 0xEEEEFFFF; - m_select_rect->lower_to_bottom(); - m_base_rect.lower_to_bottom(); - return true; - } else if (event->type == GDK_MOTION_NOTIFY && m_drag_state == SELECT) { - assert(m_select_rect != NULL); - m_select_rect->property_x2() = event->button.x; - m_select_rect->property_y2() = event->button.y; - return true; - } else if (event->type == GDK_BUTTON_RELEASE && m_drag_state == SELECT) { - // Select all modules within rect - for (ModuleMap::iterator i = m_modules.begin(); i != m_modules.end(); ++i) { - module = (*i).second; - if (module->is_within(m_select_rect)) { - if (module->selected()) - unselect_module(module); - else - select_module(module); - } - } - - delete m_select_rect; - m_select_rect = NULL; - m_drag_state = NOT_DRAGGING; - return true; - } - return false; -} - - -/** Updates m_select_dash for rotation effect, and updates any - * selected item's borders (and the selection rectangle). - */ -bool -FlowCanvas::animate_selected() -{ - static int i = 10; - - if (--i == 0) - i = 10; - - m_select_dash->offset = i; - - if (m_select_rect != NULL) - m_select_rect->property_dash() = m_select_dash; - - for (list<Module*>::iterator m = m_selected_modules.begin(); m != m_selected_modules.end(); ++m) - (*m)->rect()->property_dash() = m_select_dash; - - for (list<Connection*>::iterator c = m_selected_connections.begin(); c != m_selected_connections.end(); ++c) - (*c)->property_dash() = m_select_dash; - - return true; -} - - -bool -FlowCanvas::connection_drag_handler(GdkEvent* event) -{ - bool handled = true; - - // These are invisible, just used for making connections (while dragging) - static Module* drag_module = NULL; - static Port* drag_port = NULL; - - static Connection* drag_connection = NULL; - static Port* snapped_port = NULL; - - static bool snapped = false; - - if (event->type == GDK_BUTTON_PRESS && event->button.button == 2) { - m_drag_state = SCROLL; - } else if (event->type == GDK_MOTION_NOTIFY && m_drag_state == CONNECTION) { - double x = event->button.x, y = event->button.y; - root()->w2i(x, y); - - if (drag_connection == NULL) { // Havn't created the connection yet - assert(drag_port == NULL); - assert(m_connect_port != NULL); - - drag_module = new Module(this, ""); - bool drag_port_is_input = true; - if (m_connect_port->is_input()) - drag_port_is_input = false; - - drag_port = new Port(drag_module, "", drag_port_is_input, m_connect_port->colour()); - drag_module->add_port(drag_port); - - //drag_port->hide(); - drag_module->hide(); - - drag_module->move_to(x, y); - - drag_port->property_x() = 0; - drag_port->property_y() = 0; - drag_port->rect()->property_x2() = 1; - drag_port->rect()->property_y2() = 1; - if (drag_port_is_input) - drag_connection = new Connection(this, m_connect_port, drag_port); - else - drag_connection = new Connection(this, drag_port, m_connect_port); - - drag_connection->update_location(); - //drag_connection->property_line_style() = Gdk::LINE_DOUBLE_DASH; - //drag_connection->property_last_arrowhead() = true; - } - - if (snapped) { - if (drag_connection != NULL) drag_connection->hide(); - Port* p = get_port_at(x, y); - if (drag_connection != NULL) drag_connection->show(); - if (p != NULL) { - if (p != m_selected_port) { - if (snapped_port != NULL) - snapped_port->hilite(false); - p->hilite(true); - snapped_port = p; - } - drag_module->property_x() = p->module()->property_x().get_value(); - drag_module->rect()->property_x2() = p->module()->rect()->property_x2().get_value(); - drag_module->property_y() = p->module()->property_y().get_value(); - drag_module->rect()->property_y2() = p->module()->rect()->property_y2().get_value(); - drag_port->property_x() = p->property_x().get_value(); - drag_port->property_y() = p->property_y().get_value(); - } else { // off the port now, unsnap - if (snapped_port != NULL) - snapped_port->hilite(false); - snapped_port = NULL; - snapped = false; - drag_module->property_x() = x; - drag_module->property_y() = y; - drag_port->property_x() = 0; - drag_port->property_y() = 0; - drag_port->rect()->property_x2() = 1; - drag_port->rect()->property_y2() = 1; - } - drag_connection->update_location(); - } else { // not snapped to a port - assert(drag_module != NULL); - assert(drag_port != NULL); - assert(m_connect_port != NULL); - - // "Snap" to port, if we're on a port and it's the right direction - if (drag_connection != NULL) drag_connection->hide(); - Port* p = get_port_at(x, y); - if (drag_connection != NULL) drag_connection->show(); - if (p != NULL && p->is_input() != m_connect_port->is_input()) { - p->hilite(true); - snapped_port = p; - snapped = true; - // Make drag module and port exactly the same size/loc as the snapped - drag_module->move_to(p->module()->property_x().get_value(), p->module()->property_y().get_value()); - drag_module->width(p->module()->width()); - drag_module->height(p->module()->height()); - drag_port->property_x() = p->property_x().get_value(); - drag_port->property_y() = p->property_y().get_value(); - // Make the drag port as wide as the snapped port so the connection coords are the same - drag_port->rect()->property_x2() = p->rect()->property_x2().get_value(); - drag_port->rect()->property_y2() = p->rect()->property_y2().get_value(); - } else { - drag_module->property_x() = x; - drag_module->property_y() = y; - } - drag_connection->update_location(); - } - } else if (event->type == GDK_BUTTON_RELEASE && m_drag_state == CONNECTION) { - m_base_rect.ungrab(event->button.time); - - double x = event->button.x; - double y = event->button.y; - m_base_rect.i2w(x, y); - - if (drag_connection != NULL) drag_connection->hide(); - Port* p = get_port_at(x, y); - if (drag_connection != NULL) drag_connection->show(); - - if (p != NULL) { - if (p == m_connect_port) { // drag ended on same port it started on - if (m_selected_port == NULL) { // no active port, just activate (hilite) it - selected_port(m_connect_port); - } else { // there is already an active port, connect it with this one - if (m_selected_port != m_connect_port) - ports_joined(m_selected_port, m_connect_port); - selected_port(NULL); - m_connect_port = NULL; - snapped_port = NULL; - } - } else { // drag ended on different port - //p->hilite(false); - ports_joined(m_connect_port, p); - selected_port(NULL); - m_connect_port = NULL; - snapped_port = NULL; - } - } - - // Clean up dragging stuff - if (m_connect_port != NULL) - m_connect_port->hilite(false); - - m_drag_state = NOT_DRAGGING; - delete drag_connection; - drag_connection = NULL; - //delete drag_port; - drag_port = NULL; - delete drag_module; // deletes drag_port - drag_module = NULL; - snapped_port = NULL; - } else { - handled = false; - } - - return handled; -} - - -Port* -FlowCanvas::get_port_at(double x, double y) -{ - Gnome::Canvas::Item* item = get_item_at(x, y); - if (item == NULL) return NULL; - - Port* p = NULL; - // Loop through every port and see if the item at these coordinates is that port - // yes, this is disgusting ;) - for (ModuleMap::iterator i = m_modules.begin(); i != m_modules.end(); ++i) { - for (PortList::iterator j = (*i).second->ports().begin(); j != (*i).second->ports().end(); ++j) { - p = (*j); - - if ((Gnome::Canvas::Item*)p == item - || (Gnome::Canvas::Item*)(p->rect()) == item - || (Gnome::Canvas::Item*)(p->label()) == item) { - return p; - } - } - } - return NULL; -} - -/* -void -FlowCanvas::port_menu_disconnect_all() -{ - Connection* c = NULL; - list<Connection*> temp_list = m_selected_port->connections(); - for (list<Connection*>::iterator i = temp_list.begin(); i != temp_list.end(); ++i) { - c = *i; - disconnect(c->source_port(), c->dest_port()); - } - - selected_port(NULL); -} -*/ - -} // namespace LibFlowCanvas diff --git a/libs/flowcanvas/src/Module.cpp b/libs/flowcanvas/src/Module.cpp deleted file mode 100644 index 14f9e3eda6..0000000000 --- a/libs/flowcanvas/src/Module.cpp +++ /dev/null @@ -1,472 +0,0 @@ -/* This file is part of FlowCanvas. Copyright (C) 2005 Dave Robillard. - * - * FlowCanvas is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * FlowCanvas is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - - -#include "flowcanvas/Module.h" -#include "flowcanvas/FlowCanvas.h" -#include <functional> -#include <list> -#include <cstdlib> -#include <cassert> -#include <cmath> - -using std::string; - -namespace LibFlowCanvas { - -static const int MODULE_FILL_COLOUR = 0x122A3CFF; -static const int MODULE_OUTLINE_COLOUR = 0x8899AAFF; -static const int MODULE_TITLE_COLOUR = 0xDDEEFFFF; - -Module::Module(FlowCanvas* patch_bay, const string& name, double x, double y) -: Gnome::Canvas::Group(*patch_bay->root(), x, y), - m_name(name), - m_selected(false), - m_patch_bay(patch_bay), - m_module_box(*this, 0, 0, 0, 0), // w, h set later - m_canvas_title(*this, 0, 6, name) // x set later -{ - assert(m_patch_bay != NULL); - - m_module_box.property_fill_color_rgba() = MODULE_FILL_COLOUR; - - m_module_box.property_outline_color_rgba() = MODULE_OUTLINE_COLOUR; - m_module_box.property_join_style() = Gdk::JOIN_ROUND; - border_width(1.0); - - m_canvas_title.property_size_set() = true; - m_canvas_title.property_size() = 10000; - m_canvas_title.property_weight_set() = true; - m_canvas_title.property_weight() = 400; - m_canvas_title.property_fill_color_rgba() = MODULE_TITLE_COLOUR; - - width(m_canvas_title.property_text_width() + 6.0); - height(m_canvas_title.property_text_height() + 2.0); - m_canvas_title.property_x() = m_width/2.0; - - signal_event().connect(sigc::mem_fun(this, &Module::module_event)); -} - - -Module::~Module() -{ - if (m_selected) { - for (list<Module*>::iterator i = m_patch_bay->selected_modules().begin(); - i != m_patch_bay->selected_modules().end(); ++i) - { - if ((*i) == this) { - m_patch_bay->selected_modules().erase(i); - break; - } - } - } - for (PortList::iterator p = m_ports.begin(); p != m_ports.end(); ++p) - delete (*p); -} - -/** Set the border width of the module. - * - * Do NOT directly set the width_units property on the rect, use this function. - */ -void -Module::border_width(double w) -{ - m_border_width = w; - m_module_box.property_width_units() = w; -} - - -bool -Module::module_event(GdkEvent* event) -{ - assert(event != NULL); - - static double x, y; - static double drag_start_x, drag_start_y; - double module_x, module_y; // FIXME: bad name, actually mouse click loc - static bool dragging = false; - bool handled = true; - - module_x = event->button.x; - module_y = event->button.y; - - property_parent().get_value()->w2i(module_x, module_y); - - switch (event->type) { - - case GDK_2BUTTON_PRESS: - on_double_click(); - handled = true; - break; - - case GDK_BUTTON_PRESS: - if (event->button.button == 1) { - x = module_x; - y = module_y; - // Set these so we can tell on a button release if a drag actually - // happened (if not, it's just a click) - drag_start_x = x; - drag_start_y = y; - grab(GDK_POINTER_MOTION_MASK | GDK_BUTTON_RELEASE_MASK | GDK_BUTTON_PRESS_MASK, - Gdk::Cursor(Gdk::FLEUR), - event->button.time); - dragging = true; - } else if (event->button.button == 2) { - on_double_click(); - handled = true; - } else if (event->button.button == 3) { - show_menu(&event->button); - } else { - handled = false; - } - break; - - case GDK_MOTION_NOTIFY: - if ((dragging && (event->motion.state & GDK_BUTTON1_MASK))) { - double new_x = module_x; - double new_y = module_y; - - // Move any other selected modules if we're selected - if (m_selected) { - for (list<Module*>::iterator i = m_patch_bay->selected_modules().begin(); - i != m_patch_bay->selected_modules().end(); ++i) - { - (*i)->move(new_x - x, new_y - y); - } - } else { - move(new_x - x, new_y - y); - } - - x = new_x; - y = new_y; - } else { - handled = false; - } - break; - - case GDK_BUTTON_RELEASE: - if (dragging) { - ungrab(event->button.time); - dragging = false; - if (module_x != drag_start_x || module_y != drag_start_y) {// dragged - store_location(); - } else { // just a click - if (m_selected) { - m_patch_bay->unselect_module(this); - assert(!m_selected); - } else { - if ( !(event->button.state & GDK_CONTROL_MASK)) - m_patch_bay->clear_selection(); - m_patch_bay->select_module(this); - assert(m_selected); - } - } - } else { - handled = false; - } - break; - - case GDK_ENTER_NOTIFY: - hilite(true); - raise_to_top(); - for (PortList::iterator p = m_ports.begin(); p != m_ports.end(); ++p) - (*p)->raise_connections(); - break; - - case GDK_LEAVE_NOTIFY: - hilite(false); - break; - - default: - handled = false; - } - - return handled; -} - - -void -Module::zoom(float z) -{ - m_canvas_title.property_size() = static_cast<int>(roundf(10000.0f * z)); - for (PortList::iterator p = m_ports.begin(); p != m_ports.end(); ++p) - (*p)->zoom(z); -} - - -void -Module::hilite(bool b) -{ - if (b) { - m_module_box.property_fill_color_rgba() = 0x223553FF; - } else { - m_module_box.property_fill_color_rgba() = MODULE_FILL_COLOUR; - } -} - - -void -Module::selected(bool selected) -{ - m_selected = selected; - if (selected) { - m_module_box.property_fill_color_rgba() = 0x223553FF; - m_module_box.property_outline_color_rgba() = 0xEEEEFFFF; - m_module_box.property_dash() = m_patch_bay->select_dash(); - m_canvas_title.property_fill_color_rgba() = 0xEEEEFFFF; - //for (PortList::iterator p = m_ports.begin(); p != m_ports.end(); ++p) - // (*p)->rect()->property_outline_color_rgba() = 0xEEEEFFFF; - } else { - m_module_box.property_fill_color_rgba() = MODULE_FILL_COLOUR; - m_module_box.property_outline_color_rgba() = MODULE_OUTLINE_COLOUR; - m_module_box.property_dash() = NULL; - m_canvas_title.property_fill_color_rgba() = MODULE_TITLE_COLOUR; - //for (PortList::iterator p = m_ports.begin(); p != m_ports.end(); ++p) - // (*p)->rect()->property_outline_color_rgba() = 0x8899AAFF; - } -} - - -bool -Module::is_within(const Gnome::Canvas::Rect* const rect) -{ - const double x1 = rect->property_x1(); - const double y1 = rect->property_y1(); - const double x2 = rect->property_x2(); - const double y2 = rect->property_y2(); - - if (x1 < x2 && y1 < y2) { - return (property_x() > x1 - && property_y() > y1 - && property_x() + width() < x2 - && property_y() + height() < y2); - } else if (x2 < x1 && y2 < y1) { - return (property_x() > x2 - && property_y() > y2 - && property_x() + width() < x1 - && property_y() + height() < y1); - } else if (x1 < x2 && y2 < y1) { - return (property_x() > x1 - && property_y() > y2 - && property_x() + width() < x2 - && property_y() + height() < y1); - } else if (x2 < x1 && y1 < y2) { - return (property_x() > x2 - && property_y() > y1 - && property_x() + width() < x1 - && property_y() + height() < y2); - } else { - return false; - } -} - - -void -Module::remove_port(const string& port_name, bool resize_to_fit) -{ - for (PortList::iterator i = m_ports.begin(); i != m_ports.end(); ++i) { - if ((*i)->name() == port_name) { - delete (*i); - i = m_ports.erase(i); - } - } - - if (resize_to_fit) - resize(); -} - - -void -Module::width(double w) -{ - m_width = w; - m_module_box.property_x2() = m_module_box.property_x1() + w; -} - - -void -Module::height(double h) -{ - m_height = h; - m_module_box.property_y2() = m_module_box.property_y1() + h; -} - - -/** Overloaded Group::move to update connection paths and keep module on the canvas */ -void -Module::move(double dx, double dy) -{ - double new_x = property_x() + dx; - double new_y = property_y() + dy; - - if (new_x < 0) dx = property_x() * -1; - else if (new_x + m_width > m_patch_bay->width()) dx = m_patch_bay->width() - property_x() - m_width; - - if (new_y < 0) dy = property_y() * -1; - else if (new_y + m_height > m_patch_bay->height()) dy = m_patch_bay->height() - property_y() - m_height; - - Gnome::Canvas::Group::move(dx, dy); - - // Deal with moving the connection lines - for (PortList::iterator p = ports().begin(); p != ports().end(); ++p) - (*p)->move_connections(); -} - - -/** Move to the specified absolute coordinate on the canvas */ -void -Module::move_to(double x, double y) -{ - if (x < 0) x = 0; - if (y < 0) y = 0; - if (x + m_width > m_patch_bay->width()) x = m_patch_bay->width() - m_width; - if (y + m_height > m_patch_bay->height()) y = m_patch_bay->height() - m_height; - - // Man, not many things left to try to get the damn things to move! :) - property_x() = x; - property_y() = y; - move(0, 0); - // Deal with moving the connection lines - for (PortList::iterator p = ports().begin(); p != ports().end(); ++p) - (*p)->move_connections(); -} - - -void -Module::name(const string& n) -{ - m_name = n; - m_canvas_title.property_text() = m_name; - resize(); -} - -/* -void -Module::add_port(const string& port_name, bool is_input, int colour, bool resize_to_fit) -{ - Port* port = new Port(this, port_name, is_input, colour); - - port->signal_event().connect( - sigc::bind<Port*>(sigc::mem_fun(m_patch_bay, &FlowCanvas::port_event), port)); - - add_port(port, resize_to_fit); -} -*/ - -void -Module::add_port(Port* port, bool resize_to_fit) -{ - m_ports.push_back(port); - - if (resize_to_fit) - resize(); -} - - -/** Resize the module to fit its contents best. - */ -void -Module::resize() -{ - double widest_in = 0.0; - double widest_out = 0.0; - - Port* p = NULL; - - // Find widest in/out ports - for (PortList::iterator i = m_ports.begin(); i != m_ports.end(); ++i) { - p = (*i); - if (p->is_input() && p->width() > widest_in) - widest_in = p->width(); - else if (p->is_output() && p->width() > widest_out) - widest_out = p->width(); - } - - // Make sure module is wide enough for ports - if (widest_in > widest_out) - width(widest_in + 5.0 + border_width()*2.0); - else - width(widest_out + 5.0 + border_width()*2.0); - - // Make sure module is wide enough for title - if (m_canvas_title.property_text_width() + 6.0 > m_width) - width(m_canvas_title.property_text_width() + 6.0); - - // Set height to contain ports and title - double height_base = m_canvas_title.property_text_height() + 2; - double h = height_base; - if (m_ports.size() > 0) - h += m_ports.size() * ((*m_ports.begin())->height()+2.0); - height(h); - - // Move ports to appropriate locations - - double y; - int i = 0; - for (PortList::iterator pi = m_ports.begin(); pi != m_ports.end(); ++pi, ++i) { - Port* p = (*pi); - - y = height_base + (i * (p->height() + 2.0)); - if (p->is_input()) { - p->width(widest_in); - p->property_x() = 1.0;//border_width(); - p->property_y() = y; - } else { - p->width(widest_out); - p->property_x() = m_width - p->width() - 1.0;//p->border_width(); - p->property_y() = y; - } - } - - // Center title - m_canvas_title.property_x() = m_width/2.0; - - // Update connection locations if we've moved/resized - for (PortList::iterator pi = m_ports.begin(); pi != m_ports.end(); ++pi, ++i) { - (*pi)->move_connections(); - } - - // Make things actually move to their new locations (?!) - move(0, 0); -} - - -/** Port offset, for connection drawing. See doc/port_offsets.dia */ -double -Module::port_connection_point_offset(Port* port) -{ - assert(port->module() == this); - assert(ports().size() > 0); - - return (port->connection_coords().get_y() - - m_ports.front()->connection_coords().get_y()); -} - - -/** Range of port offsets, for connection drawing. See doc/port_offsets.dia */ -double -Module::port_connection_points_range() -{ - assert(m_ports.size() > 0); - - double ret = fabs(m_ports.back()->connection_coords().get_y() - - m_ports.front()->connection_coords().get_y()); - - return (ret < 1.0) ? 1.0 : ret; -} - - -} // namespace LibFlowCanvas diff --git a/libs/flowcanvas/src/Port.cpp b/libs/flowcanvas/src/Port.cpp deleted file mode 100644 index 8310b484c3..0000000000 --- a/libs/flowcanvas/src/Port.cpp +++ /dev/null @@ -1,189 +0,0 @@ -/* This file is part of FlowCanvas. Copyright (C) 2005 Dave Robillard. - * - * FlowCanvas is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * FlowCanvas is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - - -#include <libgnomecanvasmm/libgnomecanvasmm.h> -#include "flowcanvas/Port.h" -#include "flowcanvas/Module.h" -#include "flowcanvas/FlowCanvas.h" - -namespace LibFlowCanvas { - - -Port::Port(Module* module, const string& name, bool is_input, int color) -: Gnome::Canvas::Group(*module, 0, 0), - m_module(module), - m_name(name), - m_is_input(is_input), - m_colour(color), - m_label(*this, 1, 1, m_name), - m_rect(*this, 0, 0, 0, 0) -{ - m_menu.items().push_back(Gtk::Menu_Helpers::MenuElem( - "Disconnect All", sigc::mem_fun(this, &Port::disconnect_all))); - - m_rect.property_fill_color_rgba() = color; - - // Make rectangle pretty - //m_rect.property_outline_color_rgba() = 0x8899AAFF; - m_rect.property_outline_color_rgba() = color; - m_rect.property_join_style() = Gdk::JOIN_MITER; - border_width(1.0); - - // Make label pretty - m_label.property_size() = PORT_LABEL_SIZE; - m_label.property_fill_color_rgba() = 0xFFFFFFFF; - m_label.property_weight() = 200; - - m_width = m_label.property_text_width() + 4.0; - m_height = m_label.property_text_height(); - - // Place everything - m_rect.property_x1() = 0; - m_rect.property_y1() = 0; - m_rect.property_x2() = m_width; - m_rect.property_y2() = m_height; - m_label.property_x() = m_label.property_text_width() / 2 + 1; - m_label.property_y() = m_height / 2; - - m_label.raise_to_top(); - -} - - -/** Set the border width of the port's rectangle. - * - * Do NOT directly set the width_units property on the rect, use this function. - */ -void -Port::border_width(double w) -{ - m_border_width = w; - m_rect.property_width_units() = w; -} - - -void -Port::name(const string& n) -{ - m_name = n; - - // Reposition label - m_label.property_text() = m_name; - m_width = m_label.property_text_width() + 4.0; - m_height = m_label.property_text_height(); - m_rect.property_x2() = m_width; - m_rect.property_y2() = m_height; - m_label.property_x() = m_label.property_text_width() / 2 + 1; - m_label.property_y() = m_height / 2; - - m_module->resize(); -} - - -void -Port::zoom(float z) -{ - m_label.property_size() = static_cast<int>(8000 * z); -} - - -/** Update the location of all connections to/from this port if this port has moved */ -void -Port::move_connections() -{ - for (list<Connection*>::iterator i = m_connections.begin(); i != m_connections.end(); i++) { - ((Connection*)(*i))->update_location(); - } -} - - -void -Port::remove_connection(Connection* c) -{ - m_connections.erase( - find(m_connections.begin(), m_connections.end(), c) - ); -} - - -void -Port::disconnect_all() -{ - Connection* c = NULL; - list<Connection*> temp_list = m_connections; - for (list<Connection*>::iterator i = temp_list.begin(); i != temp_list.end(); ++i) { - c = *i; - m_module->patch_bay()->disconnect(c->source_port(), c->dest_port()); - } -} - - -void -Port::hilite(bool b) -{ - m_module->hilite(b); - - for (list<Connection*>::iterator i = m_connections.begin(); i != m_connections.end(); ++i) { - (*i)->hilite(b); - if (b) - (*i)->raise_to_top(); - } - - if (b) { - raise_to_top(); - m_rect.raise_to_top(); - m_label.raise_to_top(); - m_rect.property_fill_color_rgba() = m_colour + 0x33333300; - } else { - m_rect.property_fill_color_rgba() = m_colour; - } -} - - -void -Port::raise_connections() -{ - for (list<Connection*>::iterator i = m_connections.begin(); i != m_connections.end(); ++i) { - (*i)->raise_to_top(); - } -} - - -// Returns the world-relative coordinates of where a connection line -// should attach -Gnome::Art::Point -Port::connection_coords() -{ - double x = (is_input()) ? m_rect.property_x1()-1.0 : m_rect.property_x2()+1.0; - double y = m_rect.property_y1() + m_height / 2; - - i2w(x, y); // convert to world-relative coords - - return Gnome::Art::Point(x, y); -} - - -void -Port::width(double w) -{ - double diff = w - m_width; - m_rect.property_x2() = m_rect.property_x2() + diff; - m_width = w; -} - - -} // namespace LibFlowCanvas |