mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 05:16:21 +00:00
remove qt3 frontend
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15432 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
3a0cbc2be7
commit
a63cddf51c
4
INSTALL
4
INSTALL
@ -9,7 +9,7 @@ These four steps will compile, test and install LyX:
|
||||
0) Linux users beware: if compiling the Qt frontend, you need
|
||||
qt and qt-devel packages of the same version to compile LyX.
|
||||
|
||||
1) ./configure --with-frontend=[qt3, qt4, or gtk]
|
||||
1) ./configure --with-frontend=[qt4, or gtk]
|
||||
configures LyX according to your system.
|
||||
When compiling for Qt, you may have to set
|
||||
--with-qt-dir=<path-to-your-qt-installation>
|
||||
@ -113,7 +113,7 @@ flags:
|
||||
want to use. There is no default value: this switch is required.
|
||||
|
||||
o --with-extra-lib=DIRECTORY that specifies the path where LyX will
|
||||
find extra libraries (qt3, qt4, gtk) it needs. Defaults to NONE
|
||||
find extra libraries (qt4, gtk) it needs. Defaults to NONE
|
||||
(i.e. search in standard places). You can specify several
|
||||
directories, separated by colons.
|
||||
|
||||
|
@ -11,7 +11,7 @@ widely supported on the *nix systems, but not so under windows. They are
|
||||
not necessarily easy to use and maintain (at least to non-m4 experts)
|
||||
either. Because of these, a scons (http://www.scons.org) build system has
|
||||
been set up as an alternative way to build lyx. As of writing, this system
|
||||
only supports qt3 and qt4 frontends.
|
||||
only supports the qt4 frontend.
|
||||
|
||||
This file is organized as follows:
|
||||
1. General usage of scons
|
||||
@ -43,7 +43,7 @@ Prerequisites:
|
||||
in the near future.
|
||||
|
||||
* Other libraries:
|
||||
These include zlib (required), qt3 or qt4 (required), gettext
|
||||
These include zlib (required), qt4 (required), gettext
|
||||
(optional), boost (optional), aspell (optional) and Aiksaurus
|
||||
(optional). Please refer to the system-specific sections regarding the
|
||||
availability and installation of them.
|
||||
@ -77,9 +77,8 @@ command 'scons -h'.
|
||||
|
||||
Components to use/build:
|
||||
|
||||
* frontend=qt3/qt4: qt3 is the default for all *nix systems including
|
||||
windows cygwin. qt4 is the default for windows/mingw and windows/
|
||||
msvc. gtk is not currently supported.
|
||||
* frontend=qt4: qt4 is the only option right now.
|
||||
gtk is not currently supported.
|
||||
* mode=debug/release: lyx will be built under the debug or release
|
||||
directory, with different default build options.
|
||||
* boost=included/system/auto: whether or not use included boost, system
|
||||
@ -144,7 +143,7 @@ You can specify one or more of the following targets:
|
||||
|
||||
Static libraries (names correspond to their directories):
|
||||
boost, intl, support, mathed, insets, frontends, graphics,
|
||||
controllers, client, qt3, qt4, lyxbase
|
||||
controllers, client, qt4, lyxbase
|
||||
Programs:
|
||||
tex2lyx, client, lyx, all = tex2lyx + client + lyx
|
||||
Installation:
|
||||
@ -158,7 +157,7 @@ directory structure is:
|
||||
$build_dir
|
||||
- common: most of the intermediate files, mostly object files
|
||||
- libs: all static libraries
|
||||
- qt3 etc: lyx executable built with the frontend
|
||||
- qt4 etc: lyx executable built with the frontend
|
||||
- executables: lyxclient, tex2lyx, lyx
|
||||
|
||||
MSVS projects will be put to development/scons (and you should invoke
|
||||
@ -247,7 +246,7 @@ extra_inc_path etc is needed.
|
||||
=================
|
||||
|
||||
LyX should be easy to compile, but you must use the most recent cygwin
|
||||
dll (version 1.5.20-1 as of July 2006) because the qt3 library in the
|
||||
dll (version 1.5.20-1 as of July 2006) because qt library in older
|
||||
cygwin distribution does not work with previous versions due to broken
|
||||
threading support.
|
||||
|
||||
@ -256,8 +255,8 @@ To build lyx for cygwin, you should
|
||||
* install (using the cygwin setup program) at least the following
|
||||
packages and all other packages pulled in by dependencies:
|
||||
|
||||
aspell gzip libiconv qt3-bin
|
||||
aspell-dev jpeg libpng qt3-devel
|
||||
aspell gzip libiconv qt4-bin
|
||||
aspell-dev jpeg libpng qt4-devel
|
||||
gcc libintl libpng2
|
||||
gettext libintl1 jpeg
|
||||
gettext-devel libintl2 python
|
||||
@ -269,10 +268,10 @@ To build lyx for cygwin, you should
|
||||
* run scons as you would do under linux.
|
||||
|
||||
Note: cygwin/qt does not follow the usual $qt_dir/include, $qt_dir/bin,
|
||||
$qt_dir/lib directory structure. For example, cygwin/qt3 uses directories
|
||||
/usr/include/qt3, /usr/lib/qt3/bin and /usr/lib/qt3/lib. If these
|
||||
$qt_dir/lib directory structure. For example, cygwin/qt4 uses directories
|
||||
/usr/include/qt4, /usr/lib/qt4/bin and /usr/lib/qt4/lib. If these
|
||||
directories can not be detected automatically, use options, for example,
|
||||
qt_dir=/usr/lib/qt3 qt_inc_path=/usr/include/qt3
|
||||
qt_dir=/usr/lib/qt4 qt_inc_path=/usr/include/qt4
|
||||
|
||||
|
||||
5. Windows/msvc
|
||||
@ -292,12 +291,7 @@ To build lyx with msvc, you should
|
||||
directories in VCProjectEngine.dll.express.config, as suggested in
|
||||
http://msdn.microsoft.com/vstudio/express/visualc/usingpsdk/.
|
||||
|
||||
* build qt3
|
||||
- download qt3 source from Q../Free sourceforge.net website (not from
|
||||
trolltech).
|
||||
- compile qt3 as instructed
|
||||
|
||||
or qt4
|
||||
* build qt4
|
||||
- download qt4 source from trolltech (not the binary version, which
|
||||
only works with mingw)
|
||||
- get q../free patch for qt4
|
||||
|
@ -15,8 +15,8 @@ you can find detailed instructions at lyx/wiki.
|
||||
|
||||
To build lyx, you will need to install the following cygwin packages
|
||||
|
||||
aspell gzip libiconv qt3-bin
|
||||
aspell-dev jpeg libpng qt3-devel
|
||||
aspell gzip libiconv qt4-bin
|
||||
aspell-dev jpeg libpng qt4-devel
|
||||
gcc libintl libpng2
|
||||
gettext libintl1 jpeg
|
||||
gettext-devel libintl2 python
|
||||
|
@ -231,7 +231,7 @@ private:
|
||||
|
||||
void close();
|
||||
|
||||
enum {
|
||||
enum X {
|
||||
f_read = 1,
|
||||
f_write = f_read << 1,
|
||||
f_eof = f_write << 1,
|
||||
|
@ -116,7 +116,7 @@ AC_DEFUN([QT_CHECK_COMPILE],
|
||||
SAVE_CXXFLAGS=$CXXFLAGS
|
||||
CXXFLAGS="$CXXFLAGS $QT_INCLUDES $QT_LDFLAGS"
|
||||
|
||||
for libname in -lqt-mt -lqt-mt3 -lqt3 -lqt2 -lqt;
|
||||
for libname in -lqt-mt -lqt;
|
||||
do
|
||||
QT_TRY_LINK($libname)
|
||||
if test -n "$qt_cv_libname"; then
|
||||
|
22
configure.ac
22
configure.ac
@ -192,25 +192,6 @@ for frontend in $FRONTENDS ; do
|
||||
libglademm version:\t\t${LIBGLADEMM_VERSION}\n"
|
||||
;;
|
||||
|
||||
qt3)
|
||||
QT_DO_IT_ALL
|
||||
FRONTENDS_PROGS="$FRONTENDS_PROGS lyx-qt3\$(EXEEXT)"
|
||||
FRONTENDS_SUBDIRS="$FRONTENDS_SUBDIRS qt3"
|
||||
RPM_FRONTEND="qt3"
|
||||
FRONTEND_INFO="${FRONTEND_INFO}\
|
||||
Qt Frontend:\n\
|
||||
Qt version:\t\t${QT_VERSION}\n"
|
||||
dnl qt build will fail without moc or uic
|
||||
if test -z "$MOC"; then
|
||||
LYX_ERROR([moc binary not found !])
|
||||
fi
|
||||
if test -z "$UIC"; then
|
||||
LYX_ERROR([uic binary not found !])
|
||||
fi
|
||||
if test -z "$QT_LIB"; then
|
||||
LYX_ERROR([qt library not found !])
|
||||
fi
|
||||
;;
|
||||
qt4)
|
||||
QT4_DO_IT_ALL
|
||||
FRONTENDS_PROGS="$FRONTENDS_PROGS lyx-qt4\$(EXEEXT)"
|
||||
@ -456,9 +437,6 @@ AC_CONFIG_FILES([Makefile m4/Makefile \
|
||||
src/frontends/gtk/Makefile \
|
||||
src/frontends/gtk/gimages/Makefile \
|
||||
src/frontends/gtk/glade/Makefile \
|
||||
src/frontends/qt3/Makefile \
|
||||
src/frontends/qt3/ui/Makefile \
|
||||
src/frontends/qt3/ui/moc/Makefile \
|
||||
src/frontends/qt4/Makefile \
|
||||
src/frontends/qt4/ui/Makefile \
|
||||
])
|
||||
|
@ -41,23 +41,9 @@ if(release)
|
||||
endif(release)
|
||||
|
||||
|
||||
if(qt3)
|
||||
set(qt_postfix qt3)
|
||||
project(lyx-${qt_postfix})
|
||||
set(QT_MT_REQUIRED TRUE)
|
||||
find_package(Qt3 REQUIRED)
|
||||
set(qt3)
|
||||
set(build_qt3_frontend TRUE)
|
||||
if(QT_FOUND)
|
||||
message("-- Found Qt3: ${QT_QT_LIBRARY}")
|
||||
else(QT_FOUND)
|
||||
MESSAGE( FATAL_ERROR "Qt3 not found")
|
||||
endif(QT_FOUND)
|
||||
else(qt3)
|
||||
set(qt_postfix qt4)
|
||||
project(lyx-${qt_postfix})
|
||||
find_package(Qt4 REQUIRED)
|
||||
endif(qt3)
|
||||
set(qt_postfix qt4)
|
||||
project(lyx-${qt_postfix})
|
||||
find_package(Qt4 REQUIRED)
|
||||
|
||||
find_package(ZLIB REQUIRED)
|
||||
find_package(ICONV REQUIRED)
|
||||
|
@ -5,7 +5,6 @@ For all builds:
|
||||
- install Qt 4 and make sure qmake 4 is found
|
||||
(add the folder with qmake to the environment variable PATH)
|
||||
- by default it builds the Qt4 frontend
|
||||
- to build the Qt3 frontend set QTDIR and call cmake with '-Dqt3=1'
|
||||
- with GNUWIN32_DIR you could point to your gnuwin32 packages
|
||||
(eg. -DGNUWIN32_DIR=c:\gnuwin32) by default it searches in your
|
||||
program folder
|
||||
|
@ -1,46 +0,0 @@
|
||||
# This file is part of LyX, the document processor.
|
||||
# Licence details can be found in the file COPYING.
|
||||
#
|
||||
# Copyright (c) 2006, Peter Kümmel, <syntheticpp@gmx.net>
|
||||
#
|
||||
|
||||
project(frontend_qt3)
|
||||
|
||||
file(GLOB frontends_qt3_sources ${TOP_SRC_DIR}/src/frontends/qt3/*.C)
|
||||
file(GLOB frontends_qt3_headers ${TOP_SRC_DIR}/src/frontends/qt3/*.h)
|
||||
file(GLOB frontend_qt3_UI ${TOP_SRC_DIR}/src/frontends/qt3/ui/*.ui)
|
||||
|
||||
lyx_add_ui_files(dummy_gen_in_ui ${frontend_qt3_UI})
|
||||
|
||||
QT_WRAP_UI(frontend_qt3 qt3_uic_h qt3_uic_cxx ${frontend_qt3_UI})
|
||||
|
||||
qt_wrap_cpp(frontend_qt3 qt3_moc ${frontends_qt3_headers})
|
||||
|
||||
source_group("Uic files" FILES ${frontend_qt3_UI})
|
||||
|
||||
add_definitions(-DQT_NO_STL)
|
||||
|
||||
include_directories( ${QT_INCLUDE_DIR}
|
||||
${TOP_SRC_DIR}/src/frontends/qt3
|
||||
${TOP_SRC_DIR}/src/frontends/controllers
|
||||
${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
add_library(frontend_qt3 STATIC
|
||||
${frontends_qt3_sources}
|
||||
${frontends_qt3_headers}
|
||||
${qt3_moc}
|
||||
${qt3_uic_cxx}
|
||||
${qt3_uic_h}
|
||||
)
|
||||
|
||||
target_link_libraries(frontend_qt3 ${QT_QT_LIBRARY} controllers)
|
||||
|
||||
|
||||
|
||||
if(WIN32)
|
||||
target_link_libraries(frontend_qt3 Gdi32)
|
||||
endif(WIN32)
|
||||
|
||||
project_source_group("${GROUP_CODE}" frontends_qt3_sources frontends_qt3_headers)
|
||||
source_group("Uic files" FILES ${frontend_qt3_UI})
|
||||
|
@ -89,26 +89,26 @@ if os.name == 'nt':
|
||||
default_packaging_method = 'windows'
|
||||
elif os.name == 'posix' and sys.platform != 'cygwin':
|
||||
platform_name = sys.platform
|
||||
default_frontend = 'qt3'
|
||||
default_frontend = 'qt4'
|
||||
default_prefix = '/usr/local'
|
||||
default_with_x = True
|
||||
default_packaging_method = 'posix'
|
||||
elif os.name == 'posix' and sys.platform == 'cygwin':
|
||||
platform_name = 'cygwin'
|
||||
default_frontend = 'qt3'
|
||||
default_frontend = 'qt4'
|
||||
default_prefix = '/usr'
|
||||
default_with_x = True
|
||||
default_packaging_method = 'posix'
|
||||
elif os.name == 'darwin':
|
||||
platform_name = 'macosx'
|
||||
default_frontend = 'qt3'
|
||||
default_frontend = 'qt4'
|
||||
# FIXME: macOSX default prefix?
|
||||
default_prefix = '.'
|
||||
default_with_x = False
|
||||
default_packaging_method = 'macosx'
|
||||
else: # unsupported system, assume posix behavior
|
||||
platform_name = 'others'
|
||||
default_frontend = 'qt3'
|
||||
default_frontend = 'qt4'
|
||||
default_prefix = '.'
|
||||
default_with_x = True
|
||||
default_packaging_method = 'posix'
|
||||
@ -126,7 +126,7 @@ opts = Options(['config.py'])
|
||||
opts.AddOptions(
|
||||
# frontend
|
||||
EnumOption('frontend', 'Main GUI', default_frontend,
|
||||
allowed_values = ('qt3', 'qt4', 'gtk') ),
|
||||
allowed_values = ('qt4', 'gtk') ),
|
||||
# debug or release build
|
||||
EnumOption('mode', 'Building method', default_build_mode,
|
||||
allowed_values = ('debug', 'release') ),
|
||||
@ -674,14 +674,7 @@ else:
|
||||
|
||||
# qt libraries?
|
||||
#
|
||||
# qt3 does not use pkg_config
|
||||
if frontend == 'qt3':
|
||||
# windows lib name is qt-mt3
|
||||
if not conf.CheckLibWithHeader('qt-mt', 'qapp.h', 'c++', 'QApplication qapp();') \
|
||||
and not conf.CheckLibWithHeader('qt-mt3', 'qapp.h', 'c++', 'QApplication qapp();'):
|
||||
print 'Did not find qt libraries, exiting!'
|
||||
Exit(1)
|
||||
elif frontend == 'qt4':
|
||||
if frontend == 'qt4':
|
||||
succ = False
|
||||
# first: try pkg_config
|
||||
if env['HAS_PKG_CONFIG']:
|
||||
@ -712,9 +705,7 @@ elif frontend == 'qt4':
|
||||
|
||||
# now, if msvc2005 is used, we will need that QT_LIB_PATH/QT_LIB.manifest file
|
||||
if use_vc:
|
||||
if frontend == 'qt3':
|
||||
manifest = os.path.join(qt_lib_path, 'qt-mt3.dll.manifest')
|
||||
elif frontend == 'qt4':
|
||||
if frontend == 'qt4':
|
||||
if mode == 'debug':
|
||||
manifest = os.path.join(qt_lib_path, 'QtGuid4.dll.manifest')
|
||||
else:
|
||||
@ -1289,14 +1280,7 @@ env = conf.Finish()
|
||||
#
|
||||
# NOTE: Tool('qt') or Tool('qt4') will be loaded later
|
||||
# in their respective directory and specialized env.
|
||||
if frontend == 'qt3':
|
||||
# note: env.Tool('qt') my set QT_LIB to qt
|
||||
if platform_name == 'win32':
|
||||
qt_libs = ['qt-mt3']
|
||||
else:
|
||||
qt_libs = ['qt-mt']
|
||||
frontend_libs = qt_libs
|
||||
elif frontend == 'qt4':
|
||||
if frontend == 'qt4':
|
||||
qt_libs = ['QtCore', 'QtGui']
|
||||
# set the right lib names
|
||||
if platform_name == 'win32':
|
||||
@ -1425,7 +1409,7 @@ Frontend:
|
||||
frontend, packaging_method,
|
||||
prefix, env['LYX_DIR'])
|
||||
|
||||
if frontend in ['qt3', 'qt4']:
|
||||
if frontend in ['qt4']:
|
||||
env['VERSION_INFO'] += ''' include dir: %s
|
||||
library dir: %s
|
||||
X11: %s
|
||||
@ -1507,7 +1491,6 @@ build_tex2lyx = True in ['tex2lyx' in x for x in targets] \
|
||||
or 'install' in targets or 'all' in targets
|
||||
build_lyxbase = build_lyx or 'lyxbase' in targets
|
||||
build_po = 'po' in targets or 'install' in targets or 'all' in targets
|
||||
build_qt3 = (build_lyx and frontend == 'qt3') or 'qt3' in targets
|
||||
build_qt4 = (build_lyx and frontend == 'qt4') or 'qt4' in targets
|
||||
build_msvs_projects = use_vc and 'msvs_projects' in targets
|
||||
|
||||
@ -1534,7 +1517,6 @@ if rebuild_targets is not None:
|
||||
build_graphics = ifBuildLib('graphics', 'graphics', build_graphics)
|
||||
build_controllers = ifBuildLib('controllers', 'controllers', build_controllers)
|
||||
build_lyxbase = ifBuildLib('lyxbase', 'lyxbase_pre', build_lyxbase)
|
||||
build_qt3 = ifBuildLib('qt3', 'qt3', build_qt3)
|
||||
build_qt4 = ifBuildLib('qt4', 'qt4', build_qt4)
|
||||
#
|
||||
def ifBuildApp(name, appname, old_value):
|
||||
@ -1550,10 +1532,8 @@ if rebuild_targets is not None:
|
||||
build_tex2lyx = ifBuildApp('tex2lyx', 'tex2lyx', build_tex2lyx)
|
||||
build_client = ifBuildApp('client', 'lyxclient', build_client)
|
||||
|
||||
# sync frontend and frontend (maybe build qt4 with frontend=qt3)
|
||||
if build_qt3:
|
||||
frontend = 'qt3'
|
||||
elif build_qt4:
|
||||
# sync frontend and frontend (?)
|
||||
if build_qt4:
|
||||
frontend = 'qt4'
|
||||
|
||||
|
||||
@ -1709,50 +1689,11 @@ if build_controllers:
|
||||
|
||||
|
||||
#
|
||||
# src/frontend/qt3/4
|
||||
# src/frontend/qt4
|
||||
#
|
||||
if build_qt3 or build_qt4:
|
||||
if build_qt4:
|
||||
env.BuildDir('$BUILDDIR/$frontend', '$TOP_SRCDIR/src/frontend/$frontend', duplicate = 0)
|
||||
|
||||
if build_qt3:
|
||||
print "Processing files in src/frontends/qt3..."
|
||||
|
||||
qt3env = env.Copy()
|
||||
# disable auto scan to speed up non build time
|
||||
qt3env['QT_AUTOSCAN'] = 0
|
||||
qt3env['QT_MOCHPREFIX'] = ''
|
||||
|
||||
# load qt3 tools
|
||||
qt3env.Tool('qt')
|
||||
|
||||
qt3env.AppendUnique(CPPPATH = [
|
||||
'$BUILDDIR/common',
|
||||
'$BUILDDIR/common/images',
|
||||
'$BUILDDIR/common/frontends',
|
||||
'$BUILDDIR/common/frontends/qt3',
|
||||
'$BUILDDIR/common/frontends/controllers',
|
||||
qt_inc_path]
|
||||
)
|
||||
|
||||
qt3_moc_files = ["$BUILDDIR/common/frontends/qt3/%s" % x for x in src_frontends_qt3_moc_files]
|
||||
|
||||
# manually moc and uic files for better performance
|
||||
qt3_moced_files = [qt3env.Moc(x.replace('.C', '_moc.cpp'), x.replace('.C', '.h')) for x in qt3_moc_files]
|
||||
|
||||
qt3_uiced_files = [qt3env.Uic('$BUILDDIR/common/frontends/qt3/ui/'+x) for x in \
|
||||
src_frontends_qt3_ui_files]
|
||||
|
||||
qt3_uiced_cc_files = []
|
||||
for x in qt3_uiced_files:
|
||||
qt3_uiced_cc_files.extend(x[1:])
|
||||
|
||||
qt3 = qt3env.StaticLibrary(
|
||||
target = '$LOCALLIBPATH/qt3',
|
||||
source = ['$BUILDDIR/common/frontends/qt3/%s' % x for x in src_frontends_qt3_files] \
|
||||
+ qt3_uiced_cc_files
|
||||
)
|
||||
Alias('qt3', qt3)
|
||||
|
||||
|
||||
if build_qt4:
|
||||
print "Processing files in src/frontends/qt4..."
|
||||
@ -1994,10 +1935,6 @@ if build_msvs_projects:
|
||||
build_project('controllers', src = ['$TOP_SRCDIR/src/frontends/controllers/%s' % x for x in src_frontends_controllers_files],
|
||||
inc = ['$TOP_SRCDIR/src/frontends/controllers/%s' % x for x in src_frontends_controllers_header_files])
|
||||
#
|
||||
build_project('qt3', src = ['$TOP_SRCDIR/src/frontends/qt3/%s' % x for x in src_frontends_qt3_files + src_frontends_qt3_moc_files],
|
||||
inc = ['$TOP_SRCDIR/src/frontends/qt3/%s' % x for x in src_frontends_qt3_header_files],
|
||||
res = ['$TOP_SRCDIR/src/frontends/qt3/ui/%s' % x for x in src_frontends_qt3_ui_files])
|
||||
#
|
||||
build_project('qt4', src = ['$TOP_SRCDIR/src/frontends/qt4/%s' % x for x in src_frontends_qt4_files + src_frontends_qt4_moc_files],
|
||||
inc = ['$TOP_SRCDIR/src/frontends/qt4/%s' % x for x in src_frontends_qt4_header_files],
|
||||
res = ['$TOP_SRCDIR/src/frontends/qt4/ui/%s' % x for x in src_frontends_qt4_ui_files])
|
||||
@ -2014,28 +1951,6 @@ if build_msvs_projects:
|
||||
#
|
||||
build_project('lyxbase', src = ['$TOP_SRCDIR/src/%s' % x for x in src_pre_files + src_post_files],
|
||||
inc = ['$TOP_SRCDIR/src/%s' % x for x in src_header_files])
|
||||
#
|
||||
if frontend == 'qt3':
|
||||
build_project('lyx',
|
||||
src = ['$TOP_SRCDIR/src/%s' % x for x in src_pre_files + src_post_files] + \
|
||||
['$TOP_SRCDIR/src/support/%s' % x for x in src_support_files] + \
|
||||
['$TOP_SRCDIR/src/mathed/%s' % x for x in src_mathed_files] + \
|
||||
['$TOP_SRCDIR/src/insets/%s' % x for x in src_insets_files] + \
|
||||
['$TOP_SRCDIR/src/frontends/%s' % x for x in src_frontends_files] + \
|
||||
['$TOP_SRCDIR/src/graphics/%s' % x for x in src_graphics_files] + \
|
||||
['$TOP_SRCDIR/src/frontends/controllers/%s' % x for x in src_frontends_controllers_files] + \
|
||||
['$TOP_SRCDIR/src/frontends/qt3/%s' % x for x in src_frontends_qt3_files + src_frontends_qt3_moc_files],
|
||||
inc = ['$TOP_SRCDIR/src/%s' % x for x in src_header_files] + \
|
||||
['$TOP_SRCDIR/src/support/%s' % x for x in src_support_header_files] + \
|
||||
['$TOP_SRCDIR/src/mathed/%s' % x for x in src_mathed_header_files] + \
|
||||
['$TOP_SRCDIR/src/insets/%s' % x for x in src_insets_header_files] + \
|
||||
['$TOP_SRCDIR/src/frontends/%s' % x for x in src_frontends_header_files] + \
|
||||
['$TOP_SRCDIR/src/graphics/%s' % x for x in src_graphics_header_files] + \
|
||||
['$TOP_SRCDIR/src/frontends/controllers/%s' % x for x in src_frontends_controllers_header_files] + \
|
||||
['$TOP_SRCDIR/src/frontends/qt3/%s' % x for x in src_frontends_qt3_header_files],
|
||||
res = ['$TOP_SRCDIR/src/frontends/qt3/ui/%s' % x for x in src_frontends_qt3_ui_files],
|
||||
rebuildTargetOnly = False,
|
||||
full_target = File(env.subst('$BUILDDIR/$frontend/lyx$PROGSUFFIX')).abspath)
|
||||
else:
|
||||
build_project('lyx',
|
||||
src = ['$TOP_SRCDIR/src/%s' % x for x in src_pre_files + src_post_files] + \
|
||||
|
@ -597,378 +597,6 @@ src_frontends_controllers_files = Split('''
|
||||
''')
|
||||
|
||||
|
||||
src_frontends_qt3_ui_files = Split('''
|
||||
BiblioModuleBase.ui
|
||||
BranchesModuleBase.ui
|
||||
BulletsModuleBase.ui
|
||||
FontModuleBase.ui
|
||||
LaTeXModuleBase.ui
|
||||
LanguageModuleBase.ui
|
||||
MarginsModuleBase.ui
|
||||
MathsModuleBase.ui
|
||||
NumberingModuleBase.ui
|
||||
PageLayoutModuleBase.ui
|
||||
PreambleModuleBase.ui
|
||||
QAboutDialogBase.ui
|
||||
QAskForTextDialog.ui
|
||||
QBibitemDialogBase.ui
|
||||
QBibtexAddDialogBase.ui
|
||||
QBibtexDialogBase.ui
|
||||
QBoxDialogBase.ui
|
||||
QBranchDialogBase.ui
|
||||
QChangesDialogBase.ui
|
||||
QCharacterDialogBase.ui
|
||||
QCitationDialogBase.ui
|
||||
QCitationFindDialogBase.ui
|
||||
QDelimiterDialogBase.ui
|
||||
QDocumentDialogBase.ui
|
||||
QERTDialogBase.ui
|
||||
QErrorListDialogBase.ui
|
||||
QExternalDialogBase.ui
|
||||
QFloatDialogBase.ui
|
||||
QGraphicsDialogBase.ui
|
||||
QIncludeDialogBase.ui
|
||||
QIndexDialogBase.ui
|
||||
QLogDialogBase.ui
|
||||
QMathDialogBase.ui
|
||||
QMathMatrixDialogBase.ui
|
||||
QNoteDialogBase.ui
|
||||
QParagraphDialogBase.ui
|
||||
QPrefAsciiModule.ui
|
||||
QPrefColorsModule.ui
|
||||
QPrefConvertersModule.ui
|
||||
QPrefCopiersModule.ui
|
||||
QPrefCygwinPathModule.ui
|
||||
QPrefDateModule.ui
|
||||
QPrefDisplayModule.ui
|
||||
QPrefFileformatsModule.ui
|
||||
QPrefIdentityModule.ui
|
||||
QPrefKeyboardModule.ui
|
||||
QPrefLanguageModule.ui
|
||||
QPrefLatexModule.ui
|
||||
QPrefPathsModule.ui
|
||||
QPrefPrinterModule.ui
|
||||
QPrefScreenFontsModule.ui
|
||||
QPrefSpellcheckerModule.ui
|
||||
QPrefUIModule.ui
|
||||
QPrefsDialogBase.ui
|
||||
QPrintDialogBase.ui
|
||||
QRefDialogBase.ui
|
||||
QSearchDialogBase.ui
|
||||
QSendtoDialogBase.ui
|
||||
QShowFileDialogBase.ui
|
||||
QSpellcheckerDialogBase.ui
|
||||
QTabularCreateDialogBase.ui
|
||||
QTabularDialogBase.ui
|
||||
QTexinfoDialogBase.ui
|
||||
QThesaurusDialogBase.ui
|
||||
QTocDialogBase.ui
|
||||
QURLDialogBase.ui
|
||||
QVSpaceDialogBase.ui
|
||||
QViewSourceDialogBase.ui
|
||||
QWrapDialogBase.ui
|
||||
TextLayoutModuleBase.ui
|
||||
''')
|
||||
|
||||
|
||||
src_frontends_qt3_moc_files = Split('''
|
||||
BulletsModule.C
|
||||
emptytable.C
|
||||
floatplacement.C
|
||||
FileDialog_private.C
|
||||
iconpalette.C
|
||||
lengthcombo.C
|
||||
panelstack.C
|
||||
QAboutDialog.C
|
||||
QBibitemDialog.C
|
||||
QBibtexDialog.C
|
||||
QBoxDialog.C
|
||||
QBranchDialog.C
|
||||
QBrowseBox.C
|
||||
QChangesDialog.C
|
||||
QCharacterDialog.C
|
||||
QCitationDialog.C
|
||||
QCommandBuffer.C
|
||||
QCommandEdit.C
|
||||
QContentPane.C
|
||||
QDelimiterDialog.C
|
||||
QDocumentDialog.C
|
||||
QErrorListDialog.C
|
||||
QERTDialog.C
|
||||
QExternalDialog.C
|
||||
QFloatDialog.C
|
||||
QGraphicsDialog.C
|
||||
QIncludeDialog.C
|
||||
QIndexDialog.C
|
||||
QLogDialog.C
|
||||
QViewSourceDialog.C
|
||||
QLPopupMenu.C
|
||||
QLPrintDialog.C
|
||||
QMathDialog.C
|
||||
QMathMatrixDialog.C
|
||||
QNoteDialog.C
|
||||
QParagraphDialog.C
|
||||
QPrefsDialog.C
|
||||
QRefDialog.C
|
||||
QSearchDialog.C
|
||||
QSendtoDialog.C
|
||||
qsetborder.C
|
||||
QShowFileDialog.C
|
||||
QSpellcheckerDialog.C
|
||||
QDialogView.C
|
||||
QTabularCreateDialog.C
|
||||
QTabularDialog.C
|
||||
QTexinfoDialog.C
|
||||
QThesaurusDialog.C
|
||||
QTocDialog.C
|
||||
qttableview.C
|
||||
QtView.C
|
||||
QURLDialog.C
|
||||
QVSpaceDialog.C
|
||||
QWrapDialog.C
|
||||
QLToolbar.C
|
||||
socket_callback.C
|
||||
validators.C
|
||||
''')
|
||||
|
||||
|
||||
src_frontends_qt3_header_files = Split('''
|
||||
BulletsModule.h
|
||||
FileDialog_private.h
|
||||
GuiApplication.h
|
||||
GuiClipboard.h
|
||||
GuiFontMetrics.h
|
||||
GuiImplementation.h
|
||||
GuiSelection.h
|
||||
GuiWorkArea.h
|
||||
QAbout.h
|
||||
QAboutDialog.h
|
||||
QBibitem.h
|
||||
QBibitemDialog.h
|
||||
QBibtex.h
|
||||
QBibtexDialog.h
|
||||
QBox.h
|
||||
QBoxDialog.h
|
||||
QBranch.h
|
||||
QBranchDialog.h
|
||||
QBrowseBox.h
|
||||
QChanges.h
|
||||
QChangesDialog.h
|
||||
QCharacter.h
|
||||
QCharacterDialog.h
|
||||
QCitation.h
|
||||
QCitationDialog.h
|
||||
QCommandBuffer.h
|
||||
QCommandEdit.h
|
||||
QContentPane.h
|
||||
QDelimiterDialog.h
|
||||
QDialogView.h
|
||||
QDocument.h
|
||||
QDocumentDialog.h
|
||||
QERT.h
|
||||
QERTDialog.h
|
||||
QErrorList.h
|
||||
QErrorListDialog.h
|
||||
QExternal.h
|
||||
QExternalDialog.h
|
||||
QFloat.h
|
||||
QFloatDialog.h
|
||||
QGraphics.h
|
||||
QGraphicsDialog.h
|
||||
QInclude.h
|
||||
QIncludeDialog.h
|
||||
QIndex.h
|
||||
QIndexDialog.h
|
||||
QLImage.h
|
||||
QLMenubar.h
|
||||
QLPainter.h
|
||||
QLPopupMenu.h
|
||||
QLPrintDialog.h
|
||||
QLToolbar.h
|
||||
QLog.h
|
||||
QLogDialog.h
|
||||
QLyXKeySym.h
|
||||
QMath.h
|
||||
QMathDialog.h
|
||||
QMathMatrixDialog.h
|
||||
QNote.h
|
||||
QNoteDialog.h
|
||||
QParagraph.h
|
||||
QParagraphDialog.h
|
||||
QPrefs.h
|
||||
QPrefsDialog.h
|
||||
QPrint.h
|
||||
QRef.h
|
||||
QRefDialog.h
|
||||
QSearch.h
|
||||
QSearchDialog.h
|
||||
QSendto.h
|
||||
QSendtoDialog.h
|
||||
QShowFile.h
|
||||
QShowFileDialog.h
|
||||
QSpellchecker.h
|
||||
QSpellcheckerDialog.h
|
||||
QTabular.h
|
||||
QTabularCreate.h
|
||||
QTabularCreateDialog.h
|
||||
QTabularDialog.h
|
||||
QTexinfo.h
|
||||
QTexinfoDialog.h
|
||||
QThesaurus.h
|
||||
QThesaurusDialog.h
|
||||
QToc.h
|
||||
QTocDialog.h
|
||||
QURL.h
|
||||
QURLDialog.h
|
||||
QVSpace.h
|
||||
QVSpaceDialog.h
|
||||
QViewSource.h
|
||||
QViewSourceDialog.h
|
||||
QWorkArea.h
|
||||
QWrap.h
|
||||
QWrapDialog.h
|
||||
Qt2BC.h
|
||||
QtLyXView.h
|
||||
QtView.h
|
||||
checkedwidgets.h
|
||||
emptytable.h
|
||||
floatplacement.h
|
||||
iconpalette.h
|
||||
lcolorcache.h
|
||||
lengthcombo.h
|
||||
panelstack.h
|
||||
qcoloritem.h
|
||||
qfont_loader.h
|
||||
qfontexample.h
|
||||
qlkey.h
|
||||
qscreen.h
|
||||
qsetborder.h
|
||||
qtTimeout.h
|
||||
qt_helpers.h
|
||||
qttableview.h
|
||||
socket_callback.h
|
||||
validators.h
|
||||
''')
|
||||
|
||||
|
||||
src_frontends_qt3_files = Split('''
|
||||
Alert_pimpl.C
|
||||
BulletsModule.C
|
||||
Dialogs.C
|
||||
FileDialog.C
|
||||
FileDialog_private.C
|
||||
GuiApplication.C
|
||||
GuiClipboard.C
|
||||
GuiFontMetrics.C
|
||||
GuiSelection.C
|
||||
LyXKeySymFactory.C
|
||||
QAbout.C
|
||||
QAboutDialog.C
|
||||
QBibitem.C
|
||||
QBibitemDialog.C
|
||||
QBibtex.C
|
||||
QBibtexDialog.C
|
||||
QBox.C
|
||||
QBoxDialog.C
|
||||
QBranch.C
|
||||
QBranchDialog.C
|
||||
QBrowseBox.C
|
||||
QChanges.C
|
||||
QChangesDialog.C
|
||||
QCharacter.C
|
||||
QCharacterDialog.C
|
||||
QCitation.C
|
||||
QCitationDialog.C
|
||||
QCommandBuffer.C
|
||||
QCommandEdit.C
|
||||
QContentPane.C
|
||||
QDelimiterDialog.C
|
||||
QDialogView.C
|
||||
QDocument.C
|
||||
QDocumentDialog.C
|
||||
QERT.C
|
||||
QERTDialog.C
|
||||
QErrorList.C
|
||||
QErrorListDialog.C
|
||||
QExternal.C
|
||||
QExternalDialog.C
|
||||
QFloat.C
|
||||
QFloatDialog.C
|
||||
QGraphics.C
|
||||
QGraphicsDialog.C
|
||||
QInclude.C
|
||||
QIncludeDialog.C
|
||||
QIndex.C
|
||||
QIndexDialog.C
|
||||
QLImage.C
|
||||
QLMenubar.C
|
||||
QLPainter.C
|
||||
QLPopupMenu.C
|
||||
QLPrintDialog.C
|
||||
QLToolbar.C
|
||||
QLog.C
|
||||
QLogDialog.C
|
||||
QLyXKeySym.C
|
||||
QMath.C
|
||||
QMathDialog.C
|
||||
QMathMatrixDialog.C
|
||||
QNote.C
|
||||
QNoteDialog.C
|
||||
QParagraph.C
|
||||
QParagraphDialog.C
|
||||
QPrefs.C
|
||||
QPrefsDialog.C
|
||||
QPrint.C
|
||||
QRef.C
|
||||
QRefDialog.C
|
||||
QSearch.C
|
||||
QSearchDialog.C
|
||||
QSendto.C
|
||||
QSendtoDialog.C
|
||||
QShowFile.C
|
||||
QShowFileDialog.C
|
||||
QSpellchecker.C
|
||||
QSpellcheckerDialog.C
|
||||
QTabular.C
|
||||
QTabularCreate.C
|
||||
QTabularCreateDialog.C
|
||||
QTabularDialog.C
|
||||
QTexinfo.C
|
||||
QTexinfoDialog.C
|
||||
QThesaurus.C
|
||||
QThesaurusDialog.C
|
||||
QToc.C
|
||||
QTocDialog.C
|
||||
QURL.C
|
||||
QURLDialog.C
|
||||
QVSpace.C
|
||||
QVSpaceDialog.C
|
||||
QViewSource.C
|
||||
QViewSourceDialog.C
|
||||
QWorkArea.C
|
||||
QWrap.C
|
||||
QWrapDialog.C
|
||||
Qt2BC.C
|
||||
QtView.C
|
||||
checkedwidgets.C
|
||||
emptytable.C
|
||||
floatplacement.C
|
||||
iconpalette.C
|
||||
lcolorcache.C
|
||||
lengthcombo.C
|
||||
panelstack.C
|
||||
qcoloritem.C
|
||||
qfont_loader.C
|
||||
qfontexample.C
|
||||
qscreen.C
|
||||
qsetborder.C
|
||||
qtTimeout.C
|
||||
qt_helpers.C
|
||||
qttableview.C
|
||||
socket_callback.C
|
||||
validators.C
|
||||
''')
|
||||
|
||||
|
||||
src_frontends_qt4_ui_files = Split('''
|
||||
BiblioUi.ui
|
||||
|
622
intl/plural.c
622
intl/plural.c
File diff suppressed because it is too large
Load Diff
@ -373,39 +373,10 @@ ${srcdir}/POTFILES.in: $(POTFILE_IN_DEPS)
|
||||
sort | uniq ) > $@-t \
|
||||
&& mv $@-t $@
|
||||
|
||||
l10n_pots: qt3_l10n.pot qt4_l10n.pot layouts_l10n.pot languages_l10n.pot ui_l10n.pot
|
||||
l10n_pots: qt4_l10n.pot layouts_l10n.pot languages_l10n.pot ui_l10n.pot
|
||||
cat $^ | \
|
||||
msguniq -o $(DOMAIN).po && rm -f $^
|
||||
|
||||
qt3_l10n.pot: $(top_srcdir)/src/frontends/qt3/ui/*.ui
|
||||
LC_ALL=C ; export LC_ALL ; \
|
||||
$(AWK) -v top_srcdir="$(top_srcdir)" ' \
|
||||
function fixupfilename() \
|
||||
{\
|
||||
return substr(FILENAME, length(top_srcdir "/") + 1);\
|
||||
}\
|
||||
BEGIN { \
|
||||
previousline=""; \
|
||||
} \
|
||||
{ \
|
||||
if ((!(previousline ~ /^ *< *property *name *= *"shortcut" *> *$$/) && \
|
||||
!(previousline ~ /^ *< *property *name *= *"caption" *> *$$/)) \
|
||||
&& $$0 ~ /<string>/) { \
|
||||
line=$$0; \
|
||||
sub(/.*<string>/, "", line); \
|
||||
sub(/<\/string>.*/, "", line); \
|
||||
gsub(/&/, "\\&", line); \
|
||||
gsub(/</, "<", line); \
|
||||
gsub(/>/, ">", line); \
|
||||
gsub(/"/, "\\\"", line); \
|
||||
if (length(line) > 0) { \
|
||||
printf("#: %s:%d\nmsgid \"%s\"\nmsgstr \"\"\n\n", \
|
||||
fixupfilename(), FNR, line); \
|
||||
} \
|
||||
} \
|
||||
previousline=$$0; \
|
||||
}' \
|
||||
${top_srcdir}/src/frontends/qt3/ui/*.ui > $@
|
||||
|
||||
qt4_l10n.pot: $(top_srcdir)/src/frontends/qt4/ui/*.ui
|
||||
LC_ALL=C ; export LC_ALL ; \
|
||||
|
@ -74,55 +74,6 @@ src/frontends/gtk/GToc.C
|
||||
src/frontends/gtk/GUrl.C
|
||||
src/frontends/gtk/GVSpace.C
|
||||
src/frontends/gtk/GWrap.C
|
||||
src/frontends/qt3/Alert_pimpl.C
|
||||
src/frontends/qt3/BulletsModule.C
|
||||
src/frontends/qt3/Dialogs.C
|
||||
src/frontends/qt3/FileDialog.C
|
||||
src/frontends/qt3/QAbout.C
|
||||
src/frontends/qt3/QBibitem.C
|
||||
src/frontends/qt3/QBibtex.C
|
||||
src/frontends/qt3/QBibtexDialog.C
|
||||
src/frontends/qt3/QBox.C
|
||||
src/frontends/qt3/QBoxDialog.C
|
||||
src/frontends/qt3/QBranch.C
|
||||
src/frontends/qt3/QChanges.C
|
||||
src/frontends/qt3/QCharacter.C
|
||||
src/frontends/qt3/QCitation.C
|
||||
src/frontends/qt3/QCitationDialog.C
|
||||
src/frontends/qt3/QCommandBuffer.C
|
||||
src/frontends/qt3/QDelimiterDialog.C
|
||||
src/frontends/qt3/QDocument.C
|
||||
src/frontends/qt3/QDocumentDialog.C
|
||||
src/frontends/qt3/QERT.C
|
||||
src/frontends/qt3/QExternal.C
|
||||
src/frontends/qt3/QFloat.C
|
||||
src/frontends/qt3/QGraphics.C
|
||||
src/frontends/qt3/QInclude.C
|
||||
src/frontends/qt3/QMath.C
|
||||
src/frontends/qt3/QMathDialog.C
|
||||
src/frontends/qt3/QMathMatrixDialog.C
|
||||
src/frontends/qt3/QNote.C
|
||||
src/frontends/qt3/QParagraph.C
|
||||
src/frontends/qt3/QPrefs.C
|
||||
src/frontends/qt3/QPrefsDialog.C
|
||||
src/frontends/qt3/QPrint.C
|
||||
src/frontends/qt3/QRef.C
|
||||
src/frontends/qt3/QSearch.C
|
||||
src/frontends/qt3/QSendto.C
|
||||
src/frontends/qt3/QShowFile.C
|
||||
src/frontends/qt3/QSpellchecker.C
|
||||
src/frontends/qt3/QTabular.C
|
||||
src/frontends/qt3/QTabularCreate.C
|
||||
src/frontends/qt3/QTexinfo.C
|
||||
src/frontends/qt3/QThesaurus.C
|
||||
src/frontends/qt3/QToc.C
|
||||
src/frontends/qt3/QURL.C
|
||||
src/frontends/qt3/QVSpace.C
|
||||
src/frontends/qt3/QWrap.C
|
||||
src/frontends/qt3/Qt2BC.h
|
||||
src/frontends/qt3/QtView.C
|
||||
src/frontends/qt3/floatplacement.C
|
||||
src/frontends/qt3/validators.C
|
||||
src/frontends/qt4/Alert_pimpl.C
|
||||
src/frontends/qt4/BulletsModule.C
|
||||
src/frontends/qt4/Dialogs.C
|
||||
@ -185,6 +136,7 @@ src/insets/insetfloat.C
|
||||
src/insets/insetfloatlist.C
|
||||
src/insets/insetfoot.C
|
||||
src/insets/insetgraphics.C
|
||||
src/insets/insethfill.C
|
||||
src/insets/insetinclude.C
|
||||
src/insets/insetindex.C
|
||||
src/insets/insetmarginal.C
|
||||
|
@ -31,11 +31,7 @@ OTHERLIBS = $(BOOST_LIBS) $(LIBICONV) $(INTLLIBS) $(AIKSAURUS_LIBS) @LIBS@ $(SOC
|
||||
|
||||
bin_PROGRAMS = lyx
|
||||
noinst_PROGRAMS = $(FRONTENDS_PROGS)
|
||||
EXTRA_PROGRAMS = lyx-qt3 lyx-gtk lyx-qt4
|
||||
|
||||
lyx_qt3_LDADD = $(lyx_OBJECTS) $(LYX_PRE_LIBS) \
|
||||
frontends/qt3/libqt3.la $(LYX_POST_LIBS) $(OTHERLIBS)
|
||||
lyx_qt3_SOURCES = main.C
|
||||
EXTRA_PROGRAMS = lyx-gtk lyx-qt4
|
||||
|
||||
lyx_qt4_LDADD = $(lyx_OBJECTS) $(LYX_PRE_LIBS) \
|
||||
frontends/qt4/libqt4.la $(LYX_POST_LIBS) $(OTHERLIBS)
|
||||
|
@ -156,7 +156,7 @@ public:
|
||||
virtual void redrawWorkArea();
|
||||
|
||||
/// Temporary method to access the current workArea.
|
||||
/// This is needed for the qt3 and gtk frontend.
|
||||
/// This is needed for the gtk frontend.
|
||||
frontend::WorkArea * workArea();
|
||||
|
||||
/// show the error list to the user
|
||||
|
@ -2,7 +2,7 @@ include $(top_srcdir)/config/common.am
|
||||
|
||||
SUBDIRS = controllers $(FRONTENDS_SUBDIRS)
|
||||
|
||||
DIST_SUBDIRS = controllers qt3 gtk qt4
|
||||
DIST_SUBDIRS = controllers gtk qt4
|
||||
|
||||
EXTRA_DIST = pch.h
|
||||
|
||||
|
@ -89,7 +89,7 @@ public:
|
||||
/// grey out (no buffer)
|
||||
void greyOut();
|
||||
|
||||
/// FIXME: should be protected, public until the qt3 and gtk frontends are
|
||||
/// FIXME: should be protected, public until the gtk frontend are
|
||||
/// cleaned up.
|
||||
void processKeySym(LyXKeySymPtr key, key_modifier::state state);
|
||||
|
||||
@ -98,13 +98,13 @@ protected:
|
||||
virtual void expose(int x, int y, int w, int h) = 0;
|
||||
|
||||
public:
|
||||
/// FIXME: This is public because of qt3 and gtk, should be protected
|
||||
/// FIXME: This is public because of gtk, should be protected
|
||||
void dispatch(FuncRequest const & cmd0);
|
||||
|
||||
/// FIXME: This is public because of qt3 and gtk, should be protected
|
||||
/// FIXME: This is public because of gtk, should be protected
|
||||
void resizeBufferView();
|
||||
|
||||
/// FIXME: This is public because of qt3 and gtk, should be protected
|
||||
/// FIXME: This is public because of gtk, should be protected
|
||||
void scrollBufferView(int position);
|
||||
|
||||
protected:
|
||||
|
@ -1,125 +0,0 @@
|
||||
/**
|
||||
* \file qt3/Alert_pimpl.C
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author John Levon
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "Alert_pimpl.h"
|
||||
#include "Alert.h"
|
||||
|
||||
#include "ui/QAskForTextDialog.h"
|
||||
#include "qt_helpers.h"
|
||||
|
||||
#include "gettext.h"
|
||||
|
||||
#include <qapplication.h>
|
||||
#include <qmessagebox.h>
|
||||
#include <qlabel.h>
|
||||
#include <qlineedit.h>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
namespace lyx {
|
||||
|
||||
using lyx::docstring;
|
||||
using lyx::support::bformat;
|
||||
|
||||
using std::pair;
|
||||
using std::make_pair;
|
||||
using std::string;
|
||||
|
||||
|
||||
int prompt_pimpl(docstring const & tit, docstring const & question,
|
||||
int default_button, int cancel_button,
|
||||
docstring const & b1, docstring const & b2, docstring const & b3)
|
||||
{
|
||||
docstring const title = bformat(_("LyX: %1$s"), tit);
|
||||
|
||||
QWidget * const parent = qApp->focusWidget() ?
|
||||
qApp->focusWidget() : qApp->mainWidget();
|
||||
|
||||
int res = QMessageBox::information(parent,
|
||||
toqstr(title),
|
||||
toqstr(formatted(question)),
|
||||
toqstr(b1),
|
||||
toqstr(b2),
|
||||
b3.empty() ? QString::null : toqstr(b3),
|
||||
default_button, cancel_button);
|
||||
|
||||
// Qt bug: can return -1 on cancel or WM close, despite the docs.
|
||||
if (res == -1)
|
||||
res = cancel_button;
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
void warning_pimpl(docstring const & tit, docstring const & message)
|
||||
{
|
||||
QWidget * const parent = qApp->focusWidget() ?
|
||||
qApp->focusWidget() : qApp->mainWidget();
|
||||
|
||||
docstring const title = bformat(_("LyX: %1$s"), tit);
|
||||
QMessageBox::warning(parent,
|
||||
toqstr(title),
|
||||
toqstr(formatted(message)));
|
||||
}
|
||||
|
||||
|
||||
void error_pimpl(docstring const & tit, docstring const & message)
|
||||
{
|
||||
QWidget * const parent = qApp->focusWidget() ?
|
||||
qApp->focusWidget() : qApp->mainWidget();
|
||||
|
||||
docstring const title = bformat(_("LyX: %1$s"), tit);
|
||||
QMessageBox::critical(parent,
|
||||
toqstr(title),
|
||||
toqstr(formatted(message)));
|
||||
}
|
||||
|
||||
|
||||
void information_pimpl(docstring const & tit, docstring const & message)
|
||||
{
|
||||
QWidget * const parent = qApp->focusWidget() ?
|
||||
qApp->focusWidget() : qApp->mainWidget();
|
||||
|
||||
docstring const title = bformat(_("LyX: %1$s"), tit);
|
||||
QMessageBox::information(parent,
|
||||
toqstr(title),
|
||||
toqstr(formatted(message)));
|
||||
}
|
||||
|
||||
|
||||
pair<bool, docstring> const
|
||||
askForText_pimpl(docstring const & msg, docstring const & dflt)
|
||||
{
|
||||
QWidget * const parent = qApp->focusWidget() ?
|
||||
qApp->focusWidget() : qApp->mainWidget();
|
||||
|
||||
docstring const title = bformat(_("LyX: %1$s"), msg);
|
||||
QAskForTextDialog d(parent, toqstr(title), true);
|
||||
// We try to go with the title set above.
|
||||
// d.setCaption(qt_("LyX: Enter text"));
|
||||
|
||||
// less than ideal !
|
||||
d.askLA->setText(toqstr('&' + msg));
|
||||
d.askLE->setText(toqstr(dflt));
|
||||
d.askLE->setFocus();
|
||||
int ret = d.exec();
|
||||
|
||||
d.hide();
|
||||
|
||||
if (ret)
|
||||
return make_pair<bool, docstring>(true, qstring_to_ucs4(d.askLE->text()));
|
||||
else
|
||||
return make_pair<bool, docstring>(false, docstring());
|
||||
}
|
||||
|
||||
|
||||
} // namespace lyx
|
@ -1,364 +0,0 @@
|
||||
/**
|
||||
* \file BulletsModule.C
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Edwin Leuven
|
||||
* \author John Levon
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "BulletsModule.h"
|
||||
#include "QBrowseBox.h"
|
||||
#include "qt_helpers.h"
|
||||
|
||||
#include "support/filetools.h"
|
||||
|
||||
#include <qinputdialog.h>
|
||||
#include <qpopupmenu.h>
|
||||
#include <qpushbutton.h>
|
||||
#include <qcombobox.h>
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
using lyx::support::libFileSearch;
|
||||
|
||||
using std::string;
|
||||
|
||||
|
||||
BulletsModule::BulletsModule(QWidget * parent, const char * name, WFlags fl)
|
||||
: BulletsModuleBase(parent, name, fl), tmpbulletset(0),
|
||||
bullet_pressed_(0)
|
||||
{
|
||||
for (int iter = 0; iter < 4; ++iter) {
|
||||
bullets_[iter] = ITEMIZE_DEFAULTS[iter];
|
||||
}
|
||||
|
||||
QPopupMenu * pm = new QPopupMenu(this);
|
||||
|
||||
QPopupMenu * pm1 = new QPopupMenu(pm);
|
||||
QPopupMenu * pm2 = new QPopupMenu(pm);
|
||||
QPopupMenu * pm3 = new QPopupMenu(pm);
|
||||
QPopupMenu * pm4 = new QPopupMenu(pm);
|
||||
QPopupMenu * pm5 = new QPopupMenu(pm);
|
||||
QPopupMenu * pm6 = new QPopupMenu(pm);
|
||||
|
||||
standard_ = new QBrowseBox(6, 6, pm1);
|
||||
maths_ = new QBrowseBox(6, 6, pm2);
|
||||
ding1_ = new QBrowseBox(6, 6, pm3);
|
||||
ding2_ = new QBrowseBox(6, 6, pm4);
|
||||
ding3_ = new QBrowseBox(6, 6, pm5);
|
||||
ding4_ = new QBrowseBox(6, 6, pm6);
|
||||
|
||||
pm1->insertItem(standard_);
|
||||
pm2->insertItem(maths_);
|
||||
pm3->insertItem(ding1_);
|
||||
pm4->insertItem(ding2_);
|
||||
pm5->insertItem(ding3_);
|
||||
pm6->insertItem(ding4_);
|
||||
|
||||
pm->insertItem(qt_("&Standard"), pm1, 0);
|
||||
pm->insertItem(qt_("&Maths"), pm2, 1);
|
||||
pm->insertItem(qt_("Dings &1"), pm3, 2);
|
||||
pm->insertItem(qt_("Dings &2"), pm4, 3);
|
||||
pm->insertItem(qt_("Dings &3"), pm5, 4);
|
||||
pm->insertItem(qt_("Dings &4"), pm6, 5);
|
||||
pm->insertSeparator();
|
||||
// FIXME: make this checkable
|
||||
pm->insertItem(qt_("&Custom..."), this, SLOT(setCustom()), 0, 6);
|
||||
|
||||
connect(bullet1PB, SIGNAL(pressed()), this, SLOT(clicked1()));
|
||||
bullet1PB->setPopup(pm);
|
||||
|
||||
connect(bullet2PB, SIGNAL(pressed()), this, SLOT(clicked2()));
|
||||
bullet2PB->setPopup(pm);
|
||||
|
||||
connect(bullet3PB, SIGNAL(pressed()), this, SLOT(clicked3()));
|
||||
bullet3PB->setPopup(pm);
|
||||
|
||||
connect(bullet4PB, SIGNAL(pressed()), this, SLOT(clicked4()));
|
||||
bullet4PB->setPopup(pm);
|
||||
|
||||
// insert pixmaps
|
||||
string bmfile;
|
||||
bmfile = libFileSearch("images", "standard", "xpm");
|
||||
standard_->insertItem(QPixmap(toqstr(bmfile)));
|
||||
|
||||
bmfile = libFileSearch("images", "amssymb", "xpm");
|
||||
maths_->insertItem(QPixmap(toqstr(bmfile)));
|
||||
|
||||
bmfile = libFileSearch("images", "psnfss1", "xpm");
|
||||
ding1_->insertItem(QPixmap(toqstr(bmfile)));
|
||||
|
||||
bmfile = libFileSearch("images", "psnfss2", "xpm");
|
||||
ding2_->insertItem(QPixmap(toqstr(bmfile)));
|
||||
|
||||
bmfile = libFileSearch("images", "psnfss3", "xpm");
|
||||
ding3_->insertItem(QPixmap(toqstr(bmfile)));
|
||||
|
||||
bmfile = libFileSearch("images", "psnfss4", "xpm");
|
||||
ding4_->insertItem(QPixmap(toqstr(bmfile)));
|
||||
|
||||
connect(standard_, SIGNAL(selected(int, int)),
|
||||
this, SLOT(standard(int, int)));
|
||||
|
||||
connect(maths_, SIGNAL(selected(int, int)),
|
||||
this, SLOT(maths(int, int)));
|
||||
|
||||
connect(ding1_, SIGNAL(selected(int, int)),
|
||||
this, SLOT(ding1(int, int)));
|
||||
|
||||
connect(ding2_, SIGNAL(selected(int, int)),
|
||||
this, SLOT(ding2(int, int)));
|
||||
|
||||
connect(ding3_, SIGNAL(selected(int, int)),
|
||||
this, SLOT(ding3(int, int)));
|
||||
|
||||
connect(ding4_, SIGNAL(selected(int, int)),
|
||||
this, SLOT(ding4(int, int)));
|
||||
|
||||
connect(bullet1PB, SIGNAL(pressed()), this, SLOT(selected1()));
|
||||
connect(bullet2PB, SIGNAL(pressed()), this, SLOT(selected2()));
|
||||
connect(bullet3PB, SIGNAL(pressed()), this, SLOT(selected3()));
|
||||
connect(bullet4PB, SIGNAL(pressed()), this, SLOT(selected4()));
|
||||
connect(bulletsize1CO, SIGNAL(activated(int)), this, SLOT(updateSizes()));
|
||||
connect(bulletsize2CO, SIGNAL(activated(int)), this, SLOT(updateSizes()));
|
||||
connect(bulletsize3CO, SIGNAL(activated(int)), this, SLOT(updateSizes()));
|
||||
connect(bulletsize4CO, SIGNAL(activated(int)), this, SLOT(updateSizes()));
|
||||
|
||||
// update the view
|
||||
for (int i = 0; i < 4; ++i)
|
||||
setBullet(bullet1PB, bulletsize1CO, bullets_[i]);
|
||||
}
|
||||
|
||||
|
||||
BulletsModule::~BulletsModule()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void BulletsModule::updateSizes()
|
||||
{
|
||||
// emit signal
|
||||
changed();
|
||||
|
||||
// -1 apparently means default...
|
||||
bullets_[0].setSize(bulletsize1CO->currentItem() - 1);
|
||||
bullets_[1].setSize(bulletsize2CO->currentItem() - 1);
|
||||
bullets_[2].setSize(bulletsize3CO->currentItem() - 1);
|
||||
bullets_[3].setSize(bulletsize4CO->currentItem() - 1);
|
||||
}
|
||||
|
||||
|
||||
// These arrive before the menus are launched.
|
||||
void BulletsModule::clicked1()
|
||||
{
|
||||
bullet_pressed_ = &bullets_[0];
|
||||
}
|
||||
|
||||
|
||||
void BulletsModule::clicked2()
|
||||
{
|
||||
bullet_pressed_ = &bullets_[1];
|
||||
}
|
||||
|
||||
|
||||
void BulletsModule::clicked3()
|
||||
{
|
||||
bullet_pressed_ = &bullets_[2];
|
||||
}
|
||||
|
||||
|
||||
void BulletsModule::clicked4()
|
||||
{
|
||||
bullet_pressed_ = &bullets_[3];
|
||||
}
|
||||
|
||||
|
||||
// These arrive *after* the menus have done their work
|
||||
void BulletsModule::selected1()
|
||||
{
|
||||
if (!tmpbulletset)
|
||||
return;
|
||||
tmpbulletset = false;
|
||||
bullets_[0] = tmpbullet;
|
||||
setBullet(bullet1PB, bulletsize1CO, bullets_[0]);
|
||||
// emit signal
|
||||
changed();
|
||||
}
|
||||
|
||||
|
||||
void BulletsModule::selected2()
|
||||
{
|
||||
if (!tmpbulletset)
|
||||
return;
|
||||
tmpbulletset = false;
|
||||
bullets_[1] = tmpbullet;
|
||||
setBullet(bullet2PB, bulletsize2CO, bullets_[1]);
|
||||
// emit signal
|
||||
changed();
|
||||
}
|
||||
|
||||
|
||||
void BulletsModule::selected3()
|
||||
{
|
||||
if (!tmpbulletset)
|
||||
return;
|
||||
tmpbulletset = false;
|
||||
bullets_[2] = tmpbullet;
|
||||
setBullet(bullet3PB, bulletsize3CO, bullets_[2]);
|
||||
// emit signal
|
||||
changed();
|
||||
}
|
||||
|
||||
|
||||
void BulletsModule::selected4()
|
||||
{
|
||||
if (!tmpbulletset)
|
||||
return;
|
||||
tmpbulletset = false;
|
||||
bullets_[3] = tmpbullet;
|
||||
setBullet(bullet4PB, bulletsize4CO, bullets_[3]);
|
||||
// emit signal
|
||||
changed();
|
||||
}
|
||||
|
||||
|
||||
QPixmap BulletsModule::getPixmap(int font, int character)
|
||||
{
|
||||
int col = character % 6;
|
||||
int row = (character - col) / 6;
|
||||
|
||||
switch (font) {
|
||||
case 0:
|
||||
return standard_->pixmap(row,col);
|
||||
case 1:
|
||||
return maths_->pixmap(row,col);
|
||||
case 2:
|
||||
return ding1_->pixmap(row,col);
|
||||
case 3:
|
||||
return ding2_->pixmap(row,col);
|
||||
case 4:
|
||||
return ding3_->pixmap(row,col);
|
||||
case 5:
|
||||
return ding4_->pixmap(row,col);
|
||||
default:
|
||||
return standard_->pixmap(row,col);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void BulletsModule::setBullet(QPushButton * pb, QComboBox * co, Bullet const & b)
|
||||
{
|
||||
if (b.getFont() == -1) {
|
||||
pb->setPixmap(QPixmap());
|
||||
pb->setText(toqstr(b.getText()));
|
||||
} else {
|
||||
pb->setPixmap(getPixmap(b.getFont(), b.getCharacter()));
|
||||
}
|
||||
|
||||
pb->setMinimumSize(QSize(50, 50));
|
||||
|
||||
co->setCurrentItem(b.getSize() + 1);
|
||||
}
|
||||
|
||||
|
||||
void BulletsModule::setBullet(int level, const Bullet & bullet)
|
||||
{
|
||||
bullets_[level] = bullet;
|
||||
|
||||
QPushButton * pb = 0;
|
||||
QComboBox * co = 0;
|
||||
|
||||
switch (level) {
|
||||
case 0: pb = bullet1PB; co = bulletsize1CO; break;
|
||||
case 1: pb = bullet2PB; co = bulletsize2CO; break;
|
||||
case 2: pb = bullet3PB; co = bulletsize3CO; break;
|
||||
case 3: pb = bullet4PB; co = bulletsize4CO; break;
|
||||
default: BOOST_ASSERT(false); break;
|
||||
}
|
||||
|
||||
setBullet(pb, co, bullet);
|
||||
}
|
||||
|
||||
|
||||
Bullet const & BulletsModule::getBullet(int level) const
|
||||
{
|
||||
return bullets_[level];
|
||||
}
|
||||
|
||||
|
||||
void BulletsModule::setCurrentBullet(int font, int character)
|
||||
{
|
||||
tmpbulletset = true;
|
||||
tmpbullet.setFont(font);
|
||||
tmpbullet.setCharacter(character);
|
||||
}
|
||||
|
||||
|
||||
void BulletsModule::standard(int row, int col)
|
||||
{
|
||||
setCurrentBullet(0, 6 * row + col);
|
||||
}
|
||||
|
||||
|
||||
void BulletsModule::maths(int row, int col)
|
||||
{
|
||||
setCurrentBullet(1, 6 * row + col);
|
||||
}
|
||||
|
||||
|
||||
void BulletsModule::ding1(int row, int col)
|
||||
{
|
||||
setCurrentBullet(2, 6 * row + col);
|
||||
}
|
||||
|
||||
|
||||
void BulletsModule::ding2(int row, int col)
|
||||
{
|
||||
setCurrentBullet(3, 6 * row + col);
|
||||
}
|
||||
|
||||
|
||||
void BulletsModule::ding3(int row, int col)
|
||||
{
|
||||
setCurrentBullet(4, 6 * row + col);
|
||||
}
|
||||
|
||||
|
||||
void BulletsModule::ding4(int row, int col)
|
||||
{
|
||||
setCurrentBullet(5, 6 * row + col);
|
||||
}
|
||||
|
||||
|
||||
void BulletsModule::setCustom()
|
||||
{
|
||||
QString const input = bullet_pressed_ ?
|
||||
toqstr(bullet_pressed_->getText()) : QString::null;
|
||||
|
||||
bool ok = false;
|
||||
QString text = QInputDialog::getText(
|
||||
qt_( "Bullets" ),
|
||||
qt_( "Enter a custom bullet" ),
|
||||
QLineEdit::Normal,
|
||||
input, &ok, this );
|
||||
|
||||
if (!ok)
|
||||
return;
|
||||
|
||||
tmpbulletset = true;
|
||||
tmpbullet.setText(qstring_to_ucs4(text));
|
||||
tmpbullet.setFont(-1);
|
||||
}
|
||||
|
||||
#include "BulletsModule_moc.cpp"
|
||||
|
||||
|
||||
namespace lyx {
|
||||
|
||||
|
||||
} // namespace lyx
|
@ -1,97 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file BulletsModule.h
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Edwin Leuven
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#ifndef QBULLETSMODULE_H
|
||||
#define QBULLETSMODULE_H
|
||||
|
||||
|
||||
#include "ui/BulletsModuleBase.h"
|
||||
#include "Bullet.h"
|
||||
#include <boost/array.hpp>
|
||||
|
||||
|
||||
namespace lyx {
|
||||
|
||||
class QBrowseBox;
|
||||
class QPushButton;
|
||||
class QComboBox;
|
||||
class QPixmap;
|
||||
|
||||
class BulletsModule : public BulletsModuleBase {
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
BulletsModule(QWidget * parent = 0, const char * name = 0, WFlags fl = 0);
|
||||
|
||||
~BulletsModule();
|
||||
|
||||
/// set a bullet
|
||||
void setBullet(int level, const Bullet & bullet);
|
||||
|
||||
/// get bullet setting
|
||||
Bullet const & getBullet(int level) const;
|
||||
|
||||
signals:
|
||||
void changed();
|
||||
|
||||
protected slots:
|
||||
|
||||
/// menu callbacks
|
||||
void standard(int row, int col);
|
||||
void maths(int row, int col);
|
||||
void ding1(int row, int col);
|
||||
void ding2(int row, int col);
|
||||
void ding3(int row, int col);
|
||||
void ding4(int row, int col);
|
||||
|
||||
void updateSizes();
|
||||
|
||||
void clicked1();
|
||||
void clicked2();
|
||||
void clicked3();
|
||||
void clicked4();
|
||||
|
||||
void selected1();
|
||||
void selected2();
|
||||
void selected3();
|
||||
void selected4();
|
||||
|
||||
/// set custom (text) bullet
|
||||
void setCustom();
|
||||
|
||||
private:
|
||||
QPixmap getPixmap(int font, int character);
|
||||
|
||||
/// update GUI view
|
||||
void setBullet(QPushButton * pb, QComboBox * co, Bullet const & b);
|
||||
|
||||
/// set from menu
|
||||
void setCurrentBullet(int font, int character);
|
||||
|
||||
bool tmpbulletset;
|
||||
Bullet tmpbullet;
|
||||
|
||||
/// store results
|
||||
boost::array<Bullet, 4> bullets_;
|
||||
|
||||
QBrowseBox * standard_;
|
||||
QBrowseBox * maths_;
|
||||
QBrowseBox * ding1_;
|
||||
QBrowseBox * ding2_;
|
||||
QBrowseBox * ding3_;
|
||||
QBrowseBox * ding4_;
|
||||
Bullet * bullet_pressed_;
|
||||
};
|
||||
|
||||
|
||||
} // namespace lyx
|
||||
|
||||
#endif // BULLETSMODULE_H
|
File diff suppressed because it is too large
Load Diff
@ -1,326 +0,0 @@
|
||||
/**
|
||||
* \file qt3/Dialogs.C
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Angus Leeming
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "Dialogs.h"
|
||||
|
||||
#include "ControlAboutlyx.h"
|
||||
#include "ControlBibtex.h"
|
||||
#include "ControlBox.h"
|
||||
#include "ControlBranch.h"
|
||||
#include "ControlChanges.h"
|
||||
#include "ControlCharacter.h"
|
||||
#include "ControlCitation.h"
|
||||
#include "ControlDocument.h"
|
||||
#include "ControlErrorList.h"
|
||||
#include "ControlERT.h"
|
||||
#include "ControlExternal.h"
|
||||
#include "ControlFloat.h"
|
||||
#include "ControlGraphics.h"
|
||||
#include "ControlInclude.h"
|
||||
#include "ControlLog.h"
|
||||
#include "ControlViewSource.h"
|
||||
#include "ControlMath.h"
|
||||
#include "ControlNote.h"
|
||||
#include "ControlParagraph.h"
|
||||
#include "ControlPrefs.h"
|
||||
#include "ControlPrint.h"
|
||||
#include "ControlRef.h"
|
||||
#include "ControlSearch.h"
|
||||
#include "ControlSendto.h"
|
||||
#include "ControlShowFile.h"
|
||||
#include "ControlSpellchecker.h"
|
||||
#include "ControlTabular.h"
|
||||
#include "ControlTabularCreate.h"
|
||||
#include "ControlToc.h"
|
||||
#include "ControlVSpace.h"
|
||||
#include "ControlWrap.h"
|
||||
|
||||
#include "Qt2BC.h"
|
||||
#include "ButtonController.h"
|
||||
#include "QAbout.h"
|
||||
#include "QBibitem.h"
|
||||
#include "QBibtex.h"
|
||||
#include "QBox.h"
|
||||
#include "QBranch.h"
|
||||
#include "QChanges.h"
|
||||
#include "QCharacter.h"
|
||||
#include "QCitation.h"
|
||||
#include "QDocument.h"
|
||||
#include "QErrorList.h"
|
||||
#include "QERT.h"
|
||||
#include "QExternal.h"
|
||||
#include "QFloat.h"
|
||||
// Here would be an appropriate point to lecture on the evils
|
||||
// of the Qt headers, those most fucked up of disgusting ratholes.
|
||||
// But I won't.
|
||||
#undef signals
|
||||
#include "QGraphics.h"
|
||||
#include "QInclude.h"
|
||||
#include "QIndex.h"
|
||||
#include "QLog.h"
|
||||
#include "QViewSource.h"
|
||||
#include "QMath.h"
|
||||
#include "QNote.h"
|
||||
#include "QParagraph.h"
|
||||
#include "QPrefs.h"
|
||||
#include "QPrint.h"
|
||||
#include "QRef.h"
|
||||
#include "QSearch.h"
|
||||
#include "QSendto.h"
|
||||
#include "QShowFile.h"
|
||||
#include "QSpellchecker.h"
|
||||
#include "QTabular.h"
|
||||
#include "QTabularCreate.h"
|
||||
#include "QTexinfo.h"
|
||||
#include "QToc.h"
|
||||
#include "QURL.h"
|
||||
#include "QVSpace.h"
|
||||
#include "QWrap.h"
|
||||
|
||||
#ifdef HAVE_LIBAIKSAURUS
|
||||
#include "ControlThesaurus.h"
|
||||
#include "QThesaurus.h"
|
||||
#endif
|
||||
|
||||
#include "qt_helpers.h"
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
|
||||
namespace lyx {
|
||||
|
||||
using std::string;
|
||||
|
||||
using namespace lyx::frontend;
|
||||
|
||||
namespace {
|
||||
|
||||
char const * const dialognames[] = {
|
||||
"aboutlyx", "bibitem", "bibtex", "box", "branch", "changes", "character",
|
||||
"citation", "document", "errorlist", "ert", "external", "file",
|
||||
"findreplace", "float", "graphics", "include", "index", "label", "log", "view-source",
|
||||
"mathpanel", "mathdelimiter", "mathmatrix", "note", "paragraph",
|
||||
"prefs", "print", "ref", "sendto", "spellchecker","tabular", "tabularcreate",
|
||||
|
||||
#ifdef HAVE_LIBAIKSAURUS
|
||||
"thesaurus",
|
||||
#endif
|
||||
|
||||
"texinfo", "toc", "url", "vspace", "wrap" };
|
||||
|
||||
char const * const * const end_dialognames =
|
||||
dialognames + (sizeof(dialognames) / sizeof(char *));
|
||||
|
||||
class cmpCStr {
|
||||
public:
|
||||
cmpCStr(char const * name) : name_(name) {}
|
||||
bool operator()(char const * other) {
|
||||
return strcmp(other, name_) == 0;
|
||||
}
|
||||
private:
|
||||
char const * name_;
|
||||
};
|
||||
|
||||
|
||||
} // namespace anon
|
||||
|
||||
|
||||
bool Dialogs::isValidName(string const & name) const
|
||||
{
|
||||
return std::find_if(dialognames, end_dialognames,
|
||||
cmpCStr(name.c_str())) != end_dialognames;
|
||||
}
|
||||
|
||||
|
||||
Dialogs::DialogPtr Dialogs::build(string const & name)
|
||||
{
|
||||
BOOST_ASSERT(isValidName(name));
|
||||
|
||||
DialogPtr dialog(new Dialog(lyxview_, name));
|
||||
dialog->bc().view(new Qt2BC(dialog->bc()));
|
||||
|
||||
if (name == "aboutlyx") {
|
||||
dialog->setController(new ControlAboutlyx(*dialog));
|
||||
dialog->setView(new QAbout(*dialog));
|
||||
dialog->bc().bp(new OkCancelPolicy);
|
||||
} else if (name == "bibitem") {
|
||||
dialog->setController(new ControlCommand(*dialog, name, name));
|
||||
dialog->setView(new QBibitem(*dialog));
|
||||
dialog->bc().bp(new OkCancelReadOnlyPolicy);
|
||||
} else if (name == "bibtex") {
|
||||
dialog->setController(new ControlBibtex(*dialog));
|
||||
dialog->setView(new QBibtex(*dialog));
|
||||
dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
|
||||
} else if (name == "box") {
|
||||
dialog->setController(new ControlBox(*dialog));
|
||||
dialog->setView(new QBox(*dialog));
|
||||
dialog->bc().bp(new OkApplyCancelReadOnlyPolicy);
|
||||
} else if (name == "branch") {
|
||||
dialog->setController(new ControlBranch(*dialog));
|
||||
dialog->setView(new QBranch(*dialog));
|
||||
dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
|
||||
} else if (name == "changes") {
|
||||
dialog->setController(new ControlChanges(*dialog));
|
||||
dialog->setView(new QChanges(*dialog));
|
||||
dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
|
||||
} else if (name == "character") {
|
||||
dialog->setController(new ControlCharacter(*dialog));
|
||||
dialog->setView(new QCharacter(*dialog));
|
||||
dialog->bc().bp(new OkApplyCancelReadOnlyPolicy);
|
||||
} else if (name == "citation") {
|
||||
dialog->setController(new ControlCitation(*dialog));
|
||||
dialog->setView(new QCitation(*dialog));
|
||||
dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
|
||||
} else if (name == "document") {
|
||||
dialog->setController(new ControlDocument(*dialog));
|
||||
dialog->setView(new QDocument(*dialog));
|
||||
dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
|
||||
} else if (name == "errorlist") {
|
||||
dialog->setController(new ControlErrorList(*dialog));
|
||||
dialog->setView(new QErrorList(*dialog));
|
||||
dialog->bc().bp(new OkCancelPolicy);
|
||||
} else if (name == "ert") {
|
||||
dialog->setController(new ControlERT(*dialog));
|
||||
dialog->setView(new QERT(*dialog));
|
||||
dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
|
||||
} else if (name == "external") {
|
||||
dialog->setController(new ControlExternal(*dialog));
|
||||
dialog->setView(new QExternal(*dialog));
|
||||
dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
|
||||
} else if (name == "file") {
|
||||
dialog->setController(new ControlShowFile(*dialog));
|
||||
dialog->setView(new QShowFile(*dialog));
|
||||
dialog->bc().bp(new OkCancelPolicy);
|
||||
} else if (name == "findreplace") {
|
||||
dialog->setController(new ControlSearch(*dialog));
|
||||
dialog->setView(new QSearch(*dialog));
|
||||
dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
|
||||
} else if (name == "float") {
|
||||
dialog->setController(new ControlFloat(*dialog));
|
||||
dialog->setView(new QFloat(*dialog));
|
||||
dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
|
||||
} else if (name == "graphics") {
|
||||
dialog->setController(new ControlGraphics(*dialog));
|
||||
dialog->setView(new QGraphics(*dialog));
|
||||
dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
|
||||
} else if (name == "include") {
|
||||
dialog->setController(new ControlInclude(*dialog));
|
||||
dialog->setView(new QInclude(*dialog));
|
||||
dialog->bc().bp(new OkApplyCancelReadOnlyPolicy);
|
||||
} else if (name == "index") {
|
||||
dialog->setController(new ControlCommand(*dialog, name, name));
|
||||
dialog->setView(new QIndex(*dialog,
|
||||
_("Index Entry"),
|
||||
qt_("&Keyword:")));
|
||||
dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
|
||||
} else if (name == "label") {
|
||||
dialog->setController(new ControlCommand(*dialog, name, name));
|
||||
dialog->setView(new QIndex(*dialog,
|
||||
_("Label"),
|
||||
qt_("&Label:")));
|
||||
dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
|
||||
} else if (name == "log") {
|
||||
dialog->setController(new ControlLog(*dialog));
|
||||
dialog->setView(new QLog(*dialog));
|
||||
dialog->bc().bp(new OkCancelPolicy);
|
||||
} else if (name == "view-source") {
|
||||
dialog->setController(new ControlViewSource(*dialog));
|
||||
dialog->setView(new QViewSource(*dialog));
|
||||
dialog->bc().bp(new OkCancelPolicy);
|
||||
} else if (name == "mathpanel") {
|
||||
dialog->setController(new ControlMath(*dialog));
|
||||
dialog->setView(new QMath(*dialog));
|
||||
dialog->bc().bp(new IgnorantPolicy);
|
||||
} else if (name == "mathdelimiter") {
|
||||
dialog->setController(new ControlMath(*dialog));
|
||||
dialog->setView(new QMathDelimiter(*dialog));
|
||||
dialog->bc().bp(new IgnorantPolicy);
|
||||
} else if (name == "mathmatrix") {
|
||||
dialog->setController(new ControlMath(*dialog));
|
||||
dialog->setView(new QMathMatrix(*dialog));
|
||||
dialog->bc().bp(new IgnorantPolicy);
|
||||
} else if (name == "note") {
|
||||
dialog->setController(new ControlNote(*dialog));
|
||||
dialog->setView(new QNote(*dialog));
|
||||
dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
|
||||
} else if (name == "paragraph") {
|
||||
dialog->setController(new ControlParagraph(*dialog));
|
||||
dialog->setView(new QParagraph(*dialog));
|
||||
dialog->bc().bp(new OkApplyCancelReadOnlyPolicy);
|
||||
} else if (name == "prefs") {
|
||||
dialog->setController(new ControlPrefs(*dialog));
|
||||
dialog->setView(new QPrefs(*dialog));
|
||||
dialog->bc().bp(new PreferencesPolicy);
|
||||
} else if (name == "print") {
|
||||
dialog->setController(new ControlPrint(*dialog));
|
||||
dialog->setView(new QPrint(*dialog));
|
||||
dialog->bc().bp(new OkApplyCancelPolicy);
|
||||
} else if (name == "ref") {
|
||||
dialog->setController(new ControlRef(*dialog));
|
||||
dialog->setView(new QRef(*dialog));
|
||||
dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
|
||||
} else if (name == "sendto") {
|
||||
dialog->setController(new ControlSendto(*dialog));
|
||||
dialog->setView(new QSendto(*dialog));
|
||||
dialog->bc().bp(new OkApplyCancelPolicy);
|
||||
} else if (name == "spellchecker") {
|
||||
dialog->setController(new ControlSpellchecker(*dialog));
|
||||
dialog->setView(new QSpellchecker(*dialog));
|
||||
dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
|
||||
} else if (name == "tabular") {
|
||||
dialog->setController(new ControlTabular(*dialog));
|
||||
dialog->setView(new QTabular(*dialog));
|
||||
dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
|
||||
} else if (name == "tabularcreate") {
|
||||
dialog->setController(new ControlTabularCreate(*dialog));
|
||||
dialog->setView(new QTabularCreate(*dialog));
|
||||
dialog->bc().bp(new IgnorantPolicy);
|
||||
} else if (name == "texinfo") {
|
||||
dialog->setController(new ControlTexinfo(*dialog));
|
||||
dialog->setView(new QTexinfo(*dialog));
|
||||
dialog->bc().bp(new OkCancelPolicy);
|
||||
#ifdef HAVE_LIBAIKSAURUS
|
||||
} else if (name == "thesaurus") {
|
||||
dialog->setController(new ControlThesaurus(*dialog));
|
||||
dialog->setView(new QThesaurus(*dialog));
|
||||
dialog->bc().bp(new OkApplyCancelReadOnlyPolicy);
|
||||
#endif
|
||||
} else if (name == "toc") {
|
||||
dialog->setController(new ControlToc(*dialog));
|
||||
dialog->setView(new QToc(*dialog));
|
||||
dialog->bc().bp(new OkCancelPolicy);
|
||||
} else if (name == "url") {
|
||||
dialog->setController(new ControlCommand(*dialog, name, name));
|
||||
dialog->setView(new QURL(*dialog));
|
||||
dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
|
||||
} else if (name == "vspace") {
|
||||
dialog->setController(new ControlVSpace(*dialog));
|
||||
dialog->setView(new QVSpace(*dialog));
|
||||
dialog->bc().bp(new OkApplyCancelReadOnlyPolicy);
|
||||
} else if (name == "wrap") {
|
||||
dialog->setController(new ControlWrap(*dialog));
|
||||
dialog->setView(new QWrap(*dialog));
|
||||
dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
|
||||
}
|
||||
|
||||
return dialog;
|
||||
}
|
||||
|
||||
|
||||
/// Are the tooltips on or off?
|
||||
bool Dialogs::tooltipsEnabled()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
} // namespace lyx
|
@ -1,179 +0,0 @@
|
||||
/**
|
||||
* \file qt3/FileDialog.C
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author John Levon
|
||||
* \author Jean-Marc Lasgouttes
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "frontends/FileDialog.h"
|
||||
|
||||
#include "FileDialog_private.h"
|
||||
#include "qt_helpers.h"
|
||||
|
||||
#include "debug.h"
|
||||
#include "gettext.h"
|
||||
|
||||
#include "support/filefilterlist.h"
|
||||
|
||||
/** when this is defined, the code will use
|
||||
* QFileDialog::getOpenFileName and friends to create filedialogs.
|
||||
* Effects:
|
||||
* - the dialog does not use the quick directory buttons (Button
|
||||
* parameters);
|
||||
* - with Qt/Mac or Qt/Win, the dialogs native to the environment are used.
|
||||
*
|
||||
* Therefore there is a tradeoff in enabling or disabling this (JMarc)
|
||||
*/
|
||||
#ifdef Q_WS_MACX
|
||||
#define USE_NATIVE_FILEDIALOG 1
|
||||
#endif
|
||||
|
||||
#ifdef USE_NATIVE_FILEDIALOG
|
||||
#include <qapplication.h>
|
||||
#include "support/filetools.h"
|
||||
|
||||
|
||||
namespace lyx {
|
||||
using lyx::support::makeAbsPath;
|
||||
#endif
|
||||
|
||||
using lyx::support::FileFilterList;
|
||||
using lyx::docstring;
|
||||
|
||||
using std::endl;
|
||||
using std::string;
|
||||
|
||||
|
||||
class FileDialog::Private {
|
||||
public:
|
||||
Button b1;
|
||||
Button b2;
|
||||
};
|
||||
|
||||
|
||||
FileDialog::FileDialog(docstring const & t,
|
||||
kb_action s, Button b1, Button b2)
|
||||
: private_(new FileDialog::Private), title_(t), success_(s)
|
||||
{
|
||||
private_->b1 = b1;
|
||||
private_->b2 = b2;
|
||||
}
|
||||
|
||||
|
||||
FileDialog::~FileDialog()
|
||||
{
|
||||
delete private_;
|
||||
}
|
||||
|
||||
|
||||
FileDialog::Result const FileDialog::save(docstring const & path,
|
||||
FileFilterList const & filters,
|
||||
docstring const & suggested)
|
||||
{
|
||||
lyxerr[Debug::GUI] << "Select with path \"" << lyx::to_utf8(path)
|
||||
<< "\", mask \"" << lyx::to_utf8(filters.as_string())
|
||||
<< "\", suggested \"" << lyx::to_utf8(suggested) << '"' << endl;
|
||||
FileDialog::Result result;
|
||||
result.first = FileDialog::Chosen;
|
||||
|
||||
#ifdef USE_NATIVE_FILEDIALOG
|
||||
string const startsWith = makeAbsPath(lyx::to_utf8(suggested), lyx::to_utf8(path));
|
||||
result.second = fromqstr(
|
||||
QFileDialog::getSaveFileName(toqstr(startsWith),
|
||||
toqstr(filters.as_string()),
|
||||
qApp->focusWidget() ? qApp->focusWidget() : qApp->mainWidget(),
|
||||
lyx::to_utf8(title_).c_str()));
|
||||
#else
|
||||
LyXFileDialog dlg(path, filters, title_, private_->b1, private_->b2);
|
||||
dlg.setMode(QFileDialog::AnyFile);
|
||||
|
||||
if (!suggested.empty())
|
||||
dlg.setSelection(toqstr(suggested));
|
||||
|
||||
lyxerr[Debug::GUI] << "Synchronous FileDialog: " << endl;
|
||||
int res = dlg.exec();
|
||||
lyxerr[Debug::GUI] << "result " << res << endl;
|
||||
if (res == QDialog::Accepted)
|
||||
result.second = qstring_to_ucs4(dlg.selectedFile());
|
||||
dlg.hide();
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
FileDialog::Result const FileDialog::open(docstring const & path,
|
||||
FileFilterList const & filters,
|
||||
docstring const & suggested)
|
||||
{
|
||||
lyxerr[Debug::GUI] << "Select with path \"" << lyx::to_utf8(path)
|
||||
<< "\", mask \"" << lyx::to_utf8(filters.as_string())
|
||||
<< "\", suggested \"" << lyx::to_utf8(suggested) << '"' << endl;
|
||||
FileDialog::Result result;
|
||||
result.first = FileDialog::Chosen;
|
||||
|
||||
#ifdef USE_NATIVE_FILEDIALOG
|
||||
string const startsWith = makeAbsPath(lyx::to_utf8(suggested), lyx::to_utf8(path));
|
||||
result.second = fromqstr(
|
||||
QFileDialog::getOpenFileName(toqstr(startsWith),
|
||||
toqstr(filters.as_string()),
|
||||
qApp->focusWidget() ? qApp->focusWidget() : qApp->mainWidget(),
|
||||
lyx::to_utf8(title_).c_str()));
|
||||
#else
|
||||
LyXFileDialog dlg(path, filters, title_, private_->b1, private_->b2);
|
||||
|
||||
if (!suggested.empty())
|
||||
dlg.setSelection(toqstr(suggested));
|
||||
|
||||
lyxerr[Debug::GUI] << "Synchronous FileDialog: " << endl;
|
||||
int res = dlg.exec();
|
||||
lyxerr[Debug::GUI] << "result " << res << endl;
|
||||
if (res == QDialog::Accepted)
|
||||
result.second = qstring_to_ucs4(dlg.selectedFile());
|
||||
dlg.hide();
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
FileDialog::Result const FileDialog::opendir(docstring const & path,
|
||||
docstring const & suggested)
|
||||
{
|
||||
lyxerr[Debug::GUI] << "Select with path \"" << lyx::to_utf8(path)
|
||||
<< "\", suggested \"" << lyx::to_utf8(suggested) << '"' << endl;
|
||||
FileDialog::Result result;
|
||||
result.first = FileDialog::Chosen;
|
||||
|
||||
#ifdef USE_NATIVE_FILEDIALOG
|
||||
string const startsWith = makeAbsPath(lyx::to_utf8(suggested), lyx::to_utf8(path));
|
||||
result.second = fromqstr(
|
||||
QFileDialog::getExistingDirectory(toqstr(startsWith),
|
||||
qApp->focusWidget() ? qApp->focusWidget() : qApp->mainWidget(),
|
||||
lyx::to_utf8(title_).c_str()));
|
||||
#else
|
||||
FileFilterList const filter(_("Directories"));
|
||||
|
||||
LyXFileDialog dlg(path, filter, title_, private_->b1, private_->b2);
|
||||
|
||||
dlg.setMode(QFileDialog::DirectoryOnly);
|
||||
|
||||
if (!suggested.empty())
|
||||
dlg.setSelection(toqstr(suggested));
|
||||
|
||||
lyxerr[Debug::GUI] << "Synchronous FileDialog: " << endl;
|
||||
int res = dlg.exec();
|
||||
lyxerr[Debug::GUI] << "result " << res << endl;
|
||||
if (res == QDialog::Accepted)
|
||||
result.second = qstring_to_ucs4(dlg.selectedFile());
|
||||
dlg.hide();
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
} // namespace lyx
|
@ -1,89 +0,0 @@
|
||||
/**
|
||||
* \file FileDialog_private.C
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author John Levon
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "FileDialog_private.h"
|
||||
#include "qt_helpers.h"
|
||||
|
||||
#include "support/filefilterlist.h"
|
||||
#include "support/lstrings.h"
|
||||
|
||||
#include <qapplication.h>
|
||||
#include <qtoolbutton.h>
|
||||
|
||||
using lyx::support::split;
|
||||
using lyx::docstring;
|
||||
|
||||
using std::string;
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
/// return the Qt form of the label
|
||||
docstring const getLabel(docstring const & str) {
|
||||
docstring label;
|
||||
docstring sc(split(str, label, '|'));
|
||||
if (sc.length() < 2)
|
||||
return label;
|
||||
docstring::size_type pos = label.find(sc[1]);
|
||||
if (pos == docstring::npos)
|
||||
return label;
|
||||
label.insert(pos, 1, '&');
|
||||
return label;
|
||||
}
|
||||
|
||||
} // namespace anon
|
||||
|
||||
|
||||
LyXFileDialog::LyXFileDialog(docstring const & p,
|
||||
lyx::support::FileFilterList const & filters,
|
||||
docstring const & t,
|
||||
FileDialog::Button const & b1,
|
||||
FileDialog::Button const & b2)
|
||||
: QFileDialog(toqstr(p), toqstr(filters.as_string()),
|
||||
qApp->focusWidget() ? qApp->focusWidget() : qApp->mainWidget(), toqstr(t), true),
|
||||
b1_(0), b2_(0)
|
||||
{
|
||||
setCaption(toqstr(t));
|
||||
|
||||
if (!b1.first.empty()) {
|
||||
b1_dir_ = b1.second;
|
||||
b1_ = new QToolButton(this);
|
||||
connect(b1_, SIGNAL(clicked()), this, SLOT(buttonClicked()));
|
||||
b1_->setText(toqstr(getLabel(b1.first)));
|
||||
addToolButton(b1_, true);
|
||||
}
|
||||
|
||||
if (!b2.first.empty()) {
|
||||
b2_dir_ = b2.second;
|
||||
b2_ = new QToolButton(this);
|
||||
connect(b2_, SIGNAL(clicked()), this, SLOT(buttonClicked()));
|
||||
b2_->setText(toqstr(getLabel(b2.first)));
|
||||
addToolButton(b2_);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void LyXFileDialog::buttonClicked()
|
||||
{
|
||||
if (sender() == b1_)
|
||||
setDir(toqstr(b1_dir_));
|
||||
else if (sender() == b2_)
|
||||
setDir(toqstr(b2_dir_));
|
||||
}
|
||||
|
||||
#include "FileDialog_private_moc.cpp"
|
||||
|
||||
|
||||
namespace lyx {
|
||||
|
||||
|
||||
} // namespace lyx
|
@ -1,49 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file FileDialog_private.h
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author John Levon
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#ifndef FILEDIALOG_PRIVATE_H
|
||||
#define FILEDIALOG_PRIVATE_H
|
||||
|
||||
|
||||
#include "frontends/FileDialog.h"
|
||||
#include <qfiledialog.h>
|
||||
|
||||
namespace lyx {
|
||||
namespace support {
|
||||
|
||||
class FileFilterList;
|
||||
|
||||
} // namespace support
|
||||
} // namespace lyx
|
||||
|
||||
|
||||
class QToolButton;
|
||||
|
||||
class LyXFileDialog : public QFileDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
LyXFileDialog(lyx::docstring const & path,
|
||||
lyx::support::FileFilterList const & filters,
|
||||
lyx::docstring const & title,
|
||||
FileDialog::Button const & b1,
|
||||
FileDialog::Button const & b2);
|
||||
public slots:
|
||||
void buttonClicked();
|
||||
private:
|
||||
QToolButton * b1_;
|
||||
lyx::docstring b1_dir_;
|
||||
|
||||
QToolButton * b2_;
|
||||
lyx::docstring b2_dir_;
|
||||
};
|
||||
|
||||
#endif // FILEDIALOG_PRIVATE_H
|
@ -1,370 +0,0 @@
|
||||
/**
|
||||
* \file qt3/GuiApplication.C
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author unknown
|
||||
* \author John Levon
|
||||
* \author Abdelrazak Younes
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "frontends/LyXView.h"
|
||||
#include "frontends/WorkArea.h"
|
||||
|
||||
#include "GuiApplication.h"
|
||||
|
||||
#include "lcolorcache.h"
|
||||
#include "qt_helpers.h"
|
||||
#include "QLImage.h"
|
||||
#include "socket_callback.h"
|
||||
|
||||
#include "graphics/LoaderQueue.h"
|
||||
|
||||
#include "support/lstrings.h"
|
||||
#include "support/os.h"
|
||||
#include "support/package.h"
|
||||
|
||||
#include "BufferView.h"
|
||||
#include "Color.h"
|
||||
#include "lyx_main.h"
|
||||
#include "lyxrc.h"
|
||||
#include "debug.h"
|
||||
|
||||
#include <qapplication.h>
|
||||
#include <qclipboard.h>
|
||||
#include <qeventloop.h>
|
||||
#include <qlocale.h>
|
||||
#include <qpaintdevicemetrics.h>
|
||||
#include <qtextcodec.h>
|
||||
#include <qtranslator.h>
|
||||
|
||||
#ifdef Q_WS_X11
|
||||
#include <X11/Xlib.h>
|
||||
#endif
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
using lyx::support::subst;
|
||||
|
||||
using std::string;
|
||||
using std::endl;
|
||||
|
||||
// in QLyXKeySym.C
|
||||
extern void initEncodings();
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
// You can find other X11 and MACX specific stuff
|
||||
// at the end of this file...
|
||||
///////////////////////////////////////////////////////////////
|
||||
|
||||
namespace {
|
||||
|
||||
std::map<int, boost::shared_ptr<socket_callback> > socket_callbacks;
|
||||
|
||||
int getDPI()
|
||||
{
|
||||
QWidget w;
|
||||
QPaintDeviceMetrics pdm(&w);
|
||||
return int(0.5 * (pdm.logicalDpiX() + pdm.logicalDpiY()));
|
||||
}
|
||||
|
||||
} // namespace anon
|
||||
|
||||
|
||||
namespace lyx {
|
||||
|
||||
frontend::Application * createApplication(int & argc, char * argv[])
|
||||
{
|
||||
return new frontend::GuiApplication(argc, argv);
|
||||
}
|
||||
|
||||
namespace frontend {
|
||||
|
||||
GuiApplication::GuiApplication(int & argc, char ** argv)
|
||||
: QApplication(argc, argv), Application(argc, argv)
|
||||
{
|
||||
#ifdef Q_WS_X11
|
||||
// doubleClickInterval() is 400 ms on X11 witch is just too long.
|
||||
// On Windows and Mac OS X, the operating system's value is used.
|
||||
// On Microsoft Windows, calling this function sets the double
|
||||
// click interval for all applications. So we don't!
|
||||
QApplication::setDoubleClickInterval(300);
|
||||
#endif
|
||||
|
||||
#ifdef Q_WS_MACX
|
||||
AEInstallEventHandler(kCoreEventClass, kAEOpenDocuments,
|
||||
NewAEEventHandlerUPP(handleOpenDocuments),
|
||||
0, false);
|
||||
#endif
|
||||
|
||||
#if QT_VERSION >= 0x030200
|
||||
// install translation file for Qt built-in dialogs
|
||||
// These are only installed since Qt 3.2.x
|
||||
QTranslator qt_trans(0);
|
||||
if (qt_trans.load(QString("qt_") + QTextCodec::locale(),
|
||||
qInstallPathTranslations())) {
|
||||
qApp->installTranslator(&qt_trans);
|
||||
// even if the language calls for RtL, don't do that
|
||||
qApp->setReverseLayout(false);
|
||||
lyxerr[Debug::GUI]
|
||||
<< "Successfully installed Qt translations for locale "
|
||||
<< QTextCodec::locale() << std::endl;
|
||||
} else
|
||||
lyxerr[Debug::GUI]
|
||||
<< "Could not find Qt translations for locale "
|
||||
<< QTextCodec::locale() << std::endl;
|
||||
#endif
|
||||
|
||||
#ifdef Q_WS_MACX
|
||||
// These translations are meant to break Qt/Mac menu merging
|
||||
// algorithm on some entries. It lists the menu names that
|
||||
// should not be moved to the LyX menu
|
||||
QTranslator aqua_trans(0);
|
||||
aqua_trans.insert(QTranslatorMessage("QMenuBar", "Setting", 0,
|
||||
"do_not_merge_me"));
|
||||
aqua_trans.insert(QTranslatorMessage("QMenuBar", "Config", 0,
|
||||
"do_not_merge_me"));
|
||||
aqua_trans.insert(QTranslatorMessage("QMenuBar", "Options", 0,
|
||||
"do_not_merge_me"));
|
||||
aqua_trans.insert(QTranslatorMessage("QMenuBar", "Setup", 0,
|
||||
"do_not_merge_me"));
|
||||
|
||||
qApp->installTranslator(&aqua_trans);
|
||||
#endif
|
||||
|
||||
using namespace lyx::graphics;
|
||||
|
||||
Image::newImage = boost::bind(&QLImage::newImage);
|
||||
Image::loadableFormats = boost::bind(&QLImage::loadableFormats);
|
||||
|
||||
// needs to be done before reading lyxrc
|
||||
lyxrc.dpi = getDPI();
|
||||
|
||||
LoaderQueue::setPriority(10,100);
|
||||
}
|
||||
|
||||
|
||||
Clipboard& GuiApplication::clipboard()
|
||||
{
|
||||
return clipboard_;
|
||||
}
|
||||
|
||||
|
||||
Selection& GuiApplication::selection()
|
||||
{
|
||||
return selection_;
|
||||
}
|
||||
|
||||
|
||||
int const GuiApplication::exec()
|
||||
{
|
||||
return QApplication::exec();
|
||||
}
|
||||
|
||||
|
||||
void GuiApplication::exit(int status)
|
||||
{
|
||||
QApplication::exit(status);
|
||||
}
|
||||
|
||||
|
||||
string const GuiApplication::romanFontName()
|
||||
{
|
||||
QFont font;
|
||||
font.setStyleHint(QFont::Serif);
|
||||
font.setFamily("serif");
|
||||
|
||||
return fromqstr(QFontInfo(font).family());
|
||||
}
|
||||
|
||||
|
||||
string const GuiApplication::sansFontName()
|
||||
{
|
||||
QFont font;
|
||||
font.setStyleHint(QFont::SansSerif);
|
||||
font.setFamily("sans");
|
||||
|
||||
return fromqstr(QFontInfo(font).family());
|
||||
}
|
||||
|
||||
|
||||
string const GuiApplication::typewriterFontName()
|
||||
{
|
||||
QFont font;
|
||||
font.setStyleHint(QFont::TypeWriter);
|
||||
font.setFamily("monospace");
|
||||
|
||||
return fromqstr(QFontInfo(font).family());
|
||||
}
|
||||
|
||||
|
||||
void GuiApplication::syncEvents()
|
||||
{
|
||||
// This is the ONLY place where processEvents may be called.
|
||||
// During screen update/ redraw, this method is disabled to
|
||||
// prevent keyboard events being handed to the LyX core, where
|
||||
// they could cause re-entrant calls to screen update.
|
||||
#if QT_VERSION >= 0x030100
|
||||
qApp->eventLoop()->processEvents(QEventLoop::ExcludeUserInput);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
bool GuiApplication::getRgbColor(LColor_color col,
|
||||
lyx::RGBColor & rgbcol)
|
||||
{
|
||||
QColor const & qcol = lcolorcache.get(col);
|
||||
if (!qcol.isValid()) {
|
||||
rgbcol.r = 0;
|
||||
rgbcol.g = 0;
|
||||
rgbcol.b = 0;
|
||||
return false;
|
||||
}
|
||||
rgbcol.r = qcol.red();
|
||||
rgbcol.g = qcol.green();
|
||||
rgbcol.b = qcol.blue();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
string const GuiApplication::hexName(LColor_color col)
|
||||
{
|
||||
return lyx::support::ltrim(fromqstr(lcolorcache.get(col).name()), "#");
|
||||
}
|
||||
|
||||
|
||||
void GuiApplication::updateColor(LColor_color)
|
||||
{
|
||||
// FIXME: Bleh, can't we just clear them all at once ?
|
||||
lcolorcache.clear();
|
||||
}
|
||||
|
||||
|
||||
void GuiApplication::registerSocketCallback(int fd, boost::function<void()> func)
|
||||
{
|
||||
socket_callbacks[fd] = boost::shared_ptr<socket_callback>(new socket_callback(fd, func));
|
||||
}
|
||||
|
||||
|
||||
void GuiApplication::unregisterSocketCallback(int fd)
|
||||
{
|
||||
socket_callbacks.erase(fd);
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// X11 specific stuff goes here...
|
||||
#ifdef Q_WS_X11
|
||||
bool GuiApplication::x11EventFilter(XEvent * xev)
|
||||
{
|
||||
switch (xev->type) {
|
||||
case SelectionRequest:
|
||||
lyxerr[Debug::GUI] << "X requested selection." << endl;
|
||||
if (buffer_view_) {
|
||||
lyx::docstring const sel = buffer_view_->requestSelection();
|
||||
if (!sel.empty())
|
||||
selection_.put(sel);
|
||||
}
|
||||
break;
|
||||
case SelectionClear:
|
||||
lyxerr[Debug::GUI] << "Lost selection." << endl;
|
||||
if (buffer_view_)
|
||||
buffer_view_->clearSelection();
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// Mac OSX specific stuff goes here...
|
||||
|
||||
#ifdef Q_WS_MACX
|
||||
namespace{
|
||||
|
||||
OSErr checkAppleEventForMissingParams(const AppleEvent& theAppleEvent)
|
||||
{
|
||||
DescType returnedType;
|
||||
Size actualSize;
|
||||
OSErr err = AEGetAttributePtr(&theAppleEvent, keyMissedKeywordAttr,
|
||||
typeWildCard, &returnedType, nil, 0,
|
||||
&actualSize);
|
||||
switch (err) {
|
||||
case errAEDescNotFound:
|
||||
return noErr;
|
||||
case noErr:
|
||||
return errAEEventNotHandled;
|
||||
default:
|
||||
return err;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
OSErr GuiApplication::handleOpenDocuments(const AppleEvent* inEvent,
|
||||
AppleEvent* /*reply*/, long /*refCon*/)
|
||||
{
|
||||
QString s_arg;
|
||||
AEDescList documentList;
|
||||
OSErr err = AEGetParamDesc(inEvent, keyDirectObject, typeAEList,
|
||||
&documentList);
|
||||
if (err != noErr)
|
||||
return err;
|
||||
|
||||
err = checkAppleEventForMissingParams(*inEvent);
|
||||
if (err == noErr) {
|
||||
long documentCount;
|
||||
err = AECountItems(&documentList, &documentCount);
|
||||
for (long documentIndex = 1;
|
||||
err == noErr && documentIndex <= documentCount;
|
||||
documentIndex++) {
|
||||
DescType returnedType;
|
||||
Size actualSize;
|
||||
AEKeyword keyword;
|
||||
FSRef ref;
|
||||
char qstr_buf[1024];
|
||||
err = AESizeOfNthItem(&documentList, documentIndex,
|
||||
&returnedType, &actualSize);
|
||||
if (err == noErr) {
|
||||
err = AEGetNthPtr(&documentList, documentIndex,
|
||||
typeFSRef, &keyword,
|
||||
&returnedType, (Ptr)&ref,
|
||||
sizeof(FSRef), &actualSize);
|
||||
if (err == noErr) {
|
||||
FSRefMakePath(&ref, (UInt8*)qstr_buf,
|
||||
1024);
|
||||
s_arg=QString::fromUtf8(qstr_buf);
|
||||
// buffer_view_->workAreaDispatch(
|
||||
// FuncRequest(LFUN_FILE_OPEN,
|
||||
// fromqstr(s_arg)));
|
||||
break;
|
||||
}
|
||||
}
|
||||
} // for ...
|
||||
}
|
||||
AEDisposeDesc(&documentList);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
bool GuiApplication::macEventFilter(EventRef event)
|
||||
{
|
||||
if (GetEventClass(event) == kEventClassAppleEvent) {
|
||||
EventRecord eventrec;
|
||||
ConvertEventRefToEventRecord(event, &eventrec);
|
||||
AEProcessAppleEvent(&eventrec);
|
||||
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
#endif // Q_WS_MACX
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
@ -1,107 +0,0 @@
|
||||
/**
|
||||
* \file qt3/GuiApplication.h
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author unknown
|
||||
* \author John Levon
|
||||
* \author Abdelrazak Younes
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#ifndef QT3_APPLICATION_H
|
||||
#define QT3_APPLICATION_H
|
||||
|
||||
#include "frontends/Application.h"
|
||||
|
||||
#include "qfont_loader.h"
|
||||
#include "GuiClipboard.h"
|
||||
#include "GuiImplementation.h"
|
||||
#include "GuiSelection.h"
|
||||
|
||||
#include <qapplication.h>
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
// Specific stuff
|
||||
|
||||
#ifdef Q_WS_MACX
|
||||
#include <Carbon/Carbon.h>
|
||||
#endif
|
||||
///////////////////////////////////////////////////////////////
|
||||
|
||||
class BufferView;
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
class GuiWorkArea;
|
||||
|
||||
/// The Qt main application class
|
||||
/**
|
||||
There should be only one instance of this class. No Qt object
|
||||
initialisation should be done before the instanciation of this class.
|
||||
|
||||
\todo The work areas handling could be moved to a base virtual class
|
||||
comon to all frontends.
|
||||
*/
|
||||
class GuiApplication : public QApplication, public Application
|
||||
{
|
||||
public:
|
||||
GuiApplication(int & argc, char ** argv);
|
||||
///
|
||||
virtual ~GuiApplication() {}
|
||||
|
||||
/// Method inherited from \c Application class
|
||||
//@{
|
||||
virtual Clipboard& clipboard();
|
||||
virtual Selection& selection();
|
||||
virtual FontLoader & fontLoader() { return font_loader_; }
|
||||
virtual int const exec();
|
||||
virtual Gui & gui() { return gui_; }
|
||||
virtual void exit(int status);
|
||||
void syncEvents();
|
||||
virtual std::string const romanFontName();
|
||||
virtual std::string const sansFontName();
|
||||
virtual std::string const typewriterFontName();
|
||||
virtual bool getRgbColor(LColor_color col, lyx::RGBColor & rgbcol);
|
||||
virtual std::string const hexName(LColor_color col);
|
||||
virtual void updateColor(LColor_color col);
|
||||
virtual void registerSocketCallback(
|
||||
int fd, boost::function<void()> func);
|
||||
virtual void unregisterSocketCallback(int fd);
|
||||
//@}
|
||||
|
||||
///
|
||||
private:
|
||||
///
|
||||
GuiImplementation gui_;
|
||||
///
|
||||
GuiClipboard clipboard_;
|
||||
///
|
||||
GuiSelection selection_;
|
||||
///
|
||||
GuiFontLoader font_loader_;
|
||||
|
||||
#ifdef Q_WS_X11
|
||||
public:
|
||||
bool x11EventFilter (XEvent * ev);
|
||||
#endif
|
||||
|
||||
#ifdef Q_WS_MACX
|
||||
public:
|
||||
bool macEventFilter(EventRef event);
|
||||
private:
|
||||
// static OSStatus handleOpenDocuments(
|
||||
static pascal OSErr handleOpenDocuments(
|
||||
const AppleEvent* inEvent, AppleEvent*, long);
|
||||
#endif
|
||||
}; // GuiApplication
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
extern lyx::frontend::GuiApplication * guiApp;
|
||||
|
||||
|
||||
#endif // QT3_APPLICATION_H
|
@ -1,54 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file qt3/GuiClipboard.C
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author John Levon
|
||||
* \author Abdelrazak Younes
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "GuiClipboard.h"
|
||||
#include "qt_helpers.h"
|
||||
|
||||
#include "debug.h"
|
||||
|
||||
#include <qapplication.h>
|
||||
#include <qclipboard.h>
|
||||
#include <qstring.h>
|
||||
|
||||
#include "support/lstrings.h"
|
||||
using lyx::support::internalLineEnding;
|
||||
using lyx::support::externalLineEnding;
|
||||
|
||||
using std::endl;
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
docstring const GuiClipboard::get() const
|
||||
{
|
||||
QString const str = qApp->clipboard()->text(QClipboard::Clipboard);
|
||||
lyxerr[Debug::ACTION] << "GuiClipboard::get: " << fromqstr(str)
|
||||
<< endl;
|
||||
if (str.isNull())
|
||||
return docstring();
|
||||
|
||||
return internalLineEnding(qstring_to_ucs4(str));
|
||||
}
|
||||
|
||||
|
||||
void GuiClipboard::put(docstring const & str)
|
||||
{
|
||||
lyxerr[Debug::ACTION] << "GuiClipboard::put: " << lyx::to_utf8(str) << endl;
|
||||
|
||||
qApp->clipboard()->setText(toqstr(externalLineEnding(str)),
|
||||
QClipboard::Clipboard);
|
||||
}
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
@ -1,41 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file qt3/GuiClipboard.h
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Abdelrazak Younes
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#ifndef CLIPBOARD_H
|
||||
#define CLIPBOARD_H
|
||||
|
||||
#include "frontends/Clipboard.h"
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
/**
|
||||
* The Qt3 version of the Clipboard.
|
||||
*/
|
||||
class GuiClipboard: public lyx::frontend::Clipboard
|
||||
{
|
||||
public:
|
||||
virtual ~GuiClipboard() {}
|
||||
|
||||
/** Clipboard overloaded methods
|
||||
*/
|
||||
//@{
|
||||
|
||||
docstring const get() const;
|
||||
|
||||
void put(docstring const & str);
|
||||
//@}
|
||||
};
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#endif // CLIPBOARD_H
|
@ -1,178 +0,0 @@
|
||||
/**
|
||||
* \file GuiFontMetrics.C
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author unknown
|
||||
* \author John Levon
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "GuiFontMetrics.h"
|
||||
|
||||
#include "qt_helpers.h"
|
||||
|
||||
#include "language.h"
|
||||
|
||||
#include "support/unicode.h"
|
||||
|
||||
using lyx::char_type;
|
||||
using lyx::docstring;
|
||||
|
||||
using std::string;
|
||||
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
|
||||
GuiFontMetrics::GuiFontMetrics(QFont const & font)
|
||||
: metrics_(font), smallcaps_metrics_(font), smallcaps_shape_(false)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
GuiFontMetrics::GuiFontMetrics(QFont const & font, QFont const & smallcaps_font)
|
||||
: metrics_(font), smallcaps_metrics_(smallcaps_font), smallcaps_shape_(true)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
int GuiFontMetrics::maxAscent() const
|
||||
{
|
||||
return metrics_.ascent();
|
||||
}
|
||||
|
||||
|
||||
int GuiFontMetrics::maxDescent() const
|
||||
{
|
||||
// We add 1 as the value returned by QT is different than X
|
||||
// See http://doc.trolltech.com/2.3/qfontmetrics.html#200b74
|
||||
return metrics_.descent() + 1;
|
||||
}
|
||||
|
||||
|
||||
int GuiFontMetrics::ascent(char_type c) const
|
||||
{
|
||||
QRect const & r = metrics_.boundingRect(ucs4_to_qchar(c));
|
||||
// Qt/Win 3.2.1nc (at least) corrects the GetGlyphOutlineA|W y
|
||||
// value by the height: (x, -y-height, width, height).
|
||||
// Other versions return: (x, -y, width, height)
|
||||
#if defined(Q_WS_WIN) && (QT_VERSION == 0x030201)
|
||||
return -r.top() - r.height();
|
||||
#else
|
||||
return -r.top();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
int GuiFontMetrics::descent(char_type c) const
|
||||
{
|
||||
QRect const & r = metrics_.boundingRect(ucs4_to_qchar(c));
|
||||
// Qt/Win 3.2.1nc (at least) corrects the GetGlyphOutlineA|W y
|
||||
// value by the height: (x, -y-height, width, height).
|
||||
// Other versions return: (x, -y, width, height)
|
||||
#if defined(Q_WS_WIN) && (QT_VERSION == 0x030201)
|
||||
return r.bottom() + r.height() + 1;
|
||||
#else
|
||||
return r.bottom() + 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
int GuiFontMetrics::lbearing(char_type c) const
|
||||
{
|
||||
return metrics_.leftBearing(ucs4_to_qchar(c));
|
||||
}
|
||||
|
||||
|
||||
int GuiFontMetrics::rbearing(char_type c) const
|
||||
{
|
||||
// Qt rbearing is from the right edge of the char's width().
|
||||
QChar sc = ucs4_to_qchar(c);
|
||||
return metrics_.width(sc) - metrics_.rightBearing(sc);
|
||||
}
|
||||
|
||||
|
||||
int GuiFontMetrics::smallcapsWidth(QString const & s) const
|
||||
{
|
||||
int w = 0;
|
||||
int const ls = s.length();
|
||||
|
||||
for (int i = 0; i < ls; ++i) {
|
||||
QChar const & c = s[i];
|
||||
QChar const uc = c.upper();
|
||||
if (c != uc)
|
||||
w += smallcaps_metrics_.width(uc);
|
||||
else
|
||||
w += metrics_.width(c);
|
||||
}
|
||||
return w;
|
||||
}
|
||||
|
||||
|
||||
int GuiFontMetrics::width(char_type const * s, size_t ls) const
|
||||
{
|
||||
QString const ucs2 = toqstr(s, ls);
|
||||
|
||||
if (smallcaps_shape_)
|
||||
return smallcapsWidth(ucs2);
|
||||
|
||||
if (ls == 1)
|
||||
return width(ucs2[0].unicode());
|
||||
|
||||
int w = 0;
|
||||
for (unsigned int i = 0; i < ls; ++i)
|
||||
w += width(ucs2[i].unicode());
|
||||
|
||||
return w;
|
||||
}
|
||||
|
||||
|
||||
int GuiFontMetrics::signedWidth(docstring const & s) const
|
||||
{
|
||||
if (s[0] == '-')
|
||||
return -FontMetrics::width(s.substr(1, s.length() - 1));
|
||||
else
|
||||
return FontMetrics::width(s);
|
||||
}
|
||||
|
||||
|
||||
void GuiFontMetrics::rectText(docstring const & str,
|
||||
int & w, int & ascent, int & descent) const
|
||||
{
|
||||
static int const d = 2;
|
||||
w = FontMetrics::width(str) + d * 2 + 2;
|
||||
ascent = metrics_.ascent() + d;
|
||||
descent = metrics_.descent() + d;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void GuiFontMetrics::buttonText(docstring const & str,
|
||||
int & w, int & ascent, int & descent) const
|
||||
{
|
||||
static int const d = 3;
|
||||
w = FontMetrics::width(str) + d * 2 + 2;
|
||||
ascent = metrics_.ascent() + d;
|
||||
descent = metrics_.descent() + d;
|
||||
}
|
||||
|
||||
#ifdef USE_LYX_FONTCACHE
|
||||
int GuiFontMetrics::width(unsigned short val) const
|
||||
{
|
||||
GuiFontMetrics::WidthCache::const_iterator cit = widthcache.find(val);
|
||||
if (cit != widthcache.end())
|
||||
return cit->second;
|
||||
|
||||
int const w = metrics_.width(QChar(val));
|
||||
widthcache[val] = w;
|
||||
return w;
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
@ -1,83 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file FontMetrics.h
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Abdelrazak Younes
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#ifndef QT3_FONT_METRICS_H
|
||||
#define QT3_FONT_METRICS_H
|
||||
|
||||
#include "frontends/FontMetrics.h"
|
||||
|
||||
#include "support/docstring.h"
|
||||
|
||||
#include <qfontmetrics.h>
|
||||
|
||||
// Starting with version 3.1.0, Qt/X11 does its own caching of
|
||||
// character width, so it is not necessary to provide ours.
|
||||
#if defined(Q_WS_MACX) || defined(Q_WS_WIN32)
|
||||
#define USE_LYX_FONTCACHE
|
||||
#include <map>
|
||||
#endif
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
class GuiFontMetrics: public FontMetrics
|
||||
{
|
||||
public:
|
||||
|
||||
GuiFontMetrics(QFont const & font);
|
||||
GuiFontMetrics(QFont const & font, QFont const & smallcaps_font);
|
||||
|
||||
virtual ~GuiFontMetrics() {}
|
||||
|
||||
virtual int maxAscent() const;
|
||||
virtual int maxDescent() const;
|
||||
virtual int ascent(lyx::char_type c) const;
|
||||
int descent(lyx::char_type c) const;
|
||||
virtual int lbearing(lyx::char_type c) const;
|
||||
virtual int rbearing(lyx::char_type c) const;
|
||||
virtual int width(lyx::char_type const * s, size_t n) const;
|
||||
virtual int signedWidth(lyx::docstring const & s) const;
|
||||
virtual void rectText(lyx::docstring const & str,
|
||||
int & width,
|
||||
int & ascent,
|
||||
int & descent) const;
|
||||
virtual void buttonText(lyx::docstring const & str,
|
||||
int & width,
|
||||
int & ascent,
|
||||
int & descent) const;
|
||||
|
||||
private:
|
||||
int smallcapsWidth(QString const & s) const;
|
||||
|
||||
/// Metrics on the font
|
||||
QFontMetrics metrics_;
|
||||
QFontMetrics smallcaps_metrics_;
|
||||
|
||||
bool smallcaps_shape_;
|
||||
|
||||
#ifndef USE_LYX_FONTCACHE
|
||||
/// Return pixel width for the given unicode char
|
||||
int width(unsigned short val) const { return metrics_.width(QChar(val)); }
|
||||
|
||||
#else
|
||||
/// Return pixel width for the given unicode char
|
||||
int width(unsigned short val) const;
|
||||
|
||||
typedef std::map<unsigned short, int> WidthCache;
|
||||
/// Cache of char widths
|
||||
mutable WidthCache widthcache;
|
||||
#endif // USE_LYX_FONTCACHE
|
||||
};
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#endif // QT3_FONT_METRICS_H
|
@ -1,105 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file qt3/Gui.h
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Abdelrazak Younes
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#ifndef GUI_IMPLEMENTATION_H
|
||||
#define GUI_IMPLEMENTATION_H
|
||||
|
||||
#include "frontends/Gui.h"
|
||||
|
||||
#include "QtView.h"
|
||||
#include "qscreen.h"
|
||||
#include "QWorkArea.h"
|
||||
|
||||
#include "GuiWorkArea.h"
|
||||
|
||||
#include "BufferView.h"
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
typedef QtView FView;
|
||||
typedef QScreen FScreen;
|
||||
typedef QWorkArea FWorkArea;
|
||||
|
||||
/**
|
||||
* The Gui class is the interface to all Qt3 components.
|
||||
*/
|
||||
class GuiImplementation: public lyx::frontend::Gui
|
||||
{
|
||||
public:
|
||||
GuiImplementation()
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~GuiImplementation()
|
||||
{
|
||||
}
|
||||
|
||||
int newView()
|
||||
{
|
||||
view_.reset(new FView);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
LyXView& view(int /*id*/)
|
||||
{
|
||||
return *view_;
|
||||
}
|
||||
|
||||
|
||||
void destroyView(int /*id*/)
|
||||
{
|
||||
view_.reset();
|
||||
}
|
||||
|
||||
int newWorkArea(unsigned int w, unsigned int h, int /*view_id*/)
|
||||
{
|
||||
old_work_area_.reset(new FWorkArea(*view_.get(), w, h));
|
||||
old_screen_.reset(new FScreen(*old_work_area_.get()));
|
||||
work_area_.reset(new GuiWorkArea(old_screen_.get(), old_work_area_.get()));
|
||||
|
||||
// FIXME BufferView creation should be independant of WorkArea creation
|
||||
buffer_views_[0].reset(new BufferView);
|
||||
work_area_->setBufferView(buffer_views_[0].get());
|
||||
view_->setWorkArea(work_area_.get());
|
||||
return 0;
|
||||
}
|
||||
|
||||
lyx::frontend::WorkArea& workArea(int /*id*/)
|
||||
{
|
||||
return *work_area_;
|
||||
}
|
||||
|
||||
void destroyWorkArea(int /*id*/)
|
||||
{
|
||||
work_area_.reset();
|
||||
old_work_area_.reset();
|
||||
old_screen_.reset();
|
||||
}
|
||||
|
||||
private:
|
||||
///
|
||||
boost::shared_ptr<GuiWorkArea> work_area_;
|
||||
///
|
||||
boost::shared_ptr<FView> view_;
|
||||
///
|
||||
boost::shared_ptr<FWorkArea> old_work_area_;
|
||||
///
|
||||
boost::shared_ptr<FScreen> old_screen_;
|
||||
};
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#endif // GUI_IMPLEMENTATION_H
|
@ -1,66 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file qt3/GuiSelection.C
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author John Levon
|
||||
* \author Abdelrazak Younes
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "GuiSelection.h"
|
||||
#include "qt_helpers.h"
|
||||
|
||||
#include "debug.h"
|
||||
|
||||
#include <qapplication.h>
|
||||
#include <qclipboard.h>
|
||||
#include <qstring.h>
|
||||
|
||||
#include "support/lstrings.h"
|
||||
using lyx::support::internalLineEnding;
|
||||
using lyx::support::externalLineEnding;
|
||||
|
||||
using std::endl;
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
docstring const GuiSelection::get() const
|
||||
{
|
||||
QString const str = qApp->clipboard()->text(QClipboard::Selection);
|
||||
lyxerr[Debug::ACTION] << "GuiSelection::get: " << (const char*) str
|
||||
<< endl;
|
||||
if (str.isNull())
|
||||
return docstring();
|
||||
|
||||
return internalLineEnding(qstring_to_ucs4(str));
|
||||
}
|
||||
|
||||
|
||||
void GuiSelection::put(docstring const & str)
|
||||
{
|
||||
lyxerr[Debug::ACTION] << "GuiSelection::put: " << lyx::to_utf8(str) << endl;
|
||||
|
||||
qApp->clipboard()->setText(toqstr(externalLineEnding(str)),
|
||||
QClipboard::Selection);
|
||||
}
|
||||
|
||||
|
||||
void GuiSelection::haveSelection(bool own)
|
||||
{
|
||||
if (!QApplication::clipboard()->supportsSelection())
|
||||
return;
|
||||
|
||||
if (own)
|
||||
QApplication::clipboard()->setText(QString(), QClipboard::Selection);
|
||||
// We don't need to do anything if own = false, as this case is
|
||||
// handled by QT.
|
||||
}
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
@ -1,44 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file qt3/GuiSelection.h
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Abdelrazak Younes
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#ifndef SELECTION_H
|
||||
#define SELECTION_H
|
||||
|
||||
#include "frontends/Selection.h"
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
/**
|
||||
* The Qt3 version of the Selection.
|
||||
*/
|
||||
class GuiSelection: public lyx::frontend::Selection
|
||||
{
|
||||
public:
|
||||
GuiSelection() {}
|
||||
|
||||
virtual ~GuiSelection() {}
|
||||
|
||||
/** Selection overloaded methods
|
||||
*/
|
||||
//@{
|
||||
void haveSelection(bool);
|
||||
|
||||
docstring const get() const;
|
||||
|
||||
void put(docstring const & str);
|
||||
//@}
|
||||
};
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#endif // SELECTION_H
|
@ -1,96 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file qt3/WorkArea.h
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Abdelrazak Younes
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#ifndef WORKAREA_H
|
||||
#define WORKAREA_H
|
||||
|
||||
#include "frontends/WorkArea.h"
|
||||
|
||||
#include "qscreen.h"
|
||||
#include "QWorkArea.h"
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
typedef QScreen FScreen;
|
||||
typedef QWorkArea FWorkArea;
|
||||
|
||||
/**
|
||||
* Temporary wrapper around QWorkArea and QScreen.
|
||||
* Please refer to the Qt4 implementation for a proper cleanup of the API.
|
||||
*/
|
||||
class GuiWorkArea: public lyx::frontend::WorkArea {
|
||||
public:
|
||||
GuiWorkArea(FScreen * screen, FWorkArea * work_area)
|
||||
: WorkArea(work_area->view()), old_screen_(screen), old_work_area_(work_area)
|
||||
{
|
||||
}
|
||||
|
||||
~GuiWorkArea() {}
|
||||
|
||||
/// return the painter object for this work area
|
||||
virtual lyx::frontend::Painter & getPainter()
|
||||
{
|
||||
return old_work_area_->getPainter();
|
||||
}
|
||||
|
||||
/// return the width of the work area in pixels
|
||||
virtual int width() const
|
||||
{
|
||||
return old_work_area_->workWidth();
|
||||
}
|
||||
|
||||
/// return the height of the work area in pixels
|
||||
virtual int height() const
|
||||
{
|
||||
return old_work_area_->workHeight();
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the scrollbar.
|
||||
* @param height the total document height in pixels
|
||||
* @param pos the current position in the document, in pixels
|
||||
* @param line_height the line-scroll amount, in pixels
|
||||
*/
|
||||
virtual void setScrollbarParams(int height, int pos, int line_height)
|
||||
{
|
||||
old_work_area_->setScrollbarParams(height, pos, line_height);
|
||||
}
|
||||
|
||||
|
||||
/// paint the cursor and store the background
|
||||
virtual void showCursor(int x, int y, int h, CursorShape shape)
|
||||
{
|
||||
old_screen_->showCursor(x, y, h, shape);
|
||||
}
|
||||
|
||||
/// hide the cursor
|
||||
virtual void removeCursor()
|
||||
{
|
||||
old_screen_->removeCursor();
|
||||
}
|
||||
|
||||
protected:
|
||||
/// cause the display of the given area of the work area
|
||||
virtual void expose(int x, int y, int w, int h)
|
||||
{
|
||||
old_screen_->expose(x, y, w, h);
|
||||
}
|
||||
|
||||
private:
|
||||
FScreen * old_screen_;
|
||||
FWorkArea * old_work_area_;
|
||||
};
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#endif // WORKAREA_H
|
@ -1,30 +0,0 @@
|
||||
/**
|
||||
* \file qt3/LyXKeySymFactory.C
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Asger & Jürgen
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "frontends/LyXKeySymFactory.h"
|
||||
|
||||
#include "QLyXKeySym.h"
|
||||
|
||||
|
||||
namespace lyx {
|
||||
|
||||
namespace LyXKeySymFactory {
|
||||
|
||||
LyXKeySym * create()
|
||||
{
|
||||
return new QLyXKeySym;
|
||||
}
|
||||
|
||||
} // namespace LyXKeySymFactory
|
||||
|
||||
|
||||
} // namespace lyx
|
@ -1,97 +0,0 @@
|
||||
include $(top_srcdir)/config/common.am
|
||||
include $(srcdir)/Makefile.dialogs
|
||||
|
||||
SUBDIRS = ui
|
||||
|
||||
EXTRA_DIST = pch.h Makefile.dialogs
|
||||
|
||||
libqt3_la_DEPENDENCIES = $(MOCEDFILES)
|
||||
|
||||
MOCEDFILES = $(MOCFILES:.C=_moc.cpp)
|
||||
|
||||
%_moc.cpp: %.h
|
||||
$(MOC) -o $@ $<
|
||||
|
||||
BUILT_SOURCES = $(PCH_FILE) $(MOCEDFILES)
|
||||
|
||||
noinst_LTLIBRARIES = libqt3.la
|
||||
|
||||
libqt3_la_LDFLAGS = $(QT_LDFLAGS)
|
||||
libqt3_la_LIBADD = $(QT_LIB) ui/*.lo ui/moc/*.lo
|
||||
|
||||
AM_CPPFLAGS += \
|
||||
$(QT_CPPFLAGS) \
|
||||
$(PCH_FLAGS) \
|
||||
-I$(top_srcdir)/src \
|
||||
-I$(top_srcdir)/src/frontends \
|
||||
-I$(top_srcdir)/images \
|
||||
$(QT_INCLUDES) $(BOOST_INCLUDES) \
|
||||
-I$(top_srcdir)/src/frontends/controllers
|
||||
|
||||
libqt3_la_SOURCES = \
|
||||
QDialogView.C \
|
||||
QDialogView.h \
|
||||
Alert_pimpl.C \
|
||||
Dialogs.C \
|
||||
FileDialog.C \
|
||||
GuiApplication.C GuiApplication.h \
|
||||
GuiClipboard.C GuiClipboard.h \
|
||||
GuiFontMetrics.C GuiFontMetrics.h \
|
||||
GuiImplementation.h \
|
||||
GuiSelection.C GuiSelection.h \
|
||||
GuiWorkArea.h \
|
||||
LyXKeySymFactory.C \
|
||||
QLMenubar.C QLMenubar.h \
|
||||
qtTimeout.C qtTimeout.h \
|
||||
QAbout.C QAbout.h \
|
||||
QBibitem.C QBibitem.h \
|
||||
QBibtex.C QBibtex.h \
|
||||
QBox.C QBox.h \
|
||||
QBranch.C QBranch.h \
|
||||
QChanges.C QChanges.h \
|
||||
QCharacter.C QCharacter.h \
|
||||
QCitation.C QCitation.h \
|
||||
QDocument.C QDocument.h \
|
||||
QErrorList.C QErrorList.h \
|
||||
QERT.C QERT.h \
|
||||
QExternal.C QExternal.h \
|
||||
QFloat.C QFloat.h \
|
||||
QGraphics.C QGraphics.h \
|
||||
QInclude.C QInclude.h \
|
||||
QIndex.C QIndex.h \
|
||||
QLImage.C QLImage.h \
|
||||
QLog.C QLog.h \
|
||||
QViewSource.C QViewSource.h \
|
||||
QLPainter.C QLPainter.h \
|
||||
QLyXKeySym.C QLyXKeySym.h \
|
||||
QMath.C QMath.h \
|
||||
QNote.C QNote.h \
|
||||
QParagraph.C QParagraph.h \
|
||||
QPrefs.C QPrefs.h \
|
||||
QPrint.C QPrint.h \
|
||||
QRef.C QRef.h \
|
||||
QSearch.C QSearch.h \
|
||||
QSendto.C QSendto.h \
|
||||
QShowFile.C QShowFile.h \
|
||||
QSpellchecker.C QSpellchecker.h \
|
||||
QTabular.C QTabular.h \
|
||||
QTabularCreate.C QTabularCreate.h \
|
||||
QTexinfo.C QTexinfo.h \
|
||||
QThesaurus.C QThesaurus.h \
|
||||
QToc.C QToc.h \
|
||||
QURL.C QURL.h \
|
||||
QVSpace.C QVSpace.h \
|
||||
QWorkArea.h QWorkArea.C \
|
||||
QWrap.C QWrap.h \
|
||||
Qt2BC.C Qt2BC.h \
|
||||
QtLyXView.h \
|
||||
checkedwidgets.C checkedwidgets.h \
|
||||
lcolorcache.h lcolorcache.C \
|
||||
panelstack.h panelstack.C \
|
||||
qcoloritem.h qcoloritem.C \
|
||||
qfontexample.h qfontexample.C \
|
||||
qfont_loader.h qfont_loader.C \
|
||||
qlkey.h \
|
||||
qscreen.h qscreen.C \
|
||||
qt_helpers.h qt_helpers.C \
|
||||
$(MOCFILES)
|
@ -1,132 +0,0 @@
|
||||
# this is the master file from which the dialog file rules are generated
|
||||
|
||||
UIFILES = \
|
||||
BiblioModuleBase.ui \
|
||||
BranchesModuleBase.ui \
|
||||
BulletsModuleBase.ui \
|
||||
FontModuleBase.ui \
|
||||
TextLayoutModuleBase.ui \
|
||||
LanguageModuleBase.ui \
|
||||
LaTeXModuleBase.ui \
|
||||
MarginsModuleBase.ui \
|
||||
NumberingModuleBase.ui \
|
||||
MathsModuleBase.ui \
|
||||
PageLayoutModuleBase.ui \
|
||||
PreambleModuleBase.ui \
|
||||
QAboutDialogBase.ui \
|
||||
QAskForTextDialog.ui \
|
||||
QBibitemDialogBase.ui \
|
||||
QBibtexDialogBase.ui \
|
||||
QBibtexAddDialogBase.ui \
|
||||
QBoxDialogBase.ui \
|
||||
QBranchDialogBase.ui \
|
||||
QChangesDialogBase.ui \
|
||||
QCharacterDialogBase.ui \
|
||||
QCitationDialogBase.ui \
|
||||
QCitationFindDialogBase.ui \
|
||||
QDelimiterDialogBase.ui \
|
||||
QDocumentDialogBase.ui \
|
||||
QErrorListDialogBase.ui \
|
||||
QERTDialogBase.ui \
|
||||
QExternalDialogBase.ui \
|
||||
QFloatDialogBase.ui \
|
||||
QGraphicsDialogBase.ui \
|
||||
QIncludeDialogBase.ui \
|
||||
QIndexDialogBase.ui \
|
||||
QLogDialogBase.ui \
|
||||
QViewSourceDialogBase.ui \
|
||||
QMathDialogBase.ui \
|
||||
QMathMatrixDialogBase.ui \
|
||||
QNoteDialogBase.ui \
|
||||
QParagraphDialogBase.ui \
|
||||
QPrefAsciiModule.ui \
|
||||
QPrefColorsModule.ui \
|
||||
QPrefConvertersModule.ui \
|
||||
QPrefCopiersModule.ui \
|
||||
QPrefCygwinPathModule.ui \
|
||||
QPrefDateModule.ui \
|
||||
QPrefDisplayModule.ui \
|
||||
QPrefFileformatsModule.ui \
|
||||
QPrefIdentityModule.ui \
|
||||
QPrefKeyboardModule.ui \
|
||||
QPrefLanguageModule.ui \
|
||||
QPrefLatexModule.ui \
|
||||
QPrefPathsModule.ui \
|
||||
QPrefPrinterModule.ui \
|
||||
QPrefScreenFontsModule.ui \
|
||||
QPrefsDialogBase.ui \
|
||||
QPrefSpellcheckerModule.ui \
|
||||
QPrefUIModule.ui \
|
||||
QPrintDialogBase.ui \
|
||||
QRefDialogBase.ui \
|
||||
QSearchDialogBase.ui \
|
||||
QSendtoDialogBase.ui \
|
||||
QShowFileDialogBase.ui \
|
||||
QSpellcheckerDialogBase.ui \
|
||||
QTabularCreateDialogBase.ui \
|
||||
QTabularDialogBase.ui \
|
||||
QTexinfoDialogBase.ui \
|
||||
QThesaurusDialogBase.ui \
|
||||
QTocDialogBase.ui \
|
||||
QURLDialogBase.ui \
|
||||
QVSpaceDialogBase.ui \
|
||||
QWrapDialogBase.ui
|
||||
|
||||
MOCFILES = \
|
||||
BulletsModule.C BulletsModule.h \
|
||||
emptytable.C emptytable.h \
|
||||
FileDialog_private.C FileDialog_private.h \
|
||||
floatplacement.C floatplacement.h \
|
||||
iconpalette.C iconpalette.h \
|
||||
lengthcombo.C lengthcombo.h \
|
||||
panelstack.C panelstack.h \
|
||||
QAboutDialog.C QAboutDialog.h \
|
||||
QBibitemDialog.C QBibitemDialog.h \
|
||||
QBibtexDialog.C QBibtexDialog.h \
|
||||
QBoxDialog.C QBoxDialog.h \
|
||||
QBranchDialog.C QBranchDialog.h \
|
||||
QBrowseBox.C QBrowseBox.h \
|
||||
QChangesDialog.C QChangesDialog.h \
|
||||
QCharacterDialog.C QCharacterDialog.h \
|
||||
QCitationDialog.C QCitationDialog.h \
|
||||
QCommandBuffer.C QCommandBuffer.h \
|
||||
QCommandEdit.C QCommandEdit.h \
|
||||
QContentPane.C QContentPane.h \
|
||||
QDelimiterDialog.C QDelimiterDialog.h \
|
||||
QDocumentDialog.C QDocumentDialog.h \
|
||||
QErrorListDialog.C QErrorListDialog.h \
|
||||
QERTDialog.C QERTDialog.h \
|
||||
QExternalDialog.C QExternalDialog.h \
|
||||
QFloatDialog.C QFloatDialog.h \
|
||||
QGraphicsDialog.C QGraphicsDialog.h \
|
||||
QIncludeDialog.C QIncludeDialog.h \
|
||||
QIndexDialog.C QIndexDialog.h \
|
||||
QLogDialog.C QLogDialog.h \
|
||||
QViewSourceDialog.C QViewSourceDialog.h \
|
||||
QLPopupMenu.C QLPopupMenu.h \
|
||||
QLPrintDialog.C QLPrintDialog.h \
|
||||
QMathDialog.C QMathDialog.h \
|
||||
QMathMatrixDialog.C QMathMatrixDialog.h \
|
||||
QNoteDialog.C QNoteDialog.h \
|
||||
QParagraphDialog.C QParagraphDialog.h \
|
||||
QPrefsDialog.C QPrefsDialog.h \
|
||||
QRefDialog.C QRefDialog.h \
|
||||
QSearchDialog.C QSearchDialog.h \
|
||||
QSendtoDialog.C QSendtoDialog.h \
|
||||
qsetborder.C qsetborder.h \
|
||||
QShowFileDialog.C QShowFileDialog.h \
|
||||
QSpellcheckerDialog.C QSpellcheckerDialog.h \
|
||||
QDialogView.C QDialogView.h \
|
||||
QTabularCreateDialog.C QTabularCreateDialog.h \
|
||||
QTabularDialog.C QTabularDialog.h \
|
||||
QTexinfoDialog.C QTexinfoDialog.h \
|
||||
QThesaurusDialog.C QThesaurusDialog.h \
|
||||
QTocDialog.C QTocDialog.h \
|
||||
qttableview.C qttableview.h \
|
||||
QtView.C QtView.h \
|
||||
QURLDialog.C QURLDialog.h \
|
||||
QVSpaceDialog.C QVSpaceDialog.h \
|
||||
QWrapDialog.C QWrapDialog.h \
|
||||
QLToolbar.C QLToolbar.h \
|
||||
socket_callback.C socket_callback.h \
|
||||
validators.C validators.h
|
@ -1,131 +0,0 @@
|
||||
/**
|
||||
* \file QAbout.C
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Kalle Dalheimer
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "QAbout.h"
|
||||
#include "QAboutDialog.h"
|
||||
#include "Qt2BC.h"
|
||||
#include "qt_helpers.h"
|
||||
|
||||
#include "controllers/ButtonController.h"
|
||||
#include "controllers/ControlAboutlyx.h"
|
||||
|
||||
#include "support/lstrings.h"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
#include <qlabel.h>
|
||||
#include <qpushbutton.h>
|
||||
#include <qtextcodec.h>
|
||||
#include <qtextview.h>
|
||||
|
||||
using lyx::support::prefixIs;
|
||||
|
||||
using std::getline;
|
||||
|
||||
using std::istringstream;
|
||||
using std::ostringstream;
|
||||
using std::string;
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
typedef QController<ControlAboutlyx, QView<QAboutDialog> > base_class;
|
||||
|
||||
QAbout::QAbout(Dialog & parent)
|
||||
: base_class(parent, _("About LyX"))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void QAbout::build_dialog()
|
||||
{
|
||||
dialog_.reset(new QAboutDialog);
|
||||
connect(dialog_.get()->closePB, SIGNAL(clicked()),
|
||||
this, SLOT(slotClose()));
|
||||
|
||||
dialog_->copyright->setText(toqstr(controller().getCopyright()));
|
||||
dialog_->copyright->append("\n");
|
||||
dialog_->copyright->append(toqstr(controller().getLicense()));
|
||||
dialog_->copyright->append("\n");
|
||||
dialog_->copyright->append(toqstr(controller().getDisclaimer()));
|
||||
|
||||
dialog_->versionLA->setText(toqstr(controller().getVersion()));
|
||||
|
||||
// The code below should depend on a autoconf test. (Lgb)
|
||||
#if 1
|
||||
// There are a lot of buggy stringstream implementations..., but the
|
||||
// code below will work on all of them (I hope). The drawback with
|
||||
// this solutions os the extra copying. (Lgb)
|
||||
|
||||
ostringstream in;
|
||||
controller().getCredits(in);
|
||||
|
||||
istringstream ss(in.str());
|
||||
|
||||
string s;
|
||||
ostringstream out;
|
||||
|
||||
while (getline(ss, s)) {
|
||||
if (prefixIs(s, "@b"))
|
||||
out << "<b>" << s.substr(2) << "</b>";
|
||||
else if (prefixIs(s, "@i"))
|
||||
out << "<i>" << s.substr(2) << "</i>";
|
||||
else
|
||||
out << s;
|
||||
out << "<br>";
|
||||
}
|
||||
#else
|
||||
// Good stringstream implementations can handle this. It avoids
|
||||
// some copying, and should thus be faster and use less memory. (Lgb)
|
||||
// I'll make this the default for a short while to see if anyone
|
||||
// see the error...
|
||||
stringstream in;
|
||||
controller().getCredits(in);
|
||||
in.seekg(0);
|
||||
string s;
|
||||
ostringstream out;
|
||||
|
||||
while (getline(in, s)) {
|
||||
if (prefixIs(s, "@b"))
|
||||
out << "<b>" << s.substr(2) << "</b>";
|
||||
else if (prefixIs(s, "@i"))
|
||||
out << "<i>" << s.substr(2) << "</i>";
|
||||
else
|
||||
out << s;
|
||||
out << "<br>";
|
||||
}
|
||||
#endif
|
||||
|
||||
// Try and grab the latin1 codec
|
||||
QTextCodec * const codec =
|
||||
QTextCodec::codecForName("ISO8859-1");
|
||||
if (!codec)
|
||||
lyxerr << "Unable to find ISO8859-1 codec" << std::endl;
|
||||
|
||||
QString const qtext = codec ?
|
||||
codec->toUnicode(out.str().c_str()) :
|
||||
toqstr(out.str());
|
||||
dialog_->creditsTV->setText(qtext);
|
||||
|
||||
// try to resize to a good size
|
||||
dialog_->copyright->hide();
|
||||
dialog_->setMinimumSize(dialog_->copyright->sizeHint());
|
||||
dialog_->copyright->show();
|
||||
dialog_->setMinimumSize(dialog_->sizeHint());
|
||||
|
||||
// Manage the cancel/close button
|
||||
bcview().setCancel(dialog_->closePB);
|
||||
bc().refresh();
|
||||
}
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
@ -1,40 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file QAbout.h
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Kalle Dalheimer
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#ifndef FORMABOUT_H
|
||||
#define FORMABOUT_H
|
||||
|
||||
#include "QDialogView.h"
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
class QAboutDialog;
|
||||
class ControlAboutlyx;
|
||||
|
||||
class QAbout
|
||||
: public QController<ControlAboutlyx, QView<QAboutDialog> >
|
||||
{
|
||||
public:
|
||||
QAbout(Dialog &);
|
||||
private:
|
||||
/// not needed
|
||||
virtual void apply() {}
|
||||
/// not needed
|
||||
virtual void update_contents() {}
|
||||
// build the dialog
|
||||
virtual void build_dialog();
|
||||
};
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#endif // FORMABOUT_H
|
@ -1,31 +0,0 @@
|
||||
/**
|
||||
* \file QAboutDialog.C
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Kalle Dalheimer
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "QAboutDialog.h"
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
QAboutDialog::QAboutDialog(QWidget * parent, const char * name,
|
||||
bool modal, WFlags fl)
|
||||
: QAboutDialogBase(parent, name, modal, fl)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
QAboutDialog::~QAboutDialog()
|
||||
{}
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#include "QAboutDialog_moc.cpp"
|
@ -1,31 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file QAboutDialog.h
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Kalle Dalheimer
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#ifndef QABOUTDIALOG_H
|
||||
#define QABOUTDIALOG_H
|
||||
|
||||
#include "ui/QAboutDialogBase.h"
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
class QAboutDialog : public QAboutDialogBase {
|
||||
Q_OBJECT
|
||||
public:
|
||||
QAboutDialog(QWidget * parent = 0, const char * name = 0,
|
||||
bool modal = FALSE, WFlags fl = 0);
|
||||
~QAboutDialog();
|
||||
};
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#endif // QABOUTDIALOG_H
|
@ -1,67 +0,0 @@
|
||||
/**
|
||||
* \file QBibitem.C
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author John Levon
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "QBibitem.h"
|
||||
#include "QBibitemDialog.h"
|
||||
#include "Qt2BC.h"
|
||||
#include "qt_helpers.h"
|
||||
|
||||
#include "controllers/ControlCommand.h"
|
||||
|
||||
#include <qlineedit.h>
|
||||
#include <qpushbutton.h>
|
||||
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
typedef QController<ControlCommand, QView<QBibitemDialog> > base_class;
|
||||
|
||||
|
||||
QBibitem::QBibitem(Dialog & parent)
|
||||
: base_class(parent, _("Bibliography Entry Settings"))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void QBibitem::build_dialog()
|
||||
{
|
||||
dialog_.reset(new QBibitemDialog(this));
|
||||
|
||||
bcview().setOK(dialog_->okPB);
|
||||
bcview().setCancel(dialog_->closePB);
|
||||
bcview().addReadOnly(dialog_->keyED);
|
||||
bcview().addReadOnly(dialog_->labelED);
|
||||
}
|
||||
|
||||
|
||||
void QBibitem::update_contents()
|
||||
{
|
||||
dialog_->keyED->setText(toqstr(controller().params()["key"]));
|
||||
dialog_->labelED->setText(toqstr(controller().params()["label"]));
|
||||
}
|
||||
|
||||
|
||||
void QBibitem::apply()
|
||||
{
|
||||
controller().params()["key"] = qstring_to_ucs4(dialog_->keyED->text());
|
||||
controller().params()["label"] = qstring_to_ucs4(dialog_->labelED->text());
|
||||
}
|
||||
|
||||
|
||||
bool QBibitem::isValid()
|
||||
{
|
||||
return !dialog_->keyED->text().isEmpty();
|
||||
}
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
@ -1,44 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file QBibitem.h
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author John Levon
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#ifndef QBIBITEM_H
|
||||
#define QBIBITEM_H
|
||||
|
||||
#include "QDialogView.h"
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
class ControlCommand;
|
||||
class QBibitemDialog;
|
||||
|
||||
class QBibitem
|
||||
: public QController<ControlCommand, QView<QBibitemDialog> >
|
||||
{
|
||||
public:
|
||||
friend class QBibitemDialog;
|
||||
|
||||
QBibitem(Dialog &);
|
||||
protected:
|
||||
virtual bool isValid();
|
||||
private:
|
||||
/// Apply changes
|
||||
virtual void apply();
|
||||
/// update
|
||||
virtual void update_contents();
|
||||
/// build the dialog
|
||||
virtual void build_dialog();
|
||||
};
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#endif // QBIBITEM_H
|
@ -1,47 +0,0 @@
|
||||
/**
|
||||
* \file QBibitemDialog.C
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author John Levon
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "QBibitemDialog.h"
|
||||
#include "QBibitem.h"
|
||||
|
||||
#include <qpushbutton.h>
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
QBibitemDialog::QBibitemDialog(QBibitem * form)
|
||||
: QBibitemDialogBase(0, 0, false, 0),
|
||||
form_(form)
|
||||
{
|
||||
connect(okPB, SIGNAL(clicked()),
|
||||
form, SLOT(slotOK()));
|
||||
connect(closePB, SIGNAL(clicked()),
|
||||
form, SLOT(slotClose()));
|
||||
}
|
||||
|
||||
|
||||
void QBibitemDialog::change_adaptor()
|
||||
{
|
||||
form_->changed();
|
||||
}
|
||||
|
||||
|
||||
void QBibitemDialog::closeEvent(QCloseEvent *e)
|
||||
{
|
||||
form_->slotWMHide();
|
||||
e->accept();
|
||||
}
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#include "QBibitemDialog_moc.cpp"
|
@ -1,37 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file QBibitemDialog.h
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author John Levon
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#ifndef QBIBITEMDIALOG_H
|
||||
#define QBIBITEMDIALOG_H
|
||||
|
||||
#include "ui/QBibitemDialogBase.h"
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
class QBibitem;
|
||||
|
||||
class QBibitemDialog : public QBibitemDialogBase {
|
||||
Q_OBJECT
|
||||
public:
|
||||
QBibitemDialog(QBibitem * form);
|
||||
protected slots:
|
||||
virtual void change_adaptor();
|
||||
protected:
|
||||
virtual void closeEvent(QCloseEvent * e);
|
||||
private:
|
||||
QBibitem * form_;
|
||||
};
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#endif // QBIBITEMDIALOG_H
|
@ -1,196 +0,0 @@
|
||||
/**
|
||||
* \file QBibtex.C
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author John Levon
|
||||
* \author Herbert Voß
|
||||
* \author Jürgen Spitzmüller
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "QBibtex.h"
|
||||
#include "QBibtexDialog.h"
|
||||
#include "ui/QBibtexAddDialogBase.h"
|
||||
#include "Qt2BC.h"
|
||||
#include "qt_helpers.h"
|
||||
#include "validators.h"
|
||||
|
||||
#include "lyxrc.h"
|
||||
|
||||
#include "controllers/ControlBibtex.h"
|
||||
|
||||
#include "support/filetools.h" // ChangeExtension
|
||||
#include "support/lstrings.h"
|
||||
|
||||
#include <qcombobox.h>
|
||||
#include <qpushbutton.h>
|
||||
#include <qlistbox.h>
|
||||
#include <qcheckbox.h>
|
||||
|
||||
|
||||
using lyx::support::changeExtension;
|
||||
using lyx::support::split;
|
||||
using lyx::support::trim;
|
||||
|
||||
using std::vector;
|
||||
using std::string;
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
typedef QController<ControlBibtex, QView<QBibtexDialog> > base_class;
|
||||
|
||||
QBibtex::QBibtex(Dialog & parent)
|
||||
: base_class(parent, _("BibTeX Bibliography"))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void QBibtex::build_dialog()
|
||||
{
|
||||
dialog_.reset(new QBibtexDialog(this));
|
||||
|
||||
bcview().setOK(dialog_->okPB);
|
||||
bcview().setCancel(dialog_->closePB);
|
||||
bcview().addReadOnly(dialog_->databaseLB);
|
||||
bcview().addReadOnly(dialog_->stylePB);
|
||||
bcview().addReadOnly(dialog_->styleCB);
|
||||
bcview().addReadOnly(dialog_->bibtocCB);
|
||||
bcview().addReadOnly(dialog_->addBibPB);
|
||||
bcview().addReadOnly(dialog_->deletePB);
|
||||
}
|
||||
|
||||
|
||||
void QBibtex::update_contents()
|
||||
{
|
||||
PathValidator * path_validator =
|
||||
getPathValidator(dialog_->add_->bibED);
|
||||
if (path_validator)
|
||||
path_validator->setChecker(kernel().docType(), lyxrc);
|
||||
|
||||
bool bibtopic = controller().usingBibtopic();
|
||||
|
||||
dialog_->databaseLB->clear();
|
||||
|
||||
docstring bibs(controller().params()["bibfiles"]);
|
||||
docstring bib;
|
||||
|
||||
while (!bibs.empty()) {
|
||||
bibs = split(bibs, bib, ',');
|
||||
bib = trim(bib);
|
||||
if (!bib.empty())
|
||||
dialog_->databaseLB->insertItem(toqstr(bib));
|
||||
}
|
||||
|
||||
dialog_->add_->bibLB->clear();
|
||||
|
||||
vector<string> bib_str;
|
||||
controller().getBibFiles(bib_str);
|
||||
for (vector<string>::const_iterator it = bib_str.begin();
|
||||
it != bib_str.end(); ++it) {
|
||||
string bibItem(changeExtension(*it, ""));
|
||||
dialog_->add_->bibLB->insertItem(toqstr(bibItem));
|
||||
}
|
||||
|
||||
dialog_->bibtocCB->setChecked(controller().bibtotoc() && !bibtopic);
|
||||
dialog_->bibtocCB->setEnabled(!bibtopic);
|
||||
|
||||
docstring btprint(controller().params()["bibfiles"]);
|
||||
int btp = 0;
|
||||
if (btprint == "btPrintNotCited")
|
||||
btp = 1;
|
||||
else if (btprint == "btPrintAll")
|
||||
btp = 2;
|
||||
|
||||
dialog_->btPrintCO->setCurrentItem(btp);
|
||||
dialog_->btPrintCO->setEnabled(bibtopic);
|
||||
|
||||
dialog_->styleCB->clear();
|
||||
|
||||
int item_nr(-1);
|
||||
string bibstyle(controller().getStylefile());
|
||||
|
||||
vector<string> str;
|
||||
controller().getBibStyles(str);
|
||||
for (vector<string>::const_iterator it = str.begin();
|
||||
it != str.end(); ++it) {
|
||||
string item(changeExtension(*it, ""));
|
||||
if (item == bibstyle)
|
||||
item_nr = int(it - str.begin());
|
||||
dialog_->styleCB->insertItem(toqstr(item));
|
||||
}
|
||||
|
||||
if (item_nr == -1 && !bibstyle.empty()) {
|
||||
dialog_->styleCB->insertItem(toqstr(bibstyle));
|
||||
item_nr = dialog_->styleCB->count() - 1;
|
||||
}
|
||||
|
||||
if (item_nr != -1)
|
||||
dialog_->styleCB->setCurrentItem(item_nr);
|
||||
else
|
||||
dialog_->styleCB->clearEdit();
|
||||
}
|
||||
|
||||
|
||||
void QBibtex::apply()
|
||||
{
|
||||
docstring dbs(qstring_to_ucs4(dialog_->databaseLB->text(0)));
|
||||
|
||||
unsigned int maxCount = dialog_->databaseLB->count();
|
||||
for (unsigned int i = 1; i < maxCount; i++) {
|
||||
dbs += ',';
|
||||
dbs += qstring_to_ucs4(dialog_->databaseLB->text(i));
|
||||
}
|
||||
|
||||
controller().params()["bibfiles"] = dbs;
|
||||
|
||||
docstring const bibstyle(qstring_to_ucs4(dialog_->styleCB->currentText()));
|
||||
bool const bibtotoc(dialog_->bibtocCB->isChecked());
|
||||
|
||||
if (bibtotoc && (!bibstyle.empty())) {
|
||||
// both bibtotoc and style
|
||||
controller().params()["options"] = "bibtotoc," + bibstyle;
|
||||
} else if (bibtotoc) {
|
||||
// bibtotoc and no style
|
||||
controller().params()["options"] = lyx::from_ascii("bibtotoc");
|
||||
} else {
|
||||
// only style. An empty one is valid, because some
|
||||
// documentclasses have an own \bibliographystyle{}
|
||||
// command!
|
||||
controller().params()["options"] = bibstyle;
|
||||
}
|
||||
|
||||
// bibtopic allows three kinds of sections:
|
||||
// 1. sections that include all cited references of the database(s)
|
||||
// 2. sections that include all uncited references of the database(s)
|
||||
// 3. sections that include all references of the database(s), cited or not
|
||||
int btp = dialog_->btPrintCO->currentItem();
|
||||
|
||||
switch (btp) {
|
||||
case 0:
|
||||
controller().params()["btprint"] = lyx::from_ascii("btPrintCited");
|
||||
break;
|
||||
case 1:
|
||||
controller().params()["btprint"] = lyx::from_ascii("btPrintNotCited");
|
||||
break;
|
||||
case 2:
|
||||
controller().params()["btprint"] = lyx::from_ascii("btPrintAll");
|
||||
break;
|
||||
}
|
||||
|
||||
if (!controller().usingBibtopic())
|
||||
controller().params()["btprint"] = docstring();
|
||||
}
|
||||
|
||||
|
||||
bool QBibtex::isValid()
|
||||
{
|
||||
return dialog_->databaseLB->count() != 0;
|
||||
}
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
@ -1,44 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file QBibtex.h
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author John Levon
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#ifndef QBIBTEX_H
|
||||
#define QBIBTEX_H
|
||||
|
||||
#include "QDialogView.h"
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
class ControlBibtex;
|
||||
class QBibtexDialog;
|
||||
|
||||
class QBibtex
|
||||
: public QController<ControlBibtex, QView<QBibtexDialog> >
|
||||
{
|
||||
public:
|
||||
friend class QBibtexDialog;
|
||||
|
||||
QBibtex(Dialog &);
|
||||
protected:
|
||||
virtual bool isValid();
|
||||
private:
|
||||
/// Apply changes
|
||||
virtual void apply();
|
||||
/// update
|
||||
virtual void update_contents();
|
||||
/// build the dialog
|
||||
virtual void build_dialog();
|
||||
};
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#endif // QBIBTEX_H
|
@ -1,208 +0,0 @@
|
||||
/**
|
||||
* \file QBibtexDialog.C
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author John Levon
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "QBibtexDialog.h"
|
||||
#include "ui/QBibtexAddDialogBase.h"
|
||||
#include "QBibtex.h"
|
||||
|
||||
#include "checkedwidgets.h"
|
||||
#include "Qt2BC.h"
|
||||
#include "qt_helpers.h"
|
||||
#include "validators.h"
|
||||
|
||||
#include "controllers/ControlBibtex.h"
|
||||
#include "controllers/ButtonPolicies.h"
|
||||
|
||||
#include "support/filetools.h"
|
||||
#include "support/lstrings.h"
|
||||
|
||||
#include <qpushbutton.h>
|
||||
#include <qcombobox.h>
|
||||
#include <qlineedit.h>
|
||||
#include <qlistbox.h>
|
||||
|
||||
using lyx::support::changeExtension;
|
||||
using lyx::support::trim;
|
||||
|
||||
using std::string;
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
QBibtexDialog::QBibtexDialog(QBibtex * form)
|
||||
: QBibtexDialogBase(0, 0, false, 0),
|
||||
form_(form)
|
||||
{
|
||||
connect(okPB, SIGNAL(clicked()),
|
||||
form, SLOT(slotOK()));
|
||||
connect(closePB, SIGNAL(clicked()),
|
||||
form, SLOT(slotClose()));
|
||||
|
||||
add_ = new QBibtexAddDialogBase(this, "", true);
|
||||
add_->setCaption(qt_("LyX: Add BibTeX Database"));
|
||||
|
||||
Qt2BC * bcview = new Qt2BC(add_bc_);
|
||||
add_bc_.view(bcview);
|
||||
add_bc_.bp(new OkCancelPolicy);
|
||||
|
||||
bcview->setOK(add_->addPB);
|
||||
bcview->setCancel(add_->closePB);
|
||||
|
||||
add_->bibED->setValidator(new PathValidator(false, add_->bibED));
|
||||
addCheckedLineEdit(add_bc_.view(), add_->bibED, 0);
|
||||
|
||||
connect(add_->bibED, SIGNAL(textChanged(const QString&)),
|
||||
this, SLOT(bibEDChanged()));
|
||||
connect(add_->addPB, SIGNAL(clicked()),
|
||||
this, SLOT(addDatabase()));
|
||||
connect(add_->bibLB, SIGNAL(selected(QListBoxItem *)),
|
||||
this, SLOT(addDatabase()));
|
||||
connect(add_->bibLB, SIGNAL(selected(QListBoxItem *)),
|
||||
add_, SLOT(accept()));
|
||||
connect(add_->bibLB, SIGNAL(currentChanged(QListBoxItem *)),
|
||||
this, SLOT(availableChanged()));
|
||||
connect(add_->browsePB, SIGNAL(clicked()),
|
||||
this, SLOT(browseBibPressed()));
|
||||
}
|
||||
|
||||
|
||||
QBibtexDialog::~QBibtexDialog()
|
||||
{}
|
||||
|
||||
|
||||
void QBibtexDialog::bibEDChanged()
|
||||
{
|
||||
// Indicate to the button controller that the contents have
|
||||
// changed. The actual test of validity is carried out by
|
||||
// the checkedLineEdit.
|
||||
add_bc_.valid(true);
|
||||
}
|
||||
|
||||
|
||||
void QBibtexDialog::change_adaptor()
|
||||
{
|
||||
form_->changed();
|
||||
}
|
||||
|
||||
|
||||
void QBibtexDialog::browsePressed()
|
||||
{
|
||||
string const file = lyx::to_utf8(form_->controller().browseBst(lyx::from_ascii("")));
|
||||
|
||||
if (!file.empty()) {
|
||||
string const filen = changeExtension(file, "");
|
||||
bool present = false;
|
||||
unsigned int pres = 0;
|
||||
|
||||
for (int i = 0; i != styleCB->count(); ++i) {
|
||||
if (fromqstr(styleCB->text(i)) == filen) {
|
||||
present = true;
|
||||
pres = i;
|
||||
}
|
||||
}
|
||||
|
||||
if (!present)
|
||||
styleCB->insertItem(toqstr(filen),0);
|
||||
|
||||
styleCB->setCurrentItem(pres);
|
||||
form_->changed();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void QBibtexDialog::browseBibPressed()
|
||||
{
|
||||
string const file = trim(lyx::to_utf8(form_->controller().browseBib(lyx::from_ascii(""))));
|
||||
|
||||
if (!file.empty()) {
|
||||
string const f = changeExtension(file, "");
|
||||
bool present = false;
|
||||
|
||||
for (unsigned int i = 0; i != add_->bibLB->count(); i++) {
|
||||
if (fromqstr(add_->bibLB->text(i)) == f)
|
||||
present = true;
|
||||
}
|
||||
|
||||
if (!present) {
|
||||
add_->bibLB->insertItem(toqstr(f));
|
||||
form_->changed();
|
||||
}
|
||||
|
||||
add_->bibED->setText(toqstr(f));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void QBibtexDialog::addPressed()
|
||||
{
|
||||
add_->exec();
|
||||
add_bc_.valid(false);
|
||||
}
|
||||
|
||||
|
||||
void QBibtexDialog::addDatabase()
|
||||
{
|
||||
int const sel = add_->bibLB->currentItem();
|
||||
string const file = trim(fromqstr(add_->bibED->text()));
|
||||
|
||||
if (sel < 0 && file.empty())
|
||||
return;
|
||||
|
||||
// Add the selected browser_bib keys to browser_database
|
||||
// multiple selections are possible
|
||||
for (unsigned int i = 0; i != add_->bibLB->count(); i++) {
|
||||
if (add_->bibLB->isSelected(i)) {
|
||||
// do not allow duplicates
|
||||
if ((databaseLB->findItem(add_->bibLB->text(i))) == 0)
|
||||
databaseLB->insertItem(add_->bibLB->text(i));
|
||||
}
|
||||
}
|
||||
|
||||
if (!file.empty()) {
|
||||
QString const f = toqstr(changeExtension(file, ""));
|
||||
if ((databaseLB->findItem(f)) == 0)
|
||||
databaseLB->insertItem(f);
|
||||
}
|
||||
|
||||
form_->changed();
|
||||
}
|
||||
|
||||
|
||||
void QBibtexDialog::deletePressed()
|
||||
{
|
||||
databaseLB->removeItem(databaseLB->currentItem());
|
||||
}
|
||||
|
||||
|
||||
|
||||
void QBibtexDialog::databaseChanged()
|
||||
{
|
||||
deletePB->setEnabled(!form_->readOnly() && databaseLB->currentItem() != -1);
|
||||
}
|
||||
|
||||
|
||||
void QBibtexDialog::availableChanged()
|
||||
{
|
||||
form_->changed();
|
||||
}
|
||||
|
||||
|
||||
void QBibtexDialog::closeEvent(QCloseEvent *e)
|
||||
{
|
||||
form_->slotWMHide();
|
||||
e->accept();
|
||||
}
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#include "QBibtexDialog_moc.cpp"
|
@ -1,56 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file QBibtexDialog.h
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author John Levon
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#ifndef QBIBTEXDIALOG_H
|
||||
#define QBIBTEXDIALOG_H
|
||||
|
||||
#include "ui/QBibtexDialogBase.h"
|
||||
#include "ButtonController.h"
|
||||
|
||||
class QBibtexAddDialogBase;
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
class QBibtex;
|
||||
|
||||
class QBibtexDialog : public QBibtexDialogBase {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QBibtexDialog(QBibtex * form);
|
||||
~QBibtexDialog();
|
||||
|
||||
QBibtexAddDialogBase * add_;
|
||||
|
||||
protected slots:
|
||||
virtual void change_adaptor();
|
||||
virtual void browsePressed();
|
||||
virtual void browseBibPressed();
|
||||
virtual void addPressed();
|
||||
virtual void addDatabase();
|
||||
virtual void deletePressed();
|
||||
virtual void databaseChanged();
|
||||
virtual void availableChanged();
|
||||
void bibEDChanged();
|
||||
|
||||
protected:
|
||||
virtual void closeEvent(QCloseEvent * e);
|
||||
|
||||
private:
|
||||
QBibtex * form_;
|
||||
ButtonController add_bc_;
|
||||
};
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#endif // QBIBTEXDIALOG_H
|
@ -1,296 +0,0 @@
|
||||
/**
|
||||
* \file QBox.C
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Jürgen Vigna (Minipage stuff)
|
||||
* \author Martin Vermeer
|
||||
* \author Jürgen Spitzmüller
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "QBox.h"
|
||||
|
||||
#include "checkedwidgets.h"
|
||||
#include "lengthcombo.h"
|
||||
#include "QBoxDialog.h"
|
||||
#include "qt_helpers.h"
|
||||
#include "Qt2BC.h"
|
||||
|
||||
#include "lengthcommon.h"
|
||||
#include "lyxrc.h" // to set the default length values
|
||||
|
||||
#include "controllers/ControlBox.h"
|
||||
#include "controllers/helper_funcs.h"
|
||||
|
||||
#include "insets/insetbox.h"
|
||||
|
||||
#include "support/lstrings.h"
|
||||
|
||||
#include <qpushbutton.h>
|
||||
#include <qlineedit.h>
|
||||
#include <qcombobox.h>
|
||||
#include <qbuttongroup.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
using lyx::support::getStringFromVector;
|
||||
using lyx::support::isStrDbl;
|
||||
using lyx::support::subst;
|
||||
using std::string;
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
typedef QController<ControlBox, QView<QBoxDialog> > base_class;
|
||||
|
||||
QBox::QBox(Dialog & parent)
|
||||
: base_class(parent, _("Box Settings"))
|
||||
{}
|
||||
|
||||
|
||||
void QBox::build_dialog()
|
||||
{
|
||||
dialog_.reset(new QBoxDialog(this));
|
||||
|
||||
// fill the box type choice
|
||||
box_gui_tokens(ids_, gui_names_);
|
||||
for (unsigned int i = 0; i < gui_names_.size(); ++i)
|
||||
dialog_->typeCO->insertItem(toqstr(gui_names_[i]));
|
||||
|
||||
// add the special units to the height choice
|
||||
// width needs different handling
|
||||
box_gui_tokens_special_length(ids_spec_, gui_names_spec_);
|
||||
for (unsigned int i = 1; i < gui_names_spec_.size(); ++i) {
|
||||
dialog_->heightUnitsLC->insertItem(toqstr(gui_names_spec_[i]));
|
||||
}
|
||||
|
||||
bcview().addReadOnly(dialog_->typeCO);
|
||||
bcview().addReadOnly(dialog_->innerBoxCO);
|
||||
bcview().addReadOnly(dialog_->valignCO);
|
||||
bcview().addReadOnly(dialog_->ialignCO);
|
||||
bcview().addReadOnly(dialog_->halignCO);
|
||||
bcview().addReadOnly(dialog_->widthED);
|
||||
bcview().addReadOnly(dialog_->heightED);
|
||||
bcview().addReadOnly(dialog_->widthUnitsLC);
|
||||
bcview().addReadOnly(dialog_->heightUnitsLC);
|
||||
|
||||
bcview().setRestore(dialog_->restorePB);
|
||||
bcview().setOK(dialog_->okPB);
|
||||
bcview().setApply(dialog_->applyPB);
|
||||
bcview().setCancel(dialog_->closePB);
|
||||
|
||||
// initialize the length validator
|
||||
addCheckedLineEdit(bcview(), dialog_->widthED, dialog_->widthLA);
|
||||
addCheckedLineEdit(bcview(), dialog_->heightED, dialog_->heightLA);
|
||||
}
|
||||
|
||||
|
||||
void QBox::update_contents()
|
||||
{
|
||||
string type(controller().params().type);
|
||||
for (unsigned int i = 0; i < gui_names_.size(); ++i) {
|
||||
if (type == ids_[i])
|
||||
dialog_->typeCO->setCurrentItem(i);
|
||||
}
|
||||
|
||||
// default: minipage
|
||||
unsigned int inner_type = 2;
|
||||
if (!controller().params().inner_box)
|
||||
// none
|
||||
inner_type = 0;
|
||||
if (controller().params().use_parbox)
|
||||
// parbox
|
||||
inner_type = 1;
|
||||
bool frameless = (controller().params().type == "Frameless");
|
||||
setInnerType(frameless, inner_type);
|
||||
|
||||
char c = controller().params().pos;
|
||||
dialog_->valignCO->setCurrentItem(string("tcb").find(c, 0));
|
||||
c = controller().params().inner_pos;
|
||||
dialog_->ialignCO->setCurrentItem(string("tcbs").find(c, 0));
|
||||
c = controller().params().hor_pos;
|
||||
dialog_->halignCO->setCurrentItem(string("lcrs").find(c, 0));
|
||||
|
||||
bool ibox = controller().params().inner_box;
|
||||
dialog_->valignCO->setEnabled(ibox);
|
||||
dialog_->ialignCO->setEnabled(ibox);
|
||||
dialog_->halignCO->setEnabled(!ibox);
|
||||
setSpecial(ibox);
|
||||
|
||||
LyXLength::UNIT default_unit =
|
||||
(lyxrc.default_papersize > 3) ? LyXLength::CM : LyXLength::IN;
|
||||
|
||||
lengthToWidgets(dialog_->widthED, dialog_->widthUnitsLC,
|
||||
(controller().params().width).asString(), default_unit);
|
||||
|
||||
string const special(controller().params().special);
|
||||
if (!special.empty() && special != "none") {
|
||||
QString spc;
|
||||
for (unsigned int i = 0; i < gui_names_spec_.size(); i++) {
|
||||
if (special == ids_spec_[i])
|
||||
spc = toqstr(gui_names_spec_[i].c_str());
|
||||
}
|
||||
for (int j = 0; j < dialog_->widthUnitsLC->count(); j++) {
|
||||
if (dialog_->widthUnitsLC->text(j) == spc)
|
||||
dialog_->widthUnitsLC->setCurrentItem(j);
|
||||
}
|
||||
}
|
||||
|
||||
lengthToWidgets(dialog_->heightED, dialog_->heightUnitsLC,
|
||||
(controller().params().height).asString(), default_unit);
|
||||
|
||||
string const height_special(controller().params().height_special);
|
||||
if (!height_special.empty() && height_special != "none") {
|
||||
QString hspc;
|
||||
for (unsigned int i = 0; i < gui_names_spec_.size(); i++) {
|
||||
if (height_special == ids_spec_[i]) {
|
||||
hspc = toqstr(gui_names_spec_[i].c_str());
|
||||
}
|
||||
}
|
||||
for (int j = 0; j < dialog_->heightUnitsLC->count(); j++) {
|
||||
if (dialog_->heightUnitsLC->text(j) == hspc) {
|
||||
dialog_->heightUnitsLC->setCurrentItem(j);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dialog_->heightED->setEnabled(ibox);
|
||||
dialog_->heightUnitsLC->setEnabled(ibox);
|
||||
}
|
||||
|
||||
|
||||
void QBox::apply()
|
||||
{
|
||||
controller().params().type =
|
||||
ids_[dialog_->typeCO->currentItem()];
|
||||
|
||||
controller().params().inner_box =
|
||||
dialog_->innerBoxCO->currentText() != qt_("None");
|
||||
controller().params().use_parbox =
|
||||
dialog_->innerBoxCO->currentText() == qt_("Parbox");
|
||||
|
||||
controller().params().pos =
|
||||
"tcb"[dialog_->valignCO->currentItem()];
|
||||
controller().params().inner_pos =
|
||||
"tcbs"[dialog_->ialignCO->currentItem()];
|
||||
controller().params().hor_pos =
|
||||
"lcrs"[dialog_->halignCO->currentItem()];
|
||||
|
||||
int i = 0;
|
||||
bool spec = false;
|
||||
QString special = dialog_->widthUnitsLC->currentText();
|
||||
QString value = dialog_->widthED->text();
|
||||
if (special == qt_("Height")) {
|
||||
i = 1;
|
||||
spec = true;
|
||||
} else if (special == qt_("Depth")) {
|
||||
i = 2;
|
||||
spec = true;
|
||||
} else if (special == qt_("Total Height")) {
|
||||
i = 3;
|
||||
spec = true;
|
||||
} else if (special == qt_("Width")) {
|
||||
i = 4;
|
||||
spec = true;
|
||||
}
|
||||
// the user might insert a non-special value in the line edit
|
||||
if (isValidLength(fromqstr(value))) {
|
||||
i = 0;
|
||||
spec = false;
|
||||
}
|
||||
controller().params().special = ids_spec_[i];
|
||||
|
||||
string width;
|
||||
if (spec) {
|
||||
width = fromqstr(value);
|
||||
// beware: bogosity! the unit is simply ignored in this case
|
||||
width += "in";
|
||||
} else
|
||||
width = widgetsToLength(dialog_->widthED, dialog_->widthUnitsLC);
|
||||
|
||||
controller().params().width = LyXLength(width);
|
||||
|
||||
i = 0;
|
||||
spec = false;
|
||||
special = dialog_->heightUnitsLC->currentText();
|
||||
value = dialog_->heightED->text();
|
||||
if (special == qt_("Height")) {
|
||||
i = 1;
|
||||
spec = true;
|
||||
} else if (special == qt_("Depth")) {
|
||||
i = 2;
|
||||
spec = true;
|
||||
} else if (special == qt_("Total Height")) {
|
||||
i = 3;
|
||||
spec = true;
|
||||
} else if (special == qt_("Width")) {
|
||||
i = 4;
|
||||
spec = true;
|
||||
}
|
||||
// the user might insert a non-special value in the line edit
|
||||
if (isValidLength(fromqstr(value))) {
|
||||
i = 0;
|
||||
spec = false;
|
||||
}
|
||||
controller().params().height_special = ids_spec_[i];
|
||||
|
||||
string height;
|
||||
if (spec && !isValidLength(fromqstr(dialog_->heightED->text()))) {
|
||||
height = fromqstr(value);
|
||||
// beware: bogosity! the unit is simply ignored in this case
|
||||
height += "in";
|
||||
} else
|
||||
height = widgetsToLength(dialog_->heightED, dialog_->heightUnitsLC);
|
||||
|
||||
controller().params().height = LyXLength(height);
|
||||
}
|
||||
|
||||
|
||||
void QBox::setSpecial(bool ibox)
|
||||
{
|
||||
box_gui_tokens_special_length(ids_spec_, gui_names_spec_);
|
||||
// check if the widget contains the special units
|
||||
int count = dialog_->widthUnitsLC->count();
|
||||
bool has_special = false;
|
||||
for (int i = 0; i < count; i++)
|
||||
if (dialog_->widthUnitsLC->text(i).contains(qt_("Total Height")) > 0)
|
||||
has_special = true;
|
||||
// insert 'em if needed...
|
||||
if (!ibox && !has_special) {
|
||||
for (unsigned int i = 1; i < gui_names_spec_.size(); i++)
|
||||
dialog_->widthUnitsLC->insertItem(toqstr(gui_names_spec_[i]));
|
||||
// ... or remove 'em if needed
|
||||
} else if (ibox && has_special) {
|
||||
dialog_->widthUnitsLC->clear();
|
||||
for (int i = 0; i < num_units; i++)
|
||||
dialog_->widthUnitsLC->insertItem(unit_name_gui[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void QBox::setInnerType(bool frameless, int i)
|
||||
{
|
||||
// with "frameless" boxes, inner box is mandatory (i.e. is the actual box)
|
||||
// we have to remove "none" then and adjust the combo
|
||||
if (frameless) {
|
||||
dialog_->innerBoxCO->clear();
|
||||
dialog_->innerBoxCO->insertItem(qt_("Parbox"));
|
||||
dialog_->innerBoxCO->insertItem(qt_("Minipage"));
|
||||
dialog_->innerBoxCO->setCurrentItem(i - 1);
|
||||
} else {
|
||||
if (dialog_->innerBoxCO->count() == 2)
|
||||
i += 1;
|
||||
dialog_->innerBoxCO->clear();
|
||||
dialog_->innerBoxCO->insertItem(qt_("None"));
|
||||
dialog_->innerBoxCO->insertItem(qt_("Parbox"));
|
||||
dialog_->innerBoxCO->insertItem(qt_("Minipage"));
|
||||
dialog_->innerBoxCO->setCurrentItem(i);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
@ -1,58 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file QBox.h
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Jürgen Spitzmüller
|
||||
* \ author Martin Vermeer
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#ifndef QBOX_H
|
||||
#define QBOX_H
|
||||
|
||||
#include "QDialogView.h"
|
||||
#include <vector>
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
class ControlBox;
|
||||
class QBoxDialog;
|
||||
|
||||
///
|
||||
class QBox
|
||||
: public QController<ControlBox, QView<QBoxDialog> >
|
||||
{
|
||||
public:
|
||||
///
|
||||
friend class QBoxDialog;
|
||||
///
|
||||
QBox(Dialog &);
|
||||
/// add and remove special lengths
|
||||
void setSpecial(bool ibox);
|
||||
/// only show valid inner box items
|
||||
void setInnerType(bool frameless, int i);
|
||||
private:
|
||||
/// Apply changes
|
||||
virtual void apply();
|
||||
/// update
|
||||
virtual void update_contents();
|
||||
/// build the dialog
|
||||
virtual void build_dialog();
|
||||
///
|
||||
std::vector<std::string> ids_;
|
||||
///
|
||||
std::vector<std::string> gui_names_;
|
||||
///
|
||||
std::vector<std::string> ids_spec_;
|
||||
///
|
||||
std::vector<std::string> gui_names_spec_;
|
||||
};
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#endif // QBOX_H
|
@ -1,101 +0,0 @@
|
||||
/**
|
||||
* \file QBoxDialog.C
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Jürgen Spitzmüller
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "QBoxDialog.h"
|
||||
|
||||
#include "lengthcombo.h"
|
||||
#include "validators.h"
|
||||
#include "QBox.h"
|
||||
#include "qt_helpers.h"
|
||||
|
||||
#include <qcombobox.h>
|
||||
#include <qlineedit.h>
|
||||
#include <qpushbutton.h>
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
QBoxDialog::QBoxDialog(QBox * form)
|
||||
: QBoxDialogBase(0, 0, false, 0),
|
||||
form_(form)
|
||||
{
|
||||
connect(restorePB, SIGNAL(clicked()),
|
||||
form, SLOT(slotRestore()));
|
||||
connect(okPB, SIGNAL(clicked()),
|
||||
form, SLOT(slotOK()));
|
||||
connect(applyPB, SIGNAL(clicked()),
|
||||
form, SLOT(slotApply()));
|
||||
connect(closePB, SIGNAL(clicked()),
|
||||
form, SLOT(slotClose()));
|
||||
|
||||
heightED->setValidator(unsignedLengthValidator(heightED));
|
||||
widthED->setValidator(unsignedLengthValidator(widthED));
|
||||
}
|
||||
|
||||
|
||||
void QBoxDialog::closeEvent(QCloseEvent * e)
|
||||
{
|
||||
form_->slotWMHide();
|
||||
e->accept();
|
||||
}
|
||||
|
||||
|
||||
void QBoxDialog::change_adaptor()
|
||||
{
|
||||
form_->changed();
|
||||
}
|
||||
|
||||
|
||||
void QBoxDialog::innerBoxChanged(const QString & str)
|
||||
{
|
||||
bool ibox = (str != qt_("None"));
|
||||
valignCO->setEnabled(ibox);
|
||||
ialignCO->setEnabled(ibox);
|
||||
halignCO->setEnabled(!ibox);
|
||||
heightED->setEnabled(ibox);
|
||||
heightUnitsLC->setEnabled(ibox);
|
||||
form_->setSpecial(ibox);
|
||||
}
|
||||
|
||||
|
||||
void QBoxDialog::typeChanged(int index)
|
||||
{
|
||||
bool frameless = (index == 0);
|
||||
if (frameless) {
|
||||
valignCO->setEnabled(true);
|
||||
ialignCO->setEnabled(true);
|
||||
halignCO->setEnabled(false);
|
||||
heightED->setEnabled(true);
|
||||
heightUnitsLC->setEnabled(true);
|
||||
form_->setSpecial(true);
|
||||
}
|
||||
int itype = innerBoxCO->currentItem();
|
||||
form_->setInnerType(frameless, itype);
|
||||
}
|
||||
|
||||
|
||||
void QBoxDialog::restoreClicked()
|
||||
{
|
||||
form_->setInnerType(true, 2);
|
||||
widthED->setText("100");
|
||||
widthUnitsLC->setCurrentItem(LyXLength::PCW);
|
||||
heightED->setText("1");
|
||||
for (int j = 0; j < heightUnitsLC->count(); j++) {
|
||||
if (heightUnitsLC->text(j) == qt_("Total Height"))
|
||||
heightUnitsLC->setCurrentItem(j);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#include "QBoxDialog_moc.cpp"
|
@ -1,40 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file QBoxDialog.h
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Jürgen Spitzmüller
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#ifndef QBOXDIALOG_H
|
||||
#define QBOXDIALOG_H
|
||||
|
||||
#include "ui/QBoxDialogBase.h"
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
class QBox;
|
||||
|
||||
class QBoxDialog : public QBoxDialogBase {
|
||||
Q_OBJECT
|
||||
public:
|
||||
QBoxDialog(QBox * form);
|
||||
protected slots:
|
||||
virtual void change_adaptor();
|
||||
virtual void innerBoxChanged(const QString &);
|
||||
virtual void typeChanged(int);
|
||||
virtual void restoreClicked();
|
||||
protected:
|
||||
virtual void closeEvent(QCloseEvent * e);
|
||||
private:
|
||||
QBox * form_;
|
||||
};
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#endif // QBOXDIALOG_H
|
@ -1,80 +0,0 @@
|
||||
/**
|
||||
* \file QBranch.C
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Jürgen Spitzmüller
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "QBranch.h"
|
||||
#include "QBranchDialog.h"
|
||||
#include "Qt2BC.h"
|
||||
#include "qt_helpers.h"
|
||||
|
||||
#include "BranchList.h"
|
||||
|
||||
#include "controllers/ControlBranch.h"
|
||||
|
||||
#include "insets/insetbranch.h"
|
||||
|
||||
#include <qcombobox.h>
|
||||
#include <qpushbutton.h>
|
||||
|
||||
using std::string;
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
typedef QController<ControlBranch, QView<QBranchDialog> > base_class;
|
||||
|
||||
|
||||
QBranch::QBranch(Dialog & parent)
|
||||
: base_class(parent, _("Branch Settings"))
|
||||
{}
|
||||
|
||||
|
||||
void QBranch::build_dialog()
|
||||
{
|
||||
dialog_.reset(new QBranchDialog(this));
|
||||
|
||||
bcview().setOK(dialog_->okPB);
|
||||
bcview().setCancel(dialog_->closePB);
|
||||
}
|
||||
|
||||
|
||||
void QBranch::update_contents()
|
||||
{
|
||||
typedef BranchList::const_iterator const_iterator;
|
||||
|
||||
BranchList const & branchlist = controller().branchlist();
|
||||
string const cur_branch = controller().params().branch;
|
||||
|
||||
dialog_->branchCO->clear();
|
||||
|
||||
const_iterator const begin = branchlist.begin();
|
||||
const_iterator const end = branchlist.end();
|
||||
int id = 0;
|
||||
int count = 0;
|
||||
for (const_iterator it = begin; it != end; ++it, ++count) {
|
||||
string const & branch = it->getBranch();
|
||||
dialog_->branchCO->insertItem(toqstr(branch));
|
||||
|
||||
if (cur_branch == branch)
|
||||
id = count;
|
||||
}
|
||||
dialog_->branchCO->setCurrentItem(id);
|
||||
}
|
||||
|
||||
|
||||
void QBranch::apply()
|
||||
{
|
||||
string const type = fromqstr(dialog_->branchCO->currentText());
|
||||
controller().params().branch = type;
|
||||
}
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
@ -1,44 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file QBranch.h
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Jürgen Spitzmüller
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#ifndef QBRANCH_H
|
||||
#define QBRANCH_H
|
||||
|
||||
#include "QDialogView.h"
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
class ControlBranch;
|
||||
class QBranchDialog;
|
||||
|
||||
/** This class provides a QT implementation of the Branch Dialog.
|
||||
*/
|
||||
class QBranch : public QController<ControlBranch, QView<QBranchDialog> >
|
||||
{
|
||||
public:
|
||||
friend class QBranchDialog;
|
||||
|
||||
/// Constructor
|
||||
QBranch(Dialog &);
|
||||
private:
|
||||
/// Apply changes
|
||||
virtual void apply();
|
||||
/// Build the dialog
|
||||
virtual void build_dialog();
|
||||
/// Update dialog before showing it
|
||||
virtual void update_contents();
|
||||
};
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#endif // QBRANCH_H
|
@ -1,47 +0,0 @@
|
||||
/**
|
||||
* \file QBranchDialog.C
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Jürgen Spitzmüller
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "QBranchDialog.h"
|
||||
#include "QBranch.h"
|
||||
|
||||
#include <qpushbutton.h>
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
QBranchDialog::QBranchDialog(QBranch * form)
|
||||
: QBranchDialogBase(0, 0, false, 0),
|
||||
form_(form)
|
||||
{
|
||||
connect(okPB, SIGNAL(clicked()),
|
||||
form, SLOT(slotOK()));
|
||||
connect(closePB, SIGNAL(clicked()),
|
||||
form, SLOT(slotClose()));
|
||||
}
|
||||
|
||||
|
||||
void QBranchDialog::closeEvent(QCloseEvent * e)
|
||||
{
|
||||
form_->slotWMHide();
|
||||
e->accept();
|
||||
}
|
||||
|
||||
|
||||
void QBranchDialog::change_adaptor()
|
||||
{
|
||||
form_->changed();
|
||||
}
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#include "QBranchDialog_moc.cpp"
|
@ -1,37 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file QBranchDialog.h
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Jürgen Spitzmüller
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#ifndef QBRANCHDIALOG_H
|
||||
#define QBRANCHDIALOG_H
|
||||
|
||||
#include "ui/QBranchDialogBase.h"
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
class QBranch;
|
||||
|
||||
class QBranchDialog : public QBranchDialogBase {
|
||||
Q_OBJECT
|
||||
public:
|
||||
QBranchDialog(QBranch * form);
|
||||
protected slots:
|
||||
virtual void change_adaptor();
|
||||
protected:
|
||||
virtual void closeEvent(QCloseEvent * e);
|
||||
private:
|
||||
QBranch * form_;
|
||||
};
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#endif // QBRANCHDIALOG_H
|
@ -1,313 +0,0 @@
|
||||
/**
|
||||
* \file QBrowseBox.C
|
||||
*
|
||||
* Original file taken from klyx 0.10 sources:
|
||||
*
|
||||
* \author Kalle Dalheimer
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "QBrowseBox.h"
|
||||
|
||||
#include <qpixmap.h>
|
||||
#include <qpainter.h>
|
||||
#include <qapplication.h>
|
||||
#include <qdrawutil.h>
|
||||
#include <qstyle.h>
|
||||
|
||||
#include <cmath>
|
||||
|
||||
|
||||
QBrowseBox::QBrowseBox(int rows, int cols, QWidget* parent, const char * name, WFlags f)
|
||||
: QGridView(parent,name,f)
|
||||
{
|
||||
setNumRows(rows);
|
||||
setNumCols(cols);
|
||||
|
||||
pixmaps_ = new QPixmap[rows * cols];
|
||||
|
||||
activecell_.setX(-1);
|
||||
activecell_.setY(-1);
|
||||
|
||||
if (style().inherits("QWindowsStyle"))
|
||||
setFrameStyle(QFrame::WinPanel | QFrame::Raised);
|
||||
else
|
||||
setFrameStyle(QFrame::Panel | QFrame::Raised);
|
||||
|
||||
setVScrollBarMode(QScrollView::AlwaysOff);
|
||||
setHScrollBarMode(QScrollView::AlwaysOff);
|
||||
|
||||
viewport()->setFocusPolicy(QWidget::StrongFocus);
|
||||
// setMouseTracking must be called after setFocusPolicy
|
||||
viewport()->setMouseTracking(true);
|
||||
inloop=false;
|
||||
|
||||
}
|
||||
|
||||
|
||||
QBrowseBox::~QBrowseBox()
|
||||
{
|
||||
delete [] pixmaps_;
|
||||
}
|
||||
|
||||
|
||||
int QBrowseBox::coordsToIndex(int row, int col)
|
||||
{
|
||||
if (col < 0 || col > numCols() || row < 0 || row > numRows())
|
||||
qDebug("coordsToIndex: invalid coords (%d, %d)\n", row, col);
|
||||
return row + col * numCols();
|
||||
}
|
||||
|
||||
|
||||
void QBrowseBox::insertItem(QPixmap pixmap, int row, int col)
|
||||
{
|
||||
pixmaps_[coordsToIndex(row, col)] = pixmap;
|
||||
}
|
||||
|
||||
|
||||
void QBrowseBox::insertItem(QPixmap pixmap)
|
||||
{
|
||||
int w = pixmap.width() / numCols();
|
||||
int h = pixmap.height() / numRows();
|
||||
|
||||
for (int row = 0; row < numRows(); ++row) {
|
||||
for (int col = 0; col < numCols(); ++col) {
|
||||
QPixmap small(w,h);
|
||||
small.fill(backgroundColor());
|
||||
bitBlt(&small, 0, 0, &pixmap, col * w, row * h,
|
||||
w, h, Qt::CopyROP, false);
|
||||
insertItem(small, row, col);
|
||||
}
|
||||
}
|
||||
|
||||
setCellWidth(pixmap.width() / numCols());
|
||||
setCellHeight(pixmap.height() / numRows());
|
||||
setMinimumWidth(pixmap.width() + (numCols() + 1) * 1);
|
||||
setMinimumHeight(pixmap.height() + (numRows() + 1) * 1);
|
||||
resize(minimumSize());
|
||||
}
|
||||
|
||||
|
||||
QPixmap QBrowseBox::pixmap(int row, int col)
|
||||
{
|
||||
if (col < 0 || col >= numCols() || row < 0 || row >= numRows())
|
||||
return QPixmap();
|
||||
return pixmaps_[coordsToIndex(row, col)];
|
||||
}
|
||||
|
||||
|
||||
int QBrowseBox::exec(const QPoint & pos)
|
||||
{
|
||||
return exec(pos.x(),pos.y());
|
||||
}
|
||||
|
||||
|
||||
int QBrowseBox::exec(const QWidget * trigger)
|
||||
{
|
||||
QPoint globalpos = trigger->parentWidget()->mapToGlobal( trigger->pos());
|
||||
// is there enough space to put the box below the trigger?
|
||||
if ( globalpos.y() + trigger->height()+height()+1<
|
||||
QApplication::desktop()->height()) {
|
||||
// is there enough space to set the box left-justified with the trigger
|
||||
if (globalpos.x()+width()<QApplication::desktop()->width())
|
||||
return exec(globalpos.x(),
|
||||
globalpos.y()+trigger->height()+1);
|
||||
else
|
||||
return exec(globalpos.x()-width()-1,
|
||||
globalpos.y()+trigger->height()+1);
|
||||
} else {
|
||||
if (globalpos.x()+width()<QApplication::desktop()->width())
|
||||
return exec(globalpos.x(),
|
||||
globalpos.y()-height()-1);
|
||||
else
|
||||
return exec(globalpos.x()-width()-1,
|
||||
globalpos.y()-height()-1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int QBrowseBox::exec(int x,int y)
|
||||
{
|
||||
firstrelease_ = true;
|
||||
move(x,y);
|
||||
show();
|
||||
repaint();
|
||||
qApp->enter_loop();
|
||||
inloop = true;
|
||||
|
||||
if (activecell_.x()!=-1 && activecell_.y()!=-1 )
|
||||
return coordsToIndex( activecell_.x(),activecell_.y());
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
void QBrowseBox::keyPressEvent(QKeyEvent * e)
|
||||
{
|
||||
switch(e->key()) {
|
||||
case Key_Up:
|
||||
moveUp();
|
||||
break;
|
||||
case Key_Down:
|
||||
moveDown();
|
||||
break;
|
||||
case Key_Left:
|
||||
moveLeft();
|
||||
break;
|
||||
case Key_Right:
|
||||
moveRight();
|
||||
break;
|
||||
case Key_Return:
|
||||
// emit signal
|
||||
selected(activecell_.x(), activecell_.y());
|
||||
if ( isVisible() && parentWidget() &&
|
||||
parentWidget()->inherits("QPopupMenu") )
|
||||
parentWidget()->close();
|
||||
else
|
||||
close();
|
||||
break;
|
||||
case Key_Escape:
|
||||
if (inloop)
|
||||
qApp->exit_loop();
|
||||
if ( isVisible() && parentWidget() &&
|
||||
parentWidget()->inherits("QPopupMenu") )
|
||||
parentWidget()->close();
|
||||
default:
|
||||
e->ignore();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void QBrowseBox::contentsMouseReleaseEvent(QMouseEvent *)
|
||||
{
|
||||
|
||||
if (firstrelease_)
|
||||
firstrelease_ = false;
|
||||
else {
|
||||
selected( activecell_.x(), activecell_.y());
|
||||
if ( isVisible() && parentWidget() &&
|
||||
parentWidget()->inherits("QPopupMenu") )
|
||||
parentWidget()->close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void QBrowseBox::closeEvent(QCloseEvent * e)
|
||||
{
|
||||
e->accept();
|
||||
qApp->exit_loop();
|
||||
}
|
||||
|
||||
|
||||
void QBrowseBox::paintCell(QPainter * painter, int row, int col)
|
||||
{
|
||||
painter->setClipRect(cellGeometry(row, col));
|
||||
|
||||
int const index = coordsToIndex(row, col);
|
||||
|
||||
painter->drawPixmap(0, 0, pixmaps_[index]);
|
||||
|
||||
if (activecell_.x() == row && activecell_.y() == col) {
|
||||
qDrawShadeRect(painter, 0, 0, cellWidth(),
|
||||
cellHeight(), colorGroup(), false, 1);
|
||||
} else {
|
||||
qDrawPlainRect(painter, 0, 0, cellWidth(),
|
||||
cellHeight(), colorGroup().background(), 1);
|
||||
}
|
||||
|
||||
painter->setClipping(false);
|
||||
}
|
||||
|
||||
|
||||
void QBrowseBox::contentsMouseMoveEvent(QMouseEvent * e)
|
||||
{
|
||||
int x = e->pos().x();
|
||||
int y = e->pos().y();
|
||||
|
||||
int cellx;
|
||||
int celly;
|
||||
|
||||
if (x < 0 || y < 0 || x > width() || y > height()) {
|
||||
// outside the box
|
||||
cellx = -1;
|
||||
celly = -1;
|
||||
} else {
|
||||
celly = (int)floor( ((double)x) / ((double)cellWidth()) );
|
||||
cellx = (int)floor( ((double)y) / ((double)cellHeight()) );
|
||||
}
|
||||
|
||||
if (activecell_.x() != cellx || activecell_.y() != celly) {
|
||||
// mouse has been moved to another cell
|
||||
int oldactivecellx = activecell_.x();
|
||||
int oldactivecelly = activecell_.y();
|
||||
activecell_.setX(cellx);
|
||||
activecell_.setY(celly);
|
||||
// remove old highlighting
|
||||
updateCell(oldactivecellx, oldactivecelly);
|
||||
// set new highlighting
|
||||
updateCell(activecell_.x(), activecell_.y());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void QBrowseBox::moveLeft()
|
||||
{
|
||||
int const y = activecell_.y();
|
||||
|
||||
if (y>0)
|
||||
activecell_.setY(y - 1);
|
||||
else if (parentWidget())
|
||||
QWidget::focusNextPrevChild(false);
|
||||
|
||||
updateCell(activecell_.x(), y);
|
||||
updateCell(activecell_.x(), activecell_.y());
|
||||
}
|
||||
|
||||
|
||||
void QBrowseBox::moveRight()
|
||||
{
|
||||
int const y = activecell_.y();
|
||||
|
||||
if (y < numCols() - 1)
|
||||
activecell_.setY(y+1);
|
||||
|
||||
updateCell(activecell_.x(), y);
|
||||
updateCell(activecell_.x(), activecell_.y());
|
||||
}
|
||||
|
||||
|
||||
void QBrowseBox::moveUp()
|
||||
{
|
||||
int const x = activecell_.x();
|
||||
|
||||
if (x > 0)
|
||||
activecell_.setX(x - 1);
|
||||
else if (parentWidget())
|
||||
QWidget::focusNextPrevChild(false);
|
||||
|
||||
updateCell(x, activecell_.y());
|
||||
updateCell(activecell_.x(), activecell_.y());
|
||||
}
|
||||
|
||||
|
||||
void QBrowseBox::moveDown()
|
||||
{
|
||||
int const x = activecell_.x();
|
||||
|
||||
if (x < numRows() - 1)
|
||||
activecell_.setX(x + 1);
|
||||
|
||||
updateCell(x, activecell_.y());
|
||||
updateCell(activecell_.x(), activecell_.y());
|
||||
}
|
||||
|
||||
#include "QBrowseBox_moc.cpp"
|
||||
|
||||
|
||||
namespace lyx {
|
||||
|
||||
|
||||
} // namespace lyx
|
@ -1,73 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file QBrowseBox.h
|
||||
*
|
||||
* Original file taken from klyx 0.10 sources:
|
||||
*
|
||||
* \author Kalle Dalheimer
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#ifndef QBROWSEBOX_H
|
||||
#define QBROWSEBOX_H
|
||||
|
||||
#include <qgridview.h>
|
||||
|
||||
|
||||
namespace lyx {
|
||||
|
||||
|
||||
class QString;
|
||||
class QPainter;
|
||||
class QPixmap;
|
||||
|
||||
|
||||
class QBrowseBox : public QGridView
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QBrowseBox(int rows, int cols, QWidget * parent = 0, const char * name = 0, WFlags f = 0);
|
||||
~QBrowseBox();
|
||||
|
||||
void insertItem(QPixmap pixmap);
|
||||
|
||||
QPixmap pixmap(int row, int col);
|
||||
|
||||
int exec(const QPoint & pos);
|
||||
int exec(int x, int y);
|
||||
int exec(const QWidget * trigger);
|
||||
|
||||
signals:
|
||||
void selected(int, int);
|
||||
|
||||
protected:
|
||||
virtual void keyPressEvent(QKeyEvent * e);
|
||||
virtual void contentsMouseReleaseEvent(QMouseEvent *);
|
||||
virtual void closeEvent(QCloseEvent * e);
|
||||
virtual void contentsMouseMoveEvent(QMouseEvent * e);
|
||||
virtual void paintCell(QPainter *, int row, int col);
|
||||
|
||||
private:
|
||||
// make sure the automatically generated one is not used
|
||||
QBrowseBox & operator=(QBrowseBox const &);
|
||||
|
||||
void moveLeft();
|
||||
void moveRight();
|
||||
void moveUp();
|
||||
void moveDown();
|
||||
|
||||
void insertItem(QPixmap pixmap, int row, int col);
|
||||
|
||||
int coordsToIndex(int row, int col);
|
||||
|
||||
QPixmap* pixmaps_;
|
||||
QPoint activecell_;
|
||||
bool firstrelease_;
|
||||
bool inloop;
|
||||
|
||||
|
||||
|
||||
} // namespace lyx
|
||||
};
|
||||
#endif
|
@ -1,85 +0,0 @@
|
||||
/**
|
||||
* \file QChanges.C
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author John Levon
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "QChanges.h"
|
||||
#include "QChangesDialog.h"
|
||||
#include "Qt2BC.h"
|
||||
#include "qt_helpers.h"
|
||||
|
||||
#include "support/lstrings.h"
|
||||
|
||||
#include "controllers/ControlChanges.h"
|
||||
|
||||
#include <qpushbutton.h>
|
||||
#include <qtextview.h>
|
||||
|
||||
using lyx::support::bformat;
|
||||
|
||||
using std::string;
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
typedef QController<ControlChanges, QView<QChangesDialog> > base_class;
|
||||
|
||||
|
||||
QChanges::QChanges(Dialog & parent)
|
||||
: base_class(parent, _("Merge Changes"))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void QChanges::build_dialog()
|
||||
{
|
||||
dialog_.reset(new QChangesDialog(this));
|
||||
|
||||
bcview().setCancel(dialog_->closePB);
|
||||
bcview().addReadOnly(dialog_->acceptPB);
|
||||
bcview().addReadOnly(dialog_->rejectPB);
|
||||
}
|
||||
|
||||
|
||||
void QChanges::update_contents()
|
||||
{
|
||||
docstring text;
|
||||
docstring author = controller().getChangeAuthor();
|
||||
docstring date = controller().getChangeDate();
|
||||
|
||||
if (!author.empty())
|
||||
text += bformat(_("Change by %1$s\n\n"), author);
|
||||
if (!date.empty())
|
||||
text += bformat(_("Change made at %1$s\n"), date);
|
||||
|
||||
dialog_->changeTV->setText(toqstr(text));
|
||||
}
|
||||
|
||||
|
||||
void QChanges::next()
|
||||
{
|
||||
controller().find();
|
||||
update_contents();
|
||||
}
|
||||
|
||||
|
||||
void QChanges::accept()
|
||||
{
|
||||
controller().accept();
|
||||
}
|
||||
|
||||
|
||||
void QChanges::reject()
|
||||
{
|
||||
controller().reject();
|
||||
}
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
@ -1,49 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file QChanges.h
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author John Levon
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#ifndef QCHANGES_H
|
||||
#define QCHANGES_H
|
||||
|
||||
#include "QDialogView.h"
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
class ControlChanges;
|
||||
class QChangesDialog;
|
||||
|
||||
class QChanges
|
||||
: public QController<ControlChanges, QView<QChangesDialog> >
|
||||
{
|
||||
public:
|
||||
friend class QChangesDialog;
|
||||
|
||||
QChanges(Dialog &);
|
||||
|
||||
void accept();
|
||||
|
||||
void reject();
|
||||
|
||||
void next();
|
||||
|
||||
private:
|
||||
/// Apply changes
|
||||
virtual void apply() {};
|
||||
/// update
|
||||
virtual void update_contents();
|
||||
/// build the dialog
|
||||
virtual void build_dialog();
|
||||
};
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#endif // QCHANGES_H
|
@ -1,58 +0,0 @@
|
||||
/**
|
||||
* \file QChangesDialog.C
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author John Levon
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "QChangesDialog.h"
|
||||
#include "QChanges.h"
|
||||
|
||||
#include <qpushbutton.h>
|
||||
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
QChangesDialog::QChangesDialog(QChanges * form)
|
||||
: QChangesDialogBase(0, 0, false, 0),
|
||||
form_(form)
|
||||
{
|
||||
connect(closePB, SIGNAL(clicked()),
|
||||
form, SLOT(slotClose()));
|
||||
}
|
||||
|
||||
|
||||
void QChangesDialog::nextPressed()
|
||||
{
|
||||
form_->next();
|
||||
}
|
||||
|
||||
|
||||
void QChangesDialog::acceptPressed()
|
||||
{
|
||||
form_->accept();
|
||||
}
|
||||
|
||||
|
||||
void QChangesDialog::rejectPressed()
|
||||
{
|
||||
form_->reject();
|
||||
}
|
||||
|
||||
|
||||
void QChangesDialog::closeEvent(QCloseEvent *e)
|
||||
{
|
||||
form_->slotWMHide();
|
||||
e->accept();
|
||||
}
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#include "QChangesDialog_moc.cpp"
|
@ -1,43 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file QChangesDialog.h
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author John Levon
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#ifndef QCHANGESDIALOG_H
|
||||
#define QCHANGESDIALOG_H
|
||||
|
||||
#include "ui/QChangesDialogBase.h"
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
class QChanges;
|
||||
|
||||
class QChangesDialog : public QChangesDialogBase {
|
||||
Q_OBJECT
|
||||
public:
|
||||
QChangesDialog(QChanges * form);
|
||||
|
||||
protected slots:
|
||||
|
||||
virtual void nextPressed();
|
||||
virtual void acceptPressed();
|
||||
virtual void rejectPressed();
|
||||
|
||||
protected:
|
||||
virtual void closeEvent(QCloseEvent * e);
|
||||
|
||||
private:
|
||||
QChanges * form_;
|
||||
};
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#endif // QCHANGESDIALOG_H
|
@ -1,151 +0,0 @@
|
||||
/**
|
||||
* \file QCharacter.C
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Edwin Leuven
|
||||
* \author John Levon
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "QCharacter.h"
|
||||
#include "ControlCharacter.h"
|
||||
#include "QCharacterDialog.h"
|
||||
#include "Qt2BC.h"
|
||||
#include "qt_helpers.h"
|
||||
|
||||
#include "LColor.h"
|
||||
|
||||
#include <qpushbutton.h>
|
||||
#include <qcheckbox.h>
|
||||
#include <qcombobox.h>
|
||||
|
||||
using std::vector;
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
typedef QController<ControlCharacter, QView<QCharacterDialog> > base_class;
|
||||
|
||||
|
||||
QCharacter::QCharacter(Dialog & parent)
|
||||
: base_class(parent, _("Text Style"))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void QCharacter::build_dialog()
|
||||
{
|
||||
dialog_.reset(new QCharacterDialog(this));
|
||||
|
||||
family = getFamilyData();
|
||||
series = getSeriesData();
|
||||
shape = getShapeData();
|
||||
size = getSizeData();
|
||||
bar = getBarData();
|
||||
color = getColorData();
|
||||
language = getLanguageData(true);
|
||||
|
||||
for (vector<FamilyPair>::const_iterator cit = family.begin();
|
||||
cit != family.end(); ++cit) {
|
||||
dialog_->familyCO->insertItem(toqstr(cit->first), -1);
|
||||
}
|
||||
|
||||
for (vector<SeriesPair>::const_iterator cit = series.begin();
|
||||
cit != series.end(); ++cit) {
|
||||
dialog_->seriesCO->insertItem(toqstr(cit->first), -1);
|
||||
}
|
||||
for (vector<ShapePair>::const_iterator cit = shape.begin();
|
||||
cit != shape.end(); ++cit) {
|
||||
dialog_->shapeCO->insertItem(toqstr(cit->first), -1);
|
||||
}
|
||||
for (vector<SizePair>::const_iterator cit = size.begin();
|
||||
cit != size.end(); ++cit) {
|
||||
dialog_->sizeCO->insertItem(toqstr(cit->first), -1);
|
||||
}
|
||||
for (vector<BarPair>::const_iterator cit = bar.begin();
|
||||
cit != bar.end(); ++cit) {
|
||||
dialog_->miscCO->insertItem(toqstr(cit->first), -1);
|
||||
}
|
||||
for (vector<ColorPair>::const_iterator cit = color.begin();
|
||||
cit != color.end(); ++cit) {
|
||||
dialog_->colorCO->insertItem(toqstr(cit->first), -1);
|
||||
}
|
||||
for (vector<LanguagePair>::const_iterator cit = language.begin();
|
||||
cit != language.end(); ++cit) {
|
||||
dialog_->langCO->insertItem(toqstr(cit->first), -1);
|
||||
}
|
||||
|
||||
bcview().setOK(dialog_->okPB);
|
||||
bcview().setApply(dialog_->applyPB);
|
||||
bcview().setCancel(dialog_->closePB);
|
||||
bcview().addReadOnly(dialog_->familyCO);
|
||||
bcview().addReadOnly(dialog_->seriesCO);
|
||||
bcview().addReadOnly(dialog_->sizeCO);
|
||||
bcview().addReadOnly(dialog_->shapeCO);
|
||||
bcview().addReadOnly(dialog_->miscCO);
|
||||
bcview().addReadOnly(dialog_->langCO);
|
||||
bcview().addReadOnly(dialog_->colorCO);
|
||||
bcview().addReadOnly(dialog_->toggleallCB);
|
||||
bcview().addReadOnly(dialog_->autoapplyCB);
|
||||
}
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
template<class A, class B>
|
||||
int findPos2nd(vector<std::pair<A,B> > const & vec, B const & val)
|
||||
{
|
||||
typedef typename vector<std::pair<A, B> >::const_iterator
|
||||
const_iterator;
|
||||
|
||||
const_iterator cit = vec.begin();
|
||||
for (; cit != vec.end(); ++cit) {
|
||||
if (cit->second == val)
|
||||
return int(cit - vec.begin());
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
} // namespace anon
|
||||
|
||||
|
||||
void QCharacter::update_contents()
|
||||
{
|
||||
ControlCharacter const & ctrl = controller();
|
||||
|
||||
dialog_->familyCO->setCurrentItem(findPos2nd(family,
|
||||
ctrl.getFamily()));
|
||||
dialog_->seriesCO->setCurrentItem(findPos2nd(series,
|
||||
ctrl.getSeries()));
|
||||
dialog_->shapeCO->setCurrentItem(findPos2nd(shape, ctrl.getShape()));
|
||||
dialog_->sizeCO->setCurrentItem(findPos2nd(size, ctrl.getSize()));
|
||||
dialog_->miscCO->setCurrentItem(findPos2nd(bar, ctrl.getBar()));
|
||||
dialog_->colorCO->setCurrentItem(findPos2nd(color, ctrl.getColor()));
|
||||
dialog_->langCO->setCurrentItem(findPos2nd(language,
|
||||
ctrl.getLanguage()));
|
||||
|
||||
dialog_->toggleallCB->setChecked(ctrl.getToggleAll());
|
||||
}
|
||||
|
||||
|
||||
void QCharacter::apply()
|
||||
{
|
||||
ControlCharacter & ctrl = controller();
|
||||
|
||||
ctrl.setFamily(family[dialog_->familyCO->currentItem()].second);
|
||||
ctrl.setSeries(series[dialog_->seriesCO->currentItem()].second);
|
||||
ctrl.setShape(shape[dialog_->shapeCO->currentItem()].second);
|
||||
ctrl.setSize(size[dialog_->sizeCO->currentItem()].second);
|
||||
ctrl.setBar(bar[dialog_->miscCO->currentItem()].second);
|
||||
ctrl.setColor(color[dialog_->colorCO->currentItem()].second);
|
||||
ctrl.setLanguage(language[dialog_->langCO->currentItem()].second);
|
||||
|
||||
ctrl.setToggleAll(dialog_->toggleallCB->isChecked());
|
||||
}
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
@ -1,56 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file QCharacter.h
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Edwin Leuven
|
||||
* \author John Levon
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#ifndef QCHARACTER_H
|
||||
#define QCHARACTER_H
|
||||
|
||||
#include "QDialogView.h"
|
||||
#include "controllers/character.h"
|
||||
#include "controllers/frnt_lang.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
class ControlCharacter;
|
||||
class QCharacterDialog;
|
||||
|
||||
|
||||
class QCharacter
|
||||
: public QController<ControlCharacter, QView<QCharacterDialog> >
|
||||
{
|
||||
public:
|
||||
friend class QCharacterDialog;
|
||||
|
||||
QCharacter(Dialog &);
|
||||
private:
|
||||
/// Apply changes
|
||||
virtual void apply();
|
||||
/// update
|
||||
virtual void update_contents();
|
||||
/// build the dialog
|
||||
virtual void build_dialog();
|
||||
|
||||
std::vector<FamilyPair> family;
|
||||
std::vector<SeriesPair> series;
|
||||
std::vector<ShapePair> shape;
|
||||
std::vector<SizePair> size;
|
||||
std::vector<BarPair> bar;
|
||||
std::vector<ColorPair> color;
|
||||
std::vector<LanguagePair> language;
|
||||
};
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#endif // QCHARACTER_H
|
@ -1,66 +0,0 @@
|
||||
/**
|
||||
* \file QCharacterDialog.C
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Edwin Leuven
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "QCharacterDialog.h"
|
||||
|
||||
#include <qcheckbox.h>
|
||||
#include <qcombobox.h>
|
||||
#include <qpushbutton.h>
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
QCharacterDialog::QCharacterDialog(QCharacter * form)
|
||||
: QCharacterDialogBase(0, 0, false, 0),
|
||||
form_(form)
|
||||
{
|
||||
connect(okPB, SIGNAL(clicked()),
|
||||
form_, SLOT(slotOK()));
|
||||
connect(applyPB, SIGNAL(clicked()),
|
||||
form_, SLOT(slotApply()));
|
||||
connect(closePB, SIGNAL(clicked()),
|
||||
form_, SLOT(slotClose()));
|
||||
}
|
||||
|
||||
|
||||
void QCharacterDialog::change_adaptor()
|
||||
{
|
||||
form_->changed();
|
||||
|
||||
if (!autoapplyCB->isChecked())
|
||||
return;
|
||||
|
||||
// to be really good here, we should set the combos to the values of
|
||||
// the current text, and make it appear as "no change" if the values
|
||||
// stay the same between applys. Might be difficult though wrt to a
|
||||
// moved cursor - jbl
|
||||
form_->slotApply();
|
||||
familyCO->setCurrentItem(0);
|
||||
seriesCO->setCurrentItem(0);
|
||||
sizeCO->setCurrentItem(0);
|
||||
shapeCO->setCurrentItem(0);
|
||||
miscCO->setCurrentItem(0);
|
||||
langCO->setCurrentItem(0);
|
||||
colorCO->setCurrentItem(0);
|
||||
}
|
||||
|
||||
|
||||
void QCharacterDialog::closeEvent(QCloseEvent * e)
|
||||
{
|
||||
form_->slotWMHide();
|
||||
e->accept();
|
||||
}
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#include "QCharacterDialog_moc.cpp"
|
@ -1,39 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file QCharacterDialog.h
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Edwin Leuven
|
||||
* \author John Levon
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#ifndef QCHARACTERDIALOG_H
|
||||
#define QCHARACTERDIALOG_H
|
||||
|
||||
#include "QCharacter.h"
|
||||
#include "ui/QCharacterDialogBase.h"
|
||||
|
||||
class LyXFont;
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
class QCharacterDialog : public QCharacterDialogBase {
|
||||
Q_OBJECT
|
||||
public:
|
||||
QCharacterDialog(QCharacter * form);
|
||||
protected:
|
||||
void closeEvent(QCloseEvent * e);
|
||||
private:
|
||||
QCharacter * form_;
|
||||
protected slots:
|
||||
void change_adaptor();
|
||||
};
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#endif // QCHARACTERDIALOG_H
|
@ -1,243 +0,0 @@
|
||||
/**
|
||||
* \file QCitation.C
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Angus Leeming
|
||||
* \author Kalle Dalheimer
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "QCitation.h"
|
||||
#include "QCitationDialog.h"
|
||||
#include "ui/QCitationFindDialogBase.h"
|
||||
#include "Qt2BC.h"
|
||||
#include "qt_helpers.h"
|
||||
|
||||
#include "bufferparams.h"
|
||||
|
||||
#include "controllers/ButtonController.h"
|
||||
#include "controllers/ControlCitation.h"
|
||||
|
||||
#include "support/lstrings.h"
|
||||
|
||||
#include <qcheckbox.h>
|
||||
#include <qcombobox.h>
|
||||
#include <qlineedit.h>
|
||||
#include <qlistbox.h>
|
||||
#include <qmultilineedit.h>
|
||||
#include <qpushbutton.h>
|
||||
#include <qlabel.h>
|
||||
|
||||
using std::find;
|
||||
using std::string;
|
||||
using std::vector;
|
||||
|
||||
namespace lyx {
|
||||
|
||||
using support::getStringFromVector;
|
||||
using support::getVectorFromString;
|
||||
using support::trim;
|
||||
|
||||
namespace frontend {
|
||||
|
||||
typedef QController<ControlCitation, QView<QCitationDialog> > base_class;
|
||||
|
||||
QCitation::QCitation(Dialog & parent)
|
||||
: base_class(parent, _("Citation"))
|
||||
{}
|
||||
|
||||
|
||||
void QCitation::apply()
|
||||
{
|
||||
vector<biblio::CiteStyle> const & styles =
|
||||
ControlCitation::getCiteStyles();
|
||||
|
||||
int const choice = dialog_->citationStyleCO->currentItem();
|
||||
bool const full = dialog_->fulllistCB->isChecked();
|
||||
bool const force = dialog_->forceuppercaseCB->isChecked();
|
||||
|
||||
string const command =
|
||||
biblio::CitationStyle(styles[choice], full, force)
|
||||
.asLatexStr();
|
||||
|
||||
controller().params().setCmdName(command);
|
||||
controller().params().setContents(getStringFromVector(citekeys));
|
||||
|
||||
string const before = fromqstr(dialog_->textBeforeED->text());
|
||||
controller().params().setSecOptions(before);
|
||||
|
||||
string const after = fromqstr(dialog_->textAfterED->text());
|
||||
controller().params().setOptions(after);
|
||||
|
||||
style_ = choice;
|
||||
open_find_ = false;
|
||||
}
|
||||
|
||||
|
||||
void QCitation::hide()
|
||||
{
|
||||
citekeys.clear();
|
||||
bibkeys.clear();
|
||||
open_find_ = true;
|
||||
|
||||
QDialogView::hide();
|
||||
}
|
||||
|
||||
|
||||
void QCitation::build_dialog()
|
||||
{
|
||||
dialog_.reset(new QCitationDialog(this));
|
||||
|
||||
// Manage the ok, apply, restore and cancel/close buttons
|
||||
bcview().setOK(dialog_->okPB);
|
||||
bcview().setApply(dialog_->applyPB);
|
||||
bcview().setCancel(dialog_->closePB);
|
||||
bcview().setRestore(dialog_->restorePB);
|
||||
|
||||
bcview().addReadOnly(dialog_->addPB);
|
||||
bcview().addReadOnly(dialog_->deletePB);
|
||||
bcview().addReadOnly(dialog_->upPB);
|
||||
bcview().addReadOnly(dialog_->downPB);
|
||||
bcview().addReadOnly(dialog_->citationStyleCO);
|
||||
bcview().addReadOnly(dialog_->forceuppercaseCB);
|
||||
bcview().addReadOnly(dialog_->fulllistCB);
|
||||
bcview().addReadOnly(dialog_->textBeforeED);
|
||||
bcview().addReadOnly(dialog_->textAfterED);
|
||||
|
||||
open_find_ = true;
|
||||
}
|
||||
|
||||
|
||||
void QCitation::fillStyles()
|
||||
{
|
||||
if (citekeys.empty()) {
|
||||
dialog_->citationStyleCO->setEnabled(false);
|
||||
dialog_->citationStyleLA->setEnabled(false);
|
||||
return;
|
||||
}
|
||||
|
||||
int const orig = dialog_->citationStyleCO->currentItem();
|
||||
|
||||
dialog_->citationStyleCO->clear();
|
||||
|
||||
int curr = dialog_->selectedLB->currentItem();
|
||||
if (curr < 0)
|
||||
curr = 0;
|
||||
|
||||
string key = citekeys[curr];
|
||||
|
||||
vector<string> const & sty = controller().getCiteStrings(key);
|
||||
|
||||
biblio::CiteEngine const engine = controller().getEngine();
|
||||
bool const basic_engine = engine == biblio::ENGINE_BASIC;
|
||||
|
||||
dialog_->citationStyleCO->setEnabled(!sty.empty() && !basic_engine);
|
||||
dialog_->citationStyleLA->setEnabled(!sty.empty() && !basic_engine);
|
||||
|
||||
for (vector<string>::const_iterator it = sty.begin();
|
||||
it != sty.end(); ++it) {
|
||||
dialog_->citationStyleCO->insertItem(toqstr(*it));
|
||||
}
|
||||
|
||||
if (orig != -1 && orig < dialog_->citationStyleCO->count())
|
||||
dialog_->citationStyleCO->setCurrentItem(orig);
|
||||
}
|
||||
|
||||
|
||||
void QCitation::updateStyle()
|
||||
{
|
||||
biblio::CiteEngine const engine = controller().getEngine();
|
||||
bool const natbib_engine =
|
||||
engine == biblio::ENGINE_NATBIB_AUTHORYEAR ||
|
||||
engine == biblio::ENGINE_NATBIB_NUMERICAL;
|
||||
bool const basic_engine = engine == biblio::ENGINE_BASIC;
|
||||
|
||||
dialog_->fulllistCB->setEnabled(natbib_engine);
|
||||
dialog_->forceuppercaseCB->setEnabled(natbib_engine);
|
||||
dialog_->textBeforeED->setEnabled(!basic_engine);
|
||||
|
||||
string const & command = controller().params().getCmdName();
|
||||
|
||||
// Find the style of the citekeys
|
||||
vector<biblio::CiteStyle> const & styles =
|
||||
ControlCitation::getCiteStyles();
|
||||
biblio::CitationStyle const cs(command);
|
||||
|
||||
vector<biblio::CiteStyle>::const_iterator cit =
|
||||
find(styles.begin(), styles.end(), cs.style);
|
||||
|
||||
// restore the latest natbib style
|
||||
if (style_ >= 0 && style_ < dialog_->citationStyleCO->count())
|
||||
dialog_->citationStyleCO->setCurrentItem(style_);
|
||||
else
|
||||
dialog_->citationStyleCO->setCurrentItem(0);
|
||||
dialog_->fulllistCB->setChecked(false);
|
||||
dialog_->forceuppercaseCB->setChecked(false);
|
||||
|
||||
if (cit != styles.end()) {
|
||||
int const i = int(cit - styles.begin());
|
||||
dialog_->citationStyleCO->setCurrentItem(i);
|
||||
dialog_->fulllistCB->setChecked(cs.full);
|
||||
dialog_->forceuppercaseCB->setChecked(cs.forceUCase);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void QCitation::update_contents()
|
||||
{
|
||||
// Make the list of all available bibliography keys
|
||||
bibkeys = biblio::getKeys(controller().bibkeysInfo());
|
||||
updateBrowser(dialog_->add_->availableLB, bibkeys);
|
||||
|
||||
// Ditto for the keys cited in this inset
|
||||
citekeys = getVectorFromString(controller().params().getContents());
|
||||
updateBrowser(dialog_->selectedLB, citekeys);
|
||||
|
||||
// No keys have been selected yet, so...
|
||||
dialog_->infoML->clear();
|
||||
dialog_->setButtons();
|
||||
|
||||
dialog_->textBeforeED->setText(
|
||||
toqstr(controller().params().getSecOptions()));
|
||||
dialog_->textAfterED->setText(
|
||||
toqstr(controller().params().getOptions()));
|
||||
|
||||
fillStyles();
|
||||
updateStyle();
|
||||
|
||||
// open the find dialog if nothing has been selected (yet)
|
||||
// the bool prevents that this is also done after "apply"
|
||||
if (open_find_)
|
||||
dialog_->openFind();
|
||||
|
||||
bc().valid(isValid());
|
||||
}
|
||||
|
||||
|
||||
void QCitation::updateBrowser(QListBox * browser,
|
||||
vector<string> const & keys) const
|
||||
{
|
||||
browser->clear();
|
||||
|
||||
for (vector<string>::const_iterator it = keys.begin();
|
||||
it < keys.end(); ++it) {
|
||||
string const key = trim(*it);
|
||||
// FIXME: why the .empty() test ?
|
||||
if (!key.empty())
|
||||
browser->insertItem(toqstr(key));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool QCitation::isValid()
|
||||
{
|
||||
return dialog_->selectedLB->count() > 0;
|
||||
}
|
||||
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
@ -1,68 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file QCitation.h
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Angus Leeming
|
||||
* \author Kalle Dalheimer
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#ifndef QCITATION_H
|
||||
#define QCITATION_H
|
||||
|
||||
#include "QDialogView.h"
|
||||
#include <vector>
|
||||
|
||||
class QListBox;
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
class ControlCitation;
|
||||
class QCitationDialog;
|
||||
|
||||
|
||||
class QCitation : public QController<ControlCitation, QView<QCitationDialog> >
|
||||
{
|
||||
public:
|
||||
friend class QCitationDialog;
|
||||
///
|
||||
QCitation(Dialog &);
|
||||
protected:
|
||||
virtual bool isValid();
|
||||
private:
|
||||
|
||||
/// Set the Params variable for the Controller.
|
||||
virtual void apply();
|
||||
/// Build the dialog.
|
||||
virtual void build_dialog();
|
||||
/// Hide the dialog.
|
||||
virtual void hide();
|
||||
/// Update dialog before/whilst showing it.
|
||||
virtual void update_contents();
|
||||
|
||||
/// fill the styles combo
|
||||
void fillStyles();
|
||||
|
||||
/// set the styles combo
|
||||
void updateStyle();
|
||||
|
||||
void updateBrowser(QListBox *, std::vector<std::string> const &) const;
|
||||
/// check if apply has been pressed
|
||||
bool open_find_;
|
||||
|
||||
/// selected keys
|
||||
std::vector<std::string> citekeys;
|
||||
/// available bib keys
|
||||
std::vector<std::string> bibkeys;
|
||||
/// selected natbib style
|
||||
int style_;
|
||||
};
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#endif // QCITATION_H
|
@ -1,297 +0,0 @@
|
||||
/**
|
||||
* \file QCitationDialog.C
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Kalle Dalheimer
|
||||
* \author John Levon
|
||||
* \author Jürgen Spitzmüller
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "QCitationDialog.h"
|
||||
#include "ui/QCitationFindDialogBase.h"
|
||||
#include "QCitation.h"
|
||||
#include "qt_helpers.h"
|
||||
|
||||
#include "controllers/ControlCitation.h"
|
||||
#include "controllers/ButtonController.h"
|
||||
|
||||
#include <qcheckbox.h>
|
||||
#include <qlineedit.h>
|
||||
#include <qlistbox.h>
|
||||
#include <qmultilineedit.h>
|
||||
#include <qpushbutton.h>
|
||||
|
||||
|
||||
using std::vector;
|
||||
using std::string;
|
||||
using std::swap;
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
QCitationDialog::QCitationDialog(QCitation * form)
|
||||
: QCitationDialogBase(0, 0, false, 0),
|
||||
form_(form)
|
||||
{
|
||||
connect(restorePB, SIGNAL(clicked()),
|
||||
form, SLOT(slotRestore()));
|
||||
connect(okPB, SIGNAL(clicked()),
|
||||
form, SLOT(slotOK()));
|
||||
connect(applyPB, SIGNAL(clicked()),
|
||||
form, SLOT(slotApply()));
|
||||
connect(closePB, SIGNAL(clicked()),
|
||||
form, SLOT(slotClose()));
|
||||
|
||||
add_ = new QCitationFindDialogBase(this, "", true);
|
||||
add_->setCaption(qt_("LyX: Add Citation"));
|
||||
|
||||
connect(add_->previousPB, SIGNAL(clicked()), this, SLOT(previous()));
|
||||
connect(add_->nextPB, SIGNAL(clicked()), this, SLOT(next()));
|
||||
connect(add_->availableLB, SIGNAL(currentChanged(QListBoxItem *)), this, SLOT(availableChanged()));
|
||||
connect(add_->availableLB, SIGNAL(selected(QListBoxItem *)), this, SLOT(addCitation()));
|
||||
connect(add_->availableLB, SIGNAL(selected(QListBoxItem *)), add_, SLOT(accept()));
|
||||
connect(add_->addPB, SIGNAL(clicked()), this, SLOT(addCitation()));
|
||||
connect(selectedLB, SIGNAL(returnPressed(QListBoxItem *)), form, SLOT(slotOK()));
|
||||
}
|
||||
|
||||
|
||||
QCitationDialog::~QCitationDialog()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void QCitationDialog::setButtons()
|
||||
{
|
||||
if (form_->readOnly())
|
||||
return;
|
||||
|
||||
int const sel_nr = selectedLB->currentItem();
|
||||
int const avail_nr = add_->availableLB->currentItem();
|
||||
|
||||
add_->addPB->setEnabled(avail_nr >= 0);
|
||||
deletePB->setEnabled(sel_nr >= 0);
|
||||
upPB->setEnabled(sel_nr > 0);
|
||||
downPB->setEnabled(sel_nr >= 0 && sel_nr < int(selectedLB->count() - 1));
|
||||
}
|
||||
|
||||
|
||||
void QCitationDialog::openFind()
|
||||
{
|
||||
if (form_->readOnly())
|
||||
return;
|
||||
|
||||
if (isVisible() && selectedLB->count() == 0
|
||||
&& add_->availableLB->count() != 0){
|
||||
// open the find dialog
|
||||
add();
|
||||
// and let the user press ok after a selection
|
||||
if (selectedLB->count() != 0)
|
||||
form_->bc().valid();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void QCitationDialog::selectedChanged()
|
||||
{
|
||||
form_->fillStyles();
|
||||
biblio::InfoMap const & theMap = form_->controller().bibkeysInfo();
|
||||
infoML->clear();
|
||||
|
||||
int const sel = selectedLB->currentItem();
|
||||
if (sel < 0) {
|
||||
setButtons();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!theMap.empty())
|
||||
infoML->setText(
|
||||
toqstr(biblio::getInfo(theMap, form_->citekeys[sel])));
|
||||
setButtons();
|
||||
}
|
||||
|
||||
|
||||
void QCitationDialog::previous()
|
||||
{
|
||||
find(biblio::BACKWARD);
|
||||
}
|
||||
|
||||
|
||||
void QCitationDialog::next()
|
||||
{
|
||||
find(biblio::FORWARD);
|
||||
}
|
||||
|
||||
|
||||
void QCitationDialog::availableChanged()
|
||||
{
|
||||
biblio::InfoMap const & theMap = form_->controller().bibkeysInfo();
|
||||
add_->infoML->clear();
|
||||
|
||||
int const sel = add_->availableLB->currentItem();
|
||||
if (sel < 0) {
|
||||
setButtons();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!theMap.empty())
|
||||
add_->infoML->setText(
|
||||
toqstr(biblio::getInfo(theMap, form_->bibkeys[sel])));
|
||||
setButtons();
|
||||
}
|
||||
|
||||
|
||||
void QCitationDialog::addCitation()
|
||||
{
|
||||
int const sel = add_->availableLB->currentItem();
|
||||
|
||||
if (sel < 0)
|
||||
return;
|
||||
|
||||
// Add the selected browser_bib keys to browser_cite
|
||||
// multiple selections are possible
|
||||
for (unsigned int i = 0; i != add_->availableLB->count(); i++) {
|
||||
if (add_->availableLB->isSelected(i)) {
|
||||
// do not allow duplicates
|
||||
if ((selectedLB->findItem(add_->availableLB->text(i))) == 0) {
|
||||
selectedLB->insertItem(toqstr(form_->bibkeys[i]));
|
||||
form_->citekeys.push_back(form_->bibkeys[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int const n = int(form_->citekeys.size());
|
||||
selectedLB->setSelected(n - 1, true);
|
||||
|
||||
form_->changed();
|
||||
form_->fillStyles();
|
||||
setButtons();
|
||||
}
|
||||
|
||||
|
||||
void QCitationDialog::del()
|
||||
{
|
||||
int const sel = selectedLB->currentItem();
|
||||
|
||||
// Remove the selected key from browser_cite
|
||||
selectedLB->removeItem(sel);
|
||||
form_->citekeys.erase(form_->citekeys.begin() + sel);
|
||||
|
||||
form_->changed();
|
||||
form_->fillStyles();
|
||||
setButtons();
|
||||
}
|
||||
|
||||
|
||||
void QCitationDialog::up()
|
||||
{
|
||||
int const sel = selectedLB->currentItem();
|
||||
|
||||
BOOST_ASSERT(sel > 0);
|
||||
|
||||
// Move the selected key up one line
|
||||
string const tmp = form_->citekeys[sel];
|
||||
|
||||
selectedLB->removeItem(sel);
|
||||
swap(form_->citekeys[sel - 1], form_->citekeys[sel]);
|
||||
|
||||
selectedLB->insertItem(toqstr(tmp), sel - 1);
|
||||
selectedLB->setSelected(sel - 1, true);
|
||||
|
||||
form_->changed();
|
||||
form_->fillStyles();
|
||||
setButtons();
|
||||
}
|
||||
|
||||
|
||||
void QCitationDialog::down()
|
||||
{
|
||||
int const sel = selectedLB->currentItem();
|
||||
|
||||
BOOST_ASSERT(sel < (int)form_->citekeys.size());
|
||||
|
||||
// Move the selected key down one line
|
||||
string const tmp = form_->citekeys[sel];
|
||||
|
||||
selectedLB->removeItem(sel);
|
||||
swap(form_->citekeys[sel + 1], form_->citekeys[sel]);
|
||||
|
||||
selectedLB->insertItem(toqstr(tmp), sel + 1);
|
||||
selectedLB->setSelected(sel + 1, true);
|
||||
|
||||
form_->changed();
|
||||
form_->fillStyles();
|
||||
setButtons();
|
||||
}
|
||||
|
||||
|
||||
void QCitationDialog::add()
|
||||
{
|
||||
add_->exec();
|
||||
}
|
||||
|
||||
|
||||
void QCitationDialog::changed_adaptor()
|
||||
{
|
||||
form_->changed();
|
||||
}
|
||||
|
||||
|
||||
void QCitationDialog::find(biblio::Direction dir)
|
||||
{
|
||||
biblio::InfoMap const & theMap = form_->controller().bibkeysInfo();
|
||||
|
||||
biblio::Search const type = add_->searchTypeCB->isChecked()
|
||||
? biblio::REGEX : biblio::SIMPLE;
|
||||
|
||||
vector<string>::const_iterator start = form_->bibkeys.begin();
|
||||
int const sel = add_->availableLB->currentItem();
|
||||
if (sel >= 0 && sel <= int(form_->bibkeys.size()-1))
|
||||
start += sel;
|
||||
|
||||
// Find the NEXT instance...
|
||||
if (dir == biblio::FORWARD)
|
||||
start += 1;
|
||||
|
||||
bool const casesens = add_->searchCaseCB->isChecked();
|
||||
string const str = fromqstr(add_->searchED->text());
|
||||
|
||||
vector<string>::const_iterator cit =
|
||||
biblio::searchKeys(theMap, form_->bibkeys, str,
|
||||
start, type, dir, casesens);
|
||||
|
||||
// not found. let's loop round
|
||||
if (cit == form_->bibkeys.end()) {
|
||||
if (dir == biblio::FORWARD) {
|
||||
start = form_->bibkeys.begin();
|
||||
}
|
||||
else start = form_->bibkeys.end() - 1;
|
||||
|
||||
cit = biblio::searchKeys(theMap, form_->bibkeys, str,
|
||||
start, type, dir, casesens);
|
||||
|
||||
if (cit == form_->bibkeys.end())
|
||||
return;
|
||||
}
|
||||
|
||||
int const found = int(cit - form_->bibkeys.begin());
|
||||
if (found == sel) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Update the display
|
||||
// note that we have multi selection mode!
|
||||
add_->availableLB->setSelected(sel, false);
|
||||
add_->availableLB->setSelected(found, true);
|
||||
add_->availableLB->setCurrentItem(found);
|
||||
add_->availableLB->ensureCurrentVisible();
|
||||
}
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#include "QCitationDialog_moc.cpp"
|
@ -1,61 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file QCitationDialog.h
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Kalle Dalheimer
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#ifndef QCITATIONDIALOG_H
|
||||
#define QCITATIONDIALOG_H
|
||||
|
||||
#include "ui/QCitationDialogBase.h"
|
||||
#include "controllers/biblio.h"
|
||||
|
||||
class QCitationFindDialogBase;
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
class QCitation;
|
||||
|
||||
class QCitationDialog : public QCitationDialogBase {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QCitationDialog(QCitation * form);
|
||||
|
||||
~QCitationDialog();
|
||||
|
||||
void setButtons();
|
||||
/// open the find dialog if nothing selected
|
||||
void openFind();
|
||||
|
||||
QCitationFindDialogBase * add_;
|
||||
|
||||
protected slots:
|
||||
|
||||
virtual void availableChanged();
|
||||
virtual void selectedChanged();
|
||||
virtual void up();
|
||||
virtual void down();
|
||||
virtual void del();
|
||||
virtual void addCitation();
|
||||
virtual void add();
|
||||
virtual void previous();
|
||||
virtual void next();
|
||||
virtual void changed_adaptor();
|
||||
|
||||
private:
|
||||
void find(biblio::Direction dir);
|
||||
|
||||
QCitation * form_;
|
||||
};
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#endif // QCITATIOINDIALOG_H
|
@ -1,229 +0,0 @@
|
||||
/**
|
||||
* \file QCommandBuffer.C
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author John Levon
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
// Qt defines a macro 'signals' that clashes with a boost namespace.
|
||||
// All is well if the namespace is visible first.
|
||||
#include "QtView.h"
|
||||
|
||||
#include "QCommandBuffer.h"
|
||||
#include "QCommandEdit.h"
|
||||
#include "qt_helpers.h"
|
||||
|
||||
#include "controllers/ControlCommandBuffer.h"
|
||||
|
||||
#include "support/filetools.h"
|
||||
|
||||
#include <qlistbox.h>
|
||||
#include <qlayout.h>
|
||||
#include <qtooltip.h>
|
||||
#include <qpushbutton.h>
|
||||
|
||||
using lyx::support::libFileSearch;
|
||||
|
||||
using std::vector;
|
||||
using std::string;
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
namespace {
|
||||
|
||||
class QTempListBox : public QListBox {
|
||||
public:
|
||||
QTempListBox()
|
||||
: QListBox(0, 0,
|
||||
WType_Modal | WType_Popup | WDestructiveClose) {
|
||||
setHScrollBarMode(AlwaysOff);
|
||||
}
|
||||
protected:
|
||||
void mouseReleaseEvent(QMouseEvent * e) {
|
||||
if (e->x() < 0 || e->y() < 0
|
||||
|| e->x() > width() || e->y() > height()) {
|
||||
hide();
|
||||
} else {
|
||||
// emit signal
|
||||
selected(currentText());
|
||||
}
|
||||
}
|
||||
|
||||
void keyPressEvent(QKeyEvent * e) {
|
||||
if (e->key() == Key_Escape) {
|
||||
hide();
|
||||
return;
|
||||
}
|
||||
QListBox::keyPressEvent(e);
|
||||
}
|
||||
};
|
||||
|
||||
} // end of anon
|
||||
|
||||
|
||||
QCommandBuffer::QCommandBuffer(QtView * view, QWidget * parent, ControlCommandBuffer & control)
|
||||
: QWidget(parent), view_(view), controller_(control)
|
||||
{
|
||||
QPixmap qpup(toqstr(libFileSearch("images", "up", "xpm")));
|
||||
QPixmap qpdown(toqstr(libFileSearch("images", "down", "xpm")));
|
||||
|
||||
QVBoxLayout * top = new QVBoxLayout(this);
|
||||
QHBoxLayout * layout = new QHBoxLayout(0);
|
||||
|
||||
QPushButton * up = new QPushButton(qpup, "", this);
|
||||
QToolTip::add(up, qt_("Previous command"));
|
||||
connect(up, SIGNAL(clicked()), this, SLOT(up()));
|
||||
QPushButton * down = new QPushButton(qpdown, "", this);
|
||||
QToolTip::add(down, qt_("Next command"));
|
||||
connect(down, SIGNAL(clicked()), this, SLOT(down()));
|
||||
|
||||
edit_ = new QCommandEdit(this);
|
||||
edit_->setMinimumSize(edit_->sizeHint());
|
||||
edit_->setFocusPolicy(ClickFocus);
|
||||
|
||||
connect(edit_, SIGNAL(escapePressed()), this, SLOT(cancel()));
|
||||
connect(edit_, SIGNAL(returnPressed()), this, SLOT(dispatch()));
|
||||
connect(edit_, SIGNAL(tabPressed()), this, SLOT(complete()));
|
||||
connect(edit_, SIGNAL(upPressed()), this, SLOT(up()));
|
||||
connect(edit_, SIGNAL(downPressed()), this, SLOT(down()));
|
||||
|
||||
layout->addWidget(up, 0);
|
||||
layout->addWidget(down, 0);
|
||||
layout->addWidget(edit_, 10);
|
||||
top->addLayout(layout);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void QCommandBuffer::focus_command()
|
||||
{
|
||||
edit_->setFocus();
|
||||
}
|
||||
|
||||
|
||||
void QCommandBuffer::cancel()
|
||||
{
|
||||
view_->centralWidget()->setFocus();
|
||||
edit_->setText("");
|
||||
}
|
||||
|
||||
|
||||
void QCommandBuffer::dispatch()
|
||||
{
|
||||
controller_.dispatch(fromqstr(edit_->text()));
|
||||
view_->centralWidget()->setFocus();
|
||||
edit_->setText("");
|
||||
edit_->clearFocus();
|
||||
}
|
||||
|
||||
|
||||
void QCommandBuffer::complete()
|
||||
{
|
||||
string const input = fromqstr(edit_->text());
|
||||
string new_input;
|
||||
vector<string> comp = controller_.completions(input, new_input);
|
||||
|
||||
if (comp.empty() && new_input == input) {
|
||||
// show_info_suffix(qt_("[no match]"), input);
|
||||
return;
|
||||
}
|
||||
|
||||
if (comp.empty()) {
|
||||
edit_->setText(toqstr(new_input));
|
||||
// show_info_suffix(("[only completion]"), new_input + ' ');
|
||||
return;
|
||||
}
|
||||
|
||||
edit_->setText(toqstr(new_input));
|
||||
|
||||
QTempListBox * list = new QTempListBox;
|
||||
|
||||
// For some reason the scrollview's contents are larger
|
||||
// than the number of actual items...
|
||||
vector<string>::const_iterator cit = comp.begin();
|
||||
vector<string>::const_iterator end = comp.end();
|
||||
for (; cit != end; ++cit) {
|
||||
list->insertItem(toqstr(*cit));
|
||||
}
|
||||
|
||||
// width() is not big enough by a few pixels. Qt Sucks.
|
||||
list->setMinimumWidth(list->sizeHint().width() + 10);
|
||||
|
||||
list->resize(list->sizeHint());
|
||||
QPoint pos(edit_->mapToGlobal(QPoint(0, 0)));
|
||||
|
||||
int y = std::max(0, pos.y() - list->height());
|
||||
|
||||
list->move(pos.x(), y);
|
||||
|
||||
connect(list, SIGNAL(selected(const QString &)),
|
||||
this, SLOT(complete_selected(const QString &)));
|
||||
|
||||
list->show();
|
||||
list->setFocus();
|
||||
}
|
||||
|
||||
|
||||
void QCommandBuffer::complete_selected(QString const & str)
|
||||
{
|
||||
QWidget const * widget = static_cast<QWidget const *>(sender());
|
||||
const_cast<QWidget *>(widget)->hide();
|
||||
edit_->setText(str + ' ');
|
||||
edit_->setFocus();
|
||||
}
|
||||
|
||||
|
||||
void QCommandBuffer::up()
|
||||
{
|
||||
string const input(fromqstr(edit_->text()));
|
||||
string const h(controller_.historyUp());
|
||||
|
||||
if (h.empty()) {
|
||||
// show_info_suffix(qt_("[Beginning of history]"), input);
|
||||
} else {
|
||||
edit_->setText(toqstr(h));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void QCommandBuffer::down()
|
||||
{
|
||||
string const input(fromqstr(edit_->text()));
|
||||
string const h(controller_.historyDown());
|
||||
|
||||
if (h.empty()) {
|
||||
// show_info_suffix(qt_("[End of history]"), input);
|
||||
} else {
|
||||
edit_->setText(toqstr(h));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
void XMiniBuffer::show_info_suffix(string const & suffix, string const & input)
|
||||
{
|
||||
stored_input_ = input;
|
||||
info_suffix_shown_ = true;
|
||||
set_input(input + ' ' + suffix);
|
||||
suffix_timer_->start();
|
||||
}
|
||||
|
||||
|
||||
void XMiniBuffer::suffix_timeout()
|
||||
{
|
||||
info_suffix_shown_ = false;
|
||||
set_input(stored_input_);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#include "QCommandBuffer_moc.cpp"
|
@ -1,60 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file QCommandBuffer.h
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author John Levon
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#ifndef QCOMMANDBUFFER_H
|
||||
#define QCOMMANDBUFFER_H
|
||||
|
||||
#include <qwidget.h>
|
||||
|
||||
class QListBoxItem;
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
class QCommandEdit;
|
||||
class QtView;
|
||||
class ControlCommandBuffer;
|
||||
|
||||
class QCommandBuffer : public QWidget {
|
||||
Q_OBJECT
|
||||
public:
|
||||
QCommandBuffer(QtView * view, QWidget * parent, ControlCommandBuffer & control);
|
||||
|
||||
/// focus the edit widget
|
||||
void focus_command();
|
||||
public slots:
|
||||
/// cancel command compose
|
||||
void cancel();
|
||||
/// dispatch a command
|
||||
void dispatch();
|
||||
/// tab-complete
|
||||
void complete();
|
||||
/// select-complete
|
||||
void complete_selected(QString const & str);
|
||||
/// up
|
||||
void up();
|
||||
/// down
|
||||
void down();
|
||||
private:
|
||||
/// owning view
|
||||
QtView * view_;
|
||||
|
||||
/// controller
|
||||
ControlCommandBuffer & controller_;
|
||||
|
||||
/// command widget
|
||||
QCommandEdit * edit_;
|
||||
};
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#endif // QCOMMANDBUFFER_H
|
@ -1,68 +0,0 @@
|
||||
/**
|
||||
* \file QCommandEdit.C
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author John Levon
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "QCommandEdit.h"
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
QCommandEdit::QCommandEdit(QWidget * parent)
|
||||
: QLineEdit(parent)
|
||||
{
|
||||
setFocusPolicy(QWidget::ClickFocus);
|
||||
}
|
||||
|
||||
|
||||
void QCommandEdit::keyPressEvent(QKeyEvent * e)
|
||||
{
|
||||
switch (e->key()) {
|
||||
case Key_Escape:
|
||||
// emit signal
|
||||
escapePressed();
|
||||
break;
|
||||
|
||||
case Key_Up:
|
||||
// emit signal
|
||||
upPressed();
|
||||
break;
|
||||
|
||||
case Key_Down:
|
||||
// emit signal
|
||||
downPressed();
|
||||
break;
|
||||
|
||||
default:
|
||||
QLineEdit::keyPressEvent(e);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool QCommandEdit::event(QEvent * e)
|
||||
{
|
||||
if (e->type() != QEvent::KeyPress)
|
||||
return QLineEdit::event(e);
|
||||
|
||||
QKeyEvent * ev = (QKeyEvent *)e;
|
||||
|
||||
if (ev->key() != Key_Tab)
|
||||
return QLineEdit::event(e);
|
||||
|
||||
// emit signal
|
||||
tabPressed();
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#include "QCommandEdit_moc.cpp"
|
@ -1,46 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file QCommandEdit.h
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author John Levon
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#ifndef QCOMMANDEDIT_H
|
||||
#define QCOMMANDEDIT_H
|
||||
|
||||
#include <qlineedit.h>
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
class QCommandEdit : public QLineEdit {
|
||||
Q_OBJECT
|
||||
public:
|
||||
QCommandEdit(QWidget * parent);
|
||||
signals:
|
||||
/// cancel
|
||||
void escapePressed();
|
||||
|
||||
/// up history
|
||||
void upPressed();
|
||||
|
||||
/// down history
|
||||
void downPressed();
|
||||
|
||||
/// complete
|
||||
void tabPressed();
|
||||
|
||||
protected:
|
||||
virtual bool event(QEvent * e);
|
||||
|
||||
virtual void keyPressEvent(QKeyEvent * e);
|
||||
};
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#endif // QCOMMANDEDIT_H
|
@ -1,369 +0,0 @@
|
||||
/**
|
||||
* \file QContentPane.C
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author John Levon
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "BufferView.h"
|
||||
#include "frontends/LyXView.h"
|
||||
#include "frontends/WorkArea.h"
|
||||
|
||||
// Qt defines a macro 'signals' that clashes with a boost namespace.
|
||||
// All is well if the namespace is visible first.
|
||||
#include "QWorkArea.h"
|
||||
|
||||
#include "QContentPane.h"
|
||||
#include "QLyXKeySym.h"
|
||||
|
||||
#include <qapplication.h>
|
||||
#include <qpainter.h>
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
namespace {
|
||||
|
||||
/// return the LyX key state from Qt's
|
||||
key_modifier::state q_key_state(Qt::ButtonState state)
|
||||
{
|
||||
key_modifier::state k = key_modifier::none;
|
||||
if (state & Qt::ControlButton)
|
||||
k |= key_modifier::ctrl;
|
||||
if (state & Qt::ShiftButton)
|
||||
k |= key_modifier::shift;
|
||||
if (state & Qt::AltButton || state & Qt::MetaButton)
|
||||
k |= key_modifier::alt;
|
||||
return k;
|
||||
}
|
||||
|
||||
|
||||
/// return the LyX mouse button state from Qt's
|
||||
mouse_button::state q_button_state(Qt::ButtonState button)
|
||||
{
|
||||
mouse_button::state b = mouse_button::none;
|
||||
switch (button) {
|
||||
case Qt::LeftButton:
|
||||
b = mouse_button::button1;
|
||||
break;
|
||||
case Qt::MidButton:
|
||||
b = mouse_button::button2;
|
||||
break;
|
||||
case Qt::RightButton:
|
||||
b = mouse_button::button3;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return b;
|
||||
}
|
||||
|
||||
|
||||
/// return the LyX mouse button state from Qt's
|
||||
mouse_button::state q_motion_state(Qt::ButtonState state)
|
||||
{
|
||||
mouse_button::state b = mouse_button::none;
|
||||
if (state & Qt::LeftButton)
|
||||
b |= mouse_button::button1;
|
||||
if (state & Qt::MidButton)
|
||||
b |= mouse_button::button2;
|
||||
if (state & Qt::RightButton)
|
||||
b |= mouse_button::button3;
|
||||
return b;
|
||||
}
|
||||
|
||||
} // namespace anon
|
||||
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
// This is a 'heartbeat' generating synthetic mouse move events when the
|
||||
// cursor is at the top or bottom edge of the viewport. One scroll per 0.2 s
|
||||
SyntheticMouseEvent::SyntheticMouseEvent()
|
||||
: timeout(200), restart_timeout(true),
|
||||
x_old(-1), y_old(-1), scrollbar_value_old(-1.0)
|
||||
{}
|
||||
|
||||
|
||||
QContentPane::QContentPane(QWorkArea * parent)
|
||||
: QWidget(parent, "content_pane", WRepaintNoErase),
|
||||
track_scrollbar_(true), wa_(parent)
|
||||
{
|
||||
synthetic_mouse_event_.timeout.timeout.connect(
|
||||
boost::bind(&QContentPane::generateSyntheticMouseEvent,
|
||||
this));
|
||||
|
||||
connect(&step_timer_, SIGNAL(timeout()), SLOT(keyeventTimeout()));
|
||||
|
||||
setFocusPolicy(QWidget::WheelFocus);
|
||||
setFocus();
|
||||
setCursor(ibeamCursor);
|
||||
#if USE_INPUT_METHODS
|
||||
// to make qt-immodule work
|
||||
setInputMethodEnabled(true);
|
||||
#endif
|
||||
|
||||
// stupid moc strikes again
|
||||
connect(wa_->scrollbar_, SIGNAL(valueChanged(int)),
|
||||
this, SLOT(scrollBarChanged(int)));
|
||||
|
||||
// Start the timer, one-shot.
|
||||
step_timer_.start(50, true);
|
||||
}
|
||||
|
||||
|
||||
#if USE_INPUT_METHODS
|
||||
// to make qt-immodule work
|
||||
void QContentPane::imStartEvent(QIMEvent *e)
|
||||
{
|
||||
e->accept();
|
||||
}
|
||||
|
||||
|
||||
void QContentPane::imComposeEvent(QIMEvent *e)
|
||||
{
|
||||
e->accept();
|
||||
}
|
||||
|
||||
|
||||
void QContentPane::imEndEvent(QIMEvent *e)
|
||||
{
|
||||
QString const text = e->text();
|
||||
if (!text.isEmpty()) {
|
||||
int key = 0;
|
||||
// needed to make math superscript work on some systems
|
||||
// ideally, such special coding should not be necessary
|
||||
if (text == "^")
|
||||
key = Qt::Key_AsciiCircum;
|
||||
QKeyEvent ev(QEvent::KeyPress, key, *text.ascii(), 0, text);
|
||||
keyPressEvent(&ev);
|
||||
}
|
||||
e->accept();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
void QContentPane::generateSyntheticMouseEvent()
|
||||
{
|
||||
// Set things off to generate the _next_ 'pseudo' event.
|
||||
if (synthetic_mouse_event_.restart_timeout)
|
||||
synthetic_mouse_event_.timeout.start();
|
||||
|
||||
// Has anything changed on-screen since the last timeout signal
|
||||
// was received?
|
||||
double const scrollbar_value = wa_->scrollbar_->value();
|
||||
if (scrollbar_value != synthetic_mouse_event_.scrollbar_value_old) {
|
||||
// Yes it has. Store the params used to check this.
|
||||
synthetic_mouse_event_.scrollbar_value_old = scrollbar_value;
|
||||
|
||||
// ... and dispatch the event to the LyX core.
|
||||
wa_->view().workArea()->dispatch(synthetic_mouse_event_.cmd);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void QContentPane::scrollBarChanged(int val)
|
||||
{
|
||||
if (track_scrollbar_)
|
||||
wa_->view().workArea()->scrollBufferView(val);
|
||||
}
|
||||
|
||||
|
||||
void QContentPane::mousePressEvent(QMouseEvent * e)
|
||||
{
|
||||
if (dc_event_.active && dc_event_ == *e) {
|
||||
dc_event_.active = false;
|
||||
FuncRequest cmd(LFUN_MOUSE_TRIPLE,
|
||||
dc_event_.x, dc_event_.y,
|
||||
q_button_state(dc_event_.state));
|
||||
wa_->view().workArea()->dispatch(cmd);
|
||||
return;
|
||||
}
|
||||
|
||||
FuncRequest const cmd(LFUN_MOUSE_PRESS, e->x(), e->y(),
|
||||
q_button_state(e->button()));
|
||||
wa_->view().workArea()->dispatch(cmd);
|
||||
}
|
||||
|
||||
|
||||
void QContentPane::mouseReleaseEvent(QMouseEvent * e)
|
||||
{
|
||||
if (synthetic_mouse_event_.timeout.running())
|
||||
synthetic_mouse_event_.timeout.stop();
|
||||
|
||||
FuncRequest const cmd(LFUN_MOUSE_RELEASE, e->x(), e->y(),
|
||||
q_button_state(e->button()));
|
||||
wa_->view().workArea()->dispatch(cmd);
|
||||
}
|
||||
|
||||
|
||||
void QContentPane::mouseMoveEvent(QMouseEvent * e)
|
||||
{
|
||||
FuncRequest cmd(LFUN_MOUSE_MOTION, e->x(), e->y(),
|
||||
q_motion_state(e->state()));
|
||||
|
||||
// If we're above or below the work area...
|
||||
if (e->y() <= 20 || e->y() >= height() - 20) {
|
||||
// Make sure only a synthetic event can cause a page scroll,
|
||||
// so they come at a steady rate:
|
||||
if (e->y() <= 20)
|
||||
// _Force_ a scroll up:
|
||||
cmd.y = -40;
|
||||
else
|
||||
cmd.y = height();
|
||||
// Store the event, to be handled when the timeout expires.
|
||||
synthetic_mouse_event_.cmd = cmd;
|
||||
|
||||
if (synthetic_mouse_event_.timeout.running())
|
||||
// Discard the event. Note that it _may_ be handled
|
||||
// when the timeout expires if
|
||||
// synthetic_mouse_event_.cmd has not been overwritten.
|
||||
// Ie, when the timeout expires, we handle the
|
||||
// most recent event but discard all others that
|
||||
// occurred after the one used to start the timeout
|
||||
// in the first place.
|
||||
return;
|
||||
else {
|
||||
synthetic_mouse_event_.restart_timeout = true;
|
||||
synthetic_mouse_event_.timeout.start();
|
||||
// Fall through to handle this event...
|
||||
}
|
||||
|
||||
} else if (synthetic_mouse_event_.timeout.running()) {
|
||||
// Store the event, to be possibly handled when the timeout
|
||||
// expires.
|
||||
// Once the timeout has expired, normal control is returned
|
||||
// to mouseMoveEvent (restart_timeout = false).
|
||||
// This results in a much smoother 'feel' when moving the
|
||||
// mouse back into the work area.
|
||||
synthetic_mouse_event_.cmd = cmd;
|
||||
synthetic_mouse_event_.restart_timeout = false;
|
||||
return;
|
||||
}
|
||||
|
||||
// Has anything changed on-screen since the last QMouseEvent
|
||||
// was received?
|
||||
double const scrollbar_value = wa_->scrollbar_->value();
|
||||
if (e->x() != synthetic_mouse_event_.x_old ||
|
||||
e->y() != synthetic_mouse_event_.y_old ||
|
||||
scrollbar_value != synthetic_mouse_event_.scrollbar_value_old) {
|
||||
// Yes it has. Store the params used to check this.
|
||||
synthetic_mouse_event_.x_old = e->x();
|
||||
synthetic_mouse_event_.y_old = e->y();
|
||||
synthetic_mouse_event_.scrollbar_value_old = scrollbar_value;
|
||||
|
||||
// ... and dispatch the event to the LyX core.
|
||||
wa_->view().workArea()->dispatch(cmd);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void QContentPane::wheelEvent(QWheelEvent * e)
|
||||
{
|
||||
// Wheel rotation by one notch results in a delta() of 120 (see
|
||||
// documentation of QWheelEvent)
|
||||
int const lines = QApplication::wheelScrollLines() * e->delta() / 120;
|
||||
wa_->scrollbar_->setValue(wa_->scrollbar_->value() -
|
||||
lines * wa_->scrollbar_->lineStep());
|
||||
}
|
||||
|
||||
|
||||
void QContentPane::keyPressEvent(QKeyEvent * e)
|
||||
{
|
||||
keyeventQueue_.push(boost::shared_ptr<QKeyEvent>(new QKeyEvent(*e)));
|
||||
}
|
||||
|
||||
|
||||
void QContentPane::keyeventTimeout()
|
||||
{
|
||||
bool handle_autos = true;
|
||||
|
||||
while (!keyeventQueue_.empty()) {
|
||||
boost::shared_ptr<QKeyEvent> ev = keyeventQueue_.front();
|
||||
|
||||
// We never handle more than one auto repeated
|
||||
// char in a list of queued up events.
|
||||
if (!handle_autos && ev->isAutoRepeat()) {
|
||||
keyeventQueue_.pop();
|
||||
continue;
|
||||
}
|
||||
|
||||
boost::shared_ptr<QLyXKeySym> sym(new QLyXKeySym);
|
||||
sym->set(ev.get());
|
||||
|
||||
wa_->view().workArea()->processKeySym(sym, q_key_state(ev->state()));
|
||||
keyeventQueue_.pop();
|
||||
|
||||
handle_autos = false;
|
||||
}
|
||||
|
||||
// Restart the timer.
|
||||
step_timer_.start(25, true);
|
||||
}
|
||||
|
||||
|
||||
void QContentPane::doubleClickTimeout()
|
||||
{
|
||||
if (!dc_event_.active)
|
||||
return;
|
||||
|
||||
dc_event_.active = false;
|
||||
|
||||
FuncRequest cmd(LFUN_MOUSE_DOUBLE,
|
||||
dc_event_.x, dc_event_.y,
|
||||
q_button_state(dc_event_.state));
|
||||
wa_->view().workArea()->dispatch(cmd);
|
||||
}
|
||||
|
||||
|
||||
void QContentPane::mouseDoubleClickEvent(QMouseEvent * e)
|
||||
{
|
||||
dc_event_ = double_click(e);
|
||||
|
||||
// doubleClickInterval() is just too long.
|
||||
QTimer::singleShot(int(QApplication::doubleClickInterval() / 1.5),
|
||||
this, SLOT(doubleClickTimeout()));
|
||||
}
|
||||
|
||||
|
||||
void QContentPane::resizeEvent(QResizeEvent *)
|
||||
{
|
||||
if (!pixmap_.get()) {
|
||||
pixmap_.reset(new QPixmap(width(), height()));
|
||||
}
|
||||
|
||||
pixmap_->resize(width(), height());
|
||||
wa_->view().workArea()->resizeBufferView();
|
||||
}
|
||||
|
||||
|
||||
void QContentPane::paintEvent(QPaintEvent * e)
|
||||
{
|
||||
if (!pixmap_.get()) {
|
||||
pixmap_.reset(new QPixmap(width(), height()));
|
||||
wa_->view().workArea()->resizeBufferView();
|
||||
return;
|
||||
}
|
||||
|
||||
QRect r(e->rect());
|
||||
|
||||
QPainter q(this);
|
||||
q.drawPixmap(QPoint(r.x(), r.y()),
|
||||
*pixmap_.get(), r);
|
||||
}
|
||||
|
||||
|
||||
void QContentPane::trackScrollbar(bool track_on)
|
||||
{
|
||||
track_scrollbar_ = track_on;
|
||||
}
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#include "QContentPane_moc.cpp"
|
@ -1,151 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file QContentPane.h
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author John Levon
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#ifndef QCONTENTPANE_H
|
||||
#define QCONTENTPANE_H
|
||||
|
||||
#include "funcrequest.h"
|
||||
#ifdef emit
|
||||
#undef emit
|
||||
#include "frontends/Timeout.h"
|
||||
#define emit
|
||||
#else
|
||||
#include "frontends/Timeout.h"
|
||||
#endif
|
||||
|
||||
#include <qwidget.h>
|
||||
#include <qpixmap.h>
|
||||
#include <qtimer.h>
|
||||
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
|
||||
#include <queue>
|
||||
|
||||
#if (defined(Q_WS_X11) && QT_VERSION >= 0x030200)
|
||||
#define USE_INPUT_METHODS 1
|
||||
#endif
|
||||
|
||||
|
||||
/// for emulating triple click
|
||||
class double_click {
|
||||
public:
|
||||
int x;
|
||||
int y;
|
||||
Qt::ButtonState state;
|
||||
bool active;
|
||||
|
||||
bool operator==(QMouseEvent const & e) {
|
||||
return x == e.x() && y == e.y()
|
||||
&& state == e.button();
|
||||
}
|
||||
|
||||
double_click()
|
||||
: x(0), y(0), state(Qt::NoButton), active(false) {}
|
||||
|
||||
double_click(QMouseEvent * e)
|
||||
: x(e->x()), y(e->y()),
|
||||
state(e->button()), active(true) {}
|
||||
};
|
||||
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
class QWorkArea;
|
||||
|
||||
/** Qt only emits mouse events when the mouse is being moved, but
|
||||
* we want to generate 'pseudo' mouse events when the mouse button is
|
||||
* pressed and the mouse cursor is below the bottom, or above the top
|
||||
* of the work area. In this way, we'll be able to continue scrolling
|
||||
* (and selecting) the text.
|
||||
*
|
||||
* This class stores all the parameters needed to make this happen.
|
||||
*/
|
||||
class SyntheticMouseEvent
|
||||
{
|
||||
public:
|
||||
SyntheticMouseEvent();
|
||||
|
||||
FuncRequest cmd;
|
||||
Timeout timeout;
|
||||
bool restart_timeout;
|
||||
int x_old;
|
||||
int y_old;
|
||||
double scrollbar_value_old;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Widget for actually drawing the document on
|
||||
*/
|
||||
class QContentPane : public QWidget {
|
||||
Q_OBJECT
|
||||
public:
|
||||
QContentPane(QWorkArea * parent);
|
||||
|
||||
/// return the backing pixmap
|
||||
QPixmap * pixmap() const { return pixmap_.get(); }
|
||||
/// track scrollbar signals?
|
||||
void trackScrollbar(bool track_on);
|
||||
|
||||
protected:
|
||||
/// repaint part of the widget
|
||||
void paintEvent(QPaintEvent * e);
|
||||
/// widget has been resized
|
||||
void resizeEvent(QResizeEvent * e);
|
||||
|
||||
/// mouse button press
|
||||
void mousePressEvent(QMouseEvent * e);
|
||||
/// mouse button release
|
||||
void mouseReleaseEvent(QMouseEvent * e);
|
||||
/// mouse double click of button
|
||||
void mouseDoubleClickEvent(QMouseEvent * e);
|
||||
/// mouse motion
|
||||
void mouseMoveEvent(QMouseEvent * e);
|
||||
/// wheel event
|
||||
void wheelEvent(QWheelEvent * e);
|
||||
/// key press
|
||||
void keyPressEvent(QKeyEvent * e);
|
||||
#if USE_INPUT_METHODS
|
||||
/// IM events
|
||||
void imStartEvent(QIMEvent *);
|
||||
void imComposeEvent(QIMEvent *);
|
||||
void imEndEvent(QIMEvent *);
|
||||
#endif
|
||||
public slots:
|
||||
void doubleClickTimeout();
|
||||
|
||||
void scrollBarChanged(int);
|
||||
void keyeventTimeout();
|
||||
|
||||
private:
|
||||
/// The slot connected to SyntheticMouseEvent::timeout.
|
||||
void generateSyntheticMouseEvent();
|
||||
SyntheticMouseEvent synthetic_mouse_event_;
|
||||
|
||||
///
|
||||
bool track_scrollbar_;
|
||||
/// owning widget
|
||||
QWorkArea * wa_;
|
||||
|
||||
QTimer step_timer_;
|
||||
std::queue<boost::shared_ptr<QKeyEvent> > keyeventQueue_;
|
||||
|
||||
/// the double buffered pixmap
|
||||
boost::scoped_ptr<QPixmap> pixmap_;
|
||||
|
||||
double_click dc_event_;
|
||||
};
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#endif // QCONTENTPANE_H
|
@ -1,180 +0,0 @@
|
||||
/**
|
||||
* \file QDelimiterDialog.C
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author John Levon
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "QDelimiterDialog.h"
|
||||
|
||||
#include "iconpalette.h"
|
||||
#include "QMath.h"
|
||||
#include "qt_helpers.h"
|
||||
|
||||
#include "controllers/ControlMath.h"
|
||||
|
||||
#include "gettext.h"
|
||||
|
||||
#include <qlabel.h>
|
||||
#include <qpixmap.h>
|
||||
#include <qcheckbox.h>
|
||||
#include <qcombobox.h>
|
||||
|
||||
#include <sstream>
|
||||
|
||||
|
||||
using std::string;
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
namespace {
|
||||
|
||||
char const * delim[] = {
|
||||
"(", ")", "{", "}", "[", "]",
|
||||
"lceil", "rceil", "lfloor", "rfloor", "langle", "rangle",
|
||||
"uparrow", "Uparrow", "downarrow", "Downarrow",
|
||||
"|", "Vert", "slash", "backslash", ""
|
||||
};
|
||||
|
||||
|
||||
char const * const bigleft[] = {"bigl", "Bigl", "biggl", "Biggl", ""};
|
||||
char const * const bigright[] = {"bigr", "Bigr", "biggr", "Biggr", ""};
|
||||
char const * const biggui[] = {N_("big size"), N_("Big size"),
|
||||
N_("bigg size"), N_("Bigg size"), ""};
|
||||
|
||||
|
||||
string do_match(const string & str)
|
||||
{
|
||||
if (str == "(") return ")";
|
||||
if (str == ")") return "(";
|
||||
if (str == "[") return "]";
|
||||
if (str == "]") return "[";
|
||||
if (str == "{") return "}";
|
||||
if (str == "}") return "{";
|
||||
if (str == "l") return "r";
|
||||
if (str == "rceil") return "lceil";
|
||||
if (str == "lceil") return "rceil";
|
||||
if (str == "rfloor") return "lfloor";
|
||||
if (str == "lfloor") return "rfloor";
|
||||
if (str == "rangle") return "langle";
|
||||
if (str == "langle") return "rangle";
|
||||
if (str == "backslash") return "slash";
|
||||
if (str == "slash") return "backslash";
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
string fix_name(const string & str, bool big)
|
||||
{
|
||||
if (str == "slash")
|
||||
return "/";
|
||||
if (str == "backslash")
|
||||
return "\\";
|
||||
if (str == "empty")
|
||||
return ".";
|
||||
if (!big || str == "(" || str == ")" || str == "[" || str == "]")
|
||||
return str;
|
||||
|
||||
return "\\" + str;
|
||||
}
|
||||
|
||||
} // namespace anon
|
||||
|
||||
|
||||
QDelimiterDialog::QDelimiterDialog(QMathDelimiter * form)
|
||||
: QDelimiterDialogBase(0, 0, false, 0),
|
||||
form_(form)
|
||||
{
|
||||
setCaption(qt_("LyX: Delimiters"));
|
||||
|
||||
for (int i = 0; *delim[i]; ++i) {
|
||||
string xpm(find_xpm(delim[i]));
|
||||
leftIP->add(QPixmap(toqstr(xpm)), delim[i], delim[i]);
|
||||
rightIP->add(QPixmap(toqstr(xpm)), delim[i], delim[i]);
|
||||
}
|
||||
|
||||
string empty_xpm(find_xpm("empty"));
|
||||
|
||||
leftIP->add(QPixmap(toqstr(empty_xpm)), "empty", "empty");
|
||||
rightIP->add(QPixmap(toqstr(empty_xpm)), "empty", "empty");
|
||||
delimSize->insertItem(qt_("Variable size"));
|
||||
for (int i = 0; *biggui[i]; ++i)
|
||||
delimSize->insertItem(qt_(biggui[i]));
|
||||
size_ = 0;
|
||||
// Leave these std:: qualifications alone !
|
||||
connect(leftIP, SIGNAL(button_clicked(const std::string &)),
|
||||
this, SLOT(ldelim_clicked(const std::string &)));
|
||||
connect(rightIP, SIGNAL(button_clicked(const std::string &)),
|
||||
this, SLOT(rdelim_clicked(const std::string &)));
|
||||
connect(delimSize, SIGNAL(activated(int)),
|
||||
this, SLOT(size_selected(int)) );
|
||||
ldelim_clicked("(");
|
||||
rdelim_clicked(")");
|
||||
}
|
||||
|
||||
|
||||
void QDelimiterDialog::insertClicked()
|
||||
{
|
||||
if (size_ == 0) {
|
||||
form_->controller().dispatchDelim(
|
||||
fix_name(left_, false) + ' ' +
|
||||
fix_name(right_, false));
|
||||
} else {
|
||||
std::ostringstream os;
|
||||
os << '"' << bigleft[size_ - 1] << "\" \""
|
||||
<< fix_name(left_, true) << "\" \""
|
||||
<< bigright[size_ - 1] << "\" \""
|
||||
<< fix_name(right_, true) << '"';
|
||||
form_->controller().dispatchBigDelim(os.str());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void QDelimiterDialog::set_label(QLabel * label, const string & str)
|
||||
{
|
||||
label->setUpdatesEnabled(false);
|
||||
label->setPixmap(QPixmap(toqstr(find_xpm(str))));
|
||||
label->setUpdatesEnabled(true);
|
||||
label->update();
|
||||
}
|
||||
|
||||
|
||||
void QDelimiterDialog::ldelim_clicked(const string & str)
|
||||
{
|
||||
left_ = str;
|
||||
|
||||
set_label(leftPI, left_);
|
||||
if (matchCB->isChecked()) {
|
||||
right_ = do_match(left_);
|
||||
set_label(rightPI, right_);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void QDelimiterDialog::rdelim_clicked(const string & str)
|
||||
{
|
||||
right_ = str;
|
||||
|
||||
set_label(rightPI, right_);
|
||||
if (matchCB->isChecked()) {
|
||||
left_ = do_match(right_);
|
||||
set_label(leftPI, left_);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void QDelimiterDialog::size_selected(int index)
|
||||
{
|
||||
size_ = index;
|
||||
}
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#include "QDelimiterDialog_moc.cpp"
|
@ -1,56 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file QDelimiterDialog.h
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author John Levon
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#ifndef QDELIMITERDIALOG_H
|
||||
#define QDELIMITERDIALOG_H
|
||||
|
||||
#include "ui/QDelimiterDialogBase.h"
|
||||
#include <string>
|
||||
|
||||
class IconPalette;
|
||||
class QLabel;
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
class QMathDelimiter;
|
||||
|
||||
class QDelimiterDialog : public QDelimiterDialogBase {
|
||||
Q_OBJECT
|
||||
public:
|
||||
QDelimiterDialog(QMathDelimiter * form);
|
||||
public slots:
|
||||
void ldelim_clicked(const std::string & str);
|
||||
void rdelim_clicked(const std::string & str);
|
||||
void size_selected(int);
|
||||
void insertClicked();
|
||||
protected:
|
||||
//needed ? virtual void closeEvent(QCloseEvent * e);
|
||||
private:
|
||||
void set_label(QLabel * label, const std::string & str);
|
||||
|
||||
/// symbol of left delimiter
|
||||
std::string left_;
|
||||
|
||||
/// symbol of right delimiter
|
||||
std::string right_;
|
||||
|
||||
/// size of delimiters
|
||||
int size_;
|
||||
|
||||
/// owning form
|
||||
QMathDelimiter * form_;
|
||||
};
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#endif // QDELIMITERDIALOG_H
|
@ -1,120 +0,0 @@
|
||||
/**
|
||||
* \file QDialogView.C
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Angus Leeming
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "QDialogView.h"
|
||||
#include "Qt2BC.h"
|
||||
#include "qt_helpers.h"
|
||||
|
||||
#include "controllers/ButtonController.h"
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
QDialogView::QDialogView(Dialog & parent, docstring const & t)
|
||||
: Dialog::View(parent,t), updating_(false)
|
||||
{}
|
||||
|
||||
|
||||
Qt2BC & QDialogView::bcview()
|
||||
{
|
||||
return static_cast<Qt2BC &>(dialog().bc().view());
|
||||
}
|
||||
|
||||
|
||||
bool QDialogView::isVisible() const
|
||||
{
|
||||
return form() && form()->isVisible();
|
||||
}
|
||||
|
||||
|
||||
bool QDialogView::readOnly() const
|
||||
{
|
||||
return kernel().isBufferReadonly();
|
||||
}
|
||||
|
||||
|
||||
void QDialogView::show()
|
||||
{
|
||||
if (!form()) {
|
||||
build();
|
||||
}
|
||||
|
||||
form()->setMinimumSize(form()->sizeHint());
|
||||
|
||||
update(); // make sure its up-to-date
|
||||
if (dialog().controller().exitEarly())
|
||||
return;
|
||||
|
||||
form()->setCaption(toqstr("LyX: " + getTitle()));
|
||||
|
||||
if (form()->isVisible()) {
|
||||
form()->raise();
|
||||
} else {
|
||||
form()->show();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void QDialogView::hide()
|
||||
{
|
||||
if (form() && form()->isVisible())
|
||||
form()->hide();
|
||||
}
|
||||
|
||||
|
||||
bool QDialogView::isValid()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void QDialogView::changed()
|
||||
{
|
||||
if (updating_)
|
||||
return;
|
||||
bc().valid(isValid());
|
||||
}
|
||||
|
||||
|
||||
void QDialogView::slotWMHide()
|
||||
{
|
||||
dialog().CancelButton();
|
||||
}
|
||||
|
||||
|
||||
void QDialogView::slotApply()
|
||||
{
|
||||
dialog().ApplyButton();
|
||||
}
|
||||
|
||||
|
||||
void QDialogView::slotOK()
|
||||
{
|
||||
dialog().OKButton();
|
||||
}
|
||||
|
||||
|
||||
void QDialogView::slotClose()
|
||||
{
|
||||
dialog().CancelButton();
|
||||
}
|
||||
|
||||
|
||||
void QDialogView::slotRestore()
|
||||
{
|
||||
dialog().RestoreButton();
|
||||
}
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#include "QDialogView_moc.cpp"
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user