mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-23 10:18:50 +00:00
applying Martin Craig's gnome patch. Upgrading to gtkmm-2.0+ from the 1.3 development stream.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6073 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
3903b3ee3e
commit
2b08bb805b
@ -1,3 +1,33 @@
|
||||
2003-02-01 Michael A. Koziarski <michael@koziarski.org>
|
||||
|
||||
Major changes to make the gnome frontend compile and work again.
|
||||
|
||||
Credit to Martin Craig <martin@menudo.freeserve.co.uk> who
|
||||
actually did the work, I just cleaned his patch up.
|
||||
|
||||
Removed Files:
|
||||
* GUIRuntime.C
|
||||
|
||||
Added Files:
|
||||
* Dialogs2.C
|
||||
* Dialogs_impl.h
|
||||
* lyx_gui.C
|
||||
|
||||
Changed Files:
|
||||
* Dialogs.C
|
||||
* FileDialog.C
|
||||
* GAbout.[Ch]
|
||||
* GERT.[Ch]
|
||||
* GError.[Ch]
|
||||
* GFloat.[Ch]
|
||||
* GLog.[Ch]
|
||||
* GPreamble.[Ch]
|
||||
* GTabularCreate.[Ch]
|
||||
* GUrl.[Ch]
|
||||
* GnomeBase.[Ch]
|
||||
* Makefile.am
|
||||
* Timeout_pimpl.C
|
||||
|
||||
2002-12-16 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* Makefile.am: remove the if USE_BASIC_IMAGE_LOADER test.
|
||||
|
@ -1,8 +1,10 @@
|
||||
/**
|
||||
* \file gnome/Dialogs.C
|
||||
* Copyright 1995 Matthias Ettrich
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Allan Rae
|
||||
* \author Angus Leeming
|
||||
*
|
||||
* Full author contact details are available in file CREDITS
|
||||
@ -14,49 +16,70 @@
|
||||
#pragma implementation
|
||||
#endif
|
||||
|
||||
#include "Dialogs_impl.h"
|
||||
|
||||
#include "Dialogs.h"
|
||||
|
||||
#include "GUI.h"
|
||||
#include "gnomeBC.h"
|
||||
|
||||
#include "frontends/LyXView.h"
|
||||
|
||||
#include "GAbout.h"
|
||||
#include "GError.h"
|
||||
#include "GERT.h"
|
||||
#include "GFloat.h"
|
||||
#include "GLog.h"
|
||||
#include "GPreamble.h"
|
||||
#include "GTabularCreate.h"
|
||||
#include "GUrl.h"
|
||||
|
||||
#include "Tooltips.h"
|
||||
|
||||
bool Dialogs::tooltipsEnabled()
|
||||
Dialogs::Dialogs(LyXView & lv)
|
||||
: pimpl_(new Impl(lv, *this))
|
||||
{
|
||||
return Tooltips::enabled();
|
||||
}
|
||||
Dialogs::Dialogs(LyXView * lv)
|
||||
{
|
||||
|
||||
add(new GUI<ControlError,GErrorDialog,
|
||||
OkCancelPolicy, gnomeBC>(*lv, *this));
|
||||
add(new GUI<ControlERT, GERT,
|
||||
NoRepeatedApplyReadOnlyPolicy, gnomeBC>(*lv, *this));
|
||||
add(new GUI<ControlUrl, GUrl,
|
||||
NoRepeatedApplyReadOnlyPolicy, gnomeBC>(*lv,*this));
|
||||
add(new GUI<ControlPreamble, GPreamble,
|
||||
NoRepeatedApplyReadOnlyPolicy, gnomeBC>(*lv, *this));
|
||||
add(new GUI<ControlTabularCreate, GTabularCreate,
|
||||
OkApplyCancelReadOnlyPolicy, gnomeBC>(*lv, *this));
|
||||
add(new GUI<ControlLog, GLog,
|
||||
OkCancelPolicy, gnomeBC>(*lv, *this));
|
||||
add(new GUI<ControlAboutlyx, GAbout,
|
||||
OkCancelPolicy, gnomeBC>(*lv, *this));
|
||||
add(new GUI<ControlFloat, GFloat,
|
||||
NoRepeatedApplyReadOnlyPolicy, gnomeBC>(*lv, *this));
|
||||
// reduce the number of connections needed in
|
||||
// dialogs by a simple connection here.
|
||||
hideAll.connect(hideBufferDependent);
|
||||
}
|
||||
|
||||
|
||||
Dialogs::~Dialogs()
|
||||
{}
|
||||
|
||||
|
||||
void Dialogs::toggleTooltips()
|
||||
{
|
||||
Tooltips::toggleEnabled();
|
||||
}
|
||||
|
||||
|
||||
/// Are the tooltips on or off?
|
||||
bool Dialogs::tooltipsEnabled()
|
||||
{
|
||||
return Tooltips::enabled();
|
||||
}
|
||||
|
||||
|
||||
Dialogs::Impl::Impl(LyXView & lv, Dialogs & d)
|
||||
: aboutlyx(lv, d),
|
||||
bibitem(lv, d),
|
||||
bibtex(lv, d),
|
||||
character(lv, d),
|
||||
citation(lv, d),
|
||||
document(lv, d),
|
||||
error(lv, d),
|
||||
ert(lv, d),
|
||||
external(lv, d),
|
||||
file(lv, d),
|
||||
floats(lv, d),
|
||||
forks(lv, d),
|
||||
graphics(lv, d),
|
||||
include(lv, d),
|
||||
index(lv, d),
|
||||
logfile(lv, d),
|
||||
mathpanel(lv, d),
|
||||
minipage(lv, d),
|
||||
paragraph(lv, d),
|
||||
preamble(lv, d),
|
||||
preferences(lv, d),
|
||||
print(lv, d),
|
||||
ref(lv, d),
|
||||
search(lv, d),
|
||||
sendto(lv, d),
|
||||
spellchecker(lv, d),
|
||||
tabular(lv, d),
|
||||
tabularcreate(lv, d),
|
||||
texinfo(lv, d),
|
||||
#ifdef HAVE_LIBAIKSAURUS
|
||||
thesaurus(lv, d),
|
||||
#endif
|
||||
|
||||
toc(lv, d),
|
||||
url(lv, d),
|
||||
vclogfile(lv, d),
|
||||
wrap(lv, d)
|
||||
{}
|
||||
|
292
src/frontends/gnome/Dialogs2.C
Normal file
292
src/frontends/gnome/Dialogs2.C
Normal file
@ -0,0 +1,292 @@
|
||||
/**
|
||||
* \file gnome/Dialogs2.C
|
||||
* Copyright 1995 Matthias Ettrich
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Allan Rae
|
||||
* \author Angus Leeming
|
||||
*
|
||||
* Full author contact details are available in file CREDITS
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation
|
||||
#endif
|
||||
|
||||
#include "Dialogs_impl.h"
|
||||
|
||||
|
||||
void Dialogs::showAboutlyx()
|
||||
{
|
||||
pimpl_->aboutlyx.controller().show();
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::showBibitem(InsetCommand * ic)
|
||||
{
|
||||
pimpl_->bibitem.controller().showInset(ic);
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::showBibtex(InsetCommand * ic)
|
||||
{
|
||||
pimpl_->bibtex.controller().showInset(ic);
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::showCharacter()
|
||||
{
|
||||
pimpl_->character.controller().show();
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::setUserFreeFont()
|
||||
{
|
||||
pimpl_->character.controller().apply();
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::showCitation(InsetCommand * ic)
|
||||
{
|
||||
pimpl_->citation.controller().showInset(ic);
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::createCitation(string const & s)
|
||||
{
|
||||
pimpl_->citation.controller().createInset(s);
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::showDocument()
|
||||
{
|
||||
pimpl_->document.controller().show();
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::showError(InsetError * ie)
|
||||
{
|
||||
pimpl_->error.controller().showInset(ie);
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::showERT(InsetERT * ie)
|
||||
{
|
||||
pimpl_->ert.controller().showInset(ie);
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::updateERT(InsetERT * ie)
|
||||
{
|
||||
pimpl_->ert.controller().showInset(ie);
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::showExternal(InsetExternal * ie)
|
||||
{
|
||||
pimpl_->external.controller().showInset(ie);
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::showFile(string const & f)
|
||||
{
|
||||
pimpl_->file.controller().showFile(f);
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::showFloat(InsetFloat * ifl)
|
||||
{
|
||||
pimpl_->floats.controller().showInset(ifl);
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::showForks()
|
||||
{
|
||||
pimpl_->forks.controller().show();
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::showGraphics(InsetGraphics * ig)
|
||||
{
|
||||
pimpl_->graphics.controller().showInset(ig);
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::showInclude(InsetInclude * ii)
|
||||
{
|
||||
pimpl_->include.controller().showInset(ii);
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::showIndex(InsetCommand * ic)
|
||||
{
|
||||
pimpl_->index.controller().showInset(ic);
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::createIndex()
|
||||
{
|
||||
pimpl_->index.controller().createInset(string());
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::showLogFile()
|
||||
{
|
||||
pimpl_->logfile.controller().show();
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::showMathPanel()
|
||||
{
|
||||
pimpl_->mathpanel.controller().show();
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::showMinipage(InsetMinipage * im)
|
||||
{
|
||||
pimpl_->minipage.controller().showInset(im);
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::updateMinipage(InsetMinipage * im)
|
||||
{
|
||||
pimpl_->minipage.controller().showInset(im);
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::showParagraph()
|
||||
{
|
||||
pimpl_->paragraph.controller().show();
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::updateParagraph()
|
||||
{
|
||||
pimpl_->paragraph.controller().changedParagraph();
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::showPreamble()
|
||||
{
|
||||
pimpl_->preamble.controller().show();
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::showPreferences()
|
||||
{
|
||||
pimpl_->preferences.controller().show();
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::showPrint()
|
||||
{
|
||||
pimpl_->print.controller().show();
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::showRef(InsetCommand * ic)
|
||||
{
|
||||
pimpl_->ref.controller().showInset(ic);
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::createRef(string const & s)
|
||||
{
|
||||
pimpl_->ref.controller().createInset(s);
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::showSearch()
|
||||
{
|
||||
pimpl_->search.controller().show();
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::showSendto()
|
||||
{
|
||||
pimpl_->sendto.controller().show();
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::showSpellchecker()
|
||||
{
|
||||
pimpl_->spellchecker.controller().show();
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::showTabular(InsetTabular * it)
|
||||
{
|
||||
pimpl_->tabular.controller().showInset(it);
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::updateTabular(InsetTabular * it)
|
||||
{
|
||||
pimpl_->tabular.controller().updateInset(it);
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::showTabularCreate()
|
||||
{
|
||||
pimpl_->tabularcreate.controller().show();
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::showTexinfo()
|
||||
{
|
||||
pimpl_->texinfo.controller().show();
|
||||
}
|
||||
|
||||
|
||||
#ifdef HAVE_LIBAIKSAURUS
|
||||
|
||||
void Dialogs::showThesaurus(string const & s)
|
||||
{
|
||||
pimpl_->thesaurus.controller().showEntry(s);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
void Dialogs::showThesaurus(string const &)
|
||||
{}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
void Dialogs::showTOC(InsetCommand * ic)
|
||||
{
|
||||
pimpl_->toc.controller().showInset(ic);
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::createTOC(string const & s)
|
||||
{
|
||||
pimpl_->toc.controller().createInset(s);
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::showUrl(InsetCommand * ic)
|
||||
{
|
||||
pimpl_->url.controller().showInset(ic);
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::createUrl(string const & s)
|
||||
{
|
||||
pimpl_->url.controller().createInset(s);
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::showVCLogFile()
|
||||
{
|
||||
pimpl_->vclogfile.controller().show();
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::showWrap(InsetWrap * iw)
|
||||
{
|
||||
pimpl_->wrap.controller().showInset(iw);
|
||||
}
|
305
src/frontends/gnome/Dialogs_impl.h
Normal file
305
src/frontends/gnome/Dialogs_impl.h
Normal file
@ -0,0 +1,305 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file xforms/Dialogs_impl.h
|
||||
* 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
|
||||
*/
|
||||
|
||||
#ifndef DIALOGS_IMPL_H
|
||||
#define DIALOGS_IMP_H
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
#include "Dialogs.h"
|
||||
#include "controllers/GUI.h"
|
||||
|
||||
#include "Tooltips.h"
|
||||
#include "xformsBC.h"
|
||||
#include "gnomeBC.h"
|
||||
#include "combox.h"
|
||||
|
||||
#include "ControlAboutlyx.h"
|
||||
#include "GAbout.h"
|
||||
|
||||
#include "ControlBibitem.h"
|
||||
#include "FormBibitem.h"
|
||||
#include "forms/form_bibitem.h"
|
||||
|
||||
#include "ControlBibtex.h"
|
||||
#include "FormBibtex.h"
|
||||
#include "forms/form_bibtex.h"
|
||||
|
||||
#include "FormBrowser.h"
|
||||
#include "forms/form_browser.h"
|
||||
|
||||
#include "ControlCharacter.h"
|
||||
#include "FormCharacter.h"
|
||||
#include "forms/form_character.h"
|
||||
|
||||
#include "ControlCitation.h"
|
||||
#include "FormCitation.h"
|
||||
#include "forms/form_citation.h"
|
||||
|
||||
#include "ControlDocument.h"
|
||||
#include "FormDocument.h"
|
||||
#include "forms/form_document.h"
|
||||
|
||||
#include "ControlError.h"
|
||||
#include "GError.h"
|
||||
|
||||
#include "ControlERT.h"
|
||||
#include "GERT.h"
|
||||
|
||||
#include "ControlExternal.h"
|
||||
#include "FormExternal.h"
|
||||
#include "forms/form_external.h"
|
||||
|
||||
#include "ControlFloat.h"
|
||||
#include "GFloat.h"
|
||||
|
||||
#include "ControlForks.h"
|
||||
#include "FormForks.h"
|
||||
#include "forms/form_forks.h"
|
||||
|
||||
#include "ControlGraphics.h"
|
||||
#include "FormGraphics.h"
|
||||
#include "forms/form_graphics.h"
|
||||
|
||||
#include "ControlInclude.h"
|
||||
#include "FormInclude.h"
|
||||
#include "forms/form_include.h"
|
||||
|
||||
#include "ControlIndex.h"
|
||||
#include "FormIndex.h"
|
||||
#include "forms/form_index.h"
|
||||
|
||||
#include "ControlLog.h"
|
||||
#include "GLog.h"
|
||||
|
||||
#include "ControlShowFile.h"
|
||||
#include "FormShowFile.h"
|
||||
|
||||
#include "ControlMath.h"
|
||||
#include "FormMathsPanel.h"
|
||||
#include "forms/form_maths_panel.h"
|
||||
|
||||
#include "ControlMinipage.h"
|
||||
#include "FormMinipage.h"
|
||||
#include "forms/form_minipage.h"
|
||||
|
||||
#include "ControlParagraph.h"
|
||||
#include "FormParagraph.h"
|
||||
#include "forms/form_paragraph.h"
|
||||
|
||||
#include "ControlPreamble.h"
|
||||
#include "GPreamble.h"
|
||||
|
||||
#include "ControlPrefs.h"
|
||||
#include "FormPreferences.h"
|
||||
#include "forms/form_preferences.h"
|
||||
|
||||
#include "ControlPrint.h"
|
||||
#include "FormPrint.h"
|
||||
#include "forms/form_print.h"
|
||||
|
||||
#include "ControlRef.h"
|
||||
#include "FormRef.h"
|
||||
#include "forms/form_ref.h"
|
||||
|
||||
#include "ControlSearch.h"
|
||||
#include "FormSearch.h"
|
||||
#include "forms/form_search.h"
|
||||
|
||||
#include "ControlSendto.h"
|
||||
#include "FormSendto.h"
|
||||
#include "forms/form_sendto.h"
|
||||
|
||||
#include "ControlSpellchecker.h"
|
||||
#include "FormSpellchecker.h"
|
||||
#include "forms/form_spellchecker.h"
|
||||
|
||||
#include "ControlTabular.h"
|
||||
#include "FormTabular.h"
|
||||
#include "forms/form_tabular.h"
|
||||
|
||||
#include "ControlTabularCreate.h"
|
||||
#include "GTabularCreate.h"
|
||||
|
||||
#include "ControlTexinfo.h"
|
||||
#include "FormTexinfo.h"
|
||||
#include "forms/form_texinfo.h"
|
||||
|
||||
#ifdef HAVE_LIBAIKSAURUS
|
||||
#include "ControlThesaurus.h"
|
||||
#include "FormThesaurus.h"
|
||||
#include "forms/form_thesaurus.h"
|
||||
#endif
|
||||
|
||||
#include "ControlToc.h"
|
||||
#include "FormToc.h"
|
||||
#include "forms/form_toc.h"
|
||||
|
||||
#include "ControlUrl.h"
|
||||
#include "GUrl.h"
|
||||
|
||||
#include "ControlVCLog.h"
|
||||
#include "FormVCLog.h"
|
||||
|
||||
#include "ControlWrap.h"
|
||||
#include "FormWrap.h"
|
||||
#include "forms/form_wrap.h"
|
||||
|
||||
|
||||
typedef GUI<ControlAboutlyx, GAbout, OkCancelPolicy, gnomeBC>
|
||||
AboutlyxDialog;
|
||||
|
||||
typedef GUI<ControlBibitem, FormBibitem, OkCancelReadOnlyPolicy, xformsBC>
|
||||
BibitemDialog;
|
||||
|
||||
typedef GUI<ControlBibtex, FormBibtex, NoRepeatedApplyReadOnlyPolicy, xformsBC>
|
||||
BibtexDialog;
|
||||
|
||||
typedef GUI<ControlCharacter, FormCharacter, OkApplyCancelReadOnlyPolicy, xformsBC>
|
||||
CharacterDialog;
|
||||
|
||||
typedef GUI<ControlCitation, FormCitation, NoRepeatedApplyReadOnlyPolicy, xformsBC>
|
||||
CitationDialog;
|
||||
|
||||
typedef GUI<ControlDocument, FormDocument, NoRepeatedApplyReadOnlyPolicy, xformsBC>
|
||||
DocumentDialog;
|
||||
|
||||
typedef GUI<ControlError, GErrorDialog, OkCancelPolicy, gnomeBC>
|
||||
ErrorDialog;
|
||||
|
||||
typedef GUI<ControlERT, GERT, NoRepeatedApplyReadOnlyPolicy, gnomeBC>
|
||||
ERTDialog;
|
||||
|
||||
typedef GUI<ControlExternal, FormExternal, OkApplyCancelReadOnlyPolicy, xformsBC>
|
||||
ExternalDialog;
|
||||
|
||||
typedef GUI<ControlShowFile, FormShowFile, OkCancelPolicy, xformsBC>
|
||||
FileDialog;
|
||||
|
||||
typedef GUI<ControlFloat, GFloat, NoRepeatedApplyReadOnlyPolicy, gnomeBC>
|
||||
FloatDialog;
|
||||
|
||||
typedef GUI<ControlForks, FormForks, OkApplyCancelPolicy, xformsBC>
|
||||
ForksDialog;
|
||||
|
||||
typedef GUI<ControlGraphics, FormGraphics, NoRepeatedApplyReadOnlyPolicy, xformsBC>
|
||||
GraphicsDialog;
|
||||
|
||||
typedef GUI<ControlInclude, FormInclude, OkCancelReadOnlyPolicy, xformsBC>
|
||||
IncludeDialog;
|
||||
|
||||
typedef GUI<ControlIndex, FormIndex, NoRepeatedApplyReadOnlyPolicy, xformsBC>
|
||||
IndexDialog;
|
||||
|
||||
typedef GUI<ControlLog, GLog, OkCancelPolicy, gnomeBC>
|
||||
LogFileDialog;
|
||||
|
||||
typedef GUI<ControlMath, FormMathsPanel, OkCancelReadOnlyPolicy, xformsBC>
|
||||
MathPanelDialog;
|
||||
|
||||
typedef GUI<ControlMinipage, FormMinipage, NoRepeatedApplyReadOnlyPolicy, xformsBC>
|
||||
MinipageDialog;
|
||||
|
||||
typedef GUI<ControlParagraph, FormParagraph, OkApplyCancelReadOnlyPolicy, xformsBC>
|
||||
ParagraphDialog;
|
||||
|
||||
typedef GUI<ControlPreamble, GPreamble, NoRepeatedApplyReadOnlyPolicy, gnomeBC>
|
||||
PreambleDialog;
|
||||
|
||||
typedef GUI<ControlPrefs, FormPreferences, OkApplyCancelPolicy, xformsBC>
|
||||
PreferencesDialog;
|
||||
|
||||
typedef GUI<ControlPrint, FormPrint, OkApplyCancelPolicy, xformsBC>
|
||||
PrintDialog;
|
||||
|
||||
typedef GUI<ControlRef, FormRef, NoRepeatedApplyReadOnlyPolicy, xformsBC>
|
||||
RefDialog;
|
||||
|
||||
typedef GUI<ControlSearch, FormSearch, NoRepeatedApplyReadOnlyPolicy, xformsBC>
|
||||
SearchDialog;
|
||||
|
||||
typedef GUI<ControlSendto, FormSendto, OkApplyCancelPolicy, xformsBC>
|
||||
SendtoDialog;
|
||||
|
||||
typedef GUI<ControlSpellchecker, FormSpellchecker, NoRepeatedApplyReadOnlyPolicy, xformsBC>
|
||||
SpellcheckerDialog;
|
||||
|
||||
typedef GUI<ControlTabular, FormTabular, NoRepeatedApplyReadOnlyPolicy, xformsBC>
|
||||
TabularDialog;
|
||||
|
||||
typedef GUI<ControlTabularCreate, GTabularCreate, OkApplyCancelReadOnlyPolicy, gnomeBC>
|
||||
TabularCreateDialog;
|
||||
|
||||
typedef GUI<ControlTexinfo, FormTexinfo, OkCancelPolicy, xformsBC>
|
||||
TexinfoDialog;
|
||||
|
||||
#ifdef HAVE_LIBAIKSAURUS
|
||||
typedef GUI<ControlThesaurus, FormThesaurus, OkApplyCancelReadOnlyPolicy, xformsBC>
|
||||
ThesaurusDialog;
|
||||
#endif
|
||||
|
||||
typedef GUI<ControlToc, FormToc, OkCancelPolicy, xformsBC>
|
||||
TocDialog;
|
||||
|
||||
typedef GUI<ControlUrl, GUrl, NoRepeatedApplyReadOnlyPolicy, gnomeBC>
|
||||
UrlDialog;
|
||||
|
||||
typedef GUI<ControlVCLog, FormVCLog, OkCancelPolicy, xformsBC>
|
||||
VCLogFileDialog;
|
||||
|
||||
typedef GUI<ControlWrap, FormWrap, NoRepeatedApplyReadOnlyPolicy, xformsBC>
|
||||
WrapDialog;
|
||||
|
||||
struct Dialogs::Impl {
|
||||
Impl(LyXView & lv, Dialogs & d);
|
||||
|
||||
AboutlyxDialog aboutlyx;
|
||||
BibitemDialog bibitem;
|
||||
BibtexDialog bibtex;
|
||||
CharacterDialog character;
|
||||
CitationDialog citation;
|
||||
DocumentDialog document;
|
||||
ErrorDialog error;
|
||||
ERTDialog ert;
|
||||
ExternalDialog external;
|
||||
FileDialog file;
|
||||
FloatDialog floats;
|
||||
ForksDialog forks;
|
||||
GraphicsDialog graphics;
|
||||
IncludeDialog include;
|
||||
IndexDialog index;
|
||||
LogFileDialog logfile;
|
||||
MathPanelDialog mathpanel;
|
||||
MinipageDialog minipage;
|
||||
ParagraphDialog paragraph;
|
||||
PreambleDialog preamble;
|
||||
PreferencesDialog preferences;
|
||||
PrintDialog print;
|
||||
RefDialog ref;
|
||||
SearchDialog search;
|
||||
SendtoDialog sendto;
|
||||
SpellcheckerDialog spellchecker;
|
||||
TabularDialog tabular;
|
||||
TabularCreateDialog tabularcreate;
|
||||
TexinfoDialog texinfo;
|
||||
|
||||
#ifdef HAVE_LIBAIKSAURUS
|
||||
ThesaurusDialog thesaurus;
|
||||
#endif
|
||||
|
||||
TocDialog toc;
|
||||
UrlDialog url;
|
||||
VCLogFileDialog vclogfile;
|
||||
WrapDialog wrap;
|
||||
};
|
||||
|
||||
#endif // DIALOGS_IMPL_H
|
@ -16,12 +16,9 @@
|
||||
#include "FileDialog.h"
|
||||
#include "debug.h"
|
||||
#include "support/lstrings.h"
|
||||
#include <gtk--/fileselection.h>
|
||||
#include <gnome--/main.h>
|
||||
#include <gtkmm/fileselection.h>
|
||||
#include <gtk/gtkbutton.h>
|
||||
|
||||
#include <sigc++/signal_system.h>
|
||||
|
||||
#include "frontends/LyXView.h" // This is only needed while we have the xforms part!
|
||||
#include "bufferview_funcs.h"
|
||||
// FileDialog::Private
|
||||
@ -49,9 +46,9 @@ private:
|
||||
FileDialog::Private::Private(string const & title)
|
||||
: sel_(title), modal_(false)
|
||||
{
|
||||
sel_.get_ok_button()->clicked.connect(slot(this,
|
||||
sel_.get_ok_button()->signal_clicked().connect(slot(*this,
|
||||
&FileDialog::Private::ok_clicked));
|
||||
sel_.get_cancel_button()->clicked.connect(slot(this,
|
||||
sel_.get_cancel_button()->signal_clicked().connect(slot(*this,
|
||||
&FileDialog::Private::cancel_clicked));
|
||||
}
|
||||
|
||||
@ -60,7 +57,8 @@ string const FileDialog::Private::exec()
|
||||
canceled_ = false;
|
||||
sel_.set_modal(modal_);
|
||||
sel_.show();
|
||||
Gnome::Main::run();
|
||||
|
||||
sel_.run();
|
||||
// Find if its canceled or oked and return as needed.
|
||||
|
||||
if (canceled_)
|
||||
@ -73,7 +71,6 @@ void FileDialog::Private::button_clicked(bool canceled)
|
||||
{
|
||||
canceled_ = canceled;
|
||||
sel_.hide();
|
||||
Gnome::Main::quit();
|
||||
}
|
||||
|
||||
// FileDialog
|
||||
@ -94,7 +91,7 @@ FileDialog::~FileDialog()
|
||||
|
||||
|
||||
FileDialog::Result const
|
||||
FileDialog::Select(string const & path, string const & mask,
|
||||
FileDialog::open(string const & path, string const & mask,
|
||||
string const & suggested)
|
||||
{
|
||||
// For some reason we need to ignore the asynchronous method...
|
||||
@ -122,3 +119,15 @@ FileDialog::Select(string const & path, string const & mask,
|
||||
// Collect the info and return it for synchronous dialog.
|
||||
return FileDialog::Result(Chosen, filename);
|
||||
}
|
||||
|
||||
FileDialog::Result const
|
||||
FileDialog::opendir(string const & path,
|
||||
string const & suggested)
|
||||
{
|
||||
return open(path, "*/", suggested);
|
||||
}
|
||||
|
||||
FileDialog::Result const FileDialog::save(string const & path, string const & mask, string const & suggested)
|
||||
{
|
||||
return open(path, mask, suggested);
|
||||
}
|
||||
|
@ -17,15 +17,15 @@
|
||||
#include "support/lstrings.h"
|
||||
#include "Lsstream.h"
|
||||
|
||||
|
||||
#include "gnome_helpers.h"
|
||||
#include "gnomeBC.h"
|
||||
#include "GAbout.h"
|
||||
|
||||
#include <gtkmm/button.h>
|
||||
#include <gtkmm/textview.h>
|
||||
|
||||
GAbout::GAbout(ControlAboutlyx & c)
|
||||
: GnomeCB<ControlAboutlyx>(c, "GAbout")
|
||||
GAbout::GAbout()
|
||||
: GnomeCB<ControlAboutlyx>("GAbout")
|
||||
{}
|
||||
|
||||
|
||||
@ -69,21 +69,26 @@ void GAbout::update()
|
||||
istringstream ss(in.str());
|
||||
|
||||
string s;
|
||||
string out;
|
||||
Gtk::TextIter e;
|
||||
Glib::RefPtr<Gtk::TextBuffer> buf = credits()->get_buffer();
|
||||
|
||||
addDefaultTags(buf);
|
||||
while (getline(ss, s)) {
|
||||
|
||||
if (prefixIs(s, "@b"))
|
||||
out += s.substr(2);
|
||||
if (prefixIs(s, "@b"))
|
||||
buf->insert_with_tag(buf->end(),
|
||||
Glib::locale_to_utf8(s.substr(2)),
|
||||
"bold");
|
||||
else if (prefixIs(s, "@i"))
|
||||
out += s.substr(2);
|
||||
buf->insert_with_tag(buf->end(),
|
||||
Glib::locale_to_utf8(s.substr(2)),
|
||||
"italic");
|
||||
else
|
||||
out += s.substr(2);
|
||||
buf->insert(buf->end(),
|
||||
Glib::locale_to_utf8(s.substr(2)));
|
||||
buf->insert(buf->end(),"\n");
|
||||
|
||||
out += "\n";
|
||||
}
|
||||
credits()->get_buffer()->set_text(out);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -31,7 +31,7 @@ namespace Gtk {
|
||||
class GAbout : public GnomeCB<ControlAboutlyx> {
|
||||
public:
|
||||
///
|
||||
GAbout(ControlAboutlyx & c);
|
||||
GAbout();
|
||||
///
|
||||
~GAbout();
|
||||
|
||||
|
@ -20,8 +20,8 @@
|
||||
#include <gtkmm/radiobutton.h>
|
||||
#include <gtkmm/button.h>
|
||||
|
||||
GERT::GERT(ControlERT & c)
|
||||
: GnomeCB<ControlERT>(c, "GERT")
|
||||
GERT::GERT()
|
||||
: GnomeCB<ControlERT>("GERT")
|
||||
{}
|
||||
|
||||
|
||||
|
@ -30,7 +30,7 @@ namespace Gtk {
|
||||
class GERT : public GnomeCB<ControlERT> {
|
||||
public:
|
||||
///
|
||||
GERT(ControlERT & c);
|
||||
GERT();
|
||||
///
|
||||
~GERT();
|
||||
|
||||
|
@ -21,8 +21,8 @@
|
||||
#include <gtkmm/button.h>
|
||||
#include <gtkmm/textview.h>
|
||||
|
||||
GErrorDialog::GErrorDialog(ControlError & c)
|
||||
: GnomeCB<ControlError>(c, "GError")
|
||||
GErrorDialog::GErrorDialog()
|
||||
: GnomeCB<ControlError>("GError")
|
||||
{}
|
||||
|
||||
|
||||
|
@ -33,7 +33,7 @@ class TextView;
|
||||
class GErrorDialog : public GnomeCB<ControlError> {
|
||||
public:
|
||||
///
|
||||
GErrorDialog(ControlError & c);
|
||||
GErrorDialog();
|
||||
///
|
||||
~GErrorDialog() {}
|
||||
///
|
||||
@ -49,7 +49,7 @@ private:
|
||||
bool validate() const { return true; }
|
||||
|
||||
///
|
||||
void CloseClicked() { CancelButton(); }
|
||||
void CloseClicked() { CancelClicked(); }
|
||||
|
||||
/// generated by accessors.py
|
||||
Gtk::Button * button_close() const;
|
||||
|
@ -23,8 +23,8 @@
|
||||
#include <gtkmm/radiobutton.h>
|
||||
#include <gtkmm/box.h>
|
||||
|
||||
GFloat::GFloat(ControlFloat & c)
|
||||
: GnomeCB<ControlFloat>(c, "GFloat")
|
||||
GFloat::GFloat()
|
||||
: GnomeCB<ControlFloat>("GFloat")
|
||||
{}
|
||||
|
||||
|
||||
|
@ -32,7 +32,7 @@ namespace Gtk {
|
||||
class GFloat : public GnomeCB<ControlFloat> {
|
||||
public:
|
||||
///
|
||||
GFloat(ControlFloat & c);
|
||||
GFloat();
|
||||
///
|
||||
~GFloat();
|
||||
|
||||
|
@ -22,8 +22,8 @@
|
||||
#include <gtkmm/textview.h>
|
||||
#include <gtkmm/dialog.h>
|
||||
|
||||
GLog::GLog(ControlLog & c)
|
||||
: GnomeCB<ControlLog>(c, "GLog")
|
||||
GLog::GLog()
|
||||
: GnomeCB<ControlLog>("GLog")
|
||||
{}
|
||||
|
||||
|
||||
|
@ -30,7 +30,7 @@ namespace Gtk {
|
||||
class GLog : public GnomeCB<ControlLog> {
|
||||
public:
|
||||
///
|
||||
GLog(ControlLog & c);
|
||||
GLog();
|
||||
///
|
||||
~GLog();
|
||||
|
||||
|
@ -20,8 +20,8 @@
|
||||
#include <gtkmm/textview.h>
|
||||
#include <gtkmm/button.h>
|
||||
|
||||
GPreamble::GPreamble(ControlPreamble & c)
|
||||
: GnomeCB<ControlPreamble>(c, "GPreamble")
|
||||
GPreamble::GPreamble()
|
||||
: GnomeCB<ControlPreamble>("GPreamble")
|
||||
{}
|
||||
|
||||
|
||||
@ -44,9 +44,9 @@ void GPreamble::build()
|
||||
|
||||
void GPreamble::apply()
|
||||
{
|
||||
controller().params() = preamble()->get_buffer()->get_text(preamble()->get_buffer()->get_start_iter(),
|
||||
preamble()->get_buffer()->get_end_iter(),
|
||||
false);
|
||||
// controller().params() = preamble()->get_buffer()->get_text(preamble()->get_buffer()->get_start_iter(),
|
||||
// preamble()->get_buffer()->get_end_iter(),
|
||||
// false);
|
||||
}
|
||||
|
||||
|
||||
|
@ -30,7 +30,7 @@ class TextView;
|
||||
class GPreamble : public GnomeCB<ControlPreamble> {
|
||||
public:
|
||||
///
|
||||
GPreamble(ControlPreamble & c);
|
||||
GPreamble();
|
||||
///
|
||||
~GPreamble();
|
||||
|
||||
|
@ -21,8 +21,8 @@
|
||||
#include <gtkmm/spinbutton.h>
|
||||
#include <gtkmm/button.h>
|
||||
|
||||
GTabularCreate::GTabularCreate(ControlTabularCreate & c)
|
||||
: GnomeCB<ControlTabularCreate>(c, "GTabularCreate")
|
||||
GTabularCreate::GTabularCreate()
|
||||
: GnomeCB<ControlTabularCreate>("GTabularCreate")
|
||||
{}
|
||||
|
||||
|
||||
@ -38,7 +38,7 @@ void GTabularCreate::build()
|
||||
cancel_btn()->signal_clicked().connect(SigC::slot(*this,
|
||||
>abularCreate::CancelClicked));
|
||||
apply_btn()->signal_clicked().connect(SigC::slot(*this,
|
||||
>abularCreate::ApplyClicked));
|
||||
>abularCreate::ApplyClicked));
|
||||
|
||||
// Manage the buttons state
|
||||
bc().setOK(ok_btn());
|
||||
@ -52,8 +52,8 @@ void GTabularCreate::build()
|
||||
|
||||
void GTabularCreate::apply()
|
||||
{
|
||||
unsigned int ysize = (unsigned int)(rows()->get_value_as_int());
|
||||
unsigned int xsize = (unsigned int)(cols()->get_value_as_int());
|
||||
unsigned int xsize = (unsigned int)(rows()->get_value_as_int());
|
||||
unsigned int ysize = (unsigned int)(cols()->get_value_as_int());
|
||||
|
||||
controller().params() = std::make_pair(xsize, ysize);
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ namespace Gtk {
|
||||
class GTabularCreate : public GnomeCB<ControlTabularCreate> {
|
||||
public:
|
||||
///
|
||||
GTabularCreate(ControlTabularCreate & c);
|
||||
GTabularCreate();
|
||||
///
|
||||
~GTabularCreate();
|
||||
|
||||
@ -44,9 +44,9 @@ private:
|
||||
bool validate() const;
|
||||
void update();
|
||||
|
||||
void OKClicked() { OKButton(); }
|
||||
void CancelClicked() { CancelButton(); }
|
||||
void ApplyClicked() { ApplyButton(); }
|
||||
void OKClicked() { getController().OKButton(); }
|
||||
void CancelClicked() { getController().CancelButton(); }
|
||||
void ApplyClicked() { getController().ApplyButton(); }
|
||||
|
||||
/// generated by accessors.py
|
||||
Gtk::Button * ok_btn() const;
|
||||
|
@ -1,180 +0,0 @@
|
||||
/**
|
||||
* \file GUIRunTime.C
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author unknown
|
||||
*
|
||||
* Full author contact details are available in file CREDITS
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation
|
||||
#endif
|
||||
|
||||
#include FORMS_H_LOCATION
|
||||
#include "gnome_helpers.h"
|
||||
#include "GUIRunTime.h"
|
||||
#include "debug.h"
|
||||
|
||||
#include <gtkmm/main.h>
|
||||
#include <libglademm/xml.h>
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
// For now we use the xforms image loader if we can.
|
||||
// In the future, this will be replaced by a gnome equivalent.
|
||||
#if defined(HAVE_FLIMAGE_DUP) && defined(HAVE_FLIMAGE_TO_PIXMAP)
|
||||
#include "xforms/xformsGImage.h"
|
||||
#else
|
||||
#include "graphics/GraphicsImageXPM.h"
|
||||
#endif
|
||||
|
||||
using std::endl;
|
||||
|
||||
|
||||
extern bool finished;
|
||||
|
||||
namespace {
|
||||
|
||||
int const xforms_include_version = FL_INCLUDE_VERSION;
|
||||
|
||||
} // namespace anon
|
||||
|
||||
|
||||
int GUIRunTime::initApplication(int & argc , char * argv[])
|
||||
{
|
||||
// Check the XForms version in the forms.h header against
|
||||
// the one in the libforms. If they don't match quit the
|
||||
// execution of LyX. Better with a clean fast exit than
|
||||
// a strange segfault later.
|
||||
// I realize that this check have to be moved when we
|
||||
// support several toolkits, but IMO all the toolkits
|
||||
// should try to have the same kind of check. This could
|
||||
// be done by having a CheckHeaderAndLib function in
|
||||
// all the toolkit implementations, this function is
|
||||
// responsible for notifing the user.
|
||||
// if (!CheckHeaderAndLib()) {
|
||||
// // header vs. lib version failed
|
||||
// return 1;
|
||||
// }
|
||||
int xforms_lib_version = fl_library_version(0, 0);
|
||||
if (xforms_include_version != xforms_lib_version) {
|
||||
cerr << "You are either running LyX with wrong "
|
||||
"version of a dynamic XForms library\n"
|
||||
"or you have build LyX with conflicting header "
|
||||
"and library (different\n"
|
||||
"versions of XForms. Sorry but there is no point "
|
||||
"in continuing executing LyX!" << endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
// I belive that this should be done at a later stage, in
|
||||
// lyx_gui, the same place as xforms does the same. (Lgb)
|
||||
string app_id(PACKAGE);
|
||||
string app_version(VERSION);
|
||||
new Gtk::Main (argc, argv);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void GUIRunTime::processEvents()
|
||||
{
|
||||
while (Gtk::Main::events_pending())
|
||||
Gtk::Main::iteration(false);
|
||||
}
|
||||
|
||||
|
||||
void GUIRunTime::runTime()
|
||||
{
|
||||
XEvent ev;
|
||||
while (!finished) {
|
||||
processEvents();
|
||||
if (fl_check_forms() == FL_EVENT) {
|
||||
fl_XNextEvent(&ev);
|
||||
lyxerr << "Received unhandled X11 event" << endl;
|
||||
lyxerr << "Type: 0x" << hex << ev.xany.type <<
|
||||
"Target: 0x" << hex << ev.xany.window << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void GUIRunTime::setDefaults()
|
||||
{
|
||||
FL_IOPT cntl;
|
||||
cntl.buttonFontSize = FL_NORMAL_SIZE;
|
||||
cntl.browserFontSize = FL_NORMAL_SIZE;
|
||||
cntl.labelFontSize = FL_NORMAL_SIZE;
|
||||
cntl.choiceFontSize = FL_NORMAL_SIZE;
|
||||
cntl.inputFontSize = FL_NORMAL_SIZE;
|
||||
cntl.menuFontSize = FL_NORMAL_SIZE;
|
||||
cntl.borderWidth = -1;
|
||||
cntl.vclass = FL_DefaultVisual;
|
||||
fl_set_defaults(FL_PDVisual
|
||||
| FL_PDButtonFontSize
|
||||
| FL_PDBrowserFontSize
|
||||
| FL_PDLabelFontSize
|
||||
| FL_PDChoiceFontSize
|
||||
| FL_PDInputFontSize
|
||||
| FL_PDMenuFontSize
|
||||
| FL_PDBorderWidth, &cntl);
|
||||
}
|
||||
|
||||
|
||||
#include "XFormsView.h"
|
||||
LyXView * GUIRunTime::createMainView(int w, int h)
|
||||
{
|
||||
return new XFormsView(w, h);
|
||||
}
|
||||
|
||||
|
||||
// Called by the graphics cache to connect the appropriate frontend
|
||||
// image loading routines to the LyX kernel.
|
||||
void GUIRunTime::initialiseGraphics()
|
||||
{
|
||||
using namespace grfx;
|
||||
|
||||
#if defined(HAVE_FLIMAGE_DUP) && defined(HAVE_FLIMAGE_TO_PIXMAP)
|
||||
// connect the image loader based on the xforms library
|
||||
GImage::newImage.connect(boost::bind(&xformsGImage::newImage));
|
||||
GImage::loadableFormats.connect(boost::bind(&xformsGImage::loadableFormats));
|
||||
#else
|
||||
// connect the image loader based on the XPM library
|
||||
GImage::newImage.connect(boost::bind(&GImageXPM::newImage));
|
||||
GImage::loadableFormats.connect(boost::bind(&GImageXPM::loadableFormats));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
Display * GUIRunTime::x11Display()
|
||||
{
|
||||
return fl_get_display();
|
||||
}
|
||||
|
||||
|
||||
int GUIRunTime::x11Screen()
|
||||
{
|
||||
return fl_screen;
|
||||
}
|
||||
|
||||
|
||||
Colormap GUIRunTime::x11Colormap()
|
||||
{
|
||||
return fl_state[fl_get_vclass()].colormap;
|
||||
}
|
||||
|
||||
|
||||
int GUIRunTime::x11VisualDepth()
|
||||
{
|
||||
return fl_get_visual_depth();
|
||||
}
|
||||
|
||||
float GUIRunTime::getScreenDPI()
|
||||
{
|
||||
Screen * scr = ScreenOfDisplay(fl_get_display(), fl_screen);
|
||||
return ((HeightOfScreen(scr) * 25.4 / HeightMMOfScreen(scr)) +
|
||||
(WidthOfScreen(scr) * 25.4 / WidthMMOfScreen(scr))) / 2;
|
||||
}
|
@ -22,8 +22,8 @@
|
||||
#include <gtkmm/checkbutton.h>
|
||||
#include <gtkmm/button.h>
|
||||
|
||||
GUrl::GUrl(ControlUrl & c)
|
||||
: GnomeCB<ControlUrl>(c, "GUrl")
|
||||
GUrl::GUrl()
|
||||
: GnomeCB<ControlUrl>("GUrl")
|
||||
{}
|
||||
|
||||
|
||||
|
@ -32,7 +32,7 @@ class Entry;
|
||||
class GUrl : public GnomeCB<ControlUrl> {
|
||||
public:
|
||||
///
|
||||
GUrl(ControlUrl & c);
|
||||
GUrl();
|
||||
///
|
||||
~GUrl();
|
||||
|
||||
|
@ -17,14 +17,18 @@
|
||||
#include "support/LAssert.h"
|
||||
#include "debug.h"
|
||||
#include "support/filetools.h"
|
||||
#include "ControlButtons.h"
|
||||
#include <glib.h>
|
||||
#include <gtkmm/dialog.h>
|
||||
|
||||
GnomeBase::GnomeBase(ControlButtons & c,
|
||||
string const & name)
|
||||
: ViewBC<gnomeBC>(c)
|
||||
, file_(name + ".glade"), widget_name_(name), xml_(0)
|
||||
, dialog_(0)
|
||||
GnomeBase::GnomeBase(string const & name)
|
||||
: ViewBase(),
|
||||
updating_(false),
|
||||
file_(name + ".glade"),
|
||||
title_(name),
|
||||
widget_name_(name),
|
||||
xml_(0),
|
||||
dialog_(0)
|
||||
{
|
||||
loadXML();
|
||||
}
|
||||
@ -32,13 +36,18 @@ GnomeBase::GnomeBase(ControlButtons & c,
|
||||
GnomeBase::~GnomeBase()
|
||||
{}
|
||||
|
||||
gnomeBC & GnomeBase::bc()
|
||||
{
|
||||
return static_cast<gnomeBC &>(getController().bc());
|
||||
}
|
||||
|
||||
void GnomeBase::loadXML()
|
||||
{
|
||||
#ifdef WITH_WARNINGS
|
||||
#warning Change this before declaring it production code! (be 20010325)
|
||||
#endif
|
||||
string const path("src/frontends/gnome/dialogs/;frontends/gnome/dialogs/;");
|
||||
string const path("src/frontends/gnome/dialogs/;frontends/gnome/dialogs/;");
|
||||
|
||||
string const file = FileOpenSearch(path, file_, "glade");
|
||||
|
||||
if (file.empty()) {
|
||||
@ -64,7 +73,7 @@ void GnomeBase::hide()
|
||||
dialog()->hide();
|
||||
}
|
||||
|
||||
bool GnomeBase::validate()
|
||||
bool GnomeBase::isValid()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -72,30 +81,30 @@ bool GnomeBase::validate()
|
||||
void GnomeBase::OKClicked()
|
||||
{
|
||||
lyxerr[Debug::GUI] << "GnomeBase::OKClicked()\n";
|
||||
OKButton();
|
||||
getController().OKButton();
|
||||
}
|
||||
|
||||
void GnomeBase::CancelClicked()
|
||||
{
|
||||
lyxerr[Debug::GUI] << "GnomeBase::CancelClicked()\n";
|
||||
CancelButton();
|
||||
getController().CancelButton();
|
||||
}
|
||||
|
||||
void GnomeBase::ApplyClicked()
|
||||
{
|
||||
lyxerr[Debug::GUI] << "GnomeBase::ApplyClicked()\n";
|
||||
ApplyButton();
|
||||
getController().ApplyButton();
|
||||
}
|
||||
|
||||
void GnomeBase::RestoreClicked()
|
||||
{
|
||||
lyxerr[Debug::GUI] << "GnomeBase::RestoreClicked()\n";
|
||||
RestoreButton();
|
||||
getController().RestoreButton();
|
||||
}
|
||||
|
||||
void GnomeBase::InputChanged()
|
||||
{
|
||||
bc().valid(validate());
|
||||
bc().valid(isValid());
|
||||
}
|
||||
|
||||
Gtk::Dialog * GnomeBase::dialog()
|
||||
@ -105,3 +114,8 @@ Gtk::Dialog * GnomeBase::dialog()
|
||||
|
||||
return dialog_;
|
||||
}
|
||||
|
||||
bool GnomeBase::isVisible() const
|
||||
{
|
||||
return dialog_ && dialog_->is_visible();
|
||||
}
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include "ViewBase.h"
|
||||
#include "gnomeBC.h"
|
||||
|
||||
|
||||
namespace Gtk {
|
||||
class Dialog;
|
||||
};
|
||||
@ -33,10 +32,10 @@ namespace Gtk {
|
||||
* This is a base class for Gnome dialogs. It handles all the common
|
||||
* work that is needed for all dialogs.
|
||||
*/
|
||||
class GnomeBase : public ViewBC<gnomeBC>, public SigC::Object {
|
||||
class GnomeBase : public ViewBase, public SigC::Object {
|
||||
public:
|
||||
///
|
||||
GnomeBase(ControlButtons & c, string const & name);
|
||||
GnomeBase(string const & name);
|
||||
///
|
||||
virtual ~GnomeBase();
|
||||
|
||||
@ -55,7 +54,9 @@ protected:
|
||||
/// Build the dialog. Also connects signals and prepares it for work.
|
||||
virtual void build() = 0;
|
||||
/// Dialog is valid
|
||||
virtual bool validate();
|
||||
virtual bool isValid();
|
||||
/// dialog is visible
|
||||
virtual bool isVisible() const;
|
||||
/// Default OK behaviour
|
||||
virtual void OKClicked();
|
||||
/// Default Cancel behaviour
|
||||
@ -67,6 +68,11 @@ protected:
|
||||
/// Default changed input behaviour
|
||||
virtual void InputChanged();
|
||||
|
||||
///
|
||||
gnomeBC & bc();
|
||||
|
||||
/// are we updating ?
|
||||
bool updating_;
|
||||
private:
|
||||
/// Loads the glade file to memory.
|
||||
void loadXML();
|
||||
@ -83,6 +89,9 @@ private:
|
||||
* of the libglade GladeXML structure.
|
||||
*/
|
||||
Gtk::Dialog * dialog_;
|
||||
|
||||
/// dialog title, displayed by WM.
|
||||
string title_;
|
||||
};
|
||||
|
||||
|
||||
@ -105,21 +114,21 @@ T* GnomeBase::getWidget(const string & name) const
|
||||
template <class Controller>
|
||||
class GnomeCB : public GnomeBase {
|
||||
public:
|
||||
GnomeCB(Controller & c, string const & name);
|
||||
GnomeCB(string const & name);
|
||||
protected:
|
||||
Controller & controller();
|
||||
};
|
||||
|
||||
template <class Controller>
|
||||
GnomeCB<Controller>::GnomeCB(Controller & c, string const & name)
|
||||
: GnomeBase(c, name)
|
||||
GnomeCB<Controller>::GnomeCB(string const & name)
|
||||
: GnomeBase(name)
|
||||
{}
|
||||
|
||||
template <class Controller>
|
||||
Controller &
|
||||
GnomeCB<Controller>::controller()
|
||||
{
|
||||
return static_cast<Controller &>(controller_);
|
||||
return static_cast<Controller &>(getController());
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -8,49 +8,112 @@ INCLUDES = $(FRONTEND_INCLUDES) -I$(top_srcdir)/src/ \
|
||||
-I$(top_srcdir)/src/frontends/controllers \
|
||||
$(BOOST_INCLUDES)
|
||||
|
||||
# These are the XForms GUI classes we still need because they
|
||||
# haven't been implemented in Gnome.
|
||||
# alphabetised
|
||||
xforms_objects = \
|
||||
../xforms/Alert_pimpl.lo \
|
||||
../xforms/bmtable.lo \
|
||||
../xforms/checkedwidgets.lo \
|
||||
../xforms/combox.lo \
|
||||
../xforms/Color.lo \
|
||||
../xforms/ColorHandler.lo \
|
||||
../xforms/DropDown.lo \
|
||||
../xforms/FeedbackController.lo \
|
||||
../xforms/FileDialog.lo \
|
||||
../xforms/fdesign_base.lo \
|
||||
../xforms/FontInfo.lo \
|
||||
../xforms/FormBaseDeprecated.lo \
|
||||
../xforms/FormFiledialog.lo \
|
||||
../xforms/form_filedialog.lo \
|
||||
../xforms/FormAboutlyx.lo \
|
||||
../xforms/FormBase.lo \
|
||||
../xforms/FormBibitem.lo \
|
||||
../xforms/FormBibtex.lo \
|
||||
../xforms/FormBrowser.lo \
|
||||
../xforms/FormCharacter.lo \
|
||||
../xforms/FormCitation.lo \
|
||||
../xforms/FormDocument.lo \
|
||||
../xforms/FormExternal.lo \
|
||||
../xforms/FormForks.lo \
|
||||
../xforms/FormGraphics.lo \
|
||||
../xforms/FormInclude.lo \
|
||||
../xforms/FormIndex.lo \
|
||||
../xforms/FormMathsBitmap.lo \
|
||||
../xforms/FormMathsDeco.lo \
|
||||
../xforms/form_maths_deco.lo \
|
||||
../xforms/FormMathsDelim.lo \
|
||||
../xforms/form_maths_delim.lo \
|
||||
../xforms/FormMathsMatrix.lo \
|
||||
../xforms/form_maths_matrix.lo \
|
||||
../xforms/FormMathsPanel.lo \
|
||||
../xforms/form_maths_panel.lo \
|
||||
../xforms/FormMathsSpace.lo \
|
||||
../xforms/form_maths_space.lo \
|
||||
../xforms/FormMathsStyle.lo \
|
||||
../xforms/form_maths_style.lo \
|
||||
../xforms/lyxlookup.lo \
|
||||
../xforms/MathsSymbols.lo \
|
||||
../xforms/FormMinipage.lo \
|
||||
../xforms/FormParagraph.lo \
|
||||
../xforms/FormPreferences.lo \
|
||||
../xforms/FormPrint.lo \
|
||||
../xforms/FormRef.lo \
|
||||
../xforms/forms_gettext.lo \
|
||||
../xforms/FormSearch.lo \
|
||||
../xforms/FormSendto.lo \
|
||||
../xforms/FormShowFile.lo \
|
||||
../xforms/FormSpellchecker.lo \
|
||||
../xforms/FormTabular.lo \
|
||||
../xforms/FormTexinfo.lo \
|
||||
../xforms/FormThesaurus.lo \
|
||||
../xforms/FormToc.lo \
|
||||
../xforms/FormVCLog.lo \
|
||||
../xforms/FormWrap.lo \
|
||||
../xforms/input_validators.lo \
|
||||
../xforms/LyXKeySymFactory.lo \
|
||||
../xforms/LyXScreenFactory.lo \
|
||||
../xforms/Menubar_pimpl.lo \
|
||||
../xforms/RadioButtonGroup.lo \
|
||||
../xforms/Toolbar_pimpl.lo \
|
||||
../xforms/Tooltips.lo \
|
||||
../xforms/WorkAreaFactory.lo \
|
||||
../xforms/xfont_loader.lo \
|
||||
../xforms/xfont_metrics.lo \
|
||||
../xforms/xforms_helpers.lo \
|
||||
../xforms/xforms_resize.lo \
|
||||
../xforms/xformsBC.lo \
|
||||
../xforms/xformsImage.lo \
|
||||
../xforms/XFormsView.lo \
|
||||
../xforms/XLyXKeySym.lo \
|
||||
../xforms/XMiniBuffer.lo \
|
||||
../xforms/XPainter.lo \
|
||||
../xforms/xscreen.lo \
|
||||
../xforms/XWorkArea.lo \
|
||||
../xforms/xformsImage.lo
|
||||
../xforms/forms/form_aboutlyx.lo \
|
||||
../xforms/forms/form_bibitem.lo \
|
||||
../xforms/forms/form_bibtex.lo \
|
||||
../xforms/forms/form_browser.lo \
|
||||
../xforms/forms/form_character.lo \
|
||||
../xforms/forms/form_citation.lo \
|
||||
../xforms/forms/form_document.lo \
|
||||
../xforms/forms/form_error.lo \
|
||||
../xforms/forms/form_ert.lo \
|
||||
../xforms/forms/form_external.lo \
|
||||
../xforms/forms/form_filedialog.lo \
|
||||
../xforms/forms/form_float.lo \
|
||||
../xforms/forms/form_forks.lo \
|
||||
../xforms/forms/form_graphics.lo \
|
||||
../xforms/forms/form_include.lo \
|
||||
../xforms/forms/form_index.lo \
|
||||
../xforms/forms/form_maths_delim.lo \
|
||||
../xforms/forms/form_maths_matrix.lo \
|
||||
../xforms/forms/form_maths_panel.lo \
|
||||
../xforms/forms/form_maths_space.lo \
|
||||
../xforms/forms/form_maths_style.lo \
|
||||
../xforms/forms/form_minipage.lo \
|
||||
../xforms/forms/form_paragraph.lo \
|
||||
../xforms/forms/form_preamble.lo \
|
||||
../xforms/forms/form_preferences.lo \
|
||||
../xforms/forms/form_print.lo \
|
||||
../xforms/forms/form_ref.lo \
|
||||
../xforms/forms/form_search.lo \
|
||||
../xforms/forms/form_sendto.lo \
|
||||
../xforms/forms/form_spellchecker.lo \
|
||||
../xforms/forms/form_tabular_create.lo \
|
||||
../xforms/forms/form_tabular.lo \
|
||||
../xforms/forms/form_texinfo.lo \
|
||||
../xforms/forms/form_thesaurus.lo \
|
||||
../xforms/forms/form_toc.lo \
|
||||
../xforms/forms/form_url.lo \
|
||||
../xforms/forms/form_wrap.lo
|
||||
|
||||
libgnome.la: xforms.lo $(libgnome_la_OBJECTS) $(libgnome_la_DEPENDENCIES)
|
||||
|
||||
xforms.lo: $(xforms_objects)
|
||||
$(CXXLINK) $(xforms_objects)
|
||||
@ -61,6 +124,9 @@ xforms.lo: $(xforms_objects)
|
||||
|
||||
libgnome_la_SOURCES = \
|
||||
Dialogs.C \
|
||||
Dialogs2.C \
|
||||
Dialogs_impl.h \
|
||||
FileDialog.C \
|
||||
GAbout.C \
|
||||
GAbout.h \
|
||||
GError.C \
|
||||
@ -83,7 +149,9 @@ libgnome_la_SOURCES = \
|
||||
GnomeBase.h \
|
||||
gnomeBC.C \
|
||||
gnomeBC.h \
|
||||
GUIRunTime.C \
|
||||
pixbutton.h \
|
||||
lyx_gui.C \
|
||||
Timeout_pimpl.C \
|
||||
Timeout_pimpl.h
|
||||
Timeout_pimpl.h \
|
||||
pixbutton.h
|
||||
|
||||
libgnome.la: xforms.lo $(libgnome_la_OBJECTS) $(libgnome_la_DEPENDENCIES)
|
||||
|
@ -15,17 +15,15 @@
|
||||
#pragma implementation
|
||||
#endif
|
||||
|
||||
#include <gtkmm/main.h>
|
||||
#include <glibmm/main.h>
|
||||
#include "Timeout_pimpl.h"
|
||||
#include "debug.h"
|
||||
|
||||
|
||||
Timeout::Pimpl::Pimpl(Timeout * owner)
|
||||
: owner_(owner)
|
||||
: owner_(owner)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void Timeout::Pimpl::reset()
|
||||
{
|
||||
stop();
|
||||
@ -43,7 +41,7 @@ void Timeout::Pimpl::start()
|
||||
stop();
|
||||
}
|
||||
|
||||
conn_ = Gtk::Main::signal_timeout().connect(
|
||||
conn_ = Glib::signal_timeout().connect(
|
||||
SigC::slot(*this, &Timeout::Pimpl::timeoutEvent),
|
||||
owner_->timeout_ms
|
||||
);
|
||||
|
@ -113,7 +113,7 @@
|
||||
<property name="can_focus">True</property>
|
||||
<property name="editable">True</property>
|
||||
<property name="justification">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap_mode">GTK_WRAP_NONE</property>
|
||||
<property name="wrap_mode">GTK_WRAP_WORD</property>
|
||||
<property name="cursor_visible">True</property>
|
||||
<property name="pixels_above_lines">0</property>
|
||||
<property name="pixels_below_lines">0</property>
|
||||
@ -165,7 +165,7 @@
|
||||
<property name="can_focus">True</property>
|
||||
<property name="editable">True</property>
|
||||
<property name="justification">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap_mode">GTK_WRAP_NONE</property>
|
||||
<property name="wrap_mode">GTK_WRAP_WORD</property>
|
||||
<property name="cursor_visible">True</property>
|
||||
<property name="pixels_above_lines">0</property>
|
||||
<property name="pixels_below_lines">0</property>
|
||||
|
@ -12,3 +12,17 @@
|
||||
|
||||
|
||||
#include "gnome_helpers.h"
|
||||
#include <gtkmm/texttag.h>
|
||||
|
||||
void addDefaultTags(Glib::RefPtr<Gtk::TextBuffer> & buf) {
|
||||
Glib::RefPtr<Gtk::TextTag> italicTag = Gtk::TextTag::create("italic");
|
||||
italicTag->property_style() = Pango::STYLE_ITALIC;
|
||||
|
||||
Glib::RefPtr<Gtk::TextTag> boldTag = Gtk::TextTag::create("bold");
|
||||
boldTag->property_weight() = Pango::WEIGHT_BOLD;
|
||||
|
||||
buf->get_tag_table()->add(italicTag);
|
||||
buf->get_tag_table()->add(boldTag);
|
||||
|
||||
}
|
||||
|
||||
|
@ -22,4 +22,14 @@
|
||||
#undef Value
|
||||
#undef DestroyNotify
|
||||
|
||||
#include <gtkmm/textbuffer.h>
|
||||
|
||||
|
||||
/**
|
||||
* This helper function adds default tags to a TextBuffer
|
||||
*
|
||||
* Hopefully gtk will come with its own one day, but until then...
|
||||
*/
|
||||
void addDefaultTags(Glib::RefPtr<Gtk::TextBuffer> &);
|
||||
|
||||
#endif
|
||||
|
397
src/frontends/gnome/lyx_gui.C
Normal file
397
src/frontends/gnome/lyx_gui.C
Normal file
@ -0,0 +1,397 @@
|
||||
/**
|
||||
* \file xforms/lyx_gui.C
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author unknown
|
||||
* \author John Levon
|
||||
*
|
||||
* Full author contact details are available in file CREDITS
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "lyx_gui.h"
|
||||
|
||||
#include "support/lyxlib.h"
|
||||
#include "support/os.h"
|
||||
#include "support/filetools.h"
|
||||
|
||||
#include "debug.h"
|
||||
#include "gettext.h"
|
||||
|
||||
#include "lyx_main.h"
|
||||
#include "lyxrc.h"
|
||||
#include "lyxfont.h"
|
||||
|
||||
// FIXME: move this stuff out again
|
||||
#include "bufferlist.h"
|
||||
#include "lyxfunc.h"
|
||||
#include "lyxserver.h"
|
||||
#include "BufferView.h"
|
||||
#include "XFormsView.h"
|
||||
|
||||
#include FORMS_H_LOCATION
|
||||
#include "ColorHandler.h"
|
||||
#include "xforms_helpers.h"
|
||||
#include "xfont_loader.h"
|
||||
#include "xformsImage.h"
|
||||
|
||||
#include "Lsstream.h"
|
||||
#include <iomanip>
|
||||
#include <fcntl.h>
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
#include "gnome_helpers.h"
|
||||
#include <gtkmm/main.h>
|
||||
#include <libglademm/xml.h>
|
||||
|
||||
#ifndef CXX_GLOBAL_CSTD
|
||||
using std::exit;
|
||||
#endif
|
||||
|
||||
using std::vector;
|
||||
using std::hex;
|
||||
using std::dec;
|
||||
using std::endl;
|
||||
using std::setbase;
|
||||
using std::setfill;
|
||||
using std::setw;
|
||||
|
||||
extern BufferList bufferlist;
|
||||
|
||||
// FIXME: wrong place !
|
||||
LyXServer * lyxserver;
|
||||
|
||||
namespace {
|
||||
|
||||
/// quit lyx
|
||||
bool finished = false;
|
||||
|
||||
/// estimate DPI from X server
|
||||
float getDPI()
|
||||
{
|
||||
Screen * scr = ScreenOfDisplay(fl_get_display(), fl_screen);
|
||||
return ((HeightOfScreen(scr) * 25.4 / HeightMMOfScreen(scr)) +
|
||||
(WidthOfScreen(scr) * 25.4 / WidthMMOfScreen(scr))) / 2;
|
||||
}
|
||||
|
||||
|
||||
/// set default GUI configuration
|
||||
void setDefaults()
|
||||
{
|
||||
FL_IOPT cntl;
|
||||
cntl.buttonFontSize = FL_NORMAL_SIZE;
|
||||
cntl.browserFontSize = FL_NORMAL_SIZE;
|
||||
cntl.labelFontSize = FL_NORMAL_SIZE;
|
||||
cntl.choiceFontSize = FL_NORMAL_SIZE;
|
||||
cntl.inputFontSize = FL_NORMAL_SIZE;
|
||||
cntl.menuFontSize = FL_NORMAL_SIZE;
|
||||
cntl.borderWidth = -1;
|
||||
cntl.vclass = FL_DefaultVisual;
|
||||
fl_set_defaults(FL_PDVisual
|
||||
| FL_PDButtonFontSize
|
||||
| FL_PDBrowserFontSize
|
||||
| FL_PDLabelFontSize
|
||||
| FL_PDChoiceFontSize
|
||||
| FL_PDInputFontSize
|
||||
| FL_PDMenuFontSize
|
||||
| FL_PDBorderWidth, &cntl);
|
||||
}
|
||||
|
||||
|
||||
extern "C" {
|
||||
|
||||
int LyX_XErrHandler(Display * display, XErrorEvent * xeev) {
|
||||
// We don't abort on BadWindow
|
||||
if (xeev->error_code == BadWindow) {
|
||||
lyxerr << "BadWindow received !" << endl;
|
||||
lyxerr << "If you're using xforms 1.0 or greater, "
|
||||
<< " please report this to lyx-devel@lists.lyx.org" << endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// emergency cleanup
|
||||
LyX::emergencyCleanup();
|
||||
|
||||
// Get the reason for the crash.
|
||||
char etxt[513];
|
||||
XGetErrorText(display, xeev->error_code, etxt, 512);
|
||||
lyxerr << etxt << " id: " << xeev->resourceid << endl;
|
||||
// By doing an abort we get a nice backtrace. (hopefully)
|
||||
lyx::abort();
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// read in geometry specification
|
||||
char geometry[40];
|
||||
|
||||
} // namespace anon
|
||||
|
||||
|
||||
void lyx_gui::parse_init(int & argc, char * argv[])
|
||||
{
|
||||
setDefaults();
|
||||
|
||||
FL_CMD_OPT cmdopt[] = {
|
||||
{"-geometry", "*.geometry", XrmoptionSepArg, "690x510"}
|
||||
};
|
||||
|
||||
FL_resource res[] = {
|
||||
{"geometry", "geometryClass", FL_STRING, geometry, "", 40}
|
||||
};
|
||||
|
||||
const int num_res = sizeof(res)/sizeof(FL_resource);
|
||||
|
||||
fl_initialize(&argc, argv, "LyX", cmdopt, num_res);
|
||||
|
||||
// It appears that, in xforms >=0.89.5, fl_initialize()
|
||||
// calls setlocale() and ruins our LC_NUMERIC setting.
|
||||
locale_init();
|
||||
|
||||
fl_get_app_resources(res, num_res);
|
||||
|
||||
Display * display = fl_get_display();
|
||||
|
||||
if (!display) {
|
||||
lyxerr << "LyX: unable to access X display, exiting" << endl;
|
||||
os::warn("Unable to access X display, exiting");
|
||||
::exit(1);
|
||||
}
|
||||
|
||||
fcntl(ConnectionNumber(display), F_SETFD, FD_CLOEXEC);
|
||||
|
||||
XSetErrorHandler(LyX_XErrHandler);
|
||||
|
||||
lyxColorHandler.reset(new LyXColorHandler());
|
||||
|
||||
using namespace grfx;
|
||||
|
||||
// connect the image loader based on the xforms library
|
||||
Image::newImage = boost::bind(&xformsImage::newImage);
|
||||
Image::loadableFormats = boost::bind(&xformsImage::loadableFormats);
|
||||
|
||||
// must do this /before/ lyxrc gets read
|
||||
lyxrc.dpi = getDPI();
|
||||
|
||||
new Gtk::Main (argc, argv);
|
||||
}
|
||||
|
||||
|
||||
void lyx_gui::parse_lyxrc()
|
||||
{
|
||||
XformsColor::read(AddName(user_lyxdir, "preferences.xform"));
|
||||
|
||||
if (lyxrc.popup_font_encoding.empty())
|
||||
lyxrc.popup_font_encoding = lyxrc.font_norm;
|
||||
// Set the font name for popups and menus
|
||||
string boldfontname = lyxrc.popup_bold_font
|
||||
+ "-*-*-*-?-*-*-*-*-"
|
||||
+ lyxrc.popup_font_encoding;
|
||||
// "?" means "scale that font"
|
||||
string fontname = lyxrc.popup_normal_font
|
||||
+ "-*-*-*-?-*-*-*-*-"
|
||||
+ lyxrc.popup_font_encoding;
|
||||
|
||||
int bold = fl_set_font_name(FL_BOLD_STYLE, boldfontname.c_str());
|
||||
int normal = fl_set_font_name(FL_NORMAL_STYLE, fontname.c_str());
|
||||
if (bold < 0)
|
||||
lyxerr << "Could not set menu font to "
|
||||
<< boldfontname << endl;
|
||||
|
||||
if (normal < 0)
|
||||
lyxerr << "Could not set popup font to "
|
||||
<< fontname << endl;
|
||||
|
||||
if (bold < 0 && normal < 0) {
|
||||
lyxerr << "Using 'helvetica' font for menus" << endl;
|
||||
boldfontname = "-*-helvetica-bold-r-*-*-*-?-*-*-*-*-iso8859-1";
|
||||
fontname = "-*-helvetica-medium-r-*-*-*-?-*-*-*-*-iso8859-1";
|
||||
bold = fl_set_font_name(FL_BOLD_STYLE, boldfontname.c_str());
|
||||
normal = fl_set_font_name(FL_NORMAL_STYLE, fontname.c_str());
|
||||
|
||||
if (bold < 0 && normal < 0) {
|
||||
lyxerr << "Could not find helvetica font. Using 'fixed'." << endl;
|
||||
fl_set_font_name(FL_NORMAL_STYLE, "fixed");
|
||||
normal = bold = 0;
|
||||
}
|
||||
}
|
||||
if (bold < 0)
|
||||
fl_set_font_name(FL_BOLD_STYLE, fontname.c_str());
|
||||
else if (normal < 0)
|
||||
fl_set_font_name(FL_NORMAL_STYLE, boldfontname.c_str());
|
||||
|
||||
fl_setpup_fontstyle(FL_NORMAL_STYLE);
|
||||
fl_setpup_fontsize(FL_NORMAL_SIZE);
|
||||
fl_setpup_color(FL_MCOL, FL_BLACK);
|
||||
fl_set_goodies_font(FL_NORMAL_STYLE, FL_NORMAL_SIZE);
|
||||
fl_set_tooltip_font(FL_NORMAL_STYLE, FL_NORMAL_SIZE);
|
||||
}
|
||||
|
||||
void lyx_gui::start(string const & batch, vector<string> const & files)
|
||||
{
|
||||
// initial geometry
|
||||
int xpos = -1;
|
||||
int ypos = -1;
|
||||
unsigned int width = 690;
|
||||
unsigned int height = 510;
|
||||
|
||||
int const geometryBitmask =
|
||||
XParseGeometry(geometry,
|
||||
&xpos, &ypos, &width, &height);
|
||||
|
||||
// if width is not set by geometry, check it against monitor width
|
||||
if (!(geometryBitmask & WidthValue)) {
|
||||
Screen * scr = ScreenOfDisplay(fl_get_display(), fl_screen);
|
||||
if (WidthOfScreen(scr) - 8 < int(width))
|
||||
width = WidthOfScreen(scr) - 8;
|
||||
}
|
||||
|
||||
// if height is not set by geometry, check it against monitor height
|
||||
if (!(geometryBitmask & HeightValue)) {
|
||||
Screen * scr = ScreenOfDisplay(fl_get_display(), fl_screen);
|
||||
if (HeightOfScreen(scr) - 24 < int(height))
|
||||
height = HeightOfScreen(scr) - 24;
|
||||
}
|
||||
|
||||
Screen * s = ScreenOfDisplay(fl_get_display(), fl_screen);
|
||||
|
||||
// recalculate xpos if it's not set
|
||||
if (xpos == -1)
|
||||
xpos = (WidthOfScreen(s) - width) / 2;
|
||||
|
||||
// recalculate ypos if it's not set
|
||||
if (ypos == -1)
|
||||
ypos = (HeightOfScreen(s) - height) / 2;
|
||||
|
||||
lyxerr[Debug::GUI] << "Creating view: " << width << 'x' << height
|
||||
<< '+' << xpos << '+' << ypos << endl;
|
||||
|
||||
XFormsView view(width, height);
|
||||
view.show(xpos, ypos, "LyX");
|
||||
view.init();
|
||||
|
||||
Buffer * last = 0;
|
||||
|
||||
// FIXME: some code below needs moving
|
||||
|
||||
lyxserver = new LyXServer(&view.getLyXFunc(), lyxrc.lyxpipes);
|
||||
|
||||
vector<string>::const_iterator cit = files.begin();
|
||||
vector<string>::const_iterator end = files.end();
|
||||
for (; cit != end; ++cit) {
|
||||
Buffer * b = bufferlist.loadLyXFile(*cit);
|
||||
if (b) {
|
||||
last = b;
|
||||
}
|
||||
}
|
||||
|
||||
// switch to the last buffer successfully loaded
|
||||
if (last) {
|
||||
view.view()->buffer(last);
|
||||
}
|
||||
|
||||
// handle the batch commands the user asked for
|
||||
if (!batch.empty()) {
|
||||
view.getLyXFunc().dispatch(batch);
|
||||
}
|
||||
|
||||
// enter the event loop
|
||||
while (!finished) {
|
||||
while (Gtk::Main::events_pending())
|
||||
Gtk::Main::iteration(false);
|
||||
if (fl_check_forms() == FL_EVENT) {
|
||||
XEvent ev;
|
||||
fl_XNextEvent(&ev);
|
||||
lyxerr[Debug::GUI]
|
||||
<< "Received unhandled X11 event" << endl
|
||||
<< "Type: " << ev.xany.type
|
||||
<< " Target: 0x" << hex << ev.xany.window
|
||||
<< dec << endl;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// FIXME: breaks emergencyCleanup
|
||||
delete lyxserver;
|
||||
}
|
||||
|
||||
void lyx_gui::exit()
|
||||
{
|
||||
finished = true;
|
||||
}
|
||||
|
||||
|
||||
FuncStatus lyx_gui::getStatus(FuncRequest const & /*ev*/)
|
||||
{
|
||||
// Nothing interesting to do here
|
||||
return FuncStatus();
|
||||
}
|
||||
|
||||
string const lyx_gui::hexname(LColor::color col)
|
||||
{
|
||||
string const name = lcolor.getX11Name(col);
|
||||
Display * const display = fl_get_display();
|
||||
Colormap const cmap = fl_state[fl_get_vclass()].colormap;
|
||||
XColor xcol, ccol;
|
||||
|
||||
if (XLookupColor(display, cmap, name.c_str(), &xcol, &ccol) == 0) {
|
||||
lyxerr << "X can't find color \""
|
||||
<< lcolor.getLyXName(col)
|
||||
<< '"' << endl;
|
||||
return string();
|
||||
}
|
||||
|
||||
ostringstream os;
|
||||
|
||||
// Note that X stores the RGB values in the range 0 - 65535
|
||||
// whilst we require them in the range 0 - 255.
|
||||
os << setbase(16) << setfill('0')
|
||||
<< setw(2) << (xcol.red / 256)
|
||||
<< setw(2) << (xcol.green / 256)
|
||||
<< setw(2) << (xcol.blue / 256);
|
||||
|
||||
return STRCONV(os.str());
|
||||
}
|
||||
|
||||
|
||||
void lyx_gui::update_color(LColor::color col)
|
||||
{
|
||||
lyxColorHandler->updateColor(col);
|
||||
}
|
||||
|
||||
|
||||
void lyx_gui::update_fonts()
|
||||
{
|
||||
fontloader.update();
|
||||
}
|
||||
|
||||
|
||||
bool lyx_gui::font_available(LyXFont const & font)
|
||||
{
|
||||
return fontloader.available(font);
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
extern "C"
|
||||
void C_read_callback(int, void * data)
|
||||
{
|
||||
LyXComm * comm = static_cast<LyXComm *>(data);
|
||||
comm->read_ready();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void lyx_gui::set_read_callback(int fd, LyXComm * comm)
|
||||
{
|
||||
fl_add_io_callback(fd, FL_READ, C_read_callback, comm);
|
||||
}
|
||||
|
||||
|
||||
void lyx_gui::remove_read_callback(int fd)
|
||||
{
|
||||
fl_remove_io_callback(fd, FL_READ, C_read_callback);
|
||||
}
|
Loading…
Reference in New Issue
Block a user