From 6d49cbadf0ac3c5905bac7907422c61b0b4a9e3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20Gullik=20Bj=C3=B8nnes?= Date: Tue, 28 Oct 2003 16:45:09 +0000 Subject: [PATCH] gtk_patch_2003_10_28 git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7997 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/gtk/ChangeLog | 9 + src/frontends/gtk/Dialogs.C | 15 +- src/frontends/gtk/FileDialogPrivate.C | 6 +- src/frontends/gtk/GMathPanel.C | 328 ++++++++++++++ src/frontends/gtk/GMathPanel.h | 41 ++ src/frontends/gtk/GMenubar.C | 2 +- src/frontends/gtk/GPainter.C | 6 +- src/frontends/gtk/GTableCreate.C | 57 +++ src/frontends/gtk/GTableCreate.h | 31 ++ src/frontends/gtk/GUrl.C | 97 ++++ src/frontends/gtk/GUrl.h | 33 ++ src/frontends/gtk/GWorkArea.C | 4 +- src/frontends/gtk/Makefile.am | 16 +- src/frontends/gtk/codeConvert.h | 12 +- src/frontends/gtk/glade/.cvsignore | 1 + src/frontends/gtk/glade/mathPanel.glade | 525 ++++++++++++++++++++++ src/frontends/gtk/glade/search.glade | 278 ++++++++++++ src/frontends/gtk/glade/tableCreate.glade | 182 ++++++++ src/frontends/gtk/glade/url.glade | 268 +++++++++++ src/frontends/gtk/xftFontMetrics.C | 15 +- 20 files changed, 1894 insertions(+), 32 deletions(-) create mode 100644 src/frontends/gtk/GMathPanel.C create mode 100644 src/frontends/gtk/GMathPanel.h create mode 100644 src/frontends/gtk/GTableCreate.C create mode 100644 src/frontends/gtk/GTableCreate.h create mode 100644 src/frontends/gtk/GUrl.C create mode 100644 src/frontends/gtk/GUrl.h create mode 100644 src/frontends/gtk/glade/mathPanel.glade create mode 100644 src/frontends/gtk/glade/search.glade create mode 100644 src/frontends/gtk/glade/tableCreate.glade create mode 100644 src/frontends/gtk/glade/url.glade diff --git a/src/frontends/gtk/ChangeLog b/src/frontends/gtk/ChangeLog index 8ac73a75d5..04ae4f2c0b 100644 --- a/src/frontends/gtk/ChangeLog +++ b/src/frontends/gtk/ChangeLog @@ -1,3 +1,12 @@ +2003-10-28 Huang Ying + * 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 * lyx_gui.C (start): add lyxsocket. diff --git a/src/frontends/gtk/Dialogs.C b/src/frontends/gtk/Dialogs.C index e1dd28e6c8..9175bb64f2 100644 --- a/src/frontends/gtk/Dialogs.C +++ b/src/frontends/gtk/Dialogs.C @@ -57,7 +57,7 @@ #include "FormGraphics.h" #include "FormInclude.h" #include "FormLog.h" -#include "FormMathsPanel.h" +#include "GMathPanel.h" #include "FormMathsBitmap.h" #include "FormMathsDelim.h" #include "FormMathsMatrix.h" @@ -70,9 +70,9 @@ #include "FormTabular.h" #include "FormTexinfo.h" #include "FormShowFile.h" -#include "FormTabularCreate.h" +#include "GTableCreate.h" #include "FormToc.h" -#include "FormUrl.h" +#include "GUrl.h" #include "FormVCLog.h" #include "FormWrap.h" @@ -230,8 +230,9 @@ Dialog * Dialogs::build(string const & name) dialog->bc().bp(new OkCancelPolicy); } else if (name == "mathpanel") { + dialog->bc().view(new GBC(dialog->bc())); dialog->setController(new ControlMath(*dialog)); - dialog->setView(new FormMathsPanel(*dialog)); + dialog->setView(new GMathPanel(*dialog)); dialog->bc().bp(new IgnorantPolicy); } else if (name == "mathaccents") { @@ -435,8 +436,9 @@ Dialog * Dialogs::build(string const & name) dialog->setView(new FormTabular(*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 FormTabularCreate(*dialog)); + dialog->setView(new GTableCreate(*dialog)); dialog->bc().bp(new IgnorantPolicy); } else if (name == "texinfo") { dialog->setController(new ControlTexinfo(*dialog)); @@ -453,8 +455,9 @@ Dialog * Dialogs::build(string const & name) dialog->setView(new FormToc(*dialog)); dialog->bc().bp(new OkCancelPolicy); } else if (name == "url") { + dialog->bc().view(new GBC(dialog->bc())); dialog->setController(new ControlCommand(*dialog, name)); - dialog->setView(new FormUrl(*dialog)); + dialog->setView(new GUrl(*dialog)); dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy); } else if (name == "vclog") { dialog->setController(new ControlVCLog(*dialog)); diff --git a/src/frontends/gtk/FileDialogPrivate.C b/src/frontends/gtk/FileDialogPrivate.C index 01eee228e6..45ba6526c8 100644 --- a/src/frontends/gtk/FileDialogPrivate.C +++ b/src/frontends/gtk/FileDialogPrivate.C @@ -23,14 +23,14 @@ FileDialog::Private::Private(string const & title, action_(action) { fileSelection_.set_title(title); - fileSelection_.get_button_area()->children().push_back( +/* fileSelection_.get_button_area()->children().push_back( Gtk::Box_Helpers::Element(button1_)); fileSelection_.get_button_area()->children().push_back( Gtk::Box_Helpers::Element(button2_)); button1_.signal_clicked().connect( SigC::slot(*this, &FileDialog::Private::onButton1Clicked)); button2_.signal_clicked().connect( - SigC::slot(*this, &FileDialog::Private::onButton2Clicked)); + SigC::slot(*this, &FileDialog::Private::onButton2Clicked)); if (!b1.first.empty() && !b1.second.empty()) { string::size_type pos = b1.first.find('|'); button1_.set_label( @@ -44,7 +44,7 @@ FileDialog::Private::Private(string const & title, Glib::locale_to_utf8(b2.first.substr(0, pos))); dir2_ = b2.second; button2_.show(); - } + }*/ } diff --git a/src/frontends/gtk/GMathPanel.C b/src/frontends/gtk/GMathPanel.C new file mode 100644 index 0000000000..a610643dbe --- /dev/null +++ b/src/frontends/gtk/GMathPanel.C @@ -0,0 +1,328 @@ +/** + * \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 +#include + +#include + +#include "ControlMath.h" +#include "GMathPanel.h" +#include "support/filetools.h" +#include "support/lstrings.h" + +#include "deco.xpm" +#include "delim.xpm" +#include "equation.xpm" +#include "frac.xpm" +#include "matrix.xpm" +#include "space.xpm" +#include "style.xpm" +#include "sqrt.xpm" +#include "sub.xpm" +#include "super.xpm" + +using std::string; + +GMathPanel::GMathPanel(Dialog & parent) + : GViewCB(parent, _("Math Panel")) +{ +} + + +void GMathPanel::doBuild() +{ + string const gladeName = + lyx::support::LibFileSearch("glade", "mathPanel", "glade"); + xml_ = Gnome::Glade::Xml::create(gladeName); + Gtk::Button * close; + + //1 + Gtk::Button * sqrt; + Gtk::Button * frac; + Gtk::Button * delim; + Gtk::Button * deco; + Gtk::Button * space; + + //2 + Gtk::Button * super; + Gtk::Button * sub; + Gtk::Button * style; + Gtk::Button * matrix; + Gtk::Button * equation; + + //3 + Gtk::Button * boperator; + Gtk::Button * brelats; + Gtk::Button * arrow; + + //4 + Gtk::Button * varSize; + Gtk::Button * dots; + Gtk::Button * misc; + + //5 + Gtk::Button * greek; + Gtk::Button * amsArrows; + Gtk::Button * amsBrel; + + //6 + Gtk::Button * amsNrel; + Gtk::Button * amsOps; + Gtk::Button * amsMisc; + + xml_->get_widget("Close", close); + close->signal_clicked().connect( + SigC::slot(*this, &GViewBase::onCancel)); + + //1 + xml_->get_widget("Sqrt", sqrt); + xml_->get_widget("Frac", frac); + xml_->get_widget("Delim", delim); + xml_->get_widget("Deco", deco); + xml_->get_widget("Space", space); + + //2 + xml_->get_widget("Super", super); + xml_->get_widget("Sub", sub); + xml_->get_widget("Style", style); + xml_->get_widget("Matrix", matrix); + xml_->get_widget("Equation", equation); + + //3 + xml_->get_widget("Boperator", boperator); + xml_->get_widget("Brelate", brelats); + xml_->get_widget("Arrow", arrow); + + //4 + xml_->get_widget("VarSize", varSize); + xml_->get_widget("Dots", dots); + xml_->get_widget("Misc", misc); + + //5 + xml_->get_widget("Greek", greek); + xml_->get_widget("AmsArrow", amsArrows); + xml_->get_widget("AmsBrel", amsBrel); + + //6 + xml_->get_widget("AmsNrel", amsNrel); + xml_->get_widget("AmsOps", amsOps); + xml_->get_widget("AmsMisc", amsMisc); + + Glib::RefPtr mask; + Glib::RefPtr pixmap; + Glib::RefPtr clrmap = window()->get_colormap(); + + pixmap = Gdk::Pixmap::create_from_xpm(clrmap, mask, ::sqrt_xpm); + Gtk::Image * iSqrt = SigC::manage(new Gtk::Image(pixmap, mask)); + iSqrt->show(); + sqrt->add(*iSqrt); + + pixmap = Gdk::Pixmap::create_from_xpm(clrmap, mask, ::frac); + Gtk::Image * iFrac = SigC::manage(new Gtk::Image(pixmap, mask)); + iFrac->show(); + frac->add(*iFrac); + + pixmap = Gdk::Pixmap::create_from_xpm(clrmap, mask, ::delim); + Gtk::Image * iDelim = SigC::manage(new Gtk::Image(pixmap, mask)); + iDelim->show(); + delim->add(*iDelim); + + pixmap = Gdk::Pixmap::create_from_xpm(clrmap, mask, ::deco); + Gtk::Image * iDeco = SigC::manage(new Gtk::Image(pixmap, mask)); + iDeco->show(); + deco->add(*iDeco); + + pixmap = Gdk::Pixmap::create_from_xpm(clrmap, mask, ::space_xpm); + Gtk::Image * iSpace = SigC::manage(new Gtk::Image(pixmap, mask)); + iSpace->show(); + space->add(*iSpace); + + pixmap = Gdk::Pixmap::create_from_xpm(clrmap, mask, ::super_xpm); + Gtk::Image * iSuper = SigC::manage(new Gtk::Image(pixmap, mask)); + iSuper->show(); + super->add(*iSuper); + + pixmap = Gdk::Pixmap::create_from_xpm(clrmap, mask, ::sub_xpm); + Gtk::Image * iSub = SigC::manage(new Gtk::Image(pixmap, mask)); + iSub->show(); + sub->add(*iSub); + + pixmap = Gdk::Pixmap::create_from_xpm(clrmap, mask, ::style_xpm); + Gtk::Image * iStyle = SigC::manage(new Gtk::Image(pixmap, mask)); + iStyle->show(); + style->add(*iStyle); + + pixmap = Gdk::Pixmap::create_from_xpm(clrmap, mask, ::matrix); + Gtk::Image * iMatrix = SigC::manage(new Gtk::Image(pixmap, mask)); + iMatrix->show(); + matrix->add(*iMatrix); + + pixmap = Gdk::Pixmap::create_from_xpm(clrmap, mask, ::equation); + Gtk::Image * iEquation = SigC::manage(new Gtk::Image(pixmap, mask)); + iEquation->show(); + equation->add(*iEquation); + + arrow->signal_clicked().connect( + SigC::bind( + SigC::slot(*this, + &GMathPanel::onShowDialog), + "matharrows")); + deco->signal_clicked().connect( + SigC::bind( + SigC::slot(*this, + &GMathPanel::onShowDialog), + "mathaccents")); + boperator->signal_clicked().connect( + SigC::bind( + SigC::slot(*this, + &GMathPanel::onShowDialog), + "mathoperators")); + brelats->signal_clicked().connect( + SigC::bind( + SigC::slot(*this, + &GMathPanel::onShowDialog), + "mathrelations")); + greek->signal_clicked().connect( + SigC::bind( + SigC::slot(*this, + &GMathPanel::onShowDialog), + "mathgreek")); + misc->signal_clicked().connect( + SigC::bind( + SigC::slot(*this, + &GMathPanel::onShowDialog), + "mathmisc")); + dots->signal_clicked().connect( + SigC::bind( + SigC::slot(*this, + &GMathPanel::onShowDialog), + "mathdots")); + varSize->signal_clicked().connect( + SigC::bind( + SigC::slot(*this, + &GMathPanel::onShowDialog), + "mathbigoperators")); + amsMisc->signal_clicked().connect( + SigC::bind( + SigC::slot(*this, + &GMathPanel::onShowDialog), + "mathamsmisc")); + amsArrows->signal_clicked().connect( + SigC::bind( + SigC::slot(*this, + &GMathPanel::onShowDialog), + "mathamsarrows")); + amsBrel->signal_clicked().connect( + SigC::bind( + SigC::slot(*this, + &GMathPanel::onShowDialog), + "mathamsrelations")); + amsNrel->signal_clicked().connect( + SigC::bind( + SigC::slot(*this, + &GMathPanel::onShowDialog), + "mathamsnegatedrelations")); + amsOps->signal_clicked().connect( + SigC::bind( + SigC::slot(*this, + &GMathPanel::onShowDialog), + "mathamsoperators")); + delim->signal_clicked().connect( + SigC::bind( + SigC::slot(*this, + &GMathPanel::onShowDialog), + "mathdelimiter")); + matrix->signal_clicked().connect( + SigC::bind( + SigC::slot(*this, + &GMathPanel::onShowDialog), + "mathmatrix")); + space->signal_clicked().connect( + SigC::bind( + SigC::slot(*this, + &GMathPanel::onShowDialog), + "mathspace")); + style->signal_clicked().connect( + SigC::bind( + SigC::slot(*this, + &GMathPanel::onShowDialog), + "mathstyle")); + + super->signal_clicked().connect( + SigC::slot(*this, &GMathPanel::onSuperClicked)); + sub->signal_clicked().connect( + SigC::slot(*this, &GMathPanel::onSubClicked)); + equation->signal_clicked().connect( + SigC::slot(*this, &GMathPanel::onEquationClicked)); + + frac->signal_clicked().connect( + SigC::bind( + SigC::slot(*this, + &GMathPanel::onInsert), + "frac")); + sqrt->signal_clicked().connect( + SigC::bind( + SigC::slot(*this, + &GMathPanel::onInsert), + "sqrt")); + + // 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::slot(*this, &GMathPanel::onFunctionSelected)); + for (int i = 0; i < nr_function_names; ++i) + (*listStore_->append())[listCol_] = + Glib::locale_to_utf8(function_names[i]); +} + + +void GMathPanel::onFunctionSelected() +{ + Gtk::TreeModel::iterator it = listSel_->get_selected(); + Glib::ustring sel = (*it)[listCol_]; + controller().dispatchInsert( + Glib::locale_from_utf8(sel)); +} + + +void GMathPanel::onShowDialog(char const * dialogName) +{ + controller().showDialog(dialogName); +} + + +void GMathPanel::onSuperClicked() +{ + controller().dispatchSuperscript(); +} + + +void GMathPanel::onSubClicked() +{ + controller().dispatchSubscript(); +} + + +void GMathPanel::onEquationClicked() +{ + controller().dispatchToggleDisplay(); +} + + +void GMathPanel::onInsert(char const * what) +{ + controller().dispatchInsert(what); +} diff --git a/src/frontends/gtk/GMathPanel.h b/src/frontends/gtk/GMathPanel.h new file mode 100644 index 0000000000..9669700c42 --- /dev/null +++ b/src/frontends/gtk/GMathPanel.h @@ -0,0 +1,41 @@ +// -*- 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 "support/lstrings.h" + +class ControlMath; + +class GMathPanel : public GViewCB +{ +public: + GMathPanel(Dialog & parent); +private: + virtual void apply() {} + virtual void update() {} + virtual void doBuild(); + void onShowDialog(char const * dialogName); + void onSuperClicked(); + void onSubClicked(); + void onEquationClicked(); + void onInsert(char const * what); + void onFunctionSelected(); + Gtk::TreeView * functions_; + Gtk::TreeModelColumn listCol_; + Gtk::TreeModel::ColumnRecord listCols_; + Glib::RefPtr listStore_; + Glib::RefPtr listSel_; +}; + +#endif diff --git a/src/frontends/gtk/GMenubar.C b/src/frontends/gtk/GMenubar.C index 54c295d683..91c7c90022 100644 --- a/src/frontends/gtk/GMenubar.C +++ b/src/frontends/gtk/GMenubar.C @@ -153,7 +153,7 @@ bool GMenubar::submenuDisabled(MenuItem const * item) void GMenubar::onSubMenuActivate(MenuItem const * item, - Gtk::MenuItem * gitem) + Gtk::MenuItem * gitem) { Gtk::Menu * gmenu = gitem->get_submenu(); ClearMenu(gmenu); diff --git a/src/frontends/gtk/GPainter.C b/src/frontends/gtk/GPainter.C index f91c0c35e3..e57e388691 100644 --- a/src/frontends/gtk/GPainter.C +++ b/src/frontends/gtk/GPainter.C @@ -232,7 +232,7 @@ Painter & GPainter::text(int x, int y, wchar_t const * s, int ls, XftDraw * draw = owner_.getXftDraw(); if (f.realShape() != LyXFont::SMALLCAPS_SHAPE) { XftDrawString32(draw, xftClr, font, x, y, - wcsToFcChar32StrFast(s), ls); + wcsToXftChar32StrFast(s), ls); } else { LyXFont smallfont(f); smallfont.decSize().decSize().setShape(LyXFont::UP_SHAPE); @@ -243,11 +243,11 @@ Painter & GPainter::text(int x, int y, wchar_t const * s, int ls, c = lyx::support::uppercase(s[i]); if(c != s[i]) { XftDrawString32(draw, xftClr, fontS, tmpx, y, - wcsToFcChar32StrFast(&c), 1); + wcsToXftChar32StrFast(&c), 1); tmpx += font_metrics::width(c, smallfont); } else { XftDrawString32(draw, xftClr, font, tmpx, y, - wcsToFcChar32StrFast(&c), 1); + wcsToXftChar32StrFast(&c), 1); tmpx += font_metrics::width(c, f); } } diff --git a/src/frontends/gtk/GTableCreate.C b/src/frontends/gtk/GTableCreate.C new file mode 100644 index 0000000000..1f6dff4738 --- /dev/null +++ b/src/frontends/gtk/GTableCreate.C @@ -0,0 +1,57 @@ +/** + * \file GTableCreate.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 +#include + +#include + +#include "ControlTabularCreate.h" +#include "GTableCreate.h" +#include "support/filetools.h" +#include "support/lstrings.h" + +using std::string; + +GTableCreate::GTableCreate(Dialog & parent) + : GViewCB(parent, _("Insert Table")) +{ +} + +void GTableCreate::doBuild() +{ + string const gladeName = + lyx::support::LibFileSearch("glade", "tableCreate", "glade"); + xml_ = Gnome::Glade::Xml::create(gladeName); + Gtk::Button * ok; + Gtk::Button * apply; + Gtk::Button * cancel; + xml_->get_widget("Ok", ok); + xml_->get_widget("Apply", apply); + xml_->get_widget("Cancel", cancel); + xml_->get_widget("Rows", rows_); + xml_->get_widget("Columns", columns_); + bcview().setOK(ok); + bcview().setCancel(cancel); + bcview().setApply(apply); + ok->signal_clicked().connect( + SigC::slot(*this, &GViewBase::onOK)); + apply->signal_clicked().connect( + SigC::slot(*this, &GViewBase::onApply)); + cancel->signal_clicked().connect( + SigC::slot(*this, &GViewBase::onCancel)); +} + +void GTableCreate::apply() +{ + int rows = rows_->get_value_as_int(); + int columns = columns_->get_value_as_int(); + controller().params() = std::make_pair(columns, rows); +} diff --git a/src/frontends/gtk/GTableCreate.h b/src/frontends/gtk/GTableCreate.h new file mode 100644 index 0000000000..745c0598eb --- /dev/null +++ b/src/frontends/gtk/GTableCreate.h @@ -0,0 +1,31 @@ +// -*- C++ -*- +/** + * \file GTableCreate.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 GTABLE_CREATE_H +#define GTABLE_CREATE_H + +#include "GViewBase.h" + +class ControlTableCreate; + +class GTableCreate : public GViewCB +{ +public: + GTableCreate(Dialog & parent); +private: + virtual void apply(); + virtual void doBuild(); + virtual void update() {}; + Gtk::SpinButton *rows_; + Gtk::SpinButton *columns_; +}; + +#endif diff --git a/src/frontends/gtk/GUrl.C b/src/frontends/gtk/GUrl.C new file mode 100644 index 0000000000..b02205994a --- /dev/null +++ b/src/frontends/gtk/GUrl.C @@ -0,0 +1,97 @@ +/** + * \file GUrl.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 +#include + +#include + +#include "ControlCommand.h" +#include "GUrl.h" +#include "support/filetools.h" +#include "support/lstrings.h" + +using std::string; + +GUrl::GUrl(Dialog & parent) + : GViewCB(parent, _("URL")) +{ +} + + +void GUrl::doBuild() +{ + string const gladeName = + lyx::support::LibFileSearch("glade", "url", "glade"); + xml_ = Gnome::Glade::Xml::create(gladeName); + Gtk::Button * restore; + Gtk::Button * ok; + Gtk::Button * apply; + Gtk::Button * cancel; + xml_->get_widget("Url", url_); + xml_->get_widget("Name", name_); + xml_->get_widget("Html", htmlType_); + xml_->get_widget("Restore", restore); + xml_->get_widget("Ok", ok); + xml_->get_widget("Apply", apply); + xml_->get_widget("Cancel", cancel); + bcview().setOK(ok); + bcview().setCancel(cancel); + bcview().setApply(apply); + bcview().setRestore(restore); + bcview().addReadOnly(name_); + bcview().addReadOnly(url_); + bcview().addReadOnly(htmlType_); + + ok->signal_clicked().connect( + SigC::slot(*this, &GViewBase::onOK)); + apply->signal_clicked().connect( + SigC::slot(*this, &GViewBase::onApply)); + cancel->signal_clicked().connect( + SigC::slot(*this, &GViewBase::onCancel)); + restore->signal_clicked().connect( + SigC::slot(*this, &GViewBase::onRestore)); + url_->signal_changed().connect( + SigC::slot(*this, &GUrl::onEntryChanged)); + name_->signal_changed().connect( + SigC::slot(*this, &GUrl::onEntryChanged)); +} + + +void GUrl::onEntryChanged() +{ + bc().valid(!url_->get_text().empty() || !name_->get_text().empty()); +} + + +void GUrl::update() +{ + url_->set_text(Glib::locale_to_utf8( + controller().params().getContents())); + name_->set_text(Glib::locale_to_utf8( + controller().params().getOptions())); + if (controller().params().getCmdName() == "url") + htmlType_->set_active(false); + else + htmlType_->set_active(); +} + + +void GUrl::apply() +{ + controller().params().setContents( + Glib::locale_to_utf8(url_->get_text())); + controller().params().setOptions( + Glib::locale_to_utf8(name_->get_text())); + if (htmlType_->get_active()) + controller().params().setCmdName("htmlurl"); + else + controller().params().setCmdName("url"); +} diff --git a/src/frontends/gtk/GUrl.h b/src/frontends/gtk/GUrl.h new file mode 100644 index 0000000000..f6b493b5c2 --- /dev/null +++ b/src/frontends/gtk/GUrl.h @@ -0,0 +1,33 @@ +// -*- C++ -*- +/** + * \file GUrl.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 GURL_H +#define GURL_H + +#include "GViewBase.h" + +class ControlCommand; + +class GUrl : public GViewCB +{ +public: + GUrl(Dialog & parent); +private: + virtual void apply(); + virtual void doBuild(); + virtual void update(); + void onEntryChanged(); + Gtk::Entry * url_; + Gtk::Entry * name_; + Gtk::CheckButton * htmlType_; +}; + +#endif diff --git a/src/frontends/gtk/GWorkArea.C b/src/frontends/gtk/GWorkArea.C index dd5941c6fc..ff57cd0460 100644 --- a/src/frontends/gtk/GWorkArea.C +++ b/src/frontends/gtk/GWorkArea.C @@ -82,7 +82,9 @@ XftColor * ColorHandler::getXftColor(LColor_color clr) Visual * visual = GDK_VISUAL_XVISUAL( owner_.getColormap()->get_visual()->gobj()); XftColorAllocName(owner_.getDisplay(), visual, colormap, - lcolor.getX11Name(clr).c_str(), xclr); + const_cast( + lcolor.getX11Name(clr).c_str()) + , xclr); colorCache.cacheXftColor(clr, xclr); } return xclr; diff --git a/src/frontends/gtk/Makefile.am b/src/frontends/gtk/Makefile.am index 41dda25ace..6802faa365 100644 --- a/src/frontends/gtk/Makefile.am +++ b/src/frontends/gtk/Makefile.am @@ -42,6 +42,8 @@ libgtk_la_SOURCES = \ Alert_pimpl.C \ GView.h \ GView.C \ + IdSc.h \ + IdSc.C \ Dialogs.C \ GAboutlyx.h \ GAboutlyx.C \ @@ -54,8 +56,12 @@ libgtk_la_SOURCES = \ FileDialog.C \ GText.h \ GText.C \ - IdSc.h \ - IdSc.C + GUrl.h \ + GUrl.C \ + GTableCreate.h \ + GTableCreate.C \ + GMathPanel.h \ + GMathPanel.C # GPrint.h # GPrint.C @@ -90,7 +96,6 @@ xforms_objects = \ ../xforms/FormMathsBitmap.lo \ ../xforms/FormMathsDelim.lo \ ../xforms/FormMathsMatrix.lo \ - ../xforms/FormMathsPanel.lo \ ../xforms/FormMathsSpace.lo \ ../xforms/FormMathsStyle.lo \ ../xforms/FormMinipage.lo \ @@ -105,13 +110,11 @@ xforms_objects = \ ../xforms/forms_gettext.lo \ ../xforms/FormShowFile.lo \ ../xforms/FormSpellchecker.lo \ - ../xforms/FormTabularCreate.lo \ ../xforms/FormTabular.lo \ ../xforms/FormTexinfo.lo \ ../xforms/FormText.lo \ ../xforms/FormThesaurus.lo \ ../xforms/FormToc.lo \ - ../xforms/FormUrl.lo \ ../xforms/FormVCLog.lo \ ../xforms/FormWrap.lo \ ../xforms/freebrowser.lo \ @@ -127,6 +130,9 @@ xforms_objects = \ # ../xforms/FormFiledialog.lo # ../xforms/FileDialog.lo # ../xforms/FormAboutlyx.lo +# ../xforms/FormUrl.lo +# ../xforms/FormTabularCreate.lo +# ../xforms/FormMathsPanel.lo xforms.lo: $(xforms_objects) ../xforms/forms/*.lo $(CXXLINK) $(xforms_objects) ../xforms/forms/*.lo diff --git a/src/frontends/gtk/codeConvert.h b/src/frontends/gtk/codeConvert.h index 98a8c432d5..bba08aae8f 100644 --- a/src/frontends/gtk/codeConvert.h +++ b/src/frontends/gtk/codeConvert.h @@ -15,21 +15,21 @@ #include -inline FcChar32 * wcsToFcChar32StrFast(wchar_t * wcs) +inline XftChar32 * wcsToXftChar32StrFast(wchar_t * wcs) { - return reinterpret_cast(wcs); + return reinterpret_cast(wcs); } -inline FcChar32 const * wcsToFcChar32StrFast(wchar_t const * wcs) +inline XftChar32 * wcsToXftChar32StrFast(wchar_t const * wcs) { - return reinterpret_cast(wcs); + return reinterpret_cast(const_cast(wcs)); } -inline FcChar32 wcToFcChar32(wchar_t wc) +inline XftChar32 wcToXftChar32(wchar_t wc) { - return static_cast(wc); + return static_cast(wc); } diff --git a/src/frontends/gtk/glade/.cvsignore b/src/frontends/gtk/glade/.cvsignore index 3dda72986f..bdca118a2b 100644 --- a/src/frontends/gtk/glade/.cvsignore +++ b/src/frontends/gtk/glade/.cvsignore @@ -1,2 +1,3 @@ Makefile.in Makefile +*.gladep diff --git a/src/frontends/gtk/glade/mathPanel.glade b/src/frontends/gtk/glade/mathPanel.glade new file mode 100644 index 0000000000..8095ceeb5c --- /dev/null +++ b/src/frontends/gtk/glade/mathPanel.glade @@ -0,0 +1,525 @@ + + + + + + + True + LyX: Math Panel + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False + False + False + + + + 5 + True + False + 10 + + + + True + False + 20 + + + + True + 2 + 5 + True + 0 + 0 + + + + True + True + GTK_RELIEF_NORMAL + + + + + + + 4 + 5 + 1 + 2 + + + + + + True + True + GTK_RELIEF_NORMAL + + + + + + + 3 + 4 + 1 + 2 + + + + + + True + True + GTK_RELIEF_NORMAL + + + + + + + 2 + 3 + 1 + 2 + + + + + + True + True + GTK_RELIEF_NORMAL + + + + + + + 1 + 2 + 1 + 2 + + + + + + True + True + GTK_RELIEF_NORMAL + + + + + + + 0 + 1 + 1 + 2 + + + + + + True + True + GTK_RELIEF_NORMAL + + + + + + + 0 + 1 + 0 + 1 + + + + + + True + True + GTK_RELIEF_NORMAL + + + + + + + 1 + 2 + 0 + 1 + + + + + + True + True + GTK_RELIEF_NORMAL + + + + + + + 2 + 3 + 0 + 1 + + + + + + True + True + GTK_RELIEF_NORMAL + + + + + + + 3 + 4 + 0 + 1 + + + + + + True + True + GTK_RELIEF_NORMAL + + + + + + + 4 + 5 + 0 + 1 + + + + + 0 + True + True + + + + + + True + 4 + 3 + True + 0 + 0 + + + + True + True + +* + True + GTK_RELIEF_NORMAL + + + 0 + 1 + 0 + 1 + + + + + + True + True + <- + True + GTK_RELIEF_NORMAL + + + 1 + 2 + 0 + 1 + + + + + + True + True + |- + True + GTK_RELIEF_NORMAL + + + 2 + 3 + 0 + 1 + + + + + + True + True + Dots + True + GTK_RELIEF_NORMAL + + + 1 + 2 + 1 + 2 + + + + + + True + True + Misc + True + GTK_RELIEF_NORMAL + + + 2 + 3 + 1 + 2 + + + + + + True + True + Rpeek + True + GTK_RELIEF_NORMAL + + + 0 + 1 + 2 + 3 + + + + + + True + True + |- + True + GTK_RELIEF_NORMAL + + + 1 + 2 + 2 + 3 + + + + + + True + True + <= + True + GTK_RELIEF_NORMAL + + + 2 + 3 + 2 + 3 + + + + + + True + True + +* + True + GTK_RELIEF_NORMAL + + + 1 + 2 + 3 + 4 + + + + + + True + True + Misc + True + GTK_RELIEF_NORMAL + + + 2 + 3 + 3 + 4 + + + + + + True + True + !(<>) + True + GTK_RELIEF_NORMAL + + + 0 + 1 + 3 + 4 + fill + + + + + + + True + True + Ef + True + GTK_RELIEF_NORMAL + + + 0 + 1 + 1 + 2 + fill + + + + + + 0 + True + True + + + + + 0 + True + True + + + + + + True + False + 3 + + + + True + Functions: + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + 3 + True + True + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_SHADOW_NONE + GTK_CORNER_TOP_LEFT + + + + True + True + False + False + False + True + + + + + 0 + True + True + + + + + + True + True + True + True + gtk-close + True + GTK_RELIEF_NORMAL + + + 0 + False + False + + + + + 0 + True + True + + + + + + + diff --git a/src/frontends/gtk/glade/search.glade b/src/frontends/gtk/glade/search.glade new file mode 100644 index 0000000000..8f113fc4cc --- /dev/null +++ b/src/frontends/gtk/glade/search.glade @@ -0,0 +1,278 @@ + + + + + + + True + LyX: Find and Replace + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False + True + False + + + + 5 + True + 4 + 3 + False + 2 + 2 + + + + True + Find: + False + False + GTK_JUSTIFY_RIGHT + False + False + 0 + 0.5 + 0 + 0 + + + 0 + 1 + 0 + 1 + fill + + + + + + + True + Replace with: + False + False + GTK_JUSTIFY_RIGHT + False + False + 0 + 0.5 + 0 + 0 + + + 0 + 1 + 1 + 2 + fill + + + + + + + True + True + True + True + 0 + + True + * + False + + + 1 + 2 + 0 + 1 + + + + + + + True + True + True + True + 0 + + True + * + False + + + 1 + 2 + 1 + 2 + + + + + + + True + True + True + True + Find next + True + GTK_RELIEF_NORMAL + + + 2 + 3 + 0 + 1 + fill + + + + + + + True + True + _Replace + True + GTK_RELIEF_NORMAL + + + 2 + 3 + 1 + 2 + fill + + + + + + + True + True + Repl_ace all + True + GTK_RELIEF_NORMAL + + + 2 + 3 + 2 + 3 + fill + + + + + + + True + True + Cancel + True + GTK_RELIEF_NORMAL + + + 2 + 3 + 3 + 4 + fill + + + + + + + True + False + 0 + + + + True + True + _Case sensitive + True + GTK_RELIEF_NORMAL + False + False + True + + + 0 + False + False + + + + + + True + True + _Match word + True + GTK_RELIEF_NORMAL + False + False + True + + + 0 + False + False + + + + + 0 + 2 + 2 + 3 + fill + fill + + + + + + True + False + 0 + + + + True + True + _Search backwards + True + GTK_RELIEF_NORMAL + False + False + True + + + 0 + False + False + + + + + 0 + 2 + 3 + 4 + fill + fill + + + + + + + diff --git a/src/frontends/gtk/glade/tableCreate.glade b/src/frontends/gtk/glade/tableCreate.glade new file mode 100644 index 0000000000..86fc0dc432 --- /dev/null +++ b/src/frontends/gtk/glade/tableCreate.glade @@ -0,0 +1,182 @@ + + + + + + + True + LyX: Insert Table + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False + False + False + True + + + + True + False + 0 + + + + True + GTK_BUTTONBOX_END + + + + True + True + True + True + gtk-ok + True + GTK_RELIEF_NORMAL + -5 + + + + + + True + True + True + gtk-apply + True + GTK_RELIEF_NORMAL + -10 + + + + + + True + True + True + gtk-cancel + True + GTK_RELIEF_NORMAL + -6 + + + + + 0 + False + True + GTK_PACK_END + + + + + + 5 + True + 2 + 2 + False + 5 + 5 + + + + True + Rows: + False + False + GTK_JUSTIFY_RIGHT + False + False + 0 + 0.5 + 0 + 0 + + + 0 + 1 + 0 + 1 + fill + + + + + + + True + Columns: + False + False + GTK_JUSTIFY_RIGHT + False + False + 0 + 0.5 + 0 + 0 + + + 0 + 1 + 1 + 2 + fill + + + + + + + True + True + 1 + 0 + False + GTK_UPDATE_ALWAYS + False + False + 5 0 100 1 10 10 + + + 1 + 2 + 0 + 1 + + + + + + + True + True + 1 + 0 + False + GTK_UPDATE_ALWAYS + False + False + 5 0 100 1 10 10 + + + 1 + 2 + 1 + 2 + + + + + + 0 + True + True + + + + + + + diff --git a/src/frontends/gtk/glade/url.glade b/src/frontends/gtk/glade/url.glade new file mode 100644 index 0000000000..2c74ac6db3 --- /dev/null +++ b/src/frontends/gtk/glade/url.glade @@ -0,0 +1,268 @@ + + + + + + + True + LyX: URL + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False + False + False + True + + + + True + False + 0 + + + + True + GTK_BUTTONBOX_END + + + + True + True + True + GTK_RELIEF_NORMAL + 0 + + + + True + 0.5 + 0.5 + 0 + 0 + + + + True + False + 2 + + + + True + gtk-undo + 4 + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + True + _Restore + True + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + + + + + + + True + True + True + gtk-ok + True + GTK_RELIEF_NORMAL + -5 + + + + + + True + True + True + gtk-apply + True + GTK_RELIEF_NORMAL + -10 + + + + + + True + True + True + gtk-cancel + True + GTK_RELIEF_NORMAL + -6 + + + + + 0 + False + True + GTK_PACK_END + + + + + + 5 + True + 3 + 2 + False + 5 + 5 + + + + True + True + _HTML type + True + GTK_RELIEF_NORMAL + False + False + True + + + 1 + 2 + 0 + 1 + fill + + + + + + + True + True + True + True + 0 + + True + * + False + + + 1 + 2 + 1 + 2 + + + + + + + True + True + True + True + 0 + + True + * + False + + + 1 + 2 + 2 + 3 + + + + + + + True + URL: + False + False + GTK_JUSTIFY_RIGHT + False + False + 0 + 0.5 + 0 + 0 + + + 0 + 1 + 1 + 2 + fill + + + + + + + True + Name: + False + False + GTK_JUSTIFY_RIGHT + False + False + 0 + 0.5 + 0 + 0 + + + 0 + 1 + 2 + 3 + fill + + + + + + 0 + True + True + + + + + + + diff --git a/src/frontends/gtk/xftFontMetrics.C b/src/frontends/gtk/xftFontMetrics.C index 068af20f6c..f95aff0c78 100644 --- a/src/frontends/gtk/xftFontMetrics.C +++ b/src/frontends/gtk/xftFontMetrics.C @@ -101,7 +101,7 @@ int ascent(wchar_t c,LyXFont const & f) XftFont * font = getXftFont(f); XGlyphInfo glyph; XftTextExtents32(getDisplay(), font, - wcsToFcChar32StrFast(&c), + wcsToXftChar32StrFast(&c), 1, &glyph); return XGlyphAscent(glyph); @@ -119,7 +119,7 @@ int descent(wchar_t c,LyXFont const & f) XftFont * font = getXftFont(f); XGlyphInfo glyph; XftTextExtents32(getDisplay(), font, - wcsToFcChar32StrFast(&c), + wcsToXftChar32StrFast(&c), 1, &glyph); return XGlyphDescent(glyph); @@ -137,7 +137,7 @@ int lbearing(wchar_t c,LyXFont const & f) XftFont * font = getXftFont(f); XGlyphInfo glyph; XftTextExtents32(getDisplay(), font, - wcsToFcChar32StrFast(&c), + wcsToXftChar32StrFast(&c), 1, &glyph); return XGlyphLbearing(glyph); @@ -149,7 +149,7 @@ int rbearing(wchar_t c,LyXFont const & f) XftFont * font = getXftFont(f); XGlyphInfo glyph; XftTextExtents32(getDisplay(), font, - wcsToFcChar32StrFast(&c), + wcsToXftChar32StrFast(&c), 1, &glyph); return XGlyphRbearing(glyph); @@ -174,7 +174,8 @@ int width(wchar_t const * s, size_t n, LyXFont const & f) XGlyphInfo glyph; if (f.realShape() != LyXFont::SMALLCAPS_SHAPE){ XftTextExtents32(getDisplay(), font, - wcsToFcChar32StrFast(s), + const_cast( + wcsToXftChar32StrFast(s)), n, &glyph); return XGlyphLogWidth(glyph); @@ -187,13 +188,13 @@ int width(wchar_t const * s, size_t n, LyXFont const & f) wchar_t wc = lyx::support::uppercase(s[i]); if (wc != s[i]) { XftTextExtents32(getDisplay(), fontS, - wcsToFcChar32StrFast(&wc), + wcsToXftChar32StrFast(&wc), 1, &glyph); result += XGlyphLogWidth(glyph); } else { XftTextExtents32(getDisplay(), font, - wcsToFcChar32StrFast(&wc), + wcsToXftChar32StrFast(&wc), 1, &glyph); result += XGlyphLogWidth(glyph);