WS changes

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9008 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2004-09-26 13:18:29 +00:00
parent e0a50d3fb8
commit 66e8220540
44 changed files with 212 additions and 185 deletions

View File

@ -1,3 +1,7 @@
2004-09-26 Lars Gullik Bjonnes <larsbj@gullik.net>
* WS changes.
2004-09-25 John Spray <spray_john@users.sourceforge.net> 2004-09-25 John Spray <spray_john@users.sourceforge.net>
* GPrint.C: minor fixes to make it compile and work, get rid of * GPrint.C: minor fixes to make it compile and work, get rid of

View File

@ -15,8 +15,7 @@
#include <gtkmm.h> #include <gtkmm.h>
#include "frontends/FileDialog.h" #include "frontends/FileDialog.h"
class FileDialog::Private : public SigC::Object class FileDialog::Private : public SigC::Object {
{
public: public:
Private(std::string const & title, Private(std::string const & title,
kb_action action, kb_action action,

View File

@ -19,8 +19,7 @@ namespace frontend {
class ControlAboutlyx; class ControlAboutlyx;
class GAboutlyx : public GViewCB<ControlAboutlyx, GViewGladeB> class GAboutlyx : public GViewCB<ControlAboutlyx, GViewGladeB> {
{
public: public:
GAboutlyx(Dialog &); GAboutlyx(Dialog &);
private: private:

View File

@ -21,8 +21,7 @@
namespace lyx { namespace lyx {
namespace frontend { namespace frontend {
class GBC : public GuiBC<Gtk::Button, Gtk::Widget> class GBC : public GuiBC<Gtk::Button, Gtk::Widget> {
{
public: public:
GBC(ButtonController const & parent, GBC(ButtonController const & parent,
std::string const & cancel = _("Cancel"), std::string const & cancel = _("Cancel"),

View File

@ -14,8 +14,7 @@
#include "frontends/LyXKeySym.h" #include "frontends/LyXKeySym.h"
class GLyXKeySym : public LyXKeySym class GLyXKeySym : public LyXKeySym {
{
public: public:
GLyXKeySym(); GLyXKeySym();
GLyXKeySym(unsigned int keyval); GLyXKeySym(unsigned int keyval);

View File

@ -32,6 +32,7 @@ namespace
enum enumDelimType {LEFT, RIGHT, SINGLE}; enum enumDelimType {LEFT, RIGHT, SINGLE};
int const delimType[] = { int const delimType[] = {
//row 1 //row 1
LEFT, RIGHT, LEFT, RIGHT, SINGLE, SINGLE, LEFT, RIGHT,LEFT, RIGHT, LEFT, RIGHT, LEFT, RIGHT, SINGLE, SINGLE, LEFT, RIGHT,LEFT, RIGHT,
@ -41,11 +42,13 @@ int const delimType[] = {
SINGLE SINGLE
}; };
int const delimRevert[] = { int const delimRevert[] = {
1,0,3,2,4,5,7,6,9,8,10,11, 1,0,3,2,4,5,7,6,9,8,10,11,
13,12,15,14,16,17,19,18,20,21,22 13,12,15,14,16,17,19,18,20,21,22
}; };
char const * delimValues[] = { char const * delimValues[] = {
"(", ")", "lceil", "rceil", "uparrow", "Uparrow", "(", ")", "lceil", "rceil", "uparrow", "Uparrow",
"[", "]", "lfloor", "rfloor", "updownarrow", "Updownarrow", "[", "]", "lfloor", "rfloor", "updownarrow", "Updownarrow",
@ -59,6 +62,7 @@ int const delimTblCols = 12;
int const delimMax = 23; int const delimMax = 23;
GXpmBtnTbl::XbmData xbm = GXpmBtnTbl::XbmData xbm =
{ {
delim_bits, delim_bits,
@ -67,16 +71,19 @@ GXpmBtnTbl::XbmData xbm =
{0, 0, 0, 65535} {0, 0, 0, 65535}
}; };
inline int index(int row, int col) inline int index(int row, int col)
{ {
return row * delimTblCols + col; return row * delimTblCols + col;
} }
inline int indexToRow(int index) inline int indexToRow(int index)
{ {
return index / delimTblCols; return index / delimTblCols;
} }
inline int indexToCol(int index) inline int indexToCol(int index)
{ {
return index % delimTblCols; return index % delimTblCols;
@ -84,6 +91,7 @@ inline int indexToCol(int index)
} }
GMathDelim::GMathDelim(Dialog & parent) : GMathDelim::GMathDelim(Dialog & parent) :
GViewCB<ControlMath, GViewGladeB>(parent, _("Math Delimiters")), GViewCB<ControlMath, GViewGladeB>(parent, _("Math Delimiters")),
delimTbl_(delimTblRows, delimTblCols, xbm) delimTbl_(delimTblRows, delimTblCols, xbm)

View File

@ -21,8 +21,7 @@ namespace frontend {
class ControlMath; class ControlMath;
class GMathDelim : public GViewCB<ControlMath, GViewGladeB> class GMathDelim : public GViewCB<ControlMath, GViewGladeB> {
{
public: public:
GMathDelim(Dialog & parent); GMathDelim(Dialog & parent);
private: private:

View File

@ -58,6 +58,7 @@ char const * infoUp[][5] =
{0, 0, "mathstyle", "mathmatrix", 0} {0, 0, "mathstyle", "mathmatrix", 0}
}; };
GXpmBtnTbl::XpmData xpmUp[] = GXpmBtnTbl::XpmData xpmUp[] =
{ {
//row 1 //row 1
@ -66,6 +67,7 @@ GXpmBtnTbl::XpmData xpmUp[] =
super_xpm, sub_xpm, style_xpm, matrix, equation super_xpm, sub_xpm, style_xpm, matrix, equation
}; };
char const * infoDown[][3] = char const * infoDown[][3] =
{ {
//row 1 //row 1
@ -78,6 +80,7 @@ char const * infoDown[][3] =
{"mathamsnegatedrelations", "mathamsoperators", "mathamsmisc"} {"mathamsnegatedrelations", "mathamsoperators", "mathamsmisc"}
}; };
GXpmBtnTbl::XpmData xpmDown[] = GXpmBtnTbl::XpmData xpmDown[] =
{ {
//row 1 //row 1

View File

@ -21,8 +21,7 @@ namespace frontend {
class ControlMath; class ControlMath;
class GMathPanel : public GViewCB<ControlMath, GViewGladeB> class GMathPanel : public GViewCB<ControlMath, GViewGladeB> {
{
public: public:
GMathPanel(Dialog & parent); GMathPanel(Dialog & parent);
private: private:

View File

@ -24,8 +24,7 @@ namespace frontend {
namespace namespace
{ {
class LyxMenu : public Gtk::Menu class LyxMenu : public Gtk::Menu {
{
public: public:
LyxMenu() { menu_.reset(new ::Menu); } LyxMenu() { menu_.reset(new ::Menu); }
@ -50,9 +49,8 @@ Glib::ustring labelTrans(string const & label, string const & shortcut)
void ClearMenu(Gtk::MenuShell * menu) void ClearMenu(Gtk::MenuShell * menu)
{ {
Gtk::Menu_Helpers::MenuList::iterator m, end; Gtk::Menu_Helpers::MenuList::iterator m = menu->items().begin();
m = menu->items().begin(); Gtk::Menu_Helpers::MenuList::iterator end = menu->items().end();
end = menu->items().end();
Gtk::Menu * subMenu; Gtk::Menu * subMenu;
for (; m != end; ++m) { for (; m != end; ++m) {
if ((subMenu = m->get_submenu()) != 0) { if ((subMenu = m->get_submenu()) != 0) {
@ -67,7 +65,7 @@ void ClearMenu(Gtk::MenuShell * menu)
} }
GMenubar::GMenubar(LyXView *lyxView, MenuBackend const & /*menuBackend*/) : GMenubar::GMenubar(LyXView * lyxView, MenuBackend const & /*menuBackend*/) :
view_(lyxView) view_(lyxView)
{ {
GView * gview = static_cast<GView*>(lyxView); GView * gview = static_cast<GView*>(lyxView);

View File

@ -220,13 +220,14 @@ bool GMiniBuffer::onKeyPress(GdkEventKey * event)
break; break;
case GDK_Tab: case GDK_Tab:
{ {
Glib::ustring new_input, input;
string new_input_locale; string new_input_locale;
input = entry_.get_text(); Glib::ustring input = entry_.get_text();
std::vector<string> comp = std::vector<string> comp =
controller_.completions(Glib::locale_from_utf8(input), controller_.completions(Glib::locale_from_utf8(input),
new_input_locale); new_input_locale);
new_input = Glib::locale_to_utf8(new_input_locale); Glib::ustring new_input =
Glib::locale_to_utf8(new_input_locale);
if (comp.empty() && new_input == input) { if (comp.empty() && new_input == input) {
showInfo("[no match]"); showInfo("[no match]");
break; break;

View File

@ -20,8 +20,7 @@ namespace frontend {
class ControlCommandBuffer; class ControlCommandBuffer;
class GMiniBuffer : public SigC::Object class GMiniBuffer : public SigC::Object {
{
public: public:
GMiniBuffer(GView * view, ControlCommandBuffer & control); GMiniBuffer(GView * view, ControlCommandBuffer & control);
~GMiniBuffer(); ~GMiniBuffer();

View File

@ -35,7 +35,7 @@ using std::string;
namespace font_metrics { namespace font_metrics {
int width(wchar_t const *s, size_t n, LyXFont const & f); int width(wchar_t const * s, size_t n, LyXFont const & f);
} // namespace font_metrics } // namespace font_metrics

View File

@ -26,7 +26,7 @@ using namespace lyx::support;
namespace lyx { namespace lyx {
namespace frontend { namespace frontend {
GPrint::GPrint(Dialog & parent, string title) GPrint::GPrint(Dialog & parent, string const & title)
: GViewCB<ControlPrint, GViewGladeB>(parent, title, false) : GViewCB<ControlPrint, GViewGladeB>(parent, title, false)
{ {
} }
@ -144,7 +144,7 @@ void GPrint::doBuild()
xml_->get_widget("ToEntry", toEntry_); xml_->get_widget("ToEntry", toEntry_);
xml_->get_widget("PrinterEntry", printerEntry_); xml_->get_widget("PrinterEntry", printerEntry_);
xml_->get_widget("FileEntry", fileEntry_); xml_->get_widget("FileEntry", fileEntry_);
Gtk::Button * ok; Gtk::Button * ok;
Gtk::Button * cancel; Gtk::Button * cancel;
Gtk::Button * apply; Gtk::Button * apply;
@ -152,11 +152,11 @@ void GPrint::doBuild()
xml_->get_widget("CancelButton", cancel); xml_->get_widget("CancelButton", cancel);
setOK(ok); setOK(ok);
setCancel(cancel); setCancel(cancel);
Gtk::Button * browse; Gtk::Button * browse;
xml_->get_widget("Browse", browse); xml_->get_widget("Browse", browse);
browse->signal_clicked().connect(SigC::slot(*this, &GPrint::onBrowse)); browse->signal_clicked().connect(SigC::slot(*this, &GPrint::onBrowse));
fileEntry_->signal_changed().connect(SigC::bind(SigC::slot(*this, &GPrint::onTargetEdit), fileEntry_)); fileEntry_->signal_changed().connect(SigC::bind(SigC::slot(*this, &GPrint::onTargetEdit), fileEntry_));
printerEntry_->signal_changed().connect(SigC::bind(SigC::slot(*this, &GPrint::onTargetEdit), printerEntry_)); printerEntry_->signal_changed().connect(SigC::bind(SigC::slot(*this, &GPrint::onTargetEdit), printerEntry_));
fromEntry_->signal_changed().connect(SigC::slot(*this, &GPrint::onFromToEdit)); fromEntry_->signal_changed().connect(SigC::slot(*this, &GPrint::onFromToEdit));
@ -166,7 +166,7 @@ void GPrint::doBuild()
all_->signal_toggled().connect(SigC::slot(*this, &GPrint::updateUI)); all_->signal_toggled().connect(SigC::slot(*this, &GPrint::updateUI));
fromTo_->signal_toggled().connect(SigC::slot(*this, &GPrint::updateUI)); fromTo_->signal_toggled().connect(SigC::slot(*this, &GPrint::updateUI));
number_->signal_changed().connect(SigC::slot(*this, &GPrint::updateUI)); number_->signal_changed().connect(SigC::slot(*this, &GPrint::updateUI));
controller().initialiseParams(""); controller().initialiseParams("");
update(); update();
updateUI(); updateUI();

View File

@ -19,10 +19,9 @@ namespace frontend {
class ControlPrint; class ControlPrint;
class GPrint : public GViewCB<ControlPrint, GViewGladeB> class GPrint : public GViewCB<ControlPrint, GViewGladeB> {
{
public: public:
GPrint(Dialog & parent, std::string title = "Print Document"); GPrint(Dialog & parent, std::string const & title = "Print Document");
private: private:
virtual void apply(); virtual void apply();
virtual void update(); virtual void update();

View File

@ -65,8 +65,7 @@ void GScreen::setCursorColor(Glib::RefPtr<Gdk::GC> gc)
} }
void GScreen::showCursor(int x, int y, void GScreen::showCursor(int x, int y, int h, Cursor_Shape shape)
int h, Cursor_Shape shape)
{ {
// Update the cursor color. // Update the cursor color.
setCursorColor(owner_.getGC()); setCursorColor(owner_.getGC());

View File

@ -37,16 +37,13 @@ public:
/// ///
virtual void removeCursor(); virtual void removeCursor();
/// ///
virtual void showCursor(int x, int y, int h, virtual void showCursor(int x, int y, int h, Cursor_Shape shape);
Cursor_Shape shape);
protected: protected:
/// get the work area /// get the work area
virtual WorkArea & workarea() const; virtual WorkArea & workarea() const;
/// Copies specified area of pixmap to screen /// Copies specified area of pixmap to screen
virtual void expose(int x, int y, int w, int h); virtual void expose(int x, int y, int w, int h);
private: private:
/// our owning widget /// our owning widget
GWorkArea & owner_; GWorkArea & owner_;

View File

@ -23,6 +23,7 @@ namespace frontend {
typedef GViewCB<ControlSearch, GViewGladeB> base_class; typedef GViewCB<ControlSearch, GViewGladeB> base_class;
GSearch::GSearch(Dialog & parent) GSearch::GSearch(Dialog & parent)
: base_class(parent, _("Find and Replace"), false) : base_class(parent, _("Find and Replace"), false)
{} {}
@ -32,14 +33,14 @@ void GSearch::doBuild()
{ {
string const gladeName = findGladeFile("search"); string const gladeName = findGladeFile("search");
xml_ = Gnome::Glade::Xml::create(gladeName); xml_ = Gnome::Glade::Xml::create(gladeName);
Gtk::Button * cancelbutton; Gtk::Button * cancelbutton;
xml_->get_widget("Cancel", cancelbutton); xml_->get_widget("Cancel", cancelbutton);
setCancel(cancelbutton); setCancel(cancelbutton);
xml_->get_widget("FindNext", findnextbutton); xml_->get_widget("FindNext", findnextbutton);
xml_->get_widget("Replace", replacebutton); xml_->get_widget("Replace", replacebutton);
xml_->get_widget("ReplaceAll", replaceallbutton); xml_->get_widget("ReplaceAll", replaceallbutton);
xml_->get_widget("FindEntry", findentry); xml_->get_widget("FindEntry", findentry);
xml_->get_widget("ReplaceEntry", replaceentry); xml_->get_widget("ReplaceEntry", replaceentry);
xml_->get_widget("CaseSensitive", casecheck); xml_->get_widget("CaseSensitive", casecheck);
@ -53,13 +54,14 @@ void GSearch::doBuild()
replaceallbutton->signal_clicked().connect( replaceallbutton->signal_clicked().connect(
SigC::slot(*this, &GSearch::onReplaceAll)); SigC::slot(*this, &GSearch::onReplaceAll));
findentry->signal_changed().connect( findentry->signal_changed().connect(
SigC::slot(*this,&GSearch::onFindEntryChanged)); SigC::slot(*this,&GSearch::onFindEntryChanged));
bcview().addReadOnly(replaceentry); bcview().addReadOnly(replaceentry);
bcview().addReadOnly(replacebutton); bcview().addReadOnly(replacebutton);
bcview().addReadOnly(replaceallbutton); bcview().addReadOnly(replaceallbutton);
} }
void GSearch::onFindNext() void GSearch::onFindNext()
{ {
controller().find(findentry->get_text(), controller().find(findentry->get_text(),
@ -68,6 +70,7 @@ void GSearch::onFindNext()
!backwardscheck->get_active()); !backwardscheck->get_active());
} }
void GSearch::onReplace() void GSearch::onReplace()
{ {
controller().replace(findentry->get_text(), controller().replace(findentry->get_text(),
@ -75,9 +78,10 @@ void GSearch::onReplace()
casecheck->get_active(), casecheck->get_active(),
matchwordcheck->get_active(), matchwordcheck->get_active(),
!backwardscheck->get_active(), !backwardscheck->get_active(),
false); false);
} }
void GSearch::onReplaceAll() void GSearch::onReplaceAll()
{ {
controller().replace(findentry->get_text(), controller().replace(findentry->get_text(),
@ -85,19 +89,20 @@ void GSearch::onReplaceAll()
casecheck->get_active(), casecheck->get_active(),
matchwordcheck->get_active(), matchwordcheck->get_active(),
!backwardscheck->get_active(), !backwardscheck->get_active(),
true); true);
} }
void GSearch::onFindEntryChanged() void GSearch::onFindEntryChanged()
{ {
if (findentry->get_text().empty()) { if (findentry->get_text().empty()) {
findnextbutton->set_sensitive(false); findnextbutton->set_sensitive(false);
replacebutton->set_sensitive(false); replacebutton->set_sensitive(false);
replaceallbutton->set_sensitive(false); replaceallbutton->set_sensitive(false);
} else { } else {
findnextbutton->set_sensitive(true); findnextbutton->set_sensitive(true);
replacebutton->set_sensitive(true); replacebutton->set_sensitive(true);
replaceallbutton->set_sensitive(true); replaceallbutton->set_sensitive(true);
} }
} }

View File

@ -21,28 +21,27 @@ class ControlSearch;
/** This class provides a GTK+ implementation of the FormSearch Dialog. /** This class provides a GTK+ implementation of the FormSearch Dialog.
*/ */
class GSearch : public GViewCB<ControlSearch, GViewGladeB> class GSearch : public GViewCB<ControlSearch, GViewGladeB> {
{
public: public:
GSearch(Dialog & parent); GSearch(Dialog & parent);
private: private:
virtual void apply() {} virtual void apply() {}
virtual void doBuild(); virtual void doBuild();
virtual void update() {} virtual void update() {}
void onFindNext(); void onFindNext();
void onReplace(); void onReplace();
void onReplaceAll(); void onReplaceAll();
void onFindEntryChanged(); void onFindEntryChanged();
Gtk::Button * findnextbutton; Gtk::Button * findnextbutton;
Gtk::Button * replacebutton; Gtk::Button * replacebutton;
Gtk::Button * replaceallbutton; Gtk::Button * replaceallbutton;
Gtk::Entry * findentry; Gtk::Entry * findentry;
Gtk::Entry * replaceentry; Gtk::Entry * replaceentry;
Gtk::CheckButton * casecheck; Gtk::CheckButton * casecheck;
Gtk::CheckButton * matchwordcheck; Gtk::CheckButton * matchwordcheck;
Gtk::CheckButton * backwardscheck; Gtk::CheckButton * backwardscheck;
}; };
} // namespace frontend } // namespace frontend

View File

@ -28,6 +28,7 @@ GTableCreate::GTableCreate(Dialog & parent)
{ {
} }
void GTableCreate::doBuild() void GTableCreate::doBuild()
{ {
string const gladeName = findGladeFile("tableCreate"); string const gladeName = findGladeFile("tableCreate");
@ -45,6 +46,7 @@ void GTableCreate::doBuild()
setApply(apply); setApply(apply);
} }
void GTableCreate::apply() void GTableCreate::apply()
{ {
int rows = rows_->get_value_as_int(); int rows = rows_->get_value_as_int();

View File

@ -19,16 +19,15 @@ namespace frontend {
class ControlTableCreate; class ControlTableCreate;
class GTableCreate : public GViewCB<ControlTabularCreate, GViewGladeB> class GTableCreate : public GViewCB<ControlTabularCreate, GViewGladeB> {
{
public: public:
GTableCreate(Dialog & parent); GTableCreate(Dialog & parent);
private: private:
virtual void apply(); virtual void apply();
virtual void doBuild(); virtual void doBuild();
virtual void update() {}; virtual void update() {};
Gtk::SpinButton *rows_; Gtk::SpinButton * rows_;
Gtk::SpinButton *columns_; Gtk::SpinButton * columns_;
}; };
} // namespace frontend } // namespace frontend

View File

@ -29,12 +29,14 @@ GText::GText(Dialog & parent, string const & title, string const & label)
{ {
} }
void GText::apply() void GText::apply()
{ {
string const contents = Glib::locale_from_utf8(entry_->get_text()); string const contents = Glib::locale_from_utf8(entry_->get_text());
controller().params().setContents(contents); controller().params().setContents(contents);
} }
void GText::update() void GText::update()
{ {
string const contents = support::trim( string const contents = support::trim(
@ -42,6 +44,7 @@ void GText::update()
entry_->set_text(Glib::locale_to_utf8(contents)); entry_->set_text(Glib::locale_to_utf8(contents));
} }
void GText::doBuild() void GText::doBuild()
{ {
string const gladeName = findGladeFile("text"); string const gladeName = findGladeFile("text");
@ -67,6 +70,7 @@ void GText::doBuild()
SigC::slot(*this, &GText::onEntryChanged)); SigC::slot(*this, &GText::onEntryChanged));
} }
void GText::onEntryChanged() void GText::onEntryChanged()
{ {
bc().valid(!entry_->get_text().empty()); bc().valid(!entry_->get_text().empty());

View File

@ -19,8 +19,7 @@ namespace frontend {
class ControlCommand; class ControlCommand;
class GText : public GViewCB<ControlCommand, GViewGladeB> class GText : public GViewCB<ControlCommand, GViewGladeB> {
{
public: public:
GText(Dialog & parent, std::string const & title, std::string const & label); GText(Dialog & parent, std::string const & title, std::string const & label);
private: private:

View File

@ -36,8 +36,6 @@ public:
void reset(); void reset();
/// Is the timer running? /// Is the timer running?
bool running() const; bool running() const;
public:
/// The timeout signal, this gets called when the timeout passed. /// The timeout signal, this gets called when the timeout passed.
bool timeoutEvent(); bool timeoutEvent();
private: private:

View File

@ -73,14 +73,14 @@ GLayoutBox::GLayoutBox(LyXView & owner,
: owner_(owner), : owner_(owner),
internal_(false) internal_(false)
{ {
combo_.set_value_in_list(); combo_.set_value_in_list();
combo_.get_entry()->set_editable(false); combo_.get_entry()->set_editable(false);
combo_.unset_flags(Gtk::CAN_FOCUS | Gtk::CAN_DEFAULT); combo_.unset_flags(Gtk::CAN_FOCUS | Gtk::CAN_DEFAULT);
combo_.get_entry()->unset_flags(Gtk::CAN_FOCUS | Gtk::CAN_DEFAULT); combo_.get_entry()->unset_flags(Gtk::CAN_FOCUS | Gtk::CAN_DEFAULT);
comboClear(combo_); comboClear(combo_);
combo_.get_entry()->signal_changed().connect( combo_.get_entry()->signal_changed().connect(
SigC::slot(*this, SigC::slot(*this,
&GLayoutBox::selected)); &GLayoutBox::selected));
combo_.show(); combo_.show();
@ -109,7 +109,7 @@ void GLayoutBox::update()
LyXTextClass::const_iterator it = tc.begin(); LyXTextClass::const_iterator it = tc.begin();
LyXTextClass::const_iterator const end = tc.end(); LyXTextClass::const_iterator const end = tc.end();
for (; it != end; ++it) for (; it != end; ++it)
if ((*it)->obsoleted_by().empty()) if ((*it)->obsoleted_by().empty())
strings.push_back( strings.push_back(
Glib::locale_to_utf8((*it)->name())); Glib::locale_to_utf8((*it)->name()));
@ -201,19 +201,19 @@ GToolbar::GToolbar(ToolbarBackend::Toolbar const & tbb, LyXView & owner)
void GToolbar::add(FuncRequest const & func, string const & tooltip) void GToolbar::add(FuncRequest const & func, string const & tooltip)
{ {
switch (func.action) { switch (func.action) {
case ToolbarBackend::SEPARATOR: case ToolbarBackend::SEPARATOR:
toolbar_.tools().push_back(Gtk::Toolbar_Helpers::Space()); toolbar_.tools().push_back(Gtk::Toolbar_Helpers::Space());
break; break;
case ToolbarBackend::MINIBUFFER: case ToolbarBackend::MINIBUFFER:
// Not supported yet. // Not supported yet.
break; break;
case ToolbarBackend::LAYOUTS: case ToolbarBackend::LAYOUTS:
{ {
layout_.reset(new GLayoutBox(owner_, toolbar_, func)); layout_.reset(new GLayoutBox(owner_, toolbar_, func));
break; break;
} }
default: default:
Glib::ustring xpmName = Glib::ustring xpmName =
Glib::locale_to_utf8(toolbarbackend.getIcon(func)); Glib::locale_to_utf8(toolbarbackend.getIcon(func));
Glib::ustring tip = Glib::locale_to_utf8(tooltip); Glib::ustring tip = Glib::locale_to_utf8(tooltip);
@ -279,7 +279,7 @@ void GToolbar::update()
continue; continue;
default: default:
widget = it->get_content(); widget = it->get_content();
} }
FuncRequest const & func = *reinterpret_cast<FuncRequest *>( FuncRequest const & func = *reinterpret_cast<FuncRequest *>(
widget->get_data(gToolData)); widget->get_data(gToolData));

View File

@ -13,10 +13,11 @@
#ifndef GTOOLBAR_H #ifndef GTOOLBAR_H
#define GTOOLBAR_H #define GTOOLBAR_H
#include <gtkmm.h>
#include "frontends/Toolbars.h" #include "frontends/Toolbars.h"
#include <boost/scoped_ptr.hpp> #include <boost/scoped_ptr.hpp>
#include <gtkmm.h>
namespace lyx { namespace lyx {
namespace frontend { namespace frontend {
@ -37,7 +38,6 @@ public:
void open(); void open();
/// ///
void setEnabled(bool); void setEnabled(bool);
private: private:
/// ///
void selected(); void selected();
@ -54,9 +54,8 @@ public:
void add(FuncRequest const & func, std::string const & tooltip); void add(FuncRequest const & func, std::string const & tooltip);
void hide(bool); void hide(bool);
void show(bool); void show(bool);
void update(); void update();
LayoutBox * layout() const { return layout_.get(); } LayoutBox * layout() const { return layout_.get(); }
private: private:
void clicked(FuncRequest); void clicked(FuncRequest);

View File

@ -23,6 +23,7 @@ using std::string;
namespace lyx { namespace lyx {
namespace frontend { namespace frontend {
GUrl::GUrl(Dialog & parent) GUrl::GUrl(Dialog & parent)
: GViewCB<ControlCommand, GViewGladeB>(parent, _("URL")) : GViewCB<ControlCommand, GViewGladeB>(parent, _("URL"))
{ {

View File

@ -19,8 +19,7 @@ namespace frontend {
class ControlCommand; class ControlCommand;
class GUrl : public GViewCB<ControlCommand, GViewGladeB> class GUrl : public GViewCB<ControlCommand, GViewGladeB> {
{
public: public:
GUrl(Dialog & parent); GUrl(Dialog & parent);
private: private:

View File

@ -58,12 +58,12 @@ GView::GView()
// Lay them out correctly. // Lay them out correctly.
add(top_box_); add(top_box_);
Gtk::Box::BoxList & layout1 = top_box_.children(); Gtk::Box::BoxList & layout1 = top_box_.children();
add_el(layout1, *box_store_[0], true); add_el(layout1, *box_store_[0], true);
add_el(layout1, *box_store_[1], true); add_el(layout1, *box_store_[1], true);
add_el(layout1, *box_store_[2], true); add_el(layout1, *box_store_[2], true);
Gtk::Box::BoxList & layout2 = box_store_[1]->children(); Gtk::Box::BoxList & layout2 = box_store_[1]->children();
add_el(layout2, *box_store_[3], true); add_el(layout2, *box_store_[3], true);
add_el(layout2, *box_store_[4], false); add_el(layout2, *box_store_[4], false);
add_el(layout2, *box_store_[5], true); add_el(layout2, *box_store_[5], true);

View File

@ -14,6 +14,7 @@
#include "frontends/LyXView.h" #include "frontends/LyXView.h"
#include "bufferview_funcs.h" #include "bufferview_funcs.h"
#include <map> #include <map>
namespace lyx { namespace lyx {
@ -21,8 +22,7 @@ namespace frontend {
class GMiniBuffer; class GMiniBuffer;
class GView : public LyXView, public Gtk::Window class GView : public LyXView, public Gtk::Window {
{
public: public:
enum Position { enum Position {
Top, Top,

View File

@ -69,6 +69,7 @@ GBC & GViewBase::bcview()
return static_cast<GBC &>(dialog().bc().view()); return static_cast<GBC &>(dialog().bc().view());
} }
void GViewBase::setCancel(Gtk::Button * cancel) void GViewBase::setCancel(Gtk::Button * cancel)
{ {
bcview().setCancel(cancel); bcview().setCancel(cancel);
@ -76,6 +77,7 @@ void GViewBase::setCancel(Gtk::Button * cancel)
SigC::slot(*this, &GViewBase::onCancel)); SigC::slot(*this, &GViewBase::onCancel));
} }
void GViewBase::setApply(Gtk::Button * apply) void GViewBase::setApply(Gtk::Button * apply)
{ {
bcview().setApply(apply); bcview().setApply(apply);
@ -83,6 +85,7 @@ void GViewBase::setApply(Gtk::Button * apply)
SigC::slot(*this, &GViewBase::onApply)); SigC::slot(*this, &GViewBase::onApply));
} }
void GViewBase::setOK(Gtk::Button * ok) void GViewBase::setOK(Gtk::Button * ok)
{ {
bcview().setOK(ok); bcview().setOK(ok);
@ -90,6 +93,7 @@ void GViewBase::setOK(Gtk::Button * ok)
SigC::slot(*this, &GViewBase::onOK)); SigC::slot(*this, &GViewBase::onOK));
} }
void GViewBase::setRestore(Gtk::Button * restore) void GViewBase::setRestore(Gtk::Button * restore)
{ {
bcview().setRestore(restore); bcview().setRestore(restore);
@ -97,6 +101,7 @@ void GViewBase::setRestore(Gtk::Button * restore)
SigC::slot(*this, &GViewBase::onRestore)); SigC::slot(*this, &GViewBase::onRestore));
} }
void GViewBase::onApply() void GViewBase::onApply()
{ {
dialog().ApplyButton(); dialog().ApplyButton();
@ -144,7 +149,7 @@ Gtk::Window * GViewGladeB::window()
} }
const Gtk::Window * GViewGladeB::window() const Gtk::Window const * GViewGladeB::window() const
{ {
Gtk::Window * win; Gtk::Window * win;
if (!xml_) if (!xml_)

View File

@ -22,8 +22,7 @@
namespace lyx { namespace lyx {
namespace frontend { namespace frontend {
class GViewBase : public Dialog::View, public SigC::Object class GViewBase : public Dialog::View, public SigC::Object {
{
public: public:
GViewBase(Dialog &, std::string const &, bool allowResize); GViewBase(Dialog &, std::string const &, bool allowResize);
virtual ~GViewBase(); virtual ~GViewBase();
@ -53,9 +52,9 @@ private:
bool allowResize_; bool allowResize_;
}; };
template <class Dialog> template <class Dialog>
class GViewDB : public GViewBase class GViewDB : public GViewBase {
{
protected: protected:
GViewDB(Dialog &, std::string const &, bool allowResize); GViewDB(Dialog &, std::string const &, bool allowResize);
virtual const Gtk::Window * window() const; virtual const Gtk::Window * window() const;
@ -89,15 +88,14 @@ class GViewGladeB : public GViewBase
{ {
protected: protected:
GViewGladeB(Dialog & parent, std::string const & t, bool allowResize); GViewGladeB(Dialog & parent, std::string const & t, bool allowResize);
virtual const Gtk::Window * window() const; virtual Gtk::Window const * window() const;
virtual Gtk::Window * window(); virtual Gtk::Window * window();
Glib::RefPtr<Gnome::Glade::Xml> xml_; Glib::RefPtr<Gnome::Glade::Xml> xml_;
}; };
template <class Controller, class Base> template <class Controller, class Base>
class GViewCB : public Base class GViewCB : public Base {
{
public: public:
Controller & controller(); Controller & controller();
Controller const & controller() const; Controller const & controller() const;

View File

@ -175,7 +175,7 @@ GWorkArea::GWorkArea(LyXView & owner, int width, int height)
vscrollbar_.get_adjustment()->signal_value_changed().connect( vscrollbar_.get_adjustment()->signal_value_changed().connect(
SigC::slot(*this, &GWorkArea::onScroll)); SigC::slot(*this, &GWorkArea::onScroll));
workArea_.signal_scroll_event().connect( workArea_.signal_scroll_event().connect(
SigC::slot(*this, &GWorkArea::onScrollWheel)); SigC::slot(*this, &GWorkArea::onScrollWheel));
vscrollbar_.show(); vscrollbar_.show();
hbox_.children().push_back(Gtk::Box_Helpers::Element(workArea_)); hbox_.children().push_back(Gtk::Box_Helpers::Element(workArea_));
hbox_.children().push_back( hbox_.children().push_back(
@ -342,6 +342,7 @@ void GWorkArea::onScroll()
scrollDocView(static_cast<int>(val)); scrollDocView(static_cast<int>(val));
} }
bool GWorkArea::onScrollWheel(GdkEventScroll * event) bool GWorkArea::onScrollWheel(GdkEventScroll * event)
{ {
Gtk::Adjustment * adjustment = vscrollbar_.get_adjustment(); Gtk::Adjustment * adjustment = vscrollbar_.get_adjustment();
@ -351,7 +352,7 @@ bool GWorkArea::onScrollWheel(GdkEventScroll * event)
step = adjustment->get_page_increment(); step = adjustment->get_page_increment();
else else
step = adjustment->get_step_increment(); step = adjustment->get_step_increment();
if (event->direction == GDK_SCROLL_UP) if (event->direction == GDK_SCROLL_UP)
step *= -1.0f; step *= -1.0f;
@ -360,6 +361,7 @@ bool GWorkArea::onScrollWheel(GdkEventScroll * event)
return true; return true;
} }
bool GWorkArea::onButtonPress(GdkEventButton * event) bool GWorkArea::onButtonPress(GdkEventButton * event)
{ {
kb_action ka = LFUN_MOUSE_PRESS; kb_action ka = LFUN_MOUSE_PRESS;

View File

@ -26,13 +26,12 @@ class LyXView;
namespace lyx { namespace lyx {
namespace frontend { namespace frontend {
class ColorCache class ColorCache {
{ public:
typedef std::map<LColor_color, Gdk::Color *> Map; typedef std::map<LColor_color, Gdk::Color *> Map;
typedef Map::iterator MapIt; typedef Map::iterator MapIt;
typedef std::map<LColor_color, XftColor *> Map2; typedef std::map<LColor_color, XftColor *> Map2;
typedef Map2::iterator MapIt2; typedef Map2::iterator MapIt2;
public:
~ColorCache(); ~ColorCache();
Gdk::Color * getColor(LColor_color); Gdk::Color * getColor(LColor_color);
XftColor * getXftColor(LColor_color); XftColor * getXftColor(LColor_color);
@ -46,10 +45,9 @@ private:
extern ColorCache colorCache; extern ColorCache colorCache;
class ColorHandler class ColorHandler {
{
public: public:
ColorHandler(GWorkArea& owner) : owner_(owner) {} ColorHandler(GWorkArea & owner) : owner_(owner) {}
XftColor * getXftColor(LColor_color clr); XftColor * getXftColor(LColor_color clr);
Gdk::Color * getGdkColor(LColor_color clr); Gdk::Color * getGdkColor(LColor_color clr);
private: private:
@ -57,8 +55,7 @@ private:
}; };
class GWorkArea : public WorkArea, public SigC::Object class GWorkArea : public WorkArea, public SigC::Object {
{
public: public:
GWorkArea(LyXView & owner, int width, int height); GWorkArea(LyXView & owner, int width, int height);
~GWorkArea(); ~GWorkArea();
@ -98,7 +95,7 @@ private:
bool onButtonRelease(GdkEventButton * event); bool onButtonRelease(GdkEventButton * event);
bool onMotionNotify(GdkEventMotion * event); bool onMotionNotify(GdkEventMotion * event);
bool onKeyPress(GdkEventKey * event); bool onKeyPress(GdkEventKey * event);
void onClipboardGet(Gtk::SelectionData& selection_data, guint info); void onClipboardGet(Gtk::SelectionData & selection_data, guint info);
void onClipboardClear(); void onClipboardClear();
Gtk::HBox hbox_; Gtk::HBox hbox_;
Gtk::DrawingArea workArea_; Gtk::DrawingArea workArea_;

View File

@ -9,19 +9,21 @@
*/ */
#include <config.h> #include <config.h>
#include <gtkmm.h>
#include <cassert>
#include "GXpmBtnTbl.h" #include "GXpmBtnTbl.h"
#include <gtkmm.h>
#include <cassert>
void GXpmBtnTbl::GXpmBtn::setXpm(XpmData xpm) void GXpmBtnTbl::GXpmBtn::setXpm(XpmData xpm)
{ {
Glib::RefPtr<Gdk::Colormap> clrmap = get_colormap(); Glib::RefPtr<Gdk::Colormap> clrmap = get_colormap();
Gtk::Image * image;
pixmap_ = Gdk::Pixmap::create_from_xpm(clrmap, pixmap_ = Gdk::Pixmap::create_from_xpm(clrmap,
mask_, mask_,
xpm); xpm);
image = SigC::manage(new Gtk::Image(pixmap_, mask_)); Gtk::Image * image = SigC::manage(new Gtk::Image(pixmap_, mask_));
image->show(); image->show();
add(*image); add(*image);
} }
@ -32,8 +34,7 @@ void GXpmBtnTbl::GXpmBtn::setXpm(Glib::RefPtr<Gdk::Pixmap> pixmap,
{ {
pixmap_ = pixmap; pixmap_ = pixmap;
mask_ = mask; mask_ = mask;
Gtk::Image * image; Gtk::Image * image = SigC::manage(new Gtk::Image(pixmap_, mask_));
image = SigC::manage(new Gtk::Image(pixmap_, mask_));
image->show(); image->show();
add(*image); add(*image);
} }
@ -48,7 +49,7 @@ GXpmBtnTbl::GXpmBtnTbl(int rows, int cols, XpmData xpms[]) :
} }
GXpmBtnTbl::GXpmBtnTbl(int rows, int cols, const XbmData& xbm) : GXpmBtnTbl::GXpmBtnTbl(int rows, int cols, XbmData const & xbm) :
Gtk::Table(rows, cols, true), rows_(rows), cols_(cols), Gtk::Table(rows, cols, true), rows_(rows), cols_(cols),
xbm_(&xbm) xbm_(&xbm)
{ {
@ -68,11 +69,9 @@ void GXpmBtnTbl::construct()
btns_.reset(new GXpmBtn[rows_ * cols_]); btns_.reset(new GXpmBtn[rows_ * cols_]);
assert(btns_.get()); assert(btns_.get());
GXpmBtn * btn; for (int row = 0; row < rows_; ++row)
int row, col; for (int col = 0; col < cols_; ++col) {
for (row = 0; row < rows_; ++row) GXpmBtn * btn = &btns_[index(row, col)];
for (col = 0; col < cols_; ++col) {
btn = &btns_[index(row, col)];
btn->setRow(row); btn->setRow(row);
btn->setCol(col); btn->setCol(col);
btn->signalClicked().connect(signalClicked_.slot()); btn->signalClicked().connect(signalClicked_.slot());
@ -84,22 +83,20 @@ void GXpmBtnTbl::construct()
void GXpmBtnTbl::setBtnXpm(XpmData xpms[]) void GXpmBtnTbl::setBtnXpm(XpmData xpms[])
{ {
int row, col; for (int row = 0; row < rows_; ++row)
for (row = 0; row < rows_; ++row) for (int col = 0; col < cols_; ++col)
for (col = 0; col < cols_; ++col)
btns_[index(row, col)].setXpm(xpms[index(row, col)]); btns_[index(row, col)].setXpm(xpms[index(row, col)]);
} }
void GXpmBtnTbl::setBtnXpm(const XbmData& xbm) void GXpmBtnTbl::setBtnXpm(XbmData const & xbm)
{ {
Glib::RefPtr<Gdk::Bitmap> mask;
Glib::RefPtr<Gdk::Pixmap> pixmap;
Glib::RefPtr<Gdk::Colormap> clrmap = get_colormap(); Glib::RefPtr<Gdk::Colormap> clrmap = get_colormap();
Gdk::Color fg(const_cast<GdkColor *>(&xbm.fg_)); Gdk::Color fg(const_cast<GdkColor *>(&xbm.fg_));
clrmap->alloc_color(fg); clrmap->alloc_color(fg);
Glib::RefPtr<Gdk::Window> window = get_window(); Glib::RefPtr<Gdk::Window> window = get_window();
pixmap = Gdk::Pixmap::create_from_data(
Glib::RefPtr<Gdk::Pixmap> pixmap = Gdk::Pixmap::create_from_data(
window, window,
reinterpret_cast<char const * const>(xbm.data_), reinterpret_cast<char const * const>(xbm.data_),
xbm.width_, xbm.width_,
@ -107,20 +104,22 @@ void GXpmBtnTbl::setBtnXpm(const XbmData& xbm)
window->get_depth(), window->get_depth(),
fg, fg,
get_style()->get_bg(Gtk::STATE_NORMAL)); get_style()->get_bg(Gtk::STATE_NORMAL));
mask = Gdk::Bitmap::create(
Glib::RefPtr<Gdk::Bitmap> mask = Gdk::Bitmap::create(
window, window,
reinterpret_cast<char const * const>(xbm.data_), reinterpret_cast<char const * const>(xbm.data_),
xbm.width_, xbm.width_,
xbm.height_); xbm.height_);
Glib::RefPtr<Gdk::Bitmap> maskBtn;
Glib::RefPtr<Gdk::Pixmap> pixmapBtn;
Glib::RefPtr<Gdk::GC> gc = Gdk::GC::create(mask); Glib::RefPtr<Gdk::GC> gc = Gdk::GC::create(mask);
int row, col; int const btnWidth = xbm.width_ / cols_;
int btnWidth = xbm.width_ / cols_; int const btnHeight = xbm.height_ / rows_;
int btnHeight = xbm.height_ / rows_; for (int row = 0; row < rows_; ++row)
for (row = 0; row < rows_; ++row) for (int col = 0; col < cols_; ++col) {
for (col = 0; col < cols_; ++col) { Glib::RefPtr<Gdk::Pixmap> pixmapBtn =
pixmapBtn = Gdk::Pixmap::create( Gdk::Pixmap::create(
window, window,
btnWidth, btnWidth,
btnHeight, btnHeight,
@ -133,7 +132,8 @@ void GXpmBtnTbl::setBtnXpm(const XbmData& xbm)
0, 0,
btnWidth, btnWidth,
btnHeight); btnHeight);
maskBtn = Gdk::Bitmap::create( Glib::RefPtr<Gdk::Bitmap> maskBtn =
Gdk::Bitmap::create(
window, window,
reinterpret_cast<char const * const>(xbm.data_), reinterpret_cast<char const * const>(xbm.data_),
btnWidth, btnWidth,
@ -160,16 +160,17 @@ void GXpmBtnTbl::on_realize()
} }
void buttonSetXpm(Gtk::Button * btn, char const **xpm) void buttonSetXpm(Gtk::Button * btn, char const ** xpm)
{ {
Glib::RefPtr<Gdk::Bitmap> mask; Glib::RefPtr<Gdk::Bitmap> mask;
Glib::RefPtr<Gdk::Pixmap> pixmap;
Glib::RefPtr<Gdk::Colormap> clrmap = btn->get_colormap(); Glib::RefPtr<Gdk::Colormap> clrmap = btn->get_colormap();
Gtk::Image * image;
pixmap = Gdk::Pixmap::create_from_xpm(clrmap, Glib::RefPtr<Gdk::Pixmap> pixmap =
mask, Gdk::Pixmap::create_from_xpm(clrmap,
xpm); mask,
image = SigC::manage(new Gtk::Image(pixmap, mask)); xpm);
Gtk::Image * image = SigC::manage(new Gtk::Image(pixmap, mask));
image->show(); image->show();
btn->add(*image); btn->add(*image);
} }

View File

@ -15,20 +15,19 @@
#include <boost/scoped_array.hpp> #include <boost/scoped_array.hpp>
class GXpmBtnTbl : public Gtk::Table class GXpmBtnTbl : public Gtk::Table {
{
public: public:
typedef char const ** XpmData; typedef char const ** XpmData;
typedef SigC::Signal2<void, int, int> SigType; typedef SigC::Signal2<void, int, int> SigType;
struct XbmData
{ struct XbmData {
unsigned char const* data_; unsigned char const* data_;
int width_; int width_;
int height_; int height_;
GdkColor fg_; GdkColor fg_;
}; };
class GXpmBtn : public Gtk::Button
{ class GXpmBtn : public Gtk::Button {
public: public:
GXpmBtn() : row_(-1), col_(-1) GXpmBtn() : row_(-1), col_(-1)
{ {
@ -46,8 +45,11 @@ public:
Glib::RefPtr<Gdk::Pixmap> getPixmap() { return pixmap_; } Glib::RefPtr<Gdk::Pixmap> getPixmap() { return pixmap_; }
Glib::RefPtr<Gdk::Bitmap> getMask() { return mask_; } Glib::RefPtr<Gdk::Bitmap> getMask() { return mask_; }
SigType signalClicked() { return signalClicked_; } SigType signalClicked() { return signalClicked_; }
void onButtonClicked() void onButtonClicked()
{ signalClicked_.emit(row_, col_); } {
signalClicked_.emit(row_, col_);
}
private: private:
int row_; int row_;
int col_; int col_;
@ -55,19 +57,24 @@ public:
Glib::RefPtr<Gdk::Bitmap> mask_; Glib::RefPtr<Gdk::Bitmap> mask_;
SigType signalClicked_; SigType signalClicked_;
}; };
GXpmBtnTbl(int rows, int cols, XpmData xpms[]); GXpmBtnTbl(int rows, int cols, XpmData xpms[]);
//GXpmBtnTbl(int rows, int cols, XpmData xpm); //GXpmBtnTbl(int rows, int cols, XpmData xpm);
GXpmBtnTbl(int rows, int cols, const XbmData& xbm); GXpmBtnTbl(int rows, int cols, XbmData const & xbm);
~GXpmBtnTbl(); ~GXpmBtnTbl();
GXpmBtn* getBtn(int row, int col)
{ return &btns_[index(row, col)]; } GXpmBtn * getBtn(int row, int col)
{
return &btns_[index(row, col)];
}
SigType signalClicked() { return signalClicked_; } SigType signalClicked() { return signalClicked_; }
private: private:
int index(int row, int col) { return row * cols_ + col; } int index(int row, int col) { return row * cols_ + col; }
void on_realize(); void on_realize();
void construct(); void construct();
void setBtnXpm(XpmData xpms[]); void setBtnXpm(XpmData xpms[]);
void setBtnXpm(const XbmData& xbm); void setBtnXpm(XbmData const & xbm);
int rows_; int rows_;
int cols_; int cols_;
@ -77,7 +84,7 @@ private:
}; };
void buttonSetXpm(Gtk::Button * btn, char const **xpm); void buttonSetXpm(Gtk::Button * btn, char const ** xpm);
#endif #endif

View File

@ -12,10 +12,11 @@
#ifndef GTKMMX_H #ifndef GTKMMX_H
#define GTKMMX_H #define GTKMMX_H
#include <X11/Xlib.h>
#include <gtkmm.h> #include <gtkmm.h>
#include <gdk/gdkx.h> #include <gdk/gdkx.h>
#include <X11/Xlib.h>
inline Display * getDisplay() inline Display * getDisplay()
{ {

View File

@ -10,18 +10,16 @@
#include <config.h> #include <config.h>
#include "frontends/LyXKeySymFactory.h"
#include "GLyXKeySym.h" #include "GLyXKeySym.h"
#include "frontends/LyXKeySymFactory.h"
namespace LyXKeySymFactory { namespace LyXKeySymFactory {
LyXKeySym * create() LyXKeySym * create()
{ {
return new GLyXKeySym; return new GLyXKeySym;
} }
} }

View File

@ -10,12 +10,13 @@
#include <config.h> #include <config.h>
#include <gtkmm.h>
#include "frontends/LyXScreenFactory.h"
#include "GWorkArea.h" #include "GWorkArea.h"
#include "GScreen.h" #include "GScreen.h"
#include "frontends/LyXScreenFactory.h"
#include <gtkmm.h>
namespace LyXScreenFactory { namespace LyXScreenFactory {

View File

@ -26,8 +26,7 @@ string const findGladeFile(string const & name)
{ {
// First, search in the installation directories. // First, search in the installation directories.
string filename = string filename = lyx::support::LibFileSearch("glade", name, "glade");
lyx::support::LibFileSearch("glade", name, "glade");
if (!filename.empty()) if (!filename.empty())
return filename; return filename;

View File

@ -17,7 +17,9 @@
io_callback::io_callback(int fd, boost::function<void()> func) io_callback::io_callback(int fd, boost::function<void()> func)
: func_(func) : func_(func)
{ {
conn_ = Glib::signal_io().connect(SigC::slot(*this, &io_callback::data_received), fd, Glib::IO_IN); conn_ = Glib::signal_io().connect(
SigC::slot(*this, &io_callback::data_received),
fd, Glib::IO_IN);
} }

View File

@ -9,22 +9,28 @@
*/ */
#include <config.h> #include <config.h>
#include <gtkmm.h>
#include <cmath> // fabs()
#include <X11/Xft/Xft.h>
#include "xftFontLoader.h" #include "xftFontLoader.h"
#include "FontInfo.h" #include "FontInfo.h"
#include "gettext.h" #include "gettext.h"
#include "debug.h" #include "debug.h"
#include "lyxrc.h" // lyxrc.font_* #include "lyxrc.h" // lyxrc.font_*
#include "BufferView.h" #include "BufferView.h"
#include "GtkmmX.h"
#include "frontends/LyXView.h" #include "frontends/LyXView.h"
#include "frontends/lyx_gui.h"
#include "support/systemcall.h" #include "support/systemcall.h"
#include "support/filetools.h" #include "support/filetools.h"
#include "GtkmmX.h"
#include <gtkmm.h>
#include <X11/Xft/Xft.h>
#include <cmath> // fabs()
#include <vector> #include <vector>
#include "frontends/lyx_gui.h"
using std::endl; using std::endl;
using std::string; using std::string;
@ -167,10 +173,10 @@ XftFont * xftFontLoader::doLoad(LyXFont::FONT_FAMILY family,
LyXFont::FONT_SHAPE shape, LyXFont::FONT_SHAPE shape,
LyXFont::FONT_SIZE size) LyXFont::FONT_SIZE size)
{ {
XftPattern *fpat = getFontPattern(family, series, shape, size); XftPattern * fpat = getFontPattern(family, series, shape, size);
XftResult result; XftResult result;
XftPattern *fpat2 = XftFontMatch(getDisplay(), getScreen(), XftPattern * fpat2 = XftFontMatch(getDisplay(), getScreen(),
fpat, &result); fpat, &result);
XftFont * font = XftFontOpenPattern(getDisplay(), fpat2); XftFont * font = XftFontOpenPattern(getDisplay(), fpat2);
fonts_[family][series][shape][size] = font; fonts_[family][series][shape][size] = font;
return font; return font;
@ -193,11 +199,11 @@ bool xftFontLoader::available(LyXFont const & f)
string const ffamily = familyString(family); string const ffamily = familyString(family);
if (isSpecial(f)) { if (isSpecial(f)) {
cache_set[family] = true; cache_set[family] = true;
XftPattern *fpat = XftPatternCreate(); XftPattern * fpat = XftPatternCreate();
XftPatternAddString(fpat, XFT_FAMILY, ffamily.c_str()); XftPatternAddString(fpat, XFT_FAMILY, ffamily.c_str());
XftResult result; XftResult result;
XftPattern *fpat2 = XftFontMatch(getDisplay(), getScreen(), XftPattern * fpat2 = XftFontMatch(getDisplay(), getScreen(),
fpat, &result); fpat, &result);
XftPatternDestroy(fpat); XftPatternDestroy(fpat);
char * familyM; char * familyM;
XftPatternGetString(fpat2, XFT_FAMILY, 0, &familyM); XftPatternGetString(fpat2, XFT_FAMILY, 0, &familyM);

View File

@ -43,6 +43,7 @@ public:
else else
return doLoad(family, series, shape, size); return doLoad(family, series, shape, size);
} }
bool isSpecial(LyXFont const & f) bool isSpecial(LyXFont const & f)
{ {
switch (f.family()) { switch (f.family()) {

View File

@ -9,9 +9,7 @@
*/ */
#include <config.h> #include <config.h>
#include <gtkmm.h>
#include <algorithm>
#include "GtkmmX.h" #include "GtkmmX.h"
#include "support/lstrings.h" #include "support/lstrings.h"
#include "xftFontLoader.h" #include "xftFontLoader.h"
@ -21,8 +19,12 @@
#include "language.h" #include "language.h"
#include "codeConvert.h" #include "codeConvert.h"
#include <gtkmm.h>
#include <boost/scoped_array.hpp> #include <boost/scoped_array.hpp>
#include <algorithm>
using std::string; using std::string;
@ -133,7 +135,7 @@ int descent(char c, LyXFont const & f)
int lbearing(wchar_t c,LyXFont const & f) int lbearing(wchar_t c,LyXFont const & f)
{ {
XftFont * font = getXftFont(f); XftFont * font = getXftFont(f);
XGlyphInfo glyph; XGlyphInfo glyph;
XftTextExtents32(getDisplay(), font, XftTextExtents32(getDisplay(), font,
@ -141,7 +143,7 @@ int lbearing(wchar_t c,LyXFont const & f)
1, 1,
&glyph); &glyph);
return XGlyphLbearing(glyph); return XGlyphLbearing(glyph);
} }
int rbearing(wchar_t c,LyXFont const & f) int rbearing(wchar_t c,LyXFont const & f)
@ -174,7 +176,7 @@ int width(wchar_t const * s, size_t n, LyXFont const & f)
XGlyphInfo glyph; XGlyphInfo glyph;
if (f.realShape() != LyXFont::SMALLCAPS_SHAPE){ if (f.realShape() != LyXFont::SMALLCAPS_SHAPE){
XftTextExtents32(getDisplay(), font, XftTextExtents32(getDisplay(), font,
const_cast<XftChar32*>( const_cast<XftChar32 *>(
wcsToXftChar32StrFast(s)), wcsToXftChar32StrFast(s)),
n, n,
&glyph); &glyph);
@ -211,7 +213,7 @@ int width(wchar_t c,LyXFont const & f)
} }
int width(char const * s, size_t n,LyXFont const & f) int width(char const * s, size_t n, LyXFont const & f)
{ {
boost::scoped_array<wchar_t> wcs(new wchar_t[n]); boost::scoped_array<wchar_t> wcs(new wchar_t[n]);
size_t len; size_t len;