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>
* GPrint.C: minor fixes to make it compile and work, get rid of

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -35,7 +35,7 @@ using std::string;
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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -58,12 +58,12 @@ GView::GView()
// Lay them out correctly.
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_[1], 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_[4], false);
add_el(layout2, *box_store_[5], true);

View File

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

View File

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

View File

@ -22,8 +22,7 @@
namespace lyx {
namespace frontend {
class GViewBase : public Dialog::View, public SigC::Object
{
class GViewBase : public Dialog::View, public SigC::Object {
public:
GViewBase(Dialog &, std::string const &, bool allowResize);
virtual ~GViewBase();
@ -53,9 +52,9 @@ private:
bool allowResize_;
};
template <class Dialog>
class GViewDB : public GViewBase
{
class GViewDB : public GViewBase {
protected:
GViewDB(Dialog &, std::string const &, bool allowResize);
virtual const Gtk::Window * window() const;
@ -89,15 +88,14 @@ class GViewGladeB : public GViewBase
{
protected:
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();
Glib::RefPtr<Gnome::Glade::Xml> xml_;
};
template <class Controller, class Base>
class GViewCB : public Base
{
class GViewCB : public Base {
public:
Controller & controller();
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(
SigC::slot(*this, &GWorkArea::onScroll));
workArea_.signal_scroll_event().connect(
SigC::slot(*this, &GWorkArea::onScrollWheel));
SigC::slot(*this, &GWorkArea::onScrollWheel));
vscrollbar_.show();
hbox_.children().push_back(Gtk::Box_Helpers::Element(workArea_));
hbox_.children().push_back(
@ -342,6 +342,7 @@ void GWorkArea::onScroll()
scrollDocView(static_cast<int>(val));
}
bool GWorkArea::onScrollWheel(GdkEventScroll * event)
{
Gtk::Adjustment * adjustment = vscrollbar_.get_adjustment();
@ -351,7 +352,7 @@ bool GWorkArea::onScrollWheel(GdkEventScroll * event)
step = adjustment->get_page_increment();
else
step = adjustment->get_step_increment();
if (event->direction == GDK_SCROLL_UP)
step *= -1.0f;
@ -360,6 +361,7 @@ bool GWorkArea::onScrollWheel(GdkEventScroll * event)
return true;
}
bool GWorkArea::onButtonPress(GdkEventButton * event)
{
kb_action ka = LFUN_MOUSE_PRESS;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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