mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-05 13:26:21 +00:00
The Gtk removal from trunk.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15488 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
153c997228
commit
8f261b1529
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=[qt4, or gtk]
|
||||
1) ./configure --with-frontend=qt4
|
||||
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 (qt4, gtk) it needs. Defaults to NONE
|
||||
find extra libraries (qt4) it needs. Defaults to NONE
|
||||
(i.e. search in standard places). You can specify several
|
||||
directories, separated by colons.
|
||||
|
||||
|
@ -78,7 +78,6 @@ command 'scons -h'.
|
||||
Components to use/build:
|
||||
|
||||
* 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
|
||||
|
@ -558,7 +558,7 @@ AC_DEFUN([LYX_USE_FRONTENDS],
|
||||
[AC_MSG_CHECKING([what frontend should be used for the GUI])
|
||||
AC_ARG_WITH(frontend,
|
||||
[ --with-frontend=THIS Use THIS frontend as main GUI:
|
||||
Possible values: qt4, gtk],
|
||||
Possible values: qt4],
|
||||
[FRONTENDS="$withval"])
|
||||
if test "x$FRONTENDS" = x ; then
|
||||
AC_MSG_RESULT(none)
|
||||
|
16
configure.ac
16
configure.ac
@ -179,19 +179,6 @@ dnl The code below is not in a macro, because this would cause big
|
||||
dnl problems with the AC_REQUIRE contained in QT_DO_IT_ALL.
|
||||
for frontend in $FRONTENDS ; do
|
||||
case "$frontend" in
|
||||
gtk)
|
||||
PKG_CHECK_MODULES(GTK_FRONTEND, gtkmm-2.4 libglademm-2.4 xft)
|
||||
FRONTENDS_PROGS="$FRONTENDS_PROGS lyx-gtk\$(EXEEXT)"
|
||||
FRONTENDS_SUBDIRS="$FRONTENDS_SUBDIRS gtk"
|
||||
RPM_FRONTEND="gtk"
|
||||
GTKMM_VERSION=`pkg-config --modversion gtkmm-2.4`
|
||||
LIBGLADEMM_VERSION=`pkg-config --modversion libglademm-2.4`
|
||||
FRONTEND_INFO="${FRONTEND_INFO}\
|
||||
GTK Frontend:\n\
|
||||
libgtkmm version:\t\t${GTKMM_VERSION}\n\
|
||||
libglademm version:\t\t${LIBGLADEMM_VERSION}\n"
|
||||
;;
|
||||
|
||||
qt4)
|
||||
QT4_DO_IT_ALL
|
||||
FRONTENDS_PROGS="$FRONTENDS_PROGS lyx-qt4\$(EXEEXT)"
|
||||
@ -434,9 +421,6 @@ AC_CONFIG_FILES([Makefile m4/Makefile \
|
||||
src/frontends/Makefile \
|
||||
src/frontends/controllers/Makefile \
|
||||
src/frontends/controllers/tests/Makefile \
|
||||
src/frontends/gtk/Makefile \
|
||||
src/frontends/gtk/gimages/Makefile \
|
||||
src/frontends/gtk/glade/Makefile \
|
||||
src/frontends/qt4/Makefile \
|
||||
src/frontends/qt4/ui/Makefile \
|
||||
])
|
||||
|
@ -126,7 +126,7 @@ opts = Options(['config.py'])
|
||||
opts.AddOptions(
|
||||
# frontend
|
||||
EnumOption('frontend', 'Main GUI', default_frontend,
|
||||
allowed_values = ('qt4', 'gtk') ),
|
||||
allowed_values = ('qt4') ),
|
||||
# debug or release build
|
||||
EnumOption('mode', 'Building method', default_build_mode,
|
||||
allowed_values = ('debug', 'release') ),
|
||||
|
@ -37,43 +37,6 @@ src/frontends/controllers/character.C
|
||||
src/frontends/controllers/frnt_lang.C
|
||||
src/frontends/controllers/helper_funcs.C
|
||||
src/frontends/controllers/tex_helpers.C
|
||||
src/frontends/gtk/Dialogs.C
|
||||
src/frontends/gtk/GAboutlyx.C
|
||||
src/frontends/gtk/GBC.h
|
||||
src/frontends/gtk/GBibItem.C
|
||||
src/frontends/gtk/GBibtex.C
|
||||
src/frontends/gtk/GBox.C
|
||||
src/frontends/gtk/GBranch.C
|
||||
src/frontends/gtk/GChanges.C
|
||||
src/frontends/gtk/GCharacter.C
|
||||
src/frontends/gtk/GCitation.C
|
||||
src/frontends/gtk/GDocument.C
|
||||
src/frontends/gtk/GERT.C
|
||||
src/frontends/gtk/GErrorList.C
|
||||
src/frontends/gtk/GExternal.C
|
||||
src/frontends/gtk/GFloat.C
|
||||
src/frontends/gtk/GGraphics.C
|
||||
src/frontends/gtk/GInclude.C
|
||||
src/frontends/gtk/GLog.C
|
||||
src/frontends/gtk/GMathDelim.C
|
||||
src/frontends/gtk/GMathPanel.C
|
||||
src/frontends/gtk/GMathsMatrix.C
|
||||
src/frontends/gtk/GNote.C
|
||||
src/frontends/gtk/GParagraph.C
|
||||
src/frontends/gtk/GPreferences.C
|
||||
src/frontends/gtk/GRef.C
|
||||
src/frontends/gtk/GSearch.C
|
||||
src/frontends/gtk/GSendto.C
|
||||
src/frontends/gtk/GShowFile.C
|
||||
src/frontends/gtk/GSpellchecker.C
|
||||
src/frontends/gtk/GTableCreate.C
|
||||
src/frontends/gtk/GTabular.C
|
||||
src/frontends/gtk/GTexinfo.C
|
||||
src/frontends/gtk/GThesaurus.C
|
||||
src/frontends/gtk/GToc.C
|
||||
src/frontends/gtk/GUrl.C
|
||||
src/frontends/gtk/GVSpace.C
|
||||
src/frontends/gtk/GWrap.C
|
||||
src/frontends/qt4/Alert_pimpl.C
|
||||
src/frontends/qt4/BulletsModule.C
|
||||
src/frontends/qt4/Dialogs.C
|
||||
|
@ -31,16 +31,12 @@ OTHERLIBS = $(BOOST_LIBS) $(LIBICONV) $(INTLLIBS) $(AIKSAURUS_LIBS) @LIBS@ $(SOC
|
||||
|
||||
bin_PROGRAMS = lyx
|
||||
noinst_PROGRAMS = $(FRONTENDS_PROGS)
|
||||
EXTRA_PROGRAMS = lyx-gtk lyx-qt4
|
||||
EXTRA_PROGRAMS = lyx-qt4
|
||||
|
||||
lyx_qt4_LDADD = $(lyx_OBJECTS) $(LYX_PRE_LIBS) \
|
||||
frontends/qt4/libqt4.la $(LYX_POST_LIBS) $(OTHERLIBS)
|
||||
lyx_qt4_SOURCES = main.C
|
||||
|
||||
lyx_gtk_LDADD = $(lyx_OBJECTS) $(LYX_PRE_LIBS) \
|
||||
frontends/gtk/libgtk.la $(LYX_POST_LIBS) $(OTHERLIBS)
|
||||
lyx_gtk_SOURCES = main.C
|
||||
|
||||
lyx$(EXEEXT): $(FRONTENDS_PROGS)
|
||||
rm -f $@
|
||||
$(LN_S) $< $@
|
||||
|
@ -94,12 +94,6 @@ void LyXView::setWorkArea(WorkArea * work_area)
|
||||
}
|
||||
|
||||
|
||||
WorkArea * LyXView::workArea()
|
||||
{
|
||||
return work_area_;
|
||||
}
|
||||
|
||||
|
||||
Buffer * LyXView::buffer() const
|
||||
{
|
||||
return work_area_->bufferView().buffer();
|
||||
|
@ -152,10 +152,6 @@ public:
|
||||
/// returns true if this view has the focus.
|
||||
virtual bool hasFocus() const = 0;
|
||||
|
||||
/// Temporary method to access the current workArea.
|
||||
/// This is needed for the gtk frontend.
|
||||
frontend::WorkArea * workArea();
|
||||
|
||||
/// show the error list to the user
|
||||
void showErrorList(std::string const &);
|
||||
|
||||
|
@ -2,7 +2,7 @@ include $(top_srcdir)/config/common.am
|
||||
|
||||
SUBDIRS = controllers $(FRONTENDS_SUBDIRS)
|
||||
|
||||
DIST_SUBDIRS = controllers gtk qt4
|
||||
DIST_SUBDIRS = controllers qt4
|
||||
|
||||
EXTRA_DIST = pch.h
|
||||
|
||||
|
@ -89,25 +89,21 @@ public:
|
||||
/// grey out (no buffer)
|
||||
void greyOut();
|
||||
|
||||
/// FIXME: should be protected, public until the gtk frontend are
|
||||
/// cleaned up.
|
||||
void processKeySym(LyXKeySymPtr key, key_modifier::state state);
|
||||
|
||||
protected:
|
||||
///
|
||||
void processKeySym(LyXKeySymPtr key, key_modifier::state state);
|
||||
/// cause the display of the given area of the work area
|
||||
virtual void expose(int x, int y, int w, int h) = 0;
|
||||
|
||||
public:
|
||||
/// FIXME: This is public because of gtk, should be protected
|
||||
///
|
||||
void dispatch(FuncRequest const & cmd0);
|
||||
|
||||
/// FIXME: This is public because of gtk, should be protected
|
||||
///
|
||||
void resizeBufferView();
|
||||
|
||||
/// FIXME: This is public because of gtk, should be protected
|
||||
///
|
||||
void scrollBufferView(int position);
|
||||
|
||||
protected:
|
||||
/// hide the visible cursor, if it is visible
|
||||
void hideCursor();
|
||||
|
||||
|
@ -1,126 +0,0 @@
|
||||
/**
|
||||
* \file gtk/Alert_pimpl.C
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Huang Ying
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
// Too hard to make concept checks work with this file
|
||||
#ifdef _GLIBCXX_CONCEPT_CHECKS
|
||||
#undef _GLIBCXX_CONCEPT_CHECKS
|
||||
#endif
|
||||
#ifdef _GLIBCPP_CONCEPT_CHECKS
|
||||
#undef _GLIBCPP_CONCEPT_CHECKS
|
||||
#endif
|
||||
|
||||
#include "frontends/Alert.h"
|
||||
#include "frontends/Alert_pimpl.h"
|
||||
|
||||
#include <gtkmm.h>
|
||||
|
||||
|
||||
namespace lyx {
|
||||
|
||||
using lyx::docstring;
|
||||
|
||||
using std::string;
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
|
||||
docstring translateShortcut(docstring const & str)
|
||||
{
|
||||
docstring::size_type i = str.find_first_of(lyx::from_ascii("&"));
|
||||
if (i == docstring::npos || i == str.length() - 1)
|
||||
return str;
|
||||
docstring tstr = str;
|
||||
tstr[i] = '_';
|
||||
return tstr;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
void warning_pimpl(docstring const & title, docstring const & message)
|
||||
{
|
||||
Gtk::MessageDialog dlg(Glib::Markup::escape_text(lyx::to_utf8(message)),
|
||||
true, Gtk::MESSAGE_WARNING,
|
||||
Gtk::BUTTONS_CLOSE, true);
|
||||
dlg.set_title(lyx::to_utf8(title));
|
||||
dlg.run();
|
||||
}
|
||||
|
||||
|
||||
void error_pimpl(docstring const & title, docstring const & message)
|
||||
{
|
||||
Gtk::MessageDialog dlg(Glib::Markup::escape_text(lyx::to_utf8(message)),
|
||||
true, Gtk::MESSAGE_ERROR,
|
||||
Gtk::BUTTONS_CLOSE, true);
|
||||
dlg.set_title(lyx::to_utf8(title));
|
||||
dlg.run();
|
||||
}
|
||||
|
||||
|
||||
void information_pimpl(docstring const & title, docstring const & message)
|
||||
{
|
||||
Gtk::MessageDialog dlg(Glib::Markup::escape_text(lyx::to_utf8(message)),
|
||||
true, Gtk::MESSAGE_INFO,
|
||||
Gtk::BUTTONS_CLOSE, true);
|
||||
dlg.set_title(lyx::to_utf8(title));
|
||||
dlg.run();
|
||||
}
|
||||
|
||||
|
||||
int prompt_pimpl(docstring const & title, docstring const & question,
|
||||
int defaultButton, int /*escapeButton*/,
|
||||
docstring const & b1, docstring const & b2, docstring const & b3)
|
||||
{
|
||||
Glib::ustring gb1 = lyx::to_utf8(translateShortcut(b1));
|
||||
Glib::ustring gb2 = lyx::to_utf8(translateShortcut(b2));
|
||||
Glib::ustring gb3;
|
||||
if (!b3.empty())
|
||||
gb3 = lyx::to_utf8(translateShortcut(b3));
|
||||
Gtk::MessageDialog dlg(Glib::Markup::escape_text(lyx::to_utf8(question)),
|
||||
true, Gtk::MESSAGE_QUESTION,
|
||||
Gtk::BUTTONS_NONE, true);
|
||||
dlg.set_title(lyx::to_utf8(title));
|
||||
dlg.add_button(gb1, 0);
|
||||
dlg.add_button(gb2, 1);
|
||||
if (!b3.empty())
|
||||
dlg.add_button(gb3, 2);
|
||||
dlg.set_default_response(defaultButton);
|
||||
return dlg.run();
|
||||
}
|
||||
|
||||
|
||||
std::pair<bool, docstring> const askForText_pimpl(docstring const & msg,
|
||||
docstring const & dflt)
|
||||
{
|
||||
Gtk::MessageDialog dlg(Glib::Markup::escape_text(lyx::to_utf8(msg)),
|
||||
true, Gtk::MESSAGE_QUESTION,
|
||||
Gtk::BUTTONS_OK_CANCEL,
|
||||
true);
|
||||
Gtk::Entry entry;
|
||||
entry.set_text(lyx::to_utf8(dflt));
|
||||
entry.set_position(-1);
|
||||
entry.show();
|
||||
dlg.get_vbox()->children().push_back(
|
||||
Gtk::Box_Helpers::Element(entry));
|
||||
int response = dlg.run();
|
||||
if (response == Gtk::RESPONSE_OK) {
|
||||
docstring str = lyx::from_utf8(entry.get_text());
|
||||
return std::make_pair<bool, docstring>(true, str);
|
||||
}
|
||||
else
|
||||
return std::make_pair<bool, docstring>(false, docstring());
|
||||
}
|
||||
|
||||
|
||||
} // namespace lyx
|
@ -1,902 +0,0 @@
|
||||
2006-06-06 John Spray <spray@lyx.org>
|
||||
* Alert_pimpl.C: escape special characters in strings before
|
||||
passing them to Gtk::Dialog as markup
|
||||
* GCitation.[Ch]: text encoding hack to avoid crashing with
|
||||
special characters in bibtex database. Simplify UI by removing
|
||||
searching in cited keys.
|
||||
|
||||
2006-04-19 Bernhard Reiter <ockham@gmx.net>
|
||||
* GExternal.[Ch], glade/external.glade: implement external dialog
|
||||
|
||||
2006-03-26 John Spray <spray@lyx.org>
|
||||
* GMenubar.C: expect menu strings to be locale encoded (bug 2421,1954)
|
||||
|
||||
2006-03-10 Martin Vermeer <martin.vermeer@hut.fi>
|
||||
|
||||
* GChanges.C: fix bug 2212: First change is skipped in
|
||||
"Merge changes..." dialog
|
||||
|
||||
2006-02-20 John Spray <spray@lyx.org>
|
||||
* glade/documents.glade: change "page style" to "page numbering"
|
||||
in UI.
|
||||
|
||||
2006-02-20 Bartek Kostrzewa <bartek@runbox.com>
|
||||
* LyXGdkImage.C: support grayscale and monochrome
|
||||
|
||||
2006-02-17 John Spray <spray@lyx.org>
|
||||
* GPreferences.[Ch], glade/preferences.glade: Add spellchecker
|
||||
options to gtk preferences dialog
|
||||
|
||||
2006-02-16 John Spray <spray@lyx.org>
|
||||
* GCitation.C: Add selected keys to the list, even if they're
|
||||
in the list of bibkeys.
|
||||
* GViewBase.C: Put update() back into show(), it was still
|
||||
needed by some dialogs. More investigation needed.
|
||||
* GTableCreate.C: Fix rows and columns being switched
|
||||
* GMenubar.C: Escape underscores in menu labels
|
||||
* GWrap.C: Cope with empty placement string for default placement
|
||||
|
||||
2006-02-14 John Spray <spray@lyx.org>
|
||||
* GPainter.[Ch], xftFontMetrics.C: Remove broken multibyte
|
||||
text rendering stuff, make single-byte work properly.
|
||||
Now I can type Schrödinger.
|
||||
* codeConvert.h, Makefile.am: Remove codeConvert.h, it's
|
||||
no longer used.
|
||||
* GWorkArea.C: fix copy and paste text encoding. Now
|
||||
I can copy and paste Schrödinger.
|
||||
* GMenubar.C, GToolbar.C, GPainter.C: dodgy text encoding
|
||||
conversions are marked with comments. grep for ENCODING.
|
||||
* GViewBase.C: no longer call update() in show(), fixes
|
||||
update getting called twice when opening dialog.
|
||||
|
||||
2006-02-13 John Spray <spray@lyx.org>
|
||||
* ghelpers.C: implement Gtk::IconTheme stuff for getting
|
||||
lots more icons from the theme.
|
||||
* GPreferences.C: append arbitrary size to font strings
|
||||
when passing to gtk font button, to prevent it from
|
||||
mangling some more complicated font names.
|
||||
* lyx_gui.C: use Gtk::Main instead of while() loop:
|
||||
fix eating CPU even when idle
|
||||
* GPainter.[Ch]: some futile attempts to make painting
|
||||
faster by diminishing function overhead.
|
||||
|
||||
2006-02-12 John Spray <spray@lyx.org>
|
||||
* GMenubar.C: assume backend strings in latin1 (bug 1954)
|
||||
* GDocument.C, GtkLengthEntry.C: replace comboBoxTextSet with
|
||||
Gtk::ComboBoxText::set_active_text
|
||||
* ghelpers.[Ch]: remove comboBoxTextSet, rearrange GTK icon
|
||||
lookup code in preparation for using icon themes.
|
||||
* GMenubar.C, GToolbar.C: use the new icon lookup function
|
||||
|
||||
2006-02-12 Bartek Kostrzewa <bartek@runbox.com>
|
||||
* GMenubar.C: Fix crash with navigation submenus
|
||||
|
||||
2006-02-09 John Spray <spray@lyx.org>
|
||||
* GPreferences.[Ch], glade/preferences.glade: Add language tab
|
||||
|
||||
2006-02-07 John Spray <spray@lyx.org>
|
||||
|
||||
* GCitation.[Ch]: Allow adding items by double clicking
|
||||
* GPreferences.[Ch], glade/preferences.glade: Make font options
|
||||
apply properly, add graphics and keyboard options.
|
||||
|
||||
2006-02-06 John Spray <spray@lyx.org>
|
||||
|
||||
* GGraphics.[Ch], glade/graphics.glade: Use GtkLengthEntry, touch up glade
|
||||
* GDocument.[Ch], glade/document.glade: Only Bullet options left to do
|
||||
* GBibtex.[Ch], glade/bibtex.glade: Implement bibtex dialog
|
||||
* ghelpers.[Ch], GtkLengthEntry.[Ch]: Move some old stuff out of
|
||||
ghelpers into GtkLengthEntry
|
||||
* GAboutlyx.[Ch], glade/aboutlyx.glade: Sexy new about dialog
|
||||
|
||||
2006-02-05 John Spray <spray@lyx.org>
|
||||
|
||||
* GPreferences.[Ch], glade/preferences.glade: Start work on
|
||||
preferences dialog ("Screen fonts" tab done).
|
||||
* GtkLengthEntry.C: fix packing, oversized units box
|
||||
* GVSpace.[Ch], GDocument.[Ch], glade/document.glade, glade/vspace.glade:
|
||||
Use GtkLengthEntry
|
||||
|
||||
2006-01-28 John Spray <spray@lyx.org>
|
||||
|
||||
* GtkLengthEntry.[Ch]: implement signal_changed, setup spin limits
|
||||
* GWrap.[Ch], glade/wrap.glade: Add Wrap dialog
|
||||
* GDocument.[Ch], Dialogs.C: Implemented preamble editing in
|
||||
document dialog. "dialog-show preamble" will now violate
|
||||
an assertion in Dialogs.C.
|
||||
|
||||
2006-01-27 Bernhard Reiter <ockham@gmx.net>
|
||||
|
||||
* GBranch.[Ch], glade/branch.glade: Add the Branches dialog
|
||||
* Dialogs.C, Makefile.am, glade/Makefile.am: Use GBranch
|
||||
* GCitation.C, glade/citation.glade: Add some shortcuts,
|
||||
set shortcut targets correctly plus some minor bc().valid() logic
|
||||
|
||||
2006-01-25 Georg Baum <Georg.Baum@post.rwth-aachen.de>
|
||||
|
||||
* xftFontLoader.C: remove obsolete header
|
||||
|
||||
2006-01-24 John Spray <spray@lyx.org>
|
||||
* GTabular.[Ch], glade/tabular.glade: Add tabular dialog (incomplete)
|
||||
* LyXGtkLengthEntry.[Ch]: Add length entry widget
|
||||
* Dialogs.C, Makefile.am, lyx_gui.C: Remove xforms references
|
||||
|
||||
2006-01-23 John Spray <spray@lyx.org>
|
||||
|
||||
* LyXGdkImage.[Ch]: replace xforms Image class
|
||||
* Makefile.am: build LyXGdkImage
|
||||
* GPainter.C: use new Gdk Image class
|
||||
* lyx_gui.C: use new Gdk Image class, disable XSynchronize
|
||||
|
||||
2006-01-21 John Spray <spray@lyx.org>
|
||||
|
||||
* GBibItem.[Ch], glade/bibitem.glade: Add the bibitem dialog
|
||||
* Dialogs.C, Makefile.am, glade/Makefile.am: Use GBibItem
|
||||
* GDocument.[Ch], glade/document.glade: Add more functionality
|
||||
to the still-incomplete document dialog.
|
||||
* Alert_pimpl.C: Make generic dialogs use the titles LyX gives them
|
||||
* GGraphics.C: Default to scaling 100% when no scaling or size is given
|
||||
* GMenubar.C: Rename some confusing variables
|
||||
|
||||
2006-01-20 Bernhard Reiter <ockham@gmx.net>
|
||||
|
||||
* GCitation.[Ch], glade/citation.glade: Add the citation dialog
|
||||
* Dialogs.C, Makefile.am, glade/Makefile.am: Use GCitation
|
||||
|
||||
2005-10-12 Bernhard Reiter <ockham@gmx.net>
|
||||
|
||||
* The Thesaurus dialog
|
||||
* GThesaurus.C, GThesaurus.h, Makefile.am
|
||||
* Dialogs.C: moved BC generation to individual if blocks
|
||||
* glade/thesaurus.glade, glade/Makefile.am
|
||||
|
||||
2005-10-02 Martin Vermeer <martin.vermeer@hut.fi>
|
||||
|
||||
* GToc.C: fix bug 2038
|
||||
|
||||
2005-09-08 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* GSpellchecker.C: correct grammar describing invocation of the
|
||||
spellchecker.
|
||||
|
||||
2005-07-05 John Spray <spray@lyx.org>
|
||||
* GRef.[Ch], glade/ref.glade: Add the reference insertion dialog
|
||||
* Dialogs.C, Makefile.am, glade/Makefile.am: Use GRef
|
||||
|
||||
2005-07-02 John Spray <spray@lyx.org>
|
||||
* xftFontMetrics.C: Add error checking to call to mbstowcs
|
||||
in font_metrics::width, estimate width for strings that
|
||||
mbstowcs doesn't like.
|
||||
|
||||
2005-07-31 John Spray <spray_john@users.sf.net>
|
||||
* GToc.C: unbreak viewing lists other than TOC by storing
|
||||
integer index of entries in Type combobox.
|
||||
|
||||
2005-07-28 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
|
||||
|
||||
* GViewBase.C (show): exit after update if Controller::exitEarly()
|
||||
is true. (bug 1950)
|
||||
|
||||
2005-07-27 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
|
||||
|
||||
* GTexInfo.C: Load and display full-path and no-path
|
||||
lists correctly (bug 1936)
|
||||
|
||||
2005-07-27 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
|
||||
|
||||
* GToc.C (update, updateContents): Do not compare against
|
||||
translatable strings (bug 1870).
|
||||
Someone who can actually compile against gtk should verify this.
|
||||
|
||||
2005-07-24 Georg Baum <Georg.Baum@post.rwth-aachen.de>
|
||||
|
||||
* GDocument.[Ch], glade/document.glade: remove remaining
|
||||
paperpackage bits
|
||||
|
||||
2005-07-18 José Matos <jamatos@fc.up.pt>
|
||||
|
||||
* GDocument.C: new file format, remove support for a4.sty,
|
||||
a4wide.sty and a4widemargins.
|
||||
|
||||
2005-07-16 José Matos <jamatos@fc.up.pt>
|
||||
|
||||
* ghelpers.C:
|
||||
* GDocument.C: remove setPaperStuff and use a
|
||||
single papersize variable.
|
||||
|
||||
2005-07-15 José Matos <jamatos@lyx.org>
|
||||
|
||||
* .cvsignore: add pch.h.gch and pch.h.gch.dep.
|
||||
|
||||
2005-07-04 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
|
||||
|
||||
* GToc.C: consider gui name, not type, when trying to set the
|
||||
toc combo (fixes bug 1870).
|
||||
|
||||
2005-05-14 Michael Schmitt <michael.schmitt@teststep.org>
|
||||
|
||||
* Dialogs.C: dialog title "Index" => "Index Entry"
|
||||
* GTexinfo.C: dialog title "LaTeX Information" => "TeX Information"
|
||||
|
||||
2005-04-25 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* GChanges.C:
|
||||
* GLog.C:
|
||||
* GShowFile.C:
|
||||
* GTexinfo.C:
|
||||
include <config.h> in .C files, not .h ones.
|
||||
add licence blurb.
|
||||
protect headers inside preprocessor guards.
|
||||
|
||||
2005-03-21 John Spray <spray_john@users.sf.net>
|
||||
|
||||
* GDocument.[Ch]: add "Page", "Margins", "Language" tabs.
|
||||
|
||||
2005-03-20 Alfredo Braunstein <abraunst@lyx.org>
|
||||
|
||||
* GWorkArea.[Ch] (onScroll, setScrollbarParams): add an adjusting_
|
||||
flag to avoid signal reentrance.
|
||||
|
||||
2005-03-20 John Spray <spray_john@users.sf.net>
|
||||
|
||||
* ghelpers.C: use Gtk::Stock::PROPERTIES icon for document
|
||||
dialog.
|
||||
|
||||
2005-03-10 John Spray <spray_john@users.sf.net>
|
||||
|
||||
* GGraphics, GVSpace, GBox: update to use new ghelpers functions
|
||||
* ghelpers: add getLengthFromWidgets, setWidgetsFromLength,
|
||||
comboBoxTextSet, populateUnitCombo. Remove buildLengthNoRelUnitList.
|
||||
* GDocument.[Ch], Makefile.am, Dialogs.C: start work on document
|
||||
dialog.
|
||||
|
||||
2005-03-04 John Spray <spray_john@users.sf.net>
|
||||
|
||||
* GToolbar.C: remember existing selection when update()ing
|
||||
the layoutbox, in order to cope with document class changes.
|
||||
|
||||
2005-01-29 Georg Baum <Georg.Baum@post.rwth-aachen.de>
|
||||
|
||||
* GPrint.C (apply): use convert<int, string> to avoid undefined
|
||||
reference to convert<int, Glib::ustring>
|
||||
|
||||
2005-01-29 Georg Baum <Georg.Baum@post.rwth-aachen.de>
|
||||
|
||||
* *.C: make ugly concept check hack work with gcc 3.4 and above
|
||||
(fixes bug 1745)
|
||||
* GMenubar.C (onSubMenuActivate): use Glib::ustring::npos instead of
|
||||
-1
|
||||
* GTexinfo.C (onItemActivate): squash compiler warning
|
||||
|
||||
2005-01-27 Lars Gullik Bjønnes <larsbj@gullik.net>
|
||||
|
||||
* Several files: use convert<> instead of atoi,strToXXX and friends
|
||||
|
||||
2005-01-10 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* ghelpers.C:
|
||||
* lyx_gui.C: use support/package.h to provide the paths to the
|
||||
various directories used by LyX.
|
||||
|
||||
2005-01-06 Lars Gullik Bjønnes <larsbj@gullik.net>
|
||||
|
||||
* GParagraph.C: drop unused include tostr.h
|
||||
|
||||
* GSpellchecker.C:
|
||||
* GPrint.C:
|
||||
* GGraphics.C (apply): tostr -> convert
|
||||
|
||||
2005-01-04 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
|
||||
|
||||
* xftFontLoader.C: lyxrc.font_sizes is a string now.
|
||||
|
||||
* lyx_gui.C: change getDVI() to int.
|
||||
|
||||
2005-01-04 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
|
||||
|
||||
* GGraphics.C: more precise checks for the value strings.
|
||||
|
||||
2004-12-28 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
|
||||
|
||||
* GGraphics.C: store all float/double values as strings.
|
||||
|
||||
2004-12-19 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* lyx_gui.C (start): s/slashify_path/internal_path/
|
||||
|
||||
2004-12-19 Georg Baum <Georg.Baum@post.rwth-aachen.de>
|
||||
|
||||
* ghelpers.C (getDefaultUnit): add return statement to shut up the
|
||||
compiler
|
||||
* ghelpers.C (buildLengthNoRelUnitList): use std::string::npos
|
||||
instead of -1
|
||||
|
||||
2004-12-12 John Spray <spray_john@users.sourceforge.net>
|
||||
|
||||
* glade/Makefile.am: update to include all current glade
|
||||
files. This fixes "make install" for the gtk frontend.
|
||||
|
||||
2004-12-08 John Spray <spray_john@users.sourceforge.net>
|
||||
|
||||
* FileDialogPrivate.C: use Gtk::FileChooser.set_current_name
|
||||
to make suggested filenames work when saving
|
||||
|
||||
2004-12-07 John Spray <spray_john@users.sourceforge.net>
|
||||
|
||||
* glade/: improve layouts, set spinbuttons to display 2
|
||||
decimal places where apropriate
|
||||
* GSearch.C: focus 'find' entry on update()
|
||||
* GParagraph.C: don't require that 'ControlBox' widget
|
||||
be an HBox.
|
||||
* The Include Dialog:
|
||||
Dialogs.C, Makefile.am, GInclude.[Ch], glade/include.glade
|
||||
|
||||
2004-12-05 Lars Gullik Bjønnes <larsbj@lyx.org>
|
||||
|
||||
* glade/Makefile.am: clean up a bit
|
||||
* gimages/Makefile.am (dist_noinst_DATA): ditto
|
||||
|
||||
2004-12-02 Georg Baum <Georg.Baum@post.rwth-aachen.de>
|
||||
|
||||
* GTableCreate.C: use size_t-like types for cell, row and column
|
||||
indices
|
||||
|
||||
2004-11-29 John Spray <spray_john@users.sourceforge.net>
|
||||
|
||||
* GToolbar.C: Make layouts combobox not expand to full height
|
||||
of toolbar, it looks more like a combobox this way.
|
||||
|
||||
2004-11-26 John Spray <spray_john@users.sourceforge.net>
|
||||
|
||||
* FileDialogPrivate.[Ch]: use Gtk::FileChooser, add
|
||||
filtering.
|
||||
|
||||
2004-11-25 John Spray <spray_john@users.sourceforge.net>
|
||||
|
||||
* GViewBase.h: Fix gcc 3.4 compilation
|
||||
* pch.h: added (barebones version to be improved)
|
||||
|
||||
2004-11-22 John Spray <spray_john@users.sourceforge.net>
|
||||
|
||||
* GWorkArea.C: Set small scrolling interval to 3*lineheight
|
||||
as opposed to 1*lineheight
|
||||
|
||||
2004-11-22 Georg Baum <Georg.Baum@post.rwth-aachen.de>
|
||||
|
||||
* GSendto.C: Disable concept checks (see below)
|
||||
|
||||
2004-11-21 John Spray <spray_john@users.sourceforge.net>
|
||||
|
||||
* The Sendto Dialog:
|
||||
Dialogs.C, Makefile.am, GSendto.C, GSendto.h
|
||||
|
||||
2004-11-17 Lars Gullik Bjønnes <larsbj@gullik.net>
|
||||
|
||||
* Disable concept checks with the use of ugly preprocessor stuff
|
||||
in several files.
|
||||
|
||||
2004-11-15 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
|
||||
|
||||
* GView.C (hasFocus): new method, always returns true for now
|
||||
|
||||
2004-11-15 John Spray <spray_john@users.sourceforge.net>
|
||||
|
||||
* The VSpace Dialog:
|
||||
Dialogs.C, Makefile.am, GVSpace.C, GVSpace.h
|
||||
* The Note Dialog:
|
||||
Dialogs.C, Makefile.am, GNote.C, GNote.h
|
||||
* The Float Dialog:
|
||||
Dialogs.C, Makefile.am, GFloat.C, GFloat.h
|
||||
* ghelpers.[Ch]: getGTKStockIcon added to choose gtk
|
||||
stock icons for FuncRequests, buildLengthNoRelUnitList()
|
||||
to get vector of units not containing "%"
|
||||
* GToolbar.C: use getGTKStockIcon for toolbutton icons
|
||||
* GMenubar.C: add icons to menu items
|
||||
|
||||
2004-11-14 John Spray <spray_john@users.sourceforge.net>
|
||||
|
||||
* The ERT dialog:
|
||||
Dialogs.C, Makefile.am, GERT.C, GERT.h
|
||||
* The Box dialog:
|
||||
Dialogs.C, Makefile.am, GBox.C, GBox.h
|
||||
* ghelpers.[Ch], GGraphics.[Ch]: new functions unitsComboFromLength
|
||||
and getDefaultUnit take functionality that was in GGraphics into
|
||||
ghelpers
|
||||
|
||||
2004-11-08 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
|
||||
|
||||
* GToolbar.C (selected): use layoutSelected()
|
||||
|
||||
2004-11-05 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
|
||||
|
||||
* GToolbar.C (selected, clicked):
|
||||
* GMenubar.C (onCommandActivate): do not use the verbose argument
|
||||
to dispatch
|
||||
|
||||
2004-11-04 John Spray <spray_john@users.sourceforge.net>
|
||||
|
||||
* GWorkArea.C: convert GdkEventButton->state from
|
||||
gdk mouse button ids into mouse_button::state
|
||||
using gButtonToLyx function
|
||||
|
||||
2004-10-23 John Spray <spray_john@users.sourceforge.net>
|
||||
|
||||
* ghelpers.[Ch]: Add buildLengthUnitList() to get vector of
|
||||
available length unit strings
|
||||
* The Graphics dialog:
|
||||
Dialogs.C, Makefile.am, GGraphics.C, GGraphics.h
|
||||
|
||||
2004-10-11 John Spray <spray_john@users.sourceforge.net>
|
||||
|
||||
* GWorkArea.C: allow user to scroll only one half workarea height
|
||||
off the end of the document, and make the scrollbar and mousewheel
|
||||
consistant in this respect.
|
||||
|
||||
2004-10-11 John Spray <spray_john@users.sourceforge.net>
|
||||
|
||||
* The Changes dialog
|
||||
* Dialogs.C, Makefile.am, GChanges.C, GChanges.h
|
||||
* ControlChanges.[Ch]: make accept() and reject() return bool
|
||||
from findNextChange
|
||||
|
||||
2004-10-09 John Spray <spray_john@users.sourceforge.net>
|
||||
|
||||
* The Log dialog
|
||||
* Dialogs.C, GLog.C, GLog.h, Makefile.am, glade/log.glade
|
||||
|
||||
2004-10-08 John Spray <spray_john@users.sourceforge.net>
|
||||
|
||||
* The ShowFile dialog
|
||||
* Dialogs.C, GShowFile.C, GShowFile.h, Makefile.am
|
||||
* The Texinfo dialog
|
||||
* Dialogs.C, GTexinfo.C, GTexinfo.h, Makefile.am
|
||||
* The ErrorList dialog
|
||||
* Dialogs.C, GErrorList.C, GErrorList.h, Makefile.am
|
||||
* GViewBase.[Ch]: implement setTitle for gtk windows.
|
||||
|
||||
2004-10-06 John Spray <spray_john@users.sourceforge.net>
|
||||
|
||||
* The Spellchecker dialog
|
||||
* Dialogs.C, GSpellchecker.C, GSpellchecker.h, Makefile.am
|
||||
|
||||
2004-10-06 John Spray <spray_john@users.sourceforge.net>
|
||||
|
||||
* GView.C (c-tor): get the layout engine working correctly by
|
||||
invoking Gtk::PACK_EXPAND_WIDGET for the main LyX screen.
|
||||
|
||||
2004-10-04 John Spray <spray_john@users.sourceforge.net>
|
||||
|
||||
* The MathsMatrix dialog
|
||||
* Dialogs.C, GMathsMatrix.C, GMathsMatrix.h, Makefile.am
|
||||
|
||||
2004-10-04 John Spray <spray_john@users.sourceforge.net>
|
||||
|
||||
* GMenubar.C: use item->submenu() instead of
|
||||
getMenu(item->submenuname) where item->submenuname is empty.
|
||||
Fixes crash with "Figures" submenu.
|
||||
|
||||
2004-10-03 John Spray <spray_john@users.sourceforge.net>
|
||||
|
||||
* GMenubar.C: add labels in MenuItems to display bindings
|
||||
* GLyxKeySym.C: make print() output GTK+ style (Ctrl+N instead
|
||||
of C-n)
|
||||
|
||||
2004-10-02 John Spray <spray_john@users.sourceforge.net>
|
||||
|
||||
* The Table of Contents dialog
|
||||
* Dialogs.C, GToc.C, GToc.h, Makefile.am
|
||||
|
||||
2004-09-29 John Spray <spray_john@users.sourceforge.net>
|
||||
|
||||
* The Paragraph dialog
|
||||
* Dialogs.C, GParagraph.C, GParagraph.h, Makefile.am
|
||||
|
||||
2004-09-28 John Spray <spray_john@users.sourceforge.net>
|
||||
|
||||
* GToolbar.[Ch]: Use ComboBox instead of deprecated Combo for
|
||||
GLayoutBox class
|
||||
|
||||
2004-09-27 Lars Gullik Bjønnes <larsbj@gullik.net>
|
||||
|
||||
* lyx_gui.C (start): change comment
|
||||
(start): use for_each instead of explicit loop
|
||||
|
||||
* GWorkArea.h: store shared_ptr in the Maps.
|
||||
|
||||
* GWorkArea.C (~ColorCache): delete
|
||||
(getColor): adjust
|
||||
(getXftColor): adjust
|
||||
(cacheColor): adjust
|
||||
(cacheXftColor): adjust
|
||||
(clear): simplify
|
||||
|
||||
* GView.C (GView): use show_all() instead of explict loop
|
||||
|
||||
* GMathPanel.C (doBuild): ws change
|
||||
|
||||
2004-09-27 John Spray <spray_john@users.sourceforge.net>
|
||||
|
||||
* The Character dialog
|
||||
* Dialogs.C, GCharacter.C, GCharacter.h, Makefile.am, ghelpers.h,
|
||||
glade/Makefile.am, glade/character.glade
|
||||
|
||||
2004-09-27 Lars Gullik Bjønnes <larsbj@gullik.net>
|
||||
|
||||
* GXpmBtnTbl.C (construct): use Boost.Assert
|
||||
|
||||
* GToolbar.C (update): make items const
|
||||
|
||||
2004-09-27 John Spray <spray_john@users.sourceforge.net>
|
||||
|
||||
* GBC.C: Don't let the button controller set the label on GTK+
|
||||
stock icons
|
||||
* GMathPanel.C: resize-friendly packing
|
||||
* glade/*.glade: misc tweaks
|
||||
|
||||
2004-09-26 Lars Gullik Bjønnes <larsbj@gullik.net>
|
||||
|
||||
* Reordered and a lot of includes in a lot of files.
|
||||
|
||||
2004-09-26 Lars Gullik Bjønnes <larsbj@gullik.net>
|
||||
John Spray <spray_john@users.sourceforge.net>
|
||||
|
||||
* Initial move to gtk 2.4.
|
||||
|
||||
2004-09-26 Lars Gullik Bjønnes <larsbj@gullik.net>
|
||||
|
||||
* WS changes.
|
||||
|
||||
2004-09-25 John Spray <spray_john@users.sourceforge.net>
|
||||
|
||||
* GPrint.C: minor fixes to make it compile and work, get rid of
|
||||
"Apply"
|
||||
* Dialogs.C: move from FormPrint to GPrint
|
||||
* Makefile.am: move from FormPrint to GPrint
|
||||
* glade/print.glade: rearrange, gtk stock button for Print, get
|
||||
rid of "Apply"
|
||||
|
||||
2004-09-24 John Spray <spray_john@users.sourceforge.net>
|
||||
|
||||
* GSearch.[Ch]: new files
|
||||
* Dialogs.C: move from formsearch to gsearch
|
||||
* Makefile.am: move from formsearch to gsearch, alphabetically
|
||||
sort list of libgtk_la_SOURCES
|
||||
* glade/search.glade: s/Backwords/Backwards/, accelerator escape
|
||||
for close button, gtk stock buttons for find and replace.
|
||||
|
||||
2004-09-23 John Spray <spray_john@users.sourceforge.net>
|
||||
|
||||
* GWorkArea.[Ch]: Add GWorkArea::onScrollWheel to implement
|
||||
mouse-wheel scrolling of document
|
||||
|
||||
2004-07-24 Lars Gullik Bjønnes <larsbj@gullik.net>
|
||||
|
||||
* GPainter.C (text): use boost::scoped_array to store the
|
||||
temporary wchar_t pointer
|
||||
|
||||
* lyx_gui.C: change "support/std_sstream.h" to <sstream>
|
||||
|
||||
2004-07-22 Lars Gullik Bjønnes <larsbj@gullik.net>
|
||||
|
||||
* lyx_gui.C (register_socket_callback,unregister_socket_callback):
|
||||
implement
|
||||
(set_read_callback,remove_read_callback): remove implementation
|
||||
|
||||
* io_callback.[Ch]: new files
|
||||
* Makefile.am (libgtk_la_SOURCES): handle them
|
||||
|
||||
2004-07-21 Lars Gullik Bjønnes <larsbj@gullik.net>
|
||||
|
||||
* lyx_gui.C (register_socket_callback): add stub
|
||||
(unregister_socket_callback): add stub
|
||||
|
||||
2004-05-26 Lars Gullik Bjønnes <larsbj@gullik.net>
|
||||
|
||||
* Makefile.am: dont create a separate xforms.lo use he files
|
||||
directly when building libgtk instead.
|
||||
|
||||
2004-05-19 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* Most files: wrap code up inside namespace lyx::frontend.
|
||||
|
||||
2004-05-04 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* Dialogs.C: Remove "error" dialog identifier.
|
||||
|
||||
2004-04-28 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* GToolbar.[Ch]: rewrite code to derive from a single Toolbar or
|
||||
LayoutBox.
|
||||
|
||||
* GView.C: small changes due to changed Toolbar API.
|
||||
|
||||
2004-04-28 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* WorkAreaFactory.C (create): No longer passed x, y data.
|
||||
|
||||
* GView.[Ch] (c-tor): no longer passes x, y data to BufferView c-tor.
|
||||
|
||||
2004-04-28 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* WorkAreaFactory.C (create): pass a LyXView & to GWorkArea c-tor.
|
||||
|
||||
* GWorkArea.[Ch] (c-tor): now receives a LyXView &. Use it instead
|
||||
of GView::instance.
|
||||
|
||||
* GView.[Ch] (instance): removed.
|
||||
|
||||
2004-04-27 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* GView.[Ch]: split the window into 'top', 'left', 'center',
|
||||
'right' and 'bottom' boxes.
|
||||
(getBox): accessor for a particular box.
|
||||
|
||||
* GMenubar.C (c-tor):
|
||||
* GMiniBuffer.C (c-tor):
|
||||
* GWorkArea.C (c-tor):
|
||||
* GToolbar.C (add): access the correct Box in GView.
|
||||
|
||||
* GToolbar.[Ch] (add, displayToolbar): show only those toolbars that
|
||||
are flagged as 'ON'.
|
||||
|
||||
2004-04-27 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* ghelpers.[Ch]: new files.
|
||||
(findGladeFile): search the top_srcdir() as welll as LibFileSearch
|
||||
when looking for glade files.
|
||||
|
||||
* Makefile.am: add new files.
|
||||
|
||||
* GAboutlyx.C (doBuild):
|
||||
* GMathDelim.C (doBuild):
|
||||
* GMathPanel.C (doBuild):
|
||||
* GPrint.C (doBuild):
|
||||
* GTableCreate.C (doBuild):
|
||||
* GText.C (doBuild):
|
||||
* GUrl.C (doBuild): use findGladeFile in preference to LibFileSearch.
|
||||
Prevents crash when using a not-installed lyx executable.
|
||||
|
||||
2004-04-20 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* Makefile.am (SUBDIRS): add gimages.
|
||||
|
||||
* gimages/.cvsignore: new file. Ignore Makefile.in, Makefile.
|
||||
|
||||
* gimages/Makefile.am: new file. Add the xpm files to EXTRA_DIST.
|
||||
|
||||
* glade/Makefile.am (GLADE_FILES): replace '*.glade' with the
|
||||
names of the individual files.
|
||||
'make distdir' Now works when srcdir != builddir.
|
||||
|
||||
2004-04-08 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* GPainter.C: compile fixes.
|
||||
|
||||
2004-04-07 Alfredo Braunstein <abraunst@lyx.org>
|
||||
|
||||
* GPainter.[Ch]: adjust to changes in Painter.h
|
||||
|
||||
2004-04-05 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* Dialogs.C (build): set the preferences dialog button policy to
|
||||
PreferencesPolicy.
|
||||
|
||||
2004-04-05 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* GMenubar.C: wrap #warning calls inside #ifdef WITH_WARNINGS blocks.
|
||||
|
||||
2004-03-31 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* GViewBase.C: remove mention of ControlButtons.h.
|
||||
|
||||
* Makefile.am: remove mention of xforms' Dialogs2.lo, FormBase.lo.
|
||||
|
||||
2004-03-31 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* Dialogs.C (build): added preamble dialog.
|
||||
|
||||
2004-03-31 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* Dialogs.C (build): added spellchecker dialog.
|
||||
|
||||
2004-03-31 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* Dialogs.C (build): added preferences dialog.
|
||||
|
||||
2004-03-30 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* Dialogs.C (build) added document dialog.
|
||||
|
||||
2004-03-28 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* Dialogs.C (build): added print dialog.
|
||||
|
||||
2004-03-27 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* Dialogs.C (build): added box, fidreplace, log, sendto, vspace
|
||||
dialogs. Removed latexlog.
|
||||
|
||||
* Makefile.am: associated changes.
|
||||
|
||||
2004-03-26 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* Makefile.am: ensure that the build can find lyx_forms.h when
|
||||
srcdir != builddir.
|
||||
|
||||
2004-03-26 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
|
||||
|
||||
* GLyXKeySym.C (print): new method; print a keysym using
|
||||
kb_keymap::printKeySym (should use some native gtk method instead)
|
||||
|
||||
2004-03-24 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* GMenubar.C (submenuDisabled, onSubMenuActivate): compile fixes
|
||||
due to the changes in FuncStatus.
|
||||
|
||||
* GToolbar.C (update): ditto.
|
||||
|
||||
* lyx_gui.C (start): remove code to order buffers as it no longer
|
||||
compiles and none of the other frontends do this anymore.
|
||||
|
||||
2004-03-17 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* Makefile.am: remove mention of the forks dialog.
|
||||
|
||||
2004-02-09 Huang Ying <hying_caritas@163.com>
|
||||
|
||||
* GXpmBtnTbl.C : add a GXpmBtnTbl class to automate creating a Xpm
|
||||
Button Table according to a set of xpm data or xbm data, is equivalent
|
||||
with bmtable in xforms frontend.
|
||||
* GMathPanel.C : revise using GXpmBtnTbl.
|
||||
* gimages : a directory for xpm used in gtk frontend only.
|
||||
* GMathDelim.C : math delimiter dialog.
|
||||
|
||||
2004-02-07 Huang Ying <hying_caritas@163.com>
|
||||
|
||||
* GViewBase.C : add addCancel, addOK, addApply, add Restore to
|
||||
facilitate setup buttons signal.
|
||||
* GAboutLyx.C : using addxxx series functions.
|
||||
* GTableCreate.C : using addxxx series functions.
|
||||
* GText.C : using addxxx series functions.
|
||||
* GUrl.C : using addxxx series functions.
|
||||
|
||||
2004-02-02 Huang Ying <hying_caritas@163.com>
|
||||
|
||||
* GAboutLyx.C : the "CREDITS" is in "ISO8859-1" charset not locale
|
||||
charset, so change the convert function from Glib::locale_to_utf8
|
||||
to Glib::convert(credit, "UTF-8", "ISO8859-1").
|
||||
|
||||
2003-12-20 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
|
||||
|
||||
* Dialogs.C:
|
||||
* Makefile.am: remove vclog (compile fix)
|
||||
|
||||
2003-12-14 Michael Schmitt <michael.schmitt@teststep.org>
|
||||
|
||||
* Dialogs.C:
|
||||
* Makefile.am: remove minipage
|
||||
|
||||
2003-10-30 Huang Ying <hying_caritas@163.com>
|
||||
|
||||
* GToolbar.C : change layouts widget update code according xforms
|
||||
fronetends to prevent layouts widget from disable always.
|
||||
|
||||
2003-10-28 Huang Ying <hying_caritas@163.com>
|
||||
|
||||
* codeConvert.h (etc): Change FcChar to XftChar according to the libxft
|
||||
interface changing.
|
||||
* FileDialogPrivate.C : get rid of button support in FileDialog
|
||||
because of the implementation of Gtk::FileSelection changed.
|
||||
* glade/.cvsignore : add *.gladep, which is generated during editing
|
||||
*.galde
|
||||
* Add MathPanel, TableCreate and Url dialog
|
||||
|
||||
2003-10-15 José Matos <jamatos@lyx.org>
|
||||
|
||||
* lyx_gui.C (start): add lyxsocket.
|
||||
(LyX_XErrHandler): fix call to emergencyCleanup.
|
||||
|
||||
2003-10-14 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* lyx_gui.C (start): store the LyXView in the LyX list of all LyXViews.
|
||||
|
||||
2003-10-13 José Matos <jamatos@lyx.org>
|
||||
|
||||
* lyx_gui.C (set_datasocket_callback, set_serversocket_callback,
|
||||
remove_datasocket_callback, remove_serversocket_callback):
|
||||
prefix those fucntions with lyx_gui:: to link correctly.
|
||||
|
||||
* lyx_gui.C (start): fix call to dispatch.
|
||||
|
||||
2003-10-13 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* lyx_gui.C (set_datasocket_callback, set_serversocket_callback,
|
||||
remove_datasocket_callback, remove_serversocket_callback):
|
||||
placeholder functions, enabling the frontend to be linked.
|
||||
|
||||
2003-10-08 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
Fix doxygen warnings.
|
||||
|
||||
* Alert_pimpl.C: \file Alert_pimpl.C -> \file gtk/Alert_pimpl.C
|
||||
* FileDialog.C: \file FileDialog.C -> \file gtk/FileDialog.C
|
||||
* GView.C: \file GView.C -> \file gtk/GView.C
|
||||
* GView.h: \file GView.h -> \file gtk/GView.h
|
||||
|
||||
2003-09-21 Lars Gullik Bjønnes <larsbj@gullik.net>
|
||||
|
||||
* GToolbar.C (add): Make it take a ToobarBackend::Item as arg,
|
||||
adjust.
|
||||
(onButtonClicked): take a FuncRequest
|
||||
(update): adjust
|
||||
|
||||
* GMenubar.C (submenuDisabled): pass FuncRequest to getStatus.
|
||||
(onSubMenuActivate): ditto
|
||||
(onCommandActivate): pass MenuItem::func to dispatch
|
||||
|
||||
* LyXKeySymFactory.C (create): fix new bug
|
||||
|
||||
* GView.C (GView): fix new bug
|
||||
|
||||
* GToolbar.C (add): fix new bug
|
||||
|
||||
2003-09-18 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* GPainter.C:
|
||||
* GPainter.h:
|
||||
* GWorkArea.C:
|
||||
* GWorkArea.h:
|
||||
* lyx_gui.C: rename EnumLColor as LColor_color.
|
||||
|
||||
2003-09-16 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* GScreen.[Ch] (workarea):
|
||||
* GWorkArea.[Ch] (~ColorCache, getColor, getXftColor, cacheColor,
|
||||
cacheXftColor, getPainter, workWidth, workHeight, xpos, ypos, getWindow,
|
||||
getDisplay, getPixmap, getGC, getColormap, getXftDraw, getColorHandler):
|
||||
move out-of-line.
|
||||
|
||||
2003-09-15 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* GPainter.C: add #include "LColor.h".
|
||||
* GPainter.[Ch] (setForeground, point, line, lines, rectangle, fillRectangle,
|
||||
fillPolygon, arc): pass EnumLColor args, rather than LColor::color ones.
|
||||
|
||||
* GScreen.C:
|
||||
* GWorkArea.C: add #include "LColor.h".
|
||||
|
||||
* GWorkArea.h: remove #include "LColor.h".
|
||||
change typedefs to take an EnumLColor arg rather than an LColor::color one.
|
||||
|
||||
* GWorkArea.h (getColor, getXftColor, cacheColor, cacheXftColor):
|
||||
* GWorkArea.[Ch] (getXftColor, getGdkColor): pass EnumLColor args, rather
|
||||
than LColor::color ones.
|
||||
|
||||
* lyx_gui.C (hexname, update_color): pass EnumLColor args, rather
|
||||
than LColor::color ones.
|
||||
|
||||
2003-09-10 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* GToolbar.C (onLayoutSelected): missed a change from a call to the
|
||||
Buffer::params member variable to the Buffer::params() function.
|
||||
|
||||
2003-09-09 Lars Gullik Bjønnes <larsbj@lyx.org>
|
||||
|
||||
* GPainter.C: change Assert to BOOST_ASSERT
|
||||
|
||||
2003-09-08 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* GPainter.h: do not #include <config.h> in header files.
|
||||
|
||||
2003-09-02 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* .cvsignore:
|
||||
* glade/.cvsignore: new files.
|
||||
|
||||
2003-09-02 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* all files: standard-conformant header blurbs.
|
||||
|
||||
2003-09-02 Huang Ying <hying_caritas@163.com>
|
||||
|
||||
* initial release
|
@ -1,577 +0,0 @@
|
||||
/**
|
||||
// * \file gtk/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>
|
||||
|
||||
// Too hard to make concept checks work with this file
|
||||
#ifdef _GLIBCXX_CONCEPT_CHECKS
|
||||
#undef _GLIBCXX_CONCEPT_CHECKS
|
||||
#endif
|
||||
#ifdef _GLIBCPP_CONCEPT_CHECKS
|
||||
#undef _GLIBCPP_CONCEPT_CHECKS
|
||||
#endif
|
||||
|
||||
#include "Dialogs.h"
|
||||
#include "Dialog.h"
|
||||
|
||||
#include "ControlAboutlyx.h"
|
||||
#include "ControlBibtex.h"
|
||||
#include "ControlBox.h"
|
||||
#include "ControlBranch.h"
|
||||
#include "ControlChanges.h"
|
||||
#include "ControlCharacter.h"
|
||||
#include "ControlCitation.h"
|
||||
#include "ControlCommand.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 "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 "ControlTexinfo.h"
|
||||
#include "ControlToc.h"
|
||||
#include "ControlVSpace.h"
|
||||
#include "ControlWrap.h"
|
||||
|
||||
#include "GAboutlyx.h"
|
||||
#include "GText.h"
|
||||
#include "GMathDelim.h"
|
||||
#include "GBibItem.h"
|
||||
#include "GBibtex.h"
|
||||
#include "GBox.h"
|
||||
#include "GBranch.h"
|
||||
#include "GChanges.h"
|
||||
#include "GCharacter.h"
|
||||
#include "GCitation.h"
|
||||
#include "GDocument.h"
|
||||
#include "GErrorList.h"
|
||||
#include "GERT.h"
|
||||
#include "GExternal.h"
|
||||
#include "GFloat.h"
|
||||
#include "GGraphics.h"
|
||||
#include "GInclude.h"
|
||||
#include "GLog.h"
|
||||
#include "GMathPanel.h"
|
||||
//#include "FormMathsBitmap.h"
|
||||
#include "GMathsMatrix.h"
|
||||
//#include "FormMathsSpace.h"
|
||||
//#include "FormMathsStyle.h"
|
||||
#include "GNote.h"
|
||||
#include "GParagraph.h"
|
||||
#include "GPreferences.h"
|
||||
#include "GPrint.h"
|
||||
#include "GRef.h"
|
||||
#include "GSearch.h"
|
||||
#include "GSendto.h"
|
||||
#include "GTabular.h"
|
||||
#include "GTexinfo.h"
|
||||
#include "GShowFile.h"
|
||||
#include "GSpellchecker.h"
|
||||
#include "GTableCreate.h"
|
||||
#include "GToc.h"
|
||||
#include "GUrl.h"
|
||||
#include "GVSpace.h"
|
||||
#include "GWrap.h"
|
||||
|
||||
#ifdef HAVE_LIBAIKSAURUS
|
||||
#include "ControlThesaurus.h"
|
||||
#include "GThesaurus.h"
|
||||
#endif
|
||||
|
||||
#include "ButtonController.h"
|
||||
|
||||
#include "arrows.xbm"
|
||||
#include "bop.xbm"
|
||||
#include "brel.xbm"
|
||||
#include "deco.xbm"
|
||||
#include "dots.xbm"
|
||||
#include "greek.xbm"
|
||||
#include "misc.xbm"
|
||||
#include "varsz.xbm"
|
||||
|
||||
#include "ams_misc.xbm"
|
||||
#include "ams_arrows.xbm"
|
||||
#include "ams_rel.xbm"
|
||||
#include "ams_nrel.xbm"
|
||||
#include "ams_ops.xbm"
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <vector>
|
||||
|
||||
|
||||
namespace lyx {
|
||||
|
||||
using std::string;
|
||||
|
||||
using namespace lyx::frontend;
|
||||
|
||||
namespace {
|
||||
|
||||
//FormMathsBitmap * createFormBitmap(Dialog & parent, string const & title,
|
||||
// char const * const * data, int size)
|
||||
//{
|
||||
// char const * const * const end = data + size;
|
||||
// return new FormMathsBitmap(parent, title, std::vector<string>(data, end));
|
||||
//}
|
||||
|
||||
|
||||
char const * const dialognames[] = {
|
||||
"aboutlyx", "bibitem", "bibtex", "box", "branch", "changes", "character",
|
||||
"citation", "document", "errorlist" , "ert", "external", "file",
|
||||
"findreplace", "float", "graphics", "include", "index", "label", "log",
|
||||
"mathpanel", "mathaccents", "matharrows", "mathoperators", "mathrelations",
|
||||
"mathgreek", "mathmisc", "mathdots", "mathbigoperators", "mathamsmisc",
|
||||
"mathamsarrows", "mathamsrelations", "mathamsnegatedrelations",
|
||||
"mathamsoperators", "mathdelimiter", "mathmatrix", "mathspace", "mathstyle",
|
||||
"note", "paragraph", "prefs", "print", "ref", "sendto",
|
||||
"spellchecker", "tabular", "tabularcreate", "texinfo",
|
||||
|
||||
#ifdef HAVE_LIBAIKSAURUS
|
||||
"thesaurus",
|
||||
#endif
|
||||
|
||||
"toc", "url", "vspace", "wrap" };
|
||||
|
||||
char const * const * const end_dialognames =
|
||||
dialognames + (sizeof(dialognames) / sizeof(char *));
|
||||
|
||||
struct cmpCStr {
|
||||
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));
|
||||
|
||||
if (name == "aboutlyx") {
|
||||
dialog->bc().view(new GBC(dialog->bc()));
|
||||
dialog->setController(new ControlAboutlyx(*dialog));
|
||||
dialog->setView(new GAboutlyx(*dialog));
|
||||
dialog->bc().bp(new OkCancelPolicy);
|
||||
} else if (name == "bibitem") {
|
||||
dialog->bc().view(new GBC(dialog->bc()));
|
||||
dialog->setController(new ControlCommand(*dialog, name, name));
|
||||
dialog->setView(new GBibItem(*dialog));
|
||||
dialog->bc().bp(new OkCancelReadOnlyPolicy);
|
||||
} else if (name == "bibtex") {
|
||||
dialog->bc().view(new GBC(dialog->bc()));
|
||||
dialog->setController(new ControlBibtex(*dialog));
|
||||
dialog->setView(new GBibtex(*dialog));
|
||||
dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
|
||||
} else if (name == "box") {
|
||||
dialog->bc().view(new GBC(dialog->bc()));
|
||||
dialog->setController(new ControlBox(*dialog));
|
||||
dialog->setView(new GBox(*dialog));
|
||||
dialog->bc().bp(new OkApplyCancelReadOnlyPolicy);
|
||||
} else if (name == "changes") {
|
||||
dialog->bc().view(new GBC(dialog->bc()));
|
||||
dialog->setController(new ControlChanges(*dialog));
|
||||
dialog->setView(new GChanges(*dialog));
|
||||
dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
|
||||
} else if (name == "character") {
|
||||
dialog->bc().view(new GBC(dialog->bc()));
|
||||
dialog->setController(new ControlCharacter(*dialog));
|
||||
dialog->setView(new GCharacter(*dialog));
|
||||
dialog->bc().bp(new OkApplyCancelReadOnlyPolicy);
|
||||
} else if (name == "citation") {
|
||||
dialog->bc().view(new GBC(dialog->bc()));
|
||||
dialog->setController(new ControlCitation(*dialog));
|
||||
dialog->setView(new GCitation(*dialog));
|
||||
dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
|
||||
} else if (name == "document") {
|
||||
dialog->bc().view(new GBC(dialog->bc()));
|
||||
dialog->setController(new ControlDocument(*dialog));
|
||||
dialog->setView(new GDocument(*dialog));
|
||||
dialog->bc().bp(new OkApplyCancelReadOnlyPolicy);
|
||||
} else if (name == "errorlist") {
|
||||
dialog->bc().view(new GBC(dialog->bc()));
|
||||
dialog->setController(new ControlErrorList(*dialog));
|
||||
dialog->setView(new GErrorList(*dialog));
|
||||
dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
|
||||
} else if (name == "ert") {
|
||||
dialog->bc().view(new GBC(dialog->bc()));
|
||||
dialog->setController(new ControlERT(*dialog));
|
||||
dialog->setView(new GERT(*dialog));
|
||||
dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
|
||||
} else if (name == "external") {
|
||||
dialog->bc().view(new GBC(dialog->bc()));
|
||||
dialog->setController(new ControlExternal(*dialog));
|
||||
dialog->setView(new GExternal(*dialog));
|
||||
dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
|
||||
} else if (name == "file") {
|
||||
dialog->bc().view(new GBC(dialog->bc()));
|
||||
dialog->setController(new ControlShowFile(*dialog));
|
||||
dialog->setView(new GShowFile(*dialog));
|
||||
dialog->bc().bp(new OkCancelPolicy);
|
||||
} else if (name == "findreplace") {
|
||||
dialog->bc().view(new GBC(dialog->bc()));
|
||||
dialog->setController(new ControlSearch(*dialog));
|
||||
dialog->setView(new GSearch(*dialog));
|
||||
dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
|
||||
} else if (name == "float") {
|
||||
dialog->bc().view(new GBC(dialog->bc()));
|
||||
dialog->setController(new ControlFloat(*dialog));
|
||||
dialog->setView(new GFloat(*dialog));
|
||||
dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
|
||||
} else if (name == "graphics") {
|
||||
dialog->bc().view(new GBC(dialog->bc()));
|
||||
dialog->setController(new ControlGraphics(*dialog));
|
||||
dialog->setView(new GGraphics(*dialog));
|
||||
dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
|
||||
} else if (name == "include") {
|
||||
dialog->bc().view(new GBC(dialog->bc()));
|
||||
dialog->setController(new ControlInclude(*dialog));
|
||||
dialog->setView(new GInclude(*dialog));
|
||||
dialog->bc().bp(new OkApplyCancelReadOnlyPolicy);
|
||||
} else if (name == "index") {
|
||||
dialog->bc().view(new GBC(dialog->bc()));
|
||||
dialog->setController(new ControlCommand(*dialog, name, name));
|
||||
dialog->setView(new GText(*dialog, _("Index Entry"),
|
||||
_("Keyword:|#K")));
|
||||
dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
|
||||
} else if (name == "label") {
|
||||
dialog->bc().view(new GBC(dialog->bc()));
|
||||
dialog->setController(new ControlCommand(*dialog, name, name));
|
||||
dialog->setView(new GText(*dialog, _("Label"),
|
||||
_("Label:|#L")));
|
||||
dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
|
||||
} else if (name == "log") {
|
||||
dialog->bc().view(new GBC(dialog->bc()));
|
||||
dialog->setController(new ControlLog(*dialog));
|
||||
dialog->setView(new GLog(*dialog));
|
||||
dialog->bc().bp(new OkCancelPolicy);
|
||||
|
||||
} else if (name == "mathpanel") {
|
||||
dialog->bc().view(new GBC(dialog->bc()));
|
||||
dialog->setController(new ControlMath(*dialog));
|
||||
dialog->setView(new GMathPanel(*dialog));
|
||||
dialog->bc().bp(new IgnorantPolicy);
|
||||
|
||||
} else if (name == "mathaccents") {
|
||||
// FormMathsBitmap * bitmap =
|
||||
// createFormBitmap(*dialog, lyx::to_utf8(_("Maths Decorations & Accents")),
|
||||
// latex_deco, nr_latex_deco);
|
||||
// bitmap->addBitmap(
|
||||
// BitmapStore(12, 3, 4, deco1_width, deco1_height, deco1_bits, true));
|
||||
// bitmap->addBitmap(
|
||||
// BitmapStore(10, 4, 3, deco2_width, deco2_height, deco2_bits, true));
|
||||
|
||||
// dialog->bc().view(new xformsBC(dialog->bc()));
|
||||
dialog->setController(new ControlMath(*dialog));
|
||||
// dialog->setView(bitmap);
|
||||
dialog->bc().bp(new IgnorantPolicy);
|
||||
|
||||
} else if (name == "matharrows") {
|
||||
// FormMathsBitmap * bitmap =
|
||||
// createFormBitmap(*dialog, lyx::to_utf8(_("Arrows"), latex_arrow, nr_latex_arrow));
|
||||
// bitmap->addBitmap(
|
||||
// BitmapStore(20, 5, 4, arrow_width, arrow_height, arrow_bits, true));
|
||||
// bitmap->addBitmap(
|
||||
// BitmapStore(7, 2, 4, larrow_width, larrow_height, larrow_bits, false));
|
||||
// bitmap->addBitmap(
|
||||
// BitmapStore(4, 2, 2, darrow_width, darrow_height, darrow_bits, true));
|
||||
|
||||
// dialog->bc().view(new xformsBC(dialog->bc()));
|
||||
dialog->setController(new ControlMath(*dialog));
|
||||
// dialog->setView(bitmap);
|
||||
dialog->bc().bp(new IgnorantPolicy);
|
||||
|
||||
} else if (name == "mathoperators") {
|
||||
// FormMathsBitmap * bitmap =
|
||||
// createFormBitmap(*dialog, lyx::to_utf8(_("Binary Ops")),
|
||||
// latex_bop, nr_latex_bop);
|
||||
// bitmap->addBitmap(
|
||||
// BitmapStore(31, 4, 8, bop_width, bop_height, bop_bits, true));
|
||||
|
||||
// dialog->bc().view(new xformsBC(dialog->bc()));
|
||||
dialog->setController(new ControlMath(*dialog));
|
||||
// dialog->setView(bitmap);
|
||||
dialog->bc().bp(new IgnorantPolicy);
|
||||
|
||||
} else if (name == "mathrelations") {
|
||||
// FormMathsBitmap * bitmap =
|
||||
// createFormBitmap(*dialog, lyx::to_utf8(_("Binary Relations")),
|
||||
// latex_brel, nr_latex_brel);
|
||||
// bitmap->addBitmap(
|
||||
// BitmapStore(35, 4, 9, brel_width, brel_height, brel_bits, true));
|
||||
|
||||
// dialog->bc().view(new xformsBC(dialog->bc()));
|
||||
dialog->setController(new ControlMath(*dialog));
|
||||
// dialog->setView(bitmap);
|
||||
dialog->bc().bp(new IgnorantPolicy);
|
||||
|
||||
} else if (name == "mathgreek") {
|
||||
// FormMathsBitmap * bitmap =
|
||||
// createFormBitmap(*dialog, lyx::to_utf8(_("Greek")),
|
||||
// latex_greek, nr_latex_greek);
|
||||
// bitmap->addBitmap(
|
||||
// BitmapStore(11, 6, 2, Greek_width, Greek_height, Greek_bits, true));
|
||||
// bitmap->addBitmap(
|
||||
// BitmapStore(28, 7, 4, greek_width, greek_height, greek_bits, true));
|
||||
|
||||
// dialog->bc().view(new xformsBC(dialog->bc()));
|
||||
dialog->setController(new ControlMath(*dialog));
|
||||
// dialog->setView(bitmap);
|
||||
dialog->bc().bp(new IgnorantPolicy);
|
||||
|
||||
} else if (name == "mathmisc") {
|
||||
// FormMathsBitmap * bitmap =
|
||||
// createFormBitmap(*dialog, lyx::to_utf8(_("Misc")),
|
||||
// latex_misc, nr_latex_misc);
|
||||
// bitmap->addBitmap(
|
||||
// BitmapStore(29, 5, 6, misc_width, misc_height, misc_bits, true));
|
||||
// bitmap->addBitmap(
|
||||
// BitmapStore(5, 5, 1, misc4_width, misc4_height, misc4_bits, true));
|
||||
// bitmap->addBitmap(
|
||||
// BitmapStore(6, 3, 2, misc2_width, misc2_height, misc2_bits, false));
|
||||
// bitmap->addBitmap(
|
||||
// BitmapStore(4, 2, 2, misc3_width, misc3_height, misc3_bits, true));
|
||||
|
||||
// dialog->bc().view(new xformsBC(dialog->bc()));
|
||||
dialog->setController(new ControlMath(*dialog));
|
||||
// dialog->setView(bitmap);
|
||||
dialog->bc().bp(new IgnorantPolicy);
|
||||
|
||||
} else if (name == "mathdots") {
|
||||
// FormMathsBitmap * bitmap =
|
||||
// createFormBitmap(*dialog, lyx::to_utf8(_("Dots")),
|
||||
// latex_dots, nr_latex_dots);
|
||||
// bitmap->addBitmap(
|
||||
// BitmapStore(4, 4, 1, dots_width, dots_height, dots_bits, true));
|
||||
|
||||
// dialog->bc().view(new xformsBC(dialog->bc()));
|
||||
dialog->setController(new ControlMath(*dialog));
|
||||
// dialog->setView(bitmap);
|
||||
dialog->bc().bp(new IgnorantPolicy);
|
||||
|
||||
} else if (name == "mathbigoperators") {
|
||||
// FormMathsBitmap * bitmap =
|
||||
// createFormBitmap(*dialog, lyx::to_utf8(_("Big Operators")),
|
||||
// latex_varsz, nr_latex_varsz);
|
||||
// bitmap->addBitmap(
|
||||
// BitmapStore(14, 3, 5, varsz_width, varsz_height, varsz_bits, true));
|
||||
|
||||
// dialog->bc().view(new xformsBC(dialog->bc()));
|
||||
dialog->setController(new ControlMath(*dialog));
|
||||
// dialog->setView(bitmap);
|
||||
dialog->bc().bp(new IgnorantPolicy);
|
||||
|
||||
} else if (name == "mathamsmisc") {
|
||||
// FormMathsBitmap * bitmap =
|
||||
// createFormBitmap(*dialog, lyx::to_utf8(_("AMS Misc")),
|
||||
// latex_ams_misc, nr_latex_ams_misc);
|
||||
// bitmap->addBitmap(
|
||||
// BitmapStore(9, 5, 2, ams1_width, ams1_height, ams1_bits, true));
|
||||
// bitmap->addBitmap(
|
||||
// BitmapStore(26, 3, 9, ams7_width, ams7_height, ams7_bits, true));
|
||||
|
||||
// dialog->bc().view(new xformsBC(dialog->bc()));
|
||||
dialog->setController(new ControlMath(*dialog));
|
||||
// dialog->setView(bitmap);
|
||||
dialog->bc().bp(new IgnorantPolicy);
|
||||
|
||||
} else if (name == "mathamsarrows") {
|
||||
// FormMathsBitmap * bitmap =
|
||||
// createFormBitmap(*dialog, lyx::to_utf8(_("AMS Arrows")),
|
||||
// latex_ams_arrows, nr_latex_ams_arrows);
|
||||
// bitmap->addBitmap(
|
||||
// BitmapStore(32, 3, 11, ams2_width, ams2_height, ams2_bits, true));
|
||||
// bitmap->addBitmap(
|
||||
// BitmapStore(6, 3, 2, ams3_width, ams3_height, ams3_bits, true));
|
||||
|
||||
// dialog->bc().view(new xformsBC(dialog->bc()));
|
||||
dialog->setController(new ControlMath(*dialog));
|
||||
// dialog->setView(bitmap);
|
||||
dialog->bc().bp(new IgnorantPolicy);
|
||||
|
||||
} else if (name == "mathamsrelations") {
|
||||
// FormMathsBitmap * bitmap =
|
||||
// createFormBitmap(*dialog, lyx::to_utf8(_("AMS Relations")),
|
||||
// latex_ams_rel, nr_latex_ams_rel);
|
||||
// bitmap->addBitmap(
|
||||
// BitmapStore(66, 6, 11, ams_rel_width, ams_rel_height, ams_rel_bits, true));
|
||||
|
||||
// dialog->bc().view(new xformsBC(dialog->bc()));
|
||||
dialog->setController(new ControlMath(*dialog));
|
||||
// dialog->setView(bitmap);
|
||||
dialog->bc().bp(new IgnorantPolicy);
|
||||
|
||||
} else if (name == "mathamsnegatedrelations") {
|
||||
// FormMathsBitmap * bitmap =
|
||||
// createFormBitmap(*dialog, lyx::to_utf8(_("AMS Negated Rel")),
|
||||
// latex_ams_nrel, nr_latex_ams_nrel);
|
||||
// bitmap->addBitmap(
|
||||
// BitmapStore(51, 6, 9, ams_nrel_width, ams_nrel_height, ams_nrel_bits, true));
|
||||
|
||||
// dialog->bc().view(new xformsBC(dialog->bc()));
|
||||
dialog->setController(new ControlMath(*dialog));
|
||||
// dialog->setView(bitmap);
|
||||
dialog->bc().bp(new IgnorantPolicy);
|
||||
|
||||
} else if (name == "mathamsoperators") {
|
||||
// FormMathsBitmap * bitmap =
|
||||
// createFormBitmap(*dialog, lyx::to_utf8(_("AMS Operators")),
|
||||
// latex_ams_ops, nr_latex_ams_ops);
|
||||
// bitmap->addBitmap(
|
||||
// BitmapStore(23, 3, 8, ams_ops_width, ams_ops_height, ams_ops_bits, true));
|
||||
|
||||
// dialog->bc().view(new xformsBC(dialog->bc()));
|
||||
dialog->setController(new ControlMath(*dialog));
|
||||
// dialog->setView(bitmap);
|
||||
dialog->bc().bp(new IgnorantPolicy);
|
||||
|
||||
} else if (name == "mathdelimiter") {
|
||||
dialog->bc().view(new GBC(dialog->bc()));
|
||||
dialog->setController(new ControlMath(*dialog));
|
||||
dialog->setView(new GMathDelim(*dialog));
|
||||
dialog->bc().bp(new OkApplyCancelReadOnlyPolicy);
|
||||
} else if (name == "mathmatrix") {
|
||||
dialog->bc().view(new GBC(dialog->bc()));
|
||||
dialog->setController(new ControlMath(*dialog));
|
||||
dialog->setView(new GMathsMatrix(*dialog));
|
||||
dialog->bc().bp(new OkCancelReadOnlyPolicy);
|
||||
} else if (name == "mathspace") {
|
||||
// dialog->bc().view(new xformsBC(dialog->bc()));
|
||||
dialog->setController(new ControlMath(*dialog));
|
||||
// dialog->setView(new FormMathsSpace(*dialog));
|
||||
dialog->bc().bp(new IgnorantPolicy);
|
||||
} else if (name == "mathstyle") {
|
||||
// dialog->bc().view(new xformsBC(dialog->bc()));
|
||||
dialog->setController(new ControlMath(*dialog));
|
||||
// dialog->setView(new FormMathsStyle(*dialog));
|
||||
dialog->bc().bp(new IgnorantPolicy);
|
||||
} else if (name == "note") {
|
||||
dialog->bc().view(new GBC(dialog->bc()));
|
||||
dialog->setController(new ControlNote(*dialog));
|
||||
dialog->setView(new GNote(*dialog));
|
||||
dialog->bc().bp(new OkApplyCancelReadOnlyPolicy);
|
||||
} else if (name == "branch") {
|
||||
dialog->bc().view(new GBC(dialog->bc()));
|
||||
dialog->setController(new ControlBranch(*dialog));
|
||||
dialog->setView(new GBranch(*dialog));
|
||||
dialog->bc().bp(new OkApplyCancelReadOnlyPolicy);
|
||||
} else if (name == "paragraph") {
|
||||
dialog->bc().view(new GBC(dialog->bc()));
|
||||
dialog->setController(new ControlParagraph(*dialog));
|
||||
dialog->setView(new GParagraph(*dialog));
|
||||
dialog->bc().bp(new OkApplyCancelReadOnlyPolicy);
|
||||
} else if (name == "prefs") {
|
||||
dialog->bc().view(new GBC(dialog->bc()));
|
||||
dialog->setController(new ControlPrefs(*dialog));
|
||||
dialog->setView(new GPreferences(*dialog));
|
||||
dialog->bc().bp(new PreferencesPolicy);
|
||||
} else if (name == "print") {
|
||||
dialog->bc().view(new GBC(dialog->bc()));
|
||||
dialog->setController(new ControlPrint(*dialog));
|
||||
dialog->setView(new GPrint(*dialog));
|
||||
dialog->bc().bp(new OkCancelPolicy);
|
||||
} else if (name == "ref") {
|
||||
dialog->bc().view(new GBC(dialog->bc()));
|
||||
dialog->setController(new ControlRef(*dialog));
|
||||
dialog->setView(new GRef(*dialog));
|
||||
dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
|
||||
} else if (name == "sendto") {
|
||||
dialog->bc().view(new GBC(dialog->bc()));
|
||||
dialog->setController(new ControlSendto(*dialog));
|
||||
dialog->setView(new GSendto(*dialog));
|
||||
dialog->bc().bp(new OkApplyCancelPolicy);
|
||||
} else if (name == "spellchecker") {
|
||||
dialog->bc().view(new GBC(dialog->bc()));
|
||||
dialog->setController(new ControlSpellchecker(*dialog));
|
||||
dialog->setView(new GSpellchecker(*dialog));
|
||||
dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
|
||||
} else if (name == "tabular") {
|
||||
dialog->bc().view(new GBC(dialog->bc()));
|
||||
dialog->setController(new ControlTabular(*dialog));
|
||||
dialog->setView(new GTabular(*dialog));
|
||||
dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
|
||||
} else if (name == "tabularcreate") {
|
||||
dialog->bc().view(new GBC(dialog->bc()));
|
||||
dialog->setController(new ControlTabularCreate(*dialog));
|
||||
dialog->setView(new GTableCreate(*dialog));
|
||||
dialog->bc().bp(new IgnorantPolicy);
|
||||
} else if (name == "texinfo") {
|
||||
dialog->bc().view(new GBC(dialog->bc()));
|
||||
dialog->setController(new ControlTexinfo(*dialog));
|
||||
dialog->setView(new GTexinfo(*dialog));
|
||||
dialog->bc().bp(new OkCancelPolicy);
|
||||
#ifdef HAVE_LIBAIKSAURUS
|
||||
} else if (name == "thesaurus") {
|
||||
dialog->bc().view(new GBC(dialog->bc()));
|
||||
dialog->setController(new ControlThesaurus(*dialog));
|
||||
dialog->setView(new GThesaurus(*dialog));
|
||||
dialog->bc().bp(new OkApplyCancelReadOnlyPolicy);
|
||||
#endif
|
||||
} else if (name == "toc") {
|
||||
dialog->bc().view(new GBC(dialog->bc()));
|
||||
dialog->setController(new ControlToc(*dialog));
|
||||
dialog->setView(new GToc(*dialog));
|
||||
dialog->bc().bp(new OkCancelPolicy);
|
||||
} else if (name == "url") {
|
||||
dialog->bc().view(new GBC(dialog->bc()));
|
||||
dialog->setController(new ControlCommand(*dialog, name, name));
|
||||
dialog->setView(new GUrl(*dialog));
|
||||
dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
|
||||
} else if (name == "vspace") {
|
||||
dialog->bc().view(new GBC(dialog->bc()));
|
||||
dialog->setController(new ControlVSpace(*dialog));
|
||||
dialog->setView(new GVSpace(*dialog));
|
||||
dialog->bc().bp(new OkApplyCancelReadOnlyPolicy);
|
||||
} else if (name == "wrap") {
|
||||
dialog->bc().view(new GBC(dialog->bc()));
|
||||
dialog->setController(new ControlWrap(*dialog));
|
||||
dialog->setView(new GWrap(*dialog));
|
||||
dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
|
||||
}
|
||||
|
||||
return dialog;
|
||||
}
|
||||
|
||||
|
||||
/// Are the tooltips on or off?
|
||||
bool Dialogs::tooltipsEnabled()
|
||||
{
|
||||
//return Tooltips::enabled();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
} // namespace lyx
|
@ -1,72 +0,0 @@
|
||||
/**
|
||||
* \file gtk/FileDialog.C
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Huang Ying
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
// Too hard to make concept checks work with this file
|
||||
#ifdef _GLIBCXX_CONCEPT_CHECKS
|
||||
#undef _GLIBCXX_CONCEPT_CHECKS
|
||||
#endif
|
||||
#ifdef _GLIBCPP_CONCEPT_CHECKS
|
||||
#undef _GLIBCPP_CONCEPT_CHECKS
|
||||
#endif
|
||||
|
||||
#include "FileDialogPrivate.h"
|
||||
|
||||
|
||||
namespace lyx {
|
||||
|
||||
using lyx::docstring;
|
||||
|
||||
using std::string;
|
||||
|
||||
|
||||
FileDialog::FileDialog(docstring const & title,
|
||||
kb_action action,
|
||||
Button b1,
|
||||
Button b2)
|
||||
{
|
||||
private_ = new FileDialog::Private(title, action, b1, b2);
|
||||
}
|
||||
|
||||
|
||||
FileDialog::~FileDialog()
|
||||
{
|
||||
delete private_;
|
||||
}
|
||||
|
||||
|
||||
FileDialog::Result const
|
||||
FileDialog::open(docstring const & path,
|
||||
lyx::support::FileFilterList const & filters,
|
||||
docstring const & suggested)
|
||||
{
|
||||
return private_->open(path, filters, suggested);
|
||||
}
|
||||
|
||||
|
||||
FileDialog::Result const
|
||||
FileDialog::opendir(docstring const & path,
|
||||
docstring const & suggested)
|
||||
{
|
||||
return private_->opendir(path, suggested);
|
||||
}
|
||||
|
||||
|
||||
FileDialog::Result const
|
||||
FileDialog::save(docstring const & path,
|
||||
lyx::support::FileFilterList const & filters,
|
||||
docstring const & suggested)
|
||||
{
|
||||
return private_->save(path, filters, suggested);
|
||||
}
|
||||
|
||||
|
||||
} // namespace lyx
|
@ -1,120 +0,0 @@
|
||||
/**
|
||||
* \file FileDialogPrivate.C
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Huang Ying
|
||||
* \author John Spray
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
// Too hard to make concept checks work with this file
|
||||
#ifdef _GLIBCXX_CONCEPT_CHECKS
|
||||
#undef _GLIBCXX_CONCEPT_CHECKS
|
||||
#endif
|
||||
#ifdef _GLIBCPP_CONCEPT_CHECKS
|
||||
#undef _GLIBCPP_CONCEPT_CHECKS
|
||||
#endif
|
||||
|
||||
#include "FileDialogPrivate.h"
|
||||
|
||||
#include "support/filefilterlist.h"
|
||||
#include "debug.h"
|
||||
|
||||
|
||||
namespace lyx {
|
||||
|
||||
using lyx::docstring;
|
||||
|
||||
using std::string;
|
||||
|
||||
FileDialog::Private::Private(docstring const & title,
|
||||
kb_action action,
|
||||
FileDialog::Button /*b1*/,
|
||||
FileDialog::Button /*b2*/) :
|
||||
action_(action),
|
||||
fileChooser_("You shouldn't see this", Gtk::FILE_CHOOSER_ACTION_OPEN)
|
||||
{
|
||||
fileChooser_.set_title(lyx::to_utf8(title));
|
||||
}
|
||||
|
||||
|
||||
FileDialog::Result const
|
||||
FileDialog::Private::open(docstring const & path,
|
||||
lyx::support::FileFilterList const & filters,
|
||||
docstring const & suggested)
|
||||
{
|
||||
fileChooser_.set_action(Gtk::FILE_CHOOSER_ACTION_OPEN);
|
||||
fileChooser_.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
|
||||
fileChooser_.add_button(Gtk::Stock::OPEN, Gtk::RESPONSE_OK);
|
||||
|
||||
return showChooser(path, filters, suggested);
|
||||
}
|
||||
|
||||
|
||||
FileDialog::Result const FileDialog::Private::opendir(docstring const & path,
|
||||
docstring const & suggested)
|
||||
{
|
||||
fileChooser_.set_action(Gtk::FILE_CHOOSER_ACTION_SELECT_FOLDER);
|
||||
fileChooser_.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
|
||||
fileChooser_.add_button(Gtk::Stock::OPEN, Gtk::RESPONSE_OK);
|
||||
|
||||
return showChooser(path, lyx::support::FileFilterList(), suggested);
|
||||
}
|
||||
|
||||
|
||||
FileDialog::Result const FileDialog::Private::save(docstring const & path,
|
||||
lyx::support::FileFilterList const & filters,
|
||||
docstring const & suggested)
|
||||
{
|
||||
fileChooser_.set_action(Gtk::FILE_CHOOSER_ACTION_SAVE);
|
||||
fileChooser_.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
|
||||
fileChooser_.add_button(Gtk::Stock::SAVE, Gtk::RESPONSE_OK);
|
||||
|
||||
return showChooser(path, filters, suggested);
|
||||
}
|
||||
|
||||
|
||||
FileDialog::Result const FileDialog::Private::showChooser(docstring const & path,
|
||||
lyx::support::FileFilterList const & filters,
|
||||
docstring const & suggested)
|
||||
{
|
||||
lyxerr[Debug::GUI] << "File Dialog with path \"" << lyx::to_utf8(path)
|
||||
<< "\", mask \"" << lyx::to_utf8(filters.as_string())
|
||||
<< "\", suggested \"" << lyx::to_utf8(suggested) << "\"\n";
|
||||
|
||||
for (lyx::support::FileFilterList::size_type i = 0; i < filters.size(); ++i) {
|
||||
typedef lyx::support::FileFilterList::Filter::glob_iterator glob_iterator;
|
||||
glob_iterator it = filters[i].begin();
|
||||
glob_iterator const end = filters[i].end();
|
||||
if (it == end)
|
||||
continue;
|
||||
|
||||
Gtk::FileFilter filter;
|
||||
filter.set_name(lyx::to_utf8(filters[i].description()));
|
||||
for (; it != end; ++it)
|
||||
filter.add_pattern(*it);
|
||||
|
||||
fileChooser_.add_filter(filter);
|
||||
}
|
||||
|
||||
if (!path.empty())
|
||||
fileChooser_.set_current_folder(lyx::to_utf8(path));
|
||||
if (!suggested.empty())
|
||||
fileChooser_.set_current_name(lyx::to_utf8(suggested));
|
||||
|
||||
fileChooser_.set_default_response(Gtk::RESPONSE_OK);
|
||||
Result result;
|
||||
result.first = FileDialog::Chosen;
|
||||
if (fileChooser_.run() == Gtk::RESPONSE_OK)
|
||||
result.second = lyx::from_utf8(fileChooser_.get_filename());
|
||||
else
|
||||
result.second = docstring();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
} // namespace lyx
|
@ -1,49 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file FileDialogPrivate.h
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Huang Ying
|
||||
* \author John Spray
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#ifndef FILE_DIALOG_PRIVATE_H
|
||||
#define FILE_DIALOG_PRIVATE_H
|
||||
|
||||
#include "frontends/FileDialog.h"
|
||||
|
||||
#include <gtkmm.h>
|
||||
|
||||
|
||||
namespace lyx {
|
||||
|
||||
class FileDialog::Private : public sigc::trackable {
|
||||
public:
|
||||
Private(lyx::docstring const & title,
|
||||
kb_action action,
|
||||
FileDialog::Button b1, FileDialog::Button b2);
|
||||
FileDialog::Result const open(lyx::docstring const & path,
|
||||
lyx::support::FileFilterList const & filters,
|
||||
lyx::docstring const & suggested);
|
||||
FileDialog::Result const opendir(lyx::docstring const & path,
|
||||
lyx::docstring const & suggested);
|
||||
FileDialog::Result const save(lyx::docstring const & path,
|
||||
lyx::support::FileFilterList const & filters,
|
||||
lyx::docstring const & suggested);
|
||||
|
||||
FileDialog::Result const showChooser(lyx::docstring const & path,
|
||||
lyx::support::FileFilterList const & filters,
|
||||
lyx::docstring const & suggested);
|
||||
|
||||
private:
|
||||
kb_action action_;
|
||||
Gtk::FileChooserDialog fileChooser_;
|
||||
};
|
||||
|
||||
|
||||
} // namespace lyx
|
||||
|
||||
#endif
|
@ -1,227 +0,0 @@
|
||||
/**
|
||||
* \file GAboutlyx.C
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Huang Ying
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
// Too hard to make concept checks work with this file
|
||||
#ifdef _GLIBCXX_CONCEPT_CHECKS
|
||||
#undef _GLIBCXX_CONCEPT_CHECKS
|
||||
#endif
|
||||
#ifdef _GLIBCPP_CONCEPT_CHECKS
|
||||
#undef _GLIBCPP_CONCEPT_CHECKS
|
||||
#endif
|
||||
|
||||
#include "ControlAboutlyx.h"
|
||||
#include "GAboutlyx.h"
|
||||
#include "ghelpers.h"
|
||||
#include "version.h"
|
||||
|
||||
#include "support/filetools.h" // LibFileSearch
|
||||
|
||||
#include <libglademm.h>
|
||||
|
||||
#include <sstream>
|
||||
|
||||
using lyx::support::libFileSearch;
|
||||
|
||||
using std::ostringstream;
|
||||
using std::string;
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
namespace {
|
||||
|
||||
enum TranslateState {NORMAL, BEGIN, IN_AT, IN_BOLD, IN_ITALIC};
|
||||
|
||||
|
||||
Glib::ustring translateMarkup(Glib::ustring const & lyxMarkup)
|
||||
{
|
||||
Glib::ustring::const_iterator it = lyxMarkup.begin();
|
||||
Glib::ustring pangoMarkup;
|
||||
TranslateState state = BEGIN;
|
||||
for (; it != lyxMarkup.end(); it++) {
|
||||
switch (state) {
|
||||
case BEGIN:
|
||||
switch (*it) {
|
||||
case '@':
|
||||
state = IN_AT;
|
||||
break;
|
||||
case '\n':
|
||||
state = BEGIN;
|
||||
pangoMarkup.push_back('\n');
|
||||
break;
|
||||
default:
|
||||
state = NORMAL;
|
||||
pangoMarkup.push_back(*it);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case IN_AT:
|
||||
switch (*it) {
|
||||
case 'b':
|
||||
state = IN_BOLD;
|
||||
pangoMarkup += "<b>";
|
||||
break;
|
||||
case 'i':
|
||||
state = IN_ITALIC;
|
||||
pangoMarkup += "<i>";
|
||||
break;
|
||||
case '\n':
|
||||
state = BEGIN;
|
||||
pangoMarkup.push_back('@');
|
||||
pangoMarkup.push_back('\n');
|
||||
break;
|
||||
default:
|
||||
state = NORMAL;
|
||||
pangoMarkup.push_back('@');
|
||||
pangoMarkup.push_back(*it);
|
||||
}
|
||||
break;
|
||||
case IN_BOLD:
|
||||
switch (*it) {
|
||||
case '\n':
|
||||
state = BEGIN;
|
||||
pangoMarkup += "</b>\n";
|
||||
break;
|
||||
default:
|
||||
pangoMarkup.push_back(*it);
|
||||
}
|
||||
break;
|
||||
case IN_ITALIC:
|
||||
switch (*it) {
|
||||
case '\n':
|
||||
state = BEGIN;
|
||||
pangoMarkup += "</i>\n";
|
||||
break;
|
||||
default:
|
||||
pangoMarkup.push_back(*it);
|
||||
}
|
||||
break;
|
||||
case NORMAL:
|
||||
switch (*it) {
|
||||
case '\n':
|
||||
state = BEGIN;
|
||||
pangoMarkup.push_back('\n');
|
||||
break;
|
||||
default:
|
||||
pangoMarkup.push_back(*it);
|
||||
}
|
||||
}
|
||||
switch (*it) {
|
||||
case '&':
|
||||
pangoMarkup += "amp;";
|
||||
break;
|
||||
case '<':
|
||||
pangoMarkup.erase(--(pangoMarkup.end()));
|
||||
pangoMarkup += "<";
|
||||
break;
|
||||
case '>':
|
||||
pangoMarkup.erase(--(pangoMarkup.end()));
|
||||
pangoMarkup += ">";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
switch (state) {
|
||||
case IN_AT:
|
||||
pangoMarkup.push_back('@');
|
||||
break;
|
||||
case IN_ITALIC:
|
||||
pangoMarkup += "</i>";
|
||||
break;
|
||||
case IN_BOLD:
|
||||
pangoMarkup += "</b>";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return pangoMarkup;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
GAboutlyx::GAboutlyx(Dialog & parent)
|
||||
: GViewCB<ControlAboutlyx, GViewGladeB>(parent, _("About LyX"))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void GAboutlyx::doBuild()
|
||||
{
|
||||
string const gladeName = findGladeFile("aboutlyx");
|
||||
xml_ = Gnome::Glade::Xml::create(gladeName);
|
||||
|
||||
Gtk::AboutDialog *dialog;
|
||||
xml_->get_widget("dialog", dialog);
|
||||
|
||||
dialog->set_version(Glib::ustring(PACKAGE_VERSION));
|
||||
|
||||
std::ostringstream ls;
|
||||
ls << controller().getCopyright() << "\n\n"
|
||||
<< controller().getLicense() << "\n\n"
|
||||
<< controller().getDisclaimer();
|
||||
dialog->set_license (ls.str());
|
||||
|
||||
string const filename = libFileSearch("images", "banner", "ppm");
|
||||
Glib::RefPtr<Gdk::Pixbuf> logo = Gdk::Pixbuf::create_from_file(filename);
|
||||
Glib::RefPtr<Gdk::Pixbuf> logo_scaled = logo->scale_simple(
|
||||
logo->get_width() / 2,
|
||||
logo->get_height() / 2,
|
||||
Gdk::INTERP_BILINEAR);
|
||||
dialog->set_logo(logo_scaled);
|
||||
|
||||
// Total crack - find and hide the built in Credits button
|
||||
// that glade helpfully puts there for us.
|
||||
Glib::List_Iterator<Gtk::Box_Helpers::Child> it =
|
||||
dialog->get_action_area()->children().begin();
|
||||
Glib::List_Iterator<Gtk::Box_Helpers::Child> const end =
|
||||
dialog->get_action_area()->children().end();
|
||||
for (; it != end; ++it) {
|
||||
Gtk::Button * button = (Gtk::Button*)(it->get_widget());
|
||||
// The close button is a stock ID which we can reliably test for
|
||||
// The license button has no icon
|
||||
// What's left is the credits button
|
||||
if (button->get_label() != "gtk-close" && button->get_image())
|
||||
button->hide();
|
||||
}
|
||||
|
||||
// FIXME UNICODE
|
||||
Gtk::Button &authorbutton = *Gtk::manage(
|
||||
new Gtk::Button(lyx::to_utf8(_("C_redits")), true));
|
||||
authorbutton.set_image(*Gtk::manage(
|
||||
new Gtk::Image(Gtk::Stock::ABOUT, Gtk::ICON_SIZE_BUTTON)));
|
||||
dialog->get_action_area()->pack_end(authorbutton);
|
||||
dialog->get_action_area()->reorder_child(authorbutton, 0);
|
||||
authorbutton.signal_clicked().connect(
|
||||
sigc::mem_fun(*this, &GAboutlyx::showAuthors));
|
||||
authorbutton.show();
|
||||
xml_->get_widget("AuthorsDialog", authordialog_);
|
||||
Gtk::Label *authorlabel;
|
||||
xml_->get_widget("Authors", authorlabel);
|
||||
std::ostringstream crs;
|
||||
controller().getCredits(crs);
|
||||
authorlabel->set_markup(translateMarkup(
|
||||
Glib::convert(crs.str(), "UTF-8", "ISO-8859-1")));
|
||||
}
|
||||
|
||||
|
||||
void GAboutlyx::showAuthors()
|
||||
{
|
||||
authordialog_->run();
|
||||
authordialog_->hide();
|
||||
}
|
||||
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
@ -1,37 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file GAboutlyx.h
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Huang Ying
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#ifndef GABOUTLYX_H
|
||||
#define GABOUTLYX_H
|
||||
|
||||
#include "GViewBase.h"
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
class ControlAboutlyx;
|
||||
|
||||
class GAboutlyx : public GViewCB<ControlAboutlyx, GViewGladeB> {
|
||||
public:
|
||||
GAboutlyx(Dialog &);
|
||||
private:
|
||||
virtual void apply() {}
|
||||
virtual void update() {}
|
||||
virtual void doBuild();
|
||||
|
||||
void showAuthors();
|
||||
Gtk::Dialog *authordialog_;
|
||||
};
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#endif
|
@ -1,55 +0,0 @@
|
||||
/**
|
||||
* \file GBC.C
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Huang Ying
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
// Too hard to make concept checks work with this file
|
||||
#ifdef _GLIBCXX_CONCEPT_CHECKS
|
||||
#undef _GLIBCXX_CONCEPT_CHECKS
|
||||
#endif
|
||||
#ifdef _GLIBCPP_CONCEPT_CHECKS
|
||||
#undef _GLIBCPP_CONCEPT_CHECKS
|
||||
#endif
|
||||
|
||||
#include "GBC.h"
|
||||
|
||||
using lyx::docstring;
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
GBC::GBC(ButtonController const & parent,
|
||||
docstring const & cancel, docstring const & close)
|
||||
: GuiBC<Gtk::Button, Gtk::Widget>(parent, cancel, close)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void GBC::setButtonEnabled(Gtk::Button * btn, bool enabled) const
|
||||
{
|
||||
btn->set_sensitive(enabled);
|
||||
}
|
||||
|
||||
|
||||
void GBC::setWidgetEnabled(Gtk::Widget * widget, bool enabled) const
|
||||
{
|
||||
widget->set_sensitive(enabled);
|
||||
}
|
||||
|
||||
|
||||
void GBC::setButtonLabel(Gtk::Button * btn, docstring const & label) const
|
||||
{
|
||||
// GTK+ Stock buttons take precedence
|
||||
if (!btn->get_use_stock())
|
||||
btn->set_label(lyx::to_utf8(label));
|
||||
}
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
@ -1,43 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file GBC.h
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Huang Ying
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#ifndef GBUTTONCONTROLLER_H
|
||||
#define GBUTTONCONTROLLER_H
|
||||
|
||||
#include "ButtonController.h"
|
||||
#include "BCView.h"
|
||||
#include "gettext.h"
|
||||
|
||||
#include <gtkmm.h>
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
class GBC : public GuiBC<Gtk::Button, Gtk::Widget> {
|
||||
public:
|
||||
GBC(ButtonController const & parent,
|
||||
lyx::docstring const & cancel = _("Cancel"),
|
||||
lyx::docstring const & close = _("Close"));
|
||||
private:
|
||||
/// Updates the button sensitivity (enabled/disabled)
|
||||
void setButtonEnabled(Gtk::Button *, bool enabled) const;
|
||||
|
||||
/// Updates the widget sensitivity (enabled/disabled)
|
||||
void setWidgetEnabled(Gtk::Widget *, bool enabled) const;
|
||||
|
||||
/// Set the label on the button
|
||||
void setButtonLabel(Gtk::Button *, lyx::docstring const & label) const;
|
||||
};
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#endif
|
@ -1,85 +0,0 @@
|
||||
/**
|
||||
* \file GBibItem.C
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author John Spray
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
// Too hard to make concept checks work with this file
|
||||
#ifdef _GLIBCXX_CONCEPT_CHECKS
|
||||
#undef _GLIBCXX_CONCEPT_CHECKS
|
||||
#endif
|
||||
#ifdef _GLIBCPP_CONCEPT_CHECKS
|
||||
#undef _GLIBCPP_CONCEPT_CHECKS
|
||||
#endif
|
||||
|
||||
#include "GBibItem.h"
|
||||
#include "ControlCommand.h"
|
||||
#include "ghelpers.h"
|
||||
|
||||
#include <libglademm.h>
|
||||
|
||||
using std::string;
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
GBibItem::GBibItem(Dialog & parent)
|
||||
: GViewCB<ControlCommand, GViewGladeB>(parent, _("Bibliography Entry Settings"), false)
|
||||
{}
|
||||
|
||||
|
||||
void GBibItem::doBuild()
|
||||
{
|
||||
string const gladeName = findGladeFile("bibitem");
|
||||
xml_ = Gnome::Glade::Xml::create(gladeName);
|
||||
|
||||
Gtk::Button * button;
|
||||
xml_->get_widget("Cancel", button);
|
||||
setCancel(button);
|
||||
xml_->get_widget("OK", button);
|
||||
setOK(button);
|
||||
|
||||
xml_->get_widget("Key", keyentry_);
|
||||
xml_->get_widget("Label", labelentry_);
|
||||
|
||||
keyentry_->signal_changed().connect(
|
||||
sigc::mem_fun(*this, &GBibItem::changed));
|
||||
labelentry_->signal_changed().connect(
|
||||
sigc::mem_fun(*this, &GBibItem::changed));
|
||||
|
||||
bcview().addReadOnly(keyentry_);
|
||||
bcview().addReadOnly(labelentry_);
|
||||
}
|
||||
|
||||
|
||||
void GBibItem::update()
|
||||
{
|
||||
bc().refreshReadOnly();
|
||||
|
||||
keyentry_->set_text (lyx::to_utf8(controller().params()["key"]));
|
||||
labelentry_->set_text (lyx::to_utf8(controller().params()["label"]));
|
||||
}
|
||||
|
||||
|
||||
void GBibItem::apply()
|
||||
{
|
||||
controller().params()["key"] = lyx::from_utf8(keyentry_->get_text());
|
||||
controller().params()["label"] = lyx::from_utf8(labelentry_->get_text());
|
||||
}
|
||||
|
||||
void GBibItem::changed()
|
||||
{
|
||||
if (keyentry_->get_text().size() > 0)
|
||||
bc().valid(TRUE);
|
||||
else
|
||||
bc().valid(FALSE);
|
||||
}
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
@ -1,40 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file GBibItem.h
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author John Spray
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#ifndef GBIBITEM_H
|
||||
#define GBIBITEM_H
|
||||
|
||||
#include "GViewBase.h"
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
class ControlCommand;
|
||||
|
||||
/** This class provides a GTK+ implementation of the BibItem Dialog.
|
||||
*/
|
||||
class GBibItem : public GViewCB<ControlCommand, GViewGladeB> {
|
||||
public:
|
||||
GBibItem(Dialog & parent);
|
||||
private:
|
||||
virtual void apply();
|
||||
virtual void doBuild();
|
||||
virtual void update();
|
||||
void changed();
|
||||
|
||||
Gtk::Entry * keyentry_;
|
||||
Gtk::Entry * labelentry_;
|
||||
};
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#endif // GBIBITEM_H
|
@ -1,282 +0,0 @@
|
||||
/**
|
||||
* \file GBibtex.C
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author John Spray
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
// Too hard to make concept checks work with this file
|
||||
#ifdef _GLIBCXX_CONCEPT_CHECKS
|
||||
#undef _GLIBCXX_CONCEPT_CHECKS
|
||||
#endif
|
||||
#ifdef _GLIBCPP_CONCEPT_CHECKS
|
||||
#undef _GLIBCPP_CONCEPT_CHECKS
|
||||
#endif
|
||||
|
||||
#include "GBibtex.h"
|
||||
#include "ControlBibtex.h"
|
||||
#include "ghelpers.h"
|
||||
|
||||
#include "support/filetools.h"
|
||||
#include "support/lstrings.h"
|
||||
|
||||
#include <libglademm.h>
|
||||
|
||||
using lyx::docstring;
|
||||
using lyx::support::changeExtension;
|
||||
using lyx::support::split;
|
||||
using lyx::support::trim;
|
||||
|
||||
using std::vector;
|
||||
using std::string;
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
GBibtex::GBibtex(Dialog & parent)
|
||||
: GViewCB<ControlBibtex, GViewGladeB>(parent, _("BibTeX Bibliography"), false)
|
||||
{}
|
||||
|
||||
|
||||
void GBibtex::doBuild()
|
||||
{
|
||||
string const gladeName = findGladeFile("bibtex");
|
||||
xml_ = Gnome::Glade::Xml::create(gladeName);
|
||||
|
||||
Gtk::Button * button;
|
||||
xml_->get_widget("Cancel", button);
|
||||
setCancel(button);
|
||||
xml_->get_widget("OK", button);
|
||||
setOK(button);
|
||||
|
||||
xml_->get_widget("Databases", databasesview_);
|
||||
databasessel_ = databasesview_->get_selection();
|
||||
// signal_changed gets connected at the end of this fn.
|
||||
|
||||
Gtk::TreeModel::ColumnRecord listcols;
|
||||
listcols.add (stringcol_);
|
||||
databasesstore_ = Gtk::ListStore::create(listcols);
|
||||
databasesview_->set_model(databasesstore_);
|
||||
databasesview_->append_column("Database", stringcol_);
|
||||
|
||||
xml_->get_widget("Add", button);
|
||||
button->signal_clicked().connect(
|
||||
sigc::mem_fun(*this, &GBibtex::add));
|
||||
bcview().addReadOnly(button);
|
||||
xml_->get_widget("Remove", removebutton_);
|
||||
removebutton_->signal_clicked().connect(
|
||||
sigc::mem_fun(*this, &GBibtex::remove));
|
||||
bcview().addReadOnly(removebutton_);
|
||||
xml_->get_widget("Browse", button);
|
||||
button->signal_clicked().connect(
|
||||
sigc::mem_fun(*this, &GBibtex::browse));
|
||||
bcview().addReadOnly(button);
|
||||
|
||||
Gtk::HBox *box;
|
||||
xml_->get_widget("Style", box);
|
||||
box->pack_start(stylecombo_);
|
||||
stylecombo_.show();
|
||||
bcview().addReadOnly(&stylecombo_);
|
||||
|
||||
xml_->get_widget("Content", contentcombo_);
|
||||
bcview().addReadOnly(contentcombo_);
|
||||
xml_->get_widget("TOC", toccheck_);
|
||||
bcview().addReadOnly(toccheck_);
|
||||
|
||||
databasessel_->signal_changed().connect(
|
||||
sigc::mem_fun(*this, &GBibtex::validate));
|
||||
}
|
||||
|
||||
|
||||
void GBibtex::update()
|
||||
{
|
||||
string bibs(lyx::to_utf8(controller().params()["bibfiles"]));
|
||||
string bib;
|
||||
|
||||
databasesstore_->clear();
|
||||
while (!bibs.empty()) {
|
||||
bibs = split(bibs, bib, ',');
|
||||
bib = trim(bib);
|
||||
if (!bib.empty()) {
|
||||
Gtk::TreeModel::iterator const row = databasesstore_->append();
|
||||
(*row)[stringcol_] = bib;
|
||||
}
|
||||
}
|
||||
|
||||
string bibstyle(controller().getStylefile());
|
||||
|
||||
bool const bibtopic = controller().usingBibtopic();
|
||||
if (controller().bibtotoc() && !bibtopic)
|
||||
toccheck_->set_active(true);
|
||||
else
|
||||
toccheck_->set_active(false);
|
||||
|
||||
toccheck_->set_sensitive(!bibtopic);
|
||||
|
||||
string btprint(lyx::to_ascii(controller().params()["btprint"]));
|
||||
int btp = 0;
|
||||
if (btprint == "btPrintNotCited")
|
||||
btp = 1;
|
||||
else if (btprint == "btPrintAll")
|
||||
btp = 2;
|
||||
|
||||
contentcombo_->set_active(btp);
|
||||
contentcombo_->set_sensitive(bibtopic);
|
||||
|
||||
stylecombo_.clear();
|
||||
vector<string> str;
|
||||
controller().getBibStyles(str);
|
||||
|
||||
int item_nr(-1);
|
||||
vector<string>::const_iterator it = str.begin();
|
||||
vector<string>::const_iterator const end = str.end();
|
||||
for (; it != end; ++it) {
|
||||
string item(changeExtension(*it, ""));
|
||||
if (item == bibstyle)
|
||||
item_nr = int(it - str.begin());
|
||||
stylecombo_.append_text (item);
|
||||
}
|
||||
|
||||
if (item_nr == -1 && !bibstyle.empty()) {
|
||||
stylecombo_.append_text (bibstyle);
|
||||
item_nr = stylecombo_.get_model()->children().size() - 1;
|
||||
}
|
||||
|
||||
if (item_nr != -1)
|
||||
stylecombo_.set_active(item_nr);
|
||||
else
|
||||
stylecombo_.get_entry()->set_text("");
|
||||
|
||||
validate();
|
||||
}
|
||||
|
||||
|
||||
void GBibtex::apply()
|
||||
{
|
||||
Gtk::TreeModel::iterator it = databasesstore_->children().begin();
|
||||
Gtk::TreeModel::iterator const end = databasesstore_->children().end();
|
||||
|
||||
string dblist;
|
||||
for (; it != end; ++it) {
|
||||
Glib::ustring db = (*it)[stringcol_];
|
||||
dblist += string(db);
|
||||
if (it + 1 != end)
|
||||
dblist += ",";
|
||||
}
|
||||
|
||||
controller().params()["bibfiles"] = lyx::from_utf8(dblist);
|
||||
|
||||
string const bibstyle = stylecombo_.get_active_text();
|
||||
bool const bibtotoc = toccheck_->get_active();
|
||||
bool const bibtopic = controller().usingBibtopic();
|
||||
|
||||
if (!bibtopic && bibtotoc && (!bibstyle.empty())) {
|
||||
// both bibtotoc and style
|
||||
controller().params()["options"] = lyx::from_utf8("bibtotoc," + bibstyle);
|
||||
} else if (!bibtopic && 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"] = lyx::from_utf8(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 const btp = contentcombo_->get_active_row_number();
|
||||
|
||||
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 (!bibtopic)
|
||||
controller().params()["btprint"] = docstring();
|
||||
}
|
||||
|
||||
|
||||
void GBibtex::add()
|
||||
{
|
||||
string new_bib = lyx::to_utf8(controller().browseBib(docstring()));
|
||||
if (new_bib.empty())
|
||||
return;
|
||||
|
||||
new_bib = changeExtension(new_bib, string());
|
||||
|
||||
Gtk::TreeModel::iterator const row = databasesstore_->append();
|
||||
(*row)[stringcol_] = new_bib;
|
||||
|
||||
validate();
|
||||
}
|
||||
|
||||
|
||||
void GBibtex::remove()
|
||||
{
|
||||
Gtk::TreeModel::iterator const selected = databasessel_->get_selected();
|
||||
if (!databasesstore_->iter_is_valid(selected))
|
||||
return;
|
||||
|
||||
databasesstore_->erase(selected);
|
||||
|
||||
validate();
|
||||
}
|
||||
|
||||
|
||||
void GBibtex::browse()
|
||||
{
|
||||
string const file = lyx::to_utf8(controller().browseBst(docstring()));
|
||||
|
||||
if (!file.empty()) {
|
||||
string const filen = changeExtension(file, string());
|
||||
bool present = false;
|
||||
|
||||
for (unsigned int i = 0; i < stylecombo_.get_model()->children().size(); ++i) {
|
||||
stylecombo_.set_active(i);
|
||||
Glib::ustring const item = stylecombo_.get_active_text ();
|
||||
if (item == filen) {
|
||||
present = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!present) {
|
||||
stylecombo_.append_text (filen);
|
||||
stylecombo_.set_active_text(filen);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void GBibtex::validate()
|
||||
{
|
||||
if (databasesstore_->children().size())
|
||||
bc().valid(true);
|
||||
else
|
||||
bc().valid(false);
|
||||
|
||||
Gtk::TreeModel::iterator selected = databasessel_->get_selected();
|
||||
bool const enableremove = databasesstore_->iter_is_valid(selected) && !readOnly();
|
||||
removebutton_->set_sensitive(enableremove);
|
||||
}
|
||||
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
@ -1,50 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file GBibtex.h
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author John Spray
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#ifndef GBIBTEX_H
|
||||
#define GBIBTEX_H
|
||||
|
||||
#include "GViewBase.h"
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
class ControlBibtex;
|
||||
|
||||
/** This class provides a GTK+ implementation of the Bibtex Dialog.
|
||||
*/
|
||||
class GBibtex : public GViewCB<ControlBibtex, GViewGladeB> {
|
||||
public:
|
||||
GBibtex(Dialog & parent);
|
||||
private:
|
||||
virtual void apply();
|
||||
virtual void doBuild();
|
||||
virtual void update();
|
||||
|
||||
void add();
|
||||
void remove();
|
||||
void browse();
|
||||
void validate();
|
||||
|
||||
Gtk::TreeView *databasesview_;
|
||||
Glib::RefPtr<Gtk::TreeView::Selection> databasessel_;
|
||||
Glib::RefPtr<Gtk::ListStore> databasesstore_;
|
||||
Gtk::TreeModelColumn<Glib::ustring> stringcol_;
|
||||
Gtk::Button *removebutton_;
|
||||
Gtk::ComboBoxEntryText stylecombo_;
|
||||
Gtk::ComboBox *contentcombo_;
|
||||
Gtk::CheckButton *toccheck_;
|
||||
};
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#endif // GBIBTEX_H
|
@ -1,436 +0,0 @@
|
||||
/**
|
||||
* \file GBox.C
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author John Spray
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
// Too hard to make concept checks work with this file
|
||||
#ifdef _GLIBCXX_CONCEPT_CHECKS
|
||||
#undef _GLIBCXX_CONCEPT_CHECKS
|
||||
#endif
|
||||
#ifdef _GLIBCPP_CONCEPT_CHECKS
|
||||
#undef _GLIBCPP_CONCEPT_CHECKS
|
||||
#endif
|
||||
|
||||
#include "GBox.h"
|
||||
|
||||
#include "ghelpers.h"
|
||||
|
||||
#include "controllers/ControlBox.h"
|
||||
|
||||
#include "insets/insetbox.h"
|
||||
#include "lengthcommon.h"
|
||||
#include "lyxrc.h" // to set the default length values
|
||||
|
||||
using std::string;
|
||||
using std::vector;
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
namespace {
|
||||
string defaultUnit("cm");
|
||||
} // namespace anon
|
||||
|
||||
GBox::GBox(Dialog & parent)
|
||||
: GViewCB<ControlBox, GViewGladeB>(parent, _("Box Settings"), false)
|
||||
{}
|
||||
|
||||
|
||||
void GBox::doBuild()
|
||||
{
|
||||
string const gladeName = findGladeFile("box");
|
||||
xml_ = Gnome::Glade::Xml::create(gladeName);
|
||||
|
||||
Gtk::Button * closebutton;
|
||||
xml_->get_widget("Close", closebutton);
|
||||
setCancel(closebutton);
|
||||
|
||||
xml_->get_widget("Type", typecombo_);
|
||||
bcview().addReadOnly(typecombo_);
|
||||
xml_->get_widget("InnerBox", innerboxcombo_);
|
||||
bcview().addReadOnly(innerboxcombo_);
|
||||
xml_->get_widget("WidthUnits", widthunitscombo_);
|
||||
bcview().addReadOnly(widthunitscombo_);
|
||||
xml_->get_widget("HeightUnits", heightunitscombo_);
|
||||
bcview().addReadOnly(heightunitscombo_);
|
||||
xml_->get_widget("BoxVertical", boxvertcombo_);
|
||||
bcview().addReadOnly(boxvertcombo_);
|
||||
xml_->get_widget("ContentVertical", contentvertcombo_);
|
||||
bcview().addReadOnly(contentvertcombo_);
|
||||
xml_->get_widget("ContentHorizontal", contenthorzcombo_);
|
||||
bcview().addReadOnly(contenthorzcombo_);
|
||||
xml_->get_widget("Width", widthspin_);
|
||||
bcview().addReadOnly(widthspin_);
|
||||
xml_->get_widget("Height", heightspin_);
|
||||
bcview().addReadOnly(heightspin_);
|
||||
|
||||
cols_.add(stringcol_);
|
||||
|
||||
// fill the box type choice
|
||||
box_gui_tokens(ids_, gui_names_);
|
||||
PopulateComboBox(typecombo_, gui_names_);
|
||||
typecombo_->signal_changed().connect(
|
||||
sigc::mem_fun(*this, &GBox::onTypeComboChanged));
|
||||
|
||||
// set up innerbox (populated in setInnerType)
|
||||
innerboxstore_ = Gtk::ListStore::create(cols_);
|
||||
innerboxcombo_->set_model(innerboxstore_);
|
||||
Gtk::CellRendererText * cell = Gtk::manage(new Gtk::CellRendererText);
|
||||
innerboxcombo_->pack_start(*cell, true);
|
||||
innerboxcombo_->add_attribute(*cell, "text", 0);
|
||||
|
||||
innerboxcombo_->signal_changed().connect(
|
||||
sigc::mem_fun(*this, &GBox::onInnerBoxComboChanged));
|
||||
|
||||
boxvertcombo_->signal_changed().connect(
|
||||
sigc::mem_fun(*this, &GBox::onAlignChanged));
|
||||
contenthorzcombo_->signal_changed().connect(
|
||||
sigc::mem_fun(*this, &GBox::onAlignChanged));
|
||||
contentvertcombo_->signal_changed().connect(
|
||||
sigc::mem_fun(*this, &GBox::onAlignChanged));
|
||||
|
||||
heightunitscombo_->signal_changed().connect(
|
||||
sigc::mem_fun(*this, &GBox::onHeightChanged));
|
||||
widthunitscombo_->signal_changed().connect(
|
||||
sigc::mem_fun(*this, &GBox::onWidthChanged));
|
||||
|
||||
heightspin_->signal_value_changed().connect(
|
||||
sigc::mem_fun(*this, &GBox::onHeightChanged));
|
||||
widthspin_->signal_value_changed().connect(
|
||||
sigc::mem_fun(*this, &GBox::onWidthChanged));
|
||||
|
||||
|
||||
widthunitsstore_ = Gtk::ListStore::create(cols_);
|
||||
widthunitscombo_->set_model(widthunitsstore_);
|
||||
cell = Gtk::manage(new Gtk::CellRendererText);
|
||||
widthunitscombo_->pack_start(*cell, true);
|
||||
widthunitscombo_->add_attribute(*cell, "text", 0);
|
||||
//widthunitscombo_ is populated in setSpecial
|
||||
|
||||
box_gui_tokens_special_length(ids_spec_, gui_names_spec_);
|
||||
vector<string> heightunits = buildLengthUnitList(true);
|
||||
// Append special entries, skipping the first item "None"
|
||||
heightunits.insert(heightunits.end(),
|
||||
++gui_names_spec_.begin(), gui_names_spec_.end());
|
||||
|
||||
PopulateComboBox(heightunitscombo_, heightunits);
|
||||
}
|
||||
|
||||
|
||||
void GBox::PopulateComboBox(Gtk::ComboBox * combo,
|
||||
vector<string> const & strings
|
||||
)
|
||||
{
|
||||
Glib::RefPtr<Gtk::ListStore> model = Gtk::ListStore::create(cols_);
|
||||
vector<string>::const_iterator it = strings.begin();
|
||||
vector<string>::const_iterator end = strings.end();
|
||||
for(; it != end; ++it)
|
||||
(*model->append())[stringcol_] = *it;
|
||||
|
||||
combo->set_model(model);
|
||||
Gtk::CellRendererText * cell = Gtk::manage(new Gtk::CellRendererText);
|
||||
combo->pack_start(*cell, true);
|
||||
combo->add_attribute(*cell, "text", 0);
|
||||
}
|
||||
|
||||
|
||||
void GBox::update()
|
||||
{
|
||||
applylock_ = true;
|
||||
|
||||
defaultUnit = getDefaultUnit();
|
||||
|
||||
char c = controller().params().pos;
|
||||
boxvertcombo_->set_active(string("tcb").find(c, 0));
|
||||
c = controller().params().inner_pos;
|
||||
contentvertcombo_->set_active(string("tcbs").find(c, 0));
|
||||
c = controller().params().hor_pos;
|
||||
contenthorzcombo_->set_active(string("lcrs").find(c, 0));
|
||||
|
||||
string type(controller().params().type);
|
||||
for (size_t i = 0; i < gui_names_.size(); ++i) {
|
||||
if (type == ids_[i])
|
||||
typecombo_->set_active(i);
|
||||
}
|
||||
|
||||
applylock_ = false;
|
||||
updateInnerBoxCombo();
|
||||
applylock_ = true;
|
||||
|
||||
bool ibox = controller().params().inner_box;
|
||||
boxvertcombo_->set_sensitive(ibox);
|
||||
contentvertcombo_->set_sensitive(ibox);
|
||||
contenthorzcombo_->set_sensitive(!ibox);
|
||||
setSpecial(ibox);
|
||||
|
||||
widthspin_->get_adjustment()->set_value(controller().params().width.value());
|
||||
unitsComboFromLength(widthunitscombo_, stringcol_,
|
||||
controller().params().width, defaultUnit);
|
||||
|
||||
string const special(controller().params().special);
|
||||
if (!special.empty() && special != "none") {
|
||||
string spc;
|
||||
for (size_t i = 0; i < gui_names_spec_.size(); ++i) {
|
||||
if (special == ids_spec_[i])
|
||||
spc = gui_names_spec_[i];
|
||||
}
|
||||
for (size_t j = 0; j
|
||||
< widthunitsstore_->children().size(); ++j) {
|
||||
if (widthunitsstore_->children()[j][stringcol_] == spc)
|
||||
widthunitscombo_->set_active(j);
|
||||
}
|
||||
}
|
||||
|
||||
heightspin_->get_adjustment()->set_value(controller().params().height.value());
|
||||
unitsComboFromLength(heightunitscombo_, stringcol_,
|
||||
controller().params().height, defaultUnit);
|
||||
|
||||
string const height_special(controller().params().height_special);
|
||||
if (!height_special.empty() && height_special != "none") {
|
||||
string hspc;
|
||||
for (size_t i = 0; i < gui_names_spec_.size(); ++i) {
|
||||
if (height_special == ids_spec_[i]) {
|
||||
hspc = gui_names_spec_[i];
|
||||
}
|
||||
}
|
||||
for (size_t j = 0; j < heightunitscombo_->get_model()->children().size(); ++j) {
|
||||
if (heightunitscombo_->get_model()->children()[j][stringcol_] == hspc) {
|
||||
heightunitscombo_->set_active(j);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
heightspin_->set_sensitive(ibox);
|
||||
heightunitscombo_->set_sensitive(ibox);
|
||||
applylock_ = false;
|
||||
}
|
||||
|
||||
|
||||
void GBox::setSpecial(bool ibox)
|
||||
{
|
||||
bool const oldlock = applylock_;
|
||||
applylock_ = true;
|
||||
|
||||
unsigned int const initselection = widthunitscombo_->get_active_row_number();
|
||||
widthunitsstore_->clear();
|
||||
vector<string> normalunits = buildLengthUnitList(true);
|
||||
if (ibox) {
|
||||
vector<string>::const_iterator it = normalunits.begin();
|
||||
vector<string>::const_iterator end = normalunits.end();
|
||||
for(; it != end; ++it)
|
||||
(*widthunitsstore_->append())[stringcol_] = *it;
|
||||
} else {
|
||||
vector<string>::const_iterator it = normalunits.begin();
|
||||
vector<string>::const_iterator end = normalunits.end();
|
||||
for(; it != end; ++it)
|
||||
(*widthunitsstore_->append())[stringcol_] = *it;
|
||||
// Skip the first item "None"
|
||||
it = ++gui_names_spec_.begin();
|
||||
end = gui_names_spec_.end();
|
||||
for(; it != end; ++it)
|
||||
(*widthunitsstore_->append())[stringcol_] = *it;
|
||||
}
|
||||
|
||||
size_t const store_size = widthunitsstore_->children().size();
|
||||
if (initselection >= store_size) {
|
||||
widthunitscombo_->set_active(0);
|
||||
onWidthChanged();
|
||||
} else {
|
||||
widthunitscombo_->set_active(initselection);
|
||||
}
|
||||
applylock_ = oldlock;
|
||||
}
|
||||
|
||||
|
||||
void GBox::updateInnerBoxCombo()
|
||||
{
|
||||
bool const oldlock = applylock_;
|
||||
applylock_ = true;
|
||||
// with "frameless" boxes, inner box is mandatory (i.e. is the actual box)
|
||||
// we have to remove "none" then and adjust the combo
|
||||
|
||||
// default: minipage
|
||||
int i = 2;
|
||||
if (!controller().params().inner_box)
|
||||
// none
|
||||
i = 0;
|
||||
if (controller().params().use_parbox)
|
||||
// parbox
|
||||
i = 1;
|
||||
bool frameless = (controller().params().type == "Frameless");
|
||||
|
||||
int const oldsize = innerboxstore_->children().size();
|
||||
// Store the initial selection in 0,1,2 format
|
||||
int oldselection = -1;
|
||||
if (oldsize == 2)
|
||||
oldselection = innerboxcombo_->get_active_row_number() + 1;
|
||||
else if (oldsize == 3)
|
||||
oldselection = innerboxcombo_->get_active_row_number();
|
||||
|
||||
if (frameless && oldsize != 2) {
|
||||
innerboxstore_->clear();
|
||||
(*innerboxstore_->append())[stringcol_] = lyx::to_utf8(_("Parbox"));
|
||||
(*innerboxstore_->append())[stringcol_] = lyx::to_utf8(_("Minipage"));
|
||||
// Cope when the backend asks for no inner box in
|
||||
// a frameless box
|
||||
if (i == 0) {
|
||||
applylock_ = false;
|
||||
innerboxcombo_->set_active(i);
|
||||
applylock_ = true;
|
||||
} else
|
||||
innerboxcombo_->set_active(i - 1);
|
||||
} else if (!frameless && oldsize != 3) {
|
||||
innerboxstore_->clear();
|
||||
(*innerboxstore_->append())[stringcol_] = lyx::to_utf8(_("None"));
|
||||
(*innerboxstore_->append())[stringcol_] = lyx::to_utf8(_("Parbox"));
|
||||
(*innerboxstore_->append())[stringcol_] = lyx::to_utf8(_("Minipage"));
|
||||
innerboxcombo_->set_active(i);
|
||||
} else {
|
||||
// we're not changing the liststore, just selecting i
|
||||
if (frameless)
|
||||
innerboxcombo_->set_active(i - 1);
|
||||
else
|
||||
innerboxcombo_->set_active(i);
|
||||
}
|
||||
|
||||
// Update the width units list if we've changed inner box type
|
||||
if (i != oldselection)
|
||||
setSpecial(i != 0);
|
||||
|
||||
applylock_ = oldlock;
|
||||
}
|
||||
|
||||
|
||||
void GBox::onInnerBoxComboChanged()
|
||||
{
|
||||
if (applylock_)
|
||||
return;
|
||||
|
||||
controller().params().use_parbox =
|
||||
(*innerboxcombo_->get_active())[stringcol_] == lyx::to_utf8(_("Parbox"));
|
||||
|
||||
bool const ibox = (*innerboxcombo_->get_active())[stringcol_] != lyx::to_utf8(_("None"));
|
||||
controller().params().inner_box = ibox;
|
||||
setSpecial(ibox);
|
||||
|
||||
boxvertcombo_->set_sensitive(ibox);
|
||||
contentvertcombo_->set_sensitive(ibox);
|
||||
contenthorzcombo_->set_sensitive(!ibox);
|
||||
heightspin_->set_sensitive(ibox);
|
||||
heightunitscombo_->set_sensitive(ibox);
|
||||
// wtf? form_->set_sensitive(ibox);
|
||||
|
||||
controller().dispatchParams();
|
||||
}
|
||||
|
||||
|
||||
void GBox::onTypeComboChanged()
|
||||
{
|
||||
int const index = typecombo_->get_active_row_number();
|
||||
controller().params().type = ids_[index];
|
||||
|
||||
bool frameless = (index == 0);
|
||||
if (frameless) {
|
||||
boxvertcombo_->set_sensitive(true);
|
||||
contentvertcombo_->set_sensitive(true);
|
||||
contenthorzcombo_->set_sensitive(false);
|
||||
heightspin_->set_sensitive(true);
|
||||
heightunitscombo_->set_sensitive(true);
|
||||
//wtf? form_->setSpecial(true);
|
||||
}
|
||||
//int itype = innerboxcombo_->get_active_row_number();
|
||||
controller().dispatchParams();
|
||||
|
||||
updateInnerBoxCombo();
|
||||
}
|
||||
|
||||
|
||||
void GBox::onHeightChanged()
|
||||
{
|
||||
if (applylock_)
|
||||
return;
|
||||
|
||||
// "None"
|
||||
int i = 0;
|
||||
bool spec = false;
|
||||
Glib::ustring special = (*heightunitscombo_->get_active())[stringcol_];
|
||||
for (size_t j = 1; j < gui_names_spec_.size() ; ++j) {
|
||||
if (gui_names_spec_[j] == special) {
|
||||
i=j;
|
||||
spec = true;
|
||||
}
|
||||
}
|
||||
controller().params().height_special = ids_spec_[i];
|
||||
|
||||
string height;
|
||||
if (spec) {
|
||||
height = heightspin_->get_text();
|
||||
// beware: bogosity! the unit is simply ignored in this case
|
||||
height += "in";
|
||||
} else {
|
||||
Glib::ustring const heightunit =
|
||||
(*heightunitscombo_->get_active())[stringcol_];
|
||||
height = heightspin_->get_text() + heightunit;
|
||||
}
|
||||
|
||||
controller().params().height = LyXLength(height);
|
||||
controller().dispatchParams();
|
||||
}
|
||||
|
||||
|
||||
void GBox::onWidthChanged()
|
||||
{
|
||||
if (applylock_)
|
||||
return;
|
||||
|
||||
int i = 0;
|
||||
bool spec = false;
|
||||
Glib::ustring special = (*widthunitscombo_->get_active())[stringcol_];
|
||||
for (size_t j = 1; j < gui_names_spec_.size() ; ++j) {
|
||||
if (gui_names_spec_[j] == special) {
|
||||
i = j;
|
||||
spec = true;
|
||||
}
|
||||
}
|
||||
controller().params().special = ids_spec_[i];
|
||||
|
||||
string width;
|
||||
if (spec) {
|
||||
width = widthspin_->get_text();
|
||||
// beware: bogosity! the unit is simply ignored in this case
|
||||
width += "in";
|
||||
} else {
|
||||
Glib::ustring const widthunit =
|
||||
(*widthunitscombo_->get_active())[stringcol_];
|
||||
width = widthspin_->get_text() + widthunit;
|
||||
}
|
||||
|
||||
controller().params().width = LyXLength(width);
|
||||
controller().dispatchParams();
|
||||
}
|
||||
|
||||
|
||||
void GBox::onAlignChanged()
|
||||
{
|
||||
if (applylock_)
|
||||
return;
|
||||
|
||||
controller().params().pos =
|
||||
"tcb"[boxvertcombo_->get_active_row_number()];
|
||||
controller().params().inner_pos =
|
||||
"tcbs"[contenthorzcombo_->get_active_row_number()];
|
||||
controller().params().hor_pos =
|
||||
"lcrs"[contentvertcombo_->get_active_row_number()];
|
||||
|
||||
controller().dispatchParams();
|
||||
}
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
@ -1,88 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file GBox.h
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author John Spray
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#ifndef GBOX_H
|
||||
#define GBOX_H
|
||||
|
||||
#include "GViewBase.h"
|
||||
|
||||
#include "lyxlength.h"
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
class ControlBox;
|
||||
|
||||
class GBox
|
||||
: public GViewCB<ControlBox, GViewGladeB>
|
||||
{
|
||||
public:
|
||||
GBox(Dialog &);
|
||||
|
||||
// This dialog is instant-apply
|
||||
virtual void apply() {}
|
||||
// update
|
||||
virtual void update();
|
||||
// build the dialog
|
||||
virtual void doBuild();
|
||||
|
||||
// Put strings into combo
|
||||
void PopulateComboBox(Gtk::ComboBox * combo,
|
||||
std::vector<std::string> const & strings);
|
||||
|
||||
// add or remove special lengths in widthunits combo
|
||||
void setSpecial(bool ibox);
|
||||
// only show valid inner box options
|
||||
void updateInnerBoxCombo();
|
||||
|
||||
// Signal handlers
|
||||
void onTypeComboChanged();
|
||||
void onInnerBoxComboChanged();
|
||||
void onAlignChanged();
|
||||
void onHeightChanged();
|
||||
void onWidthChanged();
|
||||
|
||||
// Some event handlers are disabled when this is true
|
||||
bool applylock_;
|
||||
|
||||
// The 'type' field keys and display strings
|
||||
std::vector<std::string> ids_;
|
||||
std::vector<std::string> gui_names_;
|
||||
|
||||
// The special units for width and height
|
||||
std::vector<std::string> ids_spec_;
|
||||
std::vector<std::string> gui_names_spec_;
|
||||
|
||||
// Widgets from glade
|
||||
Gtk::ComboBox * typecombo_;
|
||||
Gtk::ComboBox * innerboxcombo_;
|
||||
Glib::RefPtr<Gtk::ListStore> innerboxstore_;
|
||||
Gtk::ComboBox * widthunitscombo_;
|
||||
Glib::RefPtr<Gtk::ListStore> widthunitsstore_;
|
||||
Gtk::ComboBox * heightunitscombo_;
|
||||
Gtk::ComboBox * boxvertcombo_;
|
||||
Gtk::ComboBox * contentvertcombo_;
|
||||
Gtk::ComboBox * contenthorzcombo_;
|
||||
Gtk::SpinButton * widthspin_;
|
||||
Gtk::SpinButton * heightspin_;
|
||||
|
||||
// Treemodel objects for use in combobox liststores
|
||||
Gtk::TreeModelColumn<Glib::ustring> stringcol_;
|
||||
Gtk::TreeModel::ColumnRecord cols_;
|
||||
};
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#endif // GBOX_H
|
@ -1,103 +0,0 @@
|
||||
/**
|
||||
* \file GBranch.C
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Bernhard Reiter
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
// Too hard to make concept checks work with this file
|
||||
#ifdef _GLIBCXX_CONCEPT_CHECKS
|
||||
#undef _GLIBCXX_CONCEPT_CHECKS
|
||||
#endif
|
||||
#ifdef _GLIBCPP_CONCEPT_CHECKS
|
||||
#undef _GLIBCPP_CONCEPT_CHECKS
|
||||
#endif
|
||||
|
||||
#include "GBranch.h"
|
||||
#include "ControlBranch.h"
|
||||
|
||||
#include "BranchList.h"
|
||||
#include "insets/insetbranch.h"
|
||||
|
||||
#include "ghelpers.h"
|
||||
|
||||
#include <libglademm.h>
|
||||
|
||||
using std::string;
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
GBranch::GBranch(Dialog & parent)
|
||||
: GViewCB<ControlBranch, GViewGladeB>(parent, _("Branch Settings"), false)
|
||||
{}
|
||||
|
||||
|
||||
void GBranch::doBuild()
|
||||
{
|
||||
string const gladeName = findGladeFile("branch");
|
||||
xml_ = Gnome::Glade::Xml::create(gladeName);
|
||||
|
||||
xml_->get_widget("Cancel", cancelbutton_);
|
||||
setCancel(cancelbutton_);
|
||||
xml_->get_widget("OK", okbutton_);
|
||||
setOK(okbutton_);
|
||||
|
||||
Gtk::Box * box = NULL;
|
||||
xml_->get_widget("innerbox", box);
|
||||
box->pack_start(branchescombo_, true, true, 0);
|
||||
box->show_all();
|
||||
|
||||
// Set shortcut target
|
||||
xml_->get_widget("BranchesLabel", brancheslabel_);
|
||||
brancheslabel_->set_mnemonic_widget(branchescombo_);
|
||||
|
||||
// Single click in branches list
|
||||
branchescombo_.signal_changed().connect(
|
||||
sigc::mem_fun(*this, &GBranch::selection_changed));
|
||||
|
||||
}
|
||||
|
||||
|
||||
void GBranch::update()
|
||||
{
|
||||
applylock_ = true;
|
||||
|
||||
typedef BranchList::const_iterator const_iterator;
|
||||
|
||||
BranchList const branchlist = controller().branchlist();
|
||||
string const cur_branch = controller().params().branch;
|
||||
|
||||
// FIXME: deprecated in favor of clear_items since gtkmm 2.8
|
||||
branchescombo_.clear();
|
||||
|
||||
const_iterator const begin = branchlist.begin();
|
||||
const_iterator const end = branchlist.end();
|
||||
for (const_iterator it = begin; it != end; ++it)
|
||||
branchescombo_.append_text(it->getBranch());
|
||||
branchescombo_.set_active_text(cur_branch);
|
||||
|
||||
applylock_ = false;
|
||||
}
|
||||
|
||||
|
||||
void GBranch::apply()
|
||||
{
|
||||
controller().params().branch = branchescombo_.get_active_text();;
|
||||
}
|
||||
|
||||
|
||||
void GBranch::selection_changed()
|
||||
{
|
||||
if (!applylock_)
|
||||
bc().valid(true);
|
||||
}
|
||||
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
@ -1,49 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file GBranch.h
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Bernhard Reiter
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#ifndef GBRANCH_H
|
||||
#define GBRANCH_H
|
||||
|
||||
#include "GViewBase.h"
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
class ControlBranch;
|
||||
|
||||
/** This class provides a GTK+ implementation of the Branch Dialog.
|
||||
*/
|
||||
class GBranch : public GViewCB<ControlBranch, GViewGladeB> {
|
||||
public:
|
||||
GBranch(Dialog & parent);
|
||||
private:
|
||||
virtual void apply();
|
||||
virtual void doBuild();
|
||||
virtual void update();
|
||||
|
||||
/// enables the apply button if a synonym is selected from the list
|
||||
void selection_changed();
|
||||
|
||||
/** apply() won't act when this is true.
|
||||
true if no text is selected when the Branch dialog is opened
|
||||
*/
|
||||
bool applylock_;
|
||||
|
||||
Gtk::Button * cancelbutton_;
|
||||
Gtk::Button * okbutton_;
|
||||
Gtk::Label * brancheslabel_;
|
||||
Gtk::ComboBoxText branchescombo_;
|
||||
};
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#endif // GBRANCH_H
|
@ -1,138 +0,0 @@
|
||||
/**
|
||||
* \file GChanges.C
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author John Spray
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
// Too hard to make concept checks work with this file
|
||||
#ifdef _GLIBCXX_CONCEPT_CHECKS
|
||||
#undef _GLIBCXX_CONCEPT_CHECKS
|
||||
#endif
|
||||
#ifdef _GLIBCPP_CONCEPT_CHECKS
|
||||
#undef _GLIBCPP_CONCEPT_CHECKS
|
||||
#endif
|
||||
|
||||
#include "GChanges.h"
|
||||
#include "ControlChanges.h"
|
||||
|
||||
#include "ghelpers.h"
|
||||
|
||||
using std::string;
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
GChanges::GChanges(Dialog & parent)
|
||||
: GViewCB<ControlChanges, GViewGladeB>(parent, _("Merge Changes"), false)
|
||||
{}
|
||||
|
||||
|
||||
void GChanges::doBuild()
|
||||
{
|
||||
string const gladeName = findGladeFile("changes");
|
||||
xml_ = Gnome::Glade::Xml::create(gladeName);
|
||||
|
||||
xml_->get_widget("Message", messagelabel_);
|
||||
|
||||
Gtk::Button * closebutton;
|
||||
xml_->get_widget("Close", closebutton);
|
||||
setCancel(closebutton);
|
||||
|
||||
xml_->get_widget("Accept", acceptbutton_);
|
||||
bcview().addReadOnly(acceptbutton_);
|
||||
acceptbutton_->signal_clicked().connect(
|
||||
sigc::mem_fun(*this, &GChanges::onAccept));
|
||||
|
||||
xml_->get_widget("Reject", rejectbutton_);
|
||||
bcview().addReadOnly(rejectbutton_);
|
||||
rejectbutton_->signal_clicked().connect(
|
||||
sigc::mem_fun(*this, &GChanges::onReject));
|
||||
|
||||
xml_->get_widget("Next", nextbutton_);
|
||||
nextbutton_->signal_clicked().connect(
|
||||
sigc::mem_fun(*this, &GChanges::onNext));
|
||||
}
|
||||
|
||||
|
||||
void GChanges::update()
|
||||
{
|
||||
if (controller().changed())
|
||||
promptChange();
|
||||
else
|
||||
promptDismiss();
|
||||
}
|
||||
|
||||
|
||||
void GChanges::onAccept()
|
||||
{
|
||||
if (controller().accept()) {
|
||||
promptChange();
|
||||
} else {
|
||||
promptDismiss();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void GChanges::onReject()
|
||||
{
|
||||
if (controller().reject()) {
|
||||
promptChange();
|
||||
} else {
|
||||
promptDismiss();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void GChanges::onNext()
|
||||
{
|
||||
if (controller().find()) {
|
||||
promptChange();
|
||||
} else {
|
||||
promptDismiss();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void GChanges::promptChange()
|
||||
{
|
||||
docstring const header = _("Accept highlighted change?");
|
||||
docstring author = controller().getChangeAuthor();
|
||||
docstring date = controller().getChangeDate();
|
||||
if(author.empty())
|
||||
author = _("unknown author");
|
||||
if(date.empty())
|
||||
date = _("unknown date");
|
||||
|
||||
// FIXME UNICODE in set_markup():
|
||||
messagelabel_->set_markup("<big><b>" + lyx::to_utf8(header) +
|
||||
"</b></big>\n\nChanged by <b>" + lyx::to_utf8(author)
|
||||
+ "</b> on <b>" + lyx::to_utf8(date) + "</b>");
|
||||
|
||||
acceptbutton_->set_sensitive(true && !readOnly());
|
||||
rejectbutton_->set_sensitive(true && !readOnly());
|
||||
nextbutton_->set_sensitive(true);
|
||||
}
|
||||
|
||||
|
||||
void GChanges::promptDismiss()
|
||||
{
|
||||
string const header = lyx::to_utf8(_("Done merging changes"));
|
||||
|
||||
messagelabel_->set_markup("<big><b>" + header +
|
||||
"</b></big>");
|
||||
|
||||
// Disable all buttons but close.
|
||||
acceptbutton_->set_sensitive(false);
|
||||
rejectbutton_->set_sensitive(false);
|
||||
nextbutton_->set_sensitive(false);
|
||||
}
|
||||
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
@ -1,54 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file GChanges.h
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author John Spray
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#ifndef GCHANGES_H
|
||||
#define GCHANGES_H
|
||||
|
||||
#include "GViewBase.h"
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
class ControlChanges;
|
||||
|
||||
/**
|
||||
* This class provides a GTK+ implementation of the Merge Changes Dialog.
|
||||
*/
|
||||
class GChanges
|
||||
: public GViewCB<ControlChanges, GViewGladeB> {
|
||||
public:
|
||||
GChanges(Dialog &);
|
||||
|
||||
private:
|
||||
/// not needed.
|
||||
virtual void apply() {}
|
||||
/// Build the dialog
|
||||
virtual void doBuild();
|
||||
/// update the dialog
|
||||
virtual void update();
|
||||
|
||||
void onAccept();
|
||||
void onReject();
|
||||
void onNext();
|
||||
|
||||
void promptChange();
|
||||
void promptDismiss();
|
||||
|
||||
Gtk::Label * messagelabel_;
|
||||
Gtk::Button * nextbutton_;
|
||||
Gtk::Button * acceptbutton_;
|
||||
Gtk::Button * rejectbutton_;
|
||||
};
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#endif // GCHANGES_H
|
@ -1,240 +0,0 @@
|
||||
/**
|
||||
* \file GCharacter.C
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author John Spray
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
// Too hard to make concept checks work with this file
|
||||
#ifdef _GLIBCXX_CONCEPT_CHECKS
|
||||
#undef _GLIBCXX_CONCEPT_CHECKS
|
||||
#endif
|
||||
#ifdef _GLIBCPP_CONCEPT_CHECKS
|
||||
#undef _GLIBCPP_CONCEPT_CHECKS
|
||||
#endif
|
||||
|
||||
#include "GCharacter.h"
|
||||
#include "ghelpers.h"
|
||||
#include "LColor.h"
|
||||
|
||||
#include "controllers/frnt_lang.h"
|
||||
#include "controllers/helper_funcs.h"
|
||||
|
||||
#include "support/lstrings.h"
|
||||
|
||||
#include <libglademm.h>
|
||||
|
||||
using std::vector;
|
||||
using std::string;
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
GCharacter::GCharacter(Dialog & parent)
|
||||
: GViewCB<ControlCharacter, GViewGladeB>(parent, _("Text Style"), false)
|
||||
{}
|
||||
|
||||
|
||||
void GCharacter::PopulateComboBox(Gtk::ComboBox * combo,
|
||||
vector<string> const & strings)
|
||||
{
|
||||
Glib::RefPtr<Gtk::ListStore> model = Gtk::ListStore::create(cols_);
|
||||
vector<string>::const_iterator it = strings.begin();
|
||||
vector<string>::const_iterator end = strings.end();
|
||||
for(; it != end; ++it)
|
||||
(*model->append())[stringcol_] = *it;
|
||||
|
||||
combo->set_model(model);
|
||||
Gtk::CellRendererText * cell = Gtk::manage(new Gtk::CellRendererText);
|
||||
combo->pack_start(*cell, true);
|
||||
combo->add_attribute(*cell,"text",0);
|
||||
}
|
||||
|
||||
|
||||
void GCharacter::doBuild()
|
||||
{
|
||||
string const gladeName = findGladeFile("character");
|
||||
xml_ = Gnome::Glade::Xml::create(gladeName);
|
||||
Gtk::Button * button;
|
||||
|
||||
// Manage the ok, apply and cancel/close buttons
|
||||
xml_->get_widget("Ok", button);
|
||||
setOK(button);
|
||||
xml_->get_widget("Apply", button);
|
||||
setApply(button);
|
||||
xml_->get_widget("Cancel", button);
|
||||
setCancel(button);
|
||||
|
||||
xml_->get_widget("ToggleAll", toggleallcheck_);
|
||||
|
||||
// Get combobox addresses
|
||||
xml_->get_widget("Family", familycombo_);
|
||||
xml_->get_widget("Series", seriescombo_);
|
||||
xml_->get_widget("Shape", shapecombo_);
|
||||
xml_->get_widget("Color", colorcombo_);
|
||||
xml_->get_widget("Language", languagecombo_);
|
||||
xml_->get_widget("Size", sizecombo_);
|
||||
xml_->get_widget("Misc", misccombo_);
|
||||
|
||||
// Don't let the user change anything for read only documents
|
||||
bcview().addReadOnly(familycombo_);
|
||||
bcview().addReadOnly(seriescombo_);
|
||||
bcview().addReadOnly(shapecombo_);
|
||||
bcview().addReadOnly(colorcombo_);
|
||||
bcview().addReadOnly(languagecombo_);
|
||||
bcview().addReadOnly(sizecombo_);
|
||||
bcview().addReadOnly(misccombo_);
|
||||
bcview().addReadOnly(toggleallcheck_);
|
||||
|
||||
// Caption/identifier pairs for the parameters
|
||||
vector<FamilyPair> const family = getFamilyData();
|
||||
vector<SeriesPair> const series = getSeriesData();
|
||||
vector<ShapePair> const shape = getShapeData();
|
||||
vector<SizePair> const size = getSizeData();
|
||||
vector<BarPair> const bar = getBarData();
|
||||
vector<ColorPair> const color = getColorData();
|
||||
vector<LanguagePair> const language = getLanguageData(true);
|
||||
|
||||
// Store the identifiers for later
|
||||
family_ = getSecond(family);
|
||||
series_ = getSecond(series);
|
||||
shape_ = getSecond(shape);
|
||||
size_ = getSecond(size);
|
||||
bar_ = getSecond(bar);
|
||||
color_ = getSecond(color);
|
||||
lang_ = getSecond(language);
|
||||
|
||||
// Setup the columnrecord we use for all combos
|
||||
cols_.add(stringcol_);
|
||||
// Load the captions into the comboboxes
|
||||
PopulateComboBox(familycombo_, getFirst(family));
|
||||
PopulateComboBox(seriescombo_, getFirst(series));
|
||||
PopulateComboBox(shapecombo_, getFirst(shape));
|
||||
PopulateComboBox(sizecombo_, getFirst(size));
|
||||
PopulateComboBox(misccombo_, getFirst(bar));
|
||||
PopulateComboBox(colorcombo_, getFirst(color));
|
||||
PopulateComboBox(languagecombo_, getFirst(language));
|
||||
|
||||
/* We use a table so that people with decent size screens don't
|
||||
* have to scroll. However, this risks the popup being too wide
|
||||
* for people with small screens, and it doesn't scroll horizontally.
|
||||
* Hopefully this is not too wide */
|
||||
languagecombo_->set_wrap_width(3);
|
||||
|
||||
// We have to update *before* the signals are connected
|
||||
update();
|
||||
|
||||
familycombo_->signal_changed().connect(
|
||||
sigc::mem_fun(*this, &GCharacter::onChange));
|
||||
seriescombo_->signal_changed().connect(
|
||||
sigc::mem_fun(*this, &GCharacter::onChange));
|
||||
shapecombo_->signal_changed().connect(
|
||||
sigc::mem_fun(*this, &GCharacter::onChange));
|
||||
sizecombo_->signal_changed().connect(
|
||||
sigc::mem_fun(*this, &GCharacter::onChange));
|
||||
misccombo_->signal_changed().connect(
|
||||
sigc::mem_fun(*this, &GCharacter::onChange));
|
||||
colorcombo_->signal_changed().connect(
|
||||
sigc::mem_fun(*this, &GCharacter::onChange));
|
||||
languagecombo_->signal_changed().connect(
|
||||
sigc::mem_fun(*this, &GCharacter::onChange));
|
||||
}
|
||||
|
||||
|
||||
void GCharacter::apply()
|
||||
{
|
||||
int pos = familycombo_->get_active_row_number();
|
||||
controller().setFamily(family_[pos]);
|
||||
|
||||
pos = seriescombo_->get_active_row_number();
|
||||
controller().setSeries(series_[pos]);
|
||||
|
||||
pos = shapecombo_->get_active_row_number();
|
||||
controller().setShape(shape_[pos]);
|
||||
|
||||
pos = sizecombo_->get_active_row_number();
|
||||
controller().setSize(size_[pos]);
|
||||
|
||||
pos = misccombo_->get_active_row_number();
|
||||
controller().setBar(bar_[pos]);
|
||||
|
||||
pos = colorcombo_->get_active_row_number();
|
||||
controller().setColor(color_[pos]);
|
||||
|
||||
pos = languagecombo_->get_active_row_number();
|
||||
controller().setLanguage(lang_[pos]);
|
||||
|
||||
bool const toggleall = toggleallcheck_->get_active();
|
||||
controller().setToggleAll(toggleall);
|
||||
}
|
||||
|
||||
|
||||
void GCharacter::update()
|
||||
{
|
||||
int pos = int(findPos(family_, controller().getFamily()));
|
||||
familycombo_->set_active(pos);
|
||||
|
||||
pos = int(findPos(series_, controller().getSeries()));
|
||||
seriescombo_->set_active(pos);
|
||||
|
||||
pos = int(findPos(shape_, controller().getShape()));
|
||||
shapecombo_->set_active(pos);
|
||||
|
||||
pos = int(findPos(size_, controller().getSize()));
|
||||
sizecombo_->set_active(pos);
|
||||
|
||||
pos = int(findPos(bar_, controller().getBar()));
|
||||
misccombo_->set_active(pos);
|
||||
|
||||
pos = int(findPos(color_, controller().getColor()));
|
||||
colorcombo_->set_active(pos);
|
||||
|
||||
pos = int(findPos(lang_, controller().getLanguage()));
|
||||
languagecombo_->set_active(pos);
|
||||
|
||||
toggleallcheck_->set_active(controller().getToggleAll());
|
||||
}
|
||||
|
||||
|
||||
void GCharacter::onChange()
|
||||
{
|
||||
ButtonPolicy::SMInput activate = ButtonPolicy::SMI_NOOP;
|
||||
|
||||
int pos = familycombo_->get_active_row_number();
|
||||
if (family_[pos] != LyXFont::IGNORE_FAMILY)
|
||||
activate = ButtonPolicy::SMI_VALID;
|
||||
|
||||
pos = seriescombo_->get_active_row_number();
|
||||
if (series_[pos] != LyXFont::IGNORE_SERIES)
|
||||
activate = ButtonPolicy::SMI_VALID;
|
||||
|
||||
pos = shapecombo_->get_active_row_number();
|
||||
if (shape_[pos] != LyXFont::IGNORE_SHAPE)
|
||||
activate = ButtonPolicy::SMI_VALID;
|
||||
|
||||
pos = sizecombo_->get_active_row_number();
|
||||
if (size_[pos] != LyXFont::IGNORE_SIZE)
|
||||
activate = ButtonPolicy::SMI_VALID;
|
||||
|
||||
pos = misccombo_->get_active_row_number();
|
||||
if (bar_[pos] != IGNORE)
|
||||
activate = ButtonPolicy::SMI_VALID;
|
||||
|
||||
pos = colorcombo_->get_active_row_number();
|
||||
if (color_[pos] != LColor::ignore)
|
||||
activate = ButtonPolicy::SMI_VALID;
|
||||
|
||||
pos = languagecombo_->get_active_row_number();
|
||||
if (lang_[pos] != "No change")
|
||||
activate = ButtonPolicy::SMI_VALID;
|
||||
|
||||
bc().input(activate);
|
||||
}
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
@ -1,74 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file GCharacter.h
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author John Spray
|
||||
* Based on version from former xforms frontend
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#ifndef GCHARACTER_H
|
||||
#define GCHARACTER_H
|
||||
|
||||
#include "GViewBase.h"
|
||||
#include "ControlCharacter.h" // for ControlCharacter enum
|
||||
|
||||
struct LColor_color;
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
/**
|
||||
* This class provides a GTK+ implementation of the Character Dialog.
|
||||
* The character dialog allows users to change the character settings
|
||||
* in their documents.
|
||||
*/
|
||||
class GCharacter
|
||||
: public GViewCB<ControlCharacter, GViewGladeB> {
|
||||
public:
|
||||
///
|
||||
GCharacter(Dialog &);
|
||||
private:
|
||||
/// Apply from dialog
|
||||
virtual void apply();
|
||||
|
||||
/// Build the dialog
|
||||
virtual void doBuild();
|
||||
|
||||
/// Update the dialog.
|
||||
virtual void update();
|
||||
|
||||
void PopulateComboBox(Gtk::ComboBox * combo,
|
||||
std::vector<std::string> const & strings);
|
||||
|
||||
std::vector<LyXFont::FONT_FAMILY> family_;
|
||||
std::vector<LyXFont::FONT_SERIES> series_;
|
||||
std::vector<LyXFont::FONT_SHAPE> shape_;
|
||||
std::vector<LyXFont::FONT_SIZE> size_;
|
||||
std::vector<FONT_STATE> bar_;
|
||||
std::vector<LColor_color> color_;
|
||||
std::vector<std::string> lang_;
|
||||
|
||||
Gtk::ComboBox * familycombo_;
|
||||
Gtk::ComboBox * seriescombo_;
|
||||
Gtk::ComboBox * shapecombo_;
|
||||
Gtk::ComboBox * colorcombo_;
|
||||
Gtk::ComboBox * languagecombo_;
|
||||
Gtk::ComboBox * sizecombo_;
|
||||
Gtk::ComboBox * misccombo_;
|
||||
|
||||
Gtk::TreeModelColumn<Glib::ustring> stringcol_;
|
||||
Gtk::TreeModel::ColumnRecord cols_;
|
||||
|
||||
Gtk::CheckButton * toggleallcheck_;
|
||||
|
||||
void onChange();
|
||||
};
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#endif
|
@ -1,661 +0,0 @@
|
||||
/**
|
||||
* \file GCitation.C
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Bernhard Reiter
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
// Too hard to make concept checks work with this file
|
||||
#ifdef _GLIBCXX_CONCEPT_CHECKS
|
||||
#undef _GLIBCXX_CONCEPT_CHECKS
|
||||
#endif
|
||||
#ifdef _GLIBCPP_CONCEPT_CHECKS
|
||||
#undef _GLIBCPP_CONCEPT_CHECKS
|
||||
#endif
|
||||
|
||||
#include "GCitation.h"
|
||||
#include "ControlCitation.h"
|
||||
#include "ghelpers.h"
|
||||
|
||||
#include "bufferparams.h"
|
||||
|
||||
#include "support/lstrings.h"
|
||||
|
||||
#include <libglademm.h>
|
||||
|
||||
using std::string;
|
||||
using std::vector;
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
class bibModelColumns : public Gtk::TreeModel::ColumnRecord
|
||||
{
|
||||
public:
|
||||
|
||||
bibModelColumns() { add(name); add(cite); add(bib_order); add(info); }
|
||||
|
||||
Gtk::TreeModelColumn<Glib::ustring> name;
|
||||
Gtk::TreeModelColumn<bool> cite;
|
||||
Gtk::TreeModelColumn<int> bib_order;
|
||||
Gtk::TreeModelColumn<Glib::ustring> info;
|
||||
};
|
||||
|
||||
bibModelColumns bibColumns;
|
||||
|
||||
class styleModelColumns : public Gtk::TreeModel::ColumnRecord
|
||||
{
|
||||
public:
|
||||
|
||||
styleModelColumns() { add(name); }
|
||||
|
||||
Gtk::TreeModelColumn<Glib::ustring> name;
|
||||
};
|
||||
|
||||
bool GCitation::bib_visible(const Gtk::TreeModel::const_iterator& iter)
|
||||
{
|
||||
if (iter)
|
||||
return !((*iter)[bibColumns.cite]);
|
||||
return true;
|
||||
}
|
||||
|
||||
styleModelColumns styleColumns;
|
||||
|
||||
|
||||
GCitation::GCitation(Dialog & parent)
|
||||
: GViewCB<ControlCitation, GViewGladeB>(parent, _("Citation"), false)
|
||||
{}
|
||||
|
||||
|
||||
void GCitation::doBuild()
|
||||
{
|
||||
string const gladeName = findGladeFile("citation");
|
||||
xml_ = Gnome::Glade::Xml::create(gladeName);
|
||||
|
||||
xml_->get_widget("Restore", restorebutton_);
|
||||
setRestore(restorebutton_);
|
||||
xml_->get_widget("Cancel", cancelbutton_);
|
||||
setCancel(cancelbutton_);
|
||||
xml_->get_widget("Apply", applybutton_);
|
||||
setApply(applybutton_);
|
||||
xml_->get_widget("OK", okbutton_);
|
||||
setOK(okbutton_);
|
||||
|
||||
xml_->get_widget("Remove", removebutton_);
|
||||
xml_->get_widget("Add", addbutton_);
|
||||
xml_->get_widget("Back", backbutton_);
|
||||
xml_->get_widget("Forward", forwardbutton_);
|
||||
xml_->get_widget("Up", upbutton_);
|
||||
xml_->get_widget("Down", downbutton_);
|
||||
|
||||
xml_->get_widget("CiteKeys", citekeysview_);
|
||||
xml_->get_widget("BibKeys", bibkeysview_);
|
||||
xml_->get_widget("Info", infoview_);
|
||||
xml_->get_widget("CaseSensitive", casecheck_);
|
||||
|
||||
xml_->get_widget("SearchString", findentry_);
|
||||
xml_->get_widget("CaseSensitive", casecheck_);
|
||||
xml_->get_widget("RegularExpression", regexpcheck_);
|
||||
|
||||
xml_->get_widget("StyleLabel", stylelabel_);
|
||||
xml_->get_widget("Style", stylecombo_);
|
||||
xml_->get_widget("TextBeforeLabel", beforelabel_);
|
||||
xml_->get_widget("TextBefore", beforeentry_);
|
||||
xml_->get_widget("TextAfter", afterentry_);
|
||||
xml_->get_widget("FullAuthorList", authorcheck_);
|
||||
xml_->get_widget("ForceUpperCase", uppercasecheck_);
|
||||
|
||||
info_ = Gtk::TextBuffer::create();
|
||||
infoview_->set_buffer(info_);
|
||||
|
||||
allListStore_ = Gtk::ListStore::create(bibColumns);
|
||||
|
||||
Gtk::TreeModel::Path rootpath; //required for gtkmm < 2.6
|
||||
|
||||
// FIXME UNICODE
|
||||
citekeysview_->append_column(lyx::to_utf8(_("CiteKeys")), bibColumns.name);
|
||||
citeFilter_ = Gtk::TreeModelFilter::create(allListStore_, rootpath);
|
||||
citeFilter_->set_visible_column(bibColumns.cite);
|
||||
citekeysview_->set_model(citeFilter_);
|
||||
citeselection_ = citekeysview_->get_selection();
|
||||
|
||||
// FIXME UNICODE
|
||||
bibkeysview_->append_column(lyx::to_utf8(_("BibKeys")), bibColumns.name);
|
||||
bibSort_ = Gtk::TreeModelSort::create(allListStore_);
|
||||
bibSort_->set_sort_column(bibColumns.bib_order, Gtk::SORT_ASCENDING );
|
||||
bibFilter_ = Gtk::TreeModelFilter::create(bibSort_, rootpath);
|
||||
bibFilter_->set_visible_func(&GCitation::bib_visible);
|
||||
bibkeysview_->set_model(bibFilter_);
|
||||
bibselection_ = bibkeysview_->get_selection();
|
||||
|
||||
styleStore_ = Gtk::ListStore::create(styleColumns);
|
||||
stylecombo_->set_model(styleStore_);
|
||||
|
||||
upbutton_->signal_clicked().connect(
|
||||
sigc::mem_fun(*this, &GCitation::up));
|
||||
downbutton_->signal_clicked().connect(
|
||||
sigc::mem_fun(*this, &GCitation::down));
|
||||
addbutton_->signal_clicked().connect(
|
||||
sigc::mem_fun(*this, &GCitation::add));
|
||||
removebutton_->signal_clicked().connect(
|
||||
sigc::mem_fun(*this, &GCitation::remove));
|
||||
backbutton_->signal_clicked().connect(
|
||||
sigc::mem_fun(*this, &GCitation::previous));
|
||||
forwardbutton_->signal_clicked().connect(
|
||||
sigc::mem_fun(*this, &GCitation::next));
|
||||
|
||||
findentry_->signal_changed().connect(
|
||||
sigc::mem_fun(*this, &GCitation::set_search_buttons));
|
||||
|
||||
bibkeysview_->signal_row_activated().connect(
|
||||
sigc::mem_fun(*this, &GCitation::bibkeysview_activated));
|
||||
bibselection_->signal_changed().connect(
|
||||
sigc::mem_fun(*this, &GCitation::bib_selected));
|
||||
|
||||
citeselection_->signal_changed().connect(
|
||||
sigc::mem_fun(*this, &GCitation::cite_selected));
|
||||
|
||||
beforeentry_->signal_changed().connect(
|
||||
sigc::mem_fun(*this, &GCitation::enable_apply));
|
||||
afterentry_->signal_changed().connect(
|
||||
sigc::mem_fun(*this, &GCitation::enable_apply));
|
||||
stylecombo_->signal_changed().connect(
|
||||
sigc::mem_fun(*this, &GCitation::enable_apply));
|
||||
authorcheck_->signal_toggled().connect(
|
||||
sigc::mem_fun(*this, &GCitation::enable_apply));
|
||||
uppercasecheck_->signal_toggled().connect(
|
||||
sigc::mem_fun(*this, &GCitation::enable_apply));
|
||||
|
||||
}
|
||||
|
||||
|
||||
void GCitation::enable_apply() {
|
||||
// if we passed !applylock_ directly as an argument, the restore button
|
||||
// would be activated
|
||||
if (!applylock_ && !(citeFilter_->children()).empty())
|
||||
bc().valid(true);
|
||||
}
|
||||
|
||||
|
||||
void GCitation::fill_styles()
|
||||
{
|
||||
if ((citeFilter_->children()).empty()) {
|
||||
stylecombo_->set_sensitive(false);
|
||||
stylelabel_->set_sensitive(false);
|
||||
return;
|
||||
}
|
||||
|
||||
int orig = stylecombo_->get_active_row_number();
|
||||
|
||||
Gtk::TreeModel::iterator iter = citeselection_->get_selected();
|
||||
if(!iter)
|
||||
iter = (citeFilter_->children()).begin();
|
||||
string key = Glib::locale_from_utf8((*iter)[bibColumns.name]);
|
||||
|
||||
std::vector<string> const & sty = controller().getCiteStrings(key);
|
||||
|
||||
biblio::CiteEngine const engine = controller().getEngine();
|
||||
bool const basic_engine = engine == biblio::ENGINE_BASIC;
|
||||
|
||||
stylecombo_->set_sensitive(!sty.empty() && !basic_engine);
|
||||
stylelabel_->set_sensitive(!sty.empty() && !basic_engine);
|
||||
|
||||
vector<string>::const_iterator it = sty.begin();
|
||||
vector<string>::const_iterator const end = sty.end();
|
||||
|
||||
styleStore_->clear();
|
||||
for (; it != end; ++it) {
|
||||
Gtk::TreeModel::iterator iter2 = styleStore_->append();
|
||||
(*iter2)[styleColumns.name] = Glib::locale_to_utf8(*it);
|
||||
}
|
||||
|
||||
if(orig)
|
||||
stylecombo_->set_active(orig);
|
||||
}
|
||||
|
||||
|
||||
void GCitation::update_style()
|
||||
{
|
||||
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;
|
||||
|
||||
authorcheck_->set_sensitive(natbib_engine);
|
||||
uppercasecheck_->set_sensitive(natbib_engine);
|
||||
beforeentry_->set_sensitive(!basic_engine);
|
||||
beforelabel_->set_sensitive(!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 =
|
||||
std::find(styles.begin(), styles.end(), cs.style);
|
||||
|
||||
//restore the latest natbib style
|
||||
if (style_ >= 0 && Gtk::TreeModel::Children::size_type(style_) <
|
||||
(styleStore_->children()).size())
|
||||
stylecombo_->set_active(style_);
|
||||
else
|
||||
stylecombo_->unset_active();
|
||||
|
||||
authorcheck_->set_active(false);
|
||||
uppercasecheck_->set_active(false);
|
||||
|
||||
if (cit != styles.end()) {
|
||||
stylecombo_->set_active(cit - styles.begin());
|
||||
authorcheck_->set_active(cs.full);
|
||||
uppercasecheck_->set_active(cs.forceUCase);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void GCitation::update_contents()
|
||||
{
|
||||
// Make a list of all available bibliography keys
|
||||
biblio::InfoMap const & theMap = controller().bibkeysInfo();
|
||||
std::vector<std::string> bibkeys = biblio::getKeys(theMap);
|
||||
std::vector<std::string> citekeys = support::getVectorFromString(
|
||||
controller().params().getContents());
|
||||
|
||||
int bib_order = 0;
|
||||
allListStore_->clear();
|
||||
|
||||
for (std::vector<std::string>::const_iterator cit = bibkeys.begin();
|
||||
cit != bibkeys.end(); ++cit) {
|
||||
|
||||
Gtk::TreeModel::iterator iter = allListStore_->append();
|
||||
// ENCODING, FIXME: assuming ISO-8859 only for key name and info fields
|
||||
// This is a hack to avoid a crash when populating the dialog from bibtex
|
||||
// files containing non-ASCII characters.
|
||||
(*iter)[bibColumns.name] = Glib::convert(*cit, "UTF-8", "ISO-8859-1");
|
||||
(*iter)[bibColumns.cite] = false; //reset state
|
||||
(*iter)[bibColumns.bib_order] = ++bib_order;
|
||||
(*iter)[bibColumns.info] = Glib::convert(biblio::getInfo(theMap,*cit), "UTF-8", "ISO-8859-1");
|
||||
}
|
||||
|
||||
// Now mark cite keys by setting their bibColumns.cite property to true
|
||||
// so they will be filtered and displayed in citekeysview_
|
||||
for (std::vector<std::string>::const_iterator ccit = citekeys.begin();
|
||||
ccit != citekeys.end(); ++ccit) {
|
||||
|
||||
bool found = false;
|
||||
for (Gtk::TreeModel::const_iterator cbit =
|
||||
(allListStore_->children()).begin();
|
||||
cbit != (allListStore_->children()).end(); ++cbit) {
|
||||
|
||||
if ((*cbit)[bibColumns.name] == (*ccit)) {
|
||||
found = true;
|
||||
(*cbit)[bibColumns.cite] = true;
|
||||
allListStore_->move(cbit,
|
||||
(allListStore_->children()).end());
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
// It wasn't in the list of keys, but to support
|
||||
// working on a document away from the bibtex file
|
||||
// we should keep it anyway.
|
||||
Gtk::TreeModel::iterator iter = allListStore_->append();
|
||||
(*iter)[bibColumns.name] = Glib::convert(*ccit, "UTF-8", "ISO-8859-1");
|
||||
(*iter)[bibColumns.cite] = true;
|
||||
(*iter)[bibColumns.bib_order] = ++bib_order;
|
||||
(*iter)[bibColumns.info] = Glib::convert(
|
||||
biblio::getInfo(theMap,*ccit), "UTF-8", "ISO-8859-1");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void GCitation::update()
|
||||
{
|
||||
applylock_ = true;
|
||||
|
||||
update_contents();
|
||||
|
||||
info_->set_text(""); // Clear Info field
|
||||
|
||||
// Initialise style tab widgets
|
||||
beforeentry_->set_text(Glib::locale_to_utf8(
|
||||
controller().params().getSecOptions()));
|
||||
afterentry_->set_text(Glib::locale_to_utf8(
|
||||
controller().params().getOptions()));
|
||||
|
||||
fill_styles();
|
||||
update_style();
|
||||
|
||||
// Deactivate all buttons
|
||||
upbutton_->set_sensitive(false);
|
||||
downbutton_->set_sensitive(false);
|
||||
removebutton_->set_sensitive(false);
|
||||
addbutton_->set_sensitive(false);
|
||||
|
||||
set_search_buttons();
|
||||
applylock_ = false;
|
||||
}
|
||||
|
||||
|
||||
void GCitation::up()
|
||||
{
|
||||
Gtk::TreeModel::iterator src =
|
||||
citeselection_->get_selected();
|
||||
Gtk::TreeModel::iterator dest = src;
|
||||
|
||||
if(--dest == (citeFilter_->children()).begin())
|
||||
upbutton_->set_sensitive(false);
|
||||
|
||||
src = citeFilter_->convert_iter_to_child_iter(src);
|
||||
dest = citeFilter_->convert_iter_to_child_iter(dest);
|
||||
allListStore_->iter_swap(src, dest);
|
||||
|
||||
bc().valid(true);
|
||||
downbutton_->set_sensitive(true);
|
||||
}
|
||||
|
||||
|
||||
void GCitation::down()
|
||||
{
|
||||
Gtk::TreeModel::iterator src =
|
||||
citeselection_->get_selected();
|
||||
Gtk::TreeModel::iterator dest = src;
|
||||
// Avoid slow operator-- by using an extra variable
|
||||
Gtk::TreeModel::iterator endtest = ++dest;
|
||||
|
||||
if(++endtest == (citeFilter_->children()).end())
|
||||
downbutton_->set_sensitive(false);
|
||||
|
||||
src = citeFilter_->convert_iter_to_child_iter(src);
|
||||
dest = citeFilter_->convert_iter_to_child_iter(dest);
|
||||
allListStore_->iter_swap(src, dest);
|
||||
|
||||
bc().valid(true);
|
||||
upbutton_->set_sensitive(true);
|
||||
}
|
||||
|
||||
|
||||
void GCitation::add()
|
||||
{
|
||||
Gtk::TreeModel::iterator iter = bibselection_->get_selected();
|
||||
|
||||
if (iter) {
|
||||
Gtk::TreeModel::iterator next_iter = iter;
|
||||
|
||||
// Select the right key in bibkeysview_ afterwards
|
||||
if(++next_iter == (bibFilter_->children()).end()) {
|
||||
if(iter != (bibFilter_->children()).begin()) {
|
||||
bibselection_->select(--iter);
|
||||
++iter;
|
||||
} else { // bibkeysview_ will be left empty...
|
||||
addbutton_->set_sensitive(false);
|
||||
}
|
||||
} else {
|
||||
bibselection_->select(next_iter);
|
||||
}
|
||||
|
||||
iter = bibFilter_->convert_iter_to_child_iter(iter);
|
||||
iter = bibSort_->convert_iter_to_child_iter(iter);
|
||||
(*iter)[bibColumns.cite] = true;
|
||||
|
||||
// Move key to the right position
|
||||
// If a cite key is selected, move bib key to the position above
|
||||
// Otherwise to the last position in citekeysview_
|
||||
Gtk::TreeModel::iterator cite_iter(citeselection_->get_selected());
|
||||
if (cite_iter) {
|
||||
cite_iter = citeFilter_->convert_iter_to_child_iter(cite_iter);
|
||||
} else {
|
||||
cite_iter = (allListStore_->children()).end();
|
||||
}
|
||||
allListStore_->move(iter,cite_iter);
|
||||
|
||||
// Highlight and scroll to newly inserted key
|
||||
iter = citeFilter_->convert_child_iter_to_iter(iter);
|
||||
citeselection_->select(iter);
|
||||
citekeysview_->scroll_to_row(Gtk::TreePath(iter));
|
||||
|
||||
// Set button states
|
||||
removebutton_->set_sensitive(true);
|
||||
set_search_buttons();
|
||||
|
||||
bc().valid(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void GCitation::remove()
|
||||
{
|
||||
Gtk::TreeModel::iterator iter(citeselection_->get_selected());
|
||||
|
||||
if (iter) {
|
||||
Gtk::TreeModel::iterator next_iter(iter);
|
||||
|
||||
if(++next_iter == (citeFilter_->children()).end()) {
|
||||
if(iter != (citeFilter_->children()).begin()) {
|
||||
citeselection_->select(--iter);
|
||||
++iter;
|
||||
bc().valid(true);
|
||||
} else { // citekeysview_ will be left empty...
|
||||
removebutton_->set_sensitive(false);
|
||||
bc().valid(false);
|
||||
}
|
||||
} else {
|
||||
citeselection_->select(next_iter);
|
||||
bc().valid(true);
|
||||
}
|
||||
|
||||
// Get an iterator to allListStore_
|
||||
iter = citeFilter_->convert_iter_to_child_iter(iter);
|
||||
(*iter)[bibColumns.cite] = false;
|
||||
|
||||
// Highlight and scroll to newly inserted key
|
||||
iter = bibSort_->convert_child_iter_to_iter(iter);
|
||||
iter = bibFilter_->convert_child_iter_to_iter(iter);
|
||||
bibselection_->select(iter);
|
||||
bibkeysview_->scroll_to_row(Gtk::TreePath(iter));
|
||||
|
||||
// Set button states
|
||||
addbutton_->set_sensitive(true);
|
||||
set_search_buttons();
|
||||
}
|
||||
}
|
||||
|
||||
void GCitation::cite_selected()
|
||||
{
|
||||
Gtk::TreeModel::iterator iter =
|
||||
citeselection_->get_selected();
|
||||
|
||||
if (iter) {
|
||||
info_->set_text((*iter)[bibColumns.info]);
|
||||
removebutton_->set_sensitive(true);
|
||||
|
||||
// Set sensitivity of Up/Down buttons
|
||||
if (iter == (citeFilter_->children()).begin()) {
|
||||
upbutton_->set_sensitive(false);
|
||||
} else {
|
||||
upbutton_->set_sensitive(true);
|
||||
}
|
||||
|
||||
if (++iter == (citeFilter_->children()).end()) {
|
||||
downbutton_->set_sensitive(false);
|
||||
} else {
|
||||
downbutton_->set_sensitive(true);
|
||||
}
|
||||
|
||||
} else {
|
||||
info_->set_text("");
|
||||
removebutton_->set_sensitive(false);
|
||||
|
||||
// Set sensitivity of Up/Down buttons
|
||||
upbutton_->set_sensitive(false);
|
||||
downbutton_->set_sensitive(false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void GCitation::bib_selected()
|
||||
{
|
||||
Gtk::TreeModel::iterator iter =
|
||||
bibselection_->get_selected();
|
||||
|
||||
if (iter) {
|
||||
info_->set_text((*iter)[bibColumns.info]);
|
||||
addbutton_->set_sensitive(true);
|
||||
} else {
|
||||
info_->set_text("");
|
||||
addbutton_->set_sensitive(false);
|
||||
}
|
||||
}
|
||||
|
||||
void GCitation::apply()
|
||||
{
|
||||
vector<biblio::CiteStyle> const & styles =
|
||||
ControlCitation::getCiteStyles();
|
||||
|
||||
int const choice = stylecombo_->get_active_row_number();
|
||||
style_ = stylecombo_->get_active_row_number();
|
||||
|
||||
bool const full = authorcheck_->get_active();
|
||||
bool const force = uppercasecheck_->get_active();
|
||||
|
||||
string const command =
|
||||
biblio::CitationStyle(styles[choice], full, force)
|
||||
.asLatexStr();
|
||||
|
||||
Gtk::TreeNodeChildren children(citeFilter_->children());
|
||||
|
||||
string citekeys;
|
||||
int i = 0;
|
||||
for (Gtk::TreeModel::const_iterator cit=children.begin();
|
||||
cit!=children.end(); ++cit) {
|
||||
|
||||
string item(support::trim(Glib::convert(
|
||||
static_cast<Glib::ustring>((*cit)[bibColumns.name]),
|
||||
"ISO-8859-1", "UTF-8")));
|
||||
if (item.empty())
|
||||
continue;
|
||||
if (i++ > 0)
|
||||
citekeys += ",";
|
||||
citekeys += item;
|
||||
}
|
||||
|
||||
controller().params().setCmdName(command);
|
||||
controller().params().setContents(citekeys);
|
||||
|
||||
controller().params().setSecOptions(Glib::locale_from_utf8(beforeentry_->get_text()));
|
||||
controller().params().setOptions(Glib::locale_from_utf8(afterentry_->get_text()));
|
||||
|
||||
update();
|
||||
}
|
||||
|
||||
void GCitation::find(biblio::Direction dir)
|
||||
{
|
||||
biblio::InfoMap const & theMap = controller().bibkeysInfo();
|
||||
std::vector<std::string> bibkeys;
|
||||
|
||||
biblio::Search const type = regexpcheck_->get_active()
|
||||
? biblio::REGEX : biblio::SIMPLE;
|
||||
|
||||
vector<string>::const_iterator start;
|
||||
|
||||
bool const casesens = casecheck_->get_active();
|
||||
string const str = Glib::locale_from_utf8(findentry_->get_text());
|
||||
|
||||
Gtk::TreeModel::iterator iter;
|
||||
Gtk::TreeModel::Children::difference_type sel = 0;
|
||||
|
||||
for (iter = (bibFilter_->children()).begin();
|
||||
iter != (bibFilter_->children()).end(); ++iter) {
|
||||
|
||||
bibkeys.push_back(Glib::locale_from_utf8(
|
||||
(*iter)[bibColumns.name]));
|
||||
}
|
||||
|
||||
iter = bibselection_->get_selected();
|
||||
if (iter)
|
||||
sel = std::distance(
|
||||
(bibFilter_->children()).begin(), iter);
|
||||
|
||||
start = bibkeys.begin();
|
||||
|
||||
if (sel >= 0 &&
|
||||
Gtk::TreeModel::Children::size_type(sel) < bibkeys.size())
|
||||
std::advance(start, sel);
|
||||
|
||||
// Find the NEXT instance...
|
||||
if (dir == biblio::FORWARD)
|
||||
++start;
|
||||
|
||||
vector<string>::const_iterator cit =
|
||||
biblio::searchKeys(theMap, bibkeys, str,
|
||||
start, type, dir, casesens);
|
||||
|
||||
if (cit == bibkeys.end()) {
|
||||
if (dir == biblio::FORWARD) {
|
||||
start = bibkeys.begin();
|
||||
}
|
||||
else {
|
||||
start = bibkeys.end();
|
||||
--start;
|
||||
}
|
||||
|
||||
cit = biblio::searchKeys(theMap, bibkeys, str,
|
||||
start, type, dir, casesens);
|
||||
|
||||
if (cit == bibkeys.end()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
vector<string>::const_iterator bibstart = bibkeys.begin();
|
||||
vector<string>::difference_type const found =
|
||||
std::distance(bibstart, cit);
|
||||
if (found == sel)
|
||||
return;
|
||||
|
||||
start = cit;
|
||||
iter = (bibFilter_->children()).begin();
|
||||
std::advance(iter, found);
|
||||
|
||||
// Highlight and scroll to the key that was found
|
||||
bibselection_->select(iter);
|
||||
bibkeysview_->set_cursor(Gtk::TreePath(iter));
|
||||
bibkeysview_->scroll_to_row(Gtk::TreePath(iter));
|
||||
bib_selected();
|
||||
}
|
||||
|
||||
void GCitation::set_search_buttons()
|
||||
{
|
||||
bool val = findentry_->get_text_length()
|
||||
&& !(bibFilter_->children()).empty();
|
||||
backbutton_->set_sensitive(val);
|
||||
forwardbutton_->set_sensitive(val);
|
||||
}
|
||||
|
||||
void GCitation::previous()
|
||||
{
|
||||
find(biblio::BACKWARD);
|
||||
}
|
||||
|
||||
|
||||
void GCitation::next()
|
||||
{
|
||||
find(biblio::FORWARD);
|
||||
}
|
||||
|
||||
|
||||
void GCitation::bibkeysview_activated(const Gtk::TreeModel::Path&, Gtk::TreeViewColumn*)
|
||||
{
|
||||
add();
|
||||
}
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
@ -1,140 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file GCitation.h
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Bernhard Reiter
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#ifndef GCITATION_H
|
||||
#define GCITATION_H
|
||||
|
||||
#include "GViewBase.h"
|
||||
|
||||
#include "ControlCitation.h"
|
||||
|
||||
#include "bufferparams.h"
|
||||
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
class ControlCitation;
|
||||
|
||||
/** This class provides a GTK+ implementation of the Citation Dialog.
|
||||
*/
|
||||
class GCitation : public GViewCB<ControlCitation, GViewGladeB> {
|
||||
public:
|
||||
GCitation(Dialog & parent);
|
||||
private:
|
||||
virtual void apply();
|
||||
virtual void doBuild();
|
||||
virtual void update();
|
||||
|
||||
/// Update dialog before/whilst showing it.
|
||||
virtual void update_contents();
|
||||
|
||||
/// fill the styles combo
|
||||
void fill_styles();
|
||||
|
||||
/// set the styles combo
|
||||
void update_style();
|
||||
|
||||
/// enable the apply button if applylock_ is false
|
||||
void enable_apply();
|
||||
|
||||
/// Move selected inset key up one line in list
|
||||
void up();
|
||||
/// Move selected inset key down one line in list
|
||||
void down();
|
||||
|
||||
/// Add bibliography key to inset key list, remove it from bibliography view
|
||||
void add();
|
||||
/// Remove inset key from list, move it back to bibliography key view
|
||||
void remove();
|
||||
|
||||
/// Find previous occurence of search string in selected key view
|
||||
void previous();
|
||||
/// Find next occurence of search string in selected key view
|
||||
void next();
|
||||
/// Find function, called by previous() and next()
|
||||
void find(biblio::Direction);
|
||||
|
||||
/// Called when inset key is (un)selected
|
||||
void cite_selected();
|
||||
/// Called when bibliography key is (un)selected
|
||||
void bib_selected();
|
||||
|
||||
/** Set previous and next buttons according to state of the search
|
||||
string entry, the radio buttons and the selected keys in the inset
|
||||
and bibliography views.
|
||||
*/
|
||||
inline void set_search_buttons();
|
||||
|
||||
/** Helper function for bibFilter_; true if argument's
|
||||
[bibColumns.cite] is false.
|
||||
*/
|
||||
static inline bool bib_visible(const Gtk::TreeModel::const_iterator&);
|
||||
|
||||
/// Handle adding a bib key by double clicking
|
||||
void bibkeysview_activated(const Gtk::TreeModel::Path&, Gtk::TreeViewColumn*);
|
||||
|
||||
/** apply() won't act when this is true.
|
||||
true if no text is selected when the citation dialog is opened
|
||||
*/
|
||||
bool applylock_;
|
||||
|
||||
/// Last selected stylecombo_ item
|
||||
int style_;
|
||||
|
||||
Gtk::Button * restorebutton_;
|
||||
Gtk::Button * cancelbutton_;
|
||||
Gtk::Button * okbutton_;
|
||||
Gtk::Button * applybutton_;
|
||||
|
||||
Gtk::Button * addbutton_;
|
||||
Gtk::Button * removebutton_;
|
||||
Gtk::Button * backbutton_;
|
||||
Gtk::Button * forwardbutton_;
|
||||
Gtk::Button * upbutton_;
|
||||
Gtk::Button * downbutton_;
|
||||
|
||||
Gtk::TreeView * citekeysview_;
|
||||
Gtk::TreeView * bibkeysview_;
|
||||
|
||||
Gtk::TextView * infoview_;
|
||||
|
||||
Gtk::Entry * findentry_;
|
||||
Gtk::CheckButton * casecheck_;
|
||||
Gtk::CheckButton * regexpcheck_;
|
||||
|
||||
Gtk::Label * stylelabel_;
|
||||
Gtk::ComboBox * stylecombo_;
|
||||
|
||||
Gtk::Label * beforelabel_;
|
||||
Gtk::Entry * beforeentry_;
|
||||
Gtk::Entry * afterentry_;
|
||||
Gtk::CheckButton * authorcheck_;
|
||||
Gtk::CheckButton * uppercasecheck_;
|
||||
|
||||
Glib::RefPtr<Gtk::TextBuffer> info_;
|
||||
|
||||
Glib::RefPtr<Gtk::ListStore> allListStore_;
|
||||
Glib::RefPtr<Gtk::ListStore> styleStore_;
|
||||
|
||||
Glib::RefPtr<Gtk::TreeSelection> citeselection_;
|
||||
Glib::RefPtr<Gtk::TreeSelection> bibselection_;
|
||||
|
||||
Glib::RefPtr<Gtk::TreeModelFilter> citeFilter_;
|
||||
Glib::RefPtr<Gtk::TreeModelFilter> bibFilter_;
|
||||
Glib::RefPtr<Gtk::TreeModelSort> bibSort_;
|
||||
|
||||
};
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#endif // GCITATION_H
|
@ -1,983 +0,0 @@
|
||||
/**
|
||||
* \file GDocument.C
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author John Spray
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
// Too hard to make concept checks work with this file
|
||||
#ifdef _GLIBCXX_CONCEPT_CHECKS
|
||||
#undef _GLIBCXX_CONCEPT_CHECKS
|
||||
#endif
|
||||
#ifdef _GLIBCPP_CONCEPT_CHECKS
|
||||
#undef _GLIBCPP_CONCEPT_CHECKS
|
||||
#endif
|
||||
|
||||
#include "GDocument.h"
|
||||
#include "ghelpers.h"
|
||||
|
||||
#include "ControlDocument.h"
|
||||
#include "controllers/helper_funcs.h"
|
||||
#include "controllers/frnt_lang.h"
|
||||
|
||||
#include "support/lstrings.h"
|
||||
#include "lyxrc.h"
|
||||
|
||||
#include "lyxtextclasslist.h"
|
||||
#include "bufferparams.h"
|
||||
#include "tex-strings.h"
|
||||
#include "language.h"
|
||||
|
||||
using std::string;
|
||||
using std::vector;
|
||||
|
||||
namespace lyx {
|
||||
|
||||
using support::bformat;
|
||||
using support::token;
|
||||
using support::contains;
|
||||
using support::findToken;
|
||||
|
||||
namespace frontend {
|
||||
|
||||
namespace {
|
||||
|
||||
char const * const encodings[] = { "Language Default", "LaTeX default",
|
||||
"latin1", "latin2", "latin3", "latin4", "latin5", "latin9",
|
||||
"koi8-r", "koi8-u", "cp866", "cp1251", "iso88595", "pt154", 0
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
GDocument::GDocument(Dialog & parent)
|
||||
: GViewCB<ControlDocument, GViewGladeB>(parent, _("Document Settings"), false),
|
||||
lang_(getSecond(getLanguageData(false)))
|
||||
{}
|
||||
|
||||
void GDocument::doBuild()
|
||||
{
|
||||
string const gladeName = findGladeFile("document");
|
||||
xml_ = Gnome::Glade::Xml::create(gladeName);
|
||||
|
||||
// Manage the action area buttons
|
||||
Gtk::Button * button;
|
||||
xml_->get_widget("Cancel", button);
|
||||
setCancel(button);
|
||||
xml_->get_widget("OK", button);
|
||||
setOK(button);
|
||||
xml_->get_widget("Apply", button);
|
||||
setApply(button);
|
||||
xml_->get_widget("Revert", button);
|
||||
setRestore(button);
|
||||
|
||||
xml_->get_widget("UseClassDefaults", button);
|
||||
button->signal_clicked().connect(
|
||||
sigc::mem_fun(*this, &GDocument::resetToDefaults));
|
||||
xml_->get_widget("SaveAsDocumentDefaults", button);
|
||||
button->signal_clicked().connect(
|
||||
sigc::mem_fun(*this, &GDocument::saveAsDefaults));
|
||||
|
||||
|
||||
// *** Start "Document" Page ***
|
||||
Gtk::Box * box = NULL;
|
||||
xml_->get_widget("DocumentClass", box);
|
||||
// Prevent combo making dialog super-wide due to long class names
|
||||
classcombo_.set_size_request(1, -1);
|
||||
box->pack_start(classcombo_, true, true, 0);
|
||||
box->show_all();
|
||||
|
||||
classcombo_.signal_changed().connect(
|
||||
sigc::mem_fun(*this, &GDocument::classChanged));
|
||||
|
||||
// Populate Document Class combo
|
||||
for (LyXTextClassList::const_iterator cit = textclasslist.begin();
|
||||
cit != textclasslist.end(); ++cit) {
|
||||
if (cit->isTeXClassAvailable()) {
|
||||
classcombo_.append_text(cit->description());
|
||||
} else {
|
||||
// FIXME UNICODE
|
||||
docstring item =
|
||||
bformat(_("Unavailable: %1$s"), lyx::from_utf8(cit->description()));
|
||||
classcombo_.append_text(lyx::to_utf8(item));
|
||||
}
|
||||
}
|
||||
|
||||
xml_->get_widget("ExtraOptions", extraoptionsentry_);
|
||||
|
||||
xml_->get_widget("PostscriptDriver", box);
|
||||
box->pack_start(psdrivercombo_, true, true, 0);
|
||||
box->show_all();
|
||||
|
||||
// Populate Postscript driver combo
|
||||
for (int i = 0; tex_graphics[i][0]; ++i) {
|
||||
psdrivercombo_.append_text(tex_graphics[i]);
|
||||
}
|
||||
|
||||
xml_->get_widget("FontSans", box);
|
||||
box->pack_start(fontsanscombo_, true, true, 0);
|
||||
box->show_all();
|
||||
|
||||
// Populate sans font combo
|
||||
for (int i = 0; tex_fonts_sans_gui[i][0]; ++i) {
|
||||
string font = lyx::to_utf8(_(tex_fonts_sans_gui[i]));
|
||||
if (!controller().isFontAvailable(tex_fonts_sans[i]))
|
||||
// FIXME UNICODE
|
||||
font += lyx::to_utf8(_(" (not installed)"));
|
||||
fontsanscombo_.append_text(font);
|
||||
}
|
||||
|
||||
xml_->get_widget("FontRoman", box);
|
||||
box->pack_start(fontromancombo_, true, true, 0);
|
||||
box->show_all();
|
||||
|
||||
// Populate roman font combo
|
||||
for (int i = 0; tex_fonts_roman_gui[i][0]; ++i) {
|
||||
string font = lyx::to_utf8(_(tex_fonts_roman_gui[i]));
|
||||
if (!controller().isFontAvailable(tex_fonts_roman[i]))
|
||||
font += lyx::to_utf8(_(" (not installed)"));
|
||||
fontsanscombo_.append_text(font);
|
||||
}
|
||||
|
||||
xml_->get_widget("FontTypewriter", box);
|
||||
box->pack_start(fonttypewritercombo_, true, true, 0);
|
||||
box->show_all();
|
||||
|
||||
// Populate typewriter font combo
|
||||
for (int i = 0; tex_fonts_monospaced_gui[i][0]; ++i) {
|
||||
string font = lyx::to_utf8(_(tex_fonts_monospaced_gui[i]));
|
||||
if (!controller().isFontAvailable(tex_fonts_monospaced[i]))
|
||||
font += lyx::to_utf8(_(" (not installed)"));
|
||||
fontsanscombo_.append_text(font);
|
||||
}
|
||||
|
||||
xml_->get_widget("FontDefaultFamily", box);
|
||||
box->pack_start(fontdefaultfamilycombo_, true, true, 0);
|
||||
box->show_all();
|
||||
|
||||
// Populate font default family combo
|
||||
for (int i = 0; ControlDocument::fontfamilies_gui[i][0]; ++i)
|
||||
fontdefaultfamilycombo_.append_text(lyx::to_utf8(_(ControlDocument::fontfamilies_gui[i])));
|
||||
|
||||
xml_->get_widget("FontSize", box);
|
||||
box->pack_start(fontsizecombo_, true, true, 0);
|
||||
box->show_all();
|
||||
|
||||
xml_->get_widget("fontScCB", fontScCB_);
|
||||
|
||||
xml_->get_widget("fontOsfCB", fontOsfCB_);
|
||||
|
||||
xml_->get_widget("scaleSansSB", scaleSansSB_);
|
||||
scaleSansSB_->set_range(10, 200);
|
||||
scaleSansSB_->set_digits(0);
|
||||
|
||||
xml_->get_widget("scaleTypewriterSB", scaleTypewriterSB_);
|
||||
scaleTypewriterSB_->set_range(10, 200);
|
||||
scaleTypewriterSB_->set_digits(0);
|
||||
|
||||
Gtk::SpinButton * spin;
|
||||
xml_->get_widget("LineSpacing", spin);
|
||||
linespacingadj_ = spin->get_adjustment();
|
||||
|
||||
xml_->get_widget("Indentation", indentradio_);
|
||||
xml_->get_widget("VerticalSpace", vspaceradio_);
|
||||
vspaceradio_->signal_toggled().connect(
|
||||
sigc::mem_fun(*this, &GDocument::updateParagraphSeparationSensitivity));
|
||||
|
||||
|
||||
xml_->get_widget("VerticalSpaceSize", box);
|
||||
box->pack_start(vspacesizecombo_, true, true, 0);
|
||||
box->show_all();
|
||||
// The order of these items is magic
|
||||
vspacesizecombo_.append_text(lyx::to_utf8(_("Small Skip")));
|
||||
vspacesizecombo_.append_text(lyx::to_utf8(_("Medium Skip")));
|
||||
vspacesizecombo_.append_text(lyx::to_utf8(_("Big Skip")));
|
||||
vspacesizecombo_.append_text(lyx::to_utf8(_("Custom")));
|
||||
vspacesizemap_[0] = VSpace::SMALLSKIP;
|
||||
vspacesizemap_[1] = VSpace::MEDSKIP;
|
||||
vspacesizemap_[2] = VSpace::BIGSKIP;
|
||||
vspacesizemap_[3] = VSpace::LENGTH;
|
||||
|
||||
vspacesizecombo_.signal_changed().connect(
|
||||
sigc::mem_fun(*this,
|
||||
&GDocument::updateParagraphSeparationSensitivity));
|
||||
|
||||
xml_->get_widget_derived("VerticalSpaceLength", vspacelengthentry_);
|
||||
vspacelengthentry_->set_relative(false);
|
||||
|
||||
updateParagraphSeparationSensitivity();
|
||||
// *** End "Document" Page ***
|
||||
|
||||
// *** Begin "Page" Page ***
|
||||
xml_->get_widget("PageSize", box);
|
||||
box->pack_start(pagesizecombo_, true, true, 0);
|
||||
box->show_all();
|
||||
pagesizecombo_.append_text(lyx::to_utf8(_("Default")));
|
||||
pagesizecombo_.append_text(lyx::to_utf8(_("Custom")));
|
||||
pagesizecombo_.append_text(lyx::to_utf8(_("US letter")));
|
||||
pagesizecombo_.append_text(lyx::to_utf8(_("US legal")));
|
||||
pagesizecombo_.append_text(lyx::to_utf8(_("US executive")));
|
||||
pagesizecombo_.append_text(lyx::to_utf8(_("A3")));
|
||||
pagesizecombo_.append_text(lyx::to_utf8(_("A4")));
|
||||
pagesizecombo_.append_text(lyx::to_utf8(_("A5")));
|
||||
pagesizecombo_.append_text(lyx::to_utf8(_("B3")));
|
||||
pagesizecombo_.append_text(lyx::to_utf8(_("B4")));
|
||||
pagesizecombo_.append_text(lyx::to_utf8(_("B5")));
|
||||
pagesizecombo_.signal_changed().connect(
|
||||
sigc::mem_fun(*this, &GDocument::pageSizeChanged));
|
||||
|
||||
xml_->get_widget_derived("PageWidth", pagewidthlengthentry_);
|
||||
xml_->get_widget_derived("PageHeight", pageheightlengthentry_);
|
||||
pagewidthlengthentry_->set_relative(false);
|
||||
pageheightlengthentry_->set_relative(false);
|
||||
|
||||
xml_->get_widget("Portrait", portraitradio_);
|
||||
xml_->get_widget("Landscape", landscaperadio_);
|
||||
|
||||
xml_->get_widget("PageStyle", box);
|
||||
box->pack_start(pagestylecombo_, true, true, 0);
|
||||
box->show_all();
|
||||
xml_->get_widget("DoubleSided", doublesidedtoggle_);
|
||||
xml_->get_widget("TwoColumns", twocolumnstoggle_);
|
||||
// *** End "Page" Page ***
|
||||
|
||||
// *** Begin "Margins" Page ***
|
||||
xml_->get_widget("DefaultMargins", defaultmargins_);
|
||||
defaultmargins_->signal_toggled().connect(
|
||||
sigc::mem_fun(*this, &GDocument::marginsChanged));
|
||||
|
||||
xml_->get_widget_derived("MarginsTop", mtoplengthentry_);
|
||||
xml_->get_widget_derived("MarginsBottom", mbottomlengthentry_);
|
||||
xml_->get_widget_derived("MarginsInner", minnerlengthentry_);
|
||||
xml_->get_widget_derived("MarginsOuter", mouterlengthentry_);
|
||||
xml_->get_widget_derived("MarginsHeadSep", mheadseplengthentry_);
|
||||
xml_->get_widget_derived("MarginsHeadHeight", mheadheightlengthentry_);
|
||||
xml_->get_widget_derived("MarginsFootSkip", mfootskiplengthentry_);
|
||||
// *** End "Margins" Page ***
|
||||
|
||||
// *** Start "Language" Page ***
|
||||
xml_->get_widget("Language", box);
|
||||
box->pack_start(languagecombo_, true, true, 0);
|
||||
box->show_all();
|
||||
|
||||
vector<LanguagePair> const langs = getLanguageData(false);
|
||||
vector<LanguagePair>::const_iterator lit = langs.begin();
|
||||
vector<LanguagePair>::const_iterator lend = langs.end();
|
||||
for (; lit != lend; ++lit) {
|
||||
languagecombo_.append_text(lit->first);
|
||||
}
|
||||
|
||||
xml_->get_widget("TextEncoding", box);
|
||||
box->pack_start(encodingcombo_, true, true, 0);
|
||||
box->show_all();
|
||||
|
||||
int i = 0;
|
||||
while (encodings[i])
|
||||
encodingcombo_.append_text(encodings[i++]);
|
||||
|
||||
xml_->get_widget("EnglishQuote", qenglishradio_);
|
||||
xml_->get_widget("SwedishQuote", qswedishradio_);
|
||||
xml_->get_widget("GermanQuote", qgermanradio_);
|
||||
xml_->get_widget("PolishQuote", qpolishradio_);
|
||||
xml_->get_widget("FrenchQuote", qfrenchradio_);
|
||||
xml_->get_widget("DanishQuote", qdanishradio_);
|
||||
// *** End "Language" Page ***
|
||||
|
||||
// *** Start "Numbering" Page ***
|
||||
Gtk::HScale * scale;
|
||||
xml_->get_widget("Numbering", scale);
|
||||
numberingadj_ = scale->get_adjustment();
|
||||
numberingadj_->signal_value_changed().connect(
|
||||
sigc::mem_fun(*this, &GDocument::numberingChanged));
|
||||
xml_->get_widget("NumberingLabel", numberinglabel_);
|
||||
|
||||
xml_->get_widget("TOC", scale);
|
||||
TOCadj_ = scale->get_adjustment();
|
||||
TOCadj_->signal_value_changed().connect(
|
||||
sigc::mem_fun(*this, &GDocument::TOCChanged));
|
||||
xml_->get_widget("TOCLabel", TOClabel_);
|
||||
// *** End "Numbering" Page ***
|
||||
|
||||
// *** Start "Bibliography" Page ***
|
||||
xml_->get_widget("BasicNumerical", basicnumericalradio_);
|
||||
xml_->get_widget("NatbibNumerical", natbibnumericalradio_);
|
||||
xml_->get_widget("NatbibAuthorYear", natbibauthoryearradio_);
|
||||
xml_->get_widget("Jurabib", jurabibradio_);
|
||||
xml_->get_widget("SectionedBibliography", sectionedbibliographytoggle_);
|
||||
// *** End "Bibliography" Page ***
|
||||
|
||||
// *** Start "Math" Page ***
|
||||
xml_->get_widget("AMSAutomatically", AMSautomaticallyradio_);
|
||||
xml_->get_widget("AMSAlways", AMSalwaysradio_);
|
||||
xml_->get_widget("AMSNever", AMSneverradio_);
|
||||
// *** End "Math" Page ***
|
||||
|
||||
// *** Start "Floats" Page ***
|
||||
xml_->get_widget("DocumentDefault", defaultradio_);
|
||||
xml_->get_widget("HereDefinitely", heredefinitelyradio_);
|
||||
xml_->get_widget("Alternative", alternativeradio_);
|
||||
alternativeradio_->signal_toggled().connect(
|
||||
sigc::mem_fun(*this, &GDocument::alternativeChanged));
|
||||
xml_->get_widget("TopOfPage", topcheck_);
|
||||
xml_->get_widget("BottomOfPage", bottomcheck_);
|
||||
xml_->get_widget("PageOfFloats", pageoffloatscheck_);
|
||||
xml_->get_widget("HereIfPossible", hereifpossiblecheck_);
|
||||
xml_->get_widget("IgnoreRules", ignorerulescheck_);
|
||||
// Initial sensitivity
|
||||
GDocument::alternativeChanged();
|
||||
|
||||
// *** End "Floats" Page ***
|
||||
|
||||
// *** Start "Bullets" Page ***
|
||||
// *** End "Bullets" Page ***
|
||||
|
||||
// *** Start "Branches" Page ***
|
||||
xml_->get_widget("Branches", branchesview_);
|
||||
xml_->get_widget("AddBranch", addbranchbutton_);
|
||||
addbranchbutton_->signal_clicked().connect(
|
||||
sigc::mem_fun(*this, &GDocument::addBranch));
|
||||
xml_->get_widget("RemoveBranch", removebranchbutton_);
|
||||
removebranchbutton_->signal_clicked().connect(
|
||||
sigc::mem_fun(*this, &GDocument::removeBranch));
|
||||
branchCols_.add(branchColName_);
|
||||
branchCols_.add(branchColActivated_);
|
||||
branchCols_.add(branchColColor_);
|
||||
|
||||
branchliststore_ = Gtk::ListStore::create(branchCols_);
|
||||
branchesview_->set_model(branchliststore_);
|
||||
branchesview_->append_column_editable(lyx::to_utf8(_("Name")), branchColName_);
|
||||
branchesview_->append_column_editable(lyx::to_utf8(_("Activated")), branchColActivated_);
|
||||
branchesview_->append_column_editable(lyx::to_utf8(_("Color")), branchColColor_);
|
||||
branchsel_ = branchesview_->get_selection();
|
||||
|
||||
branchsel_->signal_changed().connect(
|
||||
sigc::mem_fun(*this, &GDocument::branchSelChanged));
|
||||
|
||||
/*
|
||||
ErrorList::const_iterator cit = errors.begin();
|
||||
ErrorList::const_iterator end = errors.end();
|
||||
for (int rowindex = 0; cit != end; ++cit, ++rowindex) {
|
||||
Gtk::ListStore::Row row = *errliststore_->append();
|
||||
if (rowindex == 0)
|
||||
errlistsel_->select(*row);
|
||||
|
||||
(*row)[listCol_] = cit->error;
|
||||
(*row)[listColIndex_] = rowindex;
|
||||
}
|
||||
*/
|
||||
Gtk::ListStore::Row row = *branchliststore_->append();
|
||||
(*row)[branchColName_] = "Munch";
|
||||
(*row)[branchColActivated_] = false;
|
||||
row = *branchliststore_->append();
|
||||
(*row)[branchColName_] = "Hunch";
|
||||
(*row)[branchColActivated_] = true;
|
||||
// *** End "Branches" Page ***
|
||||
|
||||
// *** Begin "Preamble" Page ***
|
||||
Gtk::TextView *view;
|
||||
xml_->get_widget ("Preamble", view);
|
||||
preamblebuffer_ = view->get_buffer();
|
||||
// *** End "Preamble" Page ***
|
||||
}
|
||||
|
||||
|
||||
void GDocument::update()
|
||||
{
|
||||
BufferParams & params = controller().params();
|
||||
|
||||
// *** Start "Document" Page ***
|
||||
|
||||
// Document Class
|
||||
classcombo_.set_active(params.textclass);
|
||||
|
||||
// Extra Options
|
||||
extraoptionsentry_->set_text(params.options);
|
||||
|
||||
// Postscript driver
|
||||
psdrivercombo_.set_active_text (params.graphicsDriver);
|
||||
|
||||
// Font & Size
|
||||
int i = findToken(tex_fonts_sans, params.fontsSans);
|
||||
if (i >= 0)
|
||||
fontsanscombo_.set_active_text(lyx::to_utf8(_(tex_fonts_sans_gui[i])));
|
||||
i = findToken(tex_fonts_sans, params.fontsRoman);
|
||||
if (i >= 0)
|
||||
fontromancombo_.set_active_text(lyx::to_utf8(_(tex_fonts_roman_gui[i])));
|
||||
i = findToken(tex_fonts_monospaced, params.fontsTypewriter);
|
||||
if (i >= 0)
|
||||
fonttypewritercombo_.set_active_text(tex_fonts_monospaced_gui[i]);
|
||||
i = findToken(ControlDocument::fontfamilies, params.fontsDefaultFamily);
|
||||
if (i >= 0)
|
||||
fontdefaultfamilycombo_.set_active_text(
|
||||
lyx::to_utf8(_(ControlDocument::fontfamilies_gui[i])));
|
||||
fontsizecombo_.set_active_text (params.fontsize);
|
||||
scaleSansSB_->set_value(params.fontsSansScale);
|
||||
scaleTypewriterSB_->set_value(params.fontsTypewriterScale);
|
||||
fontScCB_->set_active(params.fontsSC);
|
||||
fontOsfCB_->set_active(params.fontsOSF);
|
||||
|
||||
// Line Spacing
|
||||
linespacingadj_->set_value(params.spacing().getValue());
|
||||
|
||||
// Paragraph Separation
|
||||
if (params.paragraph_separation == BufferParams::PARSEP_INDENT) {
|
||||
indentradio_->set_active(true);
|
||||
} else {
|
||||
vspaceradio_->set_active(true);
|
||||
}
|
||||
|
||||
// Paragraph Separation Vertical Space Size
|
||||
VSpace::vspace_kind const skipkind = params.getDefSkip().kind();
|
||||
for (int i = 0; i <= 3; ++i) {
|
||||
if (vspacesizemap_[i] == skipkind)
|
||||
vspacesizecombo_.set_active(i);
|
||||
}
|
||||
|
||||
LyXLength vspacelen = params.getDefSkip().length().len();
|
||||
vspacelengthentry_->set_length (vspacelen);
|
||||
|
||||
// *** End "Document" Page ***
|
||||
|
||||
// *** Begin "Page" Page ***
|
||||
int const psize = params.papersize;
|
||||
pagesizecombo_.set_active(psize);
|
||||
|
||||
pagewidthlengthentry_->set_length(LyXLength(params.paperwidth));
|
||||
pageheightlengthentry_->set_length(LyXLength(params.paperheight));
|
||||
|
||||
if (params.orientation == ORIENTATION_PORTRAIT)
|
||||
portraitradio_->set_active();
|
||||
else
|
||||
landscaperadio_->set_active();
|
||||
|
||||
if (params.columns == 2)
|
||||
twocolumnstoggle_->set_active(true);
|
||||
else
|
||||
twocolumnstoggle_->set_active(false);
|
||||
|
||||
doublesidedtoggle_->set_active(params.sides == LyXTextClass::TwoSides);
|
||||
|
||||
pagestylecombo_.set_active_text (params.pagestyle);
|
||||
// *** End "Page" Page ***
|
||||
|
||||
defaultmargins_->set_active(!params.use_geometry);
|
||||
|
||||
mtoplengthentry_->set_length(params.topmargin);
|
||||
mbottomlengthentry_->set_length(params.bottommargin);
|
||||
minnerlengthentry_->set_length(params.leftmargin);
|
||||
mouterlengthentry_->set_length(params.rightmargin);
|
||||
mheadseplengthentry_->set_length(params.headsep);
|
||||
mheadheightlengthentry_->set_length(params.headheight);
|
||||
mfootskiplengthentry_->set_length(params.footskip);
|
||||
|
||||
marginsChanged();
|
||||
// *** End "Margins" Page ***
|
||||
|
||||
// *** Start "Language" Page ***
|
||||
int const langpos = findPos(lang_,
|
||||
params.language->lang());
|
||||
languagecombo_.set_active(langpos);
|
||||
|
||||
// Default to "auto"
|
||||
encodingcombo_.set_active(0);
|
||||
if (params.inputenc == "default") {
|
||||
encodingcombo_.set_active(1);
|
||||
} else {
|
||||
int i = 0;
|
||||
while (encodings[i]) {
|
||||
if (encodings[i] == params.inputenc)
|
||||
encodingcombo_.set_active(i);
|
||||
++i;
|
||||
}
|
||||
}
|
||||
|
||||
switch (params.quotes_language) {
|
||||
case InsetQuotes::EnglishQ:
|
||||
qenglishradio_->set_active();
|
||||
break;
|
||||
case InsetQuotes::SwedishQ:
|
||||
qswedishradio_->set_active();
|
||||
break;
|
||||
case InsetQuotes::GermanQ:
|
||||
qgermanradio_->set_active();
|
||||
break;
|
||||
case InsetQuotes::PolishQ:
|
||||
qpolishradio_->set_active();
|
||||
break;
|
||||
case InsetQuotes::FrenchQ:
|
||||
qfrenchradio_->set_active();
|
||||
break;
|
||||
case InsetQuotes::DanishQ:
|
||||
qdanishradio_->set_active();
|
||||
break;
|
||||
}
|
||||
|
||||
// *** End "Language" Page ***
|
||||
|
||||
// *** Start "Numbering" Page ***
|
||||
numberingadj_->set_value(params.secnumdepth + 2);
|
||||
TOCadj_->set_value(params.tocdepth + 1);
|
||||
// *** End "Numbering" Page ***
|
||||
|
||||
// *** Start "Bibliography" Page ***
|
||||
switch (params.cite_engine) {
|
||||
case biblio::ENGINE_BASIC:
|
||||
basicnumericalradio_->set_active();
|
||||
break;
|
||||
case biblio::ENGINE_NATBIB_NUMERICAL:
|
||||
natbibnumericalradio_->set_active();
|
||||
break;
|
||||
case biblio::ENGINE_NATBIB_AUTHORYEAR:
|
||||
natbibauthoryearradio_->set_active();
|
||||
break;
|
||||
case biblio::ENGINE_JURABIB:
|
||||
jurabibradio_->set_active();
|
||||
break;
|
||||
}
|
||||
|
||||
sectionedbibliographytoggle_->set_active(params.use_bibtopic);
|
||||
// *** End "Bibliography" Page ***
|
||||
|
||||
// *** Start "Math" Page ***
|
||||
switch (params.use_amsmath) {
|
||||
case BufferParams::AMS_AUTO:
|
||||
AMSautomaticallyradio_->set_active();
|
||||
break;
|
||||
case BufferParams::AMS_ON:
|
||||
AMSalwaysradio_->set_active();
|
||||
break;
|
||||
case BufferParams::AMS_OFF:
|
||||
AMSneverradio_->set_active();
|
||||
break;
|
||||
}
|
||||
// *** End "Math" Page ***
|
||||
|
||||
// *** Start "Floats" Page ***
|
||||
string const placement = params.float_placement;
|
||||
bool const here_definitely = contains(placement, 'H');
|
||||
bool const top = contains(placement, 't');
|
||||
bool const bottom = contains(placement, 'b');
|
||||
bool const page = contains(placement, 'p');
|
||||
bool const here = contains(placement, 'h');
|
||||
bool const force = contains(placement, '!');
|
||||
bool const alternatives = top || bottom || page || here;
|
||||
|
||||
if (alternatives) {
|
||||
alternativeradio_->set_active(true);
|
||||
} else if (here_definitely) {
|
||||
heredefinitelyradio_->set_active(true);
|
||||
} else {
|
||||
defaultradio_->set_active(true);
|
||||
}
|
||||
ignorerulescheck_->set_active(force);
|
||||
topcheck_->set_active(top);
|
||||
bottomcheck_->set_active(bottom);
|
||||
pageoffloatscheck_->set_active(page);
|
||||
hereifpossiblecheck_->set_active(here);
|
||||
|
||||
// *** End "Floats" Page ***
|
||||
|
||||
// *** Start "Bullets" Page ***
|
||||
// *** End "Bullets" Page ***
|
||||
|
||||
// *** Start "Branches" Page ***
|
||||
branchliststore_->clear();
|
||||
|
||||
BranchList::const_iterator it = params.branchlist().begin();
|
||||
BranchList::const_iterator const end = params.branchlist().end();
|
||||
for (; it != end; ++it) {
|
||||
Gtk::ListStore::Row row = *branchliststore_->append();
|
||||
(*row)[branchColName_] = (*it).getBranch();
|
||||
std::cerr << "update: loading '" << (*it).getBranch() << "'\n";
|
||||
(*row)[branchColActivated_] = (*it).getSelected();
|
||||
(*row)[branchColColor_] = X11hexname((*it).getColor());
|
||||
}
|
||||
// *** End "Branches" Page ***
|
||||
|
||||
// *** Begin "Preamble" Page ***
|
||||
preamblebuffer_->set_text(params.preamble);
|
||||
// *** End "Preamble" Page ***
|
||||
|
||||
// Be a cheesy bastard, for the moment
|
||||
bc().valid();
|
||||
}
|
||||
|
||||
|
||||
void GDocument::apply()
|
||||
{
|
||||
BufferParams & params = controller().params();
|
||||
|
||||
// *** Start "Document" Page ***
|
||||
|
||||
// Document Class
|
||||
params.textclass = classcombo_.get_active_row_number();
|
||||
|
||||
// Extra Options
|
||||
params.options = extraoptionsentry_->get_text();
|
||||
|
||||
// Postscript Driver
|
||||
params.graphicsDriver = psdrivercombo_.get_active_text();
|
||||
|
||||
// Font & Size
|
||||
params.fontsSans = tex_fonts_sans[fontsanscombo_.get_active_row_number()];
|
||||
params.fontsRoman = tex_fonts_roman[fontromancombo_.get_active_row_number()];
|
||||
params.fontsTypewriter = tex_fonts_monospaced[fonttypewritercombo_.get_active_row_number()];
|
||||
params.fontsDefaultFamily =
|
||||
ControlDocument::fontfamilies[fontdefaultfamilycombo_.get_active_row_number()];
|
||||
params.fontsize = fontsizecombo_.get_active_text();
|
||||
params.fontsSansScale = int(scaleSansSB_->get_adjustment()->get_value());
|
||||
params.fontsTypewriterScale = int(scaleTypewriterSB_->get_adjustment()->get_value());
|
||||
params.fontsSC = fontScCB_->get_active();
|
||||
params.fontsOSF = fontOsfCB_->get_active();
|
||||
|
||||
// Line Spacing
|
||||
params.spacing().set(Spacing::Other, linespacingadj_->get_value());
|
||||
|
||||
// Paragraph Separation
|
||||
if (indentradio_->get_active()) {
|
||||
params.paragraph_separation = BufferParams::PARSEP_INDENT;
|
||||
} else {
|
||||
params.paragraph_separation = BufferParams::PARSEP_SKIP;
|
||||
}
|
||||
|
||||
// Paragraph Separation Vertical Space Size
|
||||
VSpace::vspace_kind const selection =
|
||||
vspacesizemap_[vspacesizecombo_.get_active_row_number()];
|
||||
params.setDefSkip(VSpace(selection));
|
||||
if (selection == VSpace::LENGTH) {
|
||||
LyXLength length = vspacelengthentry_->get_length();
|
||||
params.setDefSkip(VSpace(LyXGlueLength(length)));
|
||||
}
|
||||
|
||||
// *** End "Document" Page ***
|
||||
|
||||
// *** Begin "Page" Page ***
|
||||
params.papersize = PAPER_SIZE(
|
||||
pagesizecombo_.get_active_row_number());
|
||||
|
||||
params.paperwidth = pagewidthlengthentry_->get_length_string();
|
||||
params.paperheight = pageheightlengthentry_->get_length_string();
|
||||
|
||||
if (portraitradio_->get_active())
|
||||
params.orientation = ORIENTATION_PORTRAIT;
|
||||
else
|
||||
params.orientation = ORIENTATION_LANDSCAPE;
|
||||
|
||||
if (twocolumnstoggle_->get_active())
|
||||
params.columns = 2;
|
||||
else
|
||||
params.columns = 1;
|
||||
|
||||
if (doublesidedtoggle_->get_active())
|
||||
params.sides = LyXTextClass::TwoSides;
|
||||
else
|
||||
params.sides = LyXTextClass::OneSide;
|
||||
|
||||
params.pagestyle = pagestylecombo_.get_active_text();
|
||||
// *** End "Page" Page ***
|
||||
|
||||
// *** Begin "Margins" Page ***
|
||||
params.use_geometry = !defaultmargins_->get_active();
|
||||
|
||||
params.topmargin = mtoplengthentry_->get_length_string();
|
||||
params.bottommargin = mbottomlengthentry_->get_length_string();
|
||||
params.leftmargin = minnerlengthentry_->get_length_string();
|
||||
params.rightmargin = mouterlengthentry_->get_length_string();
|
||||
params.headsep = mheadseplengthentry_->get_length_string();
|
||||
params.headheight = mheadheightlengthentry_->get_length_string();
|
||||
params.footskip = mfootskiplengthentry_->get_length_string();
|
||||
// *** End "Margins" Page ***
|
||||
|
||||
// *** Start "Language" Page ***
|
||||
int const encodingsel = encodingcombo_.get_active_row_number();
|
||||
if (encodingsel == 0)
|
||||
params.inputenc = "auto";
|
||||
else if (encodingsel == 1)
|
||||
params.inputenc = "default";
|
||||
else
|
||||
params.inputenc = encodings[encodingsel];
|
||||
|
||||
int const langsel = languagecombo_.get_active_row_number();
|
||||
params.language = languages.getLanguage(lang_[langsel]);
|
||||
|
||||
if (qenglishradio_->get_active())
|
||||
params.quotes_language = InsetQuotes::EnglishQ;
|
||||
else if (qswedishradio_->get_active())
|
||||
params.quotes_language = InsetQuotes::SwedishQ;
|
||||
else if (qgermanradio_->get_active())
|
||||
params.quotes_language = InsetQuotes::GermanQ;
|
||||
else if (qpolishradio_->get_active())
|
||||
params.quotes_language = InsetQuotes::PolishQ;
|
||||
else if (qfrenchradio_->get_active())
|
||||
params.quotes_language = InsetQuotes::FrenchQ;
|
||||
else if (qdanishradio_->get_active())
|
||||
params.quotes_language = InsetQuotes::DanishQ;
|
||||
// *** End "Language" Page ***
|
||||
|
||||
// *** Start "Numbering" Page ***
|
||||
params.secnumdepth = (int)(numberingadj_->get_value()) - 2;
|
||||
params.tocdepth = (int)(TOCadj_->get_value()) - 1;
|
||||
// *** End "Numbering" Page ***
|
||||
|
||||
// *** Start "Bibliography" Page ***
|
||||
if (basicnumericalradio_->get_active())
|
||||
params.cite_engine = biblio::ENGINE_BASIC;
|
||||
else if (natbibnumericalradio_->get_active())
|
||||
params.cite_engine = biblio::ENGINE_NATBIB_NUMERICAL;
|
||||
else if (natbibauthoryearradio_->get_active())
|
||||
params.cite_engine = biblio::ENGINE_NATBIB_AUTHORYEAR;
|
||||
else if (jurabibradio_->get_active())
|
||||
params.cite_engine = biblio::ENGINE_JURABIB;
|
||||
|
||||
params.use_bibtopic = sectionedbibliographytoggle_->get_active();
|
||||
// *** End "Bibliography" Page ***
|
||||
|
||||
// *** Start "Math" Page ***
|
||||
if (AMSautomaticallyradio_->get_active())
|
||||
params.use_amsmath = BufferParams::AMS_AUTO;
|
||||
else if (AMSalwaysradio_->get_active())
|
||||
params.use_amsmath = BufferParams::AMS_ON;
|
||||
else if (AMSneverradio_->get_active())
|
||||
params.use_amsmath = BufferParams::AMS_OFF;
|
||||
// *** End "Math" Page ***
|
||||
|
||||
// *** Start "Floats" Page ***
|
||||
string placement;
|
||||
if (alternativeradio_->get_active()) {
|
||||
if (ignorerulescheck_->get_active())
|
||||
placement += '!';
|
||||
if (topcheck_->get_active())
|
||||
placement += 't';
|
||||
if (bottomcheck_->get_active())
|
||||
placement += 'b';
|
||||
if (pageoffloatscheck_->get_active())
|
||||
placement += 'p';
|
||||
if (hereifpossiblecheck_->get_active())
|
||||
placement += 'h';
|
||||
if (placement == "!")
|
||||
placement.erase();
|
||||
} else if (heredefinitelyradio_->get_active())
|
||||
placement = "H";
|
||||
|
||||
params.float_placement = placement;
|
||||
// *** End "Floats" Page ***
|
||||
|
||||
// *** Start "Bullets" Page ***
|
||||
// *** End "Bullets" Page ***
|
||||
|
||||
// *** Start "Branches" Page ***
|
||||
/*branchliststore_->clear();
|
||||
|
||||
BranchList::const_iterator it = params.branchlist().begin();
|
||||
BranchList::const_iterator const end = params.branchlist().end();
|
||||
for (; it != end; ++it) {
|
||||
Gtk::ListStore::Row row = *branchliststore_->append();
|
||||
(*row)[branchColName_] = (*it).getBranch();
|
||||
(*row)[branchColActivated_] = (*it).getSelected();
|
||||
(*row)[branchColColor_] = (*it).getColor();
|
||||
}*/
|
||||
|
||||
BranchList branchlist;
|
||||
|
||||
Gtk::ListStore::iterator it = branchliststore_->children().begin();
|
||||
Gtk::ListStore::iterator const end = branchliststore_->children().end();
|
||||
for (; it != end; ++it) {
|
||||
Gtk::ListStore::Row row = *it;
|
||||
Glib::ustring const name = (*row)[branchColName_];
|
||||
if (branchlist.add(name)) {
|
||||
std::cerr << "apply: adding '" << name << "'\n";
|
||||
Branch * newbranch = branchlist.find(name);
|
||||
newbranch->setSelected((*row)[branchColActivated_]);
|
||||
Glib::ustring const color = (*row)[branchColColor_];
|
||||
// FIXME: The color should be editable via a color
|
||||
// chooser, not a text field (see qt frontends)
|
||||
// setColor will silently ignore an invalid color and
|
||||
// use the normal background color for now.
|
||||
newbranch->setColor(color);
|
||||
}
|
||||
}
|
||||
|
||||
params.branchlist() = branchlist;
|
||||
|
||||
// *** End "Branches" Page ***
|
||||
|
||||
// *** Begin "Preamble" Page ***
|
||||
params.preamble = preamblebuffer_->get_text();
|
||||
// *** End "Preamble" Page ***
|
||||
}
|
||||
|
||||
|
||||
void GDocument::saveAsDefaults()
|
||||
{
|
||||
apply();
|
||||
controller().saveAsDefault();
|
||||
}
|
||||
|
||||
|
||||
void GDocument::resetToDefaults()
|
||||
{
|
||||
BufferParams & params = controller().params();
|
||||
params.textclass = classcombo_.get_active_row_number();
|
||||
params.useClassDefaults();
|
||||
update();
|
||||
}
|
||||
|
||||
|
||||
void GDocument::updateParagraphSeparationSensitivity()
|
||||
{
|
||||
bool const vspacesensitive = vspaceradio_->get_active();
|
||||
|
||||
vspacesizecombo_.set_sensitive(vspacesensitive);
|
||||
|
||||
bool const lengthsensitive = vspacesensitive &&
|
||||
(vspacesizecombo_.get_active_row_number() == 3);
|
||||
|
||||
vspacelengthentry_->set_sensitive(lengthsensitive);
|
||||
}
|
||||
|
||||
|
||||
void GDocument::classChanged()
|
||||
{
|
||||
ControlDocument & ctrl = controller();
|
||||
BufferParams & params = ctrl.params();
|
||||
|
||||
lyx::textclass_type const tc = classcombo_.get_active_row_number();
|
||||
|
||||
if (ctrl.loadTextclass(tc)) {
|
||||
params.textclass = tc;
|
||||
|
||||
if (lyxrc.auto_reset_options) {
|
||||
params.useClassDefaults();
|
||||
update();
|
||||
} else {
|
||||
fontsizecombo_.clear();
|
||||
fontsizecombo_.append_text("default");
|
||||
|
||||
string const fontsizeitems = ctrl.textClass().opt_fontsize();
|
||||
for (int n = 0; !token(fontsizeitems, '|', n).empty(); ++n)
|
||||
fontsizecombo_.append_text(token(fontsizeitems, '|', n));
|
||||
|
||||
fontsizecombo_.set_active_text (params.fontsize);
|
||||
|
||||
pagestylecombo_.clear();
|
||||
pagestylecombo_.append_text("default");
|
||||
|
||||
string const pagestyleitems = ctrl.textClass().opt_pagestyle();
|
||||
for (int n=0; !token(pagestyleitems,'|',n).empty(); ++n)
|
||||
pagestylecombo_.append_text(token(pagestyleitems,'|',n));
|
||||
|
||||
pagestylecombo_.set_active_text (params.pagestyle);
|
||||
}
|
||||
} else {
|
||||
classcombo_.set_active(params.textclass);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void GDocument::pageSizeChanged()
|
||||
{
|
||||
bool const customsize = pagesizecombo_.get_active_row_number() == 1;
|
||||
pagewidthlengthentry_->set_sensitive(customsize);
|
||||
pageheightlengthentry_->set_sensitive(customsize);
|
||||
|
||||
if (customsize)
|
||||
portraitradio_->set_active();
|
||||
}
|
||||
|
||||
|
||||
void GDocument::marginsChanged()
|
||||
{
|
||||
bool const custom = !defaultmargins_->get_active();
|
||||
|
||||
mtoplengthentry_->set_sensitive(custom);
|
||||
mbottomlengthentry_->set_sensitive(custom);
|
||||
minnerlengthentry_->set_sensitive(custom);
|
||||
mouterlengthentry_->set_sensitive(custom);
|
||||
mheadseplengthentry_->set_sensitive(custom);
|
||||
mheadheightlengthentry_->set_sensitive(custom);
|
||||
mfootskiplengthentry_->set_sensitive(custom);
|
||||
}
|
||||
|
||||
|
||||
void GDocument::numberingChanged()
|
||||
{
|
||||
docstring const numberinglabels[] = {
|
||||
_("No headings numbered"),
|
||||
_("Only parts numbered"),
|
||||
_("Chapters and above numbered"),
|
||||
_("Sections and above numbered"),
|
||||
_("Subsections and above numbered"),
|
||||
_("Subsubsections and above numbered"),
|
||||
_("Paragraphs and above numbered"),
|
||||
_("All headings numbered")
|
||||
};
|
||||
|
||||
int const value = (int)(numberingadj_->get_value());
|
||||
// FIXME UNICODE
|
||||
numberinglabel_->set_label("<i>" + lyx::to_utf8(numberinglabels[value]) + "</i>");
|
||||
}
|
||||
|
||||
|
||||
void GDocument::TOCChanged()
|
||||
{
|
||||
docstring const TOClabels[] = {
|
||||
_("Only Parts appear in TOC"),
|
||||
_("Chapters and above appear in TOC"),
|
||||
_("Sections and above appear in TOC"),
|
||||
_("Subsections and above appear in TOC"),
|
||||
_("Subsubsections and above appear in TOC"),
|
||||
_("Paragraphs and above appear in TOC"),
|
||||
_("TOC contains all headings")
|
||||
};
|
||||
|
||||
int const value = (int)(TOCadj_->get_value());
|
||||
// FIXME UNICODE
|
||||
TOClabel_->set_label("<i>" + lyx::to_utf8(TOClabels[value]) + "</i>");
|
||||
}
|
||||
|
||||
|
||||
void GDocument::alternativeChanged()
|
||||
{
|
||||
bool const sens = alternativeradio_->get_active();
|
||||
topcheck_->set_sensitive(sens);
|
||||
bottomcheck_->set_sensitive(sens);
|
||||
pageoffloatscheck_->set_sensitive(sens);
|
||||
hereifpossiblecheck_->set_sensitive(sens);
|
||||
ignorerulescheck_->set_sensitive(sens);
|
||||
}
|
||||
|
||||
|
||||
void GDocument::addBranch()
|
||||
{
|
||||
Gtk::ListStore::Row row = *branchliststore_->append();
|
||||
(*row)[branchColName_] = "New Branch";
|
||||
(*row)[branchColActivated_] = false;
|
||||
(*row)[branchColColor_] = "#000000";
|
||||
}
|
||||
|
||||
|
||||
void GDocument::removeBranch()
|
||||
{
|
||||
Gtk::TreeModel::iterator const selected = branchsel_->get_selected();
|
||||
if (!branchliststore_->iter_is_valid(selected))
|
||||
return;
|
||||
|
||||
branchliststore_->erase (selected);
|
||||
}
|
||||
|
||||
|
||||
void GDocument::branchSelChanged()
|
||||
{
|
||||
if (branchsel_->get_selected() == branchliststore_->children().end())
|
||||
removebranchbutton_->set_sensitive(false);
|
||||
else
|
||||
removebranchbutton_->set_sensitive(true);
|
||||
}
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
@ -1,170 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file GDocument.h
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author John Spray
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#ifndef GDOCUMENT_H
|
||||
#define GDOCUMENT_H
|
||||
|
||||
#include "GViewBase.h"
|
||||
#include "vspace.h"
|
||||
|
||||
#include "BranchList.h"
|
||||
|
||||
#include "GtkLengthEntry.h"
|
||||
|
||||
#include <gtkmm.h>
|
||||
|
||||
#include <map>
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
class ControlDocument;
|
||||
|
||||
/** This class provides a gtk implementation of the document dialog.
|
||||
*/
|
||||
class GDocument
|
||||
: public GViewCB<ControlDocument, GViewGladeB> {
|
||||
public:
|
||||
GDocument(Dialog &);
|
||||
private:
|
||||
/// Build the dialog
|
||||
virtual void doBuild();
|
||||
/// Apply from dialog
|
||||
virtual void apply();
|
||||
/// Update the dialog
|
||||
virtual void update();
|
||||
|
||||
void saveAsDefaults();
|
||||
void resetToDefaults();
|
||||
|
||||
// *** Start "Document" Page ***
|
||||
Gtk::ComboBoxText classcombo_;
|
||||
Gtk::Entry * extraoptionsentry_;
|
||||
Gtk::ComboBoxText psdrivercombo_;
|
||||
Gtk::ComboBoxText fontsanscombo_;
|
||||
Gtk::ComboBoxText fontromancombo_;
|
||||
Gtk::ComboBoxText fonttypewritercombo_;
|
||||
Gtk::ComboBoxText fontdefaultfamilycombo_;
|
||||
Gtk::ComboBoxText fontsizecombo_;
|
||||
Gtk::CheckButton * fontScCB_;
|
||||
Gtk::CheckButton * fontOsfCB_;
|
||||
Gtk::SpinButton * scaleSansSB_;
|
||||
Gtk::SpinButton * scaleTypewriterSB_;
|
||||
Gtk::Adjustment * linespacingadj_;
|
||||
Gtk::RadioButton * indentradio_;
|
||||
Gtk::RadioButton * vspaceradio_;
|
||||
Gtk::ComboBoxText vspacesizecombo_;
|
||||
std::map<int, VSpace::vspace_kind> vspacesizemap_;
|
||||
GtkLengthEntry *vspacelengthentry_;
|
||||
void updateParagraphSeparationSensitivity();
|
||||
void classChanged();
|
||||
// *** End "Document" Page ***
|
||||
|
||||
// *** Begin "Page" Page ***
|
||||
GtkLengthEntry * pagewidthlengthentry_;
|
||||
GtkLengthEntry * pageheightlengthentry_;
|
||||
Gtk::ComboBoxText pagesizecombo_;
|
||||
Gtk::RadioButton * portraitradio_;
|
||||
Gtk::RadioButton * landscaperadio_;
|
||||
Gtk::ComboBoxText pagestylecombo_;
|
||||
Gtk::ToggleButton * doublesidedtoggle_;
|
||||
Gtk::ToggleButton * twocolumnstoggle_;
|
||||
void pageSizeChanged();
|
||||
// *** End "Page" Page ***
|
||||
|
||||
// *** Begin "Margins" Page ***
|
||||
Gtk::CheckButton * defaultmargins_;
|
||||
GtkLengthEntry * mtoplengthentry_;
|
||||
GtkLengthEntry * mbottomlengthentry_;
|
||||
GtkLengthEntry * minnerlengthentry_;
|
||||
GtkLengthEntry * mouterlengthentry_;
|
||||
GtkLengthEntry * mheadseplengthentry_;
|
||||
GtkLengthEntry * mheadheightlengthentry_;
|
||||
GtkLengthEntry * mfootskiplengthentry_;
|
||||
void marginsChanged();
|
||||
// *** End "Margins" Page ***
|
||||
|
||||
// *** Start "Language" Page ***
|
||||
Gtk::ComboBoxText languagecombo_;
|
||||
Gtk::ComboBoxText encodingcombo_;
|
||||
Gtk::RadioButton * qenglishradio_;
|
||||
Gtk::RadioButton * qswedishradio_;
|
||||
Gtk::RadioButton * qgermanradio_;
|
||||
Gtk::RadioButton * qpolishradio_;
|
||||
Gtk::RadioButton * qfrenchradio_;
|
||||
Gtk::RadioButton * qdanishradio_;
|
||||
std::vector<std::string> lang_;
|
||||
// *** End "Language" Page ***
|
||||
|
||||
// *** Start "Numbering" Page ***
|
||||
Gtk::Adjustment * numberingadj_;
|
||||
Gtk::Adjustment * TOCadj_;
|
||||
Gtk::Label * numberinglabel_;
|
||||
Gtk::Label * TOClabel_;
|
||||
void numberingChanged();
|
||||
void TOCChanged();
|
||||
// *** End "Numbering" Page ***
|
||||
|
||||
// *** Start "Bibliography" Page ***
|
||||
Gtk::RadioButton * basicnumericalradio_;
|
||||
Gtk::RadioButton * natbibnumericalradio_;
|
||||
Gtk::RadioButton * natbibauthoryearradio_;
|
||||
Gtk::RadioButton * jurabibradio_;
|
||||
Gtk::ToggleButton * sectionedbibliographytoggle_;
|
||||
// *** End "Bibliography" Page ***
|
||||
|
||||
// *** Start "Math" Page ***
|
||||
Gtk::RadioButton * AMSautomaticallyradio_;
|
||||
Gtk::RadioButton * AMSalwaysradio_;
|
||||
Gtk::RadioButton * AMSneverradio_;
|
||||
// *** End "Math" Page ***
|
||||
|
||||
// *** Start "Floats" Page ***
|
||||
Gtk::RadioButton * defaultradio_;
|
||||
Gtk::RadioButton * heredefinitelyradio_;
|
||||
Gtk::RadioButton * alternativeradio_;
|
||||
Gtk::CheckButton * topcheck_;
|
||||
Gtk::CheckButton * bottomcheck_;
|
||||
Gtk::CheckButton * pageoffloatscheck_;
|
||||
Gtk::CheckButton * hereifpossiblecheck_;
|
||||
Gtk::CheckButton * ignorerulescheck_;
|
||||
void alternativeChanged();
|
||||
// *** End "Floats" Page ***
|
||||
|
||||
// *** Start "Bullets" Page ***
|
||||
// *** End "Bullets" Page ***
|
||||
|
||||
// *** Start "Branches" Page ***
|
||||
//BranchList branchlist_;
|
||||
Gtk::TreeView * branchesview_;
|
||||
Gtk::Button * addbranchbutton_;
|
||||
Gtk::Button * removebranchbutton_;
|
||||
Gtk::TreeModelColumn<Glib::ustring> branchColName_;
|
||||
Gtk::TreeModelColumn<bool> branchColActivated_;
|
||||
Gtk::TreeModelColumn<Glib::ustring> branchColColor_;
|
||||
Gtk::TreeModel::ColumnRecord branchCols_;
|
||||
|
||||
Glib::RefPtr<Gtk::ListStore> branchliststore_;
|
||||
Glib::RefPtr<Gtk::TreeSelection> branchsel_;
|
||||
void addBranch();
|
||||
void removeBranch();
|
||||
void branchSelChanged();
|
||||
// *** End "Branches" Page ***
|
||||
|
||||
// *** Begin "Preamble" Page ***
|
||||
Glib::RefPtr<Gtk::TextBuffer> preamblebuffer_;
|
||||
// *** End "Preamble" Page ***
|
||||
};
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#endif
|
@ -1,101 +0,0 @@
|
||||
/**
|
||||
* \file GERT.C
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author John Spray
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
// Too hard to make concept checks work with this file
|
||||
#ifdef _GLIBCXX_CONCEPT_CHECKS
|
||||
#undef _GLIBCXX_CONCEPT_CHECKS
|
||||
#endif
|
||||
#ifdef _GLIBCPP_CONCEPT_CHECKS
|
||||
#undef _GLIBCPP_CONCEPT_CHECKS
|
||||
#endif
|
||||
|
||||
#include "GERT.h"
|
||||
#include "ControlERT.h"
|
||||
#include "ghelpers.h"
|
||||
|
||||
#include <libglademm.h>
|
||||
|
||||
using std::string;
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
GERT::GERT(Dialog & parent)
|
||||
: GViewCB<ControlERT, GViewGladeB>(parent, _("TeX Settings"), false)
|
||||
{}
|
||||
|
||||
|
||||
void GERT::doBuild()
|
||||
{
|
||||
string const gladeName = findGladeFile("ERT");
|
||||
xml_ = Gnome::Glade::Xml::create(gladeName);
|
||||
|
||||
Gtk::Button * cancelbutton;
|
||||
xml_->get_widget("Close", cancelbutton);
|
||||
setCancel(cancelbutton);
|
||||
|
||||
xml_->get_widget("Inline", inlineradio_);
|
||||
xml_->get_widget("Open", openradio_);
|
||||
xml_->get_widget("Collapsed", collapsedradio_);
|
||||
|
||||
inlineradio_->signal_toggled().connect(
|
||||
sigc::mem_fun(*this, &GERT::apply));
|
||||
openradio_->signal_toggled().connect(
|
||||
sigc::mem_fun(*this, &GERT::apply));
|
||||
collapsedradio_->signal_toggled().connect(
|
||||
sigc::mem_fun(*this, &GERT::apply));
|
||||
|
||||
bcview().addReadOnly(inlineradio_);
|
||||
bcview().addReadOnly(openradio_);
|
||||
bcview().addReadOnly(collapsedradio_);
|
||||
}
|
||||
|
||||
|
||||
void GERT::update()
|
||||
{
|
||||
applylock_ = true;
|
||||
|
||||
bc().refreshReadOnly();
|
||||
|
||||
switch (controller().status()) {
|
||||
case InsetERT::Open:
|
||||
openradio_->set_active(true);
|
||||
break;
|
||||
case InsetERT::Collapsed:
|
||||
collapsedradio_->set_active(true);
|
||||
break;
|
||||
case InsetERT::Inlined:
|
||||
inlineradio_->set_active(true);
|
||||
break;
|
||||
}
|
||||
|
||||
applylock_ = false;
|
||||
}
|
||||
|
||||
|
||||
void GERT::apply()
|
||||
{
|
||||
if (applylock_)
|
||||
return;
|
||||
|
||||
if (openradio_->get_active())
|
||||
controller().setStatus(InsetERT::Open);
|
||||
else if (collapsedradio_->get_active())
|
||||
controller().setStatus(InsetERT::Collapsed);
|
||||
else
|
||||
controller().setStatus(InsetERT::Inlined);
|
||||
|
||||
controller().dispatchParams();
|
||||
}
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
@ -1,43 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file GERT.h
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author John Spray
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#ifndef GERT_H
|
||||
#define GERT_H
|
||||
|
||||
#include "GViewBase.h"
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
class ControlERT;
|
||||
|
||||
/** This class provides a GTK+ implementation of the ERT Dialog.
|
||||
*/
|
||||
class GERT : public GViewCB<ControlERT, GViewGladeB> {
|
||||
public:
|
||||
GERT(Dialog & parent);
|
||||
private:
|
||||
virtual void apply();
|
||||
virtual void doBuild();
|
||||
virtual void update();
|
||||
|
||||
// apply() won't act when this is true
|
||||
bool applylock_;
|
||||
|
||||
Gtk::RadioButton * inlineradio_;
|
||||
Gtk::RadioButton * openradio_;
|
||||
Gtk::RadioButton * collapsedradio_;
|
||||
};
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#endif // GERT_H
|
@ -1,102 +0,0 @@
|
||||
/**
|
||||
* \file GErrorList.C
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author John Spray
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
// Too hard to make concept checks work with this file
|
||||
#ifdef _GLIBCXX_CONCEPT_CHECKS
|
||||
#undef _GLIBCXX_CONCEPT_CHECKS
|
||||
#endif
|
||||
#ifdef _GLIBCPP_CONCEPT_CHECKS
|
||||
#undef _GLIBCPP_CONCEPT_CHECKS
|
||||
#endif
|
||||
|
||||
#include "GErrorList.h"
|
||||
#include "ControlErrorList.h"
|
||||
|
||||
#include "ghelpers.h"
|
||||
|
||||
using std::string;
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
GErrorList::GErrorList(Dialog & parent)
|
||||
: GViewCB<ControlErrorList, GViewGladeB>(parent, _("Errors"), false)
|
||||
{}
|
||||
|
||||
|
||||
void GErrorList::doBuild()
|
||||
{
|
||||
string const gladeName = findGladeFile("errors");
|
||||
xml_ = Gnome::Glade::Xml::create(gladeName);
|
||||
|
||||
Gtk::Button * closebutton;
|
||||
xml_->get_widget("Close", closebutton);
|
||||
setCancel(closebutton);
|
||||
|
||||
xml_->get_widget("ErrorList", errlistview_);
|
||||
listCols_.add(listCol_);
|
||||
listCols_.add(listColIndex_);
|
||||
errliststore_ = Gtk::ListStore::create(listCols_);
|
||||
errlistview_->set_model(errliststore_);
|
||||
errlistview_->append_column("Error", listCol_);
|
||||
errlistsel_ = errlistview_->get_selection();
|
||||
|
||||
xml_->get_widget("ErrorDescription", errdescview_);
|
||||
|
||||
errlistsel_->signal_changed().connect(
|
||||
sigc::mem_fun(*this, &GErrorList::onErrListSelection));
|
||||
}
|
||||
|
||||
|
||||
void GErrorList::update()
|
||||
{
|
||||
setTitle(lyx::from_ascii(controller().name()));
|
||||
updateContents();
|
||||
}
|
||||
|
||||
|
||||
void GErrorList::onErrListSelection()
|
||||
{
|
||||
int const choice =
|
||||
(*errlistsel_->get_selected())[listColIndex_];
|
||||
|
||||
ErrorList const & errors = controller().errorList();
|
||||
errdescview_->get_buffer()->set_text(lyx::to_utf8(errors[choice].description));
|
||||
}
|
||||
|
||||
|
||||
void GErrorList::updateContents()
|
||||
{
|
||||
errliststore_->clear();
|
||||
ErrorList const & errors = controller().errorList();
|
||||
if (errors.empty()) {
|
||||
(*errliststore_->append())[listCol_] = lyx::to_utf8(_("*** No Errors ***"));
|
||||
errlistview_->set_sensitive(false);
|
||||
return;
|
||||
}
|
||||
|
||||
errlistview_->set_sensitive(true);
|
||||
|
||||
ErrorList::const_iterator cit = errors.begin();
|
||||
ErrorList::const_iterator end = errors.end();
|
||||
for (int rowindex = 0; cit != end; ++cit, ++rowindex) {
|
||||
Gtk::ListStore::Row row = *errliststore_->append();
|
||||
if (rowindex == 0)
|
||||
errlistsel_->select(*row);
|
||||
|
||||
(*row)[listCol_] = lyx::to_utf8(cit->error);
|
||||
(*row)[listColIndex_] = rowindex;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
@ -1,53 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file GErrorList.h
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author John Spray
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#ifndef GERRORLIST_H
|
||||
#define GERRORLIST_H
|
||||
|
||||
#include "GViewBase.h"
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
class ControlErrorList;
|
||||
|
||||
/** This class provides a GTK+ implementation of the ErrorList Dialog.
|
||||
*/
|
||||
class GErrorList : public GViewCB<ControlErrorList, GViewGladeB> {
|
||||
public:
|
||||
///
|
||||
GErrorList(Dialog &);
|
||||
private:
|
||||
/// not needed
|
||||
virtual void apply() {}
|
||||
/// Build the dialog
|
||||
virtual void doBuild();
|
||||
/// Update dialog before showing it
|
||||
virtual void update();
|
||||
|
||||
void updateContents();
|
||||
void onErrListSelection();
|
||||
|
||||
Gtk::TreeModelColumn<Glib::ustring> listCol_;
|
||||
Gtk::TreeModelColumn<int> listColIndex_;
|
||||
Gtk::TreeModel::ColumnRecord listCols_;
|
||||
|
||||
Glib::RefPtr<Gtk::ListStore> errliststore_;
|
||||
Glib::RefPtr<Gtk::TreeSelection> errlistsel_;
|
||||
Gtk::TreeView * errlistview_;
|
||||
|
||||
Gtk::TextView * errdescview_;
|
||||
};
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#endif // GERRORLIST_H
|
@ -1,783 +0,0 @@
|
||||
/**
|
||||
* \file GExternal.C
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Bernhard Reiter
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
// Too hard to make concept checks work with this file
|
||||
#ifdef _GLIBCXX_CONCEPT_CHECKS
|
||||
#undef _GLIBCXX_CONCEPT_CHECKS
|
||||
#endif
|
||||
#ifdef _GLIBCPP_CONCEPT_CHECKS
|
||||
#undef _GLIBCPP_CONCEPT_CHECKS
|
||||
#endif
|
||||
|
||||
#include "GExternal.h"
|
||||
#include "ControlExternal.h"
|
||||
|
||||
#include "GtkLengthEntry.h"
|
||||
|
||||
#include "ghelpers.h"
|
||||
|
||||
#include "support/lstrings.h"
|
||||
#include "support/convert.h"
|
||||
#include "support/filefilterlist.h"
|
||||
|
||||
#include <libglademm.h>
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
using lyx::docstring;
|
||||
using lyx::support::token;
|
||||
using lyx::support::FileFilterList;
|
||||
using lyx::support::trim;
|
||||
|
||||
using std::string;
|
||||
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
namespace {
|
||||
|
||||
class formatModelColumns : public Gtk::TreeModel::ColumnRecord
|
||||
{
|
||||
public:
|
||||
|
||||
formatModelColumns() { add(name); add(extra); }
|
||||
|
||||
Gtk::TreeModelColumn<Glib::ustring> name;
|
||||
Gtk::TreeModelColumn<Glib::ustring> extra;
|
||||
};
|
||||
|
||||
|
||||
class displayModelColumns : public Gtk::TreeModel::ColumnRecord
|
||||
{
|
||||
public:
|
||||
|
||||
displayModelColumns() { add(name); add(type); }
|
||||
|
||||
Gtk::TreeModelColumn<Glib::ustring> name;
|
||||
Gtk::TreeModelColumn<external::DisplayType> type;
|
||||
};
|
||||
|
||||
|
||||
class templateModelColumns : public Gtk::TreeModel::ColumnRecord
|
||||
{
|
||||
public:
|
||||
|
||||
templateModelColumns() { add(name); add(info); add(filters);}
|
||||
|
||||
Gtk::TreeModelColumn<Glib::ustring> name;
|
||||
Gtk::TreeModelColumn<Glib::ustring> info;
|
||||
Gtk::TreeModelColumn<std::vector<Gtk::FileFilter* > > filters;
|
||||
|
||||
};
|
||||
|
||||
|
||||
formatModelColumns formatColumns;
|
||||
|
||||
|
||||
/* ...ModelColumns singletons, cf. Scott Meyers, Effective C++, Item 47
|
||||
* Needed for proper initialization of the displayModelColumns::type member
|
||||
* which in turn needs to be Glib::Value<>::init'ed in time
|
||||
*/
|
||||
displayModelColumns& displayColumns() {
|
||||
static displayModelColumns dC;
|
||||
return dC;
|
||||
}
|
||||
|
||||
|
||||
templateModelColumns& templateColumns() {
|
||||
static templateModelColumns tC;
|
||||
return tC;
|
||||
}
|
||||
|
||||
|
||||
/// Produces a vector of Gtk::FileFilter*s out of the controller's filterstring
|
||||
/// providing sensible descriptions (with alttitle as a fallback)
|
||||
std::vector<Gtk::FileFilter* > get_filters(docstring const & filterstring, docstring const & alttitle)
|
||||
{
|
||||
FileFilterList filterlist(filterstring);
|
||||
std::vector<Gtk::FileFilter* > filters(filterlist.size());
|
||||
|
||||
for (unsigned int i=0; i < filterlist.size(); ++i) {
|
||||
FileFilterList::Filter ff = filterlist[i];
|
||||
|
||||
filters[i] = new Gtk::FileFilter();
|
||||
docstring const description = ff.description();
|
||||
|
||||
if (description.empty())
|
||||
filters[i]->set_name(lyx::to_utf8(alttitle + ' ' + _("files")));
|
||||
else
|
||||
filters[i]->set_name(lyx::to_utf8(description));
|
||||
|
||||
for (FileFilterList::Filter::glob_iterator git = ff.begin();
|
||||
git!=ff.end(); ++git)
|
||||
filters[i]->add_pattern(*git);
|
||||
}
|
||||
return filters;
|
||||
}
|
||||
|
||||
|
||||
void set_display(Gtk::CheckButton * show_check, Gtk::ComboBox * display_combo,
|
||||
Gtk::Label * display_label, GtkLengthEntry * scale_length,
|
||||
Gtk::Label * scale_label,
|
||||
external::DisplayType display, unsigned int scale)
|
||||
{
|
||||
|
||||
typedef Gtk::TreeModel::const_iterator gcit;
|
||||
Glib::RefPtr<const Gtk::TreeModel> const display_store =
|
||||
display_combo->get_model();
|
||||
bool const no_display = display == external::NoDisplay;
|
||||
|
||||
if (no_display)
|
||||
display_combo->set_active(
|
||||
*(display_store->children().begin())); //Default
|
||||
else
|
||||
for (gcit it = display_store->children().begin();
|
||||
it != display_store->children().end(); ++it) {
|
||||
if ((*it)[displayColumns().type] == display) {
|
||||
display_combo->set_active(*it);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
scale_length->get_spin()->set_value(scale);
|
||||
show_check->set_active(!no_display);
|
||||
|
||||
display_label->set_sensitive(!no_display);
|
||||
display_combo->set_sensitive(!no_display);
|
||||
scale_label->set_sensitive(!no_display);
|
||||
scale_length->set_sensitive(!no_display);
|
||||
}
|
||||
|
||||
|
||||
void get_display(external::DisplayType & display,
|
||||
unsigned int & scale,
|
||||
Gtk::CheckButton const * show_check,
|
||||
Gtk::ComboBox const * display_combo,
|
||||
GtkLengthEntry const * scale_length)
|
||||
{
|
||||
display = (*(display_combo->get_active()))[displayColumns().type];
|
||||
if (!show_check->get_active())
|
||||
display = external::NoDisplay;
|
||||
scale = scale_length->get_spin()->get_value_as_int();
|
||||
}
|
||||
|
||||
|
||||
void set_rotation(Gtk::Entry * angle_entry, Gtk::ComboBox * origin_combo,
|
||||
external::RotationData const & data)
|
||||
{
|
||||
origin_combo->set_active(int(data.origin()));
|
||||
angle_entry->set_text(Glib::locale_to_utf8(data.angle));
|
||||
}
|
||||
|
||||
|
||||
void get_rotation(external::RotationData & data,
|
||||
Gtk::Entry const * angle_entry,
|
||||
Gtk::ComboBox const * origin_combo)
|
||||
{
|
||||
typedef external::RotationData::OriginType OriginType;
|
||||
|
||||
data.origin(static_cast<OriginType>(
|
||||
origin_combo->get_active_row_number()));
|
||||
data.angle = Glib::locale_from_utf8(angle_entry->get_text());
|
||||
}
|
||||
|
||||
|
||||
void set_size(GtkLengthEntry * width_length,
|
||||
GtkLengthEntry * height_length,
|
||||
Gtk::CheckButton * ar_check,
|
||||
external::ResizeData const & data)
|
||||
{
|
||||
bool using_scale = data.usingScale();
|
||||
double scale = convert<double>(data.scale);
|
||||
if (data.no_resize()) {
|
||||
// Everything is zero, so default to this!
|
||||
using_scale = true;
|
||||
scale = 100.0;
|
||||
}
|
||||
|
||||
if (using_scale) {
|
||||
width_length->get_spin()->set_value(scale);
|
||||
width_length->get_combo()->set_active_text(
|
||||
lyx::to_utf8(_("Scale%")));
|
||||
} else {
|
||||
width_length->set_length(data.width);
|
||||
}
|
||||
|
||||
height_length->set_length(data.height);
|
||||
if (!data.width.zero())
|
||||
height_length->get_combo()->set_active(data.width.unit());
|
||||
|
||||
height_length->set_sensitive(!using_scale);
|
||||
|
||||
ar_check->set_active(data.keepAspectRatio);
|
||||
|
||||
bool const disable_aspectRatio = using_scale ||
|
||||
data.width.zero() || data.height.zero();
|
||||
ar_check->set_sensitive(!disable_aspectRatio);
|
||||
}
|
||||
|
||||
|
||||
void get_size(external::ResizeData & data,
|
||||
GtkLengthEntry * width_length,
|
||||
GtkLengthEntry * height_length,
|
||||
Gtk::CheckButton * ar_check)
|
||||
{
|
||||
if (width_length->get_combo()->get_active_text() !=
|
||||
lyx::to_utf8(_("Scale%"))) {
|
||||
|
||||
data.width = width_length->get_length();
|
||||
data.scale = string();
|
||||
} else {
|
||||
// scaling instead of a width
|
||||
data.scale = convert<string>(width_length->get_spin()->get_value());
|
||||
data.width = LyXLength();
|
||||
}
|
||||
|
||||
data.height = height_length->get_length();
|
||||
|
||||
data.keepAspectRatio = ar_check->get_active();
|
||||
}
|
||||
|
||||
|
||||
void set_crop(Gtk::CheckButton * clip_check,
|
||||
Gtk::Entry * xl_entry, Gtk::Entry * yb_entry,
|
||||
Gtk::Entry * xr_entry, Gtk::Entry * yt_entry,
|
||||
external::ClipData const & data)
|
||||
{
|
||||
clip_check->set_active(data.clip);
|
||||
graphics::BoundingBox const & bbox = data.bbox;
|
||||
xl_entry->set_text(Glib::locale_to_utf8(convert<string>(bbox.xl)));
|
||||
yb_entry->set_text(Glib::locale_to_utf8(convert<string>(bbox.yb)));
|
||||
xr_entry->set_text(Glib::locale_to_utf8(convert<string>(bbox.xr)));
|
||||
yt_entry->set_text(Glib::locale_to_utf8(convert<string>(bbox.yt)));
|
||||
|
||||
}
|
||||
|
||||
|
||||
void get_crop(external::ClipData & data,
|
||||
Gtk::CheckButton const * clip_check,
|
||||
Gtk::Entry const * xl_entry, Gtk::Entry const * yb_entry,
|
||||
Gtk::Entry const * xr_entry, Gtk::Entry const * yt_entry,
|
||||
bool bb_changed)
|
||||
{
|
||||
data.clip = clip_check->get_active();
|
||||
|
||||
if (!bb_changed)
|
||||
return;
|
||||
|
||||
data.bbox.xl = convert<int>(Glib::locale_from_utf8(xl_entry->get_text()));
|
||||
data.bbox.yb = convert<int>(Glib::locale_from_utf8(yb_entry->get_text()));
|
||||
data.bbox.xr = convert<int>(Glib::locale_from_utf8(xr_entry->get_text()));
|
||||
data.bbox.yt = convert<int>(Glib::locale_from_utf8(yt_entry->get_text()));
|
||||
}
|
||||
|
||||
|
||||
void get_extra(external::ExtraData & data,
|
||||
Glib::RefPtr<Gtk::ListStore> format_store)
|
||||
{
|
||||
Gtk::TreeModel::iterator it = format_store->children().begin();
|
||||
Gtk::TreeModel::iterator end = format_store->children().end();
|
||||
for (; it != end; ++it)
|
||||
data.set(Glib::locale_from_utf8((*it)[formatColumns.name]),
|
||||
trim(Glib::locale_from_utf8((*it)[formatColumns.extra])));
|
||||
}
|
||||
|
||||
} // namespace anon
|
||||
|
||||
|
||||
GExternal::GExternal(Dialog & parent)
|
||||
: GViewCB<ControlExternal, GViewGladeB>(parent, _("External Settings"), false)
|
||||
{}
|
||||
|
||||
|
||||
void GExternal::doBuild()
|
||||
{
|
||||
string const gladeName = findGladeFile("external");
|
||||
xml_ = Gnome::Glade::Xml::create(gladeName);
|
||||
|
||||
xml_->get_widget("Cancel", cancelbutton_);
|
||||
setCancel(cancelbutton_);
|
||||
xml_->get_widget("Apply", applybutton_);
|
||||
setApply(applybutton_);
|
||||
xml_->get_widget("OK", okbutton_);
|
||||
setOK(okbutton_);
|
||||
|
||||
xml_->get_widget("notebook", notebook_);
|
||||
|
||||
templatestore_ = Gtk::ListStore::create(templateColumns());
|
||||
|
||||
std::vector<string> templates(controller().getTemplates());
|
||||
int count = 0;
|
||||
|
||||
std::vector<std::vector<Gtk::FileFilter> > myfilterlist;
|
||||
|
||||
// Fill the templates combo
|
||||
for (std::vector<string>::const_iterator cit = templates.begin();
|
||||
cit != templates.end(); ++cit, ++count) {
|
||||
external::Template templ = controller().getTemplate(count);
|
||||
|
||||
Gtk::TreeModel::iterator iter = templatestore_->append();
|
||||
(*iter)[templateColumns().name] = *cit;
|
||||
(*iter)[templateColumns().info] = templ.helpText;
|
||||
(*iter)[templateColumns().filters] = get_filters(
|
||||
lyx::from_utf8(controller().getTemplateFilters(*cit)),
|
||||
lyx::from_utf8(*cit));
|
||||
}
|
||||
|
||||
|
||||
xml_->get_widget("Template", templatecombo_);
|
||||
templatecombo_->pack_start(templateColumns().name);
|
||||
templatecombo_->set_model(templatestore_);
|
||||
templatecombo_->signal_changed().connect(
|
||||
sigc::mem_fun(*this, &GExternal::template_changed));
|
||||
|
||||
xml_->get_widget("TemplateView", templateview_);
|
||||
|
||||
templatebuffer_ = Gtk::TextBuffer::create();
|
||||
templateview_->set_buffer(templatebuffer_);
|
||||
|
||||
// *** Start "File" Page ***
|
||||
xml_->get_widget("TemplateFile", templatefcbutton_);
|
||||
templatefcbutton_->set_title(lyx::to_utf8(_("Select external file")));
|
||||
templatefcbutton_->signal_file_activated().connect(
|
||||
sigc::mem_fun(*this, &GExternal::file_changed));
|
||||
|
||||
xml_->get_widget("FileLabel", filelabel_);
|
||||
filelabel_->set_mnemonic_widget(*templatefcbutton_);
|
||||
|
||||
xml_->get_widget("Draft", draftcheck_);
|
||||
xml_->get_widget("EditFile", editfilebutton_);
|
||||
editfilebutton_->signal_clicked().connect(
|
||||
sigc::mem_fun(*this, &GExternal::edit_clicked));
|
||||
// *** End "File" Page ***
|
||||
|
||||
// *** Start "LyX View" Page ***
|
||||
xml_->get_widget("ShowInLyX", showcheck_);
|
||||
showcheck_->signal_toggled().connect(
|
||||
sigc::mem_fun(*this, &GExternal::showcheck_toggled));
|
||||
|
||||
xml_->get_widget("DisplayLabel", displaylabel_);
|
||||
|
||||
displaystore_ = Gtk::ListStore::create(displayColumns());
|
||||
|
||||
// Fill the display combo
|
||||
Gtk::TreeModel::iterator iter = displaystore_->append();
|
||||
(*iter)[displayColumns().name] = lyx::to_utf8(_("Default"));
|
||||
(*iter)[displayColumns().type] = external::DefaultDisplay;
|
||||
iter = displaystore_->append();
|
||||
(*iter)[displayColumns().name] = lyx::to_utf8(_("Monochrome"));
|
||||
(*iter)[displayColumns().type] = external::MonochromeDisplay;
|
||||
iter = displaystore_->append();
|
||||
(*iter)[displayColumns().name] = lyx::to_utf8(_("Grayscale"));
|
||||
(*iter)[displayColumns().type] = external::GrayscaleDisplay;
|
||||
iter = displaystore_->append();
|
||||
(*iter)[displayColumns().name] = lyx::to_utf8(_("Color"));
|
||||
(*iter)[displayColumns().type] = external::ColorDisplay;
|
||||
iter = displaystore_->append();
|
||||
(*iter)[displayColumns().name] = lyx::to_utf8(_("Preview"));
|
||||
(*iter)[displayColumns().type] = external::PreviewDisplay;
|
||||
|
||||
xml_->get_widget("Display", displaycombo_);
|
||||
displaycombo_->set_model(displaystore_);
|
||||
displaycombo_->pack_start(displayColumns().name);
|
||||
|
||||
xml_->get_widget_derived ("Scale", scalelength_);
|
||||
scalespin_ = scalelength_->get_spin();
|
||||
scalespin_->set_digits(0);
|
||||
scalespin_->set_range(0,100);
|
||||
scalespin_->set_increments(1,10);
|
||||
scalecombo_ = scalelength_->get_combo();
|
||||
scalecombo_->clear();
|
||||
scalecombo_->append_text(lyx::to_utf8(_("Scale%")));
|
||||
scalecombo_->set_active_text(lyx::to_utf8(_("Scale%")));
|
||||
|
||||
xml_->get_widget("ScaleLabel", scalelabel_);
|
||||
scalelabel_->set_mnemonic_widget(*scalespin_);
|
||||
// *** End "LyX View" Page ***
|
||||
|
||||
// *** Start "Rotate" Page ***
|
||||
xml_->get_widget("Angle", angleentry_);
|
||||
|
||||
Gtk::Box * box = NULL;
|
||||
xml_->get_widget("OriginBox", box);
|
||||
box->pack_start(origincombo_, true, true, 0);
|
||||
box->show_all();
|
||||
|
||||
// Fill the origins combo
|
||||
typedef std::vector<external::RotationDataType> Origins;
|
||||
Origins const & all_origins = external::all_origins();
|
||||
for (Origins::size_type i = 0; i != all_origins.size(); ++i)
|
||||
origincombo_.append_text(
|
||||
external::origin_gui_str(i));
|
||||
|
||||
xml_->get_widget("OriginLabel", originlabel_);
|
||||
originlabel_->set_mnemonic_widget(origincombo_);
|
||||
// *** End "Rotate" Page ***
|
||||
|
||||
// *** Start "Scale" Page ***
|
||||
xml_->get_widget_derived ("Width", widthlength_);
|
||||
widthcombo_ = widthlength_->get_combo();
|
||||
widthcombo_->prepend_text(lyx::to_utf8(_("Scale%")));
|
||||
widthcombo_->set_active_text(lyx::to_utf8(_("Scale%")));
|
||||
|
||||
xml_->get_widget("WidthLabel", widthlabel_);
|
||||
widthlabel_->set_mnemonic_widget(*(widthlength_->get_spin()));
|
||||
|
||||
xml_->get_widget_derived ("Height", heightlength_);
|
||||
|
||||
widthlength_->signal_changed().connect(
|
||||
sigc::mem_fun(*this, &GExternal::size_changed));
|
||||
heightlength_->signal_changed().connect(
|
||||
sigc::mem_fun(*this, &GExternal::size_changed));
|
||||
|
||||
xml_->get_widget("HeightLabel", heightlabel_);
|
||||
heightlabel_->set_mnemonic_widget(*(heightlength_->get_spin()));
|
||||
|
||||
xml_->get_widget ("AspectRatio", archeck_);
|
||||
// *** End "Scale" Page ***
|
||||
|
||||
// *** Start "Crop" Page ***
|
||||
xml_->get_widget("Clip", clipcheck_);
|
||||
clipcheck_->signal_toggled().connect(
|
||||
sigc::mem_fun(*this, &GExternal::clipcheck_toggled));
|
||||
|
||||
xml_->get_widget("GetFromFile", bbfromfilebutton_);
|
||||
|
||||
bbfromfilebutton_->signal_clicked().connect(
|
||||
sigc::mem_fun(*this, &GExternal::get_bb));
|
||||
|
||||
xml_->get_widget("xLabel", xlabel_);
|
||||
xml_->get_widget("yLabel", ylabel_);
|
||||
xml_->get_widget("RightTopLabel", rtlabel_);
|
||||
xml_->get_widget("LeftBottomLabel", lblabel_);
|
||||
|
||||
xml_->get_widget("xLeft", xlentry_);
|
||||
xlentry_->signal_editing_done().connect(
|
||||
sigc::mem_fun(*this, &GExternal::bb_changed));
|
||||
|
||||
xml_->get_widget("yBottom", ybentry_);
|
||||
ybentry_->signal_editing_done().connect(
|
||||
sigc::mem_fun(*this, &GExternal::bb_changed));
|
||||
|
||||
xml_->get_widget("xRight", xrentry_);
|
||||
xrentry_->signal_editing_done().connect(
|
||||
sigc::mem_fun(*this, &GExternal::bb_changed));
|
||||
|
||||
xml_->get_widget("yTop", ytentry_);
|
||||
ytentry_->signal_editing_done().connect(
|
||||
sigc::mem_fun(*this, &GExternal::bb_changed));
|
||||
|
||||
// *** End "Crop" Page ***
|
||||
|
||||
// *** Start "Options" Page ***
|
||||
formatstore_ = Gtk::ListStore::create(formatColumns);
|
||||
|
||||
xml_->get_widget("Options", optionsview_);
|
||||
optionsview_->set_model(formatstore_);
|
||||
optionsview_->append_column(lyx::to_utf8(_("Forma_t")), formatColumns.name);
|
||||
optionsview_->append_column_editable(lyx::to_utf8(_("O_ption")), formatColumns.extra);
|
||||
// *** End "Options" Page ***
|
||||
}
|
||||
|
||||
|
||||
void GExternal::update()
|
||||
{
|
||||
InsetExternalParams const & params = controller().params();
|
||||
|
||||
std::string const name = params.filename.outputFilename();
|
||||
templatefcbutton_->set_filename(name);
|
||||
|
||||
if (name != Glib::ustring()) {
|
||||
|
||||
editfilebutton_->set_sensitive(true);
|
||||
bbfromfilebutton_->set_sensitive(true);
|
||||
}
|
||||
else {
|
||||
editfilebutton_->set_sensitive(false);
|
||||
bbfromfilebutton_->set_sensitive(false);
|
||||
}
|
||||
|
||||
templatecombo_->set_active(
|
||||
controller().getTemplateNumber(params.templatename()));
|
||||
update_template();
|
||||
|
||||
draftcheck_->set_active(params.draft);
|
||||
|
||||
set_display(showcheck_, displaycombo_, displaylabel_, scalelength_, scalelabel_, params.display, params.lyxscale);
|
||||
|
||||
set_rotation(angleentry_, &origincombo_, params.rotationdata);
|
||||
|
||||
set_size(widthlength_, heightlength_, archeck_, params.resizedata);
|
||||
|
||||
set_crop(clipcheck_,
|
||||
xlentry_, ybentry_,
|
||||
xrentry_, ytentry_,
|
||||
params.clipdata);
|
||||
|
||||
controller().bbChanged(!params.clipdata.bbox.empty());
|
||||
}
|
||||
|
||||
|
||||
void GExternal::update_template()
|
||||
{
|
||||
external::Template templ =
|
||||
controller().getTemplate(
|
||||
templatecombo_->get_active_row_number());
|
||||
|
||||
// Remove file stale filters, if present
|
||||
// Keep the current file selected even after a template change
|
||||
Glib::ustring currentfilename;
|
||||
|
||||
typedef std::vector<Gtk::FileFilter* >::iterator ffit;
|
||||
std::vector<Gtk::FileFilter* > templatefilters;
|
||||
|
||||
if (currenttemplate_) {
|
||||
currentfilename = templatefcbutton_->get_filename();
|
||||
templatefilters =
|
||||
(*currenttemplate_)[templateColumns().filters];
|
||||
|
||||
for (ffit it = templatefilters.begin();
|
||||
it != templatefilters.end(); ++it)
|
||||
templatefcbutton_->remove_filter(**it);
|
||||
}
|
||||
|
||||
currenttemplate_ = templatecombo_->get_active();
|
||||
|
||||
templatebuffer_->set_text((*currenttemplate_)[templateColumns().info]);
|
||||
|
||||
// Ascertain which (if any) transformations the template supports
|
||||
// and disable tabs hosting unsupported transforms.
|
||||
typedef std::vector<external::TransformID> TransformIDs;
|
||||
TransformIDs const transformIds = templ.transformIds;
|
||||
TransformIDs::const_iterator tr_begin = transformIds.begin();
|
||||
TransformIDs::const_iterator const tr_end = transformIds.end();
|
||||
|
||||
bool found = find(tr_begin, tr_end, external::Rotate) != tr_end;
|
||||
Gtk::Widget * widget = notebook_->get_nth_page(2);
|
||||
widget->set_sensitive(found);
|
||||
notebook_->get_tab_label(*widget)->set_sensitive(found);
|
||||
|
||||
found = find(tr_begin, tr_end, external::Resize) != tr_end;
|
||||
widget = notebook_->get_nth_page(3);
|
||||
widget->set_sensitive(found);
|
||||
notebook_->get_tab_label(*widget)->set_sensitive(found);
|
||||
|
||||
found = find(tr_begin, tr_end, external::Clip) != tr_end;
|
||||
widget = notebook_->get_nth_page(4);
|
||||
widget->set_sensitive(found);
|
||||
notebook_->get_tab_label(*widget)->set_sensitive(found);
|
||||
|
||||
found = find(tr_begin, tr_end, external::Extra) != tr_end;
|
||||
widget = notebook_->get_nth_page(5);
|
||||
widget->set_sensitive(found);
|
||||
notebook_->get_tab_label(*widget)->set_sensitive(found);
|
||||
|
||||
// Add new filters; set the "All files" filter
|
||||
// in order to allow the previously selected file to remain selected
|
||||
templatefilters = (*currenttemplate_)[templateColumns().filters];
|
||||
for (ffit it = templatefilters.begin();
|
||||
it != templatefilters.end(); ++it)
|
||||
templatefcbutton_->add_filter(**it);
|
||||
|
||||
templatefcbutton_->set_filter(*templatefilters.back()); // "All files"
|
||||
|
||||
if (currentfilename != Glib::ustring())
|
||||
templatefcbutton_->set_filename(currentfilename);
|
||||
|
||||
if (!found)
|
||||
return;
|
||||
|
||||
// Ascertain whether the template has any formats supporting
|
||||
// the 'Extra' option
|
||||
Glib::ustring templatename =
|
||||
(*currenttemplate_)[templateColumns().name];
|
||||
formatstore_->clear();
|
||||
external::Template::Formats::const_iterator it = templ.formats.begin();
|
||||
external::Template::Formats::const_iterator end = templ.formats.end();
|
||||
|
||||
bool const enabled = (it != end);
|
||||
|
||||
for (; it != end; ++it) {
|
||||
if (it->second.option_transformers.find(external::Extra) ==
|
||||
it->second.option_transformers.end())
|
||||
continue;
|
||||
string const format = it->first;
|
||||
string const opt = controller().params().extradata.get(format);
|
||||
|
||||
Gtk::TreeModel::iterator iter = formatstore_->append();
|
||||
(*iter)[formatColumns.name] = Glib::locale_to_utf8(format);
|
||||
(*iter)[formatColumns.extra] = Glib::locale_to_utf8(opt);
|
||||
}
|
||||
|
||||
// widget is still the 'Options' tab
|
||||
notebook_->get_tab_label(*widget)->set_sensitive(enabled);
|
||||
}
|
||||
|
||||
|
||||
void GExternal::apply()
|
||||
{
|
||||
InsetExternalParams params = controller().params();
|
||||
|
||||
params.filename.set(templatefcbutton_->get_filename(),
|
||||
kernel().bufferFilepath());
|
||||
|
||||
params.settemplate(
|
||||
Glib::locale_from_utf8((*(templatecombo_->get_active()))[templateColumns().name]));
|
||||
|
||||
params.draft = draftcheck_->get_active();
|
||||
|
||||
get_display(params.display, params.lyxscale,
|
||||
showcheck_, displaycombo_, scalelength_);
|
||||
|
||||
if (notebook_->get_nth_page(2)->is_sensitive())
|
||||
get_rotation(params.rotationdata,
|
||||
angleentry_, &origincombo_);
|
||||
|
||||
if (notebook_->get_nth_page(3)->is_sensitive())
|
||||
get_size(params.resizedata,
|
||||
widthlength_, heightlength_, archeck_);
|
||||
|
||||
if (notebook_->get_nth_page(4)->is_sensitive())
|
||||
get_crop(params.clipdata,
|
||||
clipcheck_,
|
||||
xlentry_, ybentry_,
|
||||
xrentry_, ytentry_,
|
||||
controller().bbChanged());
|
||||
|
||||
if (notebook_->get_nth_page(5)->is_sensitive())
|
||||
get_extra(params.extradata, formatstore_);
|
||||
|
||||
controller().setParams(params);
|
||||
}
|
||||
|
||||
|
||||
void GExternal::get_bb()
|
||||
{
|
||||
xlentry_->set_text("0");
|
||||
ybentry_->set_text("0");
|
||||
xrentry_->set_text("0");
|
||||
ytentry_->set_text("0");
|
||||
|
||||
string const filename = templatefcbutton_->get_filename();
|
||||
if (filename.empty())
|
||||
return;
|
||||
|
||||
string const bb = controller().readBB(filename);
|
||||
if (bb.empty())
|
||||
return;
|
||||
|
||||
xlentry_->set_text(Glib::locale_to_utf8(token(bb, ' ', 0)));
|
||||
ybentry_->set_text(Glib::locale_to_utf8(token(bb, ' ', 1)));
|
||||
xrentry_->set_text(Glib::locale_to_utf8(token(bb, ' ', 2)));
|
||||
ytentry_->set_text(Glib::locale_to_utf8(token(bb, ' ', 3)));
|
||||
|
||||
controller().bbChanged(false);
|
||||
bc().valid(true);
|
||||
}
|
||||
|
||||
|
||||
bool GExternal::activate_ar() const
|
||||
{
|
||||
if (widthlength_->get_combo()->get_active_text() ==
|
||||
lyx::to_utf8(_("Scale%")))
|
||||
return false;
|
||||
|
||||
if (widthlength_->get_spin()->get_value() < 0.05)
|
||||
return false;
|
||||
|
||||
if (heightlength_->get_spin()->get_value() < 0.05)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void GExternal::bb_changed()
|
||||
{
|
||||
controller().bbChanged(true);
|
||||
bc().valid(true);
|
||||
}
|
||||
|
||||
|
||||
void GExternal::edit_clicked()
|
||||
{
|
||||
controller().editExternal();
|
||||
}
|
||||
|
||||
|
||||
void GExternal::size_changed()
|
||||
{
|
||||
archeck_->set_sensitive(activate_ar());
|
||||
|
||||
bool useHeight = widthlength_->get_combo()->get_active_text() !=
|
||||
lyx::to_utf8(_("Scale%"));
|
||||
|
||||
heightlength_->set_sensitive(useHeight);
|
||||
}
|
||||
|
||||
|
||||
void GExternal::template_changed()
|
||||
{
|
||||
update_template();
|
||||
bc().valid(true);
|
||||
}
|
||||
|
||||
|
||||
void GExternal::showcheck_toggled()
|
||||
{
|
||||
bool checked = showcheck_->get_active();
|
||||
displaylabel_->set_sensitive(checked);
|
||||
displaycombo_->set_sensitive(checked);
|
||||
scalelabel_->set_sensitive(checked);
|
||||
scalelength_->set_sensitive(checked);
|
||||
|
||||
bc().valid(true);
|
||||
}
|
||||
|
||||
|
||||
void GExternal::clipcheck_toggled()
|
||||
{
|
||||
bool checked = clipcheck_->get_active();
|
||||
|
||||
xlabel_->set_sensitive(checked);
|
||||
ylabel_->set_sensitive(checked);
|
||||
rtlabel_->set_sensitive(checked);
|
||||
lblabel_->set_sensitive(checked);
|
||||
|
||||
xlentry_->set_sensitive(checked);
|
||||
ybentry_->set_sensitive(checked);
|
||||
xrentry_->set_sensitive(checked);
|
||||
ytentry_->set_sensitive(checked);
|
||||
|
||||
bc().valid(true);
|
||||
}
|
||||
|
||||
|
||||
void GExternal::file_changed()
|
||||
{
|
||||
if (templatefcbutton_->get_filename() != Glib::ustring()) {
|
||||
|
||||
editfilebutton_->set_sensitive(true);
|
||||
bbfromfilebutton_->set_sensitive(true);
|
||||
}
|
||||
else {
|
||||
editfilebutton_->set_sensitive(false);
|
||||
bbfromfilebutton_->set_sensitive(false);
|
||||
}
|
||||
bc().valid(true);
|
||||
}
|
||||
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
@ -1,168 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file GExternal.h
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Bernhard Reiter
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#ifndef GEXTERNAL_H
|
||||
#define GEXTERNAL_H
|
||||
|
||||
#include "GViewBase.h"
|
||||
|
||||
#include "GtkLengthEntry.h"
|
||||
|
||||
#include "insets/ExternalTemplate.h"
|
||||
#include "insets/insetexternal.h"
|
||||
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
|
||||
class ControlExternal;
|
||||
|
||||
/** This class provides a GTK+ implementation of the External Dialog.
|
||||
*/
|
||||
class GExternal : public GViewCB<ControlExternal, GViewGladeB> {
|
||||
public:
|
||||
GExternal(Dialog & parent);
|
||||
private:
|
||||
virtual void apply();
|
||||
virtual void doBuild();
|
||||
virtual void update();
|
||||
|
||||
/** Called if a different template is selected from the templates combo
|
||||
Updates the dialog widgets accordingly
|
||||
*/
|
||||
void update_template();
|
||||
|
||||
/** Called if the "Get from file" button in the Crop tab is pressed
|
||||
Inserts bounding box coordinates from file into coordinate entries
|
||||
*/
|
||||
void get_bb();
|
||||
|
||||
/** Checks if the Aspect Ratio CheckButton is to be activated
|
||||
True if widthlength_'s unit is not Scale% and both widthlength and
|
||||
heightlength_ are nonzero
|
||||
*/
|
||||
bool activate_ar() const;
|
||||
|
||||
/** Calls controller().bbChanged() providing it with new coordinates
|
||||
if they any of them were changed
|
||||
*/
|
||||
void bb_changed();
|
||||
|
||||
/** Calls controller().editExternal() if corresponding button is
|
||||
clicked
|
||||
*/
|
||||
void edit_clicked();
|
||||
|
||||
/** Sets Aspect Ratio CheckButton and Height Length sensitive or greys
|
||||
them out depending on widthlength_'s and heightlength_'s status
|
||||
Called if either widthlength_ or heightlength_ were changed
|
||||
*/
|
||||
void size_changed();
|
||||
|
||||
/// enables the apply button
|
||||
void template_changed();
|
||||
|
||||
/** Sets sensitivity of the LyxView tab's other widgets depending und
|
||||
the 'Show in LyX' CheckButton
|
||||
*/
|
||||
void showcheck_toggled();
|
||||
|
||||
|
||||
/** Sets sensitivity of the Crop tab's other widgets depending und
|
||||
the 'Clip to bounding box' CheckButton
|
||||
*/
|
||||
void clipcheck_toggled();
|
||||
|
||||
/** Sets sensitivity of the 'Edit file' and
|
||||
'Get [bounding box] from file' buttons if there was a file selected
|
||||
*/
|
||||
void file_changed();
|
||||
|
||||
/// Holds the currently selected template
|
||||
Gtk::TreeModel::iterator currenttemplate_;
|
||||
|
||||
|
||||
// Widgets & couple of corresponding models
|
||||
|
||||
Gtk::Button * cancelbutton_;
|
||||
Gtk::Button * okbutton_;
|
||||
Gtk::Button * applybutton_;
|
||||
|
||||
Glib::RefPtr<Gtk::ListStore> templatestore_;
|
||||
Gtk::ComboBox * templatecombo_;
|
||||
|
||||
Glib::RefPtr<Gtk::TextBuffer> templatebuffer_;
|
||||
Gtk::TextView * templateview_;
|
||||
|
||||
Gtk::Notebook * notebook_;
|
||||
|
||||
// *** Start "File" Page ***
|
||||
Gtk::Label * filelabel_;
|
||||
Gtk::FileChooserButton * templatefcbutton_; //requires gtkmm>=2.6
|
||||
Gtk::Button * editfilebutton_;
|
||||
Gtk::CheckButton * draftcheck_;
|
||||
// *** End "File" Page ***
|
||||
|
||||
// *** Start "LyX View" Page ***
|
||||
Gtk::CheckButton * showcheck_;
|
||||
Gtk::Label * displaylabel_;
|
||||
Glib::RefPtr<Gtk::ListStore> displaystore_;
|
||||
Gtk::ComboBox * displaycombo_;
|
||||
Gtk::Label * scalelabel_;
|
||||
GtkLengthEntry * scalelength_;
|
||||
Gtk::ComboBoxText * scalecombo_;
|
||||
Gtk::SpinButton * scalespin_;
|
||||
Gtk::Label * percentlabel_;
|
||||
// *** End "LyX View" Page ***
|
||||
|
||||
// *** Start "Rotate" Page ***
|
||||
Gtk::Entry * angleentry_;
|
||||
Gtk::Label * originlabel_;
|
||||
Gtk::ComboBoxText origincombo_;
|
||||
// *** End "Rotate" Page ***
|
||||
|
||||
// *** Start "Scale" Page ***
|
||||
Gtk::CheckButton * archeck_;
|
||||
Gtk::Label * widthlabel_;
|
||||
GtkLengthEntry * widthlength_;
|
||||
Gtk::Label * heightlabel_;
|
||||
GtkLengthEntry * heightlength_;
|
||||
|
||||
Gtk::ComboBoxText * widthcombo_;
|
||||
// *** End "Scale" Page ***
|
||||
|
||||
// *** Start "Crop" Page ***
|
||||
Gtk::CheckButton * clipcheck_;
|
||||
Gtk::Button * bbfromfilebutton_;
|
||||
|
||||
Gtk::Label * xlabel_;
|
||||
Gtk::Label * ylabel_;
|
||||
Gtk::Label * rtlabel_;
|
||||
Gtk::Label * lblabel_;
|
||||
|
||||
Gtk::Entry * xlentry_;
|
||||
Gtk::Entry * ybentry_;
|
||||
Gtk::Entry * xrentry_;
|
||||
Gtk::Entry * ytentry_;
|
||||
// *** End "Crop" Page ***
|
||||
|
||||
// *** Start "Options" Page ***
|
||||
Glib::RefPtr<Gtk::ListStore> formatstore_;
|
||||
Gtk::TreeView * optionsview_;
|
||||
// *** End "Options" Page ***
|
||||
|
||||
};
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#endif // GEXTERNAL_H
|
@ -1,226 +0,0 @@
|
||||
/**
|
||||
* \file GFloat.C
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author John Spray
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
// Too hard to make concept checks work with this file
|
||||
#ifdef _GLIBCXX_CONCEPT_CHECKS
|
||||
#undef _GLIBCXX_CONCEPT_CHECKS
|
||||
#endif
|
||||
#ifdef _GLIBCPP_CONCEPT_CHECKS
|
||||
#undef _GLIBCPP_CONCEPT_CHECKS
|
||||
#endif
|
||||
|
||||
#include "GFloat.h"
|
||||
#include "ControlFloat.h"
|
||||
|
||||
#include "ghelpers.h"
|
||||
|
||||
#include "insets/insetfloat.h"
|
||||
|
||||
#include "support/lstrings.h"
|
||||
|
||||
#include <libglademm.h>
|
||||
|
||||
using std::string;
|
||||
|
||||
namespace lyx {
|
||||
|
||||
using support::contains;
|
||||
|
||||
namespace frontend {
|
||||
|
||||
GFloat::GFloat(Dialog & parent)
|
||||
: GViewCB<ControlFloat, GViewGladeB>(parent, _("Float Settings"), false)
|
||||
{}
|
||||
|
||||
|
||||
void GFloat::doBuild()
|
||||
{
|
||||
string const gladeName = findGladeFile("float");
|
||||
xml_ = Gnome::Glade::Xml::create(gladeName);
|
||||
|
||||
Gtk::Button * cancelbutton;
|
||||
xml_->get_widget("Close", cancelbutton);
|
||||
setCancel(cancelbutton);
|
||||
|
||||
xml_->get_widget("Default", defaultradio_);
|
||||
xml_->get_widget("HereDefinitely", heredefinitelyradio_);
|
||||
xml_->get_widget("Alternative", alternativeradio_);
|
||||
xml_->get_widget("Top", topcheck_);
|
||||
xml_->get_widget("Bottom", bottomcheck_);
|
||||
xml_->get_widget("PageOfFloats", pageoffloatscheck_);
|
||||
xml_->get_widget("HereIfPossible", hereifpossiblecheck_);
|
||||
xml_->get_widget("IgnoreRules", ignorerulescheck_);
|
||||
xml_->get_widget("SpanColumns", spancolumnscheck_);
|
||||
xml_->get_widget("RotateSideways", rotatesidewayscheck_);
|
||||
|
||||
defaultradio_->signal_toggled().connect(
|
||||
sigc::mem_fun(*this, &GFloat::apply));
|
||||
heredefinitelyradio_->signal_toggled().connect(
|
||||
sigc::mem_fun(*this, &GFloat::apply));
|
||||
alternativeradio_->signal_toggled().connect(
|
||||
sigc::mem_fun(*this, &GFloat::apply));
|
||||
topcheck_->signal_toggled().connect(
|
||||
sigc::mem_fun(*this, &GFloat::apply));
|
||||
bottomcheck_->signal_toggled().connect(
|
||||
sigc::mem_fun(*this, &GFloat::apply));
|
||||
pageoffloatscheck_->signal_toggled().connect(
|
||||
sigc::mem_fun(*this, &GFloat::apply));
|
||||
hereifpossiblecheck_->signal_toggled().connect(
|
||||
sigc::mem_fun(*this, &GFloat::apply));
|
||||
ignorerulescheck_->signal_toggled().connect(
|
||||
sigc::mem_fun(*this, &GFloat::apply));
|
||||
spancolumnscheck_->signal_toggled().connect(
|
||||
sigc::mem_fun(*this, &GFloat::apply));
|
||||
rotatesidewayscheck_->signal_toggled().connect(
|
||||
sigc::mem_fun(*this, &GFloat::apply));
|
||||
|
||||
bcview().addReadOnly(defaultradio_);
|
||||
bcview().addReadOnly(heredefinitelyradio_);
|
||||
bcview().addReadOnly(alternativeradio_);
|
||||
bcview().addReadOnly(topcheck_);
|
||||
bcview().addReadOnly(bottomcheck_);
|
||||
bcview().addReadOnly(pageoffloatscheck_);
|
||||
bcview().addReadOnly(hereifpossiblecheck_);
|
||||
bcview().addReadOnly(ignorerulescheck_);
|
||||
bcview().addReadOnly(spancolumnscheck_);
|
||||
bcview().addReadOnly(rotatesidewayscheck_);
|
||||
}
|
||||
|
||||
|
||||
void GFloat::update()
|
||||
{
|
||||
applylock_ = true;
|
||||
|
||||
bc().refreshReadOnly();
|
||||
|
||||
string placement(controller().params().placement);
|
||||
bool const wide = controller().params().wide;
|
||||
bool const sideways = controller().params().sideways;
|
||||
|
||||
bool const here_definitely = contains(placement, 'H');
|
||||
|
||||
bool const top = contains(placement, 't');
|
||||
bool const bottom = contains(placement, 'b');
|
||||
bool const page = contains(placement, 'p');
|
||||
bool const here = contains(placement, 'h');
|
||||
bool const force = contains(placement, '!');
|
||||
bool const alternatives = top || bottom || page || (here && !wide);
|
||||
|
||||
if (alternatives) {
|
||||
alternativeradio_->set_active(true);
|
||||
} else if (here_definitely) {
|
||||
heredefinitelyradio_->set_active(true);
|
||||
} else {
|
||||
defaultradio_->set_active(true);
|
||||
}
|
||||
ignorerulescheck_->set_active(force);
|
||||
topcheck_->set_active(top);
|
||||
bottomcheck_->set_active(bottom);
|
||||
pageoffloatscheck_->set_active(page);
|
||||
hereifpossiblecheck_->set_active(here);
|
||||
spancolumnscheck_->set_active(wide);
|
||||
rotatesidewayscheck_->set_active(sideways);
|
||||
|
||||
updateSensitivity();
|
||||
|
||||
applylock_ = false;
|
||||
}
|
||||
|
||||
|
||||
void GFloat::updateSensitivity()
|
||||
{
|
||||
bool const wide = spancolumnscheck_->get_active();
|
||||
bool const sideways = rotatesidewayscheck_->get_active();
|
||||
bool const sideways_possible = (controller().params().type == "figure"
|
||||
|| controller().params().type == "table");
|
||||
bool const alternatives = alternativeradio_->get_active();
|
||||
bool const readonly = readOnly();
|
||||
|
||||
heredefinitelyradio_->set_sensitive(!wide && !sideways && !readonly);
|
||||
ignorerulescheck_->set_sensitive(alternatives && !sideways && !readonly);
|
||||
topcheck_->set_sensitive(alternatives && !sideways && !readonly);
|
||||
bottomcheck_->set_sensitive(alternatives && !sideways && !readonly);
|
||||
pageoffloatscheck_->set_sensitive(alternatives && !sideways && !readonly);
|
||||
hereifpossiblecheck_->set_sensitive(alternatives && !wide && !sideways && !readonly);
|
||||
spancolumnscheck_->set_sensitive(!sideways && !readonly);
|
||||
defaultradio_->set_sensitive(!sideways && !readonly);
|
||||
alternativeradio_->set_sensitive(!sideways && !readonly);
|
||||
rotatesidewayscheck_->set_sensitive(sideways_possible && !readonly);
|
||||
}
|
||||
|
||||
|
||||
void GFloat::apply()
|
||||
{
|
||||
if (applylock_)
|
||||
return;
|
||||
|
||||
updateSensitivity();
|
||||
|
||||
bool const wide = spancolumnscheck_->get_active();
|
||||
bool const sideways = rotatesidewayscheck_->get_active();
|
||||
|
||||
int placementmode = 0; //default
|
||||
if (heredefinitelyradio_->get_active())
|
||||
placementmode = 1; // "Here, definitely"
|
||||
else if (alternativeradio_->get_active())
|
||||
placementmode = 2; // "Alternative"
|
||||
|
||||
string placement;
|
||||
switch (placementmode) {
|
||||
case 2:
|
||||
// "Alternative"
|
||||
if (ignorerulescheck_->get_active()) {
|
||||
// Ignore internal LaTeX rules
|
||||
placement += '!';
|
||||
}
|
||||
if (topcheck_->get_active()) {
|
||||
// Top of page
|
||||
placement += 't';
|
||||
}
|
||||
if (bottomcheck_->get_active()) {
|
||||
// Bottom of page
|
||||
placement += 'b';
|
||||
}
|
||||
if (pageoffloatscheck_->get_active()) {
|
||||
// Page of floats
|
||||
placement += 'p';
|
||||
}
|
||||
// ignore if wide is selected
|
||||
if (!wide && hereifpossiblecheck_->get_active()) {
|
||||
// Here, if possible
|
||||
placement += 'h';
|
||||
}
|
||||
if (placement == "!") {
|
||||
// ignore placement if only force is selected.
|
||||
placement.erase();
|
||||
}
|
||||
break;
|
||||
|
||||
case 1:
|
||||
// Here, definitely
|
||||
placement = "H";
|
||||
break;
|
||||
|
||||
case 0:
|
||||
// default, do nothing.
|
||||
break;
|
||||
}
|
||||
|
||||
controller().params().placement = placement;
|
||||
controller().params().wide = wide;
|
||||
controller().params().sideways = sideways;
|
||||
|
||||
controller().dispatchParams();
|
||||
}
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
@ -1,52 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file GFloat.h
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author John Spray
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#ifndef GFLOAT_H
|
||||
#define GFLOAT_H
|
||||
|
||||
#include "GViewBase.h"
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
class ControlFloat;
|
||||
|
||||
/** This class provides a GTK+ implementation of the ERT Dialog.
|
||||
*/
|
||||
class GFloat : public GViewCB<ControlFloat, GViewGladeB> {
|
||||
public:
|
||||
GFloat(Dialog & parent);
|
||||
private:
|
||||
virtual void apply();
|
||||
virtual void doBuild();
|
||||
virtual void update();
|
||||
|
||||
void updateSensitivity();
|
||||
|
||||
// apply() won't act when this is true
|
||||
bool applylock_;
|
||||
|
||||
Gtk::RadioButton * defaultradio_;
|
||||
Gtk::RadioButton * heredefinitelyradio_;
|
||||
Gtk::RadioButton * alternativeradio_;
|
||||
Gtk::CheckButton * topcheck_;
|
||||
Gtk::CheckButton * bottomcheck_;
|
||||
Gtk::CheckButton * pageoffloatscheck_;
|
||||
Gtk::CheckButton * hereifpossiblecheck_;
|
||||
Gtk::CheckButton * ignorerulescheck_;
|
||||
Gtk::CheckButton * spancolumnscheck_;
|
||||
Gtk::CheckButton * rotatesidewayscheck_;
|
||||
};
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#endif // GFLOAT_H
|
@ -1,538 +0,0 @@
|
||||
/**
|
||||
* \file GGraphics.C
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author John Spray
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
// Too hard to make concept checks work with this file
|
||||
#ifdef _GLIBCXX_CONCEPT_CHECKS
|
||||
#undef _GLIBCXX_CONCEPT_CHECKS
|
||||
#endif
|
||||
#ifdef _GLIBCPP_CONCEPT_CHECKS
|
||||
#undef _GLIBCPP_CONCEPT_CHECKS
|
||||
#endif
|
||||
|
||||
#include "GGraphics.h"
|
||||
#include "ControlGraphics.h"
|
||||
|
||||
#include "ghelpers.h"
|
||||
|
||||
#include "controllers/helper_funcs.h"
|
||||
|
||||
#include "insets/insetgraphicsParams.h"
|
||||
#include "paper.h"
|
||||
#include "lyxrc.h" // for lyxrc.default_papersize
|
||||
|
||||
#include "support/convert.h"
|
||||
#include "support/lyxlib.h" // for float_equal
|
||||
#include "support/lstrings.h"
|
||||
|
||||
#include "debug.h"
|
||||
|
||||
using std::vector;
|
||||
using std::string;
|
||||
|
||||
namespace lyx {
|
||||
|
||||
using support::float_equal;
|
||||
using support::token;
|
||||
|
||||
namespace frontend {
|
||||
|
||||
namespace {
|
||||
string defaultUnit("cm");
|
||||
} // namespace anon
|
||||
|
||||
GGraphics::GGraphics(Dialog & parent)
|
||||
: GViewCB<ControlGraphics, GViewGladeB>(parent, _("Graphics"), false)
|
||||
{}
|
||||
|
||||
|
||||
void GGraphics::doBuild()
|
||||
{
|
||||
string const gladeName = findGladeFile("graphics");
|
||||
xml_ = Gnome::Glade::Xml::create(gladeName);
|
||||
|
||||
Gtk::Button * button;
|
||||
xml_->get_widget("Close", button);
|
||||
setCancel(button);
|
||||
xml_->get_widget("Ok", button);
|
||||
setOK(button);
|
||||
xml_->get_widget("Apply", button);
|
||||
setApply(button);
|
||||
xml_->get_widget("Restore", button);
|
||||
setRestore(button);
|
||||
|
||||
xml_->get_widget("Notebook", notebook_);
|
||||
|
||||
// File Page
|
||||
xml_->get_widget("File", fileentry_);
|
||||
xml_->get_widget("DisplayScale", displayscalespin_);
|
||||
xml_->get_widget("OutputScale", outputscalespin_);
|
||||
xml_->get_widget("Browse", browsebutton_);
|
||||
xml_->get_widget("Edit", editbutton_);
|
||||
xml_->get_widget("Display", displaycombo_);
|
||||
xml_->get_widget_derived("Width", widthlengthentry_);
|
||||
xml_->get_widget_derived("Height", heightlengthentry_);
|
||||
xml_->get_widget("MaintainAspectRatio", aspectcheck_);
|
||||
|
||||
xml_->get_widget("SetScaling", setscalingradio_);
|
||||
xml_->get_widget("SetSize", setsizeradio_);
|
||||
|
||||
// Bounding Box Page
|
||||
xml_->get_widget("ClipToBoundingBox", clipcheck_);
|
||||
xml_->get_widget("RightTopX", righttopxspin_);
|
||||
xml_->get_widget("RightTopY", righttopyspin_);
|
||||
xml_->get_widget("LeftBottomX", leftbottomxspin_);
|
||||
xml_->get_widget("LeftBottomY", leftbottomyspin_);
|
||||
xml_->get_widget("BoundingUnits", bbunitscombo_);
|
||||
xml_->get_widget("GetFromFile", bbfromfilebutton_);
|
||||
|
||||
// Extra Page
|
||||
xml_->get_widget("Angle", anglespin_);
|
||||
xml_->get_widget("Origin", origincombo_);
|
||||
xml_->get_widget("UseSubfigure", subfigcheck_);
|
||||
xml_->get_widget("SubfigureCaption", subfigentry_);
|
||||
xml_->get_widget("LatexOptions", latexoptsentry_);
|
||||
xml_->get_widget("DraftMode", draftcheck_);
|
||||
xml_->get_widget("UnzipOnExport", unzipcheck_);
|
||||
|
||||
// Setup the columnrecord we use for combos
|
||||
cols_.add(stringcol_);
|
||||
|
||||
// The file page
|
||||
|
||||
// Disable for read-only documents.
|
||||
bcview().addReadOnly(browsebutton_);
|
||||
bcview().addReadOnly(aspectcheck_);
|
||||
|
||||
fileentry_->signal_changed().connect(
|
||||
sigc::mem_fun(*this, &GGraphics::onInput));
|
||||
displayscalespin_->signal_changed().connect(
|
||||
sigc::mem_fun(*this, &GGraphics::onInput));
|
||||
displaycombo_->signal_changed().connect(
|
||||
sigc::mem_fun(*this, &GGraphics::onInput));
|
||||
outputscalespin_->signal_changed().connect(
|
||||
sigc::mem_fun(*this, &GGraphics::onInput));
|
||||
heightlengthentry_->signal_changed().connect(
|
||||
sigc::mem_fun(*this, &GGraphics::onInput));
|
||||
widthlengthentry_->signal_changed().connect(
|
||||
sigc::mem_fun(*this, &GGraphics::onInput));
|
||||
aspectcheck_->signal_toggled().connect(
|
||||
sigc::mem_fun(*this, &GGraphics::onInput));
|
||||
|
||||
setscalingradio_->signal_toggled().connect(
|
||||
sigc::mem_fun(*this, &GGraphics::onSizingModeChange));
|
||||
setsizeradio_->signal_toggled().connect(
|
||||
sigc::mem_fun(*this, &GGraphics::onSizingModeChange));
|
||||
|
||||
browsebutton_->signal_clicked().connect(
|
||||
sigc::mem_fun(*this, &GGraphics::onBrowseClicked));
|
||||
|
||||
editbutton_->signal_clicked().connect(
|
||||
sigc::mem_fun(*this, &GGraphics::onEditClicked));
|
||||
|
||||
// the bounding box page
|
||||
leftbottomxspin_->signal_changed().connect(
|
||||
sigc::mem_fun(*this, &GGraphics::onBBChange));
|
||||
leftbottomyspin_->signal_changed().connect(
|
||||
sigc::mem_fun(*this, &GGraphics::onBBChange));
|
||||
righttopxspin_->signal_changed().connect(
|
||||
sigc::mem_fun(*this, &GGraphics::onBBChange));
|
||||
righttopyspin_->signal_changed().connect(
|
||||
sigc::mem_fun(*this, &GGraphics::onBBChange));
|
||||
bbunitscombo_->signal_changed().connect(
|
||||
sigc::mem_fun(*this, &GGraphics::onBBChange));
|
||||
clipcheck_->signal_toggled().connect(
|
||||
sigc::mem_fun(*this, &GGraphics::onBBChange));
|
||||
|
||||
bbfromfilebutton_->signal_clicked().connect(
|
||||
sigc::mem_fun(*this, &GGraphics::onBBFromFileClicked));
|
||||
|
||||
// disable for read-only documents
|
||||
bcview().addReadOnly(bbfromfilebutton_);
|
||||
bcview().addReadOnly(clipcheck_);
|
||||
PopulateComboBox(bbunitscombo_, getBBUnits());
|
||||
|
||||
|
||||
// the extra section
|
||||
|
||||
// disable for read-only documents
|
||||
bcview().addReadOnly(anglespin_);
|
||||
bcview().addReadOnly(origincombo_);
|
||||
bcview().addReadOnly(subfigcheck_);
|
||||
bcview().addReadOnly(latexoptsentry_);
|
||||
bcview().addReadOnly(draftcheck_);
|
||||
bcview().addReadOnly(unzipcheck_);
|
||||
|
||||
anglespin_->signal_changed().connect(
|
||||
sigc::mem_fun(*this, &GGraphics::onInput));
|
||||
origincombo_->signal_changed().connect(
|
||||
sigc::mem_fun(*this, &GGraphics::onInput));
|
||||
subfigentry_->signal_changed().connect(
|
||||
sigc::mem_fun(*this, &GGraphics::onInput));
|
||||
latexoptsentry_->signal_changed().connect(
|
||||
sigc::mem_fun(*this, &GGraphics::onInput));
|
||||
draftcheck_->signal_toggled().connect(
|
||||
sigc::mem_fun(*this, &GGraphics::onInput));
|
||||
unzipcheck_->signal_toggled().connect(
|
||||
sigc::mem_fun(*this, &GGraphics::onInput));
|
||||
|
||||
subfigcheck_->signal_toggled().connect(
|
||||
sigc::mem_fun(*this, &GGraphics::onSubFigCheckToggled));
|
||||
|
||||
vector<RotationOriginPair> origindata = getRotationOriginData();
|
||||
|
||||
// Store the identifiers for later
|
||||
origins_ = getSecond(origindata);
|
||||
PopulateComboBox(origincombo_, getFirst(origindata));
|
||||
}
|
||||
|
||||
|
||||
void GGraphics::onSizingModeChange()
|
||||
{
|
||||
bool const scalingmode = setscalingradio_->get_active();
|
||||
|
||||
outputscalespin_->set_sensitive(scalingmode);
|
||||
widthlengthentry_->set_sensitive(!scalingmode);
|
||||
heightlengthentry_->set_sensitive(!scalingmode);
|
||||
aspectcheck_->set_sensitive(!scalingmode);
|
||||
bc().input(ButtonPolicy::SMI_VALID);
|
||||
}
|
||||
|
||||
|
||||
void GGraphics::PopulateComboBox(Gtk::ComboBox * combo,
|
||||
vector<string> const & strings)
|
||||
{
|
||||
Glib::RefPtr<Gtk::ListStore> model = Gtk::ListStore::create(cols_);
|
||||
vector<string>::const_iterator it = strings.begin();
|
||||
vector<string>::const_iterator end = strings.end();
|
||||
for (int rowindex = 0; it != end; ++it, ++rowindex) {
|
||||
Gtk::TreeModel::iterator row = model->append();
|
||||
(*row)[stringcol_] = *it;
|
||||
}
|
||||
|
||||
combo->set_model(model);
|
||||
Gtk::CellRendererText * cell = Gtk::manage(new Gtk::CellRendererText);
|
||||
combo->pack_start(*cell, true);
|
||||
combo->add_attribute(*cell, "text", 0);
|
||||
}
|
||||
|
||||
|
||||
void GGraphics::apply()
|
||||
{
|
||||
// Create the parameters structure and fill the data from the dialog.
|
||||
InsetGraphicsParams & igp = controller().params();
|
||||
|
||||
// the file section
|
||||
igp.filename.set(fileentry_->get_text(),
|
||||
kernel().bufferFilepath());
|
||||
|
||||
igp.lyxscale =
|
||||
static_cast<int>(displayscalespin_->get_adjustment()->get_value());
|
||||
if (igp.lyxscale == 0) {
|
||||
igp.lyxscale = 100;
|
||||
}
|
||||
|
||||
switch (displaycombo_->get_active_row_number()) {
|
||||
case 4:
|
||||
igp.display = graphics::NoDisplay;
|
||||
break;
|
||||
case 3:
|
||||
igp.display = graphics::ColorDisplay;
|
||||
break;
|
||||
case 2:
|
||||
igp.display = graphics::GrayscaleDisplay;
|
||||
break;
|
||||
case 1:
|
||||
igp.display = graphics::MonochromeDisplay;
|
||||
break;
|
||||
case 0:
|
||||
igp.display = graphics::DefaultDisplay;
|
||||
}
|
||||
|
||||
if (setscalingradio_->get_active()) {
|
||||
float scaleValue = outputscalespin_->get_adjustment()->get_value();
|
||||
igp.scale = convert<string>(scaleValue);
|
||||
if (float_equal(scaleValue, 0.0, 0.05))
|
||||
igp.scale = string();
|
||||
igp.width = LyXLength();
|
||||
} else {
|
||||
igp.scale = string();
|
||||
igp.width = widthlengthentry_->get_length();
|
||||
}
|
||||
|
||||
igp.height = heightlengthentry_->get_length();
|
||||
|
||||
igp.keepAspectRatio = aspectcheck_->get_active();
|
||||
igp.draft = draftcheck_->get_active();
|
||||
igp.noUnzip = !unzipcheck_->get_active();
|
||||
|
||||
// the bb section
|
||||
|
||||
if (!controller().bbChanged) {
|
||||
// don't write anything
|
||||
igp.bb.erase();
|
||||
} else {
|
||||
Glib::ustring const bbunit = (*bbunitscombo_->get_active())[stringcol_];
|
||||
string bb;
|
||||
|
||||
if (leftbottomxspin_->get_text().empty())
|
||||
bb = "0";
|
||||
else
|
||||
bb = leftbottomxspin_->get_text() + bbunit;
|
||||
|
||||
bb += ' ';
|
||||
|
||||
if (leftbottomyspin_->get_text().empty())
|
||||
bb += "0";
|
||||
else
|
||||
bb += leftbottomyspin_->get_text() + bbunit;
|
||||
|
||||
bb += ' ';
|
||||
|
||||
if (righttopxspin_->get_text().empty())
|
||||
bb += "0";
|
||||
else
|
||||
bb += righttopxspin_->get_text() + bbunit;
|
||||
|
||||
bb += ' ';
|
||||
|
||||
if (righttopyspin_->get_text().empty())
|
||||
bb += "0";
|
||||
else
|
||||
bb += righttopyspin_->get_text() + bbunit;
|
||||
|
||||
/// The bounding box with "xLB yLB yRT yRT ", divided by a space!
|
||||
igp.bb = bb;
|
||||
}
|
||||
igp.clip = clipcheck_->get_active();
|
||||
|
||||
// the extra section
|
||||
igp.rotateAngle = convert<string>(anglespin_->get_adjustment()->get_value());
|
||||
|
||||
int const origin_pos = origincombo_->get_active_row_number();
|
||||
igp.rotateOrigin = origins_[origin_pos];
|
||||
|
||||
igp.subcaption = subfigcheck_->get_active();
|
||||
igp.subcaptionText = subfigentry_->get_text();
|
||||
|
||||
igp.special = latexoptsentry_->get_text();
|
||||
}
|
||||
|
||||
|
||||
void GGraphics::update() {
|
||||
// set the right default unit
|
||||
defaultUnit = getDefaultUnit();
|
||||
|
||||
// Update dialog with details from inset
|
||||
InsetGraphicsParams & igp = controller().params();
|
||||
|
||||
// the file section
|
||||
string const name =
|
||||
igp.filename.outputFilename(kernel().bufferFilepath());
|
||||
fileentry_->set_text(name);
|
||||
displayscalespin_->get_adjustment()->set_value(igp.lyxscale);
|
||||
|
||||
|
||||
switch (igp.display) {
|
||||
case graphics::NoDisplay:
|
||||
displaycombo_->set_active(4);
|
||||
break;
|
||||
case graphics::ColorDisplay:
|
||||
displaycombo_->set_active(3);
|
||||
break;
|
||||
case graphics::GrayscaleDisplay:
|
||||
displaycombo_->set_active(2);
|
||||
break;
|
||||
case graphics::MonochromeDisplay:
|
||||
displaycombo_->set_active(1);
|
||||
break;
|
||||
case graphics::DefaultDisplay:
|
||||
displaycombo_->set_active(0);
|
||||
}
|
||||
|
||||
outputscalespin_->get_adjustment()->set_value(convert<double>(igp.scale));
|
||||
|
||||
widthlengthentry_->set_length(igp.width);
|
||||
heightlengthentry_->set_length(igp.height);
|
||||
|
||||
if (!igp.scale.empty()
|
||||
&& !float_equal(convert<double>(igp.scale), 0.0, 0.05)) {
|
||||
// scaling sizing mode
|
||||
setscalingradio_->set_active(true);
|
||||
} else if (!igp.width.empty() && !igp.height.empty()) {
|
||||
setsizeradio_->set_active(true);
|
||||
} else {
|
||||
outputscalespin_->get_adjustment()->set_value(100.0);
|
||||
setscalingradio_->set_active(true);
|
||||
}
|
||||
onSizingModeChange();
|
||||
|
||||
aspectcheck_->set_active(igp.keepAspectRatio);
|
||||
draftcheck_->set_active(igp.draft);
|
||||
unzipcheck_->set_active(!igp.noUnzip);
|
||||
|
||||
// the bb section
|
||||
// set the bounding box values, if exists. First we need the whole
|
||||
// path, because the controller knows nothing about the doc-dir
|
||||
updateBB(igp.filename.absFilename(), igp.bb);
|
||||
clipcheck_->set_active(igp.clip);
|
||||
|
||||
// the extra section
|
||||
anglespin_->get_adjustment()->set_value(convert<double>(igp.rotateAngle));
|
||||
|
||||
int origin_pos;
|
||||
if (igp.rotateOrigin.empty()) {
|
||||
origin_pos = 0;
|
||||
} else {
|
||||
origin_pos = findPos(origins_, igp.rotateOrigin);
|
||||
}
|
||||
origincombo_->set_active(origin_pos);
|
||||
|
||||
|
||||
subfigcheck_->set_active(igp.subcaption);
|
||||
subfigentry_->set_text(igp.subcaptionText);
|
||||
subfigentry_->set_sensitive(subfigcheck_->get_active());
|
||||
latexoptsentry_->set_text(igp.special);
|
||||
|
||||
// open dialog in the file-tab, whenever filename is empty
|
||||
if (igp.filename.empty()) {
|
||||
notebook_->set_current_page(0);
|
||||
}
|
||||
|
||||
|
||||
bc().input(ButtonPolicy::SMI_INVALID);
|
||||
}
|
||||
|
||||
|
||||
void GGraphics::updateBB(string const & filename, string const & bb_inset)
|
||||
{
|
||||
// Update dialog with details from inset
|
||||
// set the bounding box values, if exists. First we need the whole
|
||||
// path, because the controller knows nothing about the doc-dir
|
||||
|
||||
if (bb_inset.empty()) {
|
||||
lyxerr[Debug::GRAPHICS]
|
||||
<< "GGraphics::updateBB() [no BoundingBox]\n";
|
||||
string const bb = controller().readBB(filename);
|
||||
if (!bb.empty()) {
|
||||
// get the values from the file
|
||||
// in this case we always have the point-unit
|
||||
leftbottomxspin_->set_text(token(bb, ' ', 0));
|
||||
leftbottomyspin_->set_text(token(bb, ' ', 1));
|
||||
righttopxspin_->set_text(token(bb, ' ', 2));
|
||||
righttopyspin_->set_text(token(bb, ' ', 3));
|
||||
} else {
|
||||
// no bb from file
|
||||
leftbottomxspin_->set_text("");
|
||||
leftbottomyspin_->set_text("");
|
||||
righttopxspin_->set_text("");
|
||||
righttopyspin_->set_text("");
|
||||
}
|
||||
unitsComboFromLength(bbunitscombo_, stringcol_,
|
||||
LyXLength("bp"), defaultUnit);
|
||||
} else {
|
||||
// get the values from the inset
|
||||
lyxerr[Debug::GRAPHICS]
|
||||
<< "FormGraphics::updateBB(): igp has BoundingBox"
|
||||
<< " ["<< bb_inset << "]\n";
|
||||
|
||||
LyXLength anyLength;
|
||||
anyLength = LyXLength(token(bb_inset, ' ', 0));
|
||||
|
||||
unitsComboFromLength(bbunitscombo_, stringcol_, anyLength, defaultUnit);
|
||||
|
||||
leftbottomxspin_->get_adjustment()->set_value(anyLength.value());
|
||||
|
||||
anyLength = LyXLength(token(bb_inset, ' ', 1));
|
||||
leftbottomyspin_->get_adjustment()->set_value(anyLength.value());
|
||||
|
||||
anyLength = LyXLength(token(bb_inset, ' ', 2));
|
||||
righttopxspin_->get_adjustment()->set_value(anyLength.value());
|
||||
|
||||
anyLength = LyXLength(token(bb_inset, ' ', 3));
|
||||
righttopyspin_->get_adjustment()->set_value(anyLength.value());
|
||||
}
|
||||
controller().bbChanged = false;
|
||||
}
|
||||
|
||||
|
||||
void GGraphics::onBrowseClicked()
|
||||
{
|
||||
// Get the filename from the dialog
|
||||
string const in_name = fileentry_->get_text();
|
||||
string const out_name = lyx::to_utf8(controller().browse(lyx::from_utf8(in_name)));
|
||||
lyxerr[Debug::GRAPHICS]
|
||||
<< "[FormGraphics]out_name: " << out_name << "\n";
|
||||
if (out_name != in_name && !out_name.empty()) {
|
||||
fileentry_->set_text(out_name);
|
||||
}
|
||||
if (controller().isFilenameValid(out_name) &&
|
||||
!controller().bbChanged) {
|
||||
updateBB(out_name, string());
|
||||
}
|
||||
|
||||
bc().input(ButtonPolicy::SMI_VALID);
|
||||
}
|
||||
|
||||
|
||||
void GGraphics::onBBChange()
|
||||
{
|
||||
controller().bbChanged = true;
|
||||
bc().input(ButtonPolicy::SMI_VALID);
|
||||
}
|
||||
|
||||
|
||||
void GGraphics::onBBFromFileClicked()
|
||||
{
|
||||
string const filename = fileentry_->get_text();
|
||||
if (!filename.empty()) {
|
||||
string bb = controller().readBB(filename);
|
||||
if (!bb.empty()) {
|
||||
leftbottomxspin_->set_text(token(bb, ' ', 0));
|
||||
leftbottomyspin_->set_text(token(bb, ' ', 1));
|
||||
righttopxspin_->set_text(token(bb, ' ', 2));
|
||||
righttopyspin_->set_text(token(bb, ' ', 3));
|
||||
unitsComboFromLength(bbunitscombo_, stringcol_,
|
||||
LyXLength("bp"), defaultUnit);
|
||||
}
|
||||
controller().bbChanged = false;
|
||||
} else {
|
||||
leftbottomxspin_->set_text("");
|
||||
leftbottomyspin_->set_text("");
|
||||
righttopxspin_->set_text("");
|
||||
righttopyspin_->set_text("");
|
||||
unitsComboFromLength(bbunitscombo_, stringcol_,
|
||||
LyXLength("bp"), defaultUnit);
|
||||
}
|
||||
bc().input(ButtonPolicy::SMI_VALID);
|
||||
}
|
||||
|
||||
|
||||
void GGraphics::onSubFigCheckToggled()
|
||||
{
|
||||
subfigentry_->set_sensitive(subfigcheck_->get_active());
|
||||
bc().input(ButtonPolicy::SMI_VALID);
|
||||
}
|
||||
|
||||
|
||||
void GGraphics::onEditClicked()
|
||||
{
|
||||
controller().editGraphics();
|
||||
}
|
||||
|
||||
|
||||
void GGraphics::onInput()
|
||||
{
|
||||
bc().input(ButtonPolicy::SMI_VALID);
|
||||
}
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
@ -1,103 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file GGraphics.h
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author John Spray
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#ifndef GGRAPHICS_H
|
||||
#define GGRAPHICS_H
|
||||
|
||||
#include "GViewBase.h"
|
||||
|
||||
#include "GtkLengthEntry.h"
|
||||
|
||||
#include "lyxlength.h"
|
||||
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
#include <vector>
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
class ControlGraphics;
|
||||
|
||||
/** This class provides a GTK+ implementation of the Graphics Dialog.
|
||||
*/
|
||||
class GGraphics
|
||||
: public GViewCB<ControlGraphics, GViewGladeB> {
|
||||
public:
|
||||
///
|
||||
GGraphics(Dialog &);
|
||||
private:
|
||||
|
||||
/// Set the Params variable for the Controller.
|
||||
virtual void apply();
|
||||
/// Build the dialog.
|
||||
virtual void doBuild();
|
||||
/// Update dialog before/whilst showing it.
|
||||
virtual void update();
|
||||
/// Update the BoundingBox info.
|
||||
void updateBB(std::string const & filename, std::string const & bb_inset);
|
||||
|
||||
void PopulateComboBox(Gtk::ComboBox * combo,
|
||||
std::vector<std::string> const & strings);
|
||||
|
||||
bool updating_;
|
||||
|
||||
/// Store the LaTeX names for the rotation origins.
|
||||
std::vector<std::string> origins_;
|
||||
|
||||
Gtk::TreeModelColumn<Glib::ustring> stringcol_;
|
||||
Gtk::TreeModel::ColumnRecord cols_;
|
||||
|
||||
Gtk::Notebook * notebook_;
|
||||
|
||||
// File Page
|
||||
Gtk::Entry * fileentry_;
|
||||
Gtk::SpinButton * displayscalespin_;
|
||||
Gtk::SpinButton * outputscalespin_;
|
||||
Gtk::Button * browsebutton_;
|
||||
Gtk::Button * editbutton_;
|
||||
Gtk::ComboBox * displaycombo_;
|
||||
GtkLengthEntry * widthlengthentry_;
|
||||
GtkLengthEntry * heightlengthentry_;
|
||||
Gtk::CheckButton * aspectcheck_;
|
||||
Gtk::RadioButton * setscalingradio_;
|
||||
Gtk::RadioButton * setsizeradio_;
|
||||
|
||||
// Bounding Box Page
|
||||
Gtk::CheckButton * clipcheck_;
|
||||
Gtk::SpinButton * righttopxspin_;
|
||||
Gtk::SpinButton * righttopyspin_;
|
||||
Gtk::SpinButton * leftbottomxspin_;
|
||||
Gtk::SpinButton * leftbottomyspin_;
|
||||
Gtk::ComboBox * bbunitscombo_;
|
||||
Gtk::Button * bbfromfilebutton_;
|
||||
|
||||
// Extra Page
|
||||
Gtk::SpinButton * anglespin_;
|
||||
Gtk::ComboBox * origincombo_;
|
||||
Gtk::CheckButton * subfigcheck_;
|
||||
Gtk::Entry * subfigentry_;
|
||||
Gtk::Entry * latexoptsentry_;
|
||||
Gtk::CheckButton * draftcheck_;
|
||||
Gtk::CheckButton * unzipcheck_;
|
||||
|
||||
void onSizingModeChange();
|
||||
void onBrowseClicked();
|
||||
void onBBChange();
|
||||
void onBBFromFileClicked();
|
||||
void onSubFigCheckToggled();
|
||||
void onEditClicked();
|
||||
void onInput();
|
||||
};
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#endif // GGRAPHICS_H
|
@ -1,165 +0,0 @@
|
||||
/**
|
||||
* \file GInclude.C
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author John Spray
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
// Too hard to make concept checks work with this file
|
||||
#ifdef _GLIBCXX_CONCEPT_CHECKS
|
||||
#undef _GLIBCXX_CONCEPT_CHECKS
|
||||
#endif
|
||||
#ifdef _GLIBCPP_CONCEPT_CHECKS
|
||||
#undef _GLIBCPP_CONCEPT_CHECKS
|
||||
#endif
|
||||
|
||||
#include "GInclude.h"
|
||||
#include "ControlInclude.h"
|
||||
#include "ghelpers.h"
|
||||
|
||||
#include <libglademm.h>
|
||||
|
||||
using std::string;
|
||||
using std::vector;
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
GInclude::GInclude(Dialog & parent)
|
||||
: GViewCB<ControlInclude, GViewGladeB>(parent, _("Child Document"), false)
|
||||
{}
|
||||
|
||||
|
||||
void GInclude::doBuild()
|
||||
{
|
||||
string const gladeName = findGladeFile("include");
|
||||
xml_ = Gnome::Glade::Xml::create(gladeName);
|
||||
|
||||
Gtk::Button * button;
|
||||
xml_->get_widget("Cancel", button);
|
||||
setCancel(button);
|
||||
xml_->get_widget("Ok", button);
|
||||
setOK(button);
|
||||
|
||||
xml_->get_widget("Browse", button);
|
||||
button->signal_clicked().connect(
|
||||
sigc::mem_fun(*this, &GInclude::onBrowseClicked));
|
||||
|
||||
xml_->get_widget("Open", openbutton_);
|
||||
openbutton_->signal_clicked().connect(
|
||||
sigc::mem_fun(*this, &GInclude::onOpenClicked));
|
||||
|
||||
xml_->get_widget("Include", includeradio_);
|
||||
xml_->get_widget("Input", inputradio_);
|
||||
xml_->get_widget("Verbatim", verbatimradio_);
|
||||
xml_->get_widget("File", fileentry_);
|
||||
xml_->get_widget("MarkSpaces", markspacescheck_);
|
||||
xml_->get_widget("Preview", previewcheck_);
|
||||
|
||||
inputradio_->signal_toggled().connect(
|
||||
sigc::mem_fun(*this, &GInclude::onTypeToggled));
|
||||
includeradio_->signal_toggled().connect(
|
||||
sigc::mem_fun(*this, &GInclude::onTypeToggled));
|
||||
verbatimradio_->signal_toggled().connect(
|
||||
sigc::mem_fun(*this, &GInclude::onTypeToggled));
|
||||
}
|
||||
|
||||
|
||||
void GInclude::update()
|
||||
{
|
||||
string const filename = lyx::to_utf8(controller().params()["filename"]);
|
||||
fileentry_->set_text(filename);
|
||||
|
||||
string const cmdname = controller().params().getCmdName();
|
||||
|
||||
bool const inputCommand = (cmdname == "input" || cmdname.empty());
|
||||
bool const includeCommand = cmdname == "include";
|
||||
bool const verbatimStarCommand = cmdname == "verbatiminput*";
|
||||
bool const verbatimCommand = cmdname == "verbatiminput";
|
||||
|
||||
bool const preview = static_cast<bool>((controller().params().preview()));
|
||||
|
||||
previewcheck_->set_sensitive(inputCommand);
|
||||
previewcheck_->set_active(inputCommand ? preview : false);
|
||||
|
||||
if (inputCommand)
|
||||
inputradio_->set_active(true);
|
||||
|
||||
if (includeCommand)
|
||||
includeradio_->set_active(true);
|
||||
|
||||
if (verbatimCommand || verbatimStarCommand) {
|
||||
verbatimradio_->set_active(true);
|
||||
markspacescheck_->set_active(verbatimStarCommand);
|
||||
markspacescheck_->set_sensitive(true);
|
||||
openbutton_->set_sensitive(false);
|
||||
} else {
|
||||
markspacescheck_->set_active(false);
|
||||
markspacescheck_->set_sensitive(false);
|
||||
openbutton_->set_sensitive(true);
|
||||
}
|
||||
|
||||
bc().valid();
|
||||
}
|
||||
|
||||
|
||||
void GInclude::apply()
|
||||
{
|
||||
InsetCommandParams params = controller().params();
|
||||
|
||||
params.preview(previewcheck_->get_active());
|
||||
params["filename"] = lyx::from_utf8(fileentry_->get_text());
|
||||
|
||||
if (includeradio_->get_active())
|
||||
params.setCmdName("include");
|
||||
else if (inputradio_->get_active())
|
||||
params.setCmdName("input");
|
||||
else
|
||||
if (markspacescheck_->get_active())
|
||||
params.setCmdName("verbatiminput*");
|
||||
else
|
||||
params.setCmdName("verbatiminput");
|
||||
|
||||
controller().setParams(params);
|
||||
}
|
||||
|
||||
|
||||
void GInclude::onTypeToggled()
|
||||
{
|
||||
previewcheck_->set_sensitive(inputradio_->get_active());
|
||||
markspacescheck_->set_sensitive(verbatimradio_->get_active());
|
||||
openbutton_->set_sensitive(!verbatimradio_->get_active());
|
||||
}
|
||||
|
||||
|
||||
void GInclude::onBrowseClicked()
|
||||
{
|
||||
ControlInclude::Type type;
|
||||
if (includeradio_->get_active())
|
||||
type = ControlInclude::INCLUDE;
|
||||
else if (inputradio_->get_active())
|
||||
type = ControlInclude::INPUT;
|
||||
else
|
||||
type = ControlInclude::VERBATIM;
|
||||
|
||||
fileentry_->set_text(lyx::to_utf8(controller().browse(lyx::from_utf8(fileentry_->get_text()), type)));
|
||||
}
|
||||
|
||||
|
||||
void GInclude::onOpenClicked()
|
||||
{
|
||||
string const in_name = fileentry_->get_text();
|
||||
if (!in_name.empty() && controller().fileExists(in_name)) {
|
||||
dialog().OKButton();
|
||||
controller().load(in_name);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
@ -1,48 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file GInclude.h
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author John Spray
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#ifndef GINCLUDE_H
|
||||
#define GINCLUDE_H
|
||||
|
||||
#include "GViewBase.h"
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
class ControlInclude;
|
||||
|
||||
/** This class provides a GTK+ implementation of the Include Dialog.
|
||||
*/
|
||||
class GInclude : public GViewCB<ControlInclude, GViewGladeB> {
|
||||
public:
|
||||
GInclude(Dialog & parent);
|
||||
private:
|
||||
virtual void apply();
|
||||
virtual void doBuild();
|
||||
virtual void update();
|
||||
|
||||
Gtk::RadioButton * includeradio_;
|
||||
Gtk::RadioButton * inputradio_;
|
||||
Gtk::RadioButton * verbatimradio_;
|
||||
Gtk::Entry * fileentry_;
|
||||
Gtk::Button * openbutton_;
|
||||
Gtk::CheckButton * markspacescheck_;
|
||||
Gtk::CheckButton * previewcheck_;
|
||||
|
||||
void onBrowseClicked();
|
||||
void onOpenClicked();
|
||||
void onTypeToggled();
|
||||
};
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#endif // GINCLUDE_H
|
@ -1,74 +0,0 @@
|
||||
/**
|
||||
* \file GLog.C
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author John Spray
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
// Too hard to make concept checks work with this file
|
||||
#ifdef _GLIBCXX_CONCEPT_CHECKS
|
||||
#undef _GLIBCXX_CONCEPT_CHECKS
|
||||
#endif
|
||||
#ifdef _GLIBCPP_CONCEPT_CHECKS
|
||||
#undef _GLIBCPP_CONCEPT_CHECKS
|
||||
#endif
|
||||
|
||||
#include "GLog.h"
|
||||
#include "ControlLog.h"
|
||||
|
||||
#include "ghelpers.h"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
using std::string;
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
GLog::GLog(Dialog & parent)
|
||||
: GViewCB<ControlLog, GViewGladeB>(parent, _("Log Viewer"), false)
|
||||
{}
|
||||
|
||||
|
||||
void GLog::doBuild()
|
||||
{
|
||||
string const gladeName = findGladeFile("log");
|
||||
xml_ = Gnome::Glade::Xml::create(gladeName);
|
||||
|
||||
Gtk::Button * button;
|
||||
xml_->get_widget("Close", button);
|
||||
setCancel(button);
|
||||
|
||||
xml_->get_widget("Refresh", button);
|
||||
button->signal_clicked().connect(
|
||||
sigc::mem_fun(*this, &GLog::update));
|
||||
|
||||
Gtk::TextView * contentview;
|
||||
xml_->get_widget("ContentView", contentview);
|
||||
contentbuffer_ = contentview->get_buffer();
|
||||
}
|
||||
|
||||
|
||||
void GLog::update()
|
||||
{
|
||||
lyx::docstring const title = controller().title();
|
||||
|
||||
if (!title.empty())
|
||||
setTitle(title);
|
||||
|
||||
std::ostringstream contents;
|
||||
controller().getContents(contents);
|
||||
|
||||
if (!contents.str().empty())
|
||||
contentbuffer_->set_text(contents.str());
|
||||
else
|
||||
contentbuffer_->set_text(lyx::to_utf8(_("Error reading file!")));
|
||||
}
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
@ -1,43 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file GLog.h
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author John Spray
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#ifndef GLOG_H
|
||||
#define GLOG_H
|
||||
|
||||
#include "GViewBase.h"
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
class ControlLog;
|
||||
|
||||
/**
|
||||
* This class provides a GTK+ implementation of a dialog to browse through a
|
||||
* log file.
|
||||
*/
|
||||
class GLog : public GViewCB<ControlLog, GViewGladeB> {
|
||||
public:
|
||||
GLog(Dialog &);
|
||||
|
||||
// Create the dialog
|
||||
virtual void doBuild();
|
||||
// Set the Params variable for the Controller.
|
||||
virtual void apply() {}
|
||||
// Update dialog (load log into textbuffer)
|
||||
virtual void update();
|
||||
|
||||
Glib::RefPtr<Gtk::TextBuffer> contentbuffer_;
|
||||
};
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#endif // GLOG_H
|
@ -1,120 +0,0 @@
|
||||
/**
|
||||
* \file GLyXKeySym.C
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Huang Ying
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
// Too hard to make concept checks work with this file
|
||||
#ifdef _GLIBCXX_CONCEPT_CHECKS
|
||||
#undef _GLIBCXX_CONCEPT_CHECKS
|
||||
#endif
|
||||
#ifdef _GLIBCPP_CONCEPT_CHECKS
|
||||
#undef _GLIBCPP_CONCEPT_CHECKS
|
||||
#endif
|
||||
|
||||
#include "GLyXKeySym.h"
|
||||
#include "kbmap.h"
|
||||
|
||||
#include "support/lstrings.h"
|
||||
|
||||
#include <gtkmm.h>
|
||||
#include <gdk/gdkkeysyms.h>
|
||||
|
||||
|
||||
namespace lyx {
|
||||
|
||||
using std::string;
|
||||
|
||||
|
||||
GLyXKeySym::GLyXKeySym() : keyval_(GDK_VoidSymbol)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
GLyXKeySym::GLyXKeySym(unsigned int keyval) : keyval_(keyval)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void GLyXKeySym::setKeyval(unsigned int keyval)
|
||||
{
|
||||
keyval_ = keyval;
|
||||
}
|
||||
|
||||
|
||||
void GLyXKeySym::init(string const & symbolname)
|
||||
{
|
||||
keyval_ = gdk_keyval_from_name(symbolname.c_str());
|
||||
}
|
||||
|
||||
|
||||
bool GLyXKeySym::isOK() const
|
||||
{
|
||||
return keyval_ != GDK_VoidSymbol;
|
||||
}
|
||||
|
||||
|
||||
bool GLyXKeySym::isModifier() const
|
||||
{
|
||||
return ((keyval_ >= GDK_Shift_L && keyval_ <= GDK_Hyper_R)
|
||||
|| keyval_ == GDK_Mode_switch || keyval_ == 0);
|
||||
}
|
||||
|
||||
|
||||
string GLyXKeySym::getSymbolName() const
|
||||
{
|
||||
const char * name = gdk_keyval_name(keyval_);
|
||||
return name ? name : string();
|
||||
}
|
||||
|
||||
|
||||
size_t GLyXKeySym::getUCSEncoded() const
|
||||
{
|
||||
return gdk_keyval_to_unicode(keyval_);
|
||||
}
|
||||
|
||||
|
||||
// Produce a human readable version (eg "Ctrl+N")
|
||||
string const GLyXKeySym::print(key_modifier::state mod) const
|
||||
{
|
||||
string buf;
|
||||
|
||||
if (mod & key_modifier::ctrl)
|
||||
buf += "Ctrl+";
|
||||
if (mod & key_modifier::shift)
|
||||
buf += "Shift+";
|
||||
if (mod & key_modifier::alt)
|
||||
buf += "Alt+";
|
||||
|
||||
// Uppercase the first letter, for Ctrl+N rather than Ctrl+n,
|
||||
// and for Ctrl+Greater rather than Ctrl+GREATER
|
||||
string symname = getSymbolName();
|
||||
if (!symname.empty()) {
|
||||
symname[0] = lyx::support::uppercase(symname[0]);
|
||||
buf += symname;
|
||||
}
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
|
||||
bool GLyXKeySym::isText() const
|
||||
{
|
||||
return getUCSEncoded() != 0;
|
||||
}
|
||||
|
||||
|
||||
bool operator==(LyXKeySym const & k1, LyXKeySym const & k2)
|
||||
{
|
||||
return static_cast<GLyXKeySym const &>(k1).getKeyval()
|
||||
== static_cast<GLyXKeySym const &>(k2).getKeyval();
|
||||
}
|
||||
|
||||
|
||||
} // namespace lyx
|
@ -1,41 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file GLyXKeySym.h
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Huang Ying
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#ifndef GLYX_KEYSYM_H
|
||||
#define GLYX_KEYSYM_H
|
||||
|
||||
#include "frontends/LyXKeySym.h"
|
||||
|
||||
|
||||
namespace lyx {
|
||||
|
||||
class GLyXKeySym : public LyXKeySym {
|
||||
public:
|
||||
GLyXKeySym();
|
||||
GLyXKeySym(unsigned int keyval);
|
||||
void setKeyval(unsigned int keyval);
|
||||
unsigned int getKeyval() const { return keyval_; }
|
||||
virtual void init(std::string const & symbolname);
|
||||
virtual ~GLyXKeySym() {}
|
||||
virtual bool isOK() const;
|
||||
virtual bool isModifier() const;
|
||||
virtual bool isText() const;
|
||||
virtual std::string getSymbolName() const;
|
||||
virtual size_t getUCSEncoded() const;
|
||||
virtual std::string const print(key_modifier::state mod) const;
|
||||
private:
|
||||
unsigned int keyval_;
|
||||
};
|
||||
|
||||
|
||||
} // namespace lyx
|
||||
|
||||
#endif
|
@ -1,251 +0,0 @@
|
||||
/**
|
||||
* \file GMathDelim.C
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Huang Ying
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
// Too hard to make concept checks work with this file
|
||||
#ifdef _GLIBCXX_CONCEPT_CHECKS
|
||||
#undef _GLIBCXX_CONCEPT_CHECKS
|
||||
#endif
|
||||
#ifdef _GLIBCPP_CONCEPT_CHECKS
|
||||
#undef _GLIBCPP_CONCEPT_CHECKS
|
||||
#endif
|
||||
|
||||
#include "ControlMath.h"
|
||||
#include "GMathDelim.h"
|
||||
#include "ghelpers.h"
|
||||
|
||||
#include "support/lstrings.h"
|
||||
|
||||
#include <libglademm.h>
|
||||
|
||||
#include <sstream>
|
||||
|
||||
#include "delim.xbm"
|
||||
#include "delim0.xpm"
|
||||
|
||||
using std::string;
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
// FIXME: Implement fixed size delimiters
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
enum enumDelimType {LEFT, RIGHT, SINGLE};
|
||||
|
||||
|
||||
int const delimType[] = {
|
||||
//row 1
|
||||
LEFT, RIGHT, LEFT, RIGHT, SINGLE, SINGLE, LEFT, RIGHT,LEFT, RIGHT,
|
||||
SINGLE, SINGLE,
|
||||
//row 2
|
||||
LEFT, RIGHT, LEFT, RIGHT, SINGLE, SINGLE, LEFT, RIGHT, SINGLE, SINGLE,
|
||||
SINGLE
|
||||
};
|
||||
|
||||
|
||||
int const delimRevert[] = {
|
||||
1,0,3,2,4,5,7,6,9,8,10,11,
|
||||
13,12,15,14,16,17,19,18,20,21,22
|
||||
};
|
||||
|
||||
|
||||
char const * delimValues[] = {
|
||||
"(", ")", "lceil", "rceil", "uparrow", "Uparrow",
|
||||
"[", "]", "lfloor", "rfloor", "updownarrow", "Updownarrow",
|
||||
"{", "}", "/", "backslash", "downarrow", "Downarrow",
|
||||
"langle", "rangle", "|", "Vert", ".", 0
|
||||
};
|
||||
|
||||
int const delimTblRows = 2;
|
||||
|
||||
int const delimTblCols = 12;
|
||||
|
||||
int const delimMax = 23;
|
||||
|
||||
|
||||
GXpmBtnTbl::XbmData xbm =
|
||||
{
|
||||
delim_bits,
|
||||
delim_width,
|
||||
delim_height,
|
||||
{0, 0, 0, 65535}
|
||||
};
|
||||
|
||||
|
||||
inline int index(int row, int col)
|
||||
{
|
||||
return row * delimTblCols + col;
|
||||
}
|
||||
|
||||
|
||||
inline int indexToRow(int index)
|
||||
{
|
||||
return index / delimTblCols;
|
||||
}
|
||||
|
||||
|
||||
inline int indexToCol(int index)
|
||||
{
|
||||
return index % delimTblCols;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
GMathDelim::GMathDelim(Dialog & parent) :
|
||||
GViewCB<ControlMath, GViewGladeB>(parent, _("Math Delimiters")),
|
||||
delimTbl_(delimTblRows, delimTblCols, xbm)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void GMathDelim::doBuild()
|
||||
{
|
||||
string const gladeName = findGladeFile("mathDelim");
|
||||
xml_ = Gnome::Glade::Xml::create(gladeName);
|
||||
Gtk::Button * ok;
|
||||
Gtk::Button * apply;
|
||||
Gtk::Button * close;
|
||||
Gtk::Box * box;
|
||||
xml_->get_widget("Left", left_);
|
||||
xml_->get_widget("Right", right_);
|
||||
xml_->get_widget("Both", both_);
|
||||
xml_->get_widget("OK", ok);
|
||||
xml_->get_widget("Apply", apply);
|
||||
xml_->get_widget("Close", close);
|
||||
xml_->get_widget("Demo", demo_);
|
||||
setOK(ok);
|
||||
setApply(apply);
|
||||
setCancel(close);
|
||||
// Initialize demo button pixmap to "()" as found in images/delim0.xpm
|
||||
setDemoPixmap();
|
||||
leftSel_ = 0;
|
||||
rightSel_ = 1;
|
||||
xml_->get_widget("Box", box);
|
||||
delimTbl_.signalClicked().connect(
|
||||
sigc::mem_fun(*this, &GMathDelim::onDelimTblClicked));
|
||||
delimTbl_.show();
|
||||
box->children().push_back(
|
||||
Gtk::Box_Helpers::Element(delimTbl_));
|
||||
bcview().addReadOnly(&delimTbl_);
|
||||
bcview().addReadOnly(left_);
|
||||
bcview().addReadOnly(right_);
|
||||
bcview().addReadOnly(both_);
|
||||
bcview().addReadOnly(demo_);
|
||||
left_->signal_clicked().connect(
|
||||
sigc::mem_fun(*this, &GMathDelim::onRadioClicked));
|
||||
right_->signal_clicked().connect(
|
||||
sigc::mem_fun(*this, &GMathDelim::onRadioClicked));
|
||||
both_->signal_clicked().connect(
|
||||
sigc::mem_fun(*this, &GMathDelim::onRadioClicked));
|
||||
}
|
||||
|
||||
|
||||
void GMathDelim::setDemoPixmap()
|
||||
{
|
||||
Gtk::Image * image;
|
||||
pixmap_ = Gdk::Pixmap::create_from_xpm(demo_->get_colormap(),
|
||||
mask_,
|
||||
delim0);
|
||||
image = Gtk::manage(new Gtk::Image(pixmap_, mask_));
|
||||
image->show();
|
||||
demo_->add(*image);
|
||||
gcMask_ = Gdk::GC::create(mask_);
|
||||
}
|
||||
|
||||
|
||||
void GMathDelim::apply()
|
||||
{
|
||||
std::ostringstream os;
|
||||
os << delimValues[leftSel_] << ' ' << delimValues[rightSel_];
|
||||
controller().dispatchDelim(os.str());
|
||||
}
|
||||
|
||||
|
||||
void GMathDelim::update()
|
||||
{
|
||||
bc().valid();
|
||||
}
|
||||
|
||||
|
||||
void GMathDelim::onDelimTblClicked(int row, int col)
|
||||
{
|
||||
int const sel = index(row, col);
|
||||
if (sel >= delimMax)
|
||||
return;
|
||||
bool left = left_->get_active();
|
||||
bool right = right_->get_active();
|
||||
bool both = both_->get_active();
|
||||
if (left)
|
||||
leftSel_ = sel;
|
||||
else if (right)
|
||||
rightSel_ = sel;
|
||||
else if (both)
|
||||
if (delimType[sel] == LEFT) {
|
||||
leftSel_ = sel;
|
||||
rightSel_ = delimRevert[sel];
|
||||
} else if (delimType[sel] == RIGHT) {
|
||||
rightSel_ = sel;
|
||||
leftSel_ = delimRevert[sel];
|
||||
} else {
|
||||
leftSel_ = rightSel_ = sel;
|
||||
}
|
||||
updateDemoPixmap();
|
||||
}
|
||||
|
||||
|
||||
void GMathDelim::updateDemoPixmap()
|
||||
{
|
||||
int const delimWidth = delim_width / delimTblCols;
|
||||
Glib::RefPtr<Gdk::Pixmap> pixmap;
|
||||
Glib::RefPtr<Gdk::Bitmap> mask;
|
||||
GXpmBtnTbl::GXpmBtn * btn = delimTbl_.getBtn(indexToRow(leftSel_),
|
||||
indexToCol(leftSel_));
|
||||
pixmap = btn->getPixmap();
|
||||
mask = btn->getMask();
|
||||
pixmap_->draw_drawable(left_->get_style()->get_black_gc(),
|
||||
pixmap,
|
||||
0, 0,
|
||||
0, 0);
|
||||
mask_->draw_drawable(gcMask_,
|
||||
mask,
|
||||
0, 0,
|
||||
0, 0);
|
||||
btn = delimTbl_.getBtn(indexToRow(rightSel_),
|
||||
indexToCol(rightSel_));
|
||||
pixmap = btn->getPixmap();
|
||||
mask = btn->getMask();
|
||||
pixmap_->draw_drawable(left_->get_style()->get_black_gc(),
|
||||
pixmap,
|
||||
0, 0,
|
||||
delimWidth, 0);
|
||||
mask_->draw_drawable(gcMask_,
|
||||
mask,
|
||||
0, 0,
|
||||
delimWidth, 0);
|
||||
int x, y, width, height, depth;
|
||||
demo_->get_window()->get_geometry(x, y, width, height, depth);
|
||||
demo_->get_window()->invalidate_rect(
|
||||
Gdk::Rectangle(x, y, width, height), true);
|
||||
bc().valid();
|
||||
}
|
||||
|
||||
|
||||
void GMathDelim::onRadioClicked()
|
||||
{
|
||||
bc().valid();
|
||||
}
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
@ -1,51 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file GMathDelim.h
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Huang Ying
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#ifndef GMATH_DELIM_H
|
||||
#define GMATH_DELIM_H
|
||||
|
||||
#include "GViewBase.h"
|
||||
#include "GXpmBtnTbl.h"
|
||||
|
||||
#include "support/lstrings.h"
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
class ControlMath;
|
||||
|
||||
class GMathDelim : public GViewCB<ControlMath, GViewGladeB> {
|
||||
public:
|
||||
GMathDelim(Dialog & parent);
|
||||
private:
|
||||
virtual void apply();
|
||||
virtual void update();
|
||||
virtual void doBuild();
|
||||
void setDemoPixmap();
|
||||
void updateDemoPixmap();
|
||||
void onDelimTblClicked(int row, int col);
|
||||
void onRadioClicked();
|
||||
GXpmBtnTbl delimTbl_;
|
||||
Gtk::Button * demo_;
|
||||
Gtk::RadioButton * left_;
|
||||
Gtk::RadioButton * right_;
|
||||
Gtk::RadioButton * both_;
|
||||
Glib::RefPtr<Gdk::Pixmap> pixmap_;
|
||||
Glib::RefPtr<Gdk::Bitmap> mask_;
|
||||
Glib::RefPtr<Gdk::GC> gcMask_;
|
||||
int leftSel_;
|
||||
int rightSel_;
|
||||
};
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#endif
|
@ -1,182 +0,0 @@
|
||||
/**
|
||||
* \file GMathPanel.C
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Huang Ying
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
// Too hard to make concept checks work with this file
|
||||
#ifdef _GLIBCXX_CONCEPT_CHECKS
|
||||
#undef _GLIBCXX_CONCEPT_CHECKS
|
||||
#endif
|
||||
#ifdef _GLIBCPP_CONCEPT_CHECKS
|
||||
#undef _GLIBCPP_CONCEPT_CHECKS
|
||||
#endif
|
||||
|
||||
#include "ControlMath.h"
|
||||
#include "GMathPanel.h"
|
||||
#include "ghelpers.h"
|
||||
|
||||
#include "support/lstrings.h"
|
||||
|
||||
#include <libglademm.h>
|
||||
|
||||
#include "deco.xpm"
|
||||
#include "delim.xpm"
|
||||
#include "equation.xpm"
|
||||
#include "frac-square.xpm"
|
||||
#include "matrix.xpm"
|
||||
#include "space.xpm"
|
||||
#include "style.xpm"
|
||||
#include "sqrt-square.xpm"
|
||||
#include "sub.xpm"
|
||||
#include "super.xpm"
|
||||
|
||||
#include "gimages/ams_arrow.xpm"
|
||||
#include "gimages/ams_misc.xpm"
|
||||
#include "gimages/ams_brel.xpm"
|
||||
#include "gimages/ams_nrel.xpm"
|
||||
#include "gimages/ams_ops.xpm"
|
||||
#include "gimages/arrow.xpm"
|
||||
#include "gimages/boperator.xpm"
|
||||
#include "gimages/brelats.xpm"
|
||||
#include "gimages/dots.xpm"
|
||||
#include "gimages/greek.xpm"
|
||||
#include "gimages/misc.xpm"
|
||||
#include "gimages/varsize.xpm"
|
||||
|
||||
using std::string;
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
namespace {
|
||||
|
||||
char const * infoUp[][5] =
|
||||
{
|
||||
//row 1
|
||||
{0, 0, "mathdelimiter", "mathaccents", "mathspace"},
|
||||
//row 2
|
||||
{0, 0, "mathstyle", "mathmatrix", 0}
|
||||
};
|
||||
|
||||
|
||||
GXpmBtnTbl::XpmData xpmUp[] =
|
||||
{
|
||||
//row 1
|
||||
sqrt_xpm, frac, delim, deco, space_xpm,
|
||||
//row 2
|
||||
super_xpm, sub_xpm, style_xpm, matrix, equation
|
||||
};
|
||||
|
||||
|
||||
char const * infoDown[][3] =
|
||||
{
|
||||
//row 1
|
||||
{"mathoperators", "mathrelations", "matharrows"},
|
||||
//row 2
|
||||
{"mathbigoperators", "mathdots", "mathmisc"},
|
||||
//row 3
|
||||
{"mathgreek", "mathamsarrows", "mathamsrelations"},
|
||||
//row 4
|
||||
{"mathamsnegatedrelations", "mathamsoperators", "mathamsmisc"}
|
||||
};
|
||||
|
||||
|
||||
GXpmBtnTbl::XpmData xpmDown[] =
|
||||
{
|
||||
//row 1
|
||||
boperator_xpm, brelats_xpm, arrow_xpm,
|
||||
//row 2
|
||||
varsize_xpm, dots_xpm, misc_xpm,
|
||||
//row 3
|
||||
greek_xpm, ams_arrow_xpm, ams_brel_xpm,
|
||||
//row 4
|
||||
ams_nrel_xpm, ams_ops_xpm, ams_misc_xpm
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
GMathPanel::GMathPanel(Dialog & parent)
|
||||
: GViewCB<ControlMath, GViewGladeB>(parent, _("Math Panel")),
|
||||
tableUp_(2, 5, xpmUp), tableDown_(4, 3, xpmDown)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void GMathPanel::doBuild()
|
||||
{
|
||||
string const gladeName = findGladeFile("mathPanel");
|
||||
xml_ = Gnome::Glade::Xml::create(gladeName);
|
||||
Gtk::Button * close;
|
||||
Gtk::VBox * vbox;
|
||||
|
||||
xml_->get_widget("Close", close);
|
||||
setCancel(close);
|
||||
|
||||
tableUp_.signalClicked().connect(
|
||||
sigc::mem_fun(*this, &GMathPanel::onTableUpClicked));
|
||||
tableUp_.show();
|
||||
tableDown_.signalClicked().connect(
|
||||
sigc::mem_fun(*this, &GMathPanel::onTableDownClicked));
|
||||
tableDown_.show();
|
||||
|
||||
xml_->get_widget("Vbox", vbox);
|
||||
vbox->pack_start(tableUp_, false, false, 0);
|
||||
vbox->pack_start(tableDown_, false, false, 0);
|
||||
|
||||
// Functions ListView
|
||||
xml_->get_widget("Functions", functions_);
|
||||
listCols_.add(listCol_);
|
||||
listStore_ = Gtk::ListStore::create(listCols_);
|
||||
functions_->set_model(listStore_);
|
||||
functions_->append_column("Functions", listCol_);
|
||||
|
||||
listSel_ = functions_->get_selection();
|
||||
listSel_->signal_changed().connect(
|
||||
sigc::mem_fun(*this, &GMathPanel::onFunctionSelected));
|
||||
for (int i = 0; i < nr_function_names; ++i)
|
||||
(*listStore_->append())[listCol_] =
|
||||
Glib::locale_to_utf8(function_names[i]);
|
||||
}
|
||||
|
||||
|
||||
void GMathPanel::onTableUpClicked(int row, int col)
|
||||
{
|
||||
if (infoUp[row][col])
|
||||
controller().showDialog(infoUp[row][col]);
|
||||
else if (row == 0 && col == 0)
|
||||
controller().dispatchInsert("sqrt");
|
||||
else if (row == 0 && col == 1)
|
||||
controller().dispatchInsert("frac");
|
||||
else if (row == 1 && col == 0)
|
||||
controller().dispatchSuperscript();
|
||||
else if (row == 1 && col == 1)
|
||||
controller().dispatchSubscript();
|
||||
else if (row == 1 && col == 4)
|
||||
controller().dispatchToggleDisplay();
|
||||
}
|
||||
|
||||
|
||||
void GMathPanel::onTableDownClicked(int row, int col)
|
||||
{
|
||||
controller().showDialog(infoDown[row][col]);
|
||||
}
|
||||
|
||||
|
||||
void GMathPanel::onFunctionSelected()
|
||||
{
|
||||
Gtk::TreeModel::iterator it = listSel_->get_selected();
|
||||
Glib::ustring sel = (*it)[listCol_];
|
||||
controller().dispatchInsert(
|
||||
Glib::locale_from_utf8(sel));
|
||||
}
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
@ -1,53 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file GMathPanel.h
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Huang Ying
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#ifndef GMATH_PANEL_H
|
||||
#define GMATH_PANEL_H
|
||||
|
||||
#include "GViewBase.h"
|
||||
#include "GXpmBtnTbl.h"
|
||||
|
||||
#include "support/lstrings.h"
|
||||
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
class ControlMath;
|
||||
|
||||
class GMathPanel : public GViewCB<ControlMath, GViewGladeB> {
|
||||
public:
|
||||
GMathPanel(Dialog & parent);
|
||||
private:
|
||||
virtual void apply() {}
|
||||
virtual void update() {}
|
||||
virtual void doBuild();
|
||||
void onShowDialog(char const * dialogName);
|
||||
void onTableUpClicked(int row, int col);
|
||||
void onTableDownClicked(int row, int col);
|
||||
void onSuperClicked();
|
||||
void onSubClicked();
|
||||
void onEquationClicked();
|
||||
void onInsert(char const * what);
|
||||
void onFunctionSelected();
|
||||
Gtk::TreeView * functions_;
|
||||
Gtk::TreeModelColumn<Glib::ustring> listCol_;
|
||||
Gtk::TreeModel::ColumnRecord listCols_;
|
||||
Glib::RefPtr<Gtk::ListStore> listStore_;
|
||||
Glib::RefPtr<Gtk::TreeSelection> listSel_;
|
||||
GXpmBtnTbl tableUp_;
|
||||
GXpmBtnTbl tableDown_;
|
||||
};
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#endif
|
@ -1,152 +0,0 @@
|
||||
/**
|
||||
* \file GMathsMatrix.C
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author John Spray
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
// Too hard to make concept checks work with this file
|
||||
#ifdef _GLIBCXX_CONCEPT_CHECKS
|
||||
#undef _GLIBCXX_CONCEPT_CHECKS
|
||||
#endif
|
||||
#ifdef _GLIBCPP_CONCEPT_CHECKS
|
||||
#undef _GLIBCPP_CONCEPT_CHECKS
|
||||
#endif
|
||||
|
||||
#include "GMathsMatrix.h"
|
||||
#include "ControlMath.h"
|
||||
|
||||
#include "GViewBase.h"
|
||||
#include "ghelpers.h"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
|
||||
using std::ostringstream;
|
||||
using std::string;
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
|
||||
GMathsMatrix::GMathsMatrix(Dialog & parent)
|
||||
: GViewCB<ControlMath, GViewGladeB>(parent, _("Math Matrix"), false)
|
||||
{}
|
||||
|
||||
|
||||
void GMathsMatrix::doBuild()
|
||||
{
|
||||
string const gladeName = findGladeFile("mathMatrix");
|
||||
xml_ = Gnome::Glade::Xml::create(gladeName);
|
||||
|
||||
Gtk::Button * button;
|
||||
xml_->get_widget("Cancel",button);
|
||||
setCancel(button);
|
||||
xml_->get_widget("Insert",button);
|
||||
setOK(button);
|
||||
// No inserting matrices into readonly docs!
|
||||
bcview().addReadOnly(button);
|
||||
|
||||
// Get widget pointers
|
||||
xml_->get_widget("Top", topradio_);
|
||||
xml_->get_widget("Bottom", bottomradio_);
|
||||
xml_->get_widget("Center", centerradio_);
|
||||
xml_->get_widget("Columns", columnsspin_);
|
||||
xml_->get_widget("Rows", rowsspin_);
|
||||
xml_->get_widget("HorzAlign", horzalignentry_);
|
||||
|
||||
// Make center vertical alignment the default
|
||||
centerradio_->set_active(true);
|
||||
|
||||
// Allow only [clr], keep length as number of cols
|
||||
ignoreHorzAlign_ = false;
|
||||
horzalignentry_->signal_changed().connect(
|
||||
sigc::mem_fun(*this, &GMathsMatrix::updateHorzAlignEntry));
|
||||
columnsspin_->signal_value_changed().connect(
|
||||
sigc::mem_fun(*this, &GMathsMatrix::updateHorzAlignEntry));
|
||||
}
|
||||
|
||||
|
||||
void GMathsMatrix::apply()
|
||||
{
|
||||
string const h_align = horzalignentry_->get_text();
|
||||
int const nx =
|
||||
static_cast<int>(columnsspin_->get_adjustment()->get_value());
|
||||
int const ny =
|
||||
static_cast<int>(rowsspin_->get_adjustment()->get_value());
|
||||
char v_align = 'c';
|
||||
if (topradio_->get_active())
|
||||
v_align = 't';
|
||||
else if (centerradio_->get_active())
|
||||
v_align = 'c';
|
||||
else if (bottomradio_->get_active())
|
||||
v_align = 'b';
|
||||
|
||||
ostringstream os;
|
||||
os << nx << ' ' << ny << ' ' << v_align << ' ' << h_align;
|
||||
controller().dispatchMatrix(os.str());
|
||||
}
|
||||
|
||||
|
||||
void GMathsMatrix::update()
|
||||
{
|
||||
ButtonPolicy::SMInput activate = ButtonPolicy::SMI_VALID;
|
||||
bc().input(activate);
|
||||
}
|
||||
|
||||
|
||||
void GMathsMatrix::updateHorzAlignEntry()
|
||||
{
|
||||
if (ignoreHorzAlign_) return;
|
||||
|
||||
Glib::ustring orig = horzalignentry_->get_text();
|
||||
Glib::ustring stripped;
|
||||
|
||||
Glib::ustring::iterator cur;
|
||||
for (cur = orig.begin(); cur != orig.end(); ++cur) {
|
||||
if (*cur == 'c' || *cur == 'l' ||
|
||||
*cur == 'r' || *cur == '|')
|
||||
stripped += *cur;
|
||||
}
|
||||
|
||||
int barcount = countbars(stripped);
|
||||
while (stripped.length() - barcount >
|
||||
columnsspin_->get_adjustment()->get_value()) {
|
||||
// erase last character of stripped
|
||||
stripped = stripped.erase(stripped.length() - 1,1);
|
||||
barcount = countbars(stripped);
|
||||
}
|
||||
|
||||
while (stripped.length() - barcount <
|
||||
columnsspin_->get_adjustment()->get_value()) {
|
||||
stripped = stripped + "c";
|
||||
barcount = countbars(stripped);
|
||||
}
|
||||
|
||||
if (orig.compare(stripped) != 0) {
|
||||
ignoreHorzAlign_ = true;
|
||||
horzalignentry_->set_text(stripped);
|
||||
ignoreHorzAlign_ = false;
|
||||
}
|
||||
}
|
||||
|
||||
int GMathsMatrix::countbars(Glib::ustring str)
|
||||
{
|
||||
int barcount = 0;
|
||||
Glib::ustring::iterator cur = str.begin();
|
||||
Glib::ustring::iterator end = str.end();
|
||||
for (; cur != end; ++cur) {
|
||||
if (*cur == '|')
|
||||
++barcount;
|
||||
}
|
||||
return barcount;
|
||||
}
|
||||
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
@ -1,51 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file GMathsMatrix.h
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author John Spray
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#ifndef GMATHSMATRIX_H
|
||||
#define GMATHSMATRIX_H
|
||||
|
||||
#include "GViewBase.h"
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
class ControlMath;
|
||||
|
||||
/**
|
||||
* This class provides an GTK implementation of the maths matrix dialog.
|
||||
*/
|
||||
class GMathsMatrix
|
||||
: public GViewCB<ControlMath, GViewGladeB> {
|
||||
public:
|
||||
GMathsMatrix(Dialog &);
|
||||
int AlignFilter(char const *, int);
|
||||
private:
|
||||
virtual void apply();
|
||||
virtual void doBuild();
|
||||
virtual void update();
|
||||
|
||||
void updateHorzAlignEntry();
|
||||
int countbars(Glib::ustring str);
|
||||
|
||||
Gtk::RadioButton * topradio_;
|
||||
Gtk::RadioButton * bottomradio_;
|
||||
Gtk::RadioButton * centerradio_;
|
||||
Gtk::SpinButton * rowsspin_;
|
||||
Gtk::SpinButton * columnsspin_;
|
||||
Gtk::Entry * horzalignentry_;
|
||||
bool ignoreHorzAlign_;
|
||||
};
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#endif // GMATHSMATRIX_H
|
||||
|
@ -1,272 +0,0 @@
|
||||
/**
|
||||
* \file GMenubar.C
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Huang Ying
|
||||
* \author John Spray
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
// Too hard to make concept checks work with this file
|
||||
#ifdef _GLIBCXX_CONCEPT_CHECKS
|
||||
#undef _GLIBCXX_CONCEPT_CHECKS
|
||||
#endif
|
||||
#ifdef _GLIBCPP_CONCEPT_CHECKS
|
||||
#undef _GLIBCPP_CONCEPT_CHECKS
|
||||
#endif
|
||||
|
||||
#include "GMenubar.h"
|
||||
#include "GView.h"
|
||||
#include "ghelpers.h"
|
||||
|
||||
#include "ToolbarBackend.h" // for getIcon
|
||||
|
||||
#include "debug.h"
|
||||
#include "support/lstrings.h"
|
||||
#include "support/docstring.h"
|
||||
#include "lyxfunc.h"
|
||||
|
||||
using std::string;
|
||||
|
||||
namespace lyx {
|
||||
|
||||
using support::subst;
|
||||
|
||||
namespace frontend {
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
class LyxMenu : public Gtk::Menu {
|
||||
public:
|
||||
LyxMenu() { menu_.reset(new ::Menu); }
|
||||
|
||||
::Menu & getBackMenu() { return *menu_.get(); }
|
||||
|
||||
void clearBackMenu() { menu_.reset(new ::Menu); }
|
||||
private:
|
||||
std::auto_ptr< ::Menu > menu_;
|
||||
};
|
||||
|
||||
|
||||
Glib::ustring labelTrans(docstring const & label_src,
|
||||
docstring const & shortcut)
|
||||
{
|
||||
docstring label = subst(label_src,
|
||||
lyx::from_ascii("_"),
|
||||
lyx::from_ascii("__"));
|
||||
docstring::size_type i = label.find(shortcut);
|
||||
if (i == docstring::npos)
|
||||
return lyx::to_utf8(label);
|
||||
label.insert(i, lyx::from_ascii("_"));
|
||||
return lyx::to_utf8(label);
|
||||
}
|
||||
|
||||
|
||||
void ClearMenu(Gtk::MenuShell * menu)
|
||||
{
|
||||
Gtk::Menu_Helpers::MenuList::iterator m = menu->items().begin();
|
||||
Gtk::Menu_Helpers::MenuList::iterator end = menu->items().end();
|
||||
Gtk::Menu * subMenu;
|
||||
for (; m != end; ++m) {
|
||||
if ((subMenu = m->get_submenu()) != 0) {
|
||||
ClearMenu(subMenu);
|
||||
delete subMenu;
|
||||
}
|
||||
}
|
||||
menu->items().clear();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
GMenubar::GMenubar(LyXView * lyxView, MenuBackend const & /*menuBackend*/) :
|
||||
view_(lyxView)
|
||||
{
|
||||
GView * gview = static_cast<GView*>(lyxView);
|
||||
Menu const & menu = menubackend.getMenubar();
|
||||
Menu::const_iterator i = menu.begin();
|
||||
Menu::const_iterator end = menu.end();
|
||||
for (; i != end; ++i) {
|
||||
if (i->kind() != MenuItem::Submenu) {
|
||||
lyxerr << "ERROR: GMenubar::createMenubar:"
|
||||
" only submenus can appear in a menubar"
|
||||
<< std::endl;
|
||||
continue;
|
||||
}
|
||||
Gtk::Menu * gmenu = new LyxMenu;
|
||||
menubar_.items().push_back(
|
||||
Gtk::Menu_Helpers::MenuElem(
|
||||
labelTrans(i->label(), i->shortcut()),
|
||||
*gmenu));
|
||||
menubar_.items().back().signal_activate().connect(
|
||||
sigc::bind(sigc::mem_fun(*this, &GMenubar::onSubMenuActivate), &(*i),
|
||||
&menubar_.items().back()));
|
||||
mainMenuNames_.push_back(lyx::to_utf8(i->submenuname()));
|
||||
}
|
||||
menubar_.show();
|
||||
gview->getBox(GView::Top).children().push_back(
|
||||
Gtk::Box_Helpers::Element(menubar_, Gtk::PACK_SHRINK));
|
||||
}
|
||||
|
||||
|
||||
GMenubar::~GMenubar()
|
||||
{
|
||||
ClearMenu(&menubar_);
|
||||
}
|
||||
|
||||
|
||||
void GMenubar::update()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void GMenubar::openByName(docstring const & name)
|
||||
{
|
||||
Glib::ustring uname = lyx::to_utf8(name);
|
||||
std::vector<Glib::ustring>::iterator it =
|
||||
std::find(mainMenuNames_.begin(), mainMenuNames_.end(),
|
||||
uname);
|
||||
if (it != mainMenuNames_.end()) {
|
||||
Gtk::MenuItem& mitem = menubar_.items()[it - mainMenuNames_.begin()];
|
||||
mitem.select();
|
||||
mitem.activate();
|
||||
return;
|
||||
}
|
||||
lyxerr << "GMenubar::openByName: menu "
|
||||
<< lyx::to_utf8(name) << " not found" << std::endl;
|
||||
}
|
||||
|
||||
|
||||
void GMenubar::onSubMenuActivate(MenuItem const * item,
|
||||
Gtk::MenuItem * gitem)
|
||||
{
|
||||
Gtk::Menu * gmenu = gitem->get_submenu();
|
||||
ClearMenu(gmenu);
|
||||
LyxMenu * lyxmenu = static_cast<LyxMenu*>(gmenu);
|
||||
lyxmenu->clearBackMenu();
|
||||
|
||||
Menu * fmenu;
|
||||
Menu::const_iterator i;
|
||||
Menu::const_iterator end;
|
||||
if(!item->submenuname().empty()) {
|
||||
fmenu = &menubackend.getMenu(item->submenuname());
|
||||
menubackend.expand(*fmenu, lyxmenu->getBackMenu(), view_->buffer());
|
||||
i = lyxmenu->getBackMenu().begin();
|
||||
end = lyxmenu->getBackMenu().end();
|
||||
} else {
|
||||
fmenu = item->submenu();
|
||||
i = fmenu->begin();
|
||||
end = fmenu->end();
|
||||
}
|
||||
|
||||
// Choose size for icons on command items
|
||||
int iconwidth = 16;
|
||||
int iconheight = 16;
|
||||
Gtk::IconSize::lookup(Gtk::ICON_SIZE_MENU, iconwidth, iconheight);
|
||||
|
||||
Gtk::Menu * gmenu_new;
|
||||
for (; i != end; ++i) {
|
||||
switch (i->kind()) {
|
||||
case MenuItem::Submenu:
|
||||
gmenu_new = new LyxMenu;
|
||||
gmenu->items().push_back(
|
||||
Gtk::Menu_Helpers::MenuElem(
|
||||
labelTrans(i->label(), i->shortcut()),
|
||||
*gmenu_new));
|
||||
gmenu->items().back().signal_activate().connect(
|
||||
sigc::bind(sigc::mem_fun(*this, &GMenubar::onSubMenuActivate),
|
||||
&(*i),
|
||||
&gmenu->items().back()));
|
||||
if (!i->status().enabled())
|
||||
gmenu->items().back().set_sensitive(false);
|
||||
break;
|
||||
case MenuItem::Command:
|
||||
{
|
||||
FuncStatus const flag = i->status();
|
||||
bool on = flag.onoff(true);
|
||||
bool off = flag.onoff(false);
|
||||
|
||||
if (on || off) {
|
||||
gmenu->items().push_back(
|
||||
Gtk::Menu_Helpers::CheckMenuElem(
|
||||
labelTrans(i->label(),
|
||||
i->shortcut())));
|
||||
Gtk::CheckMenuItem& checkitem =
|
||||
static_cast<Gtk::CheckMenuItem&>(
|
||||
gmenu->items().back());
|
||||
checkitem.set_active(on);
|
||||
} else {
|
||||
// Choose an icon from the funcrequest
|
||||
Gtk::Image * image = getGTKIcon(i->func(), Gtk::ICON_SIZE_MENU);
|
||||
if (!image) {
|
||||
// ENCODING, FIXME: does Pixbuf::create_from_file really
|
||||
// want UTF-8, or does it want filename encoding? Is
|
||||
// the backend string really in locale encoding?
|
||||
// This shouldn't break as long as filenames are ASCII
|
||||
Glib::ustring xpmName =
|
||||
Glib::locale_to_utf8(toolbarbackend.getIcon(i->func()));
|
||||
if (xpmName.find("unknown.xpm") == Glib::ustring::npos) {
|
||||
// Load icon and shrink it for menu size
|
||||
Glib::RefPtr<Gdk::Pixbuf> bigicon =
|
||||
Gdk::Pixbuf::create_from_file(xpmName);
|
||||
Glib::RefPtr<Gdk::Pixbuf> smallicon =
|
||||
bigicon->scale_simple(iconwidth,iconheight,Gdk::INTERP_TILES);
|
||||
image = Gtk::manage(new Gtk::Image(smallicon));
|
||||
}
|
||||
}
|
||||
|
||||
Gtk::ImageMenuItem * imgitem = Gtk::manage(new Gtk::ImageMenuItem);
|
||||
if (image)
|
||||
imgitem->set_image(*image);
|
||||
|
||||
// This hbox is necessary because add_accel_label is protected,
|
||||
// and even if you subclass Gtk::MenuItem then add_accel_label
|
||||
// doesn't do what you'd expect.
|
||||
Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox);
|
||||
Gtk::Label * label1 = Gtk::manage(new Gtk::Label(
|
||||
labelTrans(i->label(), i->shortcut()), true));
|
||||
Gtk::Label * label2 =
|
||||
Gtk::manage(new Gtk::Label(
|
||||
" " + lyx::to_utf8(i->binding()), false));
|
||||
hbox->pack_start(*label1, false, false, 0);
|
||||
hbox->pack_end(*label2, false, false, 0);
|
||||
imgitem->add(*hbox);
|
||||
|
||||
gmenu->append(*imgitem);
|
||||
imgitem->show_all();
|
||||
}
|
||||
Gtk::MenuItem & newitem = gmenu->items().back();
|
||||
newitem.signal_activate().connect(
|
||||
sigc::bind(sigc::mem_fun(*this, &GMenubar::onCommandActivate),
|
||||
&(*i), &newitem));
|
||||
if (!flag.enabled())
|
||||
newitem.set_sensitive(false);
|
||||
break;
|
||||
}
|
||||
case MenuItem::Separator:
|
||||
gmenu->items().push_back(
|
||||
Gtk::Menu_Helpers::SeparatorElem());
|
||||
break;
|
||||
default:
|
||||
lyxerr << "GMenubar::create_submenu: "
|
||||
"this should not happen" << std::endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void GMenubar::onCommandActivate(MenuItem const * item,
|
||||
Gtk::MenuItem * /*gitem*/)
|
||||
{
|
||||
view_->dispatch(item->func());
|
||||
}
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
@ -1,45 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file gtk/GMenubar.h
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Huang Ying
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#ifndef MENUBAR_PIMPL_H
|
||||
#define MENUBAR_PIMPL_H
|
||||
|
||||
#include "frontends/Menubar.h"
|
||||
#include "MenuBackend.h"
|
||||
|
||||
#include <gtkmm.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace lyx {
|
||||
|
||||
class LyXView;
|
||||
|
||||
namespace frontend {
|
||||
|
||||
class GMenubar : public Menubar, public sigc::trackable {
|
||||
public:
|
||||
GMenubar(LyXView *, MenuBackend const &);
|
||||
~GMenubar();
|
||||
void update();
|
||||
void openByName(lyx::docstring const &);
|
||||
private:
|
||||
void onCommandActivate(MenuItem const * item, Gtk::MenuItem * gitem);
|
||||
void onSubMenuActivate(MenuItem const * item, Gtk::MenuItem * gitem);
|
||||
Gtk::MenuBar menubar_;
|
||||
LyXView * view_;
|
||||
std::vector<Glib::ustring> mainMenuNames_;
|
||||
};
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#endif
|
@ -1,301 +0,0 @@
|
||||
/**
|
||||
* \file GMiniBuffer.C
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Huang Ying
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
// Too hard to make concept checks work with this file
|
||||
#ifdef _GLIBCXX_CONCEPT_CHECKS
|
||||
#undef _GLIBCXX_CONCEPT_CHECKS
|
||||
#endif
|
||||
#ifdef _GLIBCPP_CONCEPT_CHECKS
|
||||
#undef _GLIBCPP_CONCEPT_CHECKS
|
||||
#endif
|
||||
|
||||
#include "GView.h"
|
||||
#include "GMiniBuffer.h"
|
||||
#include "debug.h"
|
||||
#include "bufferview_funcs.h"
|
||||
|
||||
#include "frontends/controllers/ControlCommandBuffer.h"
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
#include <vector>
|
||||
|
||||
using std::string;
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
GMiniBuffer::GMiniBuffer(GView * view, ControlCommandBuffer & control) :
|
||||
controller_(control), view_(view)
|
||||
{
|
||||
listCols_.add(listCol_);
|
||||
listStore_ = Gtk::ListStore::create(listCols_);
|
||||
listView_.set_model(listStore_);
|
||||
listView_.append_column("Completions", listCol_);
|
||||
listView_.signal_key_press_event().connect(
|
||||
sigc::mem_fun(*this, &GMiniBuffer::onListKeyPress));
|
||||
listView_.signal_focus_in_event().connect(
|
||||
sigc::mem_fun(*this, &GMiniBuffer::onListFocusIn));
|
||||
listView_.signal_focus_out_event().connect(
|
||||
sigc::mem_fun(*this, &GMiniBuffer::onFocusOut));
|
||||
listSel_ = listView_.get_selection();
|
||||
listSel_->signal_changed().connect(
|
||||
sigc::mem_fun(*this, &GMiniBuffer::onSelected));
|
||||
|
||||
listView_.show();
|
||||
scrolledWindow_.set_policy(Gtk::POLICY_AUTOMATIC,
|
||||
Gtk::POLICY_AUTOMATIC);
|
||||
scrolledWindow_.set_size_request(300, 150);
|
||||
scrolledWindow_.add(listView_);
|
||||
|
||||
view_->getBox(GView::Bottom).children().push_back(
|
||||
Gtk::Box_Helpers::Element(scrolledWindow_,Gtk::PACK_SHRINK));
|
||||
|
||||
entry_.signal_key_press_event().connect(
|
||||
sigc::mem_fun(*this, &GMiniBuffer::onKeyPress));
|
||||
entry_.signal_focus_in_event().connect(
|
||||
sigc::mem_fun(*this, &GMiniBuffer::onFocusIn));
|
||||
entry_.signal_focus_out_event().connect(
|
||||
sigc::mem_fun(*this, &GMiniBuffer::onFocusOut));
|
||||
entry_.signal_activate().connect(
|
||||
sigc::mem_fun(*this, &GMiniBuffer::onCommit));
|
||||
entry_.show();
|
||||
|
||||
view_->getBox(GView::Bottom).children().push_back(
|
||||
Gtk::Box_Helpers::Element(entry_, Gtk::PACK_SHRINK));
|
||||
|
||||
infoTimer_.reset(new Timeout(1500));
|
||||
idleTimer_.reset(new Timeout(6000));
|
||||
focusTimer_.reset(new Timeout(50));
|
||||
infoCon_ = infoTimer_->timeout.connect(
|
||||
boost::bind(&GMiniBuffer::infoTimeout, this));
|
||||
idleCon_ = idleTimer_->timeout.connect(
|
||||
boost::bind(&GMiniBuffer::idleTimeout, this));
|
||||
focusTimer_->timeout.connect(
|
||||
boost::bind(&GMiniBuffer::focusTimeout, this));
|
||||
idleTimer_->start();
|
||||
//messageMode();
|
||||
}
|
||||
|
||||
|
||||
GMiniBuffer::~GMiniBuffer()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void GMiniBuffer::message(string const & str)
|
||||
{
|
||||
if (!isEditMode())
|
||||
setInput(Glib::locale_to_utf8(str));
|
||||
}
|
||||
|
||||
|
||||
void GMiniBuffer::showInfo(Glib::ustring const & info, bool append)
|
||||
{
|
||||
storedInput_ = entry_.get_text();
|
||||
entry_.set_editable(false);
|
||||
infoShown_ = true;
|
||||
if (append)
|
||||
setInput(storedInput_ + ' ' + info);
|
||||
else
|
||||
setInput(info);
|
||||
infoTimer_->start();
|
||||
}
|
||||
|
||||
|
||||
void GMiniBuffer::onSelected()
|
||||
{
|
||||
if (!listSel_->count_selected_rows())
|
||||
return;
|
||||
Gtk::TreeModel::iterator it = listSel_->get_selected();
|
||||
Glib::ustring sel = (*it)[listCol_];
|
||||
setInput(sel + ' ');
|
||||
}
|
||||
|
||||
|
||||
void GMiniBuffer::onCommit()
|
||||
{
|
||||
controller_.dispatch(Glib::locale_from_utf8(entry_.get_text()));
|
||||
messageMode();
|
||||
}
|
||||
|
||||
|
||||
bool GMiniBuffer::onListFocusIn(GdkEventFocus * /*event*/)
|
||||
{
|
||||
if (focusTimer_->running())
|
||||
focusTimer_->stop();
|
||||
if (infoShown_) {
|
||||
infoTimer_->stop();
|
||||
infoTimeout();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool GMiniBuffer::onFocusIn(GdkEventFocus * /*event*/)
|
||||
{
|
||||
if (infoShown_) {
|
||||
infoTimer_->stop();
|
||||
infoTimeout();
|
||||
}
|
||||
if (focusTimer_->running()) {
|
||||
focusTimer_->stop();
|
||||
return false;
|
||||
}
|
||||
setInput("");
|
||||
idleTimer_->stop();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool GMiniBuffer::onFocusOut(GdkEventFocus * /*event*/)
|
||||
{
|
||||
focusTimer_->start();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void GMiniBuffer::focusTimeout()
|
||||
{
|
||||
if (infoShown_) {
|
||||
infoTimer_->stop();
|
||||
infoTimeout();
|
||||
}
|
||||
focusTimer_->stop();
|
||||
setInput("");
|
||||
idleTimer_->start();
|
||||
scrolledWindow_.hide();
|
||||
}
|
||||
|
||||
|
||||
bool GMiniBuffer::onListKeyPress(GdkEventKey * event)
|
||||
{
|
||||
if (infoShown_) {
|
||||
infoTimer_->stop();
|
||||
infoTimeout();
|
||||
}
|
||||
switch (event->keyval) {
|
||||
case GDK_Escape:
|
||||
messageMode();
|
||||
break;
|
||||
case GDK_Tab:
|
||||
entry_.grab_focus();
|
||||
setInput(entry_.get_text() + ' ');
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool GMiniBuffer::onKeyPress(GdkEventKey * event)
|
||||
{
|
||||
if (infoShown_) {
|
||||
infoTimer_->stop();
|
||||
infoTimeout();
|
||||
}
|
||||
switch (event->keyval) {
|
||||
case GDK_Down:
|
||||
{
|
||||
Glib::ustring const h =
|
||||
Glib::locale_to_utf8(controller_.historyDown());
|
||||
if (h.empty())
|
||||
showInfo("[End of history]", false);
|
||||
else
|
||||
setInput(h);
|
||||
break;
|
||||
}
|
||||
case GDK_Up:
|
||||
{
|
||||
Glib::ustring const h =
|
||||
Glib::locale_to_utf8(controller_.historyUp());
|
||||
if (h.empty())
|
||||
showInfo("[Beginning of history]", false);
|
||||
else
|
||||
setInput(h);
|
||||
break;
|
||||
}
|
||||
case GDK_Escape:
|
||||
messageMode();
|
||||
break;
|
||||
case GDK_Tab:
|
||||
{
|
||||
string new_input_locale;
|
||||
Glib::ustring input = entry_.get_text();
|
||||
std::vector<string> comp =
|
||||
controller_.completions(Glib::locale_from_utf8(input),
|
||||
new_input_locale);
|
||||
Glib::ustring new_input =
|
||||
Glib::locale_to_utf8(new_input_locale);
|
||||
|
||||
if (comp.empty() && new_input == input) {
|
||||
showInfo("[no match]");
|
||||
break;
|
||||
}
|
||||
|
||||
if (comp.empty()) {
|
||||
setInput(new_input + ' ');
|
||||
showInfo("[only completion]");
|
||||
break;
|
||||
}
|
||||
setInput(new_input);
|
||||
listStore_->clear();
|
||||
std::vector<string>::iterator it;
|
||||
for (it = comp.begin(); it != comp.end(); ++it)
|
||||
(*listStore_->append())[listCol_] =
|
||||
Glib::locale_to_utf8(*it);
|
||||
scrolledWindow_.show();
|
||||
break;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool GMiniBuffer::isEditMode() const
|
||||
{
|
||||
return entry_.has_focus() || listView_.has_focus();
|
||||
}
|
||||
|
||||
|
||||
void GMiniBuffer::infoTimeout()
|
||||
{
|
||||
infoShown_ = false;
|
||||
setInput(storedInput_);
|
||||
entry_.set_editable(true);
|
||||
}
|
||||
|
||||
|
||||
void GMiniBuffer::idleTimeout()
|
||||
{
|
||||
setInput(Glib::locale_to_utf8(controller_.getCurrentState()));
|
||||
}
|
||||
|
||||
|
||||
void GMiniBuffer::editMode()
|
||||
{
|
||||
entry_.grab_focus();
|
||||
}
|
||||
|
||||
|
||||
void GMiniBuffer::messageMode()
|
||||
{
|
||||
view_->focusWorkArea();
|
||||
}
|
||||
|
||||
|
||||
void GMiniBuffer::setInput(Glib::ustring const & input)
|
||||
{
|
||||
entry_.set_text(input);
|
||||
entry_.set_position(-1);
|
||||
}
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
@ -1,75 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file GMiniBuffer.h
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Huang Ying
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef GMINI_BUFFER_H
|
||||
#define GMINI_BUFFER_H
|
||||
|
||||
#include "frontends/Timeout.h"
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
class ControlCommandBuffer;
|
||||
|
||||
class GMiniBuffer : public sigc::trackable {
|
||||
public:
|
||||
GMiniBuffer(GView * view, ControlCommandBuffer & control);
|
||||
~GMiniBuffer();
|
||||
void message(std::string const & str);
|
||||
/// go into edit mode
|
||||
void editMode();
|
||||
private:
|
||||
bool onKeyPress(GdkEventKey * event);
|
||||
bool onListKeyPress(GdkEventKey * event);
|
||||
void onCommit();
|
||||
bool onListFocusIn(GdkEventFocus * event);
|
||||
bool onFocusIn(GdkEventFocus * event);
|
||||
bool onFocusOut(GdkEventFocus * event);
|
||||
void focusTimeout();
|
||||
void onSelected();
|
||||
/// Are we in edit mode?
|
||||
bool isEditMode() const;
|
||||
/// reset buffer to stored input text
|
||||
void infoTimeout();
|
||||
/// go back to "at rest" message
|
||||
void idleTimeout();
|
||||
/// go into message mode
|
||||
void messageMode();
|
||||
/// show a temporary message whilst in edit mode
|
||||
void showInfo(Glib::ustring const & info, bool append = true);
|
||||
void setInput(Glib::ustring const & input);
|
||||
ControlCommandBuffer & controller_;
|
||||
GView * view_;
|
||||
Gtk::Entry entry_;
|
||||
/// info timer
|
||||
boost::scoped_ptr<Timeout> infoTimer_;
|
||||
boost::signals::connection infoCon_;
|
||||
/// idle timer
|
||||
boost::scoped_ptr<Timeout> idleTimer_;
|
||||
boost::signals::connection idleCon_;
|
||||
Glib::ustring storedInput_;
|
||||
/// are we showing an informational temporary message ?
|
||||
bool infoShown_;
|
||||
boost::scoped_ptr<Timeout> focusTimer_;
|
||||
|
||||
Gtk::ScrolledWindow scrolledWindow_;
|
||||
Gtk::TreeModelColumn<Glib::ustring> listCol_;
|
||||
Gtk::TreeModel::ColumnRecord listCols_;
|
||||
Glib::RefPtr<Gtk::ListStore> listStore_;
|
||||
Gtk::TreeView listView_;
|
||||
Glib::RefPtr<Gtk::TreeSelection> listSel_;
|
||||
};
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#endif
|
@ -1,117 +0,0 @@
|
||||
/**
|
||||
* \file GNote.C
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author John Spray
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
// Too hard to make concept checks work with this file
|
||||
#ifdef _GLIBCXX_CONCEPT_CHECKS
|
||||
#undef _GLIBCXX_CONCEPT_CHECKS
|
||||
#endif
|
||||
#ifdef _GLIBCPP_CONCEPT_CHECKS
|
||||
#undef _GLIBCPP_CONCEPT_CHECKS
|
||||
#endif
|
||||
|
||||
#include "GNote.h"
|
||||
#include "ControlNote.h"
|
||||
#include "ghelpers.h"
|
||||
|
||||
#include "insets/insetnote.h"
|
||||
|
||||
#include <libglademm.h>
|
||||
|
||||
using std::string;
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
GNote::GNote(Dialog & parent)
|
||||
: GViewCB<ControlNote, GViewGladeB>(parent, _("Note Settings"), false)
|
||||
{}
|
||||
|
||||
|
||||
void GNote::doBuild()
|
||||
{
|
||||
string const gladeName = findGladeFile("note");
|
||||
xml_ = Gnome::Glade::Xml::create(gladeName);
|
||||
|
||||
Gtk::Button * cancelbutton;
|
||||
xml_->get_widget("Close", cancelbutton);
|
||||
setCancel(cancelbutton);
|
||||
|
||||
xml_->get_widget("LyXNote", lyxnoteradio_);
|
||||
xml_->get_widget("Comment", commentradio_);
|
||||
xml_->get_widget("GreyedOut", greyedoutradio_);
|
||||
// FIXME add Framed, Shaded
|
||||
|
||||
lyxnoteradio_->signal_toggled().connect(
|
||||
sigc::mem_fun(*this, &GNote::apply));
|
||||
commentradio_->signal_toggled().connect(
|
||||
sigc::mem_fun(*this, &GNote::apply));
|
||||
greyedoutradio_->signal_toggled().connect(
|
||||
sigc::mem_fun(*this, &GNote::apply));
|
||||
|
||||
bcview().addReadOnly(lyxnoteradio_);
|
||||
bcview().addReadOnly(commentradio_);
|
||||
bcview().addReadOnly(greyedoutradio_);
|
||||
}
|
||||
|
||||
|
||||
void GNote::update()
|
||||
{
|
||||
applylock_ = true;
|
||||
|
||||
bc().refreshReadOnly();
|
||||
|
||||
switch (controller().params().type) {
|
||||
case InsetNoteParams::Framed:
|
||||
//framedradio_->set_active(true);
|
||||
greyedoutradio_->set_active(true);
|
||||
break;
|
||||
case InsetNoteParams::Shaded:
|
||||
//shadedradio_->set_active(true);
|
||||
greyedoutradio_->set_active(true);
|
||||
break;
|
||||
case InsetNoteParams::Note:
|
||||
lyxnoteradio_->set_active(true);
|
||||
break;
|
||||
case InsetNoteParams::Comment:
|
||||
commentradio_->set_active(true);
|
||||
break;
|
||||
case InsetNoteParams::Greyedout:
|
||||
greyedoutradio_->set_active(true);
|
||||
break;
|
||||
// FIXME: Framed and Shaded not handled properly
|
||||
}
|
||||
|
||||
applylock_ = false;
|
||||
}
|
||||
|
||||
|
||||
void GNote::apply()
|
||||
{
|
||||
if (applylock_)
|
||||
return;
|
||||
|
||||
InsetNoteParams::Type type;
|
||||
|
||||
if (lyxnoteradio_->get_active())
|
||||
type = InsetNoteParams::Note;
|
||||
else if (greyedoutradio_->get_active())
|
||||
type = InsetNoteParams::Greyedout;
|
||||
else
|
||||
type = InsetNoteParams::Comment;
|
||||
// FIXME add Framed, Shaded
|
||||
|
||||
controller().params().type = type;
|
||||
controller().dispatchParams();
|
||||
}
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
@ -1,43 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file GNote.h
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author John Spray
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#ifndef GNOTE_H
|
||||
#define GNOTE_H
|
||||
|
||||
#include "GViewBase.h"
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
class ControlNote;
|
||||
|
||||
/** This class provides a GTK+ implementation of the Note Dialog.
|
||||
*/
|
||||
class GNote : public GViewCB<ControlNote, GViewGladeB> {
|
||||
public:
|
||||
GNote(Dialog & parent);
|
||||
private:
|
||||
virtual void apply();
|
||||
virtual void doBuild();
|
||||
virtual void update();
|
||||
|
||||
// apply() won't act when this is true
|
||||
bool applylock_;
|
||||
|
||||
Gtk::RadioButton * lyxnoteradio_;
|
||||
Gtk::RadioButton * commentradio_;
|
||||
Gtk::RadioButton * greyedoutradio_;
|
||||
};
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#endif // GNOTE_H
|
@ -1,265 +0,0 @@
|
||||
/**
|
||||
* \file GPainter.C
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Huang Ying
|
||||
* \author John Spray
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
// Too hard to make concept checks work with this file
|
||||
#ifdef _GLIBCXX_CONCEPT_CHECKS
|
||||
#undef _GLIBCXX_CONCEPT_CHECKS
|
||||
#endif
|
||||
#ifdef _GLIBCPP_CONCEPT_CHECKS
|
||||
#undef _GLIBCPP_CONCEPT_CHECKS
|
||||
#endif
|
||||
|
||||
#include "GPainter.h"
|
||||
#include "debug.h"
|
||||
#include "GWorkArea.h"
|
||||
#include "LyXGdkImage.h"
|
||||
#include "lyxrc.h"
|
||||
#include "encoding.h"
|
||||
#include "language.h"
|
||||
#include "LColor.h"
|
||||
#include "xftFontLoader.h"
|
||||
|
||||
#include "frontends/Application.h"
|
||||
#include "frontends/FontMetrics.h"
|
||||
|
||||
#include "support/lstrings.h"
|
||||
|
||||
#include <gtkmm.h>
|
||||
#include <gdk/gdkx.h>
|
||||
|
||||
#include <X11/Xft/Xft.h>
|
||||
|
||||
#include <boost/scoped_array.hpp>
|
||||
|
||||
#include <cmath>
|
||||
|
||||
using std::string;
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
GPainter::GPainter(GWorkArea & xwa)
|
||||
: Painter(), owner_(xwa), currentcolor_(LColor::magenta)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
int GPainter::paperWidth() const
|
||||
{
|
||||
return owner_.workWidth();
|
||||
}
|
||||
|
||||
|
||||
int GPainter::paperHeight() const
|
||||
{
|
||||
return owner_.workHeight();
|
||||
}
|
||||
|
||||
|
||||
inline void GPainter::setForeground(LColor_color clr)
|
||||
{
|
||||
if (clr != currentcolor_) {
|
||||
gc_->set_foreground(*(colorhandler_->getGdkColor(clr)));
|
||||
currentcolor_ = clr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void GPainter::start()
|
||||
{
|
||||
pixmap_ = owner_.getPixmap();
|
||||
colorhandler_ = &(owner_.getColorHandler());
|
||||
gc_ = owner_.getGC();
|
||||
gc_->set_foreground(*(colorhandler_->getGdkColor(currentcolor_)));
|
||||
}
|
||||
|
||||
|
||||
inline void GPainter::setLineParam(line_style ls, line_width lw)
|
||||
{
|
||||
int width = 0;
|
||||
switch (lw) {
|
||||
case Painter::line_thin:
|
||||
width = 0;
|
||||
break;
|
||||
case Painter::line_thick:
|
||||
width = 2;
|
||||
break;
|
||||
}
|
||||
|
||||
Gdk::LineStyle style = Gdk::LINE_SOLID;
|
||||
switch (ls) {
|
||||
case Painter::line_solid:
|
||||
style = Gdk::LINE_SOLID;
|
||||
break;
|
||||
case Painter::line_onoffdash:
|
||||
style = Gdk::LINE_ON_OFF_DASH;
|
||||
break;
|
||||
}
|
||||
gc_->set_line_attributes(width, style,
|
||||
Gdk::CAP_NOT_LAST, Gdk::JOIN_MITER);
|
||||
}
|
||||
|
||||
|
||||
void GPainter::point(int x, int y, LColor_color c)
|
||||
{
|
||||
setForeground(c);
|
||||
pixmap_->draw_point(gc_, x, y);
|
||||
}
|
||||
|
||||
|
||||
void GPainter::line(int x1, int y1,
|
||||
int x2, int y2,
|
||||
LColor_color col,
|
||||
line_style ls,
|
||||
line_width lw)
|
||||
{
|
||||
setForeground(col);
|
||||
setLineParam(ls, lw);
|
||||
pixmap_->draw_line(gc_, x1, y1, x2, y2);
|
||||
}
|
||||
|
||||
|
||||
void GPainter::lines(int const * xp, int const * yp, int np,
|
||||
LColor_color col,
|
||||
line_style ls,
|
||||
line_width lw)
|
||||
{
|
||||
setForeground(col);
|
||||
setLineParam(ls, lw);
|
||||
std::vector<Gdk::Point> points(np);
|
||||
|
||||
for (int i = 0; i < np; ++i) {
|
||||
points[i].set_x(xp[i]);
|
||||
points[i].set_y(yp[i]);
|
||||
}
|
||||
pixmap_->draw_lines(gc_, points);
|
||||
}
|
||||
|
||||
|
||||
void GPainter::rectangle(int x, int y, int w, int h,
|
||||
LColor_color col,
|
||||
line_style ls,
|
||||
line_width lw)
|
||||
{
|
||||
setForeground(col);
|
||||
setLineParam(ls, lw);
|
||||
pixmap_->draw_rectangle(gc_, false, x, y, w, h);
|
||||
}
|
||||
|
||||
|
||||
void GPainter::fillRectangle(int x, int y, int w, int h,
|
||||
LColor_color col)
|
||||
{
|
||||
setForeground(col);
|
||||
pixmap_->draw_rectangle(gc_, true, x, y, w, h);
|
||||
}
|
||||
|
||||
|
||||
void GPainter::arc(int x, int y, unsigned int w, unsigned int h,
|
||||
int a1, int a2, LColor_color col)
|
||||
{
|
||||
setForeground(col);
|
||||
pixmap_->draw_arc(gc_,
|
||||
false, x, y, w, h, a1, a2);
|
||||
}
|
||||
|
||||
|
||||
void GPainter::image(int x, int y, int w, int h,
|
||||
graphics::Image const & i)
|
||||
{
|
||||
graphics::LyXGdkImage const & image =
|
||||
static_cast<graphics::LyXGdkImage const &>(i);
|
||||
Glib::RefPtr<Gdk::Pixbuf> const & pixbuf = image.pixbuf();
|
||||
Glib::RefPtr<Gdk::Pixmap> pixmap = pixmap_;
|
||||
|
||||
Glib::RefPtr<Gdk::GC> gc = gc_;
|
||||
pixmap->draw_pixbuf (gc, pixbuf, 0, 0, x, y, w, h,
|
||||
Gdk::RGB_DITHER_NONE, 0, 0);
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
inline XftFont * getXftFont(LyXFont const & f)
|
||||
{
|
||||
return fontLoader.load(f.family(), f.series(),
|
||||
f.realShape(), f.size());
|
||||
}
|
||||
|
||||
} // anon namespace
|
||||
|
||||
|
||||
int GPainter::text(int x, int y,
|
||||
char_type const * s, size_t ls,
|
||||
LyXFont const & f)
|
||||
{
|
||||
XftFont * font = getXftFont(f);
|
||||
XftColor * xftClr = owner_.getColorHandler().
|
||||
getXftColor(f.realColor());
|
||||
XftDraw * draw = owner_.getXftDraw();
|
||||
int textwidth = 0;
|
||||
|
||||
if (f.realShape() != LyXFont::SMALLCAPS_SHAPE) {
|
||||
XftDrawString32(draw,
|
||||
xftClr,
|
||||
font,
|
||||
x, y,
|
||||
reinterpret_cast<FcChar32 const *>(s),
|
||||
ls);
|
||||
textwidth = theApp->fontLoader().metrics(f).width(s, ls);
|
||||
} else {
|
||||
LyXFont smallfont(f);
|
||||
smallfont.decSize().decSize().setShape(LyXFont::UP_SHAPE);
|
||||
XftFont * fontS = getXftFont(smallfont);
|
||||
for (unsigned int i = 0; i < ls; ++i) {
|
||||
// Ok, this looks quite ugly...
|
||||
char_type c = gdk_keyval_to_unicode(gdk_keyval_to_upper(gdk_unicode_to_keyval(s[i])));
|
||||
if (c != s[i]) {
|
||||
XftDrawString32(draw,
|
||||
xftClr,
|
||||
fontS,
|
||||
x + textwidth, y,
|
||||
reinterpret_cast<FcChar32 *>(&c),
|
||||
1);
|
||||
textwidth += theApp->fontLoader().metrics(smallfont).width(c);
|
||||
} else {
|
||||
XftDrawString32(draw,
|
||||
xftClr,
|
||||
font,
|
||||
x + textwidth, y,
|
||||
reinterpret_cast<FcChar32 *>(&c),
|
||||
1);
|
||||
textwidth += theApp->fontLoader().metrics(f).width(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (f.underbar() == LyXFont::ON)
|
||||
underline(f, x, y, textwidth);
|
||||
|
||||
return textwidth;
|
||||
}
|
||||
|
||||
|
||||
int GPainter::text(int x, int y, docstring const & s, LyXFont const & f)
|
||||
{
|
||||
return text (x, y, reinterpret_cast<char_type const *>(s.data()), s.size(), f);
|
||||
}
|
||||
|
||||
|
||||
int GPainter::text(int x, int y, char_type c, LyXFont const & f)
|
||||
{
|
||||
return text (x, y, &c, 1, f);
|
||||
}
|
||||
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
@ -1,129 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file GPainter.h
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Huang Ying
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#ifndef GPAINTER_H
|
||||
#define GPAINTER_H
|
||||
|
||||
#include "frontends/Painter.h"
|
||||
|
||||
#include <gtkmm.h>
|
||||
|
||||
#include <X11/Xft/Xft.h>
|
||||
|
||||
#include <map>
|
||||
|
||||
class LyXFont;
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
class GWorkArea;
|
||||
class ColorHandler;
|
||||
|
||||
/**
|
||||
* GPainter - a painter implementation for Gtkmm
|
||||
*/
|
||||
class GPainter : public Painter {
|
||||
public:
|
||||
GPainter(GWorkArea &);
|
||||
|
||||
/// return the width of the work area in pixels
|
||||
virtual int paperWidth() const;
|
||||
/// return the height of the work area in pixels
|
||||
virtual int paperHeight() const;
|
||||
|
||||
inline void setForeground(LColor_color clr);
|
||||
inline void setLineParam(line_style ls, line_width lw);
|
||||
XftColor * getXftColor(LColor_color clr);
|
||||
/// draw a line from point to point
|
||||
virtual void line(
|
||||
int x1, int y1,
|
||||
int x2, int y2,
|
||||
LColor_color,
|
||||
line_style = line_solid,
|
||||
line_width = line_thin);
|
||||
|
||||
/**
|
||||
* lines - draw a set of lines
|
||||
* @param xp array of points' x co-ords
|
||||
* @param yp array of points' y co-ords
|
||||
* @param np size of the points array
|
||||
*/
|
||||
virtual void lines(
|
||||
int const * xp,
|
||||
int const * yp,
|
||||
int np,
|
||||
LColor_color,
|
||||
line_style = line_solid,
|
||||
line_width = line_thin);
|
||||
|
||||
/// draw a rectangle
|
||||
virtual void rectangle(
|
||||
int x, int y,
|
||||
int w, int h,
|
||||
LColor_color,
|
||||
line_style = line_solid,
|
||||
line_width = line_thin);
|
||||
|
||||
/// draw a filled rectangle
|
||||
virtual void fillRectangle(
|
||||
int x, int y,
|
||||
int w, int h,
|
||||
LColor_color);
|
||||
|
||||
/// draw an arc
|
||||
virtual void arc(
|
||||
int x, int y,
|
||||
unsigned int w, unsigned int h,
|
||||
int a1, int a2,
|
||||
LColor_color);
|
||||
|
||||
/// draw a pixel
|
||||
virtual void point(
|
||||
int x, int y,
|
||||
LColor_color);
|
||||
|
||||
/// draw an image from the image cache
|
||||
virtual void image(int x, int y,
|
||||
int w, int h,
|
||||
graphics::Image const & image);
|
||||
|
||||
/// draw a string at position x, y (y is the baseline)
|
||||
virtual int text(int x, int y,
|
||||
lyx::docstring const & str, LyXFont const & f);
|
||||
|
||||
/// draw a string at position x, y (y is the baseline)
|
||||
virtual int text(int x, int y,
|
||||
lyx::char_type const * str, size_t l,
|
||||
LyXFont const & f);
|
||||
|
||||
/// draw a char at position x, y (y is the baseline)
|
||||
virtual int text(int x, int y,
|
||||
lyx::char_type c, LyXFont const & f);
|
||||
|
||||
void start();
|
||||
|
||||
|
||||
|
||||
private:
|
||||
/// our owner who we paint upon
|
||||
GWorkArea & owner_;
|
||||
|
||||
Glib::RefPtr<Gdk::GC> gc_;
|
||||
Glib::RefPtr<Gdk::Pixmap> pixmap_;
|
||||
ColorHandler *colorhandler_;
|
||||
LColor_color currentcolor_;
|
||||
};
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#endif // XPAINTER_H
|
@ -1,201 +0,0 @@
|
||||
/**
|
||||
* \file GParagraph.C
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author John Spray
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
// Too hard to make concept checks work with this file
|
||||
#ifdef _GLIBCXX_CONCEPT_CHECKS
|
||||
#undef _GLIBCXX_CONCEPT_CHECKS
|
||||
#endif
|
||||
#ifdef _GLIBCPP_CONCEPT_CHECKS
|
||||
#undef _GLIBCPP_CONCEPT_CHECKS
|
||||
#endif
|
||||
|
||||
#include "GParagraph.h"
|
||||
#include "ghelpers.h"
|
||||
|
||||
#include "ControlParagraph.h"
|
||||
#include "controllers/helper_funcs.h"
|
||||
|
||||
#include "ParagraphParameters.h"
|
||||
#include "Spacing.h"
|
||||
#include "support/lstrings.h"
|
||||
|
||||
using std::string;
|
||||
|
||||
|
||||
namespace lyx {
|
||||
|
||||
namespace frontend {
|
||||
|
||||
namespace {
|
||||
|
||||
} // namespace anon
|
||||
|
||||
|
||||
GParagraph::GParagraph(Dialog & parent)
|
||||
: GViewCB<ControlParagraph, GViewGladeB>(parent, _("Paragraph Settings"), false)
|
||||
{}
|
||||
|
||||
void GParagraph::doBuild()
|
||||
{
|
||||
string const gladeName = findGladeFile("paragraph");
|
||||
xml_ = Gnome::Glade::Xml::create(gladeName);
|
||||
|
||||
xml_->get_widget("LineSpacing", spacingspin_);
|
||||
xml_->get_widget("DefaultLineSpacing", defaultspacingcheck_);
|
||||
xml_->get_widget("MaxLabelWidth", maxlabelwidthentry_);
|
||||
xml_->get_widget("Indent", indentcheck_);
|
||||
xml_->get_widget("AlignBlock", blockradio_);
|
||||
xml_->get_widget("AlignLeft", leftradio_);
|
||||
xml_->get_widget("AlignRight", rightradio_);
|
||||
xml_->get_widget("AlignCenter", centerradio_);
|
||||
|
||||
// Manage the Close button
|
||||
Gtk::Button * button;
|
||||
xml_->get_widget("Close", button);
|
||||
setCancel(button);
|
||||
|
||||
// Make the main hbox sensitive to readonly
|
||||
Gtk::Widget * controlbox;
|
||||
xml_->get_widget("ControlBox", controlbox);
|
||||
bcview().addReadOnly(controlbox);
|
||||
|
||||
spacingadj_ = spacingspin_->get_adjustment();
|
||||
|
||||
defaultspacingcheck_->signal_toggled().connect(
|
||||
sigc::mem_fun(*this, &GParagraph::onDefaultSpacingToggled));
|
||||
indentcheck_->signal_toggled().connect(
|
||||
sigc::mem_fun(*this, &GParagraph::onIndentToggled));
|
||||
spacingadj_->signal_value_changed().connect(
|
||||
sigc::mem_fun(*this, &GParagraph::onSpacingChanged));
|
||||
maxlabelwidthentry_->signal_changed().connect(
|
||||
sigc::mem_fun(*this, &GParagraph::onMaxLabelWidthChanged));
|
||||
|
||||
blockradio_->signal_toggled().connect(
|
||||
sigc::mem_fun(*this, &GParagraph::onAlignToggled));
|
||||
leftradio_->signal_toggled().connect(
|
||||
sigc::mem_fun(*this, &GParagraph::onAlignToggled));
|
||||
rightradio_->signal_toggled().connect(
|
||||
sigc::mem_fun(*this, &GParagraph::onAlignToggled));
|
||||
centerradio_->signal_toggled().connect(
|
||||
sigc::mem_fun(*this, &GParagraph::onAlignToggled));
|
||||
}
|
||||
|
||||
|
||||
void GParagraph::update()
|
||||
{
|
||||
// label width
|
||||
docstring const labelwidth = controller().params().labelWidthString();
|
||||
maxlabelwidthentry_->set_text(lyx::to_utf8(labelwidth));
|
||||
maxlabelwidthentry_->set_sensitive(
|
||||
labelwidth != _("Senseless with this layout!"));
|
||||
|
||||
// alignment
|
||||
LyXAlignment const current_alignment = controller().params().align();
|
||||
switch (current_alignment) {
|
||||
case LYX_ALIGN_BLOCK:
|
||||
blockradio_->set_active(true);
|
||||
break;
|
||||
case LYX_ALIGN_LEFT:
|
||||
leftradio_->set_active(true);
|
||||
break;
|
||||
case LYX_ALIGN_RIGHT:
|
||||
rightradio_->set_active(true);
|
||||
break;
|
||||
case LYX_ALIGN_CENTER:
|
||||
centerradio_->set_active(true);
|
||||
break;
|
||||
default:
|
||||
// LYX_ALIGN_SPECIAL or so? Don't ask, don't tell.
|
||||
centerradio_->set_active(false);
|
||||
blockradio_->set_active(false);
|
||||
rightradio_->set_active(false);
|
||||
leftradio_->set_active(false);
|
||||
}
|
||||
|
||||
// Find out which alignments options are available
|
||||
LyXAlignment alignpos = controller().alignPossible();
|
||||
blockradio_->set_sensitive(bool(alignpos & LYX_ALIGN_BLOCK));
|
||||
centerradio_->set_sensitive(bool(alignpos & LYX_ALIGN_CENTER));
|
||||
leftradio_->set_sensitive(bool(alignpos & LYX_ALIGN_LEFT));
|
||||
rightradio_->set_sensitive(bool(alignpos & LYX_ALIGN_RIGHT));
|
||||
|
||||
// We give the user a checkbox with an affirmative description, so
|
||||
// invert the setting
|
||||
indentcheck_->set_active(!controller().params().noindent());
|
||||
|
||||
// linespacing
|
||||
Spacing const space = controller().params().spacing();
|
||||
|
||||
// This emits the toggled signal, setting up sensitivities
|
||||
defaultspacingcheck_->set_active(
|
||||
space.getSpace() == Spacing::Default);
|
||||
|
||||
spacingadj_->set_value(space.getValue());
|
||||
}
|
||||
|
||||
|
||||
void GParagraph::onDefaultSpacingToggled()
|
||||
{
|
||||
if (defaultspacingcheck_->get_active()) {
|
||||
spacingspin_->set_sensitive(false);
|
||||
Spacing const spacing(Spacing::Default, spacingadj_->get_value());
|
||||
controller().params().spacing(spacing);
|
||||
} else {
|
||||
spacingspin_->set_sensitive(true);
|
||||
Spacing const spacing(Spacing::Other, spacingadj_->get_value());
|
||||
controller().params().spacing(spacing);
|
||||
}
|
||||
controller().dispatchParams();
|
||||
}
|
||||
|
||||
|
||||
void GParagraph::onIndentToggled()
|
||||
{
|
||||
controller().params().noindent(!indentcheck_->get_active());
|
||||
controller().dispatchParams();
|
||||
}
|
||||
|
||||
|
||||
void GParagraph::onSpacingChanged()
|
||||
{
|
||||
Spacing const spacing(Spacing::Other, spacingadj_->get_value());
|
||||
controller().params().spacing(spacing);
|
||||
controller().dispatchParams();
|
||||
}
|
||||
|
||||
|
||||
void GParagraph::onMaxLabelWidthChanged()
|
||||
{
|
||||
// FIXME UNICODE
|
||||
controller().params().labelWidthString(
|
||||
lyx::from_utf8(Glib::locale_to_utf8(maxlabelwidthentry_->get_text())));
|
||||
controller().dispatchParams();
|
||||
}
|
||||
|
||||
|
||||
void GParagraph::onAlignToggled()
|
||||
{
|
||||
if (blockradio_->get_active())
|
||||
controller().params().align(LYX_ALIGN_BLOCK);
|
||||
else if (leftradio_->get_active())
|
||||
controller().params().align(LYX_ALIGN_LEFT);
|
||||
else if (rightradio_->get_active())
|
||||
controller().params().align(LYX_ALIGN_RIGHT);
|
||||
else if (centerradio_->get_active())
|
||||
controller().params().align(LYX_ALIGN_CENTER);
|
||||
|
||||
controller().dispatchParams();
|
||||
}
|
||||
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
@ -1,59 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file GParagraph.h
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author John Spray
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#ifndef GPARAGRAPH_H
|
||||
#define GPARAGRAPH_H
|
||||
|
||||
#include "GViewBase.h"
|
||||
|
||||
#include <gtkmm.h>
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
class ControlParagraph;
|
||||
|
||||
/** This class provides a gtk implementation of the paragraph dialog.
|
||||
*/
|
||||
class GParagraph
|
||||
: public GViewCB<ControlParagraph, GViewGladeB> {
|
||||
public:
|
||||
GParagraph(Dialog &);
|
||||
private:
|
||||
/// Build the dialog
|
||||
virtual void doBuild();
|
||||
/// Apply from dialog
|
||||
virtual void apply() {}
|
||||
/// Update the dialog
|
||||
virtual void update();
|
||||
|
||||
Gtk::SpinButton * spacingspin_;
|
||||
Gtk::Entry * maxlabelwidthentry_;
|
||||
Gtk::CheckButton * indentcheck_;
|
||||
Gtk::CheckButton * defaultspacingcheck_;
|
||||
Gtk::RadioButton * blockradio_;
|
||||
Gtk::RadioButton * leftradio_;
|
||||
Gtk::RadioButton * rightradio_;
|
||||
Gtk::RadioButton * centerradio_;
|
||||
|
||||
Gtk::Adjustment * spacingadj_;
|
||||
|
||||
void onDefaultSpacingToggled();
|
||||
void onMaxLabelWidthChanged();
|
||||
void onSpacingChanged();
|
||||
void onIndentToggled();
|
||||
void onAlignToggled();
|
||||
};
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#endif
|
@ -1,374 +0,0 @@
|
||||
/**
|
||||
* \file GPreferences.C
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author John Spray
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
// Too hard to make concept checks work with this file
|
||||
#ifdef _GLIBCXX_CONCEPT_CHECKS
|
||||
#undef _GLIBCXX_CONCEPT_CHECKS
|
||||
#endif
|
||||
#ifdef _GLIBCPP_CONCEPT_CHECKS
|
||||
#undef _GLIBCPP_CONCEPT_CHECKS
|
||||
#endif
|
||||
|
||||
#include "GPreferences.h"
|
||||
#include "ControlPrefs.h"
|
||||
#include "ghelpers.h"
|
||||
|
||||
#include "controllers/frnt_lang.h"
|
||||
#include "controllers/helper_funcs.h"
|
||||
#include "support/lstrings.h"
|
||||
|
||||
#include <libglademm.h>
|
||||
|
||||
using std::string;
|
||||
using std::vector;
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
GPreferences::GPreferences(Dialog & parent)
|
||||
: GViewCB<ControlPrefs, GViewGladeB>(parent, _("Preferences"), false)
|
||||
{}
|
||||
|
||||
|
||||
void GPreferences::doBuild()
|
||||
{
|
||||
std::cerr << ">>doBuild\n";
|
||||
string const gladeName = findGladeFile("preferences");
|
||||
xml_ = Gnome::Glade::Xml::create(gladeName);
|
||||
|
||||
Gtk::Button *button;
|
||||
xml_->get_widget("Cancel", button);
|
||||
setCancel(button);
|
||||
xml_->get_widget("OK", button);
|
||||
setOK(button);
|
||||
xml_->get_widget("Apply", button);
|
||||
setApply(button);
|
||||
xml_->get_widget("Revert", button);
|
||||
setRestore(button);
|
||||
|
||||
Gtk::HBox *box = NULL;
|
||||
|
||||
// *** Screen fonts ***
|
||||
// FIXME: these font buttons display a dialog
|
||||
// with options for size and bold/etc which are
|
||||
// ignored
|
||||
xml_->get_widget("Roman", romanfontbutton_);
|
||||
xml_->get_widget("SansSerif", sansseriffontbutton_);
|
||||
xml_->get_widget("TypeWriter", typewriterfontbutton_);
|
||||
Gtk::SpinButton *spin;
|
||||
xml_->get_widget("ScreenDPI", spin);
|
||||
dpiadj_ = spin->get_adjustment();
|
||||
xml_->get_widget("Zoom", spin);
|
||||
zoomadj_ = spin->get_adjustment();
|
||||
|
||||
// *** Graphics ***
|
||||
xml_->get_widget("GraphicsColor", graphicscolorradio_);
|
||||
xml_->get_widget("GraphicsGrayscale", graphicsgrayscaleradio_);
|
||||
xml_->get_widget("GraphicsMonochrome", graphicsmonoradio_);
|
||||
xml_->get_widget("GraphicsDoNotDisplay", graphicsnoneradio_);
|
||||
|
||||
xml_->get_widget("InstantPreviewOn", instprevonradio_);
|
||||
xml_->get_widget("InstantPreviewOff", instprevoffradio_);
|
||||
xml_->get_widget("InstantPreviewNoMath", instprevnomathradio_);
|
||||
|
||||
// *** Keyboard ***
|
||||
xml_->get_widget("UseKeyboardMap", keyboardmapcheck_);
|
||||
xml_->get_widget("FirstKeyboardMap", keyboardmap1fcbutton_);
|
||||
xml_->get_widget("SecondKeyboardMap", keyboardmap2fcbutton_);
|
||||
|
||||
Gtk::FileFilter kmapfilter;
|
||||
kmapfilter.set_name ("LyX keyboard maps");
|
||||
kmapfilter.add_pattern ("*.kmap");
|
||||
Gtk::FileFilter allfilter;
|
||||
allfilter.set_name ("All files");
|
||||
allfilter.add_pattern ("*");
|
||||
|
||||
keyboardmap1fcbutton_->add_filter (kmapfilter);
|
||||
keyboardmap1fcbutton_->add_filter (allfilter);
|
||||
keyboardmap1fcbutton_->set_filter (kmapfilter);
|
||||
keyboardmap2fcbutton_->add_filter (kmapfilter);
|
||||
keyboardmap2fcbutton_->add_filter (allfilter);
|
||||
keyboardmap2fcbutton_->set_filter (kmapfilter);
|
||||
|
||||
keyboardmapcheck_->signal_toggled().connect(
|
||||
sigc::mem_fun(*this, &GPreferences::keyboard_sensitivity));
|
||||
|
||||
// *** Language ***
|
||||
|
||||
xml_->get_widget("DefaultLanguage", box);
|
||||
box->pack_start (defaultlanguagecombo_);
|
||||
defaultlanguagecombo_.show();
|
||||
xml_->get_widget("LanguagePackage", languagepackageentry_);
|
||||
xml_->get_widget("CommandStart", commandstartentry_);
|
||||
xml_->get_widget("CommandEnd", commandendentry_);
|
||||
xml_->get_widget("UseBabel", usebabelcheck_);
|
||||
xml_->get_widget("MarkForeignLanguages", markforeigncheck_);
|
||||
xml_->get_widget("Global", globalcheck_);
|
||||
xml_->get_widget("RTLSupport", RTLsupportcheck_);
|
||||
xml_->get_widget("AutoBegin", autobegincheck_);
|
||||
xml_->get_widget("AutoEnd", autoendcheck_);
|
||||
|
||||
// Store the lang identifiers for later
|
||||
vector<LanguagePair> const langs = getLanguageData(false);
|
||||
lang_ = getSecond(langs);
|
||||
|
||||
vector<LanguagePair>::const_iterator lit = langs.begin();
|
||||
vector<LanguagePair>::const_iterator const lend = langs.end();
|
||||
for (; lit != lend; ++lit) {
|
||||
defaultlanguagecombo_.append_text(lit->first);
|
||||
}
|
||||
|
||||
// *** Spellchecker ***
|
||||
xml_->get_widget("Spellchecker", box);
|
||||
box->pack_start(spellcheckercombo_);
|
||||
spellcheckercombo_.show();
|
||||
xml_->get_widget("AlternativeLanguage", alternativelanguageentry_);
|
||||
xml_->get_widget("EscapeCharacters", escapecharactersentry_);
|
||||
xml_->get_widget("PersonalDictionary", personaldictionaryfcbutton_);
|
||||
xml_->get_widget("AcceptCompoundWords", acceptcompoundcheck_);
|
||||
xml_->get_widget("UseInputEncoding", useinputenccheck_);
|
||||
|
||||
Gtk::FileFilter ispellfilter;
|
||||
ispellfilter.set_name ("iSpell Dictionary Files");
|
||||
ispellfilter.add_pattern ("*.ispell");
|
||||
|
||||
personaldictionaryfcbutton_->add_filter (ispellfilter);
|
||||
personaldictionaryfcbutton_->add_filter (allfilter);
|
||||
personaldictionaryfcbutton_->set_filter (ispellfilter);
|
||||
|
||||
spellcheckercombo_.append_text ("ispell");
|
||||
spellcheckercombo_.append_text ("aspell");
|
||||
spellcheckercombo_.append_text ("hspell");
|
||||
#ifdef USE_PSPELL
|
||||
spellcheckercombo_.append_text(lyx::to_utf8(_("pspell (library)")));
|
||||
#else
|
||||
#ifdef USE_ASPELL
|
||||
spellcheckercombo_.append_text(lyx::to_utf8(_("aspell (library)")));
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
void GPreferences::update()
|
||||
{
|
||||
LyXRC const & rc(controller().rc());
|
||||
|
||||
std::cerr << ">> update\n";
|
||||
|
||||
// *** Screen fonts ***
|
||||
Glib::ustring gtk_roman_font_name = rc.roman_font_name + ", 12";
|
||||
std::cerr << "Rc's roman_font_name is '" << rc.roman_font_name << "'\n";
|
||||
std::cerr << "Our roman_font_name is '" << gtk_roman_font_name << "'\n";
|
||||
romanfontbutton_->set_font_name(gtk_roman_font_name);
|
||||
Glib::ustring gtk_sans_font_name = rc.sans_font_name + ", 12";
|
||||
sansseriffontbutton_->set_font_name(gtk_sans_font_name);
|
||||
Glib::ustring gtk_typewriter_font_name = rc.typewriter_font_name + ", 12";
|
||||
typewriterfontbutton_->set_font_name(gtk_typewriter_font_name);
|
||||
|
||||
zoomadj_->set_value (rc.zoom);
|
||||
dpiadj_->set_value (rc.dpi);
|
||||
|
||||
// *** Graphics ***
|
||||
switch (rc.display_graphics) {
|
||||
case graphics::NoDisplay:
|
||||
graphicsnoneradio_->set_active();
|
||||
break;
|
||||
case graphics::MonochromeDisplay:
|
||||
graphicsmonoradio_->set_active();
|
||||
break;
|
||||
case graphics::GrayscaleDisplay:
|
||||
graphicsgrayscaleradio_->set_active();
|
||||
break;
|
||||
default:
|
||||
case graphics::ColorDisplay:
|
||||
graphicscolorradio_->set_active();
|
||||
break;
|
||||
}
|
||||
|
||||
switch (rc.preview) {
|
||||
case LyXRC::PREVIEW_ON:
|
||||
instprevonradio_->set_active();
|
||||
break;
|
||||
case LyXRC::PREVIEW_NO_MATH:
|
||||
instprevnomathradio_->set_active();
|
||||
break;
|
||||
default:
|
||||
case LyXRC::PREVIEW_OFF:
|
||||
instprevoffradio_->set_active();
|
||||
break;
|
||||
}
|
||||
|
||||
// *** Keyboard ***
|
||||
keyboardmapcheck_->set_active (rc.use_kbmap);
|
||||
keyboardmap1fcbutton_->set_filename (rc.primary_kbmap);
|
||||
keyboardmap2fcbutton_->set_filename (rc.secondary_kbmap);
|
||||
keyboardmap1fcbutton_->set_sensitive (rc.use_kbmap);
|
||||
keyboardmap2fcbutton_->set_sensitive (rc.use_kbmap);
|
||||
|
||||
// *** Language ***
|
||||
int const pos = int(findPos(lang_, rc.default_language));
|
||||
defaultlanguagecombo_.set_active(pos);
|
||||
|
||||
languagepackageentry_->set_text(rc.language_package);
|
||||
commandstartentry_->set_text(rc.language_command_begin);
|
||||
commandendentry_->set_text(rc.language_command_end);
|
||||
|
||||
usebabelcheck_->set_active(rc.language_use_babel);
|
||||
markforeigncheck_->set_active(rc.mark_foreign_language);
|
||||
globalcheck_->set_active(rc.language_global_options);
|
||||
RTLsupportcheck_->set_active(rc.rtl_support);
|
||||
autobegincheck_->set_active(rc.language_auto_begin);
|
||||
autoendcheck_->set_active(rc.language_auto_end);
|
||||
|
||||
// *** Spellchecker ***
|
||||
spellcheckercombo_.set_active (0);
|
||||
|
||||
if (rc.isp_command == "ispell") {
|
||||
spellcheckercombo_.set_active (0);
|
||||
} else if (rc.isp_command == "aspell") {
|
||||
spellcheckercombo_.set_active (1);
|
||||
} else if (rc.isp_command == "hspell") {
|
||||
spellcheckercombo_.set_active (2);
|
||||
}
|
||||
|
||||
if (rc.use_spell_lib) {
|
||||
#if defined(USE_ASPELL) || defined(USE_PSPELL)
|
||||
spellcheckercombo_.set_active (3);
|
||||
#endif
|
||||
}
|
||||
|
||||
// FIXME: remove isp_use_alt_lang
|
||||
alternativelanguageentry_->set_text(rc.isp_alt_lang);
|
||||
// FIXME: remove isp_use_esc_chars
|
||||
escapecharactersentry_->set_text(rc.isp_esc_chars);
|
||||
// FIXME: remove isp_use_pers_dict
|
||||
personaldictionaryfcbutton_->set_filename(rc.isp_pers_dict);
|
||||
acceptcompoundcheck_->set_active(rc.isp_accept_compound);
|
||||
useinputenccheck_->set_active(rc.isp_use_input_encoding);
|
||||
|
||||
bc().valid();
|
||||
}
|
||||
|
||||
|
||||
void GPreferences::apply()
|
||||
{
|
||||
LyXRC & rc(controller().rc());
|
||||
|
||||
// *** Screen fonts ***
|
||||
LyXRC const oldrc(rc);
|
||||
|
||||
rc.roman_font_name = Pango::FontDescription(
|
||||
romanfontbutton_->get_font_name()).get_family ();
|
||||
std::cerr << "Button's font_name is '" << romanfontbutton_->get_font_name() << "'\n";
|
||||
std::cerr << "Setting font name to :\n";
|
||||
std::cerr << "\t'" << Pango::FontDescription(
|
||||
romanfontbutton_->get_font_name()).get_family () << "'\n";
|
||||
rc.roman_font_foundry = "";
|
||||
rc.sans_font_name = Pango::FontDescription(
|
||||
sansseriffontbutton_->get_font_name()).get_family ();
|
||||
rc.sans_font_foundry = "";
|
||||
rc.typewriter_font_name = Pango::FontDescription(
|
||||
typewriterfontbutton_->get_font_name()).get_family ();
|
||||
rc.typewriter_font_foundry = "";
|
||||
|
||||
rc.zoom = static_cast<int>(zoomadj_->get_value());
|
||||
rc.dpi = static_cast<int>(dpiadj_->get_value());
|
||||
|
||||
if (rc.font_sizes != oldrc.font_sizes
|
||||
|| rc.roman_font_name != oldrc.roman_font_name
|
||||
|| rc.sans_font_name != oldrc.sans_font_name
|
||||
|| rc.typewriter_font_name != oldrc.typewriter_font_name
|
||||
|| rc.zoom != oldrc.zoom || rc.dpi != oldrc.dpi) {
|
||||
controller().updateScreenFonts();
|
||||
}
|
||||
|
||||
// *** Graphics ***
|
||||
if (graphicsnoneradio_->get_active())
|
||||
rc.display_graphics = graphics::NoDisplay;
|
||||
else if (graphicsgrayscaleradio_->get_active())
|
||||
rc.display_graphics = graphics::GrayscaleDisplay;
|
||||
else if (graphicsmonoradio_->get_active())
|
||||
rc.display_graphics = graphics::MonochromeDisplay;
|
||||
else
|
||||
rc.display_graphics = graphics::ColorDisplay;
|
||||
|
||||
if (instprevonradio_->get_active())
|
||||
rc.preview = LyXRC::PREVIEW_ON;
|
||||
else if (instprevnomathradio_->get_active())
|
||||
rc.preview = LyXRC::PREVIEW_NO_MATH;
|
||||
else
|
||||
rc.preview = LyXRC::PREVIEW_OFF;
|
||||
|
||||
// *** Keyboard ***
|
||||
rc.use_kbmap = keyboardmapcheck_->get_active();
|
||||
if (rc.use_kbmap) {
|
||||
rc.primary_kbmap = keyboardmap1fcbutton_->get_filename();
|
||||
rc.secondary_kbmap = keyboardmap2fcbutton_->get_filename();
|
||||
}
|
||||
|
||||
// *** Language ***
|
||||
rc.default_language = lang_[
|
||||
defaultlanguagecombo_.get_active_row_number()];
|
||||
|
||||
rc.language_package = languagepackageentry_->get_text();
|
||||
rc.language_command_begin = commandstartentry_->get_text();
|
||||
rc.language_command_end = commandendentry_->get_text();
|
||||
|
||||
rc.language_use_babel = usebabelcheck_->get_active();
|
||||
rc.mark_foreign_language = markforeigncheck_->get_active();
|
||||
rc.language_global_options = globalcheck_->get_active();
|
||||
rc.rtl_support = RTLsupportcheck_->get_active();
|
||||
rc.language_auto_begin = autobegincheck_->get_active();
|
||||
rc.language_auto_end = autoendcheck_->get_active();
|
||||
|
||||
// *** Spellchecker ***
|
||||
switch (spellcheckercombo_.get_active_row_number()) {
|
||||
case 0:
|
||||
case 1:
|
||||
case 2:
|
||||
rc.use_spell_lib = false;
|
||||
rc.isp_command = spellcheckercombo_.get_active_text();
|
||||
break;
|
||||
case 3:
|
||||
rc.use_spell_lib = true;
|
||||
break;
|
||||
}
|
||||
|
||||
// FIXME: remove isp_use_alt_lang
|
||||
rc.isp_alt_lang = alternativelanguageentry_->get_text();
|
||||
rc.isp_use_alt_lang = !rc.isp_alt_lang.empty();
|
||||
// FIXME: remove isp_use_esc_chars
|
||||
rc.isp_esc_chars = escapecharactersentry_->get_text();
|
||||
rc.isp_use_esc_chars = !rc.isp_esc_chars.empty();
|
||||
// FIXME: remove isp_use_pers_dict
|
||||
rc.isp_pers_dict = personaldictionaryfcbutton_->get_filename();
|
||||
rc.isp_use_pers_dict = !rc.isp_pers_dict.empty();
|
||||
rc.isp_accept_compound = acceptcompoundcheck_->get_active();
|
||||
rc.isp_use_input_encoding = useinputenccheck_->get_active();
|
||||
|
||||
// Prevent Apply button ever getting disabled
|
||||
bc().valid();
|
||||
}
|
||||
|
||||
|
||||
void GPreferences::keyboard_sensitivity ()
|
||||
{
|
||||
bool const kbmap = keyboardmapcheck_->get_active();
|
||||
keyboardmap1fcbutton_->set_sensitive(kbmap);
|
||||
keyboardmap2fcbutton_->set_sensitive(kbmap);
|
||||
}
|
||||
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
@ -1,87 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file GPreferences.h
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author John Spray
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#ifndef GPREFERENCES_H
|
||||
#define GPREFERENCES_H
|
||||
|
||||
#include "GViewBase.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
class ControlPrefs;
|
||||
|
||||
/** This class provides a GTK+ implementation of the Preferences Dialog.
|
||||
*/
|
||||
class GPreferences : public GViewCB<ControlPrefs, GViewGladeB> {
|
||||
public:
|
||||
GPreferences(Dialog & parent);
|
||||
private:
|
||||
virtual void apply();
|
||||
virtual void doBuild();
|
||||
virtual void update();
|
||||
|
||||
// >>> Font tab
|
||||
Gtk::FontButton *romanfontbutton_;
|
||||
Gtk::FontButton *sansseriffontbutton_;
|
||||
Gtk::FontButton *typewriterfontbutton_;
|
||||
Gtk::Adjustment *dpiadj_;
|
||||
Gtk::Adjustment *zoomadj_;
|
||||
// <<< Font tab
|
||||
|
||||
// >>> Graphics tab
|
||||
Gtk::RadioButton *graphicscolorradio_;
|
||||
Gtk::RadioButton *graphicsgrayscaleradio_;
|
||||
Gtk::RadioButton *graphicsmonoradio_;
|
||||
Gtk::RadioButton *graphicsnoneradio_;
|
||||
|
||||
Gtk::RadioButton *instprevonradio_;
|
||||
Gtk::RadioButton *instprevoffradio_;
|
||||
Gtk::RadioButton *instprevnomathradio_;
|
||||
// <<< Graphics tab
|
||||
|
||||
// >>> Keyboard tab
|
||||
void keyboard_sensitivity ();
|
||||
Gtk::CheckButton *keyboardmapcheck_;
|
||||
Gtk::FileChooserButton *keyboardmap1fcbutton_;
|
||||
Gtk::FileChooserButton *keyboardmap2fcbutton_;
|
||||
// <<< Keyboard tab
|
||||
|
||||
// >>> Language tab
|
||||
std::vector<std::string> lang_;
|
||||
Gtk::ComboBoxText defaultlanguagecombo_;
|
||||
Gtk::Entry *languagepackageentry_;
|
||||
Gtk::Entry *commandstartentry_;
|
||||
Gtk::Entry *commandendentry_;
|
||||
Gtk::CheckButton *usebabelcheck_;
|
||||
Gtk::CheckButton *markforeigncheck_;
|
||||
Gtk::CheckButton *globalcheck_;
|
||||
Gtk::CheckButton *RTLsupportcheck_;
|
||||
Gtk::CheckButton *autobegincheck_;
|
||||
Gtk::CheckButton *autoendcheck_;
|
||||
// <<< Language tab
|
||||
|
||||
// >>> Spellchecker tab
|
||||
Gtk::ComboBoxText spellcheckercombo_;
|
||||
Gtk::Entry *alternativelanguageentry_;
|
||||
Gtk::Entry *escapecharactersentry_;
|
||||
Gtk::FileChooserButton *personaldictionaryfcbutton_;
|
||||
Gtk::CheckButton *acceptcompoundcheck_;
|
||||
Gtk::CheckButton *useinputenccheck_;
|
||||
// <<< Spellchecker tab
|
||||
};
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#endif // GPREFERENCES_H
|
@ -1,187 +0,0 @@
|
||||
/**
|
||||
* \file GPrint.C
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Huang Ying
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
// Too hard to make concept checks work with this file
|
||||
#ifdef _GLIBCXX_CONCEPT_CHECKS
|
||||
#undef _GLIBCXX_CONCEPT_CHECKS
|
||||
#endif
|
||||
#ifdef _GLIBCPP_CONCEPT_CHECKS
|
||||
#undef _GLIBCPP_CONCEPT_CHECKS
|
||||
#endif
|
||||
|
||||
#include "GPrint.h"
|
||||
#include "ControlPrint.h"
|
||||
#include "ghelpers.h"
|
||||
|
||||
#include "PrinterParams.h"
|
||||
|
||||
#include "support/convert.h"
|
||||
#include "support/lstrings.h"
|
||||
|
||||
#include <libglademm.h>
|
||||
|
||||
using lyx::docstring;
|
||||
|
||||
using std::string;
|
||||
using namespace lyx::support;
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
GPrint::GPrint(Dialog & parent, docstring const & title)
|
||||
: GViewCB<ControlPrint, GViewGladeB>(parent, title, false)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void GPrint::apply()
|
||||
{
|
||||
PrinterParams pp;
|
||||
pp.target = printer_->get_active() ? PrinterParams::PRINTER : PrinterParams::FILE;
|
||||
pp.printer_name = printerEntry_->get_text();
|
||||
pp.file_name = fileEntry_->get_text();
|
||||
pp.all_pages = all_->get_active();
|
||||
pp.from_page = pp.to_page = 0;
|
||||
if (!fromEntry_->get_text().empty()) {
|
||||
pp.from_page = convert<int, string>(fromEntry_->get_text());
|
||||
if (!toEntry_->get_text().empty())
|
||||
pp.to_page = convert<int, string>(toEntry_->get_text());
|
||||
}
|
||||
pp.odd_pages = odd_->get_active();
|
||||
pp.even_pages = even_->get_active();
|
||||
pp.count_copies = number_->get_value_as_int();
|
||||
pp.sorted_copies = sorted_->get_active();
|
||||
pp.reverse_order = reverse_->get_active();
|
||||
controller().params() = pp;
|
||||
}
|
||||
|
||||
|
||||
void GPrint::update()
|
||||
{
|
||||
PrinterParams & pp = controller().params();
|
||||
printer_->set_active(pp.target == PrinterParams::PRINTER);
|
||||
printerEntry_->set_text(pp.printer_name);
|
||||
fileEntry_->set_text(pp.file_name);
|
||||
all_->set_active(pp.all_pages);
|
||||
|
||||
string const from = ( pp.from_page ? convert<string>(pp.from_page) : string() );
|
||||
string const to = ( pp.to_page ? convert<string>(pp.to_page) : string() );
|
||||
fromEntry_->set_text(from);
|
||||
toEntry_->set_text(to);
|
||||
odd_->set_active(pp.odd_pages);
|
||||
even_->set_active(pp.even_pages);
|
||||
reverse_->set_active(pp.reverse_order);
|
||||
sorted_->set_active(pp.sorted_copies);
|
||||
number_->set_value(pp.count_copies);
|
||||
bool const enable_counter = pp.target == PrinterParams::PRINTER;
|
||||
number_->set_sensitive(enable_counter);
|
||||
sorted_->set_sensitive(enable_counter && pp.count_copies > 1);
|
||||
}
|
||||
|
||||
|
||||
void GPrint::updateUI()
|
||||
{
|
||||
ButtonPolicy::SMInput activate = ButtonPolicy::SMI_VALID;
|
||||
// disable OK/Apply buttons when file output is selected, but no file name entered
|
||||
if (file_->get_active() && fileEntry_->get_text().empty())
|
||||
activate = ButtonPolicy::SMI_INVALID;
|
||||
// check 'from' and 'to' fields only when 'from/to' radio button is selected
|
||||
if (fromTo_->get_active()) {
|
||||
string from = fromEntry_->get_text();
|
||||
string to = toEntry_->get_text();
|
||||
if (from.empty() || (!to.empty() && convert<int>(from) > convert<int>(to)))
|
||||
activate = ButtonPolicy::SMI_INVALID;
|
||||
}
|
||||
bool const enableCounter = printer_->get_active();
|
||||
number_->set_sensitive(enableCounter);
|
||||
bool const enableSorted = enableCounter && number_->get_value_as_int() > 1;
|
||||
sorted_->set_sensitive(enableSorted);
|
||||
bc().input(activate);
|
||||
}
|
||||
|
||||
|
||||
void GPrint::onBrowse()
|
||||
{
|
||||
string const inName = fileEntry_->get_text();
|
||||
string const outName = lyx::to_utf8(controller().browse(lyx::from_utf8(inName)));
|
||||
if (outName != inName && !outName.empty())
|
||||
fileEntry_->set_text(outName);
|
||||
if (!outName.empty())
|
||||
file_->set_active(true);
|
||||
updateUI();
|
||||
}
|
||||
|
||||
|
||||
void GPrint::onTargetEdit(Gtk::Entry const * who)
|
||||
{
|
||||
if (who == fileEntry_)
|
||||
file_->set_active(true);
|
||||
else if (who == printerEntry_)
|
||||
printer_->set_active(true);
|
||||
updateUI();
|
||||
}
|
||||
|
||||
|
||||
void GPrint::onFromToEdit()
|
||||
{
|
||||
fromTo_->set_active(true);
|
||||
updateUI();
|
||||
}
|
||||
|
||||
|
||||
void GPrint::doBuild()
|
||||
{
|
||||
string const gladeName = findGladeFile("print");
|
||||
xml_ = Gnome::Glade::Xml::create(gladeName);
|
||||
xml_->get_widget("Printer", printer_);
|
||||
xml_->get_widget("File", file_);
|
||||
xml_->get_widget("All", all_);
|
||||
xml_->get_widget("FromTo", fromTo_);
|
||||
xml_->get_widget("Odd", odd_);
|
||||
xml_->get_widget("Even", even_);
|
||||
xml_->get_widget("Reverse", reverse_);
|
||||
xml_->get_widget("Number", number_);
|
||||
xml_->get_widget("Collate", sorted_);
|
||||
xml_->get_widget("FromEntry", fromEntry_);
|
||||
xml_->get_widget("ToEntry", toEntry_);
|
||||
xml_->get_widget("PrinterEntry", printerEntry_);
|
||||
xml_->get_widget("FileEntry", fileEntry_);
|
||||
|
||||
Gtk::Button * ok;
|
||||
Gtk::Button * cancel;
|
||||
xml_->get_widget("PrintButton", ok);
|
||||
xml_->get_widget("CancelButton", cancel);
|
||||
|
||||
setOK(ok);
|
||||
setCancel(cancel);
|
||||
|
||||
Gtk::Button * browse;
|
||||
xml_->get_widget("Browse", browse);
|
||||
browse->signal_clicked().connect(sigc::mem_fun(*this, &GPrint::onBrowse));
|
||||
|
||||
fileEntry_->signal_changed().connect(sigc::bind(sigc::mem_fun(*this, &GPrint::onTargetEdit), fileEntry_));
|
||||
printerEntry_->signal_changed().connect(sigc::bind(sigc::mem_fun(*this, &GPrint::onTargetEdit), printerEntry_));
|
||||
fromEntry_->signal_changed().connect(sigc::mem_fun(*this, &GPrint::onFromToEdit));
|
||||
toEntry_->signal_changed().connect(sigc::mem_fun(*this, &GPrint::onFromToEdit));
|
||||
printer_->signal_toggled().connect(sigc::mem_fun(*this, &GPrint::updateUI));
|
||||
file_->signal_toggled().connect(sigc::mem_fun(*this, &GPrint::updateUI));
|
||||
all_->signal_toggled().connect(sigc::mem_fun(*this, &GPrint::updateUI));
|
||||
fromTo_->signal_toggled().connect(sigc::mem_fun(*this, &GPrint::updateUI));
|
||||
number_->signal_changed().connect(sigc::mem_fun(*this, &GPrint::updateUI));
|
||||
|
||||
controller().initialiseParams("");
|
||||
update();
|
||||
updateUI();
|
||||
}
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
@ -1,52 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file GPrint.h
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Huang Ying
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#ifndef GPRINT_H
|
||||
#define GPRINT_H
|
||||
|
||||
#include "GViewBase.h"
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
class ControlPrint;
|
||||
|
||||
class GPrint : public GViewCB<ControlPrint, GViewGladeB> {
|
||||
public:
|
||||
GPrint(Dialog & parent, lyx::docstring const & title = lyx::from_ascii("Print Document"));
|
||||
private:
|
||||
virtual void apply();
|
||||
virtual void update();
|
||||
virtual void doBuild();
|
||||
void updateUI();
|
||||
void onBrowse();
|
||||
void onTargetEdit(Gtk::Entry const * who);
|
||||
void onFromToEdit();
|
||||
|
||||
Gtk::RadioButton * printer_;
|
||||
Gtk::RadioButton * file_;
|
||||
Gtk::RadioButton * all_;
|
||||
Gtk::RadioButton * fromTo_;
|
||||
Gtk::CheckButton * odd_;
|
||||
Gtk::CheckButton * even_;
|
||||
Gtk::CheckButton * reverse_;
|
||||
Gtk::SpinButton * number_;
|
||||
Gtk::CheckButton * sorted_;
|
||||
Gtk::Entry * printerEntry_;
|
||||
Gtk::Entry * fileEntry_;
|
||||
Gtk::Entry * fromEntry_;
|
||||
Gtk::Entry * toEntry_;
|
||||
};
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#endif
|
@ -1,264 +0,0 @@
|
||||
/**
|
||||
* \file GRef.C
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author John Spray
|
||||
* \author Andreas Klostermann
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
// Too hard to make concept checks work with this file
|
||||
#ifdef _GLIBCXX_CONCEPT_CHECKS
|
||||
#undef _GLIBCXX_CONCEPT_CHECKS
|
||||
#endif
|
||||
#ifdef _GLIBCPP_CONCEPT_CHECKS
|
||||
#undef _GLIBCPP_CONCEPT_CHECKS
|
||||
#endif
|
||||
|
||||
#include "GRef.h"
|
||||
#include "ControlRef.h"
|
||||
#include "ghelpers.h"
|
||||
#include "insets/insetref.h"
|
||||
#include "debug.h"
|
||||
#include "buffer.h"
|
||||
#include "insets/insetnote.h"
|
||||
|
||||
#include <libglademm.h>
|
||||
|
||||
using lyx::docstring;
|
||||
|
||||
using std::string;
|
||||
using std::vector;
|
||||
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
class refModelColumns : public Gtk::TreeModel::ColumnRecord
|
||||
{
|
||||
public:
|
||||
|
||||
refModelColumns()
|
||||
{ add(name);}
|
||||
|
||||
Gtk::TreeModelColumn<Glib::ustring> name;
|
||||
};
|
||||
|
||||
refModelColumns refColumns;
|
||||
|
||||
|
||||
class bufferModelColumns : public Gtk::TreeModel::ColumnRecord
|
||||
{
|
||||
public:
|
||||
|
||||
bufferModelColumns()
|
||||
{ add(name);}
|
||||
|
||||
Gtk::TreeModelColumn<Glib::ustring> name;
|
||||
};
|
||||
|
||||
bufferModelColumns bufferColumns;
|
||||
|
||||
|
||||
GRef::GRef(Dialog & parent)
|
||||
: GViewCB<ControlRef, GViewGladeB>(parent, _("Cross-reference"), false)
|
||||
{}
|
||||
|
||||
|
||||
void GRef::doBuild()
|
||||
{
|
||||
string const gladeName = findGladeFile("ref");
|
||||
xml_ = Gnome::Glade::Xml::create(gladeName);
|
||||
xml_->get_widget("Cancel", cancelbutton_);
|
||||
setCancel(cancelbutton_);
|
||||
xml_->get_widget("Apply", applybutton_);
|
||||
setApply(applybutton_);
|
||||
xml_->get_widget("OK", okbutton_);
|
||||
setOK(okbutton_);
|
||||
|
||||
xml_->get_widget("Labels", refview_);
|
||||
xml_->get_widget("Label", labelentry_);
|
||||
xml_->get_widget("Name", nameentry_);
|
||||
xml_->get_widget("Format", formatcombo_);
|
||||
xml_->get_widget("Buffer", buffercombo_ );
|
||||
xml_->get_widget("JumpTo", jumptobutton_);
|
||||
xml_->get_widget("Back", backbutton_);
|
||||
xml_->get_widget("Refresh", refreshbutton_);
|
||||
|
||||
refview_->append_column(lyx::to_utf8(_("Label")), refColumns.name);
|
||||
|
||||
buffercombo_->signal_changed().connect(
|
||||
sigc::mem_fun(*this, &GRef::buffer_changed));
|
||||
refview_->signal_cursor_changed().connect(
|
||||
sigc::mem_fun(*this, &GRef::selection_changed));
|
||||
refview_->signal_row_activated().connect(
|
||||
sigc::mem_fun(*this, &GRef::refview_activated));
|
||||
jumptobutton_->signal_clicked().connect(
|
||||
sigc::mem_fun(*this, &GRef::jumpto));
|
||||
backbutton_->signal_clicked().connect(
|
||||
sigc::mem_fun(*this, &GRef::back));
|
||||
refreshbutton_->signal_clicked().connect(
|
||||
sigc::mem_fun(*this, &GRef::update_labels));
|
||||
|
||||
labelentry_->signal_changed().connect(
|
||||
sigc::mem_fun(*this, &GRef::update_validity));
|
||||
formatcombo_->signal_changed().connect(
|
||||
sigc::mem_fun(*this, &GRef::update_validity));
|
||||
nameentry_->signal_changed().connect(
|
||||
sigc::mem_fun(*this, &GRef::update_validity));
|
||||
|
||||
applylock_ = false;
|
||||
bc().valid(false);
|
||||
}
|
||||
|
||||
|
||||
void GRef::selection_changed ()
|
||||
{
|
||||
if (applylock_)
|
||||
return;
|
||||
|
||||
Gtk::TreeModel::iterator iter = refview_->get_selection()->get_selected();
|
||||
if(iter) {
|
||||
Gtk::TreeModel::Row row = *iter;
|
||||
labelentry_->set_text(row[refColumns.name]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void GRef::jumpto()
|
||||
{
|
||||
|
||||
if (backbutton_->is_sensitive()) {
|
||||
// controller().gotoAnotherRef(labelentry_->get_text());
|
||||
// OR
|
||||
// kernel().dispatch(FuncRequest(LFUN_LABEL_GOTO, ref));
|
||||
// OR
|
||||
controller().gotoBookmark();
|
||||
controller().gotoRef(labelentry_->get_text());
|
||||
} else {
|
||||
controller().gotoRef(labelentry_->get_text());
|
||||
}
|
||||
backbutton_->set_sensitive(true);
|
||||
}
|
||||
|
||||
|
||||
void GRef::back()
|
||||
{
|
||||
controller().gotoBookmark();
|
||||
backbutton_->set_sensitive(false);
|
||||
jumptobutton_->set_sensitive(true);
|
||||
}
|
||||
|
||||
|
||||
void GRef::buffer_changed()
|
||||
{
|
||||
if (applylock_)
|
||||
return;
|
||||
update_labels();
|
||||
}
|
||||
|
||||
|
||||
void GRef::update()
|
||||
{
|
||||
applylock_ = true;
|
||||
|
||||
bc().refreshReadOnly();
|
||||
jumptobutton_->set_sensitive(true);
|
||||
backbutton_->set_sensitive(false);
|
||||
labelentry_->set_text(lyx::to_utf8(controller().params()["reference"]));
|
||||
nameentry_->set_text(lyx::to_utf8(controller().params()["name"]));
|
||||
|
||||
// Name is irrelevant to LaTeX/Literate documents
|
||||
Kernel::DocType doctype = kernel().docType();
|
||||
if (doctype == Kernel::LATEX || doctype == Kernel::LITERATE) {
|
||||
nameentry_->set_sensitive(false);
|
||||
} else {
|
||||
nameentry_->set_sensitive(true);
|
||||
}
|
||||
|
||||
// Format is irrelevant to DocBook.
|
||||
if (doctype == Kernel::DOCBOOK) {
|
||||
formatcombo_->set_active(0);
|
||||
formatcombo_->set_sensitive(false);
|
||||
|
||||
} else {
|
||||
formatcombo_->set_active(InsetRef::getType(controller().params().getCmdName()));
|
||||
formatcombo_->set_sensitive(true);
|
||||
}
|
||||
|
||||
bufferstore_ = Gtk::ListStore::create(bufferColumns);
|
||||
vector<string> const buffers = controller().getBufferList();
|
||||
buffercombo_->set_model(bufferstore_);
|
||||
|
||||
vector<string>::const_iterator it = buffers.begin();
|
||||
vector<string>::const_iterator const end = buffers.end();
|
||||
for (; it != end; ++it) {
|
||||
Gtk::TreeModel::iterator iter = bufferstore_->append();
|
||||
(*iter)[bufferColumns.name] = *it;
|
||||
}
|
||||
|
||||
buffercombo_->set_active(controller().getBufferNum());
|
||||
|
||||
update_labels();
|
||||
applylock_ = false;
|
||||
bc().valid(false);
|
||||
}
|
||||
|
||||
|
||||
void GRef::update_labels()
|
||||
{
|
||||
int buffernum = buffercombo_->get_active_row_number();
|
||||
if (buffernum < 0)
|
||||
buffernum=0;
|
||||
|
||||
string const name = controller().getBufferName(buffernum);
|
||||
vector<docstring> keys = controller().getLabelList(name);
|
||||
refListStore_ = Gtk::ListStore::create(refColumns);
|
||||
|
||||
if (!keys.empty()) {
|
||||
vector<docstring>::const_iterator it = keys.begin();
|
||||
vector<docstring>::const_iterator end = keys.end();
|
||||
for (;it != keys.end(); ++it) {
|
||||
Gtk::TreeModel::iterator iter =refListStore_->append();
|
||||
(*iter)[refColumns.name] = lyx::to_utf8(*it);
|
||||
}
|
||||
refview_->set_sensitive(true);
|
||||
} else {
|
||||
Gtk::TreeModel::iterator iter =refListStore_->append();
|
||||
(*iter)[refColumns.name] = lyx::to_utf8(_("No labels found."));
|
||||
refview_->set_sensitive(false);
|
||||
}
|
||||
refview_->set_model(refListStore_);
|
||||
}
|
||||
|
||||
|
||||
void GRef::apply()
|
||||
{
|
||||
if (applylock_)
|
||||
return;
|
||||
|
||||
controller().params()["reference"] = lyx::from_utf8(labelentry_->get_text());
|
||||
controller().params()["name"] = lyx::from_utf8(nameentry_->get_text());
|
||||
int const type = formatcombo_->get_active_row_number();
|
||||
controller().params().setCmdName(InsetRef::getName(type));
|
||||
}
|
||||
|
||||
|
||||
void GRef::update_validity()
|
||||
{
|
||||
bc().valid(!labelentry_->get_text().empty());
|
||||
}
|
||||
|
||||
|
||||
void GRef::refview_activated(const Gtk::TreeModel::Path&, Gtk::TreeViewColumn*)
|
||||
{
|
||||
if (!labelentry_->get_text().empty())
|
||||
okbutton_->clicked();
|
||||
}
|
||||
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
@ -1,62 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file GRef.h
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author John Spray
|
||||
* \author Andreas Klostermann
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#ifndef GREF_H
|
||||
#define GREF_H
|
||||
|
||||
#include "GViewBase.h"
|
||||
#include <string>
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
class ControlRef;
|
||||
|
||||
/** This class provides a GTK+ implementation of the Note Dialog.
|
||||
*/
|
||||
class GRef : public GViewCB<ControlRef, GViewGladeB> {
|
||||
public:
|
||||
GRef(Dialog & parent);
|
||||
private:
|
||||
virtual void apply();
|
||||
virtual void doBuild();
|
||||
virtual void update();
|
||||
virtual void update_labels();
|
||||
// Signal callbacks
|
||||
void selection_changed ();
|
||||
void buffer_changed();
|
||||
void update_validity();
|
||||
void jumpto();
|
||||
void back();
|
||||
void refview_activated(const Gtk::TreeModel::Path&, Gtk::TreeViewColumn*);
|
||||
// apply() won't act when this is true
|
||||
bool applylock_;
|
||||
std::string lastbuffer_;
|
||||
Gtk::Entry * labelentry_;
|
||||
Gtk::Entry * nameentry_;
|
||||
Gtk::TreeView * refview_;
|
||||
Glib::RefPtr<Gtk::ListStore> refListStore_;
|
||||
Glib::RefPtr<Gtk::ListStore> bufferstore_;
|
||||
Gtk::ComboBox * formatcombo_;
|
||||
Gtk::ComboBox * buffercombo_;
|
||||
Gtk::Button * jumptobutton_;
|
||||
Gtk::Button * backbutton_;
|
||||
Gtk::Button * cancelbutton_;
|
||||
Gtk::Button * okbutton_;
|
||||
Gtk::Button * applybutton_;
|
||||
Gtk::Button * refreshbutton_;
|
||||
|
||||
};
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#endif // GREF_H
|
@ -1,152 +0,0 @@
|
||||
/**
|
||||
* \file GScreen.C
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Huang Ying
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
// Too hard to make concept checks work with this file
|
||||
#ifdef _GLIBCXX_CONCEPT_CHECKS
|
||||
#undef _GLIBCXX_CONCEPT_CHECKS
|
||||
#endif
|
||||
#ifdef _GLIBCPP_CONCEPT_CHECKS
|
||||
#undef _GLIBCPP_CONCEPT_CHECKS
|
||||
#endif
|
||||
|
||||
#include "GScreen.h"
|
||||
|
||||
#include "GWorkArea.h"
|
||||
|
||||
#include "buffer.h"
|
||||
#include "BufferView.h"
|
||||
#include "debug.h"
|
||||
#include "language.h"
|
||||
#include "LColor.h"
|
||||
#include "lyxtext.h"
|
||||
#include "lyxrow.h"
|
||||
|
||||
#include "frontends/Painter.h"
|
||||
|
||||
#include "insets/insettext.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
// FIXME: defined in X.h, spuriously pulled in by some gui headers
|
||||
#undef CursorShape
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
//using lyx::frontend::CursorShape;
|
||||
|
||||
GScreen::GScreen(GWorkArea & o)
|
||||
: owner_(o)
|
||||
{
|
||||
// the cursor isnt yet visible
|
||||
cursorX_ = 0;
|
||||
cursorY_ = 0;
|
||||
cursorW_ = 0;
|
||||
cursorH_ = 0;
|
||||
}
|
||||
|
||||
|
||||
GScreen::~GScreen()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void GScreen::setCursorColor(Glib::RefPtr<Gdk::GC> gc)
|
||||
{
|
||||
Gdk::Color * clr = owner_.getColorHandler().
|
||||
getGdkColor(LColor::cursor);
|
||||
gc->set_foreground(*clr);
|
||||
}
|
||||
|
||||
|
||||
void GScreen::showCursor(int x, int y, int h, CursorShape shape)
|
||||
{
|
||||
// Update the cursor color.
|
||||
setCursorColor(owner_.getGC());
|
||||
|
||||
cursorX_ = x;
|
||||
cursorY_ = y;
|
||||
cursorH_ = h;
|
||||
|
||||
switch (shape) {
|
||||
case BAR_SHAPE:
|
||||
cursorW_ = 1;
|
||||
break;
|
||||
case L_SHAPE:
|
||||
cursorW_ = cursorH_ / 3;
|
||||
break;
|
||||
case REVERSED_L_SHAPE:
|
||||
cursorW_ = cursorH_ / 3;
|
||||
cursorX_ = x - cursorW_ + 1;
|
||||
break;
|
||||
}
|
||||
|
||||
int fx, fy, fwidth, fheight, fdepth;
|
||||
owner_.getWindow()->get_geometry(fx, fy, fwidth, fheight, fdepth);
|
||||
cursorPixmap_ = Gdk::Pixmap::create(owner_.getWindow(),
|
||||
cursorW_,
|
||||
cursorH_,
|
||||
fdepth);
|
||||
cursorPixmap_->draw_drawable(owner_.getGC(),
|
||||
owner_.getWindow(),
|
||||
owner_.xpos() + cursorX_,
|
||||
owner_.ypos() + cursorY_,
|
||||
0, 0,
|
||||
cursorW_,
|
||||
cursorH_);
|
||||
owner_.getWindow()->draw_line(owner_.getGC(),
|
||||
x + owner_.xpos(),
|
||||
y + owner_.ypos(),
|
||||
x + owner_.xpos(),
|
||||
y + h - 1 + owner_.ypos());
|
||||
switch (shape) {
|
||||
case BAR_SHAPE:
|
||||
break;
|
||||
case L_SHAPE:
|
||||
case REVERSED_L_SHAPE:
|
||||
owner_.getWindow()->draw_line(owner_.getGC(),
|
||||
owner_.xpos() + cursorX_,
|
||||
owner_.ypos() + y + h - 1,
|
||||
owner_.xpos() + cursorX_ + cursorW_ - 1,
|
||||
owner_.xpos() + y + h - 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void GScreen::removeCursor()
|
||||
{
|
||||
if (cursorPixmap_) {
|
||||
owner_.getWindow()->draw_drawable(owner_.getGC(),
|
||||
cursorPixmap_,
|
||||
0, 0,
|
||||
cursorX_ + owner_.xpos(),
|
||||
cursorY_ + owner_.ypos(),
|
||||
cursorW_, cursorH_);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void GScreen::expose(int x, int y, int w, int h)
|
||||
{
|
||||
lyxerr[Debug::GUI] << "expose " << w << 'x' << h
|
||||
<< '+' << x << '+' << y << std::endl;
|
||||
owner_.getWindow()->draw_drawable(owner_.getGC(),
|
||||
owner_.getPixmap(),
|
||||
x, y,
|
||||
x + owner_.xpos(),
|
||||
y + owner_.ypos(),
|
||||
w, h);
|
||||
}
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
@ -1,68 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file GScreen.h
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Huang Ying
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#ifndef GSCREEN_H
|
||||
#define GSCREEN_H
|
||||
|
||||
#include "frontends/WorkArea.h"
|
||||
|
||||
#include <gtkmm.h>
|
||||
|
||||
// FIXME: defined in X.h, spuriously pulled in by some gui headers
|
||||
#undef CursorShape
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
class GWorkArea;
|
||||
|
||||
/** The class GScreen is used for the main Textbody.
|
||||
Concretely, the screen is held in a pixmap. This pixmap is kept up to
|
||||
date and used to optimize drawing on the screen.
|
||||
This class also handles the drawing of the cursor and partly the selection.
|
||||
*/
|
||||
class GScreen {
|
||||
public:
|
||||
///
|
||||
GScreen(GWorkArea &);
|
||||
|
||||
///
|
||||
virtual ~GScreen();
|
||||
|
||||
/// Sets the cursor color to LColor::cursor.
|
||||
virtual void setCursorColor(Glib::RefPtr<Gdk::GC> gc);
|
||||
///
|
||||
virtual void removeCursor();
|
||||
///
|
||||
virtual void showCursor(int x, int y, int h, CursorShape shape);
|
||||
|
||||
/// Copies specified area of pixmap to screen
|
||||
virtual void expose(int x, int y, int w, int h);
|
||||
private:
|
||||
/// our owning widget
|
||||
GWorkArea & owner_;
|
||||
|
||||
///
|
||||
Glib::RefPtr<Gdk::Pixmap> cursorPixmap_;
|
||||
///
|
||||
int cursorX_;
|
||||
///
|
||||
int cursorY_;
|
||||
///
|
||||
int cursorW_;
|
||||
///
|
||||
int cursorH_;
|
||||
};
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#endif
|
@ -1,126 +0,0 @@
|
||||
/**
|
||||
* \file GSearch.C
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author John Spray
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
// Too hard to make concept checks work with this file
|
||||
#ifdef _GLIBCXX_CONCEPT_CHECKS
|
||||
#undef _GLIBCXX_CONCEPT_CHECKS
|
||||
#endif
|
||||
#ifdef _GLIBCPP_CONCEPT_CHECKS
|
||||
#undef _GLIBCPP_CONCEPT_CHECKS
|
||||
#endif
|
||||
|
||||
#include "GSearch.h"
|
||||
#include "ControlSearch.h"
|
||||
#include "ghelpers.h"
|
||||
|
||||
#include <libglademm.h>
|
||||
|
||||
using std::string;
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
typedef GViewCB<ControlSearch, GViewGladeB> base_class;
|
||||
|
||||
|
||||
GSearch::GSearch(Dialog & parent)
|
||||
: base_class(parent, _("Find and Replace"), false)
|
||||
{}
|
||||
|
||||
|
||||
void GSearch::doBuild()
|
||||
{
|
||||
string const gladeName = findGladeFile("search");
|
||||
xml_ = Gnome::Glade::Xml::create(gladeName);
|
||||
|
||||
Gtk::Button * cancelbutton;
|
||||
xml_->get_widget("Cancel", cancelbutton);
|
||||
setCancel(cancelbutton);
|
||||
|
||||
xml_->get_widget("FindNext", findnextbutton);
|
||||
xml_->get_widget("Replace", replacebutton);
|
||||
xml_->get_widget("ReplaceAll", replaceallbutton);
|
||||
xml_->get_widget("FindEntry", findentry);
|
||||
xml_->get_widget("ReplaceEntry", replaceentry);
|
||||
xml_->get_widget("CaseSensitive", casecheck);
|
||||
xml_->get_widget("MatchWord", matchwordcheck);
|
||||
xml_->get_widget("SearchBackwards", backwardscheck);
|
||||
|
||||
findnextbutton->signal_clicked().connect(
|
||||
sigc::mem_fun(*this, &GSearch::onFindNext));
|
||||
replacebutton->signal_clicked().connect(
|
||||
sigc::mem_fun(*this, &GSearch::onReplace));
|
||||
replaceallbutton->signal_clicked().connect(
|
||||
sigc::mem_fun(*this, &GSearch::onReplaceAll));
|
||||
findentry->signal_changed().connect(
|
||||
sigc::mem_fun(*this,&GSearch::onFindEntryChanged));
|
||||
|
||||
bcview().addReadOnly(replaceentry);
|
||||
bcview().addReadOnly(replacebutton);
|
||||
bcview().addReadOnly(replaceallbutton);
|
||||
}
|
||||
|
||||
|
||||
void GSearch::update()
|
||||
{
|
||||
bc().refreshReadOnly();
|
||||
findentry->grab_focus();
|
||||
onFindEntryChanged();
|
||||
}
|
||||
|
||||
|
||||
void GSearch::onFindNext()
|
||||
{
|
||||
controller().find(findentry->get_text(),
|
||||
casecheck->get_active(),
|
||||
matchwordcheck->get_active(),
|
||||
!backwardscheck->get_active());
|
||||
}
|
||||
|
||||
|
||||
void GSearch::onReplace()
|
||||
{
|
||||
controller().replace(findentry->get_text(),
|
||||
replaceentry->get_text(),
|
||||
casecheck->get_active(),
|
||||
matchwordcheck->get_active(),
|
||||
!backwardscheck->get_active(),
|
||||
false);
|
||||
}
|
||||
|
||||
|
||||
void GSearch::onReplaceAll()
|
||||
{
|
||||
controller().replace(findentry->get_text(),
|
||||
replaceentry->get_text(),
|
||||
casecheck->get_active(),
|
||||
matchwordcheck->get_active(),
|
||||
!backwardscheck->get_active(),
|
||||
true);
|
||||
}
|
||||
|
||||
|
||||
void GSearch::onFindEntryChanged()
|
||||
{
|
||||
if (findentry->get_text().empty()) {
|
||||
findnextbutton->set_sensitive(false);
|
||||
replacebutton->set_sensitive(false);
|
||||
replaceallbutton->set_sensitive(false);
|
||||
} else {
|
||||
findnextbutton->set_sensitive(true);
|
||||
replacebutton->set_sensitive(!readOnly());
|
||||
replaceallbutton->set_sensitive(!readOnly());
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
@ -1,50 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file GSearch.h
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author John Spray
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#ifndef GSEARCH_H
|
||||
#define GSEARCH_H
|
||||
|
||||
#include "GViewBase.h"
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
class ControlSearch;
|
||||
|
||||
/** This class provides a GTK+ implementation of the FormSearch Dialog.
|
||||
*/
|
||||
class GSearch : public GViewCB<ControlSearch, GViewGladeB> {
|
||||
public:
|
||||
GSearch(Dialog & parent);
|
||||
private:
|
||||
virtual void apply() {}
|
||||
virtual void doBuild();
|
||||
virtual void update();
|
||||
|
||||
void onFindNext();
|
||||
void onReplace();
|
||||
void onReplaceAll();
|
||||
void onFindEntryChanged();
|
||||
|
||||
Gtk::Button * findnextbutton;
|
||||
Gtk::Button * replacebutton;
|
||||
Gtk::Button * replaceallbutton;
|
||||
Gtk::Entry * findentry;
|
||||
Gtk::Entry * replaceentry;
|
||||
Gtk::CheckButton * casecheck;
|
||||
Gtk::CheckButton * matchwordcheck;
|
||||
Gtk::CheckButton * backwardscheck;
|
||||
};
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#endif // GSEARCH_H
|
@ -1,120 +0,0 @@
|
||||
/**
|
||||
* \file GSendto.C
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author John Spray
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
// Too hard to make concept checks work with this file
|
||||
#ifdef _GLIBCXX_CONCEPT_CHECKS
|
||||
#undef _GLIBCXX_CONCEPT_CHECKS
|
||||
#endif
|
||||
#ifdef _GLIBCPP_CONCEPT_CHECKS
|
||||
#undef _GLIBCPP_CONCEPT_CHECKS
|
||||
#endif
|
||||
|
||||
#include "GSendto.h"
|
||||
#include "ControlSendto.h"
|
||||
#include "ghelpers.h"
|
||||
|
||||
#include "format.h"
|
||||
|
||||
#include <libglademm.h>
|
||||
|
||||
using std::string;
|
||||
using std::vector;
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
GSendto::GSendto(Dialog & parent)
|
||||
: GViewCB<ControlSendto, GViewGladeB>(parent, _("Send document to command"), false)
|
||||
{}
|
||||
|
||||
|
||||
void GSendto::doBuild()
|
||||
{
|
||||
string const gladeName = findGladeFile("sendto");
|
||||
xml_ = Gnome::Glade::Xml::create(gladeName);
|
||||
|
||||
Gtk::Button * button;
|
||||
xml_->get_widget("Close", button);
|
||||
setCancel(button);
|
||||
xml_->get_widget("Execute", button);
|
||||
setOK(button);
|
||||
|
||||
xml_->get_widget("Format", formatview_);
|
||||
xml_->get_widget("Command", commandentry_);
|
||||
|
||||
cols_.add(stringcol_);
|
||||
cols_.add(indexcol_);
|
||||
|
||||
formatstore_ = Gtk::ListStore::create(cols_);
|
||||
formatview_->set_model(formatstore_);
|
||||
formatview_->append_column("Format", stringcol_);
|
||||
formatview_->get_selection()->set_mode(Gtk::SELECTION_BROWSE);
|
||||
|
||||
commandentry_->signal_changed().connect(
|
||||
sigc::mem_fun(*this, &GSendto::onCommandEntryChanged));
|
||||
}
|
||||
|
||||
|
||||
void GSendto::onCommandEntryChanged()
|
||||
{
|
||||
bc().valid(!commandentry_->get_text().empty());
|
||||
}
|
||||
|
||||
|
||||
void GSendto::update()
|
||||
{
|
||||
vector<Format const *> new_formats;
|
||||
new_formats = controller().allFormats();
|
||||
|
||||
if (new_formats == all_formats_)
|
||||
return;
|
||||
|
||||
all_formats_ = new_formats;
|
||||
|
||||
vector<string> keys;
|
||||
keys.resize(all_formats_.size());
|
||||
|
||||
vector<string>::iterator result = keys.begin();
|
||||
vector<Format const *>::const_iterator it = all_formats_.begin();
|
||||
vector<Format const *>::const_iterator end = all_formats_.end();
|
||||
for (; it != end; ++it, ++result) {
|
||||
*result = (*it)->prettyname();
|
||||
}
|
||||
|
||||
formatstore_->clear();
|
||||
|
||||
vector<string>::const_iterator keyend = keys.end();
|
||||
vector<string>::const_iterator keyit = keys.begin();
|
||||
for (int rowindex = 0;
|
||||
keyit < keyend; ++keyit, ++rowindex) {
|
||||
Gtk::TreeModel::iterator row = formatstore_->append();
|
||||
(*row)[stringcol_] = *keyit;
|
||||
(*row)[indexcol_] = rowindex;
|
||||
}
|
||||
|
||||
commandentry_->set_text(controller().getCommand());
|
||||
}
|
||||
|
||||
|
||||
void GSendto::apply()
|
||||
{
|
||||
int const line =
|
||||
(*formatview_->get_selection()->get_selected())[indexcol_];
|
||||
|
||||
string const cmd = commandentry_->get_text();
|
||||
|
||||
controller().setFormat(all_formats_[line]);
|
||||
controller().setCommand(cmd);
|
||||
}
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
@ -1,51 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file GSendto.h
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author John Spray
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#ifndef GSENDTO_H
|
||||
#define GSENDTO_H
|
||||
|
||||
#include "GViewBase.h"
|
||||
#include <vector>
|
||||
|
||||
class Format;
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
class ControlSendto;
|
||||
|
||||
/** This class provides a GTK+ implementation of the Sendto Dialog.
|
||||
*/
|
||||
class GSendto : public GViewCB<ControlSendto, GViewGladeB> {
|
||||
public:
|
||||
GSendto(Dialog & parent);
|
||||
private:
|
||||
virtual void apply();
|
||||
virtual void doBuild();
|
||||
virtual void update();
|
||||
|
||||
Gtk::TreeModelColumn<Glib::ustring> stringcol_;
|
||||
Gtk::TreeModelColumn<unsigned int> indexcol_;
|
||||
Gtk::TreeModel::ColumnRecord cols_;
|
||||
Glib::RefPtr<Gtk::ListStore> formatstore_;
|
||||
|
||||
Gtk::TreeView * formatview_;
|
||||
Gtk::Entry * commandentry_;
|
||||
|
||||
std::vector<Format const *> all_formats_;
|
||||
|
||||
void onCommandEntryChanged();
|
||||
};
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#endif // GSENDTO_H
|
@ -1,67 +0,0 @@
|
||||
/**
|
||||
* \file GShowFile.C
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author John Spray
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
// Too hard to make concept checks work with this file
|
||||
#ifdef _GLIBCXX_CONCEPT_CHECKS
|
||||
#undef _GLIBCXX_CONCEPT_CHECKS
|
||||
#endif
|
||||
#ifdef _GLIBCPP_CONCEPT_CHECKS
|
||||
#undef _GLIBCPP_CONCEPT_CHECKS
|
||||
#endif
|
||||
|
||||
#include "GShowFile.h"
|
||||
#include "ControlShowFile.h"
|
||||
|
||||
#include "ghelpers.h"
|
||||
|
||||
using std::string;
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
GShowFile::GShowFile(Dialog & parent)
|
||||
: GViewCB<ControlShowFile, GViewGladeB>(parent, _("Show File"), false)
|
||||
{}
|
||||
|
||||
|
||||
void GShowFile::doBuild()
|
||||
{
|
||||
string const gladeName = findGladeFile("showfile");
|
||||
xml_ = Gnome::Glade::Xml::create(gladeName);
|
||||
|
||||
Gtk::Button * closebutton;
|
||||
xml_->get_widget("Close", closebutton);
|
||||
setCancel(closebutton);
|
||||
|
||||
Gtk::TextView * contentview;
|
||||
xml_->get_widget("ContentView", contentview);
|
||||
contentbuffer_ = contentview->get_buffer();
|
||||
}
|
||||
|
||||
|
||||
void GShowFile::update()
|
||||
{
|
||||
string const title = controller().getFileName();
|
||||
|
||||
if (!title.empty())
|
||||
setTitle(lyx::from_utf8(title));
|
||||
|
||||
string const contents = controller().getFileContents();
|
||||
|
||||
if (!contents.empty())
|
||||
contentbuffer_->set_text(contents);
|
||||
else
|
||||
contentbuffer_->set_text(lyx::to_utf8(_("Error reading file!")));
|
||||
}
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user