mirror of https://github.com/KLayout/klayout.git
commit
ee8966a97e
|
|
@ -88,6 +88,7 @@ jobs:
|
|||
path: dist
|
||||
|
||||
- uses: pypa/gh-action-pypi-publish@v1.4.2
|
||||
continue-on-error: true # might fail if we don't bump the version
|
||||
with:
|
||||
user: __token__
|
||||
password: ${{ secrets.test_pypi_password }}
|
||||
|
|
|
|||
12
MANIFEST.in
12
MANIFEST.in
|
|
@ -1,10 +1,16 @@
|
|||
recursive-include src/tl/tl *.cc *.h
|
||||
recursive-include src/ant/ant *.cc *.h
|
||||
recursive-include src/db/db *.cc *.cc_gen *.h
|
||||
recursive-include src/edt/edt *.cc *.h
|
||||
recursive-include src/gsi/gsi *.cc *.h
|
||||
recursive-include src/rdb/rdb *.cc *.h
|
||||
recursive-include src/pya/pya *.cc *.h
|
||||
recursive-include src/img/img *.cc *.h
|
||||
recursive-include src/laybasic/laybasic *.cc *.h
|
||||
recursive-include src/lib/lib *.cc *.h
|
||||
recursive-include src/lym/lym *.cc *.h
|
||||
recursive-include src/pya/pya *.cc *.h
|
||||
recursive-include src/pymod *.cc *.h
|
||||
recursive-include src/rbastub *.cc *.h
|
||||
recursive-include src/rdb/rdb *.cc *.h
|
||||
recursive-include src/tl/tl *.cc *.h
|
||||
include src/plugins/*/db_plugin/*.cc
|
||||
include src/plugins/*/*/db_plugin/*.cc
|
||||
include src/plugins/*/db_plugin/*.h
|
||||
|
|
|
|||
|
|
@ -14,11 +14,6 @@ jobs:
|
|||
vmImage: 'windows-2019' # other options: 'macOS-10.13', 'ubuntu-16.04'
|
||||
strategy:
|
||||
matrix:
|
||||
# Python27:
|
||||
# python.version: '2.7'
|
||||
# cp35-cp35m-win_amd64.whl:
|
||||
# python.version: '3.5'
|
||||
# python.architecture: 'x64'
|
||||
cp36-cp36m-win_amd64.whl:
|
||||
python.version: '3.6'
|
||||
python.architecture: 'x64'
|
||||
|
|
@ -34,9 +29,6 @@ jobs:
|
|||
cp310-cp310-win_amd64.whl:
|
||||
python.version: '3.10'
|
||||
python.architecture: 'x64'
|
||||
# cp35-cp35m-win32.whl:
|
||||
# python.version: '3.5'
|
||||
# python.architecture: 'x86'
|
||||
cp36-cp36m-win32.whl:
|
||||
python.version: '3.6'
|
||||
python.architecture: 'x86'
|
||||
|
|
@ -70,9 +62,9 @@ jobs:
|
|||
#arguments: # Optional
|
||||
script: | # Required when targetType == Inline
|
||||
pwd
|
||||
Invoke-WebRequest -Uri "https://www.klayout.org/downloads/klayout-microbits-1.0.zip" -OutFile klayout-microbits-1.0.zip
|
||||
Invoke-WebRequest -Uri "https://www.klayout.org/downloads/klayout-microbits-4.0.zip" -OutFile klayout-microbits-4.0.zip
|
||||
dir
|
||||
Expand-Archive klayout-microbits-1.0.zip -DestinationPath klayout-microbits
|
||||
Expand-Archive klayout-microbits-4.0.zip -DestinationPath klayout-microbits
|
||||
dir klayout-microbits
|
||||
#errorActionPreference: 'stop' # Optional. Options: stop, continue, silentlyContinue
|
||||
#failOnStderr: false # Optional
|
||||
|
|
@ -81,37 +73,30 @@ jobs:
|
|||
#workingDirectory: # Optional
|
||||
displayName: 'Download and Extract KLayout bits'
|
||||
|
||||
# - script: |
|
||||
# curl https://download.microsoft.com/download/7/9/6/796EF2E4-801B-4FC4-AB28-B59FBF6D907B/VCForPython27.msi -o VCForPython27.msi
|
||||
# msiexec /i VCForPython27.msi /quiet
|
||||
# set "VS90COMNTOOLS=C:\Users\VssAdministrator\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC"
|
||||
# curl https://raw.githubusercontent.com/mattn/gntp-send/master/include/msinttypes/stdint.h -o "%VS90COMNTOOLS%\Include\stdint.h"
|
||||
# dir "%VS90COMNTOOLS%\Include"
|
||||
# condition: eq(variables['python.version'], '2.7')
|
||||
# displayName: 'Install Microsoft Visual C++ Compiler for Python 2.7'
|
||||
|
||||
- script: |
|
||||
python -m pip install --upgrade pip setuptools wheel
|
||||
displayName: 'Update pip, setuptools and wheel'
|
||||
|
||||
- script: |
|
||||
python -V
|
||||
set "KLAYOUT_BITS=%cd%\klayout-microbits\klayout-microbits-1.0\msvc2017\%PYTHON_ARCHITECTURE%"
|
||||
set "KLAYOUT_BITS=%cd%\klayout-microbits\klayout-microbits-4.0\msvc2017\%PYTHON_ARCHITECTURE%"
|
||||
echo KLAYOUT_BITS=%KLAYOUT_BITS%
|
||||
python setup.py bdist_wheel
|
||||
displayName: 'Build KLayout'
|
||||
|
||||
- bash: |
|
||||
bash `pwd`/ci-scripts/windows/fix_wheel.sh `pwd`/dist/*.whl "`pwd`/klayout-microbits/klayout-microbits-1.0/msvc2017/$PYTHON_ARCHITECTURE"
|
||||
bash `pwd`/ci-scripts/windows/fix_wheel.sh `pwd`/dist/*.whl "`pwd`/klayout-microbits/klayout-microbits-4.0/msvc2017/$PYTHON_ARCHITECTURE"
|
||||
displayName: 'Copy klayout bits dlls into wheel'
|
||||
|
||||
- script: |
|
||||
echo PATH=%PATH%
|
||||
set TESTSRC=.
|
||||
pip install klayout --no-index -f dist
|
||||
python testdata/pymod/import_db.py
|
||||
python testdata/pymod/import_rdb.py
|
||||
python testdata/pymod/import_tl.py
|
||||
python testdata/pymod/import_lib.py
|
||||
python testdata/pymod/import_lay.py
|
||||
python testdata/pymod/pya_tests.py
|
||||
displayName: 'Test KLayout pymod'
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ set -xe
|
|||
if [[ -f "/etc/centos-release" ]]; then
|
||||
# sometimes the epel server is down. retry 5 times
|
||||
for i in $(seq 1 5); do
|
||||
yum install -y zlib-devel curl-devel expat-devel ccache && s=0 && break || s=$? && sleep 15;
|
||||
yum install -y zlib-devel curl-devel expat-devel libpng-devel ccache && s=0 && break || s=$? && sleep 15;
|
||||
done
|
||||
|
||||
[ $s -eq 0 ] || exit $s
|
||||
|
|
@ -27,7 +27,7 @@ if [[ -f "/etc/centos-release" ]]; then
|
|||
elif [[ -f "/etc/alpine-release" ]]; then
|
||||
# musllinux prep
|
||||
# ccache already present
|
||||
apk add curl-dev expat-dev zlib-dev ccache
|
||||
apk add curl-dev expat-dev zlib-dev libpng-dev ccache
|
||||
export PATH="/usr/lib/ccache/bin:$PATH"
|
||||
fi
|
||||
|
||||
|
|
|
|||
|
|
@ -70,6 +70,7 @@ cp -v $KLAYOUT_BITS/curl/bin/* .
|
|||
cp -v $KLAYOUT_BITS/expat/bin/* .
|
||||
cp -v $KLAYOUT_BITS/ptw/bin/* .
|
||||
cp -v $KLAYOUT_BITS/zlib/bin/* .
|
||||
cp -v $KLAYOUT_BITS/png/bin/* .
|
||||
# if [ $? -ne 0 ]; then
|
||||
# >&2 echo "ERROR: lib not found. Quitting."
|
||||
# exit 1
|
||||
|
|
|
|||
|
|
@ -5,7 +5,8 @@ test-command = [
|
|||
"python {package}/testdata/pymod/import_rdb.py",
|
||||
"python {package}/testdata/pymod/import_tl.py",
|
||||
"python {package}/testdata/pymod/import_lib.py",
|
||||
"python {package}/testdata/pymod/pya_tests.py"
|
||||
"python {package}/testdata/pymod/import_lay.py",
|
||||
"TESTSRC={package} python {package}/testdata/pymod/pya_tests.py"
|
||||
]
|
||||
# Disable building PyPy wheels on all platforms
|
||||
skip = "pp*"
|
||||
|
|
@ -24,4 +25,4 @@ environment-pass = ["HOST_CCACHE_DIR"]
|
|||
|
||||
[tool.cibuildwheel.macos]
|
||||
# Don't repair macOS wheels
|
||||
repair-wheel-command = ""
|
||||
repair-wheel-command = ""
|
||||
|
|
|
|||
167
setup.py
167
setup.py
|
|
@ -28,6 +28,7 @@ The standalone libraries are basically extension modules.
|
|||
Build requirements are:
|
||||
* curl library
|
||||
* expat library
|
||||
* png library
|
||||
|
||||
The main challenge is to map KLayout's shared object architecture.
|
||||
The structure consists of the Python extension libraries and a bunch
|
||||
|
|
@ -269,6 +270,7 @@ class Config(object):
|
|||
if bits:
|
||||
return [quote_path("-I" + os.path.join(bits, "zlib", "include")),
|
||||
quote_path("-I" + os.path.join(bits, "ptw", "include")),
|
||||
quote_path("-I" + os.path.join(bits, "png", "include")),
|
||||
quote_path("-I" + os.path.join(bits, "expat", "include")),
|
||||
quote_path("-I" + os.path.join(bits, "curl", "include"))]
|
||||
else:
|
||||
|
|
@ -285,9 +287,13 @@ class Config(object):
|
|||
if platform.system() == "Windows":
|
||||
if mod == "_tl":
|
||||
return [ "libcurl", "expat", "pthreadVCE2", "zlib", "wsock32" ]
|
||||
elif mod == "_laybasic":
|
||||
return [ "libpng16" ]
|
||||
else:
|
||||
if mod == "_tl":
|
||||
return ['curl', 'expat']
|
||||
elif mod == "_laybasic":
|
||||
return [ 'png' ]
|
||||
return []
|
||||
|
||||
def link_args(self, mod):
|
||||
|
|
@ -298,8 +304,9 @@ class Config(object):
|
|||
args = ["/DLL"]
|
||||
bits = os.getenv("KLAYOUT_BITS")
|
||||
if bits:
|
||||
args += [quote_path("/LIBPATH:" + os.path.join(bits, "zlib", "libraries")),
|
||||
args += [quote_path("/LIBPATH:" + os.path.join(bits, "zlib", "lib")),
|
||||
quote_path("/LIBPATH:" + os.path.join(bits, "ptw", "libraries")),
|
||||
quote_path("/LIBPATH:" + os.path.join(bits, "png", "libraries")),
|
||||
quote_path("/LIBPATH:" + os.path.join(bits, "expat", "libraries")),
|
||||
quote_path("/LIBPATH:" + os.path.join(bits, "curl", "libraries"))]
|
||||
return args
|
||||
|
|
@ -334,7 +341,7 @@ class Config(object):
|
|||
"""
|
||||
Returns the macros to use for building
|
||||
"""
|
||||
return [('HAVE_CURL', 1), ('HAVE_EXPAT', 1), ('KLAYOUT_MAJOR_VERSION', self.major_version()), ('KLAYOUT_MINOR_VERSION', self.minor_version())]
|
||||
return [('HAVE_PNG', 1), ('HAVE_CURL', 1), ('HAVE_EXPAT', 1), ('KLAYOUT_MAJOR_VERSION', self.major_version()), ('KLAYOUT_MINOR_VERSION', self.minor_version())]
|
||||
|
||||
def minor_version(self):
|
||||
"""
|
||||
|
|
@ -425,6 +432,7 @@ _gsi = Library(config.root + '._gsi',
|
|||
include_dirs=[_tl_path],
|
||||
extra_objects=[config.path_of('_tl', _tl_path)],
|
||||
language='c++',
|
||||
libraries=config.libraries('_gsi'),
|
||||
extra_link_args=config.link_args('_gsi'),
|
||||
extra_compile_args=config.compile_args('_gsi'),
|
||||
sources=list(_gsi_sources))
|
||||
|
|
@ -441,11 +449,29 @@ _pya = Library(config.root + '._pya',
|
|||
include_dirs=[_tl_path, _gsi_path],
|
||||
extra_objects=[config.path_of('_tl', _tl_path), config.path_of('_gsi', _gsi_path)],
|
||||
language='c++',
|
||||
libraries=config.libraries('_pya'),
|
||||
extra_link_args=config.link_args('_pya'),
|
||||
extra_compile_args=config.compile_args('_pya'),
|
||||
sources=list(_pya_sources))
|
||||
config.add_extension(_pya)
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# _rba dependency library (dummy)
|
||||
|
||||
_rba_path = os.path.join("src", "rbastub")
|
||||
_rba_sources = set(glob.glob(os.path.join(_rba_path, "*.cc")))
|
||||
|
||||
_rba = Library(config.root + '._rba',
|
||||
define_macros=config.macros() + [('MAKE_RBA_LIBRARY', 1)],
|
||||
include_dirs=[_tl_path, _gsi_path],
|
||||
extra_objects=[config.path_of('_tl', _tl_path), config.path_of('_gsi', _gsi_path)],
|
||||
language='c++',
|
||||
libraries=config.libraries('_rba'),
|
||||
extra_link_args=config.link_args('_rba'),
|
||||
extra_compile_args=config.compile_args('_rba'),
|
||||
sources=list(_rba_sources))
|
||||
config.add_extension(_rba)
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# _db dependency library
|
||||
|
||||
|
|
@ -457,6 +483,7 @@ _db = Library(config.root + '._db',
|
|||
include_dirs=[_tl_path, _gsi_path, _db_path],
|
||||
extra_objects=[config.path_of('_tl', _tl_path), config.path_of('_gsi', _gsi_path)],
|
||||
language='c++',
|
||||
libraries=config.libraries('_db'),
|
||||
extra_link_args=config.link_args('_db'),
|
||||
extra_compile_args=config.compile_args('_db'),
|
||||
sources=list(_db_sources))
|
||||
|
|
@ -473,6 +500,7 @@ _lib = Library(config.root + '._lib',
|
|||
include_dirs=[_tl_path, _gsi_path, _db_path, _lib_path],
|
||||
extra_objects=[config.path_of('_tl', _tl_path), config.path_of('_gsi', _gsi_path), config.path_of('_db', _db_path)],
|
||||
language='c++',
|
||||
libraries=config.libraries('_lib'),
|
||||
extra_link_args=config.link_args('_lib'),
|
||||
extra_compile_args=config.compile_args('_lib'),
|
||||
sources=list(_lib_sources))
|
||||
|
|
@ -489,11 +517,114 @@ _rdb = Library(config.root + '._rdb',
|
|||
include_dirs=[_db_path, _tl_path, _gsi_path],
|
||||
extra_objects=[config.path_of('_tl', _tl_path), config.path_of('_gsi', _gsi_path), config.path_of('_db', _db_path)],
|
||||
language='c++',
|
||||
libraries=config.libraries('_rdb'),
|
||||
extra_link_args=config.link_args('_rdb'),
|
||||
extra_compile_args=config.compile_args('_rdb'),
|
||||
sources=list(_rdb_sources))
|
||||
config.add_extension(_rdb)
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# _laybasic dependency library
|
||||
|
||||
_laybasic_path = os.path.join("src", "laybasic", "laybasic")
|
||||
_laybasic_sources = set(glob.glob(os.path.join(_laybasic_path, "*.cc")))
|
||||
|
||||
_laybasic = Library(config.root + '._laybasic',
|
||||
define_macros=config.macros() + [('MAKE_LAYBASIC_LIBRARY', 1)],
|
||||
include_dirs=[_rdb_path, _db_path, _tl_path, _gsi_path],
|
||||
extra_objects=[config.path_of('_rdb', _rdb_path), config.path_of('_tl', _tl_path), config.path_of('_gsi', _gsi_path), config.path_of('_db', _db_path)],
|
||||
language='c++',
|
||||
libraries=config.libraries('_laybasic'),
|
||||
extra_link_args=config.link_args('_laybasic'),
|
||||
extra_compile_args=config.compile_args('_laybasic'),
|
||||
sources=list(_laybasic_sources))
|
||||
config.add_extension(_laybasic)
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# _layview dependency library
|
||||
|
||||
_layview_path = os.path.join("src", "layview", "layview")
|
||||
_layview_sources = set(glob.glob(os.path.join(_layview_path, "*.cc")))
|
||||
|
||||
_layview = Library(config.root + '._layview',
|
||||
define_macros=config.macros() + [('MAKE_LAYVIEW_LIBRARY', 1)],
|
||||
include_dirs=[_laybasic_path, _rdb_path, _db_path, _tl_path, _gsi_path],
|
||||
extra_objects=[config.path_of('_laybasic', _laybasic_path), config.path_of('_rdb', _rdb_path), config.path_of('_tl', _tl_path), config.path_of('_gsi', _gsi_path), config.path_of('_db', _db_path)],
|
||||
language='c++',
|
||||
libraries=config.libraries('_layview'),
|
||||
extra_link_args=config.link_args('_layview'),
|
||||
extra_compile_args=config.compile_args('_layview'),
|
||||
sources=list(_layview_sources))
|
||||
config.add_extension(_layview)
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# _lym dependency library
|
||||
|
||||
_lym_path = os.path.join("src", "lym", "lym")
|
||||
_lym_sources = set(glob.glob(os.path.join(_lym_path, "*.cc")))
|
||||
|
||||
_lym = Library(config.root + '._lym',
|
||||
define_macros=config.macros() + [('MAKE_LYM_LIBRARY', 1)],
|
||||
include_dirs=[_pya_path, _rba_path, _tl_path, _gsi_path],
|
||||
extra_objects=[config.path_of('_rba', _rba_path), config.path_of('_pya', _pya_path), config.path_of('_tl', _tl_path), config.path_of('_gsi', _gsi_path)],
|
||||
language='c++',
|
||||
libraries=config.libraries('_lym'),
|
||||
extra_link_args=config.link_args('_lym'),
|
||||
extra_compile_args=config.compile_args('_lym'),
|
||||
sources=list(_lym_sources))
|
||||
config.add_extension(_lym)
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# _ant dependency library
|
||||
|
||||
_ant_path = os.path.join("src", "ant", "ant")
|
||||
_ant_sources = set(glob.glob(os.path.join(_ant_path, "*.cc")))
|
||||
|
||||
_ant = Library(config.root + '._ant',
|
||||
define_macros=config.macros() + [('MAKE_ANT_LIBRARY', 1)],
|
||||
include_dirs=[_laybasic_path, _layview_path, _rdb_path, _db_path, _tl_path, _gsi_path],
|
||||
extra_objects=[config.path_of('_laybasic', _laybasic_path), config.path_of('_layview', _layview_path), config.path_of('_rdb', _rdb_path), config.path_of('_tl', _tl_path), config.path_of('_gsi', _gsi_path), config.path_of('_db', _db_path)],
|
||||
language='c++',
|
||||
libraries=config.libraries('_ant'),
|
||||
extra_link_args=config.link_args('_ant'),
|
||||
extra_compile_args=config.compile_args('_ant'),
|
||||
sources=list(_ant_sources))
|
||||
config.add_extension(_ant)
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# _img dependency library
|
||||
|
||||
_img_path = os.path.join("src", "img", "img")
|
||||
_img_sources = set(glob.glob(os.path.join(_img_path, "*.cc")))
|
||||
|
||||
_img = Library(config.root + '._img',
|
||||
define_macros=config.macros() + [('MAKE_IMG_LIBRARY', 1)],
|
||||
include_dirs=[_laybasic_path, _layview_path, _rdb_path, _db_path, _tl_path, _gsi_path],
|
||||
extra_objects=[config.path_of('_laybasic', _laybasic_path), config.path_of('_layview', _layview_path), config.path_of('_rdb', _rdb_path), config.path_of('_tl', _tl_path), config.path_of('_gsi', _gsi_path), config.path_of('_db', _db_path)],
|
||||
language='c++',
|
||||
libraries=config.libraries('_img'),
|
||||
extra_link_args=config.link_args('_img'),
|
||||
extra_compile_args=config.compile_args('_img'),
|
||||
sources=list(_img_sources))
|
||||
config.add_extension(_img)
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# _edt dependency library
|
||||
|
||||
_edt_path = os.path.join("src", "edt", "edt")
|
||||
_edt_sources = set(glob.glob(os.path.join(_edt_path, "*.cc")))
|
||||
|
||||
_edt = Library(config.root + '._edt',
|
||||
define_macros=config.macros() + [('MAKE_EDT_LIBRARY', 1)],
|
||||
include_dirs=[_laybasic_path, _layview_path, _rdb_path, _db_path, _tl_path, _gsi_path],
|
||||
extra_objects=[config.path_of('_laybasic', _laybasic_path), config.path_of('_layview', _layview_path), config.path_of('_rdb', _rdb_path), config.path_of('_tl', _tl_path), config.path_of('_gsi', _gsi_path), config.path_of('_db', _db_path)],
|
||||
language='c++',
|
||||
libraries=config.libraries('_edt'),
|
||||
extra_link_args=config.link_args('_edt'),
|
||||
extra_compile_args=config.compile_args('_edt'),
|
||||
sources=list(_edt_sources))
|
||||
config.add_extension(_edt)
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# dependency libraries from db_plugins
|
||||
|
||||
|
|
@ -577,6 +708,36 @@ rdb = Extension(config.root + '.rdbcore',
|
|||
extra_compile_args=config.compile_args('rdbcore'),
|
||||
sources=list(rdb_sources))
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# lay extension library
|
||||
|
||||
lay_path = os.path.join("src", "pymod", "lay")
|
||||
lay_sources = set(glob.glob(os.path.join(lay_path, "*.cc")))
|
||||
|
||||
lay = Extension(config.root + '.laycore',
|
||||
define_macros=config.macros(),
|
||||
include_dirs=[_laybasic_path,
|
||||
_layview_path,
|
||||
_img_path,
|
||||
_ant_path,
|
||||
_edt_path,
|
||||
_lym_path,
|
||||
_tl_path,
|
||||
_gsi_path,
|
||||
_pya_path],
|
||||
extra_objects=[config.path_of('_laybasic', _laybasic_path),
|
||||
config.path_of('_layview', _layview_path),
|
||||
config.path_of('_img', _img_path),
|
||||
config.path_of('_ant', _ant_path),
|
||||
config.path_of('_edt', _edt_path),
|
||||
config.path_of('_lym', _lym_path),
|
||||
config.path_of('_tl', _tl_path),
|
||||
config.path_of('_gsi', _gsi_path),
|
||||
config.path_of('_pya', _pya_path)],
|
||||
extra_link_args=config.link_args('laycore'),
|
||||
extra_compile_args=config.compile_args('laycore'),
|
||||
sources=list(lay_sources))
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# Core setup function
|
||||
|
||||
|
|
@ -602,4 +763,4 @@ if __name__ == '__main__':
|
|||
url='https://github.com/klayout/klayout',
|
||||
packages=find_packages('src/pymod/distutils_src'),
|
||||
package_dir={'': 'src/pymod/distutils_src'}, # https://github.com/pypa/setuptools/issues/230
|
||||
ext_modules=[_tl, _gsi, _pya, _db, _lib, _rdb] + db_plugins + [tl, db, lib, rdb])
|
||||
ext_modules=[_tl, _gsi, _pya, _rba, _db, _lib, _rdb, _lym, _laybasic, _layview, _ant, _edt, _img] + db_plugins + [tl, db, lib, rdb, lay])
|
||||
|
|
|
|||
|
|
@ -6,16 +6,7 @@ include($$PWD/../../lib.pri)
|
|||
|
||||
DEFINES += MAKE_ANT_LIBRARY
|
||||
|
||||
HEADERS = \
|
||||
antConfig.h \
|
||||
antConfigPage.h \
|
||||
antObject.h \
|
||||
antPlugin.h \
|
||||
antPropertiesPage.h \
|
||||
antService.h \
|
||||
antTemplate.h \
|
||||
antForceLink.h \
|
||||
antCommon.h
|
||||
!equals(HAVE_QT, "0") {
|
||||
|
||||
FORMS = \
|
||||
RulerConfigPage.ui \
|
||||
|
|
@ -24,18 +15,48 @@ FORMS = \
|
|||
RulerConfigPage4.ui \
|
||||
RulerPropertiesPage.ui \
|
||||
|
||||
}
|
||||
|
||||
# Disabled without Qt:
|
||||
|
||||
HEADERS = \
|
||||
antConfigPage.h \
|
||||
antPropertiesPage.h \
|
||||
|
||||
SOURCES = \
|
||||
antConfig.cc \
|
||||
antConfigPage.cc \
|
||||
antPropertiesPage.cc \
|
||||
|
||||
# Enabled without Qt:
|
||||
|
||||
HEADERS += \
|
||||
antConfig.h \
|
||||
antObject.h \
|
||||
antPlugin.h \
|
||||
antService.h \
|
||||
antTemplate.h \
|
||||
antForceLink.h \
|
||||
antCommon.h
|
||||
|
||||
SOURCES += \
|
||||
antConfig.cc \
|
||||
antObject.cc \
|
||||
antPlugin.cc \
|
||||
antPropertiesPage.cc \
|
||||
antService.cc \
|
||||
antTemplate.cc \
|
||||
gsiDeclAnt.cc \
|
||||
antForceLink.cc
|
||||
antForceLink.cc
|
||||
|
||||
INCLUDEPATH += $$TL_INC $$GSI_INC $$LAYBASIC_INC $$DB_INC
|
||||
DEPENDPATH += $$TL_INC $$GSI_INC $$LAYBASIC_INC $$DB_INC
|
||||
LIBS += -L$$DESTDIR -lklayout_tl -lklayout_gsi -lklayout_laybasic -lklayout_db
|
||||
INCLUDEPATH += $$TL_INC $$GSI_INC $$LAYBASIC_INC $$LAYVIEW_INC $$DB_INC
|
||||
DEPENDPATH += $$TL_INC $$GSI_INC $$LAYBASIC_INC $$LAYVIEW_INC $$DB_INC
|
||||
LIBS += -L$$DESTDIR -lklayout_tl -lklayout_gsi -lklayout_laybasic -lklayout_layview -lklayout_db
|
||||
|
||||
!equals(HAVE_QT, "0") {
|
||||
|
||||
INCLUDEPATH += $$LAYUI_INC
|
||||
DEPENDPATH += $$LAYUI_INC
|
||||
|
||||
LIBS += -lklayout_layui
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
*/
|
||||
|
||||
#if defined(HAVE_QT)
|
||||
|
||||
#include "antConfigPage.h"
|
||||
#include "ui_RulerConfigPage.h"
|
||||
|
|
@ -417,3 +418,5 @@ ConfigPage4::commit ()
|
|||
}
|
||||
|
||||
} // namespace ant
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -20,12 +20,13 @@
|
|||
|
||||
*/
|
||||
|
||||
|
||||
#if defined(HAVE_QT)
|
||||
|
||||
#ifndef HDR_antConfigPage
|
||||
#define HDR_antConfigPage
|
||||
|
||||
#include "layPlugin.h"
|
||||
#include "layPluginConfigPage.h"
|
||||
#include "antTemplate.h"
|
||||
|
||||
class QListWidgetItem;
|
||||
|
|
@ -133,3 +134,5 @@ private:
|
|||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@
|
|||
|
||||
*/
|
||||
|
||||
|
||||
#include "antForceLink.h"
|
||||
|
||||
namespace ant
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@
|
|||
namespace ant
|
||||
{
|
||||
ANT_PUBLIC int _force_link_f ();
|
||||
int _force_link_target = _force_link_f ();
|
||||
static int _force_link_target = _force_link_f ();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -284,7 +284,7 @@ public:
|
|||
void execute (const tl::ExpressionParserContext &context, tl::Variant &out, const std::vector <tl::Variant> &vv) const
|
||||
{
|
||||
if (vv.size () != 0) {
|
||||
throw tl::EvalError (tl::to_string (QObject::tr ("Annotation function must not have arguments")), context);
|
||||
throw tl::EvalError (tl::to_string (tr ("Annotation function must not have arguments")), context);
|
||||
}
|
||||
|
||||
const Object &obj = mp_eval->obj ();
|
||||
|
|
|
|||
|
|
@ -22,15 +22,22 @@
|
|||
|
||||
|
||||
#include "layPlugin.h"
|
||||
#include "layAbstractMenu.h"
|
||||
#include "layConverters.h"
|
||||
#include "layConfigurationDialog.h"
|
||||
#include "layDispatcher.h"
|
||||
#include "antConfigPage.h"
|
||||
#include "layColor.h"
|
||||
#if defined(HAVE_QT)
|
||||
# include "layConfigurationDialog.h"
|
||||
# include "layAbstractMenu.h"
|
||||
#endif
|
||||
#include "antConfig.h"
|
||||
#if defined(HAVE_QT)
|
||||
# include "antConfigPage.h"
|
||||
#endif
|
||||
#include "antPlugin.h"
|
||||
|
||||
#include <QApplication>
|
||||
#if defined(HAVE_QT)
|
||||
# include <QApplication>
|
||||
#endif
|
||||
|
||||
namespace ant
|
||||
{
|
||||
|
|
@ -60,7 +67,7 @@ PluginDeclaration::get_options (std::vector < std::pair<std::string, std::string
|
|||
{
|
||||
options.push_back (std::pair<std::string, std::string> (cfg_max_number_of_rulers, "-1"));
|
||||
options.push_back (std::pair<std::string, std::string> (cfg_ruler_snap_range, "8"));
|
||||
options.push_back (std::pair<std::string, std::string> (cfg_ruler_color, lay::ColorConverter ().to_string (QColor ())));
|
||||
options.push_back (std::pair<std::string, std::string> (cfg_ruler_color, lay::ColorConverter ().to_string (lay::Color ())));
|
||||
options.push_back (std::pair<std::string, std::string> (cfg_ruler_halo, "true"));
|
||||
options.push_back (std::pair<std::string, std::string> (cfg_ruler_snap_mode, ACConverter ().to_string (lay::AC_Any)));
|
||||
options.push_back (std::pair<std::string, std::string> (cfg_ruler_obj_snap, tl::to_string (true)));
|
||||
|
|
@ -70,28 +77,30 @@ PluginDeclaration::get_options (std::vector < std::pair<std::string, std::string
|
|||
// grid-micron is not configured here since some other entity is supposed to do this.
|
||||
}
|
||||
|
||||
#if defined(HAVE_QT)
|
||||
std::vector<std::pair <std::string, lay::ConfigPage *> >
|
||||
PluginDeclaration::config_pages (QWidget *parent) const
|
||||
{
|
||||
std::vector<std::pair <std::string, lay::ConfigPage *> > pages;
|
||||
pages.push_back (std::make_pair (tl::to_string (QObject::tr ("Rulers And Annotations|Snapping")), new ant::ConfigPage (parent)));
|
||||
pages.push_back (std::make_pair (tl::to_string (QObject::tr ("Rulers And Annotations|Appearance")), new ant::ConfigPage2 (parent)));
|
||||
pages.push_back (std::make_pair (tl::to_string (QObject::tr ("Rulers And Annotations|Angle")), new ant::ConfigPage3 (parent)));
|
||||
pages.push_back (std::make_pair (tl::to_string (QObject::tr ("Rulers And Annotations|Templates")), new ant::ConfigPage4 (parent)));
|
||||
pages.push_back (std::make_pair (tl::to_string (tr ("Rulers And Annotations|Snapping")), new ant::ConfigPage (parent)));
|
||||
pages.push_back (std::make_pair (tl::to_string (tr ("Rulers And Annotations|Appearance")), new ant::ConfigPage2 (parent)));
|
||||
pages.push_back (std::make_pair (tl::to_string (tr ("Rulers And Annotations|Angle")), new ant::ConfigPage3 (parent)));
|
||||
pages.push_back (std::make_pair (tl::to_string (tr ("Rulers And Annotations|Templates")), new ant::ConfigPage4 (parent)));
|
||||
return pages;
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
PluginDeclaration::get_menu_entries (std::vector<lay::MenuEntry> &menu_entries) const
|
||||
{
|
||||
lay::PluginDeclaration::get_menu_entries (menu_entries);
|
||||
menu_entries.push_back (lay::separator ("rulers_group", "edit_menu.end"));
|
||||
menu_entries.push_back (lay::menu_item ("ant::clear_all_rulers", "clear_all_rulers:edit", "edit_menu.end", tl::to_string (QObject::tr ("Clear All Rulers And Annotations(Ctrl+K)"))));
|
||||
menu_entries.push_back (lay::menu_item ("ant::configure", "configure_rulers", "edit_menu.end", tl::to_string (QObject::tr ("Ruler And Annotation Setup"))));
|
||||
menu_entries.push_back (lay::menu_item ("ant::clear_all_rulers", "clear_all_rulers:edit", "edit_menu.end", tl::to_string (tr ("Clear All Rulers And Annotations(Ctrl+K)"))));
|
||||
menu_entries.push_back (lay::menu_item ("ant::configure", "configure_rulers", "edit_menu.end", tl::to_string (tr ("Ruler And Annotation Setup"))));
|
||||
}
|
||||
|
||||
lay::Plugin *
|
||||
PluginDeclaration::create_plugin (db::Manager *manager, lay::Dispatcher *, lay::LayoutView *view) const
|
||||
PluginDeclaration::create_plugin (db::Manager *manager, lay::Dispatcher *, lay::LayoutViewBase *view) const
|
||||
{
|
||||
return new ant::Service (manager, view);
|
||||
}
|
||||
|
|
@ -101,9 +110,11 @@ PluginDeclaration::menu_activated (const std::string &symbol) const
|
|||
{
|
||||
if (symbol == "ant::configure") {
|
||||
|
||||
#if defined(HAVE_QT)
|
||||
lay::ConfigurationDialog config_dialog (QApplication::activeWindow (), lay::Dispatcher::instance (), "ant::Plugin");
|
||||
config_dialog.exec ();
|
||||
|
||||
#endif
|
||||
|
||||
return true;
|
||||
|
||||
} else {
|
||||
|
|
@ -114,14 +125,14 @@ PluginDeclaration::menu_activated (const std::string &symbol) const
|
|||
bool
|
||||
PluginDeclaration::implements_editable (std::string &title) const
|
||||
{
|
||||
title = tl::to_string (QObject::tr ("Rulers And Annotations"));
|
||||
title = tl::to_string (tr ("Rulers And Annotations"));
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
PluginDeclaration::implements_mouse_mode (std::string &title) const
|
||||
{
|
||||
title = "ruler:ruler_mode_group:ruler_templates_group\t" + tl::to_string (QObject::tr ("Ruler{Add rulers and annotations}")) + "<:ruler.png>";
|
||||
title = "ruler:ruler_mode_group:ruler_templates_group\t" + tl::to_string (tr ("Ruler{Add rulers and annotations}")) + "<:ruler.png>";
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -182,17 +193,17 @@ PluginDeclaration::initialized (lay::Dispatcher *root)
|
|||
|
||||
// Set up the templates we want to see (plus some non-categorized templates)
|
||||
|
||||
m_templates.push_back (ant::Template (tl::to_string (QObject::tr ("Ruler")), "$X", "$Y", "$D", ant::Object::STY_ruler, ant::Object::OL_diag, true, lay::AC_Global, "_ruler"));
|
||||
m_templates.push_back (ant::Template (tl::to_string (tr ("Ruler")), "$X", "$Y", "$D", ant::Object::STY_ruler, ant::Object::OL_diag, true, lay::AC_Global, "_ruler"));
|
||||
|
||||
m_templates.push_back (ant::Template (tl::to_string (QObject::tr ("Cross")), "", "", "$U,$V", ant::Object::STY_cross_both, ant::Object::OL_diag, true, lay::AC_Global, "_cross"));
|
||||
m_templates.push_back (ant::Template (tl::to_string (tr ("Cross")), "", "", "$U,$V", ant::Object::STY_cross_both, ant::Object::OL_diag, true, lay::AC_Global, "_cross"));
|
||||
m_templates.back ().set_mode (ant::Template::RulerSingleClick);
|
||||
|
||||
m_templates.push_back (ant::Template (tl::to_string (QObject::tr ("Measure")), "$X", "$Y", "$D", ant::Object::STY_ruler, ant::Object::OL_diag, true, lay::AC_Global, "_measure"));
|
||||
m_templates.push_back (ant::Template (tl::to_string (tr ("Measure")), "$X", "$Y", "$D", ant::Object::STY_ruler, ant::Object::OL_diag, true, lay::AC_Global, "_measure"));
|
||||
m_templates.back ().set_mode (ant::Template::RulerAutoMetric);
|
||||
|
||||
m_templates.push_back (ant::Template (tl::to_string (QObject::tr ("Ellipse")), "W=$(abs(X))", "H=$(abs(Y))", "", ant::Object::STY_line, ant::Object::OL_ellipse, true, lay::AC_Global, std::string ()));
|
||||
m_templates.push_back (ant::Template (tl::to_string (tr ("Ellipse")), "W=$(abs(X))", "H=$(abs(Y))", "", ant::Object::STY_line, ant::Object::OL_ellipse, true, lay::AC_Global, std::string ()));
|
||||
|
||||
m_templates.push_back (ant::Template (tl::to_string (QObject::tr ("Box")), "W=$(abs(X))", "H=$(abs(Y))", "", ant::Object::STY_line, ant::Object::OL_box, true, lay::AC_Global, std::string ()));
|
||||
m_templates.push_back (ant::Template (tl::to_string (tr ("Box")), "W=$(abs(X))", "H=$(abs(Y))", "", ant::Object::STY_line, ant::Object::OL_box, true, lay::AC_Global, std::string ()));
|
||||
|
||||
root->config_set (cfg_ruler_templates, ant::TemplatesConverter ().to_string (m_templates));
|
||||
root->config_end ();
|
||||
|
|
@ -203,12 +214,15 @@ PluginDeclaration::initialized (lay::Dispatcher *root)
|
|||
void
|
||||
PluginDeclaration::uninitialize (lay::Dispatcher *)
|
||||
{
|
||||
#if defined(HAVE_QT)
|
||||
m_actions.clear ();
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
PluginDeclaration::update_current_template ()
|
||||
{
|
||||
#if defined(HAVE_QT)
|
||||
lay::Dispatcher *mp = lay::Dispatcher::instance ();
|
||||
if (! mp || ! mp->has_ui ()) {
|
||||
return;
|
||||
|
|
@ -234,11 +248,13 @@ PluginDeclaration::update_current_template ()
|
|||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
PluginDeclaration::update_menu ()
|
||||
{
|
||||
#if defined(HAVE_QT)
|
||||
lay::Dispatcher *mp = lay::Dispatcher::instance ();
|
||||
if (! mp || ! mp->has_ui ()) {
|
||||
return;
|
||||
|
|
@ -278,7 +294,7 @@ PluginDeclaration::update_menu ()
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
|
|
@ -31,6 +31,8 @@
|
|||
namespace ant
|
||||
{
|
||||
|
||||
class Template;
|
||||
|
||||
class PluginDeclaration
|
||||
: public lay::PluginDeclaration
|
||||
{
|
||||
|
|
@ -40,11 +42,13 @@ public:
|
|||
|
||||
virtual void get_options (std::vector < std::pair<std::string, std::string> > &options) const;
|
||||
virtual void get_menu_entries (std::vector<lay::MenuEntry> &menu_entries) const;
|
||||
virtual lay::Plugin *create_plugin (db::Manager *manager, lay::Dispatcher *, lay::LayoutView *view) const;
|
||||
virtual lay::Plugin *create_plugin (db::Manager *manager, lay::Dispatcher *, lay::LayoutViewBase *view) const;
|
||||
virtual bool implements_editable (std::string &title) const;
|
||||
virtual bool implements_mouse_mode (std::string &title) const;
|
||||
virtual bool configure (const std::string &name, const std::string &value);
|
||||
#if defined(HAVE_QT)
|
||||
virtual std::vector<std::pair <std::string, lay::ConfigPage *> > config_pages (QWidget *parent) const;
|
||||
#endif
|
||||
virtual void config_finalize ();
|
||||
virtual void initialized (lay::Dispatcher *);
|
||||
virtual void uninitialize (lay::Dispatcher *);
|
||||
|
|
@ -60,7 +64,9 @@ private:
|
|||
|
||||
std::vector<ant::Template> m_templates;
|
||||
int m_current_template;
|
||||
#if defined(HAVE_QT)
|
||||
tl::weak_collection<lay::ConfigureAction> m_actions;
|
||||
#endif
|
||||
bool m_current_template_updated;
|
||||
bool m_templates_updated;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -20,9 +20,10 @@
|
|||
|
||||
*/
|
||||
|
||||
#if defined(HAVE_QT)
|
||||
|
||||
#include "antPropertiesPage.h"
|
||||
#include "layLayoutView.h"
|
||||
#include "layLayoutViewBase.h"
|
||||
#include "layQtTools.h"
|
||||
|
||||
namespace ant
|
||||
|
|
@ -365,3 +366,4 @@ PropertiesPage::apply ()
|
|||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
*/
|
||||
|
||||
#if defined(HAVE_QT)
|
||||
|
||||
#ifndef HDR_antPropertiesPage
|
||||
#define HDR_antPropertiesPage
|
||||
|
|
@ -70,3 +71,5 @@ private:
|
|||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -28,13 +28,17 @@
|
|||
#include "layPlugin.h"
|
||||
#include "layRenderer.h"
|
||||
#include "laySnap.h"
|
||||
#include "layLayoutView.h"
|
||||
#include "layLayoutViewBase.h"
|
||||
#include "laybasicConfig.h"
|
||||
#include "layConverters.h"
|
||||
#include "layLayoutCanvas.h"
|
||||
#include "layProperties.h"
|
||||
#if defined(HAVE_QT)
|
||||
# include "layProperties.h"
|
||||
#endif
|
||||
#include "antService.h"
|
||||
#include "antPropertiesPage.h"
|
||||
#if defined(HAVE_QT)
|
||||
# include "antPropertiesPage.h"
|
||||
#endif
|
||||
#include "antConfig.h"
|
||||
|
||||
namespace ant
|
||||
|
|
@ -759,9 +763,9 @@ View::render (const lay::Viewport &vp, lay::ViewObjectCanvas &canvas)
|
|||
|
||||
int basic_width = int(0.5 + 1.0 / canvas.resolution ());
|
||||
|
||||
QColor c (mp_rulers->color ());
|
||||
if (! c.isValid ()) {
|
||||
c = QColor (canvas.foreground_color ().rgb ());
|
||||
lay::Color c (mp_rulers->color ());
|
||||
if (! c.is_valid ()) {
|
||||
c = canvas.foreground_color ();
|
||||
}
|
||||
|
||||
// obtain bitmap to render on
|
||||
|
|
@ -784,7 +788,7 @@ View::render (const lay::Viewport &vp, lay::ViewObjectCanvas &canvas)
|
|||
// -------------------------------------------------------------
|
||||
// ant::Service implementation
|
||||
|
||||
Service::Service (db::Manager *manager, lay::LayoutView *view)
|
||||
Service::Service (db::Manager *manager, lay::LayoutViewBase *view)
|
||||
: lay::EditorServiceBase (view),
|
||||
lay::Drawing (1/*number of planes*/, view->drawings ()),
|
||||
db::Object (manager),
|
||||
|
|
@ -819,7 +823,7 @@ Service::configure (const std::string &name, const std::string &value)
|
|||
|
||||
if (name == cfg_ruler_color) {
|
||||
|
||||
QColor color;
|
||||
lay::Color color;
|
||||
lay::ColorConverter ().from_string (value, color);
|
||||
|
||||
// make the color available for the dynamic view objects too.
|
||||
|
|
@ -910,7 +914,7 @@ Service::annotations_changed ()
|
|||
}
|
||||
|
||||
std::vector <lay::ViewOp>
|
||||
Service::get_view_ops (lay::RedrawThreadCanvas &canvas, QColor background, QColor foreground, QColor /*active*/) const
|
||||
Service::get_view_ops (lay::RedrawThreadCanvas &canvas, lay::Color background, lay::Color foreground, lay::Color /*active*/) const
|
||||
{
|
||||
int basic_width = int(0.5 + 1.0 / canvas.resolution ());
|
||||
|
||||
|
|
@ -920,7 +924,7 @@ Service::get_view_ops (lay::RedrawThreadCanvas &canvas, QColor background, QColo
|
|||
if (m_halo) {
|
||||
view_ops.push_back (lay::ViewOp (background.rgb (), lay::ViewOp::Copy, 0, 0, 0, lay::ViewOp::Rect, 3 * basic_width, 0));
|
||||
}
|
||||
if (m_color.isValid ()) {
|
||||
if (m_color.is_valid ()) {
|
||||
view_ops.push_back (lay::ViewOp (m_color.rgb (), lay::ViewOp::Copy, 0, 0, 0, lay::ViewOp::Rect, basic_width, 0));
|
||||
} else {
|
||||
view_ops.push_back (lay::ViewOp (foreground.rgb (), lay::ViewOp::Copy, 0, 0, 0, lay::ViewOp::Rect, basic_width, 0));
|
||||
|
|
@ -1525,7 +1529,7 @@ Service::mouse_click_event (const db::DPoint &p, unsigned int buttons, bool prio
|
|||
|
||||
// begin the transaction
|
||||
tl_assert (! manager ()->transacting ());
|
||||
manager ()->transaction (tl::to_string (QObject::tr ("Create ruler")));
|
||||
manager ()->transaction (tl::to_string (tr ("Create ruler")));
|
||||
|
||||
m_current = ant::Object (pt, pt, 0, tpl);
|
||||
show_message ();
|
||||
|
|
@ -1562,7 +1566,7 @@ Service::mouse_click_event (const db::DPoint &p, unsigned int buttons, bool prio
|
|||
|
||||
// begin the transaction
|
||||
tl_assert (! manager ()->transacting ());
|
||||
manager ()->transaction (tl::to_string (QObject::tr ("Create ruler")));
|
||||
manager ()->transaction (tl::to_string (tr ("Create ruler")));
|
||||
|
||||
m_current = ant::Object (ee.first, ee.second, 0, tpl);
|
||||
show_message ();
|
||||
|
|
@ -1598,7 +1602,7 @@ Service::mouse_click_event (const db::DPoint &p, unsigned int buttons, bool prio
|
|||
|
||||
// begin the transaction
|
||||
tl_assert (! manager ()->transacting ());
|
||||
manager ()->transaction (tl::to_string (QObject::tr ("Create ruler")));
|
||||
manager ()->transaction (tl::to_string (tr ("Create ruler")));
|
||||
|
||||
show_message ();
|
||||
|
||||
|
|
@ -2160,19 +2164,21 @@ Service::display_status (bool transient)
|
|||
|
||||
std::string msg;
|
||||
if (! transient) {
|
||||
msg = tl::to_string (QObject::tr ("selected: "));
|
||||
msg = tl::to_string (tr ("selected: "));
|
||||
}
|
||||
msg += tl::sprintf (tl::to_string (QObject::tr ("annotation(d=%s x=%s y=%s)")), ruler->text (), ruler->text_x (), ruler->text_y ());
|
||||
msg += tl::sprintf (tl::to_string (tr ("annotation(d=%s x=%s y=%s)")), ruler->text (), ruler->text_x (), ruler->text_y ());
|
||||
view ()->message (msg);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(HAVE_QT)
|
||||
lay::PropertiesPage *
|
||||
Service::properties_page (db::Manager *manager, QWidget *parent)
|
||||
{
|
||||
return new PropertiesPage (this, manager, parent);
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
Service::get_selection (std::vector <obj_iterator> &sel) const
|
||||
|
|
@ -2248,7 +2254,7 @@ Service::menu_activated (const std::string &symbol)
|
|||
if (symbol == "ant::clear_all_rulers_internal") {
|
||||
clear_rulers ();
|
||||
} else if (symbol == "ant::clear_all_rulers") {
|
||||
manager ()->transaction (tl::to_string (QObject::tr ("Clear all rulers")));
|
||||
manager ()->transaction (tl::to_string (tr ("Clear all rulers")));
|
||||
clear_rulers ();
|
||||
manager ()->commit ();
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@
|
|||
|
||||
namespace ant {
|
||||
|
||||
class LayoutView;
|
||||
class LayoutViewBase;
|
||||
class LayoutCanvas;
|
||||
class Service;
|
||||
|
||||
|
|
@ -201,7 +201,7 @@ public:
|
|||
*/
|
||||
enum MoveMode { MoveNone, MoveP1, MoveP2, MoveP12, MoveP21, MoveP1X, MoveP2X, MoveP1Y, MoveP2Y, MoveRuler, MoveSelected };
|
||||
|
||||
Service (db::Manager *manager, lay::LayoutView *view);
|
||||
Service (db::Manager *manager, lay::LayoutViewBase *view);
|
||||
|
||||
~Service ();
|
||||
|
||||
|
|
@ -346,10 +346,12 @@ public:
|
|||
*/
|
||||
virtual void transform (const db::DCplxTrans &trans);
|
||||
|
||||
#if defined(HAVE_QT)
|
||||
/**
|
||||
* @brief Create the properties page
|
||||
*/
|
||||
virtual lay::PropertiesPage *properties_page (db::Manager *manager, QWidget *parent);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Get the selection for the properties page
|
||||
|
|
@ -387,7 +389,7 @@ public:
|
|||
/**
|
||||
* @brief Color accessor
|
||||
*/
|
||||
QColor color () const
|
||||
lay::Color color () const
|
||||
{
|
||||
return m_color;
|
||||
}
|
||||
|
|
@ -427,7 +429,7 @@ public:
|
|||
/**
|
||||
* @brief Access to the view object
|
||||
*/
|
||||
lay::LayoutView *view () const
|
||||
lay::LayoutViewBase *view () const
|
||||
{
|
||||
return mp_view;
|
||||
}
|
||||
|
|
@ -498,7 +500,7 @@ public:
|
|||
|
||||
private:
|
||||
// Ruler display and snapping configuration
|
||||
QColor m_color;
|
||||
lay::Color m_color;
|
||||
bool m_halo;
|
||||
lay::angle_constraint_type m_snap_mode;
|
||||
double m_grid;
|
||||
|
|
@ -510,7 +512,7 @@ private:
|
|||
int m_max_number_of_rulers;
|
||||
|
||||
// The layout view that the ruler service is attached to
|
||||
lay::LayoutView *mp_view;
|
||||
lay::LayoutViewBase *mp_view;
|
||||
|
||||
// The ruler view objects representing the selection
|
||||
// and the moved rules in move mode
|
||||
|
|
@ -599,7 +601,7 @@ private:
|
|||
/**
|
||||
* @brief implementation of the "Drawing" interface: configuration
|
||||
*/
|
||||
std::vector <lay::ViewOp> get_view_ops (lay::RedrawThreadCanvas &canvas, QColor background, QColor foreground, QColor active) const;
|
||||
std::vector <lay::ViewOp> get_view_ops (lay::RedrawThreadCanvas &canvas, lay::Color background, lay::Color foreground, lay::Color active) const;
|
||||
|
||||
/**
|
||||
* @brief Update m_rulers to reflect the selection
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ namespace ant
|
|||
{
|
||||
|
||||
Template::Template ()
|
||||
: m_title (tl::to_string (QObject::tr ("Ruler"))),
|
||||
: m_title (tl::to_string (tr ("Ruler"))),
|
||||
m_fmt_x ("$X"), m_fmt_y ("$Y"), m_fmt ("$D"),
|
||||
m_style (ant::Object::STY_ruler), m_outline (ant::Object::OL_diag),
|
||||
m_snap (true), m_angle_constraint (lay::AC_Global),
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
#include "antObject.h"
|
||||
#include "antService.h"
|
||||
#include "antPlugin.h"
|
||||
#include "layLayoutView.h"
|
||||
#include "layLayoutViewBase.h"
|
||||
|
||||
namespace gsi
|
||||
{
|
||||
|
|
@ -70,10 +70,10 @@ static int align_right () { return int (ant::Object::AL_right); }
|
|||
static int align_top () { return int (ant::Object::AL_top); }
|
||||
static int align_up () { return int (ant::Object::AL_up); }
|
||||
|
||||
static void clear_annotations (lay::LayoutView *view);
|
||||
static void insert_annotation (lay::LayoutView *view, AnnotationRef *obj);
|
||||
static void erase_annotation (lay::LayoutView *view, int id);
|
||||
static void replace_annotation (lay::LayoutView *view, int id, const AnnotationRef &obj);
|
||||
static void clear_annotations (lay::LayoutViewBase *view);
|
||||
static void insert_annotation (lay::LayoutViewBase *view, AnnotationRef *obj);
|
||||
static void erase_annotation_base (lay::LayoutViewBase *view, int id);
|
||||
static void replace_annotation_base (lay::LayoutViewBase *view, int id, const AnnotationRef &obj);
|
||||
|
||||
/**
|
||||
* @brief An extension of the ant::Object that provides "live" updates of the view
|
||||
|
|
@ -88,7 +88,7 @@ public:
|
|||
// .. nothing yet ..
|
||||
}
|
||||
|
||||
AnnotationRef (const ant::Object &other, lay::LayoutView *view)
|
||||
AnnotationRef (const ant::Object &other, lay::LayoutViewBase *view)
|
||||
: ant::Object (other), mp_view (view)
|
||||
{
|
||||
// .. nothing yet ..
|
||||
|
|
@ -132,7 +132,7 @@ public:
|
|||
void erase ()
|
||||
{
|
||||
if (mp_view && id () >= 0) {
|
||||
erase_annotation (mp_view.get (), id ());
|
||||
erase_annotation_base (mp_view.get (), id ());
|
||||
detach ();
|
||||
}
|
||||
}
|
||||
|
|
@ -140,10 +140,10 @@ public:
|
|||
template <class T>
|
||||
AnnotationRef transformed (const T &t) const
|
||||
{
|
||||
return AnnotationRef (ant::Object::transformed<T> (t), const_cast<lay::LayoutView *> (mp_view.get ()));
|
||||
return AnnotationRef (ant::Object::transformed<T> (t), const_cast<lay::LayoutViewBase *> (mp_view.get ()));
|
||||
}
|
||||
|
||||
void set_view (lay::LayoutView *view)
|
||||
void set_view (lay::LayoutViewBase *view)
|
||||
{
|
||||
mp_view.reset (view);
|
||||
}
|
||||
|
|
@ -152,15 +152,15 @@ protected:
|
|||
void property_changed ()
|
||||
{
|
||||
if (mp_view && id () >= 0) {
|
||||
replace_annotation (mp_view.get (), id (), *this);
|
||||
replace_annotation_base (mp_view.get (), id (), *this);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
tl::weak_ptr<lay::LayoutView> mp_view;
|
||||
tl::weak_ptr<lay::LayoutViewBase> mp_view;
|
||||
};
|
||||
|
||||
static void clear_annotations (lay::LayoutView *view)
|
||||
static void clear_annotations (lay::LayoutViewBase *view)
|
||||
{
|
||||
ant::Service *ant_service = view->get_plugin <ant::Service> ();
|
||||
if (ant_service) {
|
||||
|
|
@ -168,10 +168,10 @@ static void clear_annotations (lay::LayoutView *view)
|
|||
}
|
||||
}
|
||||
|
||||
static void insert_annotation (lay::LayoutView *view, AnnotationRef *obj)
|
||||
static void insert_annotation (lay::LayoutViewBase *view, AnnotationRef *obj)
|
||||
{
|
||||
if (obj->is_valid ()) {
|
||||
throw tl::Exception (tl::to_string (QObject::tr ("The object is already inserted into a view - detach the object first or create a different object.")));
|
||||
throw tl::Exception (tl::to_string (tr ("The object is already inserted into a view - detach the object first or create a different object.")));
|
||||
}
|
||||
|
||||
ant::Service *ant_service = view->get_plugin <ant::Service> ();
|
||||
|
|
@ -182,7 +182,7 @@ static void insert_annotation (lay::LayoutView *view, AnnotationRef *obj)
|
|||
}
|
||||
}
|
||||
|
||||
static void erase_annotation (lay::LayoutView *view, int id)
|
||||
static void erase_annotation_base (lay::LayoutViewBase *view, int id)
|
||||
{
|
||||
ant::Service *ant_service = view->get_plugin <ant::Service> ();
|
||||
if (ant_service) {
|
||||
|
|
@ -195,7 +195,12 @@ static void erase_annotation (lay::LayoutView *view, int id)
|
|||
}
|
||||
}
|
||||
|
||||
static void replace_annotation (lay::LayoutView *view, int id, const AnnotationRef &obj)
|
||||
static void erase_annotation (lay::LayoutViewBase *view, int id)
|
||||
{
|
||||
erase_annotation_base (view, id);
|
||||
}
|
||||
|
||||
static void replace_annotation_base (lay::LayoutViewBase *view, int id, const AnnotationRef &obj)
|
||||
{
|
||||
ant::Service *ant_service = view->get_plugin <ant::Service> ();
|
||||
if (ant_service) {
|
||||
|
|
@ -208,7 +213,12 @@ static void replace_annotation (lay::LayoutView *view, int id, const AnnotationR
|
|||
}
|
||||
}
|
||||
|
||||
static AnnotationRef create_measure_ruler (lay::LayoutView *view, const db::DPoint &pt, int angle_constraint)
|
||||
static void replace_annotation (lay::LayoutViewBase *view, int id, const AnnotationRef &obj)
|
||||
{
|
||||
replace_annotation_base (view, id, obj);
|
||||
}
|
||||
|
||||
static AnnotationRef create_measure_ruler (lay::LayoutViewBase *view, const db::DPoint &pt, int angle_constraint)
|
||||
{
|
||||
std::vector<ant::Service *> ant_services = view->get_plugins <ant::Service> ();
|
||||
if (! ant_services.empty ()) {
|
||||
|
|
@ -341,7 +351,7 @@ public:
|
|||
// .. nothing yet ..
|
||||
}
|
||||
|
||||
AnnotationRefIterator (const ant::AnnotationIterator &iter, lay::LayoutView *view)
|
||||
AnnotationRefIterator (const ant::AnnotationIterator &iter, lay::LayoutViewBase *view)
|
||||
: ant::AnnotationIterator (iter), mp_view (view)
|
||||
{
|
||||
// .. nothing yet ..
|
||||
|
|
@ -349,14 +359,14 @@ public:
|
|||
|
||||
reference operator* () const
|
||||
{
|
||||
return reference (ant::AnnotationIterator::operator* (), const_cast<lay::LayoutView * >(mp_view.get ()));
|
||||
return reference (ant::AnnotationIterator::operator* (), const_cast<lay::LayoutViewBase * >(mp_view.get ()));
|
||||
}
|
||||
|
||||
private:
|
||||
tl::weak_ptr<lay::LayoutView> mp_view;
|
||||
tl::weak_ptr<lay::LayoutViewBase> mp_view;
|
||||
};
|
||||
|
||||
static AnnotationRefIterator begin_annotations (lay::LayoutView *view)
|
||||
static AnnotationRefIterator begin_annotations (lay::LayoutViewBase *view)
|
||||
{
|
||||
ant::Service *ant_service = view->get_plugin <ant::Service> ();
|
||||
if (ant_service) {
|
||||
|
|
@ -366,7 +376,7 @@ static AnnotationRefIterator begin_annotations (lay::LayoutView *view)
|
|||
}
|
||||
}
|
||||
|
||||
static AnnotationRef get_annotation (lay::LayoutView *view, int id)
|
||||
static AnnotationRef get_annotation (lay::LayoutViewBase *view, int id)
|
||||
{
|
||||
ant::Service *ant_service = view->get_plugin <ant::Service> ();
|
||||
if (ant_service) {
|
||||
|
|
@ -379,21 +389,21 @@ static AnnotationRef get_annotation (lay::LayoutView *view, int id)
|
|||
return AnnotationRef ();
|
||||
}
|
||||
|
||||
static tl::Event &get_annotations_changed_event (lay::LayoutView *view)
|
||||
static tl::Event &get_annotations_changed_event (lay::LayoutViewBase *view)
|
||||
{
|
||||
ant::Service *ant_service = view->get_plugin <ant::Service> ();
|
||||
tl_assert (ant_service != 0);
|
||||
return ant_service->annotations_changed_event;
|
||||
}
|
||||
|
||||
static tl::Event &get_annotation_selection_changed_event (lay::LayoutView *view)
|
||||
static tl::Event &get_annotation_selection_changed_event (lay::LayoutViewBase *view)
|
||||
{
|
||||
ant::Service *ant_service = view->get_plugin <ant::Service> ();
|
||||
tl_assert (ant_service != 0);
|
||||
return ant_service->annotation_selection_changed_event;
|
||||
}
|
||||
|
||||
static tl::event<int> &get_annotation_changed_event (lay::LayoutView *view)
|
||||
static tl::event<int> &get_annotation_changed_event (lay::LayoutViewBase *view)
|
||||
{
|
||||
ant::Service *ant_service = view->get_plugin <ant::Service> ();
|
||||
tl_assert (ant_service != 0);
|
||||
|
|
@ -979,7 +989,7 @@ gsi::Class<AnnotationRef> decl_Annotation (decl_BasicAnnotation, "lay", "Annotat
|
|||
);
|
||||
|
||||
static
|
||||
gsi::ClassExt<lay::LayoutView> layout_view_decl (
|
||||
gsi::ClassExt<lay::LayoutViewBase> layout_view_decl (
|
||||
gsi::method_ext ("clear_annotations", &gsi::clear_annotations,
|
||||
"@brief Clears all annotations on this view"
|
||||
) +
|
||||
|
|
@ -1113,7 +1123,7 @@ private:
|
|||
|
||||
// extend the layout view by "edtService" specific methods
|
||||
|
||||
static bool has_annotation_selection (const lay::LayoutView *view)
|
||||
static bool has_annotation_selection (const lay::LayoutViewBase *view)
|
||||
{
|
||||
std::vector<ant::Service *> ant_services = view->get_plugins <ant::Service> ();
|
||||
for (std::vector<ant::Service *>::const_iterator s = ant_services.begin (); s != ant_services.end (); ++s) {
|
||||
|
|
@ -1124,13 +1134,13 @@ static bool has_annotation_selection (const lay::LayoutView *view)
|
|||
return false;
|
||||
}
|
||||
|
||||
static AnnotationSelectionIterator begin_annotations_selected (const lay::LayoutView *view)
|
||||
static AnnotationSelectionIterator begin_annotations_selected (const lay::LayoutViewBase *view)
|
||||
{
|
||||
return AnnotationSelectionIterator (view->get_plugins <ant::Service> ());
|
||||
}
|
||||
|
||||
static
|
||||
gsi::ClassExt<lay::LayoutView> layout_view_decl2 (
|
||||
gsi::ClassExt<lay::LayoutViewBase> layout_view_decl2 (
|
||||
gsi::method_ext ("has_annotation_selection?", &has_annotation_selection,
|
||||
"@brief Returns true, if annotations (rulers) are selected in this view"
|
||||
"\n"
|
||||
|
|
|
|||
|
|
@ -408,7 +408,7 @@ BD_PUBLIC int strmxor (int argc, char *argv[])
|
|||
db::Layout layout_b;
|
||||
|
||||
{
|
||||
tl::SelfTimer timer (tl::verbosity () >= 11, tl::to_string (QObject::tr ("Loading file (A): ")) + infile_a);
|
||||
tl::SelfTimer timer (tl::verbosity () >= 11, tl::to_string (tr ("Loading file (A): ")) + infile_a);
|
||||
|
||||
db::LoadLayoutOptions load_options;
|
||||
generic_reader_options_a.configure (load_options);
|
||||
|
|
@ -416,7 +416,7 @@ BD_PUBLIC int strmxor (int argc, char *argv[])
|
|||
}
|
||||
|
||||
{
|
||||
tl::SelfTimer timer (tl::verbosity () >= 11, tl::to_string (QObject::tr ("Loading file (B): ")) + infile_b);
|
||||
tl::SelfTimer timer (tl::verbosity () >= 11, tl::to_string (tr ("Loading file (B): ")) + infile_b);
|
||||
|
||||
db::LoadLayoutOptions load_options;
|
||||
generic_reader_options_b.configure (load_options);
|
||||
|
|
|
|||
|
|
@ -201,6 +201,8 @@ public:
|
|||
|
||||
/**
|
||||
* @brief Returns the first logical layer for a given layer specification
|
||||
* The first value of the pair indicates whether there is a valid mapping.
|
||||
* The second value will give the layer to map to.
|
||||
*/
|
||||
template <class L>
|
||||
std::pair<bool, unsigned int> first_logical (const L &p) const
|
||||
|
|
@ -215,6 +217,8 @@ public:
|
|||
|
||||
/**
|
||||
* @brief Returns the first logical layer for a given layer specification
|
||||
* The first value of the pair indicates whether there is a valid mapping.
|
||||
* The second value will give the layer to map to.
|
||||
*/
|
||||
template <class L>
|
||||
std::pair<bool, unsigned int> first_logical (const L &p, db::Layout &layout) const
|
||||
|
|
@ -230,24 +234,21 @@ public:
|
|||
/**
|
||||
* @brief Query a layer mapping
|
||||
*
|
||||
* @return A pair telling if the layer is mapped (first=true) and
|
||||
* the logical layer mapped (second) if this is the case.
|
||||
* @return A set of layers which are designated targets.
|
||||
*/
|
||||
std::set<unsigned int> logical (const LDPair &p) const;
|
||||
|
||||
/**
|
||||
* @brief Query a layer mapping from a name
|
||||
*
|
||||
* @return A pair telling if the layer is mapped (first=true) and
|
||||
* the logical layer mapped (second) if this is the case.
|
||||
* @return A set of layers which are designated targets.
|
||||
*/
|
||||
std::set<unsigned int> logical (const std::string &name) const;
|
||||
|
||||
/**
|
||||
* @brief Query a layer mapping from a name or LDPair
|
||||
*
|
||||
* @return A pair telling if the layer is mapped (first=true) and
|
||||
* the logical layer mapped (second) if this is the case.
|
||||
* @return A set of layers which are designated targets.
|
||||
*
|
||||
* @param p The layer that is looked for
|
||||
*/
|
||||
|
|
@ -256,8 +257,7 @@ public:
|
|||
/**
|
||||
* @brief Query or install a layer mapping from a name or LDPair
|
||||
*
|
||||
* @return A pair telling if the layer is mapped (first=true) and
|
||||
* the logical layer mapped (second) if this is the case.
|
||||
* @return A set of layers which are designated targets.
|
||||
*
|
||||
* @param p The layer that is looked for
|
||||
*
|
||||
|
|
|
|||
|
|
@ -6,70 +6,88 @@ include($$PWD/../../lib.pri)
|
|||
|
||||
DEFINES += MAKE_EDT_LIBRARY
|
||||
|
||||
HEADERS = \
|
||||
edtConfig.h \
|
||||
edtDialogs.h \
|
||||
edtEditorOptionsPages.h \
|
||||
edtInstPropertiesPage.h \
|
||||
edtMainService.h \
|
||||
edtPartialService.h \
|
||||
edtPCellParametersPage.h \
|
||||
edtPlugin.h \
|
||||
edtPropertiesPages.h \
|
||||
edtPropertiesPageUtils.h \
|
||||
edtService.h \
|
||||
edtServiceImpl.h \
|
||||
edtUtils.h \
|
||||
edtCommon.h \
|
||||
edtDistribute.h \
|
||||
edtRecentConfigurationPage.h
|
||||
!equals(HAVE_QT, "0") {
|
||||
|
||||
FORMS = \
|
||||
AlignOptionsDialog.ui \
|
||||
BoxPropertiesPage.ui \
|
||||
CopyModeDialog.ui \
|
||||
ChangeLayerOptionsDialog.ui \
|
||||
EditablePathPropertiesPage.ui \
|
||||
EditorOptionsGeneric.ui \
|
||||
EditorOptionsInst.ui \
|
||||
EditorOptionsPath.ui \
|
||||
EditorOptionsText.ui \
|
||||
InstantiationForm.ui \
|
||||
InstPropertiesPage.ui \
|
||||
MakeArrayOptionsDialog.ui \
|
||||
MakeCellOptionsDialog.ui \
|
||||
PathPropertiesPage.ui \
|
||||
PolygonPropertiesPage.ui \
|
||||
RoundCornerOptionsDialog.ui \
|
||||
TextPropertiesPage.ui \
|
||||
FORMS = \
|
||||
AlignOptionsDialog.ui \
|
||||
BoxPropertiesPage.ui \
|
||||
CopyModeDialog.ui \
|
||||
ChangeLayerOptionsDialog.ui \
|
||||
EditablePathPropertiesPage.ui \
|
||||
EditorOptionsGeneric.ui \
|
||||
EditorOptionsInst.ui \
|
||||
EditorOptionsPath.ui \
|
||||
EditorOptionsText.ui \
|
||||
InstantiationForm.ui \
|
||||
InstPropertiesPage.ui \
|
||||
MakeArrayOptionsDialog.ui \
|
||||
MakeCellOptionsDialog.ui \
|
||||
PathPropertiesPage.ui \
|
||||
PolygonPropertiesPage.ui \
|
||||
RoundCornerOptionsDialog.ui \
|
||||
TextPropertiesPage.ui \
|
||||
DistributeOptionsDialog.ui \
|
||||
EditorOptionsInstPCellParam.ui
|
||||
|
||||
}
|
||||
|
||||
# Disabled without Qt:
|
||||
|
||||
HEADERS = \
|
||||
edtDialogs.h \
|
||||
edtEditorOptionsPages.h \
|
||||
edtInstPropertiesPage.h \
|
||||
edtPCellParametersPage.h \
|
||||
edtPropertiesPages.h \
|
||||
edtPropertiesPageUtils.h \
|
||||
edtRecentConfigurationPage.h
|
||||
|
||||
SOURCES = \
|
||||
edtDialogs.cc \
|
||||
edtEditorOptionsPages.cc \
|
||||
edtInstPropertiesPage.cc \
|
||||
edtPCellParametersPage.cc \
|
||||
edtPropertiesPages.cc \
|
||||
edtPropertiesPageUtils.cc \
|
||||
edtRecentConfigurationPage.cc
|
||||
|
||||
# Enabled without Qt:
|
||||
|
||||
HEADERS += \
|
||||
edtForceLink.h \
|
||||
edtConfig.h \
|
||||
edtMainService.h \
|
||||
edtPartialService.h \
|
||||
edtPlugin.h \
|
||||
edtService.h \
|
||||
edtServiceImpl.h \
|
||||
edtUtils.h \
|
||||
edtCommon.h \
|
||||
edtDistribute.h \
|
||||
|
||||
SOURCES += \
|
||||
edtForceLink.cc \
|
||||
edtConfig.cc \
|
||||
edtDialogs.cc \
|
||||
edtEditorOptionsPages.cc \
|
||||
edtInstPropertiesPage.cc \
|
||||
edtMainService.cc \
|
||||
edtPartialService.cc \
|
||||
edtPCellParametersPage.cc \
|
||||
edtPlugin.cc \
|
||||
edtPropertiesPages.cc \
|
||||
edtPropertiesPageUtils.cc \
|
||||
edtService.cc \
|
||||
edtServiceImpl.cc \
|
||||
edtUtils.cc \
|
||||
gsiDeclEdt.cc \
|
||||
edtDistribute.cc \
|
||||
edtRecentConfigurationPage.cc
|
||||
edtDistribute.cc \
|
||||
|
||||
INCLUDEPATH += $$TL_INC $$GSI_INC $$LAYBASIC_INC $$DB_INC
|
||||
DEPENDPATH += $$TL_INC $$GSI_INC $$LAYBASIC_INC $$DB_INC
|
||||
INCLUDEPATH += $$TL_INC $$GSI_INC $$LAYBASIC_INC $$LAYVIEW_INC $$DB_INC
|
||||
DEPENDPATH += $$TL_INC $$GSI_INC $$LAYBASIC_INC $$LAYVIEW_INC $$DB_INC
|
||||
|
||||
# Note: this accounts for UI-generated headers placed into the output folders in
|
||||
# shadow builds:
|
||||
INCLUDEPATH += $$DESTDIR/laybasic/laybasic
|
||||
DEPENDPATH += $$DESTDIR/laybasic/laybasic
|
||||
LIBS += -L$$DESTDIR -lklayout_tl -lklayout_gsi -lklayout_laybasic -lklayout_layview -lklayout_db
|
||||
|
||||
LIBS += -L$$DESTDIR -lklayout_tl -lklayout_gsi -lklayout_laybasic -lklayout_db
|
||||
!equals(HAVE_QT, "0") {
|
||||
|
||||
INCLUDEPATH += $$LAYUI_INC
|
||||
DEPENDPATH += $$LAYUI_INC
|
||||
|
||||
LIBS += -lklayout_layui
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -289,7 +289,7 @@ EditGridConverter::from_string_picky (const std::string &s, db::DVector &eg)
|
|||
y = x;
|
||||
}
|
||||
if (x < 1e-6 || y < 1e-6) {
|
||||
throw tl::Exception (tl::to_string (QObject::tr ("The grid must be larger than zero")));
|
||||
throw tl::Exception (tl::to_string (tr ("The grid must be larger than zero")));
|
||||
}
|
||||
eg = db::DVector (x, y);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,13 +20,15 @@
|
|||
|
||||
*/
|
||||
|
||||
#if defined(HAVE_QT)
|
||||
|
||||
#include "dbBox.h"
|
||||
#include "dbLayout.h"
|
||||
|
||||
#include "edtDialogs.h"
|
||||
#include "layObjectInstPath.h"
|
||||
#include "layCellView.h"
|
||||
#include "layLayoutView.h"
|
||||
#include "layLayoutViewBase.h"
|
||||
#include "layMarker.h"
|
||||
#include "tlException.h"
|
||||
#include "tlExceptions.h"
|
||||
|
|
@ -103,7 +105,7 @@ InstantiationForm::double_clicked (QListWidgetItem *item)
|
|||
}
|
||||
|
||||
void
|
||||
InstantiationForm::show (lay::LayoutView *view, const lay::ObjectInstPath &path)
|
||||
InstantiationForm::show (lay::LayoutViewBase *view, const lay::ObjectInstPath &path)
|
||||
{
|
||||
mp_view = view;
|
||||
mp_path = &path;
|
||||
|
|
@ -231,7 +233,7 @@ ChangeLayerOptionsDialog::~ChangeLayerOptionsDialog ()
|
|||
}
|
||||
|
||||
bool
|
||||
ChangeLayerOptionsDialog::exec_dialog (lay::LayoutView *view, int cv_index, unsigned int &new_layer)
|
||||
ChangeLayerOptionsDialog::exec_dialog (lay::LayoutViewBase *view, int cv_index, unsigned int &new_layer)
|
||||
{
|
||||
std::vector <std::pair <db::LayerProperties, unsigned int> > ll;
|
||||
|
||||
|
|
@ -280,7 +282,7 @@ AlignOptionsDialog::~AlignOptionsDialog ()
|
|||
}
|
||||
|
||||
bool
|
||||
AlignOptionsDialog::exec_dialog (lay::LayoutView * /*view*/, int &hmode, int &vmode, bool &visible_layers)
|
||||
AlignOptionsDialog::exec_dialog (int &hmode, int &vmode, bool &visible_layers)
|
||||
{
|
||||
QRadioButton *hmode_buttons [] = { this->h_none_rb, this->h_left_rb, this->h_center_rb, this->h_right_rb };
|
||||
QRadioButton *vmode_buttons [] = { this->v_none_rb, this->v_top_rb, this->v_center_rb, this->v_bottom_rb };
|
||||
|
|
@ -343,7 +345,7 @@ DistributeOptionsDialog::~DistributeOptionsDialog ()
|
|||
}
|
||||
|
||||
bool
|
||||
DistributeOptionsDialog::exec_dialog (lay::LayoutView * /*view*/, bool &hdistribute, int &hmode, double &hpitch, double &hspace, bool &vdistribute, int &vmode, double &vpitch, double &vspace, bool &visible_layers)
|
||||
DistributeOptionsDialog::exec_dialog (bool &hdistribute, int &hmode, double &hpitch, double &hspace, bool &vdistribute, int &vmode, double &vpitch, double &vspace, bool &visible_layers)
|
||||
{
|
||||
QRadioButton *hmode_buttons [] = { this->h_none_rb, this->h_left_rb, this->h_center_rb, this->h_right_rb };
|
||||
QRadioButton *vmode_buttons [] = { this->v_none_rb, this->v_top_rb, this->v_center_rb, this->v_bottom_rb };
|
||||
|
|
@ -683,3 +685,5 @@ END_PROTECTED;
|
|||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
*/
|
||||
|
||||
#if defined(HAVE_QT)
|
||||
|
||||
|
||||
#ifndef HDR_edtDialogs
|
||||
|
|
@ -45,7 +46,7 @@
|
|||
|
||||
namespace lay
|
||||
{
|
||||
class LayoutView;
|
||||
class LayoutViewBase;
|
||||
class Marker;
|
||||
class ObjectInstPath;
|
||||
}
|
||||
|
|
@ -81,7 +82,7 @@ public:
|
|||
InstantiationForm (QWidget *parent);
|
||||
virtual ~InstantiationForm ();
|
||||
|
||||
void show (lay::LayoutView *view, const lay::ObjectInstPath &path);
|
||||
void show (lay::LayoutViewBase *view, const lay::ObjectInstPath &path);
|
||||
|
||||
public slots:
|
||||
void display_mode_changed (bool);
|
||||
|
|
@ -90,7 +91,7 @@ public slots:
|
|||
private:
|
||||
void update ();
|
||||
|
||||
lay::LayoutView *mp_view;
|
||||
lay::LayoutViewBase *mp_view;
|
||||
const lay::ObjectInstPath *mp_path;
|
||||
lay::Marker *mp_marker;
|
||||
bool m_enable_cb_callbacks;
|
||||
|
|
@ -109,7 +110,7 @@ public:
|
|||
ChangeLayerOptionsDialog (QWidget *parent);
|
||||
virtual ~ChangeLayerOptionsDialog ();
|
||||
|
||||
bool exec_dialog (lay::LayoutView *view, int cv_index, unsigned int &new_layer);
|
||||
bool exec_dialog (lay::LayoutViewBase *view, int cv_index, unsigned int &new_layer);
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -125,7 +126,7 @@ public:
|
|||
AlignOptionsDialog (QWidget *parent);
|
||||
virtual ~AlignOptionsDialog ();
|
||||
|
||||
bool exec_dialog (lay::LayoutView *view, int &hmode, int &vmode, bool &visible_layers);
|
||||
bool exec_dialog (int &hmode, int &vmode, bool &visible_layers);
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -141,7 +142,7 @@ public:
|
|||
DistributeOptionsDialog (QWidget *parent);
|
||||
virtual ~DistributeOptionsDialog ();
|
||||
|
||||
bool exec_dialog (lay::LayoutView *view, bool &hdistribute, int &hmode, double &hpitch, double &hspace, bool &vdistribute, int &vmode, double &vpitch, double &vspace, bool &visible_layers);
|
||||
bool exec_dialog (bool &hdistribute, int &hmode, double &hpitch, double &hspace, bool &vdistribute, int &vmode, double &vpitch, double &vspace, bool &visible_layers);
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -208,3 +209,5 @@ private:
|
|||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
*/
|
||||
|
||||
#if defined(HAVE_QT)
|
||||
|
||||
#include "tlInternational.h"
|
||||
#include "dbLibrary.h"
|
||||
|
|
@ -32,7 +33,7 @@
|
|||
#include "edtPropertiesPageUtils.h"
|
||||
#include "tlExceptions.h"
|
||||
#include "layPlugin.h"
|
||||
#include "layLayoutView.h"
|
||||
#include "layLayoutViewBase.h"
|
||||
#include "layCellSelectionForm.h"
|
||||
#include "layQtTools.h"
|
||||
#include "ui_EditorOptionsGeneric.h"
|
||||
|
|
@ -69,7 +70,7 @@ static void configure_from_line_edit (lay::Dispatcher *dispatcher, QLineEdit *le
|
|||
// ------------------------------------------------------------------
|
||||
// EditorOptionsGeneric implementation
|
||||
|
||||
EditorOptionsGeneric::EditorOptionsGeneric (lay::LayoutView *view, lay::Dispatcher *dispatcher)
|
||||
EditorOptionsGeneric::EditorOptionsGeneric (lay::LayoutViewBase *view, lay::Dispatcher *dispatcher)
|
||||
: EditorOptionsPage (view, dispatcher)
|
||||
{
|
||||
mp_ui = new Ui::EditorOptionsGeneric ();
|
||||
|
|
@ -206,7 +207,7 @@ EditorOptionsGeneric::setup (lay::Dispatcher *root)
|
|||
// ------------------------------------------------------------------
|
||||
// EditorOptionsText implementation
|
||||
|
||||
EditorOptionsText::EditorOptionsText (lay::LayoutView *view, lay::Dispatcher *dispatcher)
|
||||
EditorOptionsText::EditorOptionsText (lay::LayoutViewBase *view, lay::Dispatcher *dispatcher)
|
||||
: lay::EditorOptionsPage (view, dispatcher)
|
||||
{
|
||||
mp_ui = new Ui::EditorOptionsText ();
|
||||
|
|
@ -284,7 +285,7 @@ EditorOptionsText::setup (lay::Dispatcher *root)
|
|||
// ------------------------------------------------------------------
|
||||
// EditorOptionsPath implementation
|
||||
|
||||
EditorOptionsPath::EditorOptionsPath (lay::LayoutView *view, lay::Dispatcher *dispatcher)
|
||||
EditorOptionsPath::EditorOptionsPath (lay::LayoutViewBase *view, lay::Dispatcher *dispatcher)
|
||||
: lay::EditorOptionsPage (view, dispatcher)
|
||||
{
|
||||
mp_ui = new Ui::EditorOptionsPath ();
|
||||
|
|
@ -385,7 +386,7 @@ EditorOptionsPath::setup (lay::Dispatcher *root)
|
|||
// ------------------------------------------------------------------
|
||||
// EditorOptionsInst implementation
|
||||
|
||||
EditorOptionsInst::EditorOptionsInst (lay::LayoutView *view, lay::Dispatcher *dispatcher)
|
||||
EditorOptionsInst::EditorOptionsInst (lay::LayoutViewBase *view, lay::Dispatcher *dispatcher)
|
||||
: lay::EditorOptionsPage (view, dispatcher)
|
||||
{
|
||||
mp_ui = new Ui::EditorOptionsInst ();
|
||||
|
|
@ -678,7 +679,7 @@ EditorOptionsInst::setup (lay::Dispatcher *root)
|
|||
// ------------------------------------------------------------------
|
||||
// EditorOptionsInstPCellParam implementation
|
||||
|
||||
EditorOptionsInstPCellParam::EditorOptionsInstPCellParam (lay::LayoutView *view, lay::Dispatcher *dispatcher)
|
||||
EditorOptionsInstPCellParam::EditorOptionsInstPCellParam (lay::LayoutViewBase *view, lay::Dispatcher *dispatcher)
|
||||
: lay::EditorOptionsPage (view, dispatcher), mp_pcell_parameters (0), mp_placeholder_label (0)
|
||||
{
|
||||
mp_ui = new Ui::EditorOptionsInstPCellParam ();
|
||||
|
|
@ -890,3 +891,4 @@ EditorOptionsInstPCellParam::update_pcell_parameters (const std::vector <tl::Var
|
|||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
*/
|
||||
|
||||
#if defined(HAVE_QT)
|
||||
|
||||
#ifndef HDR_edtEditorOptionsPages
|
||||
#define HDR_edtEditorOptionsPages
|
||||
|
|
@ -51,7 +52,7 @@ namespace lay
|
|||
{
|
||||
class PluginDeclaration;
|
||||
class Dispatcher;
|
||||
class LayoutView;
|
||||
class LayoutViewBase;
|
||||
class Plugin;
|
||||
}
|
||||
|
||||
|
|
@ -69,7 +70,7 @@ class EditorOptionsGeneric
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
EditorOptionsGeneric (lay::LayoutView *view, lay::Dispatcher *dispatcher);
|
||||
EditorOptionsGeneric (lay::LayoutViewBase *view, lay::Dispatcher *dispatcher);
|
||||
~EditorOptionsGeneric ();
|
||||
|
||||
virtual std::string title () const;
|
||||
|
|
@ -92,7 +93,7 @@ class EditorOptionsText
|
|||
: public lay::EditorOptionsPage
|
||||
{
|
||||
public:
|
||||
EditorOptionsText (lay::LayoutView *view, lay::Dispatcher *dispatcher);
|
||||
EditorOptionsText (lay::LayoutViewBase *view, lay::Dispatcher *dispatcher);
|
||||
~EditorOptionsText ();
|
||||
|
||||
virtual std::string title () const;
|
||||
|
|
@ -113,7 +114,7 @@ class EditorOptionsPath
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
EditorOptionsPath (lay::LayoutView *view, lay::Dispatcher *dispatcher);
|
||||
EditorOptionsPath (lay::LayoutViewBase *view, lay::Dispatcher *dispatcher);
|
||||
~EditorOptionsPath ();
|
||||
|
||||
virtual std::string title () const;
|
||||
|
|
@ -137,7 +138,7 @@ class EditorOptionsInst
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
EditorOptionsInst (lay::LayoutView *view, lay::Dispatcher *root);
|
||||
EditorOptionsInst (lay::LayoutViewBase *view, lay::Dispatcher *root);
|
||||
~EditorOptionsInst ();
|
||||
|
||||
virtual std::string title () const;
|
||||
|
|
@ -169,7 +170,7 @@ class EditorOptionsInstPCellParam
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
EditorOptionsInstPCellParam (lay::LayoutView *view, lay::Dispatcher *root);
|
||||
EditorOptionsInstPCellParam (lay::LayoutViewBase *view, lay::Dispatcher *root);
|
||||
~EditorOptionsInstPCellParam ();
|
||||
|
||||
virtual std::string title () const;
|
||||
|
|
@ -195,3 +196,4 @@ private:
|
|||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -0,0 +1,32 @@
|
|||
|
||||
/*
|
||||
|
||||
KLayout Layout Viewer
|
||||
Copyright (C) 2006-2022 Matthias Koefferlein
|
||||
|
||||
This program 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.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warredty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
*/
|
||||
|
||||
#include "edtForceLink.h"
|
||||
|
||||
namespace edt
|
||||
{
|
||||
int _force_link_f ()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
|
||||
/*
|
||||
|
||||
KLayout Layout Viewer
|
||||
Copyright (C) 2006-2022 Matthias Koefferlein
|
||||
|
||||
This program 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.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warredty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#ifndef HDR_edtForceLink
|
||||
#define HDR_edtForceLink
|
||||
|
||||
#include "edtCommon.h"
|
||||
|
||||
/**
|
||||
* @file Include this function to force linking of the edt module
|
||||
*/
|
||||
|
||||
namespace edt
|
||||
{
|
||||
EDT_PUBLIC int _force_link_f ();
|
||||
static int _force_link_target = _force_link_f ();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
*/
|
||||
|
||||
#if defined(HAVE_QT)
|
||||
|
||||
#include "dbLibrary.h"
|
||||
#include "dbPCellHeader.h"
|
||||
|
|
@ -31,7 +32,7 @@
|
|||
#include "edtDialogs.h"
|
||||
#include "layDialogs.h"
|
||||
#include "layObjectInstPath.h"
|
||||
#include "layLayoutView.h"
|
||||
#include "layLayoutViewBase.h"
|
||||
#include "layCellSelectionForm.h"
|
||||
#include "layQtTools.h"
|
||||
#include "tlExceptions.h"
|
||||
|
|
@ -940,3 +941,4 @@ InstPropertiesPage::update_pcell_parameters ()
|
|||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
*/
|
||||
|
||||
#if defined(HAVE_QT)
|
||||
|
||||
|
||||
#ifndef HDR_edtInstPropertiesPage
|
||||
|
|
@ -88,3 +89,4 @@ protected slots:
|
|||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -64,7 +64,7 @@ public:
|
|||
/**
|
||||
* @brief The constructor
|
||||
*/
|
||||
MainService (db::Manager *manager, lay::LayoutView *view, lay::Dispatcher *root);
|
||||
MainService (db::Manager *manager, lay::LayoutViewBase *view, lay::Dispatcher *root);
|
||||
|
||||
/**
|
||||
* @brief The destructor
|
||||
|
|
@ -74,7 +74,7 @@ public:
|
|||
/**
|
||||
* @brief Access to the view object
|
||||
*/
|
||||
lay::LayoutView *view () const
|
||||
lay::LayoutViewBase *view () const
|
||||
{
|
||||
return mp_view;
|
||||
}
|
||||
|
|
@ -196,7 +196,7 @@ public:
|
|||
|
||||
private:
|
||||
// The layout view that this service is attached to
|
||||
lay::LayoutView *mp_view;
|
||||
lay::LayoutViewBase *mp_view;
|
||||
lay::Dispatcher *mp_root;
|
||||
bool m_needs_update;
|
||||
|
||||
|
|
@ -221,21 +221,25 @@ private:
|
|||
double m_router, m_rinner;
|
||||
unsigned int m_npoints;
|
||||
bool m_undo_before_apply;
|
||||
#if defined(HAVE_QT)
|
||||
edt::RoundCornerOptionsDialog *mp_round_corners_dialog;
|
||||
edt::AlignOptionsDialog *mp_align_options_dialog;
|
||||
edt::DistributeOptionsDialog *mp_distribute_options_dialog;
|
||||
lay::FlattenInstOptionsDialog *mp_flatten_inst_options_dialog;
|
||||
edt::MakeCellOptionsDialog *mp_make_cell_options_dialog;
|
||||
edt::MakeArrayOptionsDialog *mp_make_array_options_dialog;
|
||||
#endif
|
||||
|
||||
void boolean_op (int mode);
|
||||
void check_no_guiding_shapes ();
|
||||
#if defined(HAVE_QT)
|
||||
edt::RoundCornerOptionsDialog *round_corners_dialog ();
|
||||
edt::AlignOptionsDialog *align_options_dialog ();
|
||||
edt::DistributeOptionsDialog *distribute_options_dialog ();
|
||||
lay::FlattenInstOptionsDialog *flatten_inst_options_dialog ();
|
||||
edt::MakeCellOptionsDialog *make_cell_options_dialog ();
|
||||
edt::MakeArrayOptionsDialog *make_array_options_dialog ();
|
||||
#endif
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,12 +20,13 @@
|
|||
|
||||
*/
|
||||
|
||||
#if defined(HAVE_QT)
|
||||
|
||||
#include "edtPCellParametersPage.h"
|
||||
#include "edtPropertiesPageUtils.h"
|
||||
#include "layWidgets.h"
|
||||
#include "layQtTools.h"
|
||||
#include "layLayoutView.h"
|
||||
#include "layLayoutViewBase.h"
|
||||
#include "tlScriptError.h"
|
||||
|
||||
#include <QFrame>
|
||||
|
|
@ -232,7 +233,7 @@ PCellParametersPage::lazy_evaluation ()
|
|||
}
|
||||
|
||||
void
|
||||
PCellParametersPage::setup (lay::LayoutView *view, int cv_index, const db::PCellDeclaration *pcell_decl, const db::pcell_parameters_type ¶meters)
|
||||
PCellParametersPage::setup (lay::LayoutViewBase *view, int cv_index, const db::PCellDeclaration *pcell_decl, const db::pcell_parameters_type ¶meters)
|
||||
{
|
||||
mp_pcell_decl.reset (const_cast<db::PCellDeclaration *> (pcell_decl)); // no const weak_ptr ...
|
||||
mp_view = view;
|
||||
|
|
@ -732,4 +733,4 @@ PCellParametersPage::set_parameters_internal (const std::vector<tl::Variant> &pa
|
|||
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
*/
|
||||
|
||||
#if defined(HAVE_QT)
|
||||
|
||||
#ifndef HDR_edtPCellParametersPage
|
||||
#define HDR_edtPCellParametersPage
|
||||
|
|
@ -34,7 +35,7 @@
|
|||
|
||||
namespace lay
|
||||
{
|
||||
class LayoutView;
|
||||
class LayoutViewBase;
|
||||
}
|
||||
|
||||
namespace edt
|
||||
|
|
@ -79,7 +80,7 @@ public:
|
|||
* @param pcell_decl The PCell declaration
|
||||
* @param parameters The parameter values to show (if empty, the default values are used)
|
||||
*/
|
||||
void setup (lay::LayoutView *view, int cv_index, const db::PCellDeclaration *pcell_decl, const db::pcell_parameters_type ¶meters);
|
||||
void setup (lay::LayoutViewBase *view, int cv_index, const db::PCellDeclaration *pcell_decl, const db::pcell_parameters_type ¶meters);
|
||||
|
||||
/**
|
||||
* @brief Gets the pages current state
|
||||
|
|
@ -140,7 +141,7 @@ private:
|
|||
QFrame *mp_error_frame, *mp_update_frame;
|
||||
tl::weak_ptr<db::PCellDeclaration> mp_pcell_decl;
|
||||
std::vector<QWidget *> m_widgets;
|
||||
lay::LayoutView *mp_view;
|
||||
lay::LayoutViewBase *mp_view;
|
||||
int m_cv_index;
|
||||
db::pcell_parameters_type m_parameters;
|
||||
bool m_dense;
|
||||
|
|
@ -157,3 +158,5 @@ private:
|
|||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -21,19 +21,20 @@
|
|||
*/
|
||||
|
||||
|
||||
#include <QMessageBox>
|
||||
|
||||
#include "dbVector.h"
|
||||
#include "layLayoutView.h"
|
||||
#include "layLayoutViewBase.h"
|
||||
#include "laySnap.h"
|
||||
#include "layFinder.h"
|
||||
#include "tlProgress.h"
|
||||
#include "edtPartialService.h"
|
||||
#include "edtService.h"
|
||||
#include "edtConfig.h"
|
||||
#include "edtDialogs.h"
|
||||
#include "edtPlugin.h"
|
||||
#include "edtEditorOptionsPages.h"
|
||||
|
||||
#if defined(HAVE_QT)
|
||||
# include "edtDialogs.h"
|
||||
# include "edtEditorOptionsPages.h"
|
||||
#endif
|
||||
|
||||
#include <cmath>
|
||||
|
||||
|
|
@ -1010,8 +1011,10 @@ PartialShapeFinder::visit_cell (const db::Cell &cell, const db::Box &search_box,
|
|||
// -----------------------------------------------------------------------------
|
||||
// Main Service implementation
|
||||
|
||||
PartialService::PartialService (db::Manager *manager, lay::LayoutView *view, lay::Dispatcher *root)
|
||||
: QObject (),
|
||||
PartialService::PartialService (db::Manager *manager, lay::LayoutViewBase *view, lay::Dispatcher *root) :
|
||||
#if defined(HAVE_QT)
|
||||
QObject (),
|
||||
#endif
|
||||
lay::EditorServiceBase (view),
|
||||
db::Object (manager),
|
||||
mp_view (view),
|
||||
|
|
@ -1027,9 +1030,11 @@ PartialService::PartialService (db::Manager *manager, lay::LayoutView *view, lay
|
|||
m_hover (false),
|
||||
m_hover_wait (false)
|
||||
{
|
||||
#if defined(HAVE_QT)
|
||||
m_timer.setInterval (100 /*hover time*/);
|
||||
m_timer.setSingleShot (true);
|
||||
connect (&m_timer, SIGNAL (timeout ()), this, SLOT (timeout ()));
|
||||
#endif
|
||||
}
|
||||
|
||||
PartialService::~PartialService ()
|
||||
|
|
@ -1077,7 +1082,9 @@ void
|
|||
PartialService::hover_reset ()
|
||||
{
|
||||
if (m_hover_wait) {
|
||||
#if defined(HAVE_QT)
|
||||
m_timer.stop ();
|
||||
#endif
|
||||
m_hover_wait = false;
|
||||
}
|
||||
if (m_hover) {
|
||||
|
|
@ -1086,7 +1093,9 @@ PartialService::hover_reset ()
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
// TODO: should receive timer calls from regular timer update
|
||||
#if defined(HAVE_QT)
|
||||
void
|
||||
PartialService::timeout ()
|
||||
{
|
||||
m_hover_wait = false;
|
||||
|
|
@ -1209,6 +1218,7 @@ PartialService::timeout ()
|
|||
resize_inst_markers (n_inst_marker, true);
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
PartialService::clear_partial_transient_selection ()
|
||||
|
|
@ -1220,7 +1230,7 @@ PartialService::clear_partial_transient_selection ()
|
|||
}
|
||||
|
||||
void
|
||||
PartialService::set_colors (QColor /*background*/, QColor color)
|
||||
PartialService::set_colors (lay::Color /*background*/, lay::Color color)
|
||||
{
|
||||
m_color = color.rgb ();
|
||||
if (mp_box) {
|
||||
|
|
@ -1571,7 +1581,9 @@ PartialService::mouse_move_event (const db::DPoint &p, unsigned int buttons, boo
|
|||
} else if (view ()->transient_selection_mode ()) {
|
||||
|
||||
m_hover_wait = true;
|
||||
#if defined(HAVE_QT)
|
||||
m_timer.start ();
|
||||
#endif
|
||||
m_hover_point = p;
|
||||
|
||||
}
|
||||
|
|
@ -1622,8 +1634,7 @@ PartialService::mouse_press_event (const db::DPoint &p, unsigned int buttons, bo
|
|||
try {
|
||||
partial_select (db::DBox (p, p), lay::Editable::Replace);
|
||||
} catch (tl::Exception &ex) {
|
||||
tl::error << ex.msg ();
|
||||
QMessageBox::critical (0, QObject::tr ("Error"), tl::to_qstring (ex.msg ()));
|
||||
show_error (ex);
|
||||
// clear selection
|
||||
partial_select (db::DBox (), lay::Editable::Reset);
|
||||
}
|
||||
|
|
@ -1703,7 +1714,7 @@ PartialService::mouse_click_event (const db::DPoint &p, unsigned int buttons, bo
|
|||
// stop dragging
|
||||
widget ()->ungrab_mouse (this);
|
||||
|
||||
manager ()->transaction (tl::to_string (QObject::tr ("Partial move")));
|
||||
manager ()->transaction (tl::to_string (tr ("Partial move")));
|
||||
|
||||
// heuristically, if there is just one edge selected: do not confine to the movement
|
||||
// angle constraint - the edge usually is confined enough
|
||||
|
|
@ -1862,8 +1873,7 @@ PartialService::mouse_click_event (const db::DPoint &p, unsigned int buttons, bo
|
|||
selection_to_view ();
|
||||
|
||||
} catch (tl::Exception &ex) {
|
||||
tl::error << ex.msg ();
|
||||
QMessageBox::critical (0, QObject::tr ("Error"), tl::to_qstring (ex.msg ()));
|
||||
show_error (ex);
|
||||
// clear selection
|
||||
partial_select (db::DBox (), lay::Editable::Reset);
|
||||
}
|
||||
|
|
@ -1901,7 +1911,7 @@ PartialService::mouse_double_click_event (const db::DPoint &p, unsigned int butt
|
|||
partial_objects::iterator r = m_selection.begin (); // we assert above that we have at least one selected element
|
||||
if (! r->first.is_cell_inst ()) {
|
||||
|
||||
manager ()->transaction (tl::to_string (QObject::tr ("Insert point")));
|
||||
manager ()->transaction (tl::to_string (tr ("Insert point")));
|
||||
|
||||
// snap the point
|
||||
db::DPoint new_point_d = snap (p);
|
||||
|
|
@ -2018,8 +2028,7 @@ PartialService::mouse_release_event (const db::DPoint &p, unsigned int buttons,
|
|||
try {
|
||||
partial_select (db::DBox (m_p1, m_p2), mode);
|
||||
} catch (tl::Exception &ex) {
|
||||
tl::error << ex.msg ();
|
||||
QMessageBox::critical (0, QObject::tr ("Error"), tl::to_qstring (ex.msg ()));
|
||||
show_error (ex);
|
||||
// clear selection
|
||||
partial_select (db::DBox (), lay::Editable::Reset);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,8 +34,10 @@
|
|||
#include "edtUtils.h"
|
||||
#include "edtConfig.h"
|
||||
|
||||
#include <QObject>
|
||||
#include <QTimer>
|
||||
#if defined(HAVE_QT)
|
||||
# include <QObject>
|
||||
# include <QTimer>
|
||||
#endif
|
||||
|
||||
namespace db {
|
||||
class Manager;
|
||||
|
|
@ -136,12 +138,16 @@ struct EdgeWithIndex
|
|||
/**
|
||||
* @brief The partial selection and manipulation service
|
||||
*/
|
||||
class PartialService
|
||||
: public QObject,
|
||||
class PartialService :
|
||||
#if defined(HAVE_QT)
|
||||
public QObject,
|
||||
#endif
|
||||
public lay::EditorServiceBase,
|
||||
public db::Object
|
||||
{
|
||||
#if defined(HAVE_QT)
|
||||
Q_OBJECT
|
||||
#endif
|
||||
|
||||
public:
|
||||
typedef std::map<lay::ObjectInstPath, std::set<EdgeWithIndex> > partial_objects;
|
||||
|
|
@ -149,7 +155,7 @@ public:
|
|||
/**
|
||||
* @brief The constructor
|
||||
*/
|
||||
PartialService (db::Manager *manager, lay::LayoutView *view, lay::Dispatcher *root);
|
||||
PartialService (db::Manager *manager, lay::LayoutViewBase *view, lay::Dispatcher *root);
|
||||
|
||||
/**
|
||||
* @brief The destructor
|
||||
|
|
@ -159,7 +165,7 @@ public:
|
|||
/**
|
||||
* @brief Access to the view object
|
||||
*/
|
||||
lay::LayoutView *view () const
|
||||
lay::LayoutViewBase *view () const
|
||||
{
|
||||
tl_assert (mp_view != 0);
|
||||
return mp_view;
|
||||
|
|
@ -282,15 +288,17 @@ public:
|
|||
/**
|
||||
* @brief Reimplementation of the ViewService interface: set the colors
|
||||
*/
|
||||
virtual void set_colors (QColor background, QColor text);
|
||||
virtual void set_colors (lay::Color background, lay::Color text);
|
||||
|
||||
/**
|
||||
* @brief Cancel any edit operations (in this case, unselect all & cancel any drag operation)
|
||||
*/
|
||||
virtual void edit_cancel ();
|
||||
|
||||
#if defined(HAVE_QT)
|
||||
public slots:
|
||||
void timeout ();
|
||||
#endif
|
||||
|
||||
protected:
|
||||
lay::angle_constraint_type connect_ac () const;
|
||||
|
|
@ -298,7 +306,7 @@ protected:
|
|||
|
||||
private:
|
||||
// The layout view that this service is attached to
|
||||
lay::LayoutView *mp_view;
|
||||
lay::LayoutViewBase *mp_view;
|
||||
lay::Dispatcher *mp_root;
|
||||
bool m_dragging;
|
||||
bool m_keep_selection;
|
||||
|
|
@ -324,7 +332,9 @@ private:
|
|||
std::vector<lay::InstanceMarker *> m_inst_markers;
|
||||
std::vector<lay::InstanceMarker *> m_transient_inst_markers;
|
||||
|
||||
#if defined(HAVE_QT)
|
||||
QTimer m_timer;
|
||||
#endif
|
||||
bool m_hover;
|
||||
bool m_hover_wait;
|
||||
db::DPoint m_hover_point;
|
||||
|
|
|
|||
|
|
@ -21,36 +21,49 @@
|
|||
*/
|
||||
|
||||
|
||||
#include "layTipDialog.h"
|
||||
#include "layEditorOptionsPages.h"
|
||||
#if defined(HAVE_QT)
|
||||
# include "layTipDialog.h"
|
||||
# include "layEditorOptionsPages.h"
|
||||
#endif
|
||||
|
||||
#include "layDispatcher.h"
|
||||
#include "layLayoutView.h"
|
||||
#include "layLayoutViewBase.h"
|
||||
#include "edtPlugin.h"
|
||||
#include "edtConfig.h"
|
||||
#include "edtService.h"
|
||||
#include "edtServiceImpl.h"
|
||||
#include "edtMainService.h"
|
||||
#include "edtPartialService.h"
|
||||
#include "edtEditorOptionsPages.h"
|
||||
#include "edtRecentConfigurationPage.h"
|
||||
#if defined(HAVE_QT)
|
||||
# include "edtEditorOptionsPages.h"
|
||||
# include "edtRecentConfigurationPage.h"
|
||||
#endif
|
||||
|
||||
#include <QApplication>
|
||||
#include <QLayout>
|
||||
#if defined(HAVE_QT)
|
||||
# include <QApplication>
|
||||
# include <QLayout>
|
||||
#endif
|
||||
|
||||
namespace edt
|
||||
{
|
||||
|
||||
#if defined(HAVE_QT)
|
||||
edt::RecentConfigurationPage::ConfigurationDescriptor shape_cfg_descriptors[] =
|
||||
{
|
||||
edt::RecentConfigurationPage::ConfigurationDescriptor ("", tl::to_string (tr ("Layer")), edt::RecentConfigurationPage::Layer),
|
||||
};
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_QT)
|
||||
static
|
||||
void get_shape_editor_options_pages (std::vector<lay::EditorOptionsPage *> &ret, lay::LayoutView *view, lay::Dispatcher *dispatcher)
|
||||
void get_shape_editor_options_pages (std::vector<lay::EditorOptionsPage *> &ret, lay::LayoutViewBase *view, lay::Dispatcher *dispatcher)
|
||||
{
|
||||
ret.push_back (new RecentConfigurationPage (view, dispatcher, "edit-recent-shape-param",
|
||||
&shape_cfg_descriptors[0], &shape_cfg_descriptors[sizeof (shape_cfg_descriptors) / sizeof (shape_cfg_descriptors[0])]));
|
||||
}
|
||||
#else
|
||||
static void get_shape_editor_options_pages () { }
|
||||
#endif
|
||||
|
||||
static
|
||||
void get_text_options (std::vector < std::pair<std::string, std::string> > &options)
|
||||
|
|
@ -61,8 +74,9 @@ void get_text_options (std::vector < std::pair<std::string, std::string> > &opti
|
|||
options.push_back (std::pair<std::string, std::string> (cfg_edit_text_valign, "bottom"));
|
||||
}
|
||||
|
||||
#if defined(HAVE_QT)
|
||||
static
|
||||
void get_text_editor_options_pages (std::vector<lay::EditorOptionsPage *> &ret, lay::LayoutView *view, lay::Dispatcher *dispatcher)
|
||||
void get_text_editor_options_pages (std::vector<lay::EditorOptionsPage *> &ret, lay::LayoutViewBase *view, lay::Dispatcher *dispatcher)
|
||||
{
|
||||
static edt::RecentConfigurationPage::ConfigurationDescriptor text_cfg_descriptors[] =
|
||||
{
|
||||
|
|
@ -77,6 +91,9 @@ void get_text_editor_options_pages (std::vector<lay::EditorOptionsPage *> &ret,
|
|||
&text_cfg_descriptors[0], &text_cfg_descriptors[sizeof (text_cfg_descriptors) / sizeof (text_cfg_descriptors[0])]));
|
||||
ret.push_back (new edt::EditorOptionsText (view, dispatcher));
|
||||
}
|
||||
#else
|
||||
static void get_text_editor_options_pages () { }
|
||||
#endif
|
||||
|
||||
static
|
||||
void get_path_options (std::vector < std::pair<std::string, std::string> > &options)
|
||||
|
|
@ -87,8 +104,9 @@ void get_path_options (std::vector < std::pair<std::string, std::string> > &opti
|
|||
options.push_back (std::pair<std::string, std::string> (cfg_edit_path_ext_var_end, "0.0"));
|
||||
}
|
||||
|
||||
#if defined(HAVE_QT)
|
||||
static
|
||||
void get_path_editor_options_pages (std::vector<lay::EditorOptionsPage *> &ret, lay::LayoutView *view, lay::Dispatcher *dispatcher)
|
||||
void get_path_editor_options_pages (std::vector<lay::EditorOptionsPage *> &ret, lay::LayoutViewBase *view, lay::Dispatcher *dispatcher)
|
||||
{
|
||||
static edt::RecentConfigurationPage::ConfigurationDescriptor path_cfg_descriptors[] =
|
||||
{
|
||||
|
|
@ -103,6 +121,9 @@ void get_path_editor_options_pages (std::vector<lay::EditorOptionsPage *> &ret,
|
|||
&path_cfg_descriptors[0], &path_cfg_descriptors[sizeof (path_cfg_descriptors) / sizeof (path_cfg_descriptors[0])]));
|
||||
ret.push_back (new EditorOptionsPath (view, dispatcher));
|
||||
}
|
||||
#else
|
||||
static void get_path_editor_options_pages () { }
|
||||
#endif
|
||||
|
||||
static
|
||||
void get_inst_options (std::vector < std::pair<std::string, std::string> > &options)
|
||||
|
|
@ -123,8 +144,9 @@ void get_inst_options (std::vector < std::pair<std::string, std::string> > &opti
|
|||
options.push_back (std::pair<std::string, std::string> (cfg_edit_show_shapes_of_instances, "true"));
|
||||
}
|
||||
|
||||
#if defined(HAVE_QT)
|
||||
static
|
||||
void get_inst_editor_options_pages (std::vector<lay::EditorOptionsPage *> &ret, lay::LayoutView *view, lay::Dispatcher *dispatcher)
|
||||
void get_inst_editor_options_pages (std::vector<lay::EditorOptionsPage *> &ret, lay::LayoutViewBase *view, lay::Dispatcher *dispatcher)
|
||||
{
|
||||
static edt::RecentConfigurationPage::ConfigurationDescriptor inst_cfg_descriptors[] =
|
||||
{
|
||||
|
|
@ -148,19 +170,32 @@ void get_inst_editor_options_pages (std::vector<lay::EditorOptionsPage *> &ret,
|
|||
ret.push_back (new EditorOptionsInstPCellParam (view, dispatcher));
|
||||
ret.push_back (new EditorOptionsInst (view, dispatcher));
|
||||
}
|
||||
#else
|
||||
static void get_inst_editor_options_pages () { }
|
||||
#endif
|
||||
|
||||
template <class Svc>
|
||||
class PluginDeclaration
|
||||
: public PluginDeclarationBase
|
||||
{
|
||||
public:
|
||||
#if defined(HAVE_QT)
|
||||
PluginDeclaration (const std::string &title, const std::string &mouse_mode,
|
||||
void (*option_get_f) (std::vector < std::pair<std::string, std::string> > &) = 0,
|
||||
void (*pages_f) (std::vector <lay::EditorOptionsPage *> &, lay::LayoutView *, lay::Dispatcher *) = 0)
|
||||
void (*pages_f) (std::vector <lay::EditorOptionsPage *> &, lay::LayoutViewBase *, lay::Dispatcher *) = 0)
|
||||
: m_title (title), m_mouse_mode (mouse_mode), mp_option_get_f (option_get_f), mp_pages_f (pages_f)
|
||||
{
|
||||
// .. nothing yet ..
|
||||
}
|
||||
#else
|
||||
PluginDeclaration (const std::string &title, const std::string &mouse_mode,
|
||||
void (*option_get_f) (std::vector < std::pair<std::string, std::string> > &) = 0,
|
||||
void (*pages_f) () = 0)
|
||||
: m_title (title), m_mouse_mode (mouse_mode), mp_option_get_f (option_get_f), mp_pages_f (pages_f)
|
||||
{
|
||||
// .. nothing yet ..
|
||||
}
|
||||
#endif
|
||||
|
||||
virtual void get_options (std::vector < std::pair<std::string, std::string> > &options) const
|
||||
{
|
||||
|
|
@ -169,17 +204,20 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
#if defined(HAVE_QT)
|
||||
virtual lay::ConfigPage *config_page (QWidget * /*parent*/, std::string & /*title*/) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
virtual void get_menu_entries (std::vector<lay::MenuEntry> & /*menu_entries*/) const
|
||||
{
|
||||
// .. nothing yet ..
|
||||
}
|
||||
|
||||
virtual void get_editor_options_pages (std::vector<lay::EditorOptionsPage *> &pages, lay::LayoutView *view, lay::Dispatcher *root) const
|
||||
#if defined(HAVE_QT)
|
||||
virtual void get_editor_options_pages (std::vector<lay::EditorOptionsPage *> &pages, lay::LayoutViewBase *view, lay::Dispatcher *root) const
|
||||
{
|
||||
if (mp_pages_f != 0) {
|
||||
size_t nstart = pages.size ();
|
||||
|
|
@ -189,8 +227,9 @@ public:
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
virtual lay::Plugin *create_plugin (db::Manager *manager, lay::Dispatcher *, lay::LayoutView *view) const
|
||||
virtual lay::Plugin *create_plugin (db::Manager *manager, lay::Dispatcher *, lay::LayoutViewBase *view) const
|
||||
{
|
||||
Svc *service = new Svc (manager, view);
|
||||
service->set_plugin_declaration (this);
|
||||
|
|
@ -214,31 +253,35 @@ private:
|
|||
std::string m_mouse_mode;
|
||||
|
||||
void (*mp_option_get_f) (std::vector < std::pair<std::string, std::string> > &options);
|
||||
void (*mp_pages_f) (std::vector <lay::EditorOptionsPage *> &, lay::LayoutView *, lay::Dispatcher *);
|
||||
#if defined(HAVE_QT)
|
||||
void (*mp_pages_f) (std::vector <lay::EditorOptionsPage *> &, lay::LayoutViewBase *, lay::Dispatcher *);
|
||||
#else
|
||||
void (*mp_pages_f) ();
|
||||
#endif
|
||||
};
|
||||
|
||||
static tl::RegisteredClass<lay::PluginDeclaration> config_decl1 (
|
||||
new edt::PluginDeclaration<edt::PolygonService> (tl::to_string (QObject::tr ("Polygons")), "polygon:edit_mode\t" + tl::to_string (QObject::tr ("Polygon")) + "<:polygon.png>" + tl::to_string (QObject::tr ("{Create a polygon}")), 0, &get_shape_editor_options_pages),
|
||||
new edt::PluginDeclaration<edt::PolygonService> (tl::to_string (tr ("Polygons")), "polygon:edit_mode\t" + tl::to_string (tr ("Polygon")) + "<:polygon.png>" + tl::to_string (tr ("{Create a polygon}")), 0, &get_shape_editor_options_pages),
|
||||
4010,
|
||||
"edt::Service(Polygons)"
|
||||
);
|
||||
static tl::RegisteredClass<lay::PluginDeclaration> config_decl2 (
|
||||
new edt::PluginDeclaration<edt::BoxService> (tl::to_string (QObject::tr ("Boxes")), "box:edit_mode\t" + tl::to_string (QObject::tr ("Box")) + "\t<:box.png>" + tl::to_string (QObject::tr ("{Create a box}")), 0, &get_shape_editor_options_pages),
|
||||
new edt::PluginDeclaration<edt::BoxService> (tl::to_string (tr ("Boxes")), "box:edit_mode\t" + tl::to_string (tr ("Box")) + "\t<:box.png>" + tl::to_string (tr ("{Create a box}")), 0, &get_shape_editor_options_pages),
|
||||
4011,
|
||||
"edt::Service(Boxes)"
|
||||
);
|
||||
static tl::RegisteredClass<lay::PluginDeclaration> config_decl3 (
|
||||
new edt::PluginDeclaration<edt::TextService> (tl::to_string (QObject::tr ("Texts")), "text:edit_mode\t" + tl::to_string (QObject::tr ("Text")) + "\t<:text.png>" + tl::to_string (QObject::tr ("{Create a text object}")), &get_text_options, &get_text_editor_options_pages),
|
||||
new edt::PluginDeclaration<edt::TextService> (tl::to_string (tr ("Texts")), "text:edit_mode\t" + tl::to_string (tr ("Text")) + "\t<:text.png>" + tl::to_string (tr ("{Create a text object}")), &get_text_options, &get_text_editor_options_pages),
|
||||
4012,
|
||||
"edt::Service(Texts)"
|
||||
);
|
||||
static tl::RegisteredClass<lay::PluginDeclaration> config_decl4 (
|
||||
new edt::PluginDeclaration<edt::PathService> (tl::to_string (QObject::tr ("Paths")), "path:edit_mode\t" + tl::to_string (QObject::tr ("Path")) + "\t<:path.png>" + tl::to_string (QObject::tr ("{Create a path}")), &get_path_options, &get_path_editor_options_pages),
|
||||
new edt::PluginDeclaration<edt::PathService> (tl::to_string (tr ("Paths")), "path:edit_mode\t" + tl::to_string (tr ("Path")) + "\t<:path.png>" + tl::to_string (tr ("{Create a path}")), &get_path_options, &get_path_editor_options_pages),
|
||||
4013,
|
||||
"edt::Service(Paths)"
|
||||
);
|
||||
static tl::RegisteredClass<lay::PluginDeclaration> config_decl5 (
|
||||
new edt::PluginDeclaration<edt::InstService> (tl::to_string (QObject::tr ("Instances")), "instance:edit_mode\t" + tl::to_string (QObject::tr ("Instance")) + "\t<:instance.png>" + tl::to_string (QObject::tr ("{Create a cell instance}")), &get_inst_options, &get_inst_editor_options_pages),
|
||||
new edt::PluginDeclaration<edt::InstService> (tl::to_string (tr ("Instances")), "instance:edit_mode\t" + tl::to_string (tr ("Instance")) + "\t<:instance.png>" + tl::to_string (tr ("{Create a cell instance}")), &get_inst_options, &get_inst_editor_options_pages),
|
||||
4020,
|
||||
"edt::Service(CellInstances)"
|
||||
);
|
||||
|
|
@ -264,41 +307,43 @@ public:
|
|||
options.push_back (std::pair<std::string, std::string> (cfg_edit_combine_mode, "add"));
|
||||
}
|
||||
|
||||
#if defined(HAVE_QT)
|
||||
virtual lay::ConfigPage *config_page (QWidget * /*parent*/, std::string & /*title*/) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
virtual void get_menu_entries (std::vector<lay::MenuEntry> &menu_entries) const
|
||||
{
|
||||
lay::PluginDeclaration::get_menu_entries (menu_entries);
|
||||
|
||||
menu_entries.push_back (lay::separator ("edt::hier_group", "zoom_menu.end"));
|
||||
menu_entries.push_back (lay::menu_item ("edt::descend", "descend", "zoom_menu.end", tl::to_string (QObject::tr ("Descend")) + "(Ctrl+D)"));
|
||||
menu_entries.push_back (lay::menu_item ("edt::ascend", "ascend", "zoom_menu.end", tl::to_string (QObject::tr ("Ascend")) + "(Ctrl+A)"));
|
||||
menu_entries.push_back (lay::menu_item ("edt::descend", "descend", "zoom_menu.end", tl::to_string (tr ("Descend")) + "(Ctrl+D)"));
|
||||
menu_entries.push_back (lay::menu_item ("edt::ascend", "ascend", "zoom_menu.end", tl::to_string (tr ("Ascend")) + "(Ctrl+A)"));
|
||||
|
||||
menu_entries.push_back (lay::menu_item ("edt::sel_make_array", "make_array:edit_mode", "edit_menu.selection_menu.end", tl::to_string (QObject::tr ("Make Array"))));
|
||||
menu_entries.push_back (lay::menu_item ("edt::sel_make_array", "make_array:edit_mode", "edit_menu.selection_menu.end", tl::to_string (tr ("Make Array"))));
|
||||
menu_entries.push_back (lay::separator ("selection_group:edit_mode", "edit_menu.selection_menu.end"));
|
||||
menu_entries.push_back (lay::menu_item ("edt::sel_change_layer", "change_layer:edit_mode", "edit_menu.selection_menu.end", tl::to_string (QObject::tr ("Change Layer"))));
|
||||
menu_entries.push_back (lay::menu_item ("edt::sel_tap", "tap", "edit_menu.selection_menu.end", tl::to_string (QObject::tr ("Tap")) + "(T)"));
|
||||
menu_entries.push_back (lay::menu_item ("edt::sel_align", "align:edit_mode", "edit_menu.selection_menu.end", tl::to_string (QObject::tr ("Align"))));
|
||||
menu_entries.push_back (lay::menu_item ("edt::sel_distribute", "distribute:edit_mode", "edit_menu.selection_menu.end", tl::to_string (QObject::tr ("Distribute"))));
|
||||
menu_entries.push_back (lay::menu_item ("edt::sel_round_corners", "round_corners:edit_mode", "edit_menu.selection_menu.end", tl::to_string (QObject::tr ("Round Corners"))));
|
||||
menu_entries.push_back (lay::menu_item ("edt::sel_size", "size:edit_mode", "edit_menu.selection_menu.end", tl::to_string (QObject::tr ("Size Shapes"))));
|
||||
menu_entries.push_back (lay::menu_item ("edt::sel_union", "union:edit_mode", "edit_menu.selection_menu.end", tl::to_string (QObject::tr ("Merge Shapes"))));
|
||||
menu_entries.push_back (lay::menu_item ("edt::sel_intersection", "intersection:edit_mode", "edit_menu.selection_menu.end", tl::to_string (QObject::tr ("Intersection - Others With First"))));
|
||||
menu_entries.push_back (lay::menu_item ("edt::sel_difference", "difference:edit_mode", "edit_menu.selection_menu.end", tl::to_string (QObject::tr ("Subtraction - Others From First"))));
|
||||
menu_entries.push_back (lay::menu_item ("edt::sel_separate", "separate:edit_mode", "edit_menu.selection_menu.end", tl::to_string (QObject::tr ("Separate - First into Inside/Outside Others"))));
|
||||
menu_entries.push_back (lay::menu_item ("edt::sel_change_layer", "change_layer:edit_mode", "edit_menu.selection_menu.end", tl::to_string (tr ("Change Layer"))));
|
||||
menu_entries.push_back (lay::menu_item ("edt::sel_tap", "tap", "edit_menu.selection_menu.end", tl::to_string (tr ("Tap")) + "(T)"));
|
||||
menu_entries.push_back (lay::menu_item ("edt::sel_align", "align:edit_mode", "edit_menu.selection_menu.end", tl::to_string (tr ("Align"))));
|
||||
menu_entries.push_back (lay::menu_item ("edt::sel_distribute", "distribute:edit_mode", "edit_menu.selection_menu.end", tl::to_string (tr ("Distribute"))));
|
||||
menu_entries.push_back (lay::menu_item ("edt::sel_round_corners", "round_corners:edit_mode", "edit_menu.selection_menu.end", tl::to_string (tr ("Round Corners"))));
|
||||
menu_entries.push_back (lay::menu_item ("edt::sel_size", "size:edit_mode", "edit_menu.selection_menu.end", tl::to_string (tr ("Size Shapes"))));
|
||||
menu_entries.push_back (lay::menu_item ("edt::sel_union", "union:edit_mode", "edit_menu.selection_menu.end", tl::to_string (tr ("Merge Shapes"))));
|
||||
menu_entries.push_back (lay::menu_item ("edt::sel_intersection", "intersection:edit_mode", "edit_menu.selection_menu.end", tl::to_string (tr ("Intersection - Others With First"))));
|
||||
menu_entries.push_back (lay::menu_item ("edt::sel_difference", "difference:edit_mode", "edit_menu.selection_menu.end", tl::to_string (tr ("Subtraction - Others From First"))));
|
||||
menu_entries.push_back (lay::menu_item ("edt::sel_separate", "separate:edit_mode", "edit_menu.selection_menu.end", tl::to_string (tr ("Separate - First into Inside/Outside Others"))));
|
||||
menu_entries.push_back (lay::separator ("hier_group:edit_mode", "edit_menu.selection_menu.end"));
|
||||
menu_entries.push_back (lay::menu_item ("edt::sel_flatten_insts", "flatten_insts:edit_mode", "edit_menu.selection_menu.end", tl::to_string (QObject::tr ("Flatten Instances"))));
|
||||
menu_entries.push_back (lay::menu_item ("edt::sel_resolve_arefs", "resolve_arefs:edit_mode", "edit_menu.selection_menu.end", tl::to_string (QObject::tr ("Resolve Arrays"))));
|
||||
menu_entries.push_back (lay::menu_item ("edt::sel_move_hier_up", "move_hier_up:edit_mode", "edit_menu.selection_menu.end", tl::to_string (QObject::tr ("Move Up In Hierarchy"))));
|
||||
menu_entries.push_back (lay::menu_item ("edt::sel_make_cell", "make_cell:edit_mode", "edit_menu.selection_menu.end", tl::to_string (QObject::tr ("Make Cell"))));
|
||||
menu_entries.push_back (lay::menu_item ("edt::sel_make_cell_variants", "make_cell_variants:edit_mode", "edit_menu.selection_menu.end", tl::to_string (QObject::tr ("Make Cell Variants"))));
|
||||
menu_entries.push_back (lay::menu_item ("edt::sel_convert_to_pcell", "convert_to_pcell:edit_mode", "edit_menu.selection_menu.end", tl::to_string (QObject::tr ("Convert To PCell"))));
|
||||
menu_entries.push_back (lay::menu_item ("edt::sel_convert_to_cell", "convert_to_cell:edit_mode", "edit_menu.selection_menu.end", tl::to_string (QObject::tr ("Convert To Static Cell"))));
|
||||
menu_entries.push_back (lay::menu_item ("edt::sel_flatten_insts", "flatten_insts:edit_mode", "edit_menu.selection_menu.end", tl::to_string (tr ("Flatten Instances"))));
|
||||
menu_entries.push_back (lay::menu_item ("edt::sel_resolve_arefs", "resolve_arefs:edit_mode", "edit_menu.selection_menu.end", tl::to_string (tr ("Resolve Arrays"))));
|
||||
menu_entries.push_back (lay::menu_item ("edt::sel_move_hier_up", "move_hier_up:edit_mode", "edit_menu.selection_menu.end", tl::to_string (tr ("Move Up In Hierarchy"))));
|
||||
menu_entries.push_back (lay::menu_item ("edt::sel_make_cell", "make_cell:edit_mode", "edit_menu.selection_menu.end", tl::to_string (tr ("Make Cell"))));
|
||||
menu_entries.push_back (lay::menu_item ("edt::sel_make_cell_variants", "make_cell_variants:edit_mode", "edit_menu.selection_menu.end", tl::to_string (tr ("Make Cell Variants"))));
|
||||
menu_entries.push_back (lay::menu_item ("edt::sel_convert_to_pcell", "convert_to_pcell:edit_mode", "edit_menu.selection_menu.end", tl::to_string (tr ("Convert To PCell"))));
|
||||
menu_entries.push_back (lay::menu_item ("edt::sel_convert_to_cell", "convert_to_cell:edit_mode", "edit_menu.selection_menu.end", tl::to_string (tr ("Convert To Static Cell"))));
|
||||
|
||||
menu_entries.push_back (lay::menu_item ("edt::combine_mode", "combine_mode:edit_mode", "@toolbar.end_modes", tl::to_string (QObject::tr ("Combine{Select background combination mode}"))));
|
||||
menu_entries.push_back (lay::menu_item ("edt::combine_mode", "combine_mode:edit_mode", "@toolbar.end_modes", tl::to_string (tr ("Combine{Select background combination mode}"))));
|
||||
}
|
||||
|
||||
bool configure (const std::string &name, const std::string &value)
|
||||
|
|
@ -312,7 +357,7 @@ public:
|
|||
return false;
|
||||
}
|
||||
|
||||
virtual lay::Plugin *create_plugin (db::Manager *manager, lay::Dispatcher *root, lay::LayoutView *view) const
|
||||
virtual lay::Plugin *create_plugin (db::Manager *manager, lay::Dispatcher *root, lay::LayoutViewBase *view) const
|
||||
{
|
||||
return new edt::MainService (manager, view, root);
|
||||
}
|
||||
|
|
@ -327,12 +372,14 @@ public:
|
|||
return false;
|
||||
}
|
||||
|
||||
virtual void get_editor_options_pages (std::vector<lay::EditorOptionsPage *> &pages, lay::LayoutView *view, lay::Dispatcher *dispatcher) const
|
||||
#if defined(HAVE_QT)
|
||||
virtual void get_editor_options_pages (std::vector<lay::EditorOptionsPage *> &pages, lay::LayoutViewBase *view, lay::Dispatcher *dispatcher) const
|
||||
{
|
||||
// NOTE: we do not set plugin_declaration which makes the page unspecific
|
||||
EditorOptionsGeneric *generic_opt = new EditorOptionsGeneric (view, dispatcher);
|
||||
pages.push_back (generic_opt);
|
||||
}
|
||||
#endif
|
||||
|
||||
virtual void initialize (lay::Dispatcher *root)
|
||||
{
|
||||
|
|
@ -343,18 +390,21 @@ public:
|
|||
|
||||
mp_root = root;
|
||||
|
||||
#if defined(HAVE_QT)
|
||||
// add entries to the combine mode dialog
|
||||
mp->menu ()->insert_item ("@toolbar.combine_mode.end", "combine_mode_add", new lay::ConfigureAction (tl::to_string (QObject::tr ("Add<:/cm_add.png>{Add shapes}")), cfg_edit_combine_mode, CMConverter ().to_string (CM_Add)));
|
||||
mp->menu ()->insert_item ("@toolbar.combine_mode.end", "combine_mode_merge", new lay::ConfigureAction (tl::to_string (QObject::tr ("Merge<:/cm_merge.png>{Merge shapes with background}")), cfg_edit_combine_mode, CMConverter ().to_string (CM_Merge)));
|
||||
mp->menu ()->insert_item ("@toolbar.combine_mode.end", "combine_mode_erase", new lay::ConfigureAction (tl::to_string (QObject::tr ("Erase<:/cm_erase.png>{Erase shape from background}")), cfg_edit_combine_mode, CMConverter ().to_string (CM_Erase)));
|
||||
mp->menu ()->insert_item ("@toolbar.combine_mode.end", "combine_mode_mask", new lay::ConfigureAction (tl::to_string (QObject::tr ("Mask<:/cm_mask.png>{Mask background with shape}")), cfg_edit_combine_mode, CMConverter ().to_string (CM_Mask)));
|
||||
mp->menu ()->insert_item ("@toolbar.combine_mode.end", "combine_mode_diff", new lay::ConfigureAction (tl::to_string (QObject::tr ("Diff<:/cm_diff.png>{Compute difference of shape with background}")), cfg_edit_combine_mode, CMConverter ().to_string (CM_Diff)));
|
||||
mp->menu ()->insert_item ("@toolbar.combine_mode.end", "combine_mode_add", new lay::ConfigureAction (tl::to_string (tr ("Add<:/cm_add.png>{Add shapes}")), cfg_edit_combine_mode, CMConverter ().to_string (CM_Add)));
|
||||
mp->menu ()->insert_item ("@toolbar.combine_mode.end", "combine_mode_merge", new lay::ConfigureAction (tl::to_string (tr ("Merge<:/cm_merge.png>{Merge shapes with background}")), cfg_edit_combine_mode, CMConverter ().to_string (CM_Merge)));
|
||||
mp->menu ()->insert_item ("@toolbar.combine_mode.end", "combine_mode_erase", new lay::ConfigureAction (tl::to_string (tr ("Erase<:/cm_erase.png>{Erase shape from background}")), cfg_edit_combine_mode, CMConverter ().to_string (CM_Erase)));
|
||||
mp->menu ()->insert_item ("@toolbar.combine_mode.end", "combine_mode_mask", new lay::ConfigureAction (tl::to_string (tr ("Mask<:/cm_mask.png>{Mask background with shape}")), cfg_edit_combine_mode, CMConverter ().to_string (CM_Mask)));
|
||||
mp->menu ()->insert_item ("@toolbar.combine_mode.end", "combine_mode_diff", new lay::ConfigureAction (tl::to_string (tr ("Diff<:/cm_diff.png>{Compute difference of shape with background}")), cfg_edit_combine_mode, CMConverter ().to_string (CM_Diff)));
|
||||
|
||||
update_menu (CM_Add);
|
||||
#endif
|
||||
}
|
||||
|
||||
void update_menu (combine_mode_type cm)
|
||||
{
|
||||
#if defined(HAVE_QT)
|
||||
lay::Dispatcher *mp = lay::Dispatcher::instance ();
|
||||
if (! mp || ! mp->has_ui ()) {
|
||||
return;
|
||||
|
|
@ -363,21 +413,22 @@ public:
|
|||
lay::Action *combine_menu = mp->menu ()->action ("@toolbar.combine_mode");
|
||||
|
||||
if (cm == CM_Add) {
|
||||
combine_menu->set_title (tl::to_string (QObject::tr ("Add")));
|
||||
combine_menu->set_title (tl::to_string (tr ("Add")));
|
||||
combine_menu->set_icon (":/cm_add.png");
|
||||
} else if (cm == CM_Merge) {
|
||||
combine_menu->set_title (tl::to_string (QObject::tr ("Merge")));
|
||||
combine_menu->set_title (tl::to_string (tr ("Merge")));
|
||||
combine_menu->set_icon (":/cm_merge.png");
|
||||
} else if (cm == CM_Erase) {
|
||||
combine_menu->set_title (tl::to_string (QObject::tr ("Erase")));
|
||||
combine_menu->set_title (tl::to_string (tr ("Erase")));
|
||||
combine_menu->set_icon (":/cm_erase.png");
|
||||
} else if (cm == CM_Mask) {
|
||||
combine_menu->set_title (tl::to_string (QObject::tr ("Mask")));
|
||||
combine_menu->set_title (tl::to_string (tr ("Mask")));
|
||||
combine_menu->set_icon (":/cm_mask.png");
|
||||
} else if (cm == CM_Diff) {
|
||||
combine_menu->set_title (tl::to_string (QObject::tr ("Diff")));
|
||||
combine_menu->set_title (tl::to_string (tr ("Diff")));
|
||||
combine_menu->set_icon (":/cm_diff.png");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void initialized (lay::Dispatcher *root)
|
||||
|
|
@ -387,22 +438,27 @@ public:
|
|||
return;
|
||||
}
|
||||
|
||||
lay::Action *combine_menu = mp->menu ()->action ("@toolbar.combine_mode");
|
||||
#if defined(HAVE_QT)
|
||||
|
||||
// Do some more initialization here.
|
||||
// generate a warning if the combine mode isn't "Add"
|
||||
|
||||
combine_mode_type cm = CM_Add;
|
||||
root->config_get (cfg_edit_combine_mode, cm, CMConverter ());
|
||||
|
||||
lay::Action *combine_menu = mp->menu ()->action ("@toolbar.combine_mode");
|
||||
|
||||
if (cm != CM_Add && combine_menu->is_visible ()) {
|
||||
lay::TipDialog td (QApplication::activeWindow (),
|
||||
tl::to_string (QObject::tr ("The background combination mode of the shape editor is set to some other mode than 'Add'.\n"
|
||||
"This can be confusing, because a shape may not be drawn as expected.\n\nTo switch back to normal mode, choose 'Add' for the background combination mode in the toolbar.")),
|
||||
tl::to_string (tr ("The background combination mode of the shape editor is set to some other mode than 'Add'.\n"
|
||||
"This can be confusing, because a shape may not be drawn as expected.\n\nTo switch back to normal mode, choose 'Add' for the background combination mode in the toolbar.")),
|
||||
"has-non-add-edit-combine-mode");
|
||||
if (td.exec_dialog ()) {
|
||||
// Don't bother the user with more dialogs.
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
@ -410,12 +466,13 @@ private:
|
|||
std::string m_title;
|
||||
};
|
||||
|
||||
static tl::RegisteredClass<lay::PluginDeclaration> config_decl_main (new edt::MainPluginDeclaration (tl::to_string (QObject::tr ("Instances and shapes"))), 4000, "edt::MainService");
|
||||
static tl::RegisteredClass<lay::PluginDeclaration> config_decl_main (new edt::MainPluginDeclaration (tl::to_string (tr ("Instances and shapes"))), 4000, "edt::MainService");
|
||||
|
||||
void
|
||||
commit_recent (lay::LayoutView *view)
|
||||
commit_recent (lay::LayoutViewBase *view)
|
||||
{
|
||||
lay::EditorOptionsPages *eo_pages = view->editor_options_pages ();;
|
||||
#if defined(HAVE_QT)
|
||||
lay::EditorOptionsPages *eo_pages = view->editor_options_pages ();
|
||||
if (!eo_pages) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -425,6 +482,7 @@ commit_recent (lay::LayoutView *view)
|
|||
(*op)->commit_recent (view);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
class PartialPluginDeclaration
|
||||
|
|
@ -442,12 +500,12 @@ public:
|
|||
// .. nothing yet ..
|
||||
}
|
||||
|
||||
virtual void get_editor_options_pages (std::vector<lay::EditorOptionsPage *> & /*pages*/, lay::LayoutView * /*view*/, lay::Dispatcher * /*root*/) const
|
||||
virtual void get_editor_options_pages (std::vector<lay::EditorOptionsPage *> & /*pages*/, lay::LayoutViewBase * /*view*/, lay::Dispatcher * /*root*/) const
|
||||
{
|
||||
// .. no specific ones ..
|
||||
}
|
||||
|
||||
virtual lay::Plugin *create_plugin (db::Manager *manager, lay::Dispatcher *root, lay::LayoutView *view) const
|
||||
virtual lay::Plugin *create_plugin (db::Manager *manager, lay::Dispatcher *root, lay::LayoutViewBase *view) const
|
||||
{
|
||||
return new edt::PartialService (manager, view, root);
|
||||
}
|
||||
|
|
@ -470,7 +528,7 @@ private:
|
|||
};
|
||||
|
||||
static tl::RegisteredClass<lay::PluginDeclaration> config_decl30 (
|
||||
new edt::PartialPluginDeclaration (tl::to_string (QObject::tr ("Partial shapes")), "partial:edit_mode\t" + tl::to_string (QObject::tr ("Partial{Edit points and edges of shapes}")) + "<:partial.png>"),
|
||||
new edt::PartialPluginDeclaration (tl::to_string (tr ("Partial shapes")), "partial:edit_mode\t" + tl::to_string (tr ("Partial{Edit points and edges of shapes}")) + "<:partial.png>"),
|
||||
4030,
|
||||
"edt::PartialService"
|
||||
);
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ namespace lay
|
|||
{
|
||||
class Dispatcher;
|
||||
class EditorOptionsPage;
|
||||
class LayoutViewBase;
|
||||
}
|
||||
|
||||
namespace edt
|
||||
|
|
@ -48,7 +49,7 @@ namespace edt
|
|||
/**
|
||||
* @brief Commits the current configuration for the recently used configuration list
|
||||
*/
|
||||
void commit_recent (lay::LayoutView *view);
|
||||
void commit_recent (lay::LayoutViewBase *view);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
*/
|
||||
|
||||
#if defined(HAVE_QT)
|
||||
|
||||
#include "edtPropertiesPageUtils.h"
|
||||
|
||||
|
|
@ -870,3 +871,4 @@ coords_to_string (const db::DPoint &dp, double dbu, bool du, const char *sep)
|
|||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
*/
|
||||
|
||||
#if defined(HAVE_QT)
|
||||
|
||||
#ifndef HDR_edtPropertiesPageUtils
|
||||
#define HDR_edtPropertiesPageUtils
|
||||
|
|
@ -522,3 +523,4 @@ db::Coord coord_from_string (const char *txt, double dbu, bool du, const db::VCp
|
|||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
*/
|
||||
|
||||
#if defined(HAVE_QT)
|
||||
|
||||
#include "edtPropertiesPages.h"
|
||||
#include "edtPropertiesPageUtils.h"
|
||||
|
|
@ -27,7 +28,7 @@
|
|||
#include "edtPropertiesPageUtils.h"
|
||||
#include "layDialogs.h"
|
||||
#include "layObjectInstPath.h"
|
||||
#include "layLayoutView.h"
|
||||
#include "layLayoutViewBase.h"
|
||||
#include "layQtTools.h"
|
||||
#include "tlExceptions.h"
|
||||
#include "tlString.h"
|
||||
|
|
@ -1183,3 +1184,4 @@ EditablePathPropertiesPage::type_selected (int t)
|
|||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
*/
|
||||
|
||||
#if defined(HAVE_QT)
|
||||
|
||||
|
||||
#ifndef HDR_edtPropertiesPages
|
||||
|
|
@ -207,3 +208,5 @@ private:
|
|||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -20,10 +20,12 @@
|
|||
|
||||
*/
|
||||
|
||||
#if defined(HAVE_QT)
|
||||
|
||||
#include "edtRecentConfigurationPage.h"
|
||||
#include "edtUtils.h"
|
||||
#include "layDispatcher.h"
|
||||
#include "layLayoutView.h"
|
||||
#include "layLayoutViewBase.h"
|
||||
#include "layLayerTreeModel.h"
|
||||
#include "dbLibraryManager.h"
|
||||
#include "dbLibrary.h"
|
||||
|
|
@ -32,6 +34,7 @@
|
|||
#include <QVBoxLayout>
|
||||
#include <QHeaderView>
|
||||
#include <QLabel>
|
||||
#include <QMessageBox>
|
||||
|
||||
namespace edt
|
||||
{
|
||||
|
|
@ -131,7 +134,7 @@ RecentConfigurationPage::set_stored_values (const std::list<std::vector<std::str
|
|||
}
|
||||
|
||||
static lay::LayerPropertiesConstIterator
|
||||
lp_iter_from_string (lay::LayoutView *view, const std::string &s)
|
||||
lp_iter_from_string (lay::LayoutViewBase *view, const std::string &s)
|
||||
{
|
||||
// parse the layer spec (<layer-props>[@<cv-index>])
|
||||
db::LayerProperties lp;
|
||||
|
|
@ -179,7 +182,7 @@ RecentConfigurationPage::render_to (QTreeWidgetItem *item, int column, const std
|
|||
|
||||
case RecentConfigurationPage::Layer:
|
||||
{
|
||||
int icon_size = view ()->style ()->pixelMetric (QStyle::PM_ButtonIconSize);
|
||||
int icon_size = view ()->widget ()->style ()->pixelMetric (QStyle::PM_ButtonIconSize);
|
||||
lay::LayerPropertiesConstIterator l;
|
||||
try {
|
||||
l = lp_iter_from_string (view (), values [column]);
|
||||
|
|
@ -344,6 +347,40 @@ RecentConfigurationPage::update_list (const std::list<std::vector<std::string> >
|
|||
mp_tree_widget->header ()->resizeSections (QHeaderView::ResizeToContents);
|
||||
}
|
||||
|
||||
static bool
|
||||
set_or_request_current_layer (lay::LayoutViewBase *view, unsigned int cv_index, const db::LayerProperties &lp)
|
||||
{
|
||||
bool ok = view->set_current_layer (cv_index, lp);
|
||||
if (ok) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (! view->control_panel ()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const lay::CellView &cv = view->cellview (cv_index);
|
||||
if (! cv.is_valid ()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (QMessageBox::question (view->widget (), tr ("Create Layer"), tr ("Layer %1 does not exist yet. Create it now?").arg (tl::to_qstring (lp.to_string ()))) == QMessageBox::Yes) {
|
||||
|
||||
lay::LayerPropertiesNode lpn;
|
||||
lpn.set_source (lay::ParsedLayerSource (lp, cv_index));
|
||||
view->init_layer_properties (lpn);
|
||||
|
||||
view->transaction (tl::to_string (QObject::tr ("Create new layer")));
|
||||
view->set_current_layer (lay::LayerPropertiesConstIterator (& view->insert_layer (view->end_layers (), lpn)));
|
||||
view->commit ();
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
RecentConfigurationPage::item_clicked (QTreeWidgetItem *item)
|
||||
{
|
||||
|
|
@ -363,7 +400,7 @@ RecentConfigurationPage::item_clicked (QTreeWidgetItem *item)
|
|||
ex.read (cv_index);
|
||||
}
|
||||
|
||||
view ()->set_or_request_current_layer (cv_index, lp);
|
||||
set_or_request_current_layer (view (), cv_index, lp);
|
||||
|
||||
} else {
|
||||
dispatcher ()->config_set (c->cfg_name, v);
|
||||
|
|
@ -428,3 +465,5 @@ RecentConfigurationPage::commit_recent (lay::Dispatcher *root)
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
*/
|
||||
|
||||
#if defined(HAVE_QT)
|
||||
|
||||
#ifndef HDR_edtRecentConfigurationPage
|
||||
#define HDR_edtRecentConfigurationPage
|
||||
|
|
@ -32,7 +33,7 @@
|
|||
|
||||
namespace lay
|
||||
{
|
||||
class LayoutView;
|
||||
class LayoutViewBase;
|
||||
}
|
||||
|
||||
namespace edt
|
||||
|
|
@ -77,7 +78,7 @@ public:
|
|||
};
|
||||
|
||||
template <class Iter>
|
||||
RecentConfigurationPage (lay::LayoutView *view, lay::Dispatcher *dispatcher, const std::string &recent_cfg_name, Iter begin_cfg, Iter end_cfg)
|
||||
RecentConfigurationPage (lay::LayoutViewBase *view, lay::Dispatcher *dispatcher, const std::string &recent_cfg_name, Iter begin_cfg, Iter end_cfg)
|
||||
: EditorOptionsPage (view, dispatcher), m_recent_cfg_name (recent_cfg_name), m_cfg (begin_cfg, end_cfg)
|
||||
{
|
||||
init ();
|
||||
|
|
@ -112,3 +113,4 @@ private:
|
|||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -26,10 +26,12 @@
|
|||
#include "dbLibrary.h"
|
||||
#include "edtPlugin.h"
|
||||
#include "edtService.h"
|
||||
#include "edtEditorOptionsPages.h"
|
||||
#include "edtDialogs.h"
|
||||
#if defined(HAVE_QT)
|
||||
# include "edtEditorOptionsPages.h"
|
||||
# include "edtDialogs.h"
|
||||
#endif
|
||||
#include "layFinder.h"
|
||||
#include "layLayoutView.h"
|
||||
#include "layLayoutViewBase.h"
|
||||
#include "laySnap.h"
|
||||
#include "tlProgress.h"
|
||||
#include "tlTimer.h"
|
||||
|
|
@ -60,7 +62,7 @@ ac_from_buttons (unsigned int buttons)
|
|||
|
||||
// -------------------------------------------------------------
|
||||
|
||||
Service::Service (db::Manager *manager, lay::LayoutView *view, db::ShapeIterator::flags_type flags)
|
||||
Service::Service (db::Manager *manager, lay::LayoutViewBase *view, db::ShapeIterator::flags_type flags)
|
||||
: lay::EditorServiceBase (view),
|
||||
db::Object (manager),
|
||||
mp_view (view),
|
||||
|
|
@ -80,7 +82,7 @@ Service::Service (db::Manager *manager, lay::LayoutView *view, db::ShapeIterator
|
|||
// .. nothing yet ..
|
||||
}
|
||||
|
||||
Service::Service (db::Manager *manager, lay::LayoutView *view)
|
||||
Service::Service (db::Manager *manager, lay::LayoutViewBase *view)
|
||||
: lay::EditorServiceBase (view),
|
||||
db::Object (manager),
|
||||
mp_view (view),
|
||||
|
|
@ -312,7 +314,8 @@ Service::copy ()
|
|||
void
|
||||
Service::copy_selected ()
|
||||
{
|
||||
edt::CopyModeDialog mode_dialog (view ());
|
||||
#if defined(HAVE_QT)
|
||||
edt::CopyModeDialog mode_dialog (view ()->widget ());
|
||||
|
||||
bool need_to_ask_for_copy_mode = false;
|
||||
unsigned int inst_mode = 0;
|
||||
|
|
@ -340,33 +343,49 @@ Service::copy_selected ()
|
|||
dispatcher ()->config_end ();
|
||||
}
|
||||
|
||||
// create one ClipboardData object per cv_index because, this one assumes that there is
|
||||
// only one source layout object.
|
||||
std::set <unsigned int> cv_indices;
|
||||
copy_selected (inst_mode);
|
||||
|
||||
}
|
||||
#else
|
||||
|
||||
unsigned int inst_mode = 0;
|
||||
if (m_hier_copy_mode >= 0) {
|
||||
inst_mode = int (m_hier_copy_mode);
|
||||
}
|
||||
|
||||
copy_selected (inst_mode);
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
Service::copy_selected (unsigned int inst_mode)
|
||||
{
|
||||
// create one ClipboardData object per cv_index because, this one assumes that there is
|
||||
// only one source layout object.
|
||||
std::set <unsigned int> cv_indices;
|
||||
for (objects::const_iterator r = m_selection.begin (); r != m_selection.end (); ++r) {
|
||||
cv_indices.insert (r->cv_index ());
|
||||
}
|
||||
|
||||
for (std::set <unsigned int>::const_iterator cvi = cv_indices.begin (); cvi != cv_indices.end (); ++cvi) {
|
||||
|
||||
db::ClipboardValue<edt::ClipboardData> *cd = new db::ClipboardValue<edt::ClipboardData> ();
|
||||
|
||||
// add the selected objects to the clipboard data objects.
|
||||
const lay::CellView &cv = view ()->cellview (*cvi);
|
||||
for (objects::const_iterator r = m_selection.begin (); r != m_selection.end (); ++r) {
|
||||
cv_indices.insert (r->cv_index ());
|
||||
}
|
||||
|
||||
for (std::set <unsigned int>::const_iterator cvi = cv_indices.begin (); cvi != cv_indices.end (); ++cvi) {
|
||||
|
||||
db::ClipboardValue<edt::ClipboardData> *cd = new db::ClipboardValue<edt::ClipboardData> ();
|
||||
|
||||
// add the selected objects to the clipboard data objects.
|
||||
const lay::CellView &cv = view ()->cellview (*cvi);
|
||||
for (objects::const_iterator r = m_selection.begin (); r != m_selection.end (); ++r) {
|
||||
if (r->cv_index () == *cvi) {
|
||||
if (! r->is_cell_inst ()) {
|
||||
cd->get ().add (cv->layout (), r->layer (), r->shape (), cv.context_trans () * r->trans ());
|
||||
} else {
|
||||
cd->get ().add (cv->layout (), r->back ().inst_ptr, inst_mode, cv.context_trans () * r->trans ());
|
||||
}
|
||||
if (r->cv_index () == *cvi) {
|
||||
if (! r->is_cell_inst ()) {
|
||||
cd->get ().add (cv->layout (), r->layer (), r->shape (), cv.context_trans () * r->trans ());
|
||||
} else {
|
||||
cd->get ().add (cv->layout (), r->back ().inst_ptr, inst_mode, cv.context_trans () * r->trans ());
|
||||
}
|
||||
}
|
||||
|
||||
db::Clipboard::instance () += cd;
|
||||
|
||||
}
|
||||
|
||||
db::Clipboard::instance () += cd;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -799,7 +818,7 @@ Service::mouse_click_event (const db::DPoint &p, unsigned int buttons, bool prio
|
|||
bool
|
||||
Service::key_event (unsigned int key, unsigned int buttons)
|
||||
{
|
||||
if (view ()->is_editable () && m_editing && buttons == 0 && key == Qt::Key_Backspace) {
|
||||
if (view ()->is_editable () && m_editing && buttons == 0 && key == lay::KeyBackspace) {
|
||||
do_delete ();
|
||||
return true;
|
||||
} else {
|
||||
|
|
@ -1141,7 +1160,7 @@ Service::display_status (bool transient)
|
|||
|
||||
std::string msg;
|
||||
if (! transient) {
|
||||
msg = tl::to_string (QObject::tr ("selected: "));
|
||||
msg = tl::to_string (tr ("selected: "));
|
||||
}
|
||||
|
||||
db::Instance inst = r->back ().inst_ptr;
|
||||
|
|
@ -1149,12 +1168,12 @@ Service::display_status (bool transient)
|
|||
db::Vector a, b;
|
||||
unsigned long amax = 0, bmax = 0;
|
||||
if (! inst.is_regular_array (a, b, amax, bmax)) {
|
||||
msg += tl::sprintf (tl::to_string (QObject::tr ("instance(\"%s\" %s)")), layout.display_name (inst.cell_index ()), inst.complex_trans ().to_string ());
|
||||
msg += tl::sprintf (tl::to_string (tr ("instance(\"%s\" %s)")), layout.display_name (inst.cell_index ()), inst.complex_trans ().to_string ());
|
||||
} else {
|
||||
msg += tl::sprintf (tl::to_string (QObject::tr ("instance(\"%s\" %s %ldx%ld)")), layout.display_name (inst.cell_index ()), inst.complex_trans ().to_string (), amax, bmax);
|
||||
msg += tl::sprintf (tl::to_string (tr ("instance(\"%s\" %s %ldx%ld)")), layout.display_name (inst.cell_index ()), inst.complex_trans ().to_string (), amax, bmax);
|
||||
}
|
||||
|
||||
msg += tl::to_string (QObject::tr (" in "));
|
||||
msg += tl::to_string (tr (" in "));
|
||||
msg += path_to_string (layout, *r);
|
||||
|
||||
view ()->message (msg, transient ? 10 : 10000);
|
||||
|
|
@ -1163,31 +1182,31 @@ Service::display_status (bool transient)
|
|||
|
||||
std::string msg;
|
||||
if (! transient) {
|
||||
msg = tl::to_string (QObject::tr ("selected: "));
|
||||
msg = tl::to_string (tr ("selected: "));
|
||||
}
|
||||
|
||||
if (r->shape ().is_box ()) {
|
||||
db::Box b (r->shape ().bbox ());
|
||||
msg += tl::sprintf (tl::to_string (QObject::tr ("box(%d,%d %d,%d)")), int (b.left ()), int (b.bottom ()), int (b.right ()), int (b.top ()));
|
||||
msg += tl::sprintf (tl::to_string (tr ("box(%d,%d %d,%d)")), int (b.left ()), int (b.bottom ()), int (b.right ()), int (b.top ()));
|
||||
} else if (r->shape ().is_text ()) {
|
||||
msg += tl::sprintf (tl::to_string (QObject::tr ("text(\"%s\" %s)")), tl::escape_string (r->shape ().text_string ()), r->shape ().text_trans ().to_string ());
|
||||
msg += tl::sprintf (tl::to_string (tr ("text(\"%s\" %s)")), tl::escape_string (r->shape ().text_string ()), r->shape ().text_trans ().to_string ());
|
||||
} else if (r->shape ().is_polygon ()) {
|
||||
size_t npoints = 0;
|
||||
for (db::Shape::polygon_edge_iterator e = r->shape ().begin_edge (); ! e.at_end (); ++e) {
|
||||
++npoints;
|
||||
}
|
||||
msg += tl::sprintf (tl::to_string (QObject::tr ("polygon(#points=%lu)")), npoints);
|
||||
msg += tl::sprintf (tl::to_string (tr ("polygon(#points=%lu)")), npoints);
|
||||
} else if (r->shape ().is_path ()) {
|
||||
size_t npoints = 0;
|
||||
for (db::Shape::point_iterator p = r->shape ().begin_point (); p != r->shape ().end_point (); ++p) {
|
||||
++npoints;
|
||||
}
|
||||
msg += tl::sprintf (tl::to_string (QObject::tr ("path(w=%d #points=%lu)")), int (r->shape ().path_width ()), npoints);
|
||||
msg += tl::sprintf (tl::to_string (tr ("path(w=%d #points=%lu)")), int (r->shape ().path_width ()), npoints);
|
||||
}
|
||||
|
||||
if (! msg.empty ()) {
|
||||
|
||||
msg += tl::to_string (QObject::tr (" on "));
|
||||
msg += tl::to_string (tr (" on "));
|
||||
|
||||
std::string ln = layout.get_properties (r->layer ()).to_string ();
|
||||
for (lay::LayerPropertiesConstIterator lp = view ()->begin_layers (); ! lp.at_end (); ++lp) {
|
||||
|
|
@ -1198,7 +1217,7 @@ Service::display_status (bool transient)
|
|||
}
|
||||
msg += ln;
|
||||
|
||||
msg += tl::to_string (QObject::tr (" in "));
|
||||
msg += tl::to_string (tr (" in "));
|
||||
msg += path_to_string (layout, *r);
|
||||
|
||||
view ()->message (msg, transient ? 10 : 10000);
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@
|
|||
#include "layMarker.h"
|
||||
#include "laySnap.h"
|
||||
#include "layObjectInstPath.h"
|
||||
#include "layColor.h"
|
||||
#include "dbLayout.h"
|
||||
#include "dbShape.h"
|
||||
#include "edtUtils.h"
|
||||
|
|
@ -41,7 +42,6 @@
|
|||
|
||||
#include <set>
|
||||
#include <vector>
|
||||
#include <QColor>
|
||||
|
||||
namespace lay {
|
||||
class LayerPropertiesConstIterator;
|
||||
|
|
@ -83,12 +83,12 @@ public:
|
|||
/**
|
||||
* @brief The constructor for an service selecting shapes
|
||||
*/
|
||||
Service (db::Manager *manager, lay::LayoutView *view, db::ShapeIterator::flags_type shape_types);
|
||||
Service (db::Manager *manager, lay::LayoutViewBase *view, db::ShapeIterator::flags_type shape_types);
|
||||
|
||||
/**
|
||||
* @brief The constructor for an service selecting instances
|
||||
*/
|
||||
Service (db::Manager *manager, lay::LayoutView *view);
|
||||
Service (db::Manager *manager, lay::LayoutViewBase *view);
|
||||
|
||||
/**
|
||||
* @brief The destructor
|
||||
|
|
@ -220,7 +220,7 @@ public:
|
|||
/**
|
||||
* @brief Color accessor
|
||||
*/
|
||||
QColor color () const
|
||||
lay::Color color () const
|
||||
{
|
||||
return m_color;
|
||||
}
|
||||
|
|
@ -244,7 +244,7 @@ public:
|
|||
/**
|
||||
* @brief Access to the view object
|
||||
*/
|
||||
lay::LayoutView *view () const
|
||||
lay::LayoutViewBase *view () const
|
||||
{
|
||||
tl_assert (mp_view != 0);
|
||||
return mp_view;
|
||||
|
|
@ -560,7 +560,7 @@ protected:
|
|||
|
||||
private:
|
||||
// The layout view that the editor service is attached to
|
||||
lay::LayoutView *mp_view;
|
||||
lay::LayoutViewBase *mp_view;
|
||||
|
||||
// The marker objects representing the selection
|
||||
std::vector<lay::ViewObject *> m_markers;
|
||||
|
|
@ -593,7 +593,7 @@ private:
|
|||
db::ShapeIterator::flags_type m_flags;
|
||||
|
||||
// The look of the markers
|
||||
QColor m_color;
|
||||
lay::Color m_color;
|
||||
|
||||
// The current transformation on movement
|
||||
db::DTrans m_move_trans;
|
||||
|
|
@ -645,6 +645,9 @@ private:
|
|||
* @brief Display the status bar message for the given selection
|
||||
*/
|
||||
void display_status (bool transient);
|
||||
|
||||
private:
|
||||
void copy_selected (unsigned int inst_mode);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,8 +23,10 @@
|
|||
|
||||
#include "edtMainService.h"
|
||||
#include "edtServiceImpl.h"
|
||||
#include "edtPropertiesPages.h"
|
||||
#include "edtInstPropertiesPage.h"
|
||||
#if defined(HAVE_QT)
|
||||
# include "edtPropertiesPages.h"
|
||||
# include "edtInstPropertiesPage.h"
|
||||
#endif
|
||||
#include "edtService.h"
|
||||
#include "edtPlugin.h"
|
||||
#include "dbEdge.h"
|
||||
|
|
@ -35,11 +37,16 @@
|
|||
#include "dbEdgeProcessor.h"
|
||||
#include "layMarker.h"
|
||||
#include "layLayerProperties.h"
|
||||
#include "layLayoutView.h"
|
||||
#include "layTipDialog.h"
|
||||
#include "layLayoutViewBase.h"
|
||||
|
||||
#include <QInputDialog>
|
||||
#include <QApplication>
|
||||
#if defined(HAVE_QT)
|
||||
# include "layTipDialog.h"
|
||||
# include "layDragDropData.h"
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_QT)
|
||||
# include <QApplication>
|
||||
#endif
|
||||
|
||||
namespace edt
|
||||
{
|
||||
|
|
@ -47,7 +54,7 @@ namespace edt
|
|||
// -----------------------------------------------------------------------------
|
||||
// ShapeEditService implementation
|
||||
|
||||
ShapeEditService::ShapeEditService (db::Manager *manager, lay::LayoutView *view, db::ShapeIterator::flags_type shape_types)
|
||||
ShapeEditService::ShapeEditService (db::Manager *manager, lay::LayoutViewBase *view, db::ShapeIterator::flags_type shape_types)
|
||||
: edt::Service (manager, view, shape_types),
|
||||
m_layer (0), m_cv_index (0), mp_cell (0), mp_layout (0), m_combine_mode (CM_Add)
|
||||
{
|
||||
|
|
@ -71,7 +78,7 @@ ShapeEditService::get_edit_layer ()
|
|||
lay::LayerPropertiesConstIterator cl = view ()->current_layer ();
|
||||
|
||||
if (cl.is_null ()) {
|
||||
throw tl::Exception (tl::to_string (QObject::tr ("Please select a layer first")));
|
||||
throw tl::Exception (tl::to_string (tr ("Please select a layer first")));
|
||||
}
|
||||
|
||||
int cv_index = cl->cellview_index ();
|
||||
|
|
@ -79,20 +86,22 @@ ShapeEditService::get_edit_layer ()
|
|||
int layer = cl->layer_index ();
|
||||
|
||||
if (cv_index < 0 || ! cv.is_valid ()) {
|
||||
throw tl::Exception (tl::to_string (QObject::tr ("Please select a cell first")));
|
||||
throw tl::Exception (tl::to_string (tr ("Please select a cell first")));
|
||||
}
|
||||
|
||||
#if defined(HAVE_QT)
|
||||
if (! cl->visible (true)) {
|
||||
lay::TipDialog td (QApplication::activeWindow (),
|
||||
tl::to_string (QObject::tr ("You are about to draw on a hidden layer. The result won't be visible.")),
|
||||
tl::to_string (tr ("You are about to draw on a hidden layer. The result won't be visible.")),
|
||||
"drawing-on-invisible-layer");
|
||||
td.exec_dialog ();
|
||||
}
|
||||
#endif
|
||||
|
||||
if (layer < 0 || ! cv->layout ().is_valid_layer ((unsigned int) layer)) {
|
||||
|
||||
if (cl->has_children ()) {
|
||||
throw tl::Exception (tl::to_string (QObject::tr ("Please select a valid drawing layer first")));
|
||||
throw tl::Exception (tl::to_string (tr ("Please select a valid drawing layer first")));
|
||||
} else {
|
||||
|
||||
// create this layer now
|
||||
|
|
@ -125,7 +134,7 @@ ShapeEditService::get_edit_layer ()
|
|||
mp_cell = &(mp_layout->cell (cv.cell_index ()));
|
||||
|
||||
if (mp_cell->is_proxy ()) {
|
||||
throw tl::Exception (tl::to_string (QObject::tr ("Cannot put a shape into a PCell or library cell")));
|
||||
throw tl::Exception (tl::to_string (tr ("Cannot put a shape into a PCell or library cell")));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -152,12 +161,14 @@ ShapeEditService::update_edit_layer (const lay::LayerPropertiesConstIterator &cl
|
|||
return;
|
||||
}
|
||||
|
||||
#if defined(HAVE_QT)
|
||||
if (! cl->visible (true)) {
|
||||
lay::TipDialog td (QApplication::activeWindow (),
|
||||
tl::to_string (QObject::tr ("You are now drawing on a hidden layer. The result won't be visible.")),
|
||||
tl::to_string (tr ("You are now drawing on a hidden layer. The result won't be visible.")),
|
||||
"drawing-on-invisible-layer");
|
||||
td.exec_dialog ();
|
||||
}
|
||||
#endif
|
||||
|
||||
if (layer < 0 || ! cv->layout ().is_valid_layer ((unsigned int) layer)) {
|
||||
|
||||
|
|
@ -255,7 +266,7 @@ ShapeEditService::deliver_shape (const db::Polygon &poly)
|
|||
{
|
||||
if (m_combine_mode == CM_Add) {
|
||||
|
||||
manager ()->transaction (tl::to_string (QObject::tr ("Create polygon")));
|
||||
manager ()->transaction (tl::to_string (tr ("Create polygon")));
|
||||
cell ().shapes (layer ()).insert (poly);
|
||||
manager ()->commit ();
|
||||
|
||||
|
|
@ -315,7 +326,7 @@ ShapeEditService::deliver_shape (const db::Polygon &poly)
|
|||
result = input;
|
||||
}
|
||||
|
||||
manager ()->transaction (tl::to_string (QObject::tr ("Combine shape with background")));
|
||||
manager ()->transaction (tl::to_string (tr ("Combine shape with background")));
|
||||
|
||||
// Erase existing shapes
|
||||
for (std::vector<db::Shape>::const_iterator s = shapes.begin (); s != shapes.end (); ++s) {
|
||||
|
|
@ -339,7 +350,7 @@ void
|
|||
ShapeEditService::deliver_shape (const db::Path &path)
|
||||
{
|
||||
if (m_combine_mode == CM_Add) {
|
||||
manager ()->transaction (tl::to_string (QObject::tr ("Create path")));
|
||||
manager ()->transaction (tl::to_string (tr ("Create path")));
|
||||
cell ().shapes (layer ()).insert (path);
|
||||
manager ()->commit ();
|
||||
} else {
|
||||
|
|
@ -351,7 +362,7 @@ void
|
|||
ShapeEditService::deliver_shape (const db::Box &box)
|
||||
{
|
||||
if (m_combine_mode == CM_Add) {
|
||||
manager ()->transaction (tl::to_string (QObject::tr ("Create box")));
|
||||
manager ()->transaction (tl::to_string (tr ("Create box")));
|
||||
cell ().shapes (layer ()).insert (box);
|
||||
manager ()->commit ();
|
||||
} else {
|
||||
|
|
@ -362,18 +373,20 @@ ShapeEditService::deliver_shape (const db::Box &box)
|
|||
// -----------------------------------------------------------------------------
|
||||
// PolygonService implementation
|
||||
|
||||
PolygonService::PolygonService (db::Manager *manager, lay::LayoutView *view)
|
||||
PolygonService::PolygonService (db::Manager *manager, lay::LayoutViewBase *view)
|
||||
: ShapeEditService (manager, view, db::ShapeIterator::Polygons),
|
||||
m_closure_set (false), m_closure ()
|
||||
{
|
||||
// .. nothing yet ..
|
||||
}
|
||||
|
||||
#if defined(HAVE_QT)
|
||||
lay::PropertiesPage *
|
||||
PolygonService::properties_page (db::Manager *manager, QWidget *parent)
|
||||
{
|
||||
return new edt::PolygonPropertiesPage (this, manager, parent);
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
PolygonService::do_begin_edit (const db::DPoint &p)
|
||||
|
|
@ -468,7 +481,7 @@ PolygonService::get_polygon () const
|
|||
db::Polygon poly;
|
||||
|
||||
if (m_points.size () < 4) {
|
||||
throw tl::Exception (tl::to_string (QObject::tr ("A polygon must have at least 3 points")));
|
||||
throw tl::Exception (tl::to_string (tr ("A polygon must have at least 3 points")));
|
||||
}
|
||||
|
||||
std::vector<db::Point> points_dbu;
|
||||
|
|
@ -485,7 +498,7 @@ PolygonService::get_polygon () const
|
|||
poly.assign_hull (points_dbu.begin (), points_dbu.end (), true, true /*remove reflected*/);
|
||||
|
||||
if (poly.hull ().size () < 3) {
|
||||
throw tl::Exception (tl::to_string (QObject::tr ("A polygon must have at least 3 effective points")));
|
||||
throw tl::Exception (tl::to_string (tr ("A polygon must have at least 3 effective points")));
|
||||
}
|
||||
|
||||
return poly;
|
||||
|
|
@ -692,17 +705,19 @@ PolygonService::update_marker ()
|
|||
// -----------------------------------------------------------------------------
|
||||
// BoxService implementation
|
||||
|
||||
BoxService::BoxService (db::Manager *manager, lay::LayoutView *view)
|
||||
BoxService::BoxService (db::Manager *manager, lay::LayoutViewBase *view)
|
||||
: ShapeEditService (manager, view, db::ShapeIterator::Boxes)
|
||||
{
|
||||
// .. nothing yet ..
|
||||
}
|
||||
|
||||
#if defined(HAVE_QT)
|
||||
lay::PropertiesPage *
|
||||
BoxService::properties_page (db::Manager *manager, QWidget *parent)
|
||||
{
|
||||
return new edt::BoxPropertiesPage (this, manager, parent);
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
BoxService::do_begin_edit (const db::DPoint &p)
|
||||
|
|
@ -784,7 +799,7 @@ BoxService::selection_applies (const lay::ObjectInstPath &sel) const
|
|||
// -----------------------------------------------------------------------------
|
||||
// TextService implementation
|
||||
|
||||
TextService::TextService (db::Manager *manager, lay::LayoutView *view)
|
||||
TextService::TextService (db::Manager *manager, lay::LayoutViewBase *view)
|
||||
: ShapeEditService (manager, view, db::ShapeIterator::Texts),
|
||||
m_rot (0)
|
||||
{
|
||||
|
|
@ -796,11 +811,13 @@ TextService::~TextService ()
|
|||
// .. nothing yet ..
|
||||
}
|
||||
|
||||
#if defined(HAVE_QT)
|
||||
lay::PropertiesPage *
|
||||
TextService::properties_page (db::Manager *manager, QWidget *parent)
|
||||
{
|
||||
return new edt::TextPropertiesPage (this, manager, parent);
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
TextService::do_begin_edit (const db::DPoint &p)
|
||||
|
|
@ -889,16 +906,17 @@ TextService::do_finish_edit ()
|
|||
{
|
||||
get_edit_layer ();
|
||||
|
||||
manager ()->transaction (tl::to_string (QObject::tr ("Create text")));
|
||||
manager ()->transaction (tl::to_string (tr ("Create text")));
|
||||
cell ().shapes (layer ()).insert (get_text ());
|
||||
manager ()->commit ();
|
||||
|
||||
commit_recent (view ());
|
||||
|
||||
#if defined(HAVE_QT)
|
||||
if (! view ()->text_visible ()) {
|
||||
|
||||
lay::TipDialog td (QApplication::activeWindow (),
|
||||
tl::to_string (QObject::tr ("A text object is created but texts are disabled for drawing and are not visible. Do you want to enable drawing of texts?\n\nChoose \"Yes\" to enable text drawing now.")),
|
||||
tl::to_string (tr ("A text object is created but texts are disabled for drawing and are not visible. Do you want to enable drawing of texts?\n\nChoose \"Yes\" to enable text drawing now.")),
|
||||
"text-created-but-not-visible",
|
||||
lay::TipDialog::yesno_buttons);
|
||||
|
||||
|
|
@ -909,6 +927,7 @@ TextService::do_finish_edit ()
|
|||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -972,7 +991,7 @@ TextService::configure (const std::string &name, const std::string &value)
|
|||
// -----------------------------------------------------------------------------
|
||||
// PathService implementation
|
||||
|
||||
PathService::PathService (db::Manager *manager, lay::LayoutView *view)
|
||||
PathService::PathService (db::Manager *manager, lay::LayoutViewBase *view)
|
||||
: ShapeEditService (manager, view, db::ShapeIterator::Paths),
|
||||
m_width (0.1), m_bgnext (0.0), m_endext (0.0), m_type (Flush), m_needs_update (true)
|
||||
{
|
||||
|
|
@ -984,6 +1003,7 @@ PathService::~PathService ()
|
|||
// .. nothing yet ..
|
||||
}
|
||||
|
||||
#if defined(HAVE_QT)
|
||||
lay::PropertiesPage *
|
||||
PathService::properties_page (db::Manager *manager, QWidget *parent)
|
||||
{
|
||||
|
|
@ -993,6 +1013,7 @@ PathService::properties_page (db::Manager *manager, QWidget *parent)
|
|||
return new edt::PathPropertiesPage (this, manager, parent);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
PathService::do_begin_edit (const db::DPoint &p)
|
||||
|
|
@ -1083,7 +1104,7 @@ PathService::do_finish_edit ()
|
|||
{
|
||||
// one point is reserved for the "current one"
|
||||
if (m_points.size () < 3) {
|
||||
throw tl::Exception (tl::to_string (QObject::tr ("A path must have at least 2 points")));
|
||||
throw tl::Exception (tl::to_string (tr ("A path must have at least 2 points")));
|
||||
}
|
||||
m_points.pop_back ();
|
||||
|
||||
|
|
@ -1211,7 +1232,7 @@ PathService::config_finalize ()
|
|||
// -----------------------------------------------------------------------------
|
||||
// InstService implementation
|
||||
|
||||
InstService::InstService (db::Manager *manager, lay::LayoutView *view)
|
||||
InstService::InstService (db::Manager *manager, lay::LayoutViewBase *view)
|
||||
: edt::Service (manager, view),
|
||||
m_angle (0.0), m_scale (1.0),
|
||||
m_mirror (false), m_is_pcell (false),
|
||||
|
|
@ -1224,11 +1245,13 @@ InstService::InstService (db::Manager *manager, lay::LayoutView *view)
|
|||
// .. nothing yet ..
|
||||
}
|
||||
|
||||
#if defined(HAVE_QT)
|
||||
lay::PropertiesPage *
|
||||
InstService::properties_page (db::Manager *manager, QWidget *parent)
|
||||
{
|
||||
return new edt::InstPropertiesPage (this, manager, parent);
|
||||
}
|
||||
#endif
|
||||
|
||||
bool
|
||||
InstService::do_activated ()
|
||||
|
|
@ -1253,6 +1276,7 @@ InstService::get_default_layer_for_pcell ()
|
|||
return tl::Variant ();
|
||||
}
|
||||
|
||||
#if defined(HAVE_QT)
|
||||
bool
|
||||
InstService::drag_enter_event (const db::DPoint &p, const lay::DragDropDataBase *data)
|
||||
{
|
||||
|
|
@ -1323,7 +1347,7 @@ InstService::drag_enter_event (const db::DPoint &p, const lay::DragDropDataBase
|
|||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
bool
|
||||
InstService::drag_move_event (const db::DPoint &p, const lay::DragDropDataBase * /*data*/)
|
||||
{
|
||||
if (m_in_drag_drop) {
|
||||
|
|
@ -1343,19 +1367,20 @@ InstService::drag_leave_event ()
|
|||
}
|
||||
}
|
||||
|
||||
bool
|
||||
InstService::drop_event (const db::DPoint & /*p*/, const lay::DragDropDataBase * /*data*/)
|
||||
{
|
||||
m_in_drag_drop = false;
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool
|
||||
InstService::selection_applies (const lay::ObjectInstPath &sel) const
|
||||
{
|
||||
return sel.is_cell_inst ();
|
||||
}
|
||||
|
||||
bool
|
||||
InstService::drop_event (const db::DPoint & /*p*/, const lay::DragDropDataBase * /*data*/)
|
||||
{
|
||||
m_in_drag_drop = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
InstService::sync_to_config ()
|
||||
{
|
||||
|
|
@ -1383,7 +1408,7 @@ InstService::do_begin_edit (const db::DPoint &p)
|
|||
}
|
||||
|
||||
if (cv.cell ()->is_proxy ()) {
|
||||
throw tl::Exception (tl::to_string (QObject::tr ("Cannot put an instance into a PCell or library cell")));
|
||||
throw tl::Exception (tl::to_string (tr ("Cannot put an instance into a PCell or library cell")));
|
||||
}
|
||||
|
||||
m_trans = cv.context_trans ();
|
||||
|
|
@ -1429,7 +1454,7 @@ InstService::make_cell (const lay::CellView &cv)
|
|||
// NOTE: do this at the beginning: creating a transaction might delete transactions behind the
|
||||
// head transaction, hence releasing (thus: deleting) cells. To prevert interference, create
|
||||
// the transaction at the beginning.
|
||||
db::Transaction tr (manager (), tl::to_string (QObject::tr ("Create reference cell")), m_reference_transaction_id);
|
||||
db::Transaction transaction (manager (), tl::to_string (tr ("Create reference cell")), m_reference_transaction_id);
|
||||
|
||||
lay::LayerState layer_state = view ()->layer_snapshot ();
|
||||
|
||||
|
|
@ -1497,8 +1522,8 @@ InstService::make_cell (const lay::CellView &cv)
|
|||
m_has_valid_cell = true;
|
||||
m_current_cell = inst_cell_index;
|
||||
|
||||
if (! tr.is_empty ()) {
|
||||
m_reference_transaction_id = tr.id ();
|
||||
if (! transaction.is_empty ()) {
|
||||
m_reference_transaction_id = transaction.id ();
|
||||
}
|
||||
|
||||
return std::pair<bool, db::cell_index_type> (true, inst_cell_index);
|
||||
|
|
@ -1596,10 +1621,10 @@ InstService::do_finish_edit ()
|
|||
std::vector <db::cell_index_type> intersection;
|
||||
std::set_intersection (called.begin (), called.end (), callers.begin (), callers.end (), std::back_inserter (intersection));
|
||||
if (! intersection.empty ()) {
|
||||
throw tl::Exception (tl::to_string (QObject::tr ("Inserting this instance would create a recursive hierarchy")));
|
||||
throw tl::Exception (tl::to_string (tr ("Inserting this instance would create a recursive hierarchy")));
|
||||
}
|
||||
|
||||
manager ()->transaction (tl::to_string (QObject::tr ("Create instance")), m_reference_transaction_id);
|
||||
manager ()->transaction (tl::to_string (tr ("Create instance")), m_reference_transaction_id);
|
||||
m_reference_transaction_id = 0;
|
||||
db::Instance i = cv->layout ().cell (cv.cell_index ()).insert (inst);
|
||||
cv->layout ().cleanup ();
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@
|
|||
namespace lay
|
||||
{
|
||||
class CellView;
|
||||
class LayoutViewBase;
|
||||
class LayerPropertiesConstIterator;
|
||||
}
|
||||
|
||||
|
|
@ -45,7 +46,7 @@ class ShapeEditService
|
|||
: public edt::Service
|
||||
{
|
||||
public:
|
||||
ShapeEditService (db::Manager *manager, lay::LayoutView *view, db::ShapeIterator::flags_type shape_types);
|
||||
ShapeEditService (db::Manager *manager, lay::LayoutViewBase *view, db::ShapeIterator::flags_type shape_types);
|
||||
|
||||
protected:
|
||||
void get_edit_layer ();
|
||||
|
|
@ -86,9 +87,11 @@ class PolygonService
|
|||
: public ShapeEditService
|
||||
{
|
||||
public:
|
||||
PolygonService (db::Manager *manager, lay::LayoutView *view);
|
||||
PolygonService (db::Manager *manager, lay::LayoutViewBase *view);
|
||||
|
||||
#if defined(HAVE_QT)
|
||||
virtual lay::PropertiesPage *properties_page (db::Manager *manager, QWidget *parent);
|
||||
#endif
|
||||
virtual void do_delete ();
|
||||
virtual void do_begin_edit (const db::DPoint &p);
|
||||
virtual void do_mouse_move (const db::DPoint &p);
|
||||
|
|
@ -117,9 +120,11 @@ class BoxService
|
|||
: public ShapeEditService
|
||||
{
|
||||
public:
|
||||
BoxService (db::Manager *manager, lay::LayoutView *view);
|
||||
BoxService (db::Manager *manager, lay::LayoutViewBase *view);
|
||||
|
||||
#if defined(HAVE_QT)
|
||||
virtual lay::PropertiesPage *properties_page (db::Manager *manager, QWidget *parent);
|
||||
#endif
|
||||
virtual void do_begin_edit (const db::DPoint &p);
|
||||
virtual void do_mouse_move (const db::DPoint &p);
|
||||
virtual void do_mouse_move_inactive (const db::DPoint &p);
|
||||
|
|
@ -142,10 +147,12 @@ class TextService
|
|||
: public ShapeEditService
|
||||
{
|
||||
public:
|
||||
TextService (db::Manager *manager, lay::LayoutView *view);
|
||||
TextService (db::Manager *manager, lay::LayoutViewBase *view);
|
||||
~TextService ();
|
||||
|
||||
#if defined(HAVE_QT)
|
||||
virtual lay::PropertiesPage *properties_page (db::Manager *manager, QWidget *parent);
|
||||
#endif
|
||||
virtual void do_begin_edit (const db::DPoint &p);
|
||||
virtual void do_mouse_transform (const db::DPoint &p, db::DFTrans trans);
|
||||
virtual void do_mouse_move (const db::DPoint &p);
|
||||
|
|
@ -174,10 +181,12 @@ class PathService
|
|||
: public ShapeEditService
|
||||
{
|
||||
public:
|
||||
PathService (db::Manager *manager, lay::LayoutView *view);
|
||||
PathService (db::Manager *manager, lay::LayoutViewBase *view);
|
||||
~PathService ();
|
||||
|
||||
#if defined(HAVE_QT)
|
||||
virtual lay::PropertiesPage *properties_page (db::Manager *manager, QWidget *parent);
|
||||
#endif
|
||||
virtual void do_begin_edit (const db::DPoint &p);
|
||||
virtual void do_mouse_move (const db::DPoint &p);
|
||||
virtual bool do_mouse_click (const db::DPoint &p);
|
||||
|
|
@ -211,9 +220,11 @@ class InstService
|
|||
: public edt::Service
|
||||
{
|
||||
public:
|
||||
InstService (db::Manager *manager, lay::LayoutView *view);
|
||||
InstService (db::Manager *manager, lay::LayoutViewBase *view);
|
||||
|
||||
#if defined(HAVE_QT)
|
||||
virtual lay::PropertiesPage *properties_page (db::Manager *manager, QWidget *parent);
|
||||
#endif
|
||||
virtual void do_begin_edit (const db::DPoint &p);
|
||||
virtual void do_mouse_move_inactive (const db::DPoint &p);
|
||||
virtual void do_mouse_move (const db::DPoint &p);
|
||||
|
|
@ -222,10 +233,12 @@ public:
|
|||
virtual void do_finish_edit ();
|
||||
virtual void do_cancel_edit ();
|
||||
virtual bool do_activated ();
|
||||
#if defined(HAVE_QT)
|
||||
virtual bool drag_enter_event (const db::DPoint &p, const lay::DragDropDataBase *data);
|
||||
virtual bool drag_move_event (const db::DPoint &p, const lay::DragDropDataBase *data);
|
||||
virtual void drag_leave_event ();
|
||||
virtual bool drop_event (const db::DPoint &p, const lay::DragDropDataBase *data);
|
||||
#endif
|
||||
virtual bool selection_applies (const lay::ObjectInstPath &sel) const;
|
||||
|
||||
protected:
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@
|
|||
#include "edtService.h"
|
||||
|
||||
#include "layCellView.h"
|
||||
#include "layLayoutView.h"
|
||||
#include "layLayoutViewBase.h"
|
||||
#include "layEditable.h"
|
||||
#include "tlException.h"
|
||||
|
||||
|
|
@ -77,7 +77,7 @@ std::map<std::string, tl::Variant> pcell_parameters_from_string (const std::stri
|
|||
// -------------------------------------------------------------
|
||||
// SelectionIterator implementation
|
||||
|
||||
SelectionIterator::SelectionIterator (lay::LayoutView *view, bool including_transient)
|
||||
SelectionIterator::SelectionIterator (lay::LayoutViewBase *view, bool including_transient)
|
||||
: m_transient_mode (false)
|
||||
{
|
||||
mp_edt_services = view->get_plugins <edt::Service> ();
|
||||
|
|
@ -145,7 +145,7 @@ SelectionIterator::next ()
|
|||
// TransformationsVariants implementation
|
||||
// for a lay::LayoutView
|
||||
|
||||
TransformationVariants::TransformationVariants (const lay::LayoutView *view, bool per_cv_and_layer, bool per_cv)
|
||||
TransformationVariants::TransformationVariants (const lay::LayoutViewBase *view, bool per_cv_and_layer, bool per_cv)
|
||||
{
|
||||
// build the transformation variants cache
|
||||
|
||||
|
|
|
|||
|
|
@ -29,8 +29,6 @@
|
|||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
#include "layObjectInstPath.h"
|
||||
|
||||
#include "dbInstElement.h"
|
||||
|
|
@ -40,7 +38,7 @@
|
|||
|
||||
namespace lay
|
||||
{
|
||||
class LayoutView;
|
||||
class LayoutViewBase;
|
||||
}
|
||||
|
||||
namespace edt {
|
||||
|
|
@ -84,7 +82,7 @@ public:
|
|||
class TransformationVariants
|
||||
{
|
||||
public:
|
||||
TransformationVariants (const lay::LayoutView *view, bool per_cv_and_layer = true, bool per_cv = true);
|
||||
TransformationVariants (const lay::LayoutViewBase *view, bool per_cv_and_layer = true, bool per_cv = true);
|
||||
|
||||
const std::vector<db::DCplxTrans> *per_cv_and_layer (unsigned int cv, unsigned int layer) const;
|
||||
const std::vector<db::DCplxTrans> *per_cv (unsigned int cv) const;
|
||||
|
|
@ -109,7 +107,7 @@ public:
|
|||
*
|
||||
* If "including_transient" is true, the transient selection will be used as fallback.
|
||||
*/
|
||||
SelectionIterator (lay::LayoutView *view, bool including_transient = true);
|
||||
SelectionIterator (lay::LayoutViewBase *view, bool including_transient = true);
|
||||
|
||||
/**
|
||||
* @brief Returns a value indicating whether the transient selection is taken
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
#include "edtService.h"
|
||||
#include "dbRecursiveShapeIterator.h"
|
||||
#include "layObjectInstPath.h"
|
||||
#include "layLayoutView.h"
|
||||
#include "layLayoutViewBase.h"
|
||||
|
||||
namespace gsi
|
||||
{
|
||||
|
|
@ -489,7 +489,7 @@ private:
|
|||
|
||||
// extend the layout view by "edtService" specific methods
|
||||
|
||||
static std::vector<edt::Service::objects::value_type> object_selection (const lay::LayoutView *view)
|
||||
static std::vector<edt::Service::objects::value_type> object_selection (const lay::LayoutViewBase *view)
|
||||
{
|
||||
std::vector<edt::Service::objects::value_type> result;
|
||||
std::vector<edt::Service *> edt_services = view->get_plugins <edt::Service> ();
|
||||
|
|
@ -501,7 +501,7 @@ static std::vector<edt::Service::objects::value_type> object_selection (const la
|
|||
return result;
|
||||
}
|
||||
|
||||
static void set_object_selection (const lay::LayoutView *view, const std::vector<edt::Service::objects::value_type> &all_selected)
|
||||
static void set_object_selection (const lay::LayoutViewBase *view, const std::vector<edt::Service::objects::value_type> &all_selected)
|
||||
{
|
||||
std::vector<edt::Service::objects::value_type> sel;
|
||||
|
||||
|
|
@ -521,7 +521,7 @@ static void set_object_selection (const lay::LayoutView *view, const std::vector
|
|||
}
|
||||
}
|
||||
|
||||
static bool has_object_selection (const lay::LayoutView *view)
|
||||
static bool has_object_selection (const lay::LayoutViewBase *view)
|
||||
{
|
||||
std::vector<edt::Service *> edt_services = view->get_plugins <edt::Service> ();
|
||||
for (std::vector<edt::Service *>::const_iterator s = edt_services.begin (); s != edt_services.end (); ++s) {
|
||||
|
|
@ -532,7 +532,7 @@ static bool has_object_selection (const lay::LayoutView *view)
|
|||
return false;
|
||||
}
|
||||
|
||||
static void clear_object_selection (const lay::LayoutView *view)
|
||||
static void clear_object_selection (const lay::LayoutViewBase *view)
|
||||
{
|
||||
std::vector<edt::Service *> edt_services = view->get_plugins <edt::Service> ();
|
||||
for (std::vector<edt::Service *>::const_iterator s = edt_services.begin (); s != edt_services.end (); ++s) {
|
||||
|
|
@ -540,7 +540,7 @@ static void clear_object_selection (const lay::LayoutView *view)
|
|||
}
|
||||
}
|
||||
|
||||
static void select_object (const lay::LayoutView *view, const edt::Service::objects::value_type &object)
|
||||
static void select_object (const lay::LayoutViewBase *view, const edt::Service::objects::value_type &object)
|
||||
{
|
||||
std::vector<edt::Service *> edt_services = view->get_plugins <edt::Service> ();
|
||||
for (std::vector<edt::Service *>::const_iterator s = edt_services.begin (); s != edt_services.end (); ++s) {
|
||||
|
|
@ -551,7 +551,7 @@ static void select_object (const lay::LayoutView *view, const edt::Service::obje
|
|||
}
|
||||
}
|
||||
|
||||
static void unselect_object (const lay::LayoutView *view, const edt::Service::objects::value_type &object)
|
||||
static void unselect_object (const lay::LayoutViewBase *view, const edt::Service::objects::value_type &object)
|
||||
{
|
||||
std::vector<edt::Service *> edt_services = view->get_plugins <edt::Service> ();
|
||||
for (std::vector<edt::Service *>::const_iterator s = edt_services.begin (); s != edt_services.end (); ++s) {
|
||||
|
|
@ -562,7 +562,7 @@ static void unselect_object (const lay::LayoutView *view, const edt::Service::ob
|
|||
}
|
||||
}
|
||||
|
||||
static bool has_transient_object_selection (const lay::LayoutView *view)
|
||||
static bool has_transient_object_selection (const lay::LayoutViewBase *view)
|
||||
{
|
||||
std::vector<edt::Service *> edt_services = view->get_plugins <edt::Service> ();
|
||||
for (std::vector<edt::Service *>::const_iterator s = edt_services.begin (); s != edt_services.end (); ++s) {
|
||||
|
|
@ -573,18 +573,18 @@ static bool has_transient_object_selection (const lay::LayoutView *view)
|
|||
return false;
|
||||
}
|
||||
|
||||
static EditableSelectionIterator begin_objects_selected (const lay::LayoutView *view)
|
||||
static EditableSelectionIterator begin_objects_selected (const lay::LayoutViewBase *view)
|
||||
{
|
||||
return EditableSelectionIterator (view->get_plugins <edt::Service> (), false);
|
||||
}
|
||||
|
||||
static EditableSelectionIterator begin_objects_selected_transient (const lay::LayoutView *view)
|
||||
static EditableSelectionIterator begin_objects_selected_transient (const lay::LayoutViewBase *view)
|
||||
{
|
||||
return EditableSelectionIterator (view->get_plugins <edt::Service> (), true);
|
||||
}
|
||||
|
||||
static
|
||||
gsi::ClassExt<lay::LayoutView> layout_view_decl (
|
||||
gsi::ClassExt<lay::LayoutViewBase> layout_view_decl (
|
||||
gsi::method_ext ("has_object_selection?", &has_object_selection,
|
||||
"@brief Returns true, if geometrical objects (shapes or cell instances) are selected in this view"
|
||||
) +
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ static gsi::Interpreter *ruby_interpreter ()
|
|||
return interpreter_by_name ("rba");
|
||||
}
|
||||
|
||||
Class<Interpreter> decl_Macro ("tl", "Interpreter",
|
||||
Class<Interpreter> decl_Interpreter ("tl", "Interpreter",
|
||||
gsi::method ("load_file", &Interpreter::load_file, gsi::arg ("path"),
|
||||
"@brief Loads the given file into the interpreter\n"
|
||||
"This will execute the code inside the file.\n"
|
||||
|
|
|
|||
|
|
@ -448,7 +448,6 @@ template <typename T> struct type_traits<std::optional<T> > : generic_type_trait
|
|||
template <> struct type_traits<QString> : generic_type_traits<string_tag, StringAdaptor, T_string> { };
|
||||
template <> struct type_traits<QStringRef> : generic_type_traits<string_tag, StringAdaptor, T_string> { };
|
||||
template <> struct type_traits<QByteArray> : generic_type_traits<byte_array_tag, StringAdaptor, T_byte_array> { };
|
||||
template <> struct type_traits<std::vector<char> > : generic_type_traits<byte_array_tag, StringAdaptor, T_byte_array> { };
|
||||
template <> struct type_traits<QVariant> : generic_type_traits<var_tag, VariantAdaptor, T_var> { };
|
||||
#if QT_VERSION >= 0x50000
|
||||
template <typename T> struct type_traits<QPointer<T> > : generic_type_traits<var_tag, VariantAdaptor, T_var> { };
|
||||
|
|
@ -459,6 +458,7 @@ template <> struct type_traits<QStringView> : generic_type_trait
|
|||
template <> struct type_traits<QByteArrayView> : generic_type_traits<byte_array_tag, StringAdaptor, T_byte_array> { };
|
||||
#endif
|
||||
#endif
|
||||
template <> struct type_traits<std::vector<char> > : generic_type_traits<byte_array_tag, StringAdaptor, T_byte_array> { };
|
||||
template <> struct type_traits<tl::Variant> : generic_type_traits<var_tag, VariantAdaptor, T_var> { };
|
||||
|
||||
template <> struct type_traits<void *> : generic_type_traits<vptr_tag, void *, T_void_ptr> { };
|
||||
|
|
@ -492,7 +492,6 @@ template <typename T> struct type_traits<const std::optional<T> &> : generic_ty
|
|||
template <> struct type_traits<const QString &> : generic_type_traits<string_cref_tag, StringAdaptor, T_string> { };
|
||||
template <> struct type_traits<const QStringRef &> : generic_type_traits<string_cref_tag, StringAdaptor, T_string> { };
|
||||
template <> struct type_traits<const QByteArray &> : generic_type_traits<byte_array_cref_tag, StringAdaptor, T_byte_array> { };
|
||||
template <> struct type_traits<const std::vector<char> &> : generic_type_traits<byte_array_cref_tag, StringAdaptor, T_byte_array> { };
|
||||
template <> struct type_traits<const QVariant &> : generic_type_traits<var_cref_tag, VariantAdaptor, T_var> { };
|
||||
#if QT_VERSION >= 0x50000
|
||||
template <typename T> struct type_traits<const QPointer<T> &> : generic_type_traits<var_cref_tag, VariantAdaptor, T_var> { };
|
||||
|
|
@ -503,6 +502,7 @@ template <> struct type_traits<const QStringView &> : generic_type_trait
|
|||
template <> struct type_traits<const QByteArrayView &> : generic_type_traits<byte_array_cref_tag, StringAdaptor, T_byte_array> { };
|
||||
#endif
|
||||
#endif
|
||||
template <> struct type_traits<const std::vector<char> &> : generic_type_traits<byte_array_cref_tag, StringAdaptor, T_byte_array> { };
|
||||
template <> struct type_traits<const tl::Variant &> : generic_type_traits<var_cref_tag, VariantAdaptor, T_var> { };
|
||||
template <> struct type_traits<const char * const &> : generic_type_traits<string_cref_tag, StringAdaptor, T_string> { };
|
||||
template <> struct type_traits<const unsigned char * const &> : generic_type_traits<string_cref_tag, StringAdaptor, T_string> { };
|
||||
|
|
@ -533,7 +533,6 @@ template <typename T> struct type_traits<std::optional<T> &> : generic_type_tra
|
|||
template <> struct type_traits<QString &> : generic_type_traits<string_ref_tag, StringAdaptor, T_string> { };
|
||||
template <> struct type_traits<QStringRef &> : generic_type_traits<string_ref_tag, StringAdaptor, T_string> { };
|
||||
template <> struct type_traits<QByteArray &> : generic_type_traits<byte_array_ref_tag, StringAdaptor, T_byte_array> { };
|
||||
template <> struct type_traits<std::vector<char> &> : generic_type_traits<byte_array_ref_tag, StringAdaptor, T_byte_array> { };
|
||||
template <> struct type_traits<QVariant &> : generic_type_traits<var_ref_tag, VariantAdaptor, T_var> { };
|
||||
#if QT_VERSION >= 0x50000
|
||||
template <typename T> struct type_traits<QPointer<T> &> : generic_type_traits<var_ref_tag, VariantAdaptor, T_var> { };
|
||||
|
|
@ -544,6 +543,7 @@ template <> struct type_traits<QStringView &> : generic_type_trait
|
|||
template <> struct type_traits<QByteArrayView &> : generic_type_traits<byte_array_ref_tag, StringAdaptor, T_byte_array> { };
|
||||
#endif
|
||||
#endif
|
||||
template <> struct type_traits<std::vector<char> &> : generic_type_traits<byte_array_ref_tag, StringAdaptor, T_byte_array> { };
|
||||
template <> struct type_traits<tl::Variant &> : generic_type_traits<var_ref_tag, VariantAdaptor, T_var> { };
|
||||
template <> struct type_traits<const char * &> : generic_type_traits<string_ref_tag, StringAdaptor, T_string> { };
|
||||
template <> struct type_traits<const unsigned char * &> : generic_type_traits<string_ref_tag, StringAdaptor, T_string> { };
|
||||
|
|
@ -575,7 +575,6 @@ template <typename T> struct type_traits<const std::optional<T> *> : generic_ty
|
|||
template <> struct type_traits<const QString *> : generic_type_traits<string_cptr_tag, StringAdaptor, T_string> { };
|
||||
template <> struct type_traits<const QStringRef *> : generic_type_traits<string_cptr_tag, StringAdaptor, T_string> { };
|
||||
template <> struct type_traits<const QByteArray *> : generic_type_traits<byte_array_cptr_tag, StringAdaptor, T_byte_array> { };
|
||||
template <> struct type_traits<const std::vector<char> *> : generic_type_traits<byte_array_cptr_tag, StringAdaptor, T_byte_array> { };
|
||||
template <> struct type_traits<const QVariant *> : generic_type_traits<var_cptr_tag, VariantAdaptor, T_var> { };
|
||||
#if QT_VERSION >= 0x50000
|
||||
template <typename T> struct type_traits<const QPointer<T> *> : generic_type_traits<var_cptr_tag, VariantAdaptor, T_var> { };
|
||||
|
|
@ -586,6 +585,7 @@ template <> struct type_traits<const QStringView *> : generic_type_trait
|
|||
template <> struct type_traits<const QByteArrayView *> : generic_type_traits<byte_array_cptr_tag, StringAdaptor, T_byte_array> { };
|
||||
#endif
|
||||
#endif
|
||||
template <> struct type_traits<const std::vector<char> *> : generic_type_traits<byte_array_cptr_tag, StringAdaptor, T_byte_array> { };
|
||||
template <> struct type_traits<const tl::Variant *> : generic_type_traits<var_cptr_tag, VariantAdaptor, T_var> { };
|
||||
template <> struct type_traits<const char * const *> : generic_type_traits<string_cptr_tag, StringAdaptor, T_string> { };
|
||||
template <> struct type_traits<const unsigned char * const *> : generic_type_traits<string_cptr_tag, StringAdaptor, T_string> { };
|
||||
|
|
@ -617,7 +617,6 @@ template <typename T> struct type_traits<std::optional<T> *> : generic_type_t
|
|||
template <> struct type_traits<QString *> : generic_type_traits<string_ptr_tag, StringAdaptor, T_string> { };
|
||||
template <> struct type_traits<QStringRef *> : generic_type_traits<string_ptr_tag, StringAdaptor, T_string> { };
|
||||
template <> struct type_traits<QByteArray *> : generic_type_traits<byte_array_ptr_tag, StringAdaptor, T_byte_array> { };
|
||||
template <> struct type_traits<std::vector<char> *> : generic_type_traits<byte_array_ptr_tag, StringAdaptor, T_byte_array> { };
|
||||
template <> struct type_traits<QVariant *> : generic_type_traits<var_ptr_tag, VariantAdaptor, T_var> { };
|
||||
#if QT_VERSION >= 0x50000
|
||||
template <typename T> struct type_traits<QPointer<T> *> : generic_type_traits<var_ptr_tag, VariantAdaptor, T_var> { };
|
||||
|
|
@ -628,6 +627,7 @@ template <> struct type_traits<QStringView *> : generic_type_trait
|
|||
template <> struct type_traits<QByteArrayView *> : generic_type_traits<byte_array_ptr_tag, StringAdaptor, T_byte_array> { };
|
||||
#endif
|
||||
#endif
|
||||
template <> struct type_traits<std::vector<char> *> : generic_type_traits<byte_array_ptr_tag, StringAdaptor, T_byte_array> { };
|
||||
template <> struct type_traits<tl::Variant *> : generic_type_traits<var_ptr_tag, VariantAdaptor, T_var> { };
|
||||
template <> struct type_traits<const char * *> : generic_type_traits<string_ptr_tag, StringAdaptor, T_string> { };
|
||||
template <> struct type_traits<const unsigned char * *> : generic_type_traits<string_ptr_tag, StringAdaptor, T_string> { };
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
#include "imgService.h"
|
||||
#include "imgStream.h"
|
||||
#include "dbTilingProcessor.h"
|
||||
#include "layLayoutView.h"
|
||||
#include "layLayoutViewBase.h"
|
||||
|
||||
namespace gsi
|
||||
{
|
||||
|
|
@ -45,12 +45,12 @@ static void clear_colormap (img::DataMapping *dm)
|
|||
|
||||
static void add_colormap (img::DataMapping *dm, double value, lay::color_t color)
|
||||
{
|
||||
dm->false_color_nodes.push_back (std::make_pair (value, std::make_pair (QColor (color), QColor (color))));
|
||||
dm->false_color_nodes.push_back (std::make_pair (value, std::make_pair (lay::Color (color), lay::Color (color))));
|
||||
}
|
||||
|
||||
static void add_colormap2 (img::DataMapping *dm, double value, lay::color_t lcolor, lay::color_t rcolor)
|
||||
{
|
||||
dm->false_color_nodes.push_back (std::make_pair (value, std::make_pair (QColor (lcolor), QColor (rcolor))));
|
||||
dm->false_color_nodes.push_back (std::make_pair (value, std::make_pair (lay::Color (lcolor), lay::Color (rcolor))));
|
||||
}
|
||||
|
||||
static size_t num_colormap_entries (const img::DataMapping *dm)
|
||||
|
|
@ -299,8 +299,8 @@ gsi::Class<img::DataMapping> decl_ImageDataMapping ("lay", "ImageDataMapping",
|
|||
|
||||
class ImageRef;
|
||||
|
||||
static void replace_image (lay::LayoutView *view, size_t id, ImageRef &new_obj);
|
||||
static void erase_image (lay::LayoutView *view, size_t id);
|
||||
static void replace_image_base (lay::LayoutViewBase *view, size_t id, ImageRef &new_obj);
|
||||
static void erase_image_base (lay::LayoutViewBase *view, size_t id);
|
||||
|
||||
/**
|
||||
* @brief An extension of the img::Object that provides "live" updates of the view
|
||||
|
|
@ -321,7 +321,7 @@ public:
|
|||
// .. nothing yet ..
|
||||
}
|
||||
|
||||
ImageRef (const img::Object &other, lay::LayoutView *view)
|
||||
ImageRef (const img::Object &other, lay::LayoutViewBase *view)
|
||||
: img::Object (other), mp_view (view), dm_update_view (this, &ImageRef::do_update_view)
|
||||
{
|
||||
// .. nothing yet ..
|
||||
|
|
@ -365,7 +365,7 @@ public:
|
|||
void erase ()
|
||||
{
|
||||
if (mp_view) {
|
||||
erase_image (mp_view.get (), id ());
|
||||
erase_image_base (mp_view.get (), id ());
|
||||
detach ();
|
||||
}
|
||||
}
|
||||
|
|
@ -373,10 +373,10 @@ public:
|
|||
template <class T>
|
||||
ImageRef transformed (const T &t) const
|
||||
{
|
||||
return ImageRef (img::Object::transformed<T> (t), const_cast<lay::LayoutView *> (mp_view.get ()));
|
||||
return ImageRef (img::Object::transformed<T> (t), const_cast<lay::LayoutViewBase *> (mp_view.get ()));
|
||||
}
|
||||
|
||||
void set_view (lay::LayoutView *view)
|
||||
void set_view (lay::LayoutViewBase *view)
|
||||
{
|
||||
mp_view.reset (view);
|
||||
}
|
||||
|
|
@ -398,12 +398,12 @@ protected:
|
|||
void do_update_view ()
|
||||
{
|
||||
if (mp_view) {
|
||||
replace_image (mp_view.get (), id (), *this);
|
||||
replace_image_base (mp_view.get (), id (), *this);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
tl::weak_ptr<lay::LayoutView> mp_view;
|
||||
tl::weak_ptr<lay::LayoutViewBase> mp_view;
|
||||
tl::DeferredMethod<ImageRef> dm_update_view;
|
||||
};
|
||||
|
||||
|
|
@ -1073,7 +1073,7 @@ public:
|
|||
// .. nothing yet ..
|
||||
}
|
||||
|
||||
ImageRefIterator (const img::ImageIterator &iter, lay::LayoutView *view)
|
||||
ImageRefIterator (const img::ImageIterator &iter, lay::LayoutViewBase *view)
|
||||
: img::ImageIterator (iter), mp_view (view)
|
||||
{
|
||||
// .. nothing yet ..
|
||||
|
|
@ -1081,14 +1081,14 @@ public:
|
|||
|
||||
reference operator* () const
|
||||
{
|
||||
return reference (img::ImageIterator::operator* (), const_cast<lay::LayoutView * >(mp_view.get ()));
|
||||
return reference (img::ImageIterator::operator* (), const_cast<lay::LayoutViewBase * >(mp_view.get ()));
|
||||
}
|
||||
|
||||
private:
|
||||
tl::weak_ptr<lay::LayoutView> mp_view;
|
||||
tl::weak_ptr<lay::LayoutViewBase> mp_view;
|
||||
};
|
||||
|
||||
static void clear_images (lay::LayoutView *view)
|
||||
static void clear_images (lay::LayoutViewBase *view)
|
||||
{
|
||||
img::Service *img_service = view->get_plugin <img::Service> ();
|
||||
if (img_service) {
|
||||
|
|
@ -1096,14 +1096,14 @@ static void clear_images (lay::LayoutView *view)
|
|||
}
|
||||
}
|
||||
|
||||
static void show_image (lay::LayoutView *view, size_t id, bool visible)
|
||||
static void show_image (lay::LayoutViewBase *view, size_t id, bool visible)
|
||||
{
|
||||
img::Service *img_service = view->get_plugin <img::Service> ();
|
||||
if (img_service) {
|
||||
|
||||
const img::Object *img = img_service->object_by_id (id);
|
||||
if (img == 0) {
|
||||
throw tl::Exception (tl::to_string (QObject::tr ("The image Id is not valid")));
|
||||
throw tl::Exception (tl::to_string (tr ("The image Id is not valid")));
|
||||
}
|
||||
|
||||
img::Object new_img (*img);
|
||||
|
|
@ -1114,14 +1114,14 @@ static void show_image (lay::LayoutView *view, size_t id, bool visible)
|
|||
}
|
||||
}
|
||||
|
||||
static void replace_image (lay::LayoutView *view, size_t id, ImageRef &new_obj)
|
||||
void replace_image_base (lay::LayoutViewBase *view, size_t id, ImageRef &new_obj)
|
||||
{
|
||||
img::Service *img_service = view->get_plugin <img::Service> ();
|
||||
if (img_service) {
|
||||
|
||||
const img::Object *img = img_service->object_by_id (id);
|
||||
if (img == 0) {
|
||||
throw tl::Exception (tl::to_string (QObject::tr ("The image Id is not valid")));
|
||||
throw tl::Exception (tl::to_string (tr ("The image Id is not valid")));
|
||||
}
|
||||
|
||||
img_service->change_image_by_id (id, new_obj);
|
||||
|
|
@ -1129,14 +1129,19 @@ static void replace_image (lay::LayoutView *view, size_t id, ImageRef &new_obj)
|
|||
}
|
||||
}
|
||||
|
||||
static void erase_image (lay::LayoutView *view, size_t id)
|
||||
static void replace_image (lay::LayoutViewBase *view, size_t id, ImageRef &new_obj)
|
||||
{
|
||||
replace_image_base (view, id, new_obj);
|
||||
}
|
||||
|
||||
void erase_image_base (lay::LayoutViewBase *view, size_t id)
|
||||
{
|
||||
img::Service *img_service = view->get_plugin <img::Service> ();
|
||||
if (img_service) {
|
||||
|
||||
const img::Object *img = img_service->object_by_id (id);
|
||||
if (img == 0) {
|
||||
throw tl::Exception (tl::to_string (QObject::tr ("The image Id is not valid")));
|
||||
throw tl::Exception (tl::to_string (tr ("The image Id is not valid")));
|
||||
}
|
||||
|
||||
img_service->erase_image_by_id (id);
|
||||
|
|
@ -1144,10 +1149,15 @@ static void erase_image (lay::LayoutView *view, size_t id)
|
|||
}
|
||||
}
|
||||
|
||||
static void insert_image (lay::LayoutView *view, ImageRef &obj)
|
||||
static void erase_image (lay::LayoutViewBase *view, size_t id)
|
||||
{
|
||||
erase_image_base (view, id);
|
||||
}
|
||||
|
||||
static void insert_image (lay::LayoutViewBase *view, ImageRef &obj)
|
||||
{
|
||||
if (obj.is_valid ()) {
|
||||
throw tl::Exception (tl::to_string (QObject::tr ("The object is already inserted into a view - detach the object first or create a different object.")));
|
||||
throw tl::Exception (tl::to_string (tr ("The object is already inserted into a view - detach the object first or create a different object.")));
|
||||
}
|
||||
|
||||
img::Service *img_service = view->get_plugin <img::Service> ();
|
||||
|
|
@ -1158,7 +1168,7 @@ static void insert_image (lay::LayoutView *view, ImageRef &obj)
|
|||
}
|
||||
}
|
||||
|
||||
static ImageRef get_image (lay::LayoutView *view, size_t id)
|
||||
static ImageRef get_image (lay::LayoutViewBase *view, size_t id)
|
||||
{
|
||||
img::Service *img_service = view->get_plugin <img::Service> ();
|
||||
if (img_service) {
|
||||
|
|
@ -1171,28 +1181,28 @@ static ImageRef get_image (lay::LayoutView *view, size_t id)
|
|||
return ImageRef ();
|
||||
}
|
||||
|
||||
static tl::Event &get_images_changed_event (lay::LayoutView *view)
|
||||
static tl::Event &get_images_changed_event (lay::LayoutViewBase *view)
|
||||
{
|
||||
img::Service *img_service = view->get_plugin <img::Service> ();
|
||||
tl_assert (img_service != 0);
|
||||
return img_service->images_changed_event;
|
||||
}
|
||||
|
||||
static tl::Event &get_image_selection_changed_event (lay::LayoutView *view)
|
||||
static tl::Event &get_image_selection_changed_event (lay::LayoutViewBase *view)
|
||||
{
|
||||
img::Service *img_service = view->get_plugin <img::Service> ();
|
||||
tl_assert (img_service != 0);
|
||||
return img_service->image_selection_changed_event;
|
||||
}
|
||||
|
||||
static tl::event<int> &get_image_changed_event (lay::LayoutView *view)
|
||||
static tl::event<int> &get_image_changed_event (lay::LayoutViewBase *view)
|
||||
{
|
||||
img::Service *img_service = view->get_plugin <img::Service> ();
|
||||
tl_assert (img_service != 0);
|
||||
return img_service->image_changed_event;
|
||||
}
|
||||
|
||||
static ImageRefIterator begin_images (lay::LayoutView *view)
|
||||
static ImageRefIterator begin_images (lay::LayoutViewBase *view)
|
||||
{
|
||||
img::Service *img_service = view->get_plugin <img::Service> ();
|
||||
if (img_service) {
|
||||
|
|
@ -1203,7 +1213,7 @@ static ImageRefIterator begin_images (lay::LayoutView *view)
|
|||
}
|
||||
|
||||
static
|
||||
gsi::ClassExt<lay::LayoutView> layout_view_decl (
|
||||
gsi::ClassExt<lay::LayoutViewBase> layout_view_decl (
|
||||
gsi::method_ext ("clear_images", &gsi::clear_images,
|
||||
"@brief Clear all images on this view"
|
||||
) +
|
||||
|
|
@ -1332,7 +1342,7 @@ private:
|
|||
|
||||
// extend the layout view by "edtService" specific methods
|
||||
|
||||
static bool has_image_selection (const lay::LayoutView *view)
|
||||
static bool has_image_selection (const lay::LayoutViewBase *view)
|
||||
{
|
||||
std::vector<img::Service *> img = view->get_plugins <img::Service> ();
|
||||
for (std::vector<img::Service *>::const_iterator s = img.begin (); s != img.end (); ++s) {
|
||||
|
|
@ -1343,14 +1353,14 @@ static bool has_image_selection (const lay::LayoutView *view)
|
|||
return false;
|
||||
}
|
||||
|
||||
static SelectionIterator begin_images_selected (const lay::LayoutView *view)
|
||||
static SelectionIterator begin_images_selected (const lay::LayoutViewBase *view)
|
||||
{
|
||||
return SelectionIterator (view->get_plugins <img::Service> ());
|
||||
}
|
||||
|
||||
|
||||
static
|
||||
gsi::ClassExt<lay::LayoutView> layout_view_decl2 (
|
||||
gsi::ClassExt<lay::LayoutViewBase> layout_view_decl2 (
|
||||
gsi::method_ext ("has_image_selection?", &has_image_selection,
|
||||
"@brief Returns true, if images are selected in this view"
|
||||
"\n"
|
||||
|
|
|
|||
|
|
@ -6,36 +6,56 @@ include($$PWD/../../lib.pri)
|
|||
|
||||
DEFINES += MAKE_IMG_LIBRARY
|
||||
|
||||
HEADERS = \
|
||||
imgLandmarksDialog.h \
|
||||
imgNavigator.h \
|
||||
imgObject.h \
|
||||
imgPlugin.h \
|
||||
imgPropertiesPage.h \
|
||||
imgService.h \
|
||||
imgWidgets.h \
|
||||
imgForceLink.h \
|
||||
imgCommon.h \
|
||||
imgStream.h
|
||||
!equals(HAVE_QT, "0") {
|
||||
|
||||
FORMS = \
|
||||
AddNewImageDialog.ui \
|
||||
ImageLandmarksDialog.ui \
|
||||
ImagePropertiesPage.ui \
|
||||
|
||||
}
|
||||
|
||||
# Disabled without Qt:
|
||||
|
||||
HEADERS = \
|
||||
imgLandmarksDialog.h \
|
||||
imgNavigator.h \
|
||||
imgPropertiesPage.h \
|
||||
imgWidgets.h \
|
||||
|
||||
SOURCES = \
|
||||
gsiDeclImg.cc \
|
||||
imgLandmarksDialog.cc \
|
||||
imgNavigator.cc \
|
||||
imgPropertiesPage.cc \
|
||||
imgWidgets.cc \
|
||||
|
||||
# Enabled without Qt:
|
||||
|
||||
HEADERS += \
|
||||
imgObject.h \
|
||||
imgPlugin.h \
|
||||
imgService.h \
|
||||
imgForceLink.h \
|
||||
imgCommon.h \
|
||||
imgStream.h
|
||||
|
||||
SOURCES += \
|
||||
gsiDeclImg.cc \
|
||||
imgObject.cc \
|
||||
imgPlugin.cc \
|
||||
imgPropertiesPage.cc \
|
||||
imgService.cc \
|
||||
imgWidgets.cc \
|
||||
imgForceLink.cc \
|
||||
imgStream.cc
|
||||
imgStream.cc
|
||||
|
||||
INCLUDEPATH += $$TL_INC $$DB_INC $$GSI_INC $$LAYBASIC_INC $$DB_INC
|
||||
DEPENDPATH += $$TL_INC $$DB_INC $$GSI_INC $$LAYBASIC_INC $$DB_INC
|
||||
LIBS += -L$$DESTDIR -lklayout_tl -lklayout_db -lklayout_gsi -lklayout_laybasic -lklayout_db
|
||||
INCLUDEPATH += $$TL_INC $$DB_INC $$GSI_INC $$LAYBASIC_INC $$LAYVIEW_INC $$DB_INC
|
||||
DEPENDPATH += $$TL_INC $$DB_INC $$GSI_INC $$LAYBASIC_INC $$LAYVIEW_INC $$DB_INC
|
||||
LIBS += -L$$DESTDIR -lklayout_tl -lklayout_db -lklayout_gsi -lklayout_laybasic -lklayout_layview -lklayout_db
|
||||
|
||||
!equals(HAVE_QT, "0") {
|
||||
|
||||
INCLUDEPATH += $$LAYUI_INC
|
||||
DEPENDPATH += $$LAYUI_INC
|
||||
|
||||
LIBS += -lklayout_layui
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
but WITHOUT ANY WARRANTY; without even the implied warrimgy of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
|
|
@ -20,7 +20,6 @@
|
|||
|
||||
*/
|
||||
|
||||
|
||||
#include "imgForceLink.h"
|
||||
|
||||
namespace img
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
but WITHOUT ANY WARRANTY; without even the implied warrimgy of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
|
|
@ -33,7 +33,7 @@
|
|||
namespace img
|
||||
{
|
||||
IMG_PUBLIC int _force_link_f ();
|
||||
int _force_link_target = _force_link_f ();
|
||||
static int _force_link_target = _force_link_f ();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
*/
|
||||
|
||||
#if defined(HAVE_QT)
|
||||
|
||||
#include "imgLandmarksDialog.h"
|
||||
#include "imgService.h"
|
||||
|
|
@ -144,7 +145,7 @@ class LandmarkEditorService
|
|||
: public lay::ViewService
|
||||
{
|
||||
public:
|
||||
LandmarkEditorService (lay::LayoutView *view, img::Object *img)
|
||||
LandmarkEditorService (lay::LayoutViewBase *view, img::Object *img)
|
||||
: lay::ViewService (view->view_object_widget ()),
|
||||
mp_image (img), m_selected (-1), m_dragging (false),
|
||||
m_mode (LandmarksDialog::None)
|
||||
|
|
@ -345,7 +346,7 @@ public:
|
|||
widget ()->ungrab_mouse (this);
|
||||
}
|
||||
|
||||
void set_colors (QColor /*background*/, QColor /*color*/)
|
||||
void set_colors (lay::Color /*background*/, lay::Color /*color*/)
|
||||
{
|
||||
// ...
|
||||
}
|
||||
|
|
@ -499,3 +500,4 @@ LandmarksDialog::landmarks_updated ()
|
|||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
*/
|
||||
|
||||
#if defined(HAVE_QT)
|
||||
|
||||
#ifndef HDR_imgLandmarksDialog
|
||||
#define HDR_imgLandmarksDialog
|
||||
|
|
@ -65,3 +66,5 @@ private:
|
|||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
*/
|
||||
|
||||
#if defined(HAVE_QT)
|
||||
|
||||
#include "laybasicConfig.h"
|
||||
#include "layMarker.h"
|
||||
|
|
@ -113,3 +114,4 @@ Navigator::background_color (QColor c)
|
|||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
*/
|
||||
|
||||
#if defined(HAVE_QT)
|
||||
|
||||
#ifndef HDR_imgNavigator
|
||||
#define HDR_imgNavigator
|
||||
|
|
@ -54,7 +55,7 @@ public:
|
|||
void background_color (QColor c);
|
||||
img::Object *setup (lay::Dispatcher *root, img::Object *img);
|
||||
|
||||
lay::LayoutView *view ()
|
||||
lay::LayoutView *view ()
|
||||
{
|
||||
return mp_view;
|
||||
}
|
||||
|
|
@ -62,7 +63,7 @@ public:
|
|||
void activate_service (lay::ViewService *service);
|
||||
|
||||
private:
|
||||
lay::LayoutView *mp_view;
|
||||
lay::LayoutView *mp_view;
|
||||
lay::ZoomService *mp_zoom_service;
|
||||
};
|
||||
|
||||
|
|
@ -70,3 +71,4 @@ private:
|
|||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -22,15 +22,16 @@
|
|||
|
||||
|
||||
#include "imgObject.h"
|
||||
#include "imgWidgets.h" // for interpolate_color()
|
||||
#include "imgStream.h"
|
||||
#include "tlLog.h"
|
||||
#include "tlTimer.h"
|
||||
#include "layPlugin.h"
|
||||
#include "layConverters.h"
|
||||
#include "layPixelBuffer.h"
|
||||
#include "dbPolygonTools.h"
|
||||
#include "tlFileUtils.h"
|
||||
#include "tlUri.h"
|
||||
#include "tlThreads.h"
|
||||
|
||||
#include <cmath>
|
||||
#include <cstring>
|
||||
|
|
@ -39,8 +40,9 @@
|
|||
#include <string>
|
||||
#include <memory.h>
|
||||
|
||||
#include <QImage>
|
||||
#include <QMutex>
|
||||
#if defined(HAVE_QT)
|
||||
# include <QImage>
|
||||
#endif
|
||||
|
||||
namespace img
|
||||
{
|
||||
|
|
@ -51,8 +53,8 @@ namespace img
|
|||
DataMapping::DataMapping ()
|
||||
: brightness (0.0), contrast (0.0), gamma (1.0), red_gain (1.0), green_gain (1.0), blue_gain (1.0)
|
||||
{
|
||||
false_color_nodes.push_back (std::make_pair (0.0, std::make_pair (QColor (0, 0, 0), QColor (0, 0, 0))));
|
||||
false_color_nodes.push_back (std::make_pair (1.0, std::make_pair (QColor (255, 255, 255), QColor (255, 255, 255))));
|
||||
false_color_nodes.push_back (std::make_pair (0.0, std::make_pair (lay::Color (0, 0, 0), lay::Color (0, 0, 0))));
|
||||
false_color_nodes.push_back (std::make_pair (1.0, std::make_pair (lay::Color (255, 255, 255), lay::Color (255, 255, 255))));
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
@ -192,21 +194,25 @@ DataMapping::create_data_mapping (bool monochrome, double xmin, double xmax, uns
|
|||
|
||||
for (unsigned int i = 1; i < false_color_nodes.size (); ++i) {
|
||||
|
||||
int h1, s1, v1;
|
||||
false_color_nodes [i - 1].second.second.getHsv (&h1, &s1, &v1);
|
||||
unsigned int h1, s1, v1;
|
||||
false_color_nodes [i - 1].second.second.get_hsv (h1, s1, v1);
|
||||
|
||||
int h2, s2, v2;
|
||||
false_color_nodes [i].second.first.getHsv (&h2, &s2, &v2);
|
||||
unsigned int h2, s2, v2;
|
||||
false_color_nodes [i].second.first.get_hsv (h2, s2, v2);
|
||||
|
||||
int dh = int (h1) - int (h2);
|
||||
int ds = int (s1) - int (s2);
|
||||
int dv = int (v1) - int (v2);
|
||||
|
||||
// The number of steps is chosen such that the full HSV band divides into approximately 200 steps
|
||||
double nsteps = 0.5 * sqrt (double (h1 - h2) * double (h1 - h2) + double (s1 - s2) * double (s1 - s2) + double (v1 - v2) * double (v1 - v2));
|
||||
double nsteps = 0.5 * sqrt (double (dh * dh) + double (ds * ds) + double (dv * dv));
|
||||
int n = int (floor (nsteps + 1.0));
|
||||
double dx = (false_color_nodes [i].first - false_color_nodes [i - 1].first) / n;
|
||||
double x = false_color_nodes [i - 1].first;
|
||||
|
||||
for (int j = 0; j < n; ++j) {
|
||||
|
||||
QColor c = interpolated_color (false_color_nodes, x);
|
||||
lay::Color c = interpolated_color (false_color_nodes, x);
|
||||
|
||||
double y = 0.0;
|
||||
if (channel == 0) {
|
||||
|
|
@ -260,6 +266,57 @@ DataMapping::create_data_mapping (bool monochrome, double xmin, double xmax, uns
|
|||
return dm;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
struct compare_first_of_node
|
||||
{
|
||||
bool operator() (const std::pair <double, std::pair<lay::Color, lay::Color> > &a, const std::pair <double, std::pair<lay::Color, lay::Color> > &b) const
|
||||
{
|
||||
return a.first < b.first;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
lay::Color
|
||||
interpolated_color (const DataMapping::false_color_nodes_type &nodes, double x)
|
||||
{
|
||||
if (nodes.size () < 1) {
|
||||
return lay::Color ();
|
||||
} else if (nodes.size () < 2) {
|
||||
return x < nodes[0].first ? nodes[0].second.first : nodes[0].second.second;
|
||||
} else {
|
||||
|
||||
std::vector<std::pair<double, std::pair<lay::Color, lay::Color> > >::const_iterator p = std::lower_bound (nodes.begin (), nodes.end (), std::make_pair (x, std::make_pair (lay::Color (), lay::Color ())), compare_first_of_node ());
|
||||
if (p == nodes.end ()) {
|
||||
return nodes.back ().second.second;
|
||||
} else if (p == nodes.begin ()) {
|
||||
return nodes.front ().second.first;
|
||||
} else {
|
||||
|
||||
double x1 = p[-1].first;
|
||||
double x2 = p->first;
|
||||
|
||||
unsigned int h1 = 0, s1 = 0, v1 = 0;
|
||||
p[-1].second.second.get_hsv (h1, s1, v1);
|
||||
|
||||
unsigned int h2 = 0, s2 = 0, v2 = 0;
|
||||
p->second.first.get_hsv (h2, s2, v2);
|
||||
|
||||
int h = int (0.5 + h1 + double(x - x1) * double (int (h2) - int (h1)) / double(x2 - x1));
|
||||
int s = int (0.5 + s1 + double(x - x1) * double (int (s2) - int (s1)) / double(x2 - x1));
|
||||
int v = int (0.5 + v1 + double(x - x1) * double (int (v2) - int (v1)) / double(x2 - x1));
|
||||
|
||||
return lay::Color::from_hsv ((unsigned int) h, (unsigned int) s, (unsigned int) v);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
// img::DataHeader definition and implementation
|
||||
|
||||
|
|
@ -690,7 +747,7 @@ private:
|
|||
|
||||
static size_t make_id ()
|
||||
{
|
||||
static QMutex id_lock;
|
||||
static tl::Mutex id_lock;
|
||||
static size_t s_id_counter = 1;
|
||||
|
||||
// Get a new Id for the object. Id == 0 is reserved.
|
||||
|
|
@ -1283,7 +1340,7 @@ Object::from_string (const char *str, const char *base_dir)
|
|||
|
||||
double x = 0.0;
|
||||
lay::ColorConverter cc;
|
||||
QColor cl, cr;
|
||||
lay::Color cl, cr;
|
||||
std::string s;
|
||||
|
||||
m_data_mapping.false_color_nodes.clear ();
|
||||
|
|
@ -1506,6 +1563,8 @@ Object::read_file ()
|
|||
// continue with other formats ...
|
||||
}
|
||||
|
||||
#if defined(HAVE_QT)
|
||||
|
||||
QImage qimage (tl::to_qstring (m_filename));
|
||||
|
||||
if (! qimage.isNull ()) {
|
||||
|
|
@ -1566,6 +1625,85 @@ Object::read_file ()
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
#elif defined(HAVE_PNG)
|
||||
|
||||
lay::PixelBuffer img;
|
||||
|
||||
{
|
||||
tl::InputStream stream (m_filename);
|
||||
img = lay::PixelBuffer::read_png (stream);
|
||||
}
|
||||
|
||||
bool is_color = false;
|
||||
for (unsigned int i = 0; i < img.height () && ! is_color; ++i) {
|
||||
const lay::color_t *d = img.scan_line (i);
|
||||
const lay::color_t *dd = d + img.width ();
|
||||
while (! is_color && d != dd) {
|
||||
lay::color_t c = *d++;
|
||||
is_color = (((c >> 8) ^ c) & 0xffff) != 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (! m_min_value_set) {
|
||||
m_min_value = 0.0;
|
||||
}
|
||||
|
||||
if (! m_max_value_set) {
|
||||
m_max_value = 255.0;
|
||||
}
|
||||
|
||||
m_min_value_set = true;
|
||||
m_max_value_set = true;
|
||||
|
||||
unsigned int w = img.width (), h = img.height ();
|
||||
|
||||
mp_data = new DataHeader (w, h, is_color, true);
|
||||
mp_data->add_ref ();
|
||||
|
||||
if (is_color) {
|
||||
|
||||
unsigned char *red = mp_data->byte_data (0);
|
||||
unsigned char *green = mp_data->byte_data (1);
|
||||
unsigned char *blue = mp_data->byte_data (2);
|
||||
unsigned char *msk = img.transparent () ? mp_data->set_mask () : 0;
|
||||
|
||||
for (unsigned int y = 0; y < h; ++y) {
|
||||
const lay::color_t *d = img.scan_line (h - y - 1);
|
||||
const lay::color_t *dd = d + img.width ();
|
||||
while (d != dd) {
|
||||
lay::color_t rgb = *d++;
|
||||
*red++ = lay::red (rgb);
|
||||
*green++ = lay::green (rgb);
|
||||
*blue++ = lay::blue (rgb);
|
||||
if (msk) {
|
||||
*msk++ = lay::alpha (rgb) > 128;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
unsigned char *mono = mp_data->byte_data ();
|
||||
unsigned char *msk = img.transparent () ? mp_data->set_mask () : 0;
|
||||
|
||||
for (unsigned int y = 0; y < h; ++y) {
|
||||
const lay::color_t *d = img.scan_line (h - y - 1);
|
||||
const lay::color_t *dd = d + img.width ();
|
||||
while (d != dd) {
|
||||
lay::color_t rgb = *d++;
|
||||
*mono++ = lay::green (rgb);
|
||||
if (msk) {
|
||||
*msk++ = lay::alpha (rgb) > 128;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#else
|
||||
throw tl::Exception (tl::to_string ("No PNG support compiled in - cannot load PNG files"));
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -1654,7 +1792,7 @@ Object::to_string () const
|
|||
for (unsigned int i = 0; i < data_mapping ().false_color_nodes.size (); ++i) {
|
||||
os << data_mapping ().false_color_nodes[i].first;
|
||||
os << ",";
|
||||
const std::pair<QColor, QColor> &clr = data_mapping ().false_color_nodes[i].second;
|
||||
const std::pair<lay::Color, lay::Color> &clr = data_mapping ().false_color_nodes[i].second;
|
||||
os << tl::to_word_or_quoted_string (cc.to_string (clr.first));
|
||||
if (clr.first != clr.second) {
|
||||
os << ",";
|
||||
|
|
|
|||
|
|
@ -33,13 +33,11 @@
|
|||
#include "dbMatrix.h"
|
||||
#include "dbPolygon.h"
|
||||
#include "tlDataMapping.h"
|
||||
#include "layViewOp.h"
|
||||
#include "layColor.h"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <QColor>
|
||||
|
||||
namespace img {
|
||||
|
||||
class DataHeader;
|
||||
|
|
@ -52,7 +50,7 @@ class DataHeader;
|
|||
struct IMG_PUBLIC DataMapping
|
||||
{
|
||||
public:
|
||||
typedef std::vector< std::pair<double, std::pair<QColor, QColor> > > false_color_nodes_type;
|
||||
typedef std::vector< std::pair<double, std::pair<lay::Color, lay::Color> > > false_color_nodes_type;
|
||||
|
||||
/**
|
||||
* @brief The constructor
|
||||
|
|
@ -139,6 +137,11 @@ public:
|
|||
tl::DataMappingBase *create_data_mapping (bool monochrome, double xmin, double xmax, unsigned int channel) const;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief A helper function to interpolate a color in the color bar at a given x
|
||||
*/
|
||||
lay::Color interpolated_color (const DataMapping::false_color_nodes_type &nodes, double x);
|
||||
|
||||
/**
|
||||
* @brief A image object
|
||||
*
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@
|
|||
|
||||
|
||||
#include "layPlugin.h"
|
||||
#include "layAbstractMenu.h"
|
||||
#include "imgService.h"
|
||||
#include "imgPlugin.h"
|
||||
|
||||
|
|
@ -36,16 +35,16 @@ PluginDeclaration::get_menu_entries (std::vector<lay::MenuEntry> &menu_entries)
|
|||
{
|
||||
lay::PluginDeclaration::get_menu_entries (menu_entries);
|
||||
menu_entries.push_back (lay::separator ("image_group", "edit_menu.end"));
|
||||
menu_entries.push_back (lay::menu_item ("img::add_image", "add_image:edit", "edit_menu.end", tl::to_string (QObject::tr ("Add Image"))));
|
||||
menu_entries.push_back (lay::submenu ("img::image_menu", "image_menu:edit", "edit_menu.end", tl::to_string (QObject::tr ("Images"))));
|
||||
menu_entries.push_back (lay::menu_item ("img::bring_to_front", "bring_to_front:edit", "edit_menu.image_menu.end", tl::to_string (QObject::tr ("Image Stack: Selected Images to Front"))));
|
||||
menu_entries.push_back (lay::menu_item ("img::bring_to_back", "bring_to_back:edit", "edit_menu.image_menu.end", tl::to_string (QObject::tr ("Image Stack: Selected Images to Back"))));
|
||||
menu_entries.push_back (lay::menu_item ("img::clear_all_images", "clear_all_images:edit", "edit_menu.image_menu.end", tl::to_string (QObject::tr ("Clear All Images"))));
|
||||
menu_entries.push_back (lay::config_menu_item ("show_images", "view_menu.layout_group+", tl::to_string (QObject::tr ("Show Images")), cfg_images_visible, "?"));
|
||||
menu_entries.push_back (lay::menu_item ("img::add_image", "add_image:edit", "edit_menu.end", tl::to_string (tr ("Add Image"))));
|
||||
menu_entries.push_back (lay::submenu ("img::image_menu", "image_menu:edit", "edit_menu.end", tl::to_string (tr ("Images"))));
|
||||
menu_entries.push_back (lay::menu_item ("img::bring_to_front", "bring_to_front:edit", "edit_menu.image_menu.end", tl::to_string (tr ("Image Stack: Selected Images to Front"))));
|
||||
menu_entries.push_back (lay::menu_item ("img::bring_to_back", "bring_to_back:edit", "edit_menu.image_menu.end", tl::to_string (tr ("Image Stack: Selected Images to Back"))));
|
||||
menu_entries.push_back (lay::menu_item ("img::clear_all_images", "clear_all_images:edit", "edit_menu.image_menu.end", tl::to_string (tr ("Clear All Images"))));
|
||||
menu_entries.push_back (lay::config_menu_item ("show_images", "view_menu.layout_group+", tl::to_string (tr ("Show Images")), cfg_images_visible, "?"));
|
||||
}
|
||||
|
||||
lay::Plugin *
|
||||
PluginDeclaration::create_plugin (db::Manager *manager, lay::Dispatcher *, lay::LayoutView *view) const
|
||||
PluginDeclaration::create_plugin (db::Manager *manager, lay::Dispatcher *, lay::LayoutViewBase *view) const
|
||||
{
|
||||
return new img::Service (manager, view);
|
||||
}
|
||||
|
|
@ -53,7 +52,7 @@ PluginDeclaration::create_plugin (db::Manager *manager, lay::Dispatcher *, lay::
|
|||
bool
|
||||
PluginDeclaration::implements_editable (std::string &title) const
|
||||
{
|
||||
title = tl::to_string (QObject::tr ("Images"));
|
||||
title = tl::to_string (tr ("Images"));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ class PluginDeclaration
|
|||
{
|
||||
public:
|
||||
virtual void get_menu_entries (std::vector<lay::MenuEntry> &menu_entries) const;
|
||||
virtual lay::Plugin *create_plugin (db::Manager *manager, lay::Dispatcher *, lay::LayoutView *view) const;
|
||||
virtual lay::Plugin *create_plugin (db::Manager *manager, lay::Dispatcher *, lay::LayoutViewBase *view) const;
|
||||
virtual bool implements_editable (std::string &title) const;
|
||||
virtual void get_options (std::vector < std::pair<std::string, std::string> > &options) const;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
*/
|
||||
|
||||
#if defined(HAVE_QT)
|
||||
|
||||
#include "imgPropertiesPage.h"
|
||||
#include "imgLandmarksDialog.h"
|
||||
|
|
@ -735,9 +736,9 @@ PropertiesPage::blue_spinbox_changed (double value)
|
|||
void
|
||||
PropertiesPage::black_to_white ()
|
||||
{
|
||||
std::vector <std::pair <double, std::pair<QColor, QColor> > > nodes;
|
||||
nodes.push_back (std::make_pair (0.0, std::make_pair (QColor (0, 0, 0), QColor (0, 0, 0))));
|
||||
nodes.push_back (std::make_pair (1.0, std::make_pair (QColor (255, 255, 255), QColor (255, 255, 255))));
|
||||
std::vector <std::pair <double, std::pair<lay::Color, lay::Color> > > nodes;
|
||||
nodes.push_back (std::make_pair (0.0, std::make_pair (lay::Color (0, 0, 0), lay::Color (0, 0, 0))));
|
||||
nodes.push_back (std::make_pair (1.0, std::make_pair (lay::Color (255, 255, 255), lay::Color (255, 255, 255))));
|
||||
false_color_control->set_nodes (nodes);
|
||||
emit edited ();
|
||||
}
|
||||
|
|
@ -745,9 +746,9 @@ PropertiesPage::black_to_white ()
|
|||
void
|
||||
PropertiesPage::white_to_black ()
|
||||
{
|
||||
std::vector <std::pair <double, std::pair<QColor, QColor> > > nodes;
|
||||
nodes.push_back (std::make_pair (0.0, std::make_pair (QColor (255, 255, 255), QColor (255, 255, 255))));
|
||||
nodes.push_back (std::make_pair (1.0, std::make_pair (QColor (0, 0, 0), QColor (0, 0, 0))));
|
||||
std::vector <std::pair <double, std::pair<lay::Color, lay::Color> > > nodes;
|
||||
nodes.push_back (std::make_pair (0.0, std::make_pair (lay::Color (255, 255, 255), lay::Color (255, 255, 255))));
|
||||
nodes.push_back (std::make_pair (1.0, std::make_pair (lay::Color (0, 0, 0), lay::Color (0, 0, 0))));
|
||||
false_color_control->set_nodes (nodes);
|
||||
emit edited ();
|
||||
}
|
||||
|
|
@ -755,9 +756,9 @@ PropertiesPage::white_to_black ()
|
|||
void
|
||||
PropertiesPage::red_to_blue ()
|
||||
{
|
||||
std::vector <std::pair <double, std::pair<QColor, QColor> > > nodes;
|
||||
nodes.push_back (std::make_pair (0.0, std::make_pair (QColor (255, 0, 0), QColor (255, 0, 0))));
|
||||
nodes.push_back (std::make_pair (1.0, std::make_pair (QColor (0, 0, 255), QColor (0, 0, 255))));
|
||||
std::vector <std::pair <double, std::pair<lay::Color, lay::Color> > > nodes;
|
||||
nodes.push_back (std::make_pair (0.0, std::make_pair (lay::Color (255, 0, 0), lay::Color (255, 0, 0))));
|
||||
nodes.push_back (std::make_pair (1.0, std::make_pair (lay::Color (0, 0, 255), lay::Color (0, 0, 255))));
|
||||
false_color_control->set_nodes (nodes);
|
||||
emit edited ();
|
||||
}
|
||||
|
|
@ -765,9 +766,9 @@ PropertiesPage::red_to_blue ()
|
|||
void
|
||||
PropertiesPage::blue_to_red ()
|
||||
{
|
||||
std::vector <std::pair <double, std::pair<QColor, QColor> > > nodes;
|
||||
nodes.push_back (std::make_pair (0.0, std::make_pair (QColor (0, 0, 255), QColor (0, 0, 255))));
|
||||
nodes.push_back (std::make_pair (1.0, std::make_pair (QColor (255, 0, 0), QColor (255, 0, 0))));
|
||||
std::vector <std::pair <double, std::pair<lay::Color, lay::Color> > > nodes;
|
||||
nodes.push_back (std::make_pair (0.0, std::make_pair (lay::Color (0, 0, 255), lay::Color (0, 0, 255))));
|
||||
nodes.push_back (std::make_pair (1.0, std::make_pair (lay::Color (255, 0, 0), lay::Color (255, 0, 0))));
|
||||
false_color_control->set_nodes (nodes);
|
||||
emit edited ();
|
||||
}
|
||||
|
|
@ -775,7 +776,7 @@ PropertiesPage::blue_to_red ()
|
|||
void
|
||||
PropertiesPage::reverse_color_order ()
|
||||
{
|
||||
std::vector <std::pair <double, std::pair<QColor, QColor> > > nodes (false_color_control->nodes ());
|
||||
std::vector <std::pair <double, std::pair<lay::Color, lay::Color> > > nodes (false_color_control->nodes ());
|
||||
for (size_t i = 0; i < nodes.size () / 2; ++i) {
|
||||
std::swap (nodes [i].second.second, nodes [nodes.size () - 1 - i].second.first);
|
||||
std::swap (nodes [i].second.first, nodes [nodes.size () - 1 - i].second.second);
|
||||
|
|
@ -1003,3 +1004,4 @@ PropertiesPage::define_landmarks_pressed ()
|
|||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
*/
|
||||
|
||||
#if defined(HAVE_QT)
|
||||
|
||||
#ifndef HDR_imgPropertiesPage
|
||||
#define HDR_imgPropertiesPage
|
||||
|
|
@ -105,3 +106,5 @@ private:
|
|||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -30,24 +30,30 @@
|
|||
#include "layPlugin.h"
|
||||
#include "layRenderer.h"
|
||||
#include "laySnap.h"
|
||||
#include "layLayoutView.h"
|
||||
#include "layLayoutViewBase.h"
|
||||
#include "laybasicConfig.h"
|
||||
#include "layLayoutCanvas.h"
|
||||
#include "layProperties.h"
|
||||
#include "layTipDialog.h"
|
||||
#if defined(HAVE_QT)
|
||||
# include "layProperties.h"
|
||||
# include "layTipDialog.h"
|
||||
#endif
|
||||
#include "tlExceptions.h"
|
||||
#include "imgService.h"
|
||||
#include "imgPlugin.h"
|
||||
#include "ui_AddNewImageDialog.h"
|
||||
#if defined(HAVE_QT)
|
||||
# include "ui_AddNewImageDialog.h"
|
||||
#endif
|
||||
|
||||
#include <QApplication>
|
||||
#if defined(HAVE_QT)
|
||||
# include <QApplication>
|
||||
#endif
|
||||
|
||||
namespace img
|
||||
{
|
||||
|
||||
// -------------------------------------------------------------
|
||||
|
||||
class AddNewImageDialog
|
||||
#if defined(HAVE_QT)
|
||||
class AddNewImageDialog
|
||||
: public QDialog,
|
||||
public Ui::AddNewImageDialog
|
||||
{
|
||||
|
|
@ -68,7 +74,7 @@ public:
|
|||
properties_frame->apply ();
|
||||
|
||||
if (mp_image_object->is_empty ()) {
|
||||
throw tl::Exception (tl::to_string (QObject::tr ("No data loaded for that image")));
|
||||
throw tl::Exception (tl::to_string (tr ("No data loaded for that image")));
|
||||
}
|
||||
|
||||
QDialog::accept ();
|
||||
|
|
@ -79,11 +85,12 @@ public:
|
|||
private:
|
||||
img::Object *mp_image_object;
|
||||
};
|
||||
#endif
|
||||
|
||||
// -------------------------------------------------------------
|
||||
|
||||
static void
|
||||
draw_scanline (unsigned int level, const img::Object &image_object, QImage &qimage, int y, const db::Matrix3d &t, const db::Matrix3d &it, const db::DPoint &q1, const db::DPoint &q2)
|
||||
draw_scanline (unsigned int level, const img::Object &image_object, lay::PixelBuffer &pxbuffer, int y, const db::Matrix3d &t, const db::Matrix3d &it, const db::DPoint &q1, const db::DPoint &q2)
|
||||
{
|
||||
double source_width = image_object.width ();
|
||||
double source_height = image_object.height ();
|
||||
|
|
@ -95,8 +102,8 @@ draw_scanline (unsigned int level, const img::Object &image_object, QImage &qima
|
|||
std::swap (x1, x2);
|
||||
}
|
||||
|
||||
int xstart = int (std::max (0.0, std::min (floor (x1), double (qimage.width ()))));
|
||||
int xstop = int (std::max (0.0, std::min (ceil (x2) + 1.0, double (qimage.width ()))));
|
||||
int xstart = int (std::max (0.0, std::min (floor (x1), double (pxbuffer.width ()))));
|
||||
int xstop = int (std::max (0.0, std::min (ceil (x2) + 1.0, double (pxbuffer.width ()))));
|
||||
|
||||
db::DPoint p1 = it.trans (db::DPoint (xstart, y));
|
||||
db::DPoint p2 = it.trans (db::DPoint (xstop, y));
|
||||
|
|
@ -106,8 +113,8 @@ draw_scanline (unsigned int level, const img::Object &image_object, QImage &qima
|
|||
|
||||
if (level < 7 && xstop > xstart + 1 && fabs (xm - (xstart + xstop) / 2) > 1.0 && xm > xstart + 1 && xm < xstop - 1) {
|
||||
|
||||
draw_scanline (level + 1, image_object, qimage, y, t, it, q1, qm);
|
||||
draw_scanline (level + 1, image_object, qimage, y, t, it, qm, q2);
|
||||
draw_scanline (level + 1, image_object, pxbuffer, y, t, it, q1, qm);
|
||||
draw_scanline (level + 1, image_object, pxbuffer, y, t, it, qm, q2);
|
||||
|
||||
} else {
|
||||
|
||||
|
|
@ -115,8 +122,8 @@ draw_scanline (unsigned int level, const img::Object &image_object, QImage &qima
|
|||
double dpx = (p2.x () - p1.x ()) / double (xstop - xstart);
|
||||
double dpy = (p2.y () - p1.y ()) / double (xstop - xstart);
|
||||
|
||||
QRgb *scanline_data = (QRgb *) qimage.scanLine (qimage.height () - y - 1) + xstart;
|
||||
QRgb *pixel_data = (QRgb *) image_object.pixel_data ();
|
||||
lay::color_t *scanline_data = pxbuffer.scan_line (pxbuffer.height () - y - 1) + xstart;
|
||||
lay::color_t *pixel_data = (lay::color_t *) image_object.pixel_data ();
|
||||
const unsigned char *mask_data = image_object.mask ();
|
||||
|
||||
for (int x = xstart; x < xstop; ++x) {
|
||||
|
|
@ -144,15 +151,15 @@ draw_image (const img::Object &image_object, const lay::Viewport &vp, lay::ViewO
|
|||
{
|
||||
// TODO: currently, the images can only be rendered to a bitmap canvas ..
|
||||
lay::BitmapViewObjectCanvas *bmp_canvas = dynamic_cast<lay::BitmapViewObjectCanvas *> (&canvas);
|
||||
if (! bmp_canvas) {
|
||||
if (! bmp_canvas || ! bmp_canvas->bg_image ()) {
|
||||
return;
|
||||
}
|
||||
|
||||
QImage &qimage = bmp_canvas->bg_image ();
|
||||
lay::PixelBuffer &image = *bmp_canvas->bg_image ();
|
||||
db::DBox source_image_box (0.0, 0.0, image_object.width (), image_object.height ());
|
||||
|
||||
// safety measure to avoid division by zero.
|
||||
if (qimage.width () < 1 || qimage.height () < 1) {
|
||||
if (image.width () < 1 || image.height () < 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -165,7 +172,7 @@ draw_image (const img::Object &image_object, const lay::Viewport &vp, lay::ViewO
|
|||
db::DBox image_box = source_image_box.transformed (t);
|
||||
|
||||
int y1 = int (floor (std::max (0.0, image_box.bottom ())));
|
||||
int y2 = int (floor (std::min (double (qimage.height ()) - 1, image_box.top ())));
|
||||
int y2 = int (floor (std::min (double (image.height ()) - 1, image_box.top ())));
|
||||
|
||||
for (int y = y1; y <= y2; ++y) {
|
||||
|
||||
|
|
@ -175,7 +182,7 @@ draw_image (const img::Object &image_object, const lay::Viewport &vp, lay::ViewO
|
|||
// clip the transformed scanline to the original image
|
||||
std::pair<bool, db::DEdge> clipped = scanline.clipped_line (source_image_box);
|
||||
if (clipped.first) {
|
||||
draw_scanline (0, image_object, qimage, y, t, it, clipped.second.p1 (), clipped.second.p2 ());
|
||||
draw_scanline (0, image_object, image, y, t, it, clipped.second.p1 (), clipped.second.p2 ());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -402,7 +409,7 @@ View::render (const lay::Viewport &vp, lay::ViewObjectCanvas &canvas)
|
|||
// -------------------------------------------------------------
|
||||
// img::Service implementation
|
||||
|
||||
Service::Service (db::Manager *manager, lay::LayoutView *view)
|
||||
Service::Service (db::Manager *manager, lay::LayoutViewBase *view)
|
||||
: lay::BackgroundViewObject (view->view_object_widget ()),
|
||||
lay::Editable (view),
|
||||
lay::Plugin (view),
|
||||
|
|
@ -1361,19 +1368,21 @@ Service::display_status (bool transient)
|
|||
|
||||
std::string msg;
|
||||
if (! transient) {
|
||||
msg = tl::to_string (QObject::tr ("selected: "));
|
||||
msg = tl::to_string (tr ("selected: "));
|
||||
}
|
||||
msg += tl::sprintf (tl::to_string (QObject::tr ("image(%dx%d)")), image->width (), image->height ());
|
||||
msg += tl::sprintf (tl::to_string (tr ("image(%dx%d)")), image->width (), image->height ());
|
||||
view ()->message (msg);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(HAVE_QT)
|
||||
lay::PropertiesPage *
|
||||
Service::properties_page (db::Manager *manager, QWidget *parent)
|
||||
{
|
||||
return new img::PropertiesPage (this, manager, parent);
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
Service::get_selection (std::vector <obj_iterator> &sel) const
|
||||
|
|
@ -1463,15 +1472,16 @@ Service::menu_activated (const std::string &symbol)
|
|||
{
|
||||
if (symbol == "img::clear_all_images") {
|
||||
|
||||
manager ()->transaction (tl::to_string (QObject::tr ("Clear all images")));
|
||||
manager ()->transaction (tl::to_string (tr ("Clear all images")));
|
||||
clear_images ();
|
||||
manager ()->commit ();
|
||||
|
||||
} else if (symbol == "img::add_image") {
|
||||
|
||||
#if defined(HAVE_QT)
|
||||
if (! images_visible ()) {
|
||||
lay::TipDialog td (QApplication::activeWindow (),
|
||||
tl::to_string (QObject::tr ("Images are not visible. If you add an image you will not see it.\n\n"
|
||||
tl::to_string (tr ("Images are not visible. If you add an image you will not see it.\n\n"
|
||||
"Choose 'View/Show Images' to make images visible.")),
|
||||
"add-image-while-not-visible",
|
||||
lay::TipDialog::okcancel_buttons);
|
||||
|
|
@ -1482,6 +1492,7 @@ Service::menu_activated (const std::string &symbol)
|
|||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
add_image ();
|
||||
|
||||
|
|
@ -1573,6 +1584,7 @@ Service::top_z_position () const
|
|||
void
|
||||
Service::add_image ()
|
||||
{
|
||||
#if defined(HAVE_QT)
|
||||
img::Object *new_image = new img::Object ();
|
||||
|
||||
AddNewImageDialog dialog (QApplication::activeWindow (), new_image);
|
||||
|
|
@ -1580,7 +1592,7 @@ Service::add_image ()
|
|||
|
||||
clear_selection ();
|
||||
|
||||
manager ()->transaction (tl::to_string (QObject::tr ("Add image")));
|
||||
manager ()->transaction (tl::to_string (tr ("Add image")));
|
||||
new_image->set_z_position (top_z_position ());
|
||||
mp_view->annotation_shapes ().insert (db::DUserObject (new_image));
|
||||
manager ()->commit ();
|
||||
|
|
@ -1588,6 +1600,7 @@ Service::add_image ()
|
|||
} else {
|
||||
delete new_image;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
|
|
@ -203,7 +203,7 @@ public:
|
|||
typedef lay::AnnotationShapes::iterator obj_iterator;
|
||||
enum MoveMode { move_none, move_selected, move_landmark, move_l, move_r, move_t, move_b, move_lr, move_tr, move_ll, move_tl, move_all };
|
||||
|
||||
Service (db::Manager *manager, lay::LayoutView *view);
|
||||
Service (db::Manager *manager, lay::LayoutViewBase *view);
|
||||
|
||||
~Service ();
|
||||
|
||||
|
|
@ -369,10 +369,12 @@ public:
|
|||
*/
|
||||
virtual void transform (const db::DCplxTrans &trans);
|
||||
|
||||
#if defined(HAVE_QT)
|
||||
/**
|
||||
* @brief Create the properties page
|
||||
*/
|
||||
virtual lay::PropertiesPage *properties_page (db::Manager *manager, QWidget *parent);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Get the selection for the properties page
|
||||
|
|
@ -432,7 +434,7 @@ public:
|
|||
/**
|
||||
* @brief Access to the view object
|
||||
*/
|
||||
lay::LayoutView *view () const
|
||||
lay::LayoutViewBase *view () const
|
||||
{
|
||||
return mp_view;
|
||||
}
|
||||
|
|
@ -480,7 +482,7 @@ public:
|
|||
|
||||
private:
|
||||
// The layout view that the image service is attached to
|
||||
lay::LayoutView *mp_view;
|
||||
lay::LayoutViewBase *mp_view;
|
||||
|
||||
// The view objects representing the selection and the moved images in move mode
|
||||
std::vector<View *> m_selected_image_views;
|
||||
|
|
|
|||
|
|
@ -373,7 +373,7 @@ namespace {
|
|||
|
||||
struct ColorMapConverter
|
||||
{
|
||||
std::string to_string (const std::pair<double, std::pair<QColor, QColor> > &cm) const
|
||||
std::string to_string (const std::pair<double, std::pair<lay::Color, lay::Color> > &cm) const
|
||||
{
|
||||
std::string s;
|
||||
s = tl::to_string (cm.first);
|
||||
|
|
@ -389,7 +389,7 @@ namespace {
|
|||
return s;
|
||||
}
|
||||
|
||||
void from_string (const std::string &s, std::pair<double, std::pair<QColor, QColor> > &cm) const
|
||||
void from_string (const std::string &s, std::pair<double, std::pair<lay::Color, lay::Color> > &cm) const
|
||||
{
|
||||
tl::Extractor ex (s.c_str ());
|
||||
|
||||
|
|
@ -427,7 +427,7 @@ tl::XMLStruct<ImageProxy> s_img_structure ("image-data",
|
|||
tl::make_member (&ImageProxy::max_value, &ImageProxy::set_max_value, "max-value") +
|
||||
tl::make_element (&ImageProxy::data_mapping, &ImageProxy::set_data_mapping, "data-mapping",
|
||||
tl::make_element (&img::DataMapping::false_color_nodes, "color-map",
|
||||
tl::make_member<std::pair<double, std::pair<QColor, QColor> >, img::DataMapping::false_color_nodes_type::const_iterator, img::DataMapping::false_color_nodes_type, ColorMapConverter> (&img::DataMapping::false_color_nodes_type::begin, &img::DataMapping::false_color_nodes_type::end, &img::DataMapping::false_color_nodes_type::push_back, "color-map-entry", ColorMapConverter ())
|
||||
tl::make_member<std::pair<double, std::pair<lay::Color, lay::Color> >, img::DataMapping::false_color_nodes_type::const_iterator, img::DataMapping::false_color_nodes_type, ColorMapConverter> (&img::DataMapping::false_color_nodes_type::begin, &img::DataMapping::false_color_nodes_type::end, &img::DataMapping::false_color_nodes_type::push_back, "color-map-entry", ColorMapConverter ())
|
||||
) +
|
||||
tl::make_member (&img::DataMapping::brightness, "brightness") +
|
||||
tl::make_member (&img::DataMapping::contrast, "contrast") +
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
*/
|
||||
|
||||
#if defined(HAVE_QT)
|
||||
|
||||
#include "imgWidgets.h"
|
||||
|
||||
|
|
@ -44,52 +45,6 @@ const int min_bar_height = 4;
|
|||
const double min_value_interval = 1e-3;
|
||||
const double epsilon = 1e-6;
|
||||
|
||||
struct compare_first_of_node
|
||||
{
|
||||
bool operator() (const std::pair <double, std::pair<QColor, QColor> > &a, const std::pair <double, std::pair<QColor, QColor> > &b) const
|
||||
{
|
||||
return a.first < b.first;
|
||||
}
|
||||
};
|
||||
|
||||
QColor
|
||||
interpolated_color (const std::vector<std::pair <double, std::pair<QColor, QColor> > > &nodes, double x)
|
||||
{
|
||||
if (nodes.size () < 1) {
|
||||
return QColor ();
|
||||
} else if (nodes.size () < 2) {
|
||||
return x < nodes[0].first ? nodes[0].second.first : nodes[0].second.second;
|
||||
} else {
|
||||
|
||||
std::vector<std::pair<double, std::pair<QColor, QColor> > >::const_iterator p = std::lower_bound (nodes.begin (), nodes.end (), std::make_pair (x, std::make_pair (QColor (), QColor ())), compare_first_of_node ());
|
||||
if (p == nodes.end ()) {
|
||||
return nodes.back ().second.second;
|
||||
} else if (p == nodes.begin ()) {
|
||||
return nodes.front ().second.first;
|
||||
} else {
|
||||
|
||||
double x1 = p[-1].first;
|
||||
double x2 = p->first;
|
||||
|
||||
int h1 = 0, s1 = 0, v1 = 0;
|
||||
p[-1].second.second.getHsv (&h1, &s1, &v1);
|
||||
|
||||
int h2 = 0, s2 = 0, v2 = 0;
|
||||
p->second.first.getHsv (&h2, &s2, &v2);
|
||||
|
||||
int h = int (0.5 + h1 + double(x - x1) * double (h2 - h1) / double(x2 - x1));
|
||||
int s = int (0.5 + s1 + double(x - x1) * double (s2 - s1) / double(x2 - x1));
|
||||
int v = int (0.5 + v1 + double(x - x1) * double (v2 - v1) / double(x2 - x1));
|
||||
|
||||
QColor r;
|
||||
r.setHsv (h, s, v);
|
||||
return r;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
TwoColorWidget::TwoColorWidget (QWidget *parent)
|
||||
|
|
@ -173,8 +128,8 @@ TwoColorWidget::lock_changed (bool checked)
|
|||
ColorBar::ColorBar (QWidget *parent)
|
||||
: QWidget (parent), m_dragging (false), m_selected (-1)
|
||||
{
|
||||
m_nodes.push_back (std::make_pair (0.0, std::make_pair (QColor (0, 0, 0), QColor (0, 0, 0))));
|
||||
m_nodes.push_back (std::make_pair (1.0, std::make_pair (QColor (255, 255, 255), QColor (255, 255, 255))));
|
||||
m_nodes.push_back (std::make_pair (0.0, std::make_pair (lay::Color (0, 0, 0), lay::Color (0, 0, 0))));
|
||||
m_nodes.push_back (std::make_pair (1.0, std::make_pair (lay::Color (255, 255, 255), lay::Color (255, 255, 255))));
|
||||
}
|
||||
|
||||
ColorBar::~ColorBar ()
|
||||
|
|
@ -206,7 +161,7 @@ void
|
|||
ColorBar::set_current_color (std::pair<QColor, QColor> c)
|
||||
{
|
||||
if (has_selection ()) {
|
||||
m_nodes [m_selected].second = c;
|
||||
m_nodes [m_selected].second = std::make_pair (lay::Color (c.first.rgb ()), lay::Color (c.second.rgb ()));
|
||||
emit color_mapping_changed ();
|
||||
update ();
|
||||
}
|
||||
|
|
@ -260,22 +215,35 @@ ColorBar::keyPressEvent (QKeyEvent *event)
|
|||
}
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
struct compare_first_of_node
|
||||
{
|
||||
bool operator() (const std::pair <double, std::pair<lay::Color, lay::Color> > &a, const std::pair <double, std::pair<lay::Color, lay::Color> > &b) const
|
||||
{
|
||||
return a.first < b.first;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
ColorBar::set_nodes (const std::vector<std::pair<double, std::pair<QColor, QColor> > > &nodes)
|
||||
ColorBar::set_nodes (const std::vector<std::pair<double, std::pair<lay::Color, lay::Color> > > &nodes)
|
||||
{
|
||||
m_nodes = nodes;
|
||||
|
||||
std::sort (m_nodes.begin (), m_nodes.end (), compare_first_of_node ());
|
||||
|
||||
if (m_nodes.size () == 0 || fabs (m_nodes[0].first) > epsilon) {
|
||||
m_nodes.insert (m_nodes.begin (), std::make_pair (0.0, std::make_pair (QColor (0, 0, 0), QColor (0, 0, 0))));
|
||||
m_nodes.insert (m_nodes.begin (), std::make_pair (0.0, std::make_pair (lay::Color (0, 0, 0), lay::Color (0, 0, 0))));
|
||||
} else {
|
||||
m_nodes[0].first = 0.0;
|
||||
}
|
||||
|
||||
std::vector <std::pair <double, std::pair<QColor, QColor> > >::iterator w = m_nodes.begin ();
|
||||
std::vector <std::pair <double, std::pair<QColor, QColor> > >::const_iterator nn = m_nodes.begin ();
|
||||
for (std::vector <std::pair <double, std::pair<QColor, QColor> > >::const_iterator n = m_nodes.begin () + 1; n != m_nodes.end (); ++n) {
|
||||
std::vector <std::pair <double, std::pair<lay::Color, lay::Color> > >::iterator w = m_nodes.begin ();
|
||||
std::vector <std::pair <double, std::pair<lay::Color, lay::Color> > >::const_iterator nn = m_nodes.begin ();
|
||||
for (std::vector <std::pair <double, std::pair<lay::Color, lay::Color> > >::const_iterator n = m_nodes.begin () + 1; n != m_nodes.end (); ++n) {
|
||||
if (fabs (nn->first - n->first) > min_value_interval) {
|
||||
*w++ = *nn;
|
||||
nn = n;
|
||||
|
|
@ -288,7 +256,7 @@ ColorBar::set_nodes (const std::vector<std::pair<double, std::pair<QColor, QColo
|
|||
if (m_nodes.back ().first > 1.0 - min_value_interval) {
|
||||
m_nodes.back ().first = 1.0;
|
||||
} else {
|
||||
m_nodes.push_back (std::make_pair (1.0, std::make_pair (QColor (255, 255, 255), QColor (255, 255, 255))));
|
||||
m_nodes.push_back (std::make_pair (1.0, std::make_pair (lay::Color (255, 255, 255), lay::Color (255, 255, 255))));
|
||||
}
|
||||
|
||||
m_selected = -1;
|
||||
|
|
@ -313,8 +281,8 @@ ColorBar::mousePressEvent (QMouseEvent *event)
|
|||
double xx = double (event->x () - xl) / double (xr - xl);
|
||||
|
||||
double dmin = 100.0;
|
||||
std::vector<std::pair<double, std::pair<QColor, QColor> > >::const_iterator pmin = m_nodes.end ();
|
||||
for (std::vector<std::pair<double, std::pair<QColor, QColor> > >::const_iterator p = m_nodes.begin (); p != m_nodes.end (); ++p) {
|
||||
std::vector<std::pair<double, std::pair<lay::Color, lay::Color> > >::const_iterator pmin = m_nodes.end ();
|
||||
for (std::vector<std::pair<double, std::pair<lay::Color, lay::Color> > >::const_iterator p = m_nodes.begin (); p != m_nodes.end (); ++p) {
|
||||
double d = fabs (p->first - xx);
|
||||
if (d < 0.05 && d < dmin) {
|
||||
dmin = d;
|
||||
|
|
@ -323,9 +291,10 @@ ColorBar::mousePressEvent (QMouseEvent *event)
|
|||
}
|
||||
|
||||
if (pmin != m_nodes.end ()) {
|
||||
m_selected = int (std::distance (std::vector<std::pair<double, std::pair<QColor, QColor> > >::const_iterator (m_nodes.begin ()), pmin));
|
||||
m_selected = int (std::distance (std::vector<std::pair<double, std::pair<lay::Color, lay::Color> > >::const_iterator (m_nodes.begin ()), pmin));
|
||||
emit selection_changed ();
|
||||
emit selection_changed (m_nodes [m_selected].second);
|
||||
std::pair<lay::Color, lay::Color> cp = m_nodes [m_selected].second;
|
||||
emit selection_changed (std::make_pair (QColor (cp.first.rgb ()), QColor (cp.second.rgb ())));
|
||||
m_dragging = true;
|
||||
update ();
|
||||
} else {
|
||||
|
|
@ -359,13 +328,14 @@ ColorBar::mouseDoubleClickEvent (QMouseEvent *event)
|
|||
|
||||
double xx = double (event->x () - xl) / double (xr - xl);
|
||||
|
||||
std::vector<std::pair<double, std::pair<QColor, QColor> > >::iterator p = std::lower_bound (m_nodes.begin (), m_nodes.end (), std::make_pair (xx, std::make_pair (QColor (), QColor ())), compare_first_of_node ());
|
||||
std::vector<std::pair<double, std::pair<lay::Color, lay::Color> > >::iterator p = std::lower_bound (m_nodes.begin (), m_nodes.end (), std::make_pair (xx, std::make_pair (lay::Color (), lay::Color ())), compare_first_of_node ());
|
||||
if (p != m_nodes.begin () && p != m_nodes.end ()) {
|
||||
m_selected = int (std::distance (m_nodes.begin (), p));
|
||||
QColor ci = interpolated_color (m_nodes, xx);
|
||||
lay::Color ci = interpolated_color (m_nodes, xx);
|
||||
m_nodes.insert (p, std::make_pair (xx, std::make_pair (ci, ci)));
|
||||
emit selection_changed ();
|
||||
emit selection_changed (m_nodes [m_selected].second);
|
||||
std::pair<lay::Color, lay::Color> cp = m_nodes [m_selected].second;
|
||||
emit selection_changed (std::make_pair (QColor (cp.first.rgb ()), QColor (cp.second.rgb ())));
|
||||
emit color_mapping_changed ();
|
||||
update ();
|
||||
}
|
||||
|
|
@ -440,9 +410,9 @@ ColorBar::paintEvent (QPaintEvent *)
|
|||
if (xr != xl) {
|
||||
xx = double (x - xl) / double (xr - xl);
|
||||
}
|
||||
QColor c = interpolated_color (m_nodes, xx);
|
||||
lay::Color c = interpolated_color (m_nodes, xx);
|
||||
|
||||
painter.fillRect (x, yb - hbar, 1, hbar + 1, QBrush (c));
|
||||
painter.fillRect (x, yb - hbar, 1, hbar + 1, QBrush (QColor (c.rgb ())));
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -483,3 +453,5 @@ ColorBar::paintEvent (QPaintEvent *)
|
|||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -20,10 +20,14 @@
|
|||
|
||||
*/
|
||||
|
||||
#if defined(HAVE_QT)
|
||||
|
||||
#ifndef HDR_imgWidgets
|
||||
#define HDR_imgWidgets
|
||||
|
||||
#include "layWidgets.h"
|
||||
#include "layColor.h"
|
||||
#include "imgObject.h"
|
||||
|
||||
#include <QObject>
|
||||
#include <QWidget>
|
||||
|
|
@ -38,13 +42,6 @@ class QPaintEvent;
|
|||
namespace img
|
||||
{
|
||||
|
||||
/**
|
||||
* @brief A helper function to interpolate a color in the color bar at a given x
|
||||
*
|
||||
* TODO: move this somewhere else.
|
||||
*/
|
||||
QColor interpolated_color (const std::vector<std::pair <double, std::pair<QColor, QColor> > > &nodes, double x);
|
||||
|
||||
/**
|
||||
* @brief A two-color widget
|
||||
*
|
||||
|
|
@ -114,9 +111,9 @@ public:
|
|||
return m_selected >= 0;
|
||||
}
|
||||
|
||||
void set_nodes (const std::vector <std::pair <double, std::pair<QColor, QColor> > > &nodes);
|
||||
void set_nodes (const std::vector <std::pair <double, std::pair<lay::Color, lay::Color> > > &nodes);
|
||||
|
||||
const std::vector <std::pair <double, std::pair<QColor, QColor> > > &nodes () const
|
||||
const std::vector <std::pair <double, std::pair<lay::Color, lay::Color> > > &nodes () const
|
||||
{
|
||||
return m_nodes;
|
||||
}
|
||||
|
|
@ -135,7 +132,7 @@ signals:
|
|||
private:
|
||||
bool m_dragging;
|
||||
int m_selected;
|
||||
std::vector <std::pair <double, std::pair<QColor, QColor> > > m_nodes;
|
||||
std::vector <std::pair <double, std::pair<lay::Color, lay::Color> > > m_nodes;
|
||||
std::vector <size_t> m_histogram;
|
||||
};
|
||||
|
||||
|
|
@ -143,3 +140,4 @@ private:
|
|||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -45,9 +45,9 @@ TEST(1_FloatMono)
|
|||
dm.gamma = 1.5;
|
||||
dm.brightness = 1.25;
|
||||
dm.false_color_nodes.clear ();
|
||||
dm.false_color_nodes.push_back (std::make_pair (0.0, std::make_pair (QColor (0, 0, 0), QColor (0, 0, 0))));
|
||||
dm.false_color_nodes.push_back (std::make_pair (0.5, std::make_pair (QColor (255, 0, 0), QColor (0, 255, 0))));
|
||||
dm.false_color_nodes.push_back (std::make_pair (1.0, std::make_pair (QColor (255, 255, 255), QColor (255, 255, 255))));
|
||||
dm.false_color_nodes.push_back (std::make_pair (0.0, std::make_pair (lay::Color (0, 0, 0), lay::Color (0, 0, 0))));
|
||||
dm.false_color_nodes.push_back (std::make_pair (0.5, std::make_pair (lay::Color (255, 0, 0), lay::Color (0, 255, 0))));
|
||||
dm.false_color_nodes.push_back (std::make_pair (1.0, std::make_pair (lay::Color (255, 255, 255), lay::Color (255, 255, 255))));
|
||||
image.set_data_mapping (dm);
|
||||
|
||||
image.set_pixel (0, 0, 0.25);
|
||||
|
|
|
|||
|
|
@ -101,8 +101,8 @@ TEST(1)
|
|||
dm.red_gain = 1.25;
|
||||
dm.green_gain = 0.75;
|
||||
dm.blue_gain = 2.5;
|
||||
QColor c (128, 255, 64);
|
||||
QColor c2 (64, 32, 192);
|
||||
lay::Color c (128, 255, 64);
|
||||
lay::Color c2 (64, 32, 192);
|
||||
dm.false_color_nodes.insert (dm.false_color_nodes.begin () + 1, std::make_pair (0.5, std::make_pair (c, c)));
|
||||
image.set_data_mapping (dm);
|
||||
EXPECT_EQ (copy1.equals (&image), false);
|
||||
|
|
@ -226,7 +226,7 @@ TEST(2)
|
|||
dm.red_gain = 1.25;
|
||||
dm.green_gain = 0.75;
|
||||
dm.blue_gain = 2.5;
|
||||
QColor c (128, 255, 64);
|
||||
lay::Color c (128, 255, 64);
|
||||
dm.false_color_nodes.insert (dm.false_color_nodes.begin () + 1, std::make_pair (0.5, std::make_pair (c, c)));
|
||||
image.set_data_mapping (dm);
|
||||
EXPECT_EQ (copy1.equals (&image), false);
|
||||
|
|
|
|||
|
|
@ -11,8 +11,10 @@ RDB_INC = $$PWD/rdb/rdb
|
|||
IMG_INC = $$PWD/img/img
|
||||
LYM_INC = $$PWD/lym/lym
|
||||
LIB_INC = $$PWD/lib/lib
|
||||
LAY_INC = $$PWD/lay/lay
|
||||
LAYBASIC_INC = $$PWD/laybasic/laybasic
|
||||
LAYVIEW_INC = $$PWD/layview/layview
|
||||
LAYUI_INC = $$PWD/layui/layui
|
||||
LAY_INC = $$PWD/lay/lay
|
||||
|
||||
QTBASIC_INC = $$PWD/gsiqt/qtbasic
|
||||
|
||||
|
|
@ -72,6 +74,15 @@ equals(HAVE_CURL, "1") {
|
|||
DEFINES += HAVE_CURL
|
||||
}
|
||||
|
||||
equals(HAVE_PNG, "1") {
|
||||
!isEmpty(BITS_PATH) {
|
||||
include($$BITS_PATH/png/png.pri)
|
||||
} else {
|
||||
LIBS += -lpng
|
||||
}
|
||||
DEFINES += HAVE_PNG
|
||||
}
|
||||
|
||||
equals(HAVE_EXPAT, "1") {
|
||||
!isEmpty(BITS_PATH) {
|
||||
include($$BITS_PATH/expat/expat.pri)
|
||||
|
|
|
|||
|
|
@ -11,19 +11,25 @@ SUBDIRS = \
|
|||
lib \
|
||||
plugins \
|
||||
unit_tests \
|
||||
buddies \
|
||||
lym \
|
||||
laybasic \
|
||||
layview \
|
||||
ant \
|
||||
img \
|
||||
edt \
|
||||
|
||||
equals(HAVE_RUBY, "1") {
|
||||
SUBDIRS += drc lvs
|
||||
}
|
||||
|
||||
!equals(HAVE_QT, "0") {
|
||||
|
||||
# TODO: make buddies able to build without Qt
|
||||
SUBDIRS += \
|
||||
klayout_main \
|
||||
laybasic \
|
||||
lay \
|
||||
ant \
|
||||
buddies \
|
||||
lym \
|
||||
img \
|
||||
edt \
|
||||
layui \
|
||||
fontgen \
|
||||
|
||||
}
|
||||
|
|
@ -58,23 +64,35 @@ db.depends += gsi
|
|||
rdb.depends += db
|
||||
lib.depends += db
|
||||
|
||||
plugins.depends += lib rdb db
|
||||
buddies.depends += plugins lym $$LANG_DEPENDS
|
||||
lym.depends += gsi $$LANG_DEPENDS
|
||||
|
||||
laybasic.depends += rdb
|
||||
layview.depends += laybasic
|
||||
|
||||
ant.depends += layview
|
||||
img.depends += layview
|
||||
edt.depends += layview
|
||||
|
||||
plugins.depends += lib rdb db ant
|
||||
|
||||
equals(HAVE_PYTHON, "1") {
|
||||
pymod.depends += layview ant img edt lym
|
||||
}
|
||||
|
||||
equals(HAVE_RUBY, "1") {
|
||||
MAIN_DEPENDS += drc lvs
|
||||
drc.depends += rdb lym
|
||||
lvs.depends += drc
|
||||
buddies.depends += drc lvs
|
||||
}
|
||||
|
||||
!equals(HAVE_QT, "0") {
|
||||
|
||||
buddies.depends += plugins lym $$LANG_DEPENDS
|
||||
|
||||
equals(HAVE_PYTHON, "1") {
|
||||
pymod.depends += lay
|
||||
}
|
||||
|
||||
equals(HAVE_RUBY, "1") {
|
||||
SUBDIRS += drc lvs
|
||||
MAIN_DEPENDS += drc lvs
|
||||
drc.depends += rdb lym
|
||||
lvs.depends += drc
|
||||
}
|
||||
|
||||
equals(HAVE_QTBINDINGS, "1") {
|
||||
|
||||
SUBDIRS += gsiqt
|
||||
|
|
@ -87,23 +105,14 @@ plugins.depends += lib rdb db
|
|||
|
||||
}
|
||||
|
||||
plugins.depends += lay ant
|
||||
layui.depends += laybasic
|
||||
layview.depends += layui
|
||||
lay.depends += ant img edt layui
|
||||
|
||||
lym.depends += gsi $$LANG_DEPENDS
|
||||
laybasic.depends += rdb lym
|
||||
ant.depends += laybasic
|
||||
img.depends += laybasic
|
||||
edt.depends += laybasic
|
||||
|
||||
lay.depends += laybasic ant img edt
|
||||
plugins.depends += lay
|
||||
|
||||
klayout_main.depends += plugins $$MAIN_DEPENDS
|
||||
|
||||
}
|
||||
|
||||
unit_tests.depends += plugins $$MAIN_DEPENDS $$LANG_DEPENDS
|
||||
|
||||
RESOURCES += \
|
||||
plugins/tools/import/lay_plugin/layResources.qrc \
|
||||
laybasic/laybasic/layResources.qrc
|
||||
|
||||
|
|
|
|||
|
|
@ -56,7 +56,6 @@ HEADERS = \
|
|||
laySignalHandler.h \
|
||||
layLibraryController.h \
|
||||
layFontController.h \
|
||||
layNativePlugin.h \
|
||||
laySystemPaths.h \
|
||||
layMacroEditorSetupPage.h \
|
||||
layPasswordDialog.h \
|
||||
|
|
@ -164,7 +163,6 @@ SOURCES = \
|
|||
laySignalHandler.cc \
|
||||
layLibraryController.cc \
|
||||
layFontController.cc \
|
||||
layNativePlugin.cc \
|
||||
laySystemPaths.cc \
|
||||
layMacroEditorSetupPage.cc \
|
||||
layPasswordDialog.cc \
|
||||
|
|
@ -179,9 +177,9 @@ RESOURCES = layBuildInMacros.qrc \
|
|||
laySaltTemplates.qrc \
|
||||
layDRCLVSHelpResources.qrc
|
||||
|
||||
INCLUDEPATH += $$TL_INC $$GSI_INC $$DB_INC $$RDB_INC $$LAYBASIC_INC $$ANT_INC $$IMG_INC $$EDT_INC $$LYM_INC
|
||||
DEPENDPATH += $$TL_INC $$GSI_INC $$DB_INC $$RDB_INC $$LAYBASIC_INC $$ANT_INC $$IMG_INC $$EDT_INC $$LYM_INC
|
||||
LIBS += -L$$DESTDIR -lklayout_tl -lklayout_gsi -lklayout_db -lklayout_rdb -lklayout_lym -lklayout_laybasic -lklayout_ant -lklayout_img -lklayout_edt
|
||||
INCLUDEPATH += $$TL_INC $$GSI_INC $$DB_INC $$RDB_INC $$LAYBASIC_INC $$LAYUI_INC $$LAYVIEW_INC $$ANT_INC $$IMG_INC $$EDT_INC $$LYM_INC
|
||||
DEPENDPATH += $$TL_INC $$GSI_INC $$DB_INC $$RDB_INC $$LAYBASIC_INC $$LAYUI_INC $$LAYVIEW_INC $$ANT_INC $$IMG_INC $$EDT_INC $$LYM_INC
|
||||
LIBS += -L$$DESTDIR -lklayout_tl -lklayout_gsi -lklayout_db -lklayout_rdb -lklayout_lym -lklayout_laybasic -lklayout_layview -lklayout_layui -lklayout_ant -lklayout_img -lklayout_edt
|
||||
|
||||
win32 {
|
||||
# for stack trace support:
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ public:
|
|||
menu_entries.push_back (lay::menu_item ("clip_tool::show", "clip_tool:edit_mode", "edit_menu.utils_menu.end", tl::to_string (QObject::tr ("Clip Tool"))));
|
||||
}
|
||||
|
||||
virtual lay::Plugin *create_plugin (db::Manager *, lay::Dispatcher *root, lay::LayoutView *view) const
|
||||
virtual lay::Plugin *create_plugin (db::Manager *, lay::Dispatcher *root, lay::LayoutViewBase *view) const
|
||||
{
|
||||
return new ClipDialog (root, view);
|
||||
}
|
||||
|
|
@ -66,7 +66,7 @@ static tl::RegisteredClass<lay::PluginDeclaration> config_decl (new ClipDialogPl
|
|||
|
||||
// ------------------------------------------------------------
|
||||
|
||||
ClipDialog::ClipDialog (lay::Dispatcher *root, lay::LayoutView *vw)
|
||||
ClipDialog::ClipDialog (lay::Dispatcher *root, LayoutViewBase *vw)
|
||||
: lay::Browser (root, vw),
|
||||
Ui::ClipDialog ()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ class ClipDialog
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ClipDialog (lay::Dispatcher *root, lay::LayoutView *view);
|
||||
ClipDialog (lay::Dispatcher *root, lay::LayoutViewBase *view);
|
||||
~ClipDialog ();
|
||||
|
||||
public slots:
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ public:
|
|||
menu_entries.push_back (lay::menu_item ("fill_tool::show", "fill_tool:edit_mode", "edit_menu.utils_menu.end", tl::to_string (QObject::tr ("Fill Tool"))));
|
||||
}
|
||||
|
||||
virtual lay::Plugin *create_plugin (db::Manager *, lay::Dispatcher *root, lay::LayoutView *view) const
|
||||
virtual lay::Plugin *create_plugin (db::Manager *, lay::Dispatcher *root, lay::LayoutViewBase *view) const
|
||||
{
|
||||
return new FillDialog (root, view);
|
||||
}
|
||||
|
|
@ -73,8 +73,8 @@ static tl::RegisteredClass<lay::PluginDeclaration> config_decl (new FillDialogPl
|
|||
|
||||
// ------------------------------------------------------------
|
||||
|
||||
FillDialog::FillDialog (lay::Dispatcher *main, lay::LayoutView *view)
|
||||
: QDialog (view),
|
||||
FillDialog::FillDialog (lay::Dispatcher *main, LayoutViewBase *view)
|
||||
: QDialog (view->widget ()),
|
||||
lay::Plugin (main),
|
||||
Ui::FillDialog (),
|
||||
mp_view (view)
|
||||
|
|
@ -315,8 +315,9 @@ FillDialog::get_fill_parameters ()
|
|||
|
||||
} else if (layer_spec_cbx->currentIndex () == 2) {
|
||||
|
||||
// selected layers
|
||||
// get selected layers
|
||||
std::vector<lay::LayerPropertiesConstIterator> s = mp_view->selected_layers ();
|
||||
|
||||
for (std::vector<lay::LayerPropertiesConstIterator>::const_iterator l = s.begin (); l != s.end (); ++l) {
|
||||
if (! (*l)->has_children () && cv->layout ().is_valid_layer ((*l)->layer_index ())) {
|
||||
fp.exclude_layers.push_back (cv->layout ().get_properties ((*l)->layer_index ()));
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ class LAY_PUBLIC FillDialog
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
FillDialog (lay::Dispatcher *root, lay::LayoutView *view);
|
||||
FillDialog (lay::Dispatcher *root, lay::LayoutViewBase *view);
|
||||
~FillDialog ();
|
||||
|
||||
public slots:
|
||||
|
|
@ -95,7 +95,7 @@ private:
|
|||
void generate_fill (const FillParameters &fp);
|
||||
FillParameters get_fill_parameters ();
|
||||
|
||||
lay::LayoutView *mp_view;
|
||||
lay::LayoutViewBase *mp_view;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
#include "layCommon.h"
|
||||
#include "layPlugin.h"
|
||||
#include "lymMacro.h"
|
||||
#include "lymMacroCollection.h"
|
||||
#include "tlObject.h"
|
||||
#include "tlDeferredExecution.h"
|
||||
#include "tlFileSystemWatcher.h"
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
#define HDR_layMacroEditorSetupPage
|
||||
|
||||
#include "layPlugin.h"
|
||||
#include "layPluginConfigPage.h"
|
||||
#include "ui_MacroEditorSetupPage.h"
|
||||
|
||||
namespace lay
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
#include "layMacroEditorTree.h"
|
||||
#include "layMacroEditorDialog.h"
|
||||
#include "lymMacro.h"
|
||||
#include "lymMacroCollection.h"
|
||||
#include "tlExceptions.h"
|
||||
#include "tlInternational.h"
|
||||
#include "tlException.h"
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@
|
|||
#include <QObject>
|
||||
|
||||
#include "layPlugin.h"
|
||||
#include "layPluginConfigPage.h"
|
||||
|
||||
#include <map>
|
||||
|
||||
|
|
|
|||
|
|
@ -159,7 +159,7 @@ MainWindow::MainWindow (QApplication *app, const char *name, bool undo_enabled)
|
|||
: QMainWindow (0),
|
||||
tl::Object (),
|
||||
lay::DispatcherDelegate (),
|
||||
m_dispatcher (this, this),
|
||||
m_dispatcher (this),
|
||||
m_text_progress (this, 10 /*verbosity threshold*/),
|
||||
m_mode (std::numeric_limits<unsigned int>::max ()),
|
||||
mp_setup_form (0),
|
||||
|
|
@ -179,6 +179,8 @@ MainWindow::MainWindow (QApplication *app, const char *name, bool undo_enabled)
|
|||
mp_app (app),
|
||||
m_manager (undo_enabled)
|
||||
{
|
||||
m_dispatcher.set_menu_parent_widget (this);
|
||||
|
||||
// ensures the deferred method scheduler is present
|
||||
tl::DeferredMethodScheduler::instance ();
|
||||
|
||||
|
|
@ -2882,7 +2884,9 @@ MainWindow::close_view (int index)
|
|||
|
||||
view_closed_event (int (index));
|
||||
|
||||
delete view (index);
|
||||
// delete the view later as it may still be needed by event handlers or similar
|
||||
std::unique_ptr<lay::LayoutView> old_view (view (index));
|
||||
|
||||
mp_views.erase (mp_views.begin () + index, mp_views.begin () + index + 1);
|
||||
|
||||
if (index >= int (mp_views.size ())) {
|
||||
|
|
|
|||
|
|
@ -72,18 +72,18 @@ public:
|
|||
|
||||
void background_color_changed ()
|
||||
{
|
||||
QColor c = mp_view->background_color ();
|
||||
lay::Color c = mp_view->background_color ();
|
||||
|
||||
// replace by "real" background color if required
|
||||
if (! c.isValid ()) {
|
||||
c = mp_view->palette ().color (QPalette::Normal, QPalette::Base);
|
||||
if (! c.is_valid ()) {
|
||||
c = lay::Color (mp_view->palette ().color (QPalette::Normal, QPalette::Base).rgb ());
|
||||
}
|
||||
|
||||
QColor contrast;
|
||||
if (c.green () > 128) {
|
||||
contrast = QColor (0, 0, 0);
|
||||
lay::Color contrast;
|
||||
if (c.to_mono ()) {
|
||||
contrast = lay::Color (0, 0, 0);
|
||||
} else {
|
||||
contrast = QColor (255, 255, 255);
|
||||
contrast = lay::Color (255, 255, 255);
|
||||
}
|
||||
|
||||
set_colors (c, contrast);
|
||||
|
|
@ -388,7 +388,7 @@ public:
|
|||
widget ()->ungrab_mouse (this);
|
||||
}
|
||||
|
||||
void set_colors (QColor /*background*/, QColor color)
|
||||
void set_colors (lay::Color /*background*/, lay::Color color)
|
||||
{
|
||||
// set zoom box color
|
||||
m_color = color.rgb ();
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
#define HDR_laySearchReplaceConfigPage
|
||||
|
||||
#include "layPlugin.h"
|
||||
#include "layPluginConfigPage.h"
|
||||
#include "laySearchReplaceDialog.h"
|
||||
|
||||
#include "ui_SearchReplaceConfigPage.h"
|
||||
|
|
|
|||
|
|
@ -699,7 +699,7 @@ fill_ctx_cbx (QComboBox *cbx)
|
|||
cbx->addItem (QObject::tr ("All cells"));
|
||||
}
|
||||
|
||||
SearchReplaceDialog::SearchReplaceDialog (lay::Dispatcher *root, lay::LayoutView *view)
|
||||
SearchReplaceDialog::SearchReplaceDialog (lay::Dispatcher *root, LayoutViewBase *view)
|
||||
: lay::Browser (root, view),
|
||||
Ui::SearchReplaceDialog (),
|
||||
mp_view (view),
|
||||
|
|
|
|||
|
|
@ -164,7 +164,7 @@ public:
|
|||
std::string text;
|
||||
};
|
||||
|
||||
SearchReplaceDialog (lay::Dispatcher *root, lay::LayoutView *view);
|
||||
SearchReplaceDialog (lay::Dispatcher *root, lay::LayoutViewBase *view);
|
||||
~SearchReplaceDialog ();
|
||||
|
||||
private:
|
||||
|
|
@ -174,7 +174,7 @@ private:
|
|||
// implementation of the lay::Plugin interface
|
||||
void menu_activated (const std::string &symbol);
|
||||
|
||||
lay::LayoutView *mp_view;
|
||||
lay::LayoutViewBase *mp_view;
|
||||
std::vector<std::string> m_mru;
|
||||
std::vector<SavedQuery> m_saved;
|
||||
int m_current_mode;
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ public:
|
|||
menu_entries.push_back (lay::menu_item ("search_replace::show", "search_replace_viewer:edit:view_mode", "edit_menu.utils_group+", tl::to_string (QObject::tr ("Search"))));
|
||||
}
|
||||
|
||||
virtual lay::Plugin *create_plugin (db::Manager *, lay::Dispatcher *root, lay::LayoutView *view) const
|
||||
virtual lay::Plugin *create_plugin (db::Manager *, lay::Dispatcher *root, lay::LayoutViewBase *view) const
|
||||
{
|
||||
return new SearchReplaceDialog (root, view);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -320,7 +320,7 @@ class SearchInstanceProperties
|
|||
private Ui::SearchPropertiesInstance
|
||||
{
|
||||
public:
|
||||
SearchInstanceProperties (QStackedWidget *sw, lay::LayoutView * /*view*/, int /*cv_index*/)
|
||||
SearchInstanceProperties (QStackedWidget *sw, lay::LayoutViewBase * /*view*/, int /*cv_index*/)
|
||||
: SearchPropertiesWidget (sw)
|
||||
{
|
||||
setupUi (this);
|
||||
|
|
@ -377,7 +377,7 @@ class SearchShapeProperties
|
|||
protected Ui::SearchPropertiesShape
|
||||
{
|
||||
public:
|
||||
SearchShapeProperties (QStackedWidget *sw, lay::LayoutView *view, int cv_index)
|
||||
SearchShapeProperties (QStackedWidget *sw, lay::LayoutViewBase *view, int cv_index)
|
||||
: SearchPropertiesWidget (sw)
|
||||
{
|
||||
setupUi (this);
|
||||
|
|
@ -449,7 +449,7 @@ class SearchPolygonProperties
|
|||
: public SearchShapeProperties
|
||||
{
|
||||
public:
|
||||
SearchPolygonProperties (QStackedWidget *sw, lay::LayoutView *view, int cv_index)
|
||||
SearchPolygonProperties (QStackedWidget *sw, lay::LayoutViewBase *view, int cv_index)
|
||||
: SearchShapeProperties (sw, view, cv_index)
|
||||
{
|
||||
// .. nothing yet ..
|
||||
|
|
@ -518,7 +518,7 @@ class SearchBoxProperties
|
|||
private Ui::SearchPropertiesBox
|
||||
{
|
||||
public:
|
||||
SearchBoxProperties (QStackedWidget *sw, lay::LayoutView *view, int cv_index)
|
||||
SearchBoxProperties (QStackedWidget *sw, lay::LayoutViewBase *view, int cv_index)
|
||||
: SearchPropertiesWidget (sw)
|
||||
{
|
||||
setupUi (this);
|
||||
|
|
@ -593,7 +593,7 @@ class SearchPathProperties
|
|||
private Ui::SearchPropertiesPath
|
||||
{
|
||||
public:
|
||||
SearchPathProperties (QStackedWidget *sw, lay::LayoutView *view, int cv_index)
|
||||
SearchPathProperties (QStackedWidget *sw, lay::LayoutViewBase *view, int cv_index)
|
||||
: SearchPropertiesWidget (sw)
|
||||
{
|
||||
setupUi (this);
|
||||
|
|
@ -666,7 +666,7 @@ class SearchTextProperties
|
|||
private Ui::SearchPropertiesText
|
||||
{
|
||||
public:
|
||||
SearchTextProperties (QStackedWidget *sw, lay::LayoutView *view, int cv_index)
|
||||
SearchTextProperties (QStackedWidget *sw, lay::LayoutViewBase *view, int cv_index)
|
||||
: SearchPropertiesWidget (sw)
|
||||
{
|
||||
setupUi (this);
|
||||
|
|
@ -748,7 +748,7 @@ class ReplaceInstanceProperties
|
|||
private Ui::ReplacePropertiesInstance
|
||||
{
|
||||
public:
|
||||
ReplaceInstanceProperties (QStackedWidget *sw, lay::LayoutView * /*view*/, int /*cv_index*/)
|
||||
ReplaceInstanceProperties (QStackedWidget *sw, lay::LayoutViewBase * /*view*/, int /*cv_index*/)
|
||||
: ReplacePropertiesWidget (sw)
|
||||
{
|
||||
setupUi (this);
|
||||
|
|
@ -787,7 +787,7 @@ class ReplaceShapeProperties
|
|||
protected Ui::ReplacePropertiesShape
|
||||
{
|
||||
public:
|
||||
ReplaceShapeProperties (QStackedWidget *sw, lay::LayoutView *view, int cv_index)
|
||||
ReplaceShapeProperties (QStackedWidget *sw, lay::LayoutViewBase *view, int cv_index)
|
||||
: ReplacePropertiesWidget (sw)
|
||||
{
|
||||
setupUi (this);
|
||||
|
|
@ -828,7 +828,7 @@ class ReplacePolygonProperties
|
|||
: public ReplaceShapeProperties
|
||||
{
|
||||
public:
|
||||
ReplacePolygonProperties (QStackedWidget *sw, lay::LayoutView *view, int cv_index)
|
||||
ReplacePolygonProperties (QStackedWidget *sw, lay::LayoutViewBase *view, int cv_index)
|
||||
: ReplaceShapeProperties (sw, view, cv_index)
|
||||
{
|
||||
// .. nothing yet ..
|
||||
|
|
@ -867,7 +867,7 @@ class ReplaceBoxProperties
|
|||
private Ui::ReplacePropertiesBox
|
||||
{
|
||||
public:
|
||||
ReplaceBoxProperties (QStackedWidget *sw, lay::LayoutView *view, int cv_index)
|
||||
ReplaceBoxProperties (QStackedWidget *sw, lay::LayoutViewBase *view, int cv_index)
|
||||
: ReplacePropertiesWidget (sw)
|
||||
{
|
||||
setupUi (this);
|
||||
|
|
@ -919,7 +919,7 @@ class ReplacePathProperties
|
|||
private Ui::ReplacePropertiesPath
|
||||
{
|
||||
public:
|
||||
ReplacePathProperties (QStackedWidget *sw, lay::LayoutView *view, int cv_index)
|
||||
ReplacePathProperties (QStackedWidget *sw, lay::LayoutViewBase *view, int cv_index)
|
||||
: ReplacePropertiesWidget (sw)
|
||||
{
|
||||
setupUi (this);
|
||||
|
|
@ -966,7 +966,7 @@ class ReplaceTextProperties
|
|||
private Ui::ReplacePropertiesText
|
||||
{
|
||||
public:
|
||||
ReplaceTextProperties (QStackedWidget *sw, lay::LayoutView *view, int cv_index)
|
||||
ReplaceTextProperties (QStackedWidget *sw, lay::LayoutViewBase *view, int cv_index)
|
||||
: ReplacePropertiesWidget (sw)
|
||||
{
|
||||
setupUi (this);
|
||||
|
|
@ -1018,7 +1018,7 @@ public:
|
|||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void fill_find_pages (QStackedWidget *sw, lay::LayoutView *view, int cv_index)
|
||||
void fill_find_pages (QStackedWidget *sw, lay::LayoutViewBase *view, int cv_index)
|
||||
{
|
||||
while (sw->count () > 0) {
|
||||
sw->removeWidget (sw->widget (0));
|
||||
|
|
@ -1031,7 +1031,7 @@ void fill_find_pages (QStackedWidget *sw, lay::LayoutView *view, int cv_index)
|
|||
sw->addWidget (new SearchTextProperties (sw, view, cv_index));
|
||||
}
|
||||
|
||||
void fill_replace_pages (QStackedWidget *sw, lay::LayoutView *view, int cv_index)
|
||||
void fill_replace_pages (QStackedWidget *sw, lay::LayoutViewBase *view, int cv_index)
|
||||
{
|
||||
while (sw->count () > 0) {
|
||||
sw->removeWidget (sw->widget (0));
|
||||
|
|
|
|||
|
|
@ -86,12 +86,12 @@ public:
|
|||
/**
|
||||
* @brief Fill the given stack widget with pairs of items plus properties widget
|
||||
*/
|
||||
void fill_find_pages (QStackedWidget *sw, lay::LayoutView *view, int cv_index);
|
||||
void fill_find_pages (QStackedWidget *sw, lay::LayoutViewBase *view, int cv_index);
|
||||
|
||||
/**
|
||||
* @brief Fill the given stack widget with pairs of items plus properties widget
|
||||
*/
|
||||
void fill_replace_pages (QStackedWidget *sw, lay::LayoutView *view, int cv_index);
|
||||
void fill_replace_pages (QStackedWidget *sw, lay::LayoutViewBase *view, int cv_index);
|
||||
|
||||
/**
|
||||
* @brief Get an object id from a page index
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@
|
|||
|
||||
#include "layMainWindow.h"
|
||||
#include "layApplication.h"
|
||||
#include "layPluginConfigPage.h"
|
||||
#include "tlExceptions.h"
|
||||
#include "tlLog.h"
|
||||
#include "dbHershey.h"
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@ SOURCES = \
|
|||
laySalt.cc \
|
||||
laySessionTests.cc
|
||||
|
||||
INCLUDEPATH += $$LAY_INC $$TL_INC $$LAYBASIC_INC $$DB_INC $$GSI_INC $$ANT_INC $$IMG_INC $$RDB_INC
|
||||
DEPENDPATH += $$LAY_INC $$TL_INC $$LAYBASIC_INC $$DB_INC $$GSI_INC $$ANT_INC $$IMG_INC $$RDB_INC
|
||||
INCLUDEPATH += $$LAY_INC $$TL_INC $$LAYBASIC_INC $$LAYUI_INC $$LAYVIEW_INC $$DB_INC $$GSI_INC $$ANT_INC $$IMG_INC $$RDB_INC
|
||||
DEPENDPATH += $$LAY_INC $$TL_INC $$LAYBASIC_INC $$LAYUI_INC $$LAYVIEW_INC $$DB_INC $$GSI_INC $$ANT_INC $$IMG_INC $$RDB_INC
|
||||
|
||||
LIBS += -L$$DESTDIR_UT -lklayout_lay -lklayout_laybasic -lklayout_db -lklayout_tl -lklayout_gsi -lklayout_ant -lklayout_img -lklayout_rdb
|
||||
LIBS += -L$$DESTDIR_UT -lklayout_lay -lklayout_laybasic -lklayout_layui -lklayout_layview -lklayout_db -lklayout_tl -lklayout_gsi -lklayout_ant -lklayout_img -lklayout_rdb
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,8 @@
|
|||
|
||||
|
||||
#include "gsiDecl.h"
|
||||
#include "layLayoutView.h"
|
||||
#include "layLayerProperties.h"
|
||||
#include "layLayoutViewBase.h"
|
||||
|
||||
namespace gsi
|
||||
{
|
||||
|
|
@ -1221,11 +1222,6 @@ Class<lay::LayerPropertiesNode> decl_LayerPropertiesNode (
|
|||
"\n"
|
||||
"@return A bbox in micron units\n"
|
||||
) +
|
||||
method ("view", &lay::LayerPropertiesNode::view,
|
||||
"@brief Gets the view this node lives in\n"
|
||||
"\n"
|
||||
"This reference can be nil if the node is a orphan node that lives outside a view."
|
||||
) +
|
||||
method ("list_index", &lay::LayerPropertiesNode::list_index,
|
||||
"@brief Gets the index of the layer properties list that the node lives in\n"
|
||||
) +
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue