diff --git a/src/frontends/gtk/ChangeLog b/src/frontends/gtk/ChangeLog index 1fe81f6ca2..61bd362cf7 100644 --- a/src/frontends/gtk/ChangeLog +++ b/src/frontends/gtk/ChangeLog @@ -1,3 +1,7 @@ +2004-09-26 Lars Gullik Bjonnes + + * WS changes. + 2004-09-25 John Spray * GPrint.C: minor fixes to make it compile and work, get rid of diff --git a/src/frontends/gtk/FileDialogPrivate.h b/src/frontends/gtk/FileDialogPrivate.h index 298d03b752..eeac92f92d 100644 --- a/src/frontends/gtk/FileDialogPrivate.h +++ b/src/frontends/gtk/FileDialogPrivate.h @@ -15,8 +15,7 @@ #include #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, diff --git a/src/frontends/gtk/GAboutlyx.h b/src/frontends/gtk/GAboutlyx.h index 98fe06c24d..22166f8cbb 100644 --- a/src/frontends/gtk/GAboutlyx.h +++ b/src/frontends/gtk/GAboutlyx.h @@ -19,8 +19,7 @@ namespace frontend { class ControlAboutlyx; -class GAboutlyx : public GViewCB -{ +class GAboutlyx : public GViewCB { public: GAboutlyx(Dialog &); private: diff --git a/src/frontends/gtk/GBC.h b/src/frontends/gtk/GBC.h index 8525d20798..c7178a7898 100644 --- a/src/frontends/gtk/GBC.h +++ b/src/frontends/gtk/GBC.h @@ -21,8 +21,7 @@ namespace lyx { namespace frontend { -class GBC : public GuiBC -{ +class GBC : public GuiBC { public: GBC(ButtonController const & parent, std::string const & cancel = _("Cancel"), diff --git a/src/frontends/gtk/GLyXKeySym.h b/src/frontends/gtk/GLyXKeySym.h index d4c54c71d4..a0a8e82a80 100644 --- a/src/frontends/gtk/GLyXKeySym.h +++ b/src/frontends/gtk/GLyXKeySym.h @@ -14,8 +14,7 @@ #include "frontends/LyXKeySym.h" -class GLyXKeySym : public LyXKeySym -{ +class GLyXKeySym : public LyXKeySym { public: GLyXKeySym(); GLyXKeySym(unsigned int keyval); diff --git a/src/frontends/gtk/GMathDelim.C b/src/frontends/gtk/GMathDelim.C index 5057eaf65c..85a7cf22a6 100644 --- a/src/frontends/gtk/GMathDelim.C +++ b/src/frontends/gtk/GMathDelim.C @@ -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(parent, _("Math Delimiters")), delimTbl_(delimTblRows, delimTblCols, xbm) diff --git a/src/frontends/gtk/GMathDelim.h b/src/frontends/gtk/GMathDelim.h index addf53c7c8..0c825a6727 100644 --- a/src/frontends/gtk/GMathDelim.h +++ b/src/frontends/gtk/GMathDelim.h @@ -21,8 +21,7 @@ namespace frontend { class ControlMath; -class GMathDelim : public GViewCB -{ +class GMathDelim : public GViewCB { public: GMathDelim(Dialog & parent); private: diff --git a/src/frontends/gtk/GMathPanel.C b/src/frontends/gtk/GMathPanel.C index e6fb1132c3..1193f90ce3 100644 --- a/src/frontends/gtk/GMathPanel.C +++ b/src/frontends/gtk/GMathPanel.C @@ -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 diff --git a/src/frontends/gtk/GMathPanel.h b/src/frontends/gtk/GMathPanel.h index 30b99f9a39..b3a1a0a591 100644 --- a/src/frontends/gtk/GMathPanel.h +++ b/src/frontends/gtk/GMathPanel.h @@ -21,8 +21,7 @@ namespace frontend { class ControlMath; -class GMathPanel : public GViewCB -{ +class GMathPanel : public GViewCB { public: GMathPanel(Dialog & parent); private: diff --git a/src/frontends/gtk/GMenubar.C b/src/frontends/gtk/GMenubar.C index 1c1e767aa3..2450c68f04 100644 --- a/src/frontends/gtk/GMenubar.C +++ b/src/frontends/gtk/GMenubar.C @@ -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(lyxView); diff --git a/src/frontends/gtk/GMiniBuffer.C b/src/frontends/gtk/GMiniBuffer.C index c917958f5d..182a20ae1b 100644 --- a/src/frontends/gtk/GMiniBuffer.C +++ b/src/frontends/gtk/GMiniBuffer.C @@ -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 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; diff --git a/src/frontends/gtk/GMiniBuffer.h b/src/frontends/gtk/GMiniBuffer.h index 41e146ebbc..982cfd5ccf 100644 --- a/src/frontends/gtk/GMiniBuffer.h +++ b/src/frontends/gtk/GMiniBuffer.h @@ -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(); diff --git a/src/frontends/gtk/GPainter.C b/src/frontends/gtk/GPainter.C index 8e6a6b5620..9e09423401 100644 --- a/src/frontends/gtk/GPainter.C +++ b/src/frontends/gtk/GPainter.C @@ -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 diff --git a/src/frontends/gtk/GPrint.C b/src/frontends/gtk/GPrint.C index 011642da2a..c31f79a3b6 100644 --- a/src/frontends/gtk/GPrint.C +++ b/src/frontends/gtk/GPrint.C @@ -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(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(); diff --git a/src/frontends/gtk/GPrint.h b/src/frontends/gtk/GPrint.h index 26df42f3c4..2b954399c5 100644 --- a/src/frontends/gtk/GPrint.h +++ b/src/frontends/gtk/GPrint.h @@ -19,10 +19,9 @@ namespace frontend { class ControlPrint; -class GPrint : public GViewCB -{ +class GPrint : public GViewCB { 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(); diff --git a/src/frontends/gtk/GScreen.C b/src/frontends/gtk/GScreen.C index 5948231f84..1e8a199fc3 100644 --- a/src/frontends/gtk/GScreen.C +++ b/src/frontends/gtk/GScreen.C @@ -65,8 +65,7 @@ void GScreen::setCursorColor(Glib::RefPtr 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()); diff --git a/src/frontends/gtk/GScreen.h b/src/frontends/gtk/GScreen.h index c3610a71b9..596e74980f 100644 --- a/src/frontends/gtk/GScreen.h +++ b/src/frontends/gtk/GScreen.h @@ -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_; diff --git a/src/frontends/gtk/GSearch.C b/src/frontends/gtk/GSearch.C index 14fa2033e3..63372ae1fa 100644 --- a/src/frontends/gtk/GSearch.C +++ b/src/frontends/gtk/GSearch.C @@ -23,6 +23,7 @@ namespace frontend { typedef GViewCB 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); } } diff --git a/src/frontends/gtk/GSearch.h b/src/frontends/gtk/GSearch.h index 0ace5137c4..4d4dd5c687 100644 --- a/src/frontends/gtk/GSearch.h +++ b/src/frontends/gtk/GSearch.h @@ -21,28 +21,27 @@ class ControlSearch; /** This class provides a GTK+ implementation of the FormSearch Dialog. */ -class GSearch : public GViewCB -{ +class GSearch : public GViewCB { 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 diff --git a/src/frontends/gtk/GTableCreate.C b/src/frontends/gtk/GTableCreate.C index f7bf7e7ce9..753df0b52a 100644 --- a/src/frontends/gtk/GTableCreate.C +++ b/src/frontends/gtk/GTableCreate.C @@ -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(); diff --git a/src/frontends/gtk/GTableCreate.h b/src/frontends/gtk/GTableCreate.h index a01e9dc730..4a8302dfae 100644 --- a/src/frontends/gtk/GTableCreate.h +++ b/src/frontends/gtk/GTableCreate.h @@ -19,16 +19,15 @@ namespace frontend { class ControlTableCreate; -class GTableCreate : public GViewCB -{ +class GTableCreate : public GViewCB { 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 diff --git a/src/frontends/gtk/GText.C b/src/frontends/gtk/GText.C index 642008d313..0f4eff37e3 100644 --- a/src/frontends/gtk/GText.C +++ b/src/frontends/gtk/GText.C @@ -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, >ext::onEntryChanged)); } + void GText::onEntryChanged() { bc().valid(!entry_->get_text().empty()); diff --git a/src/frontends/gtk/GText.h b/src/frontends/gtk/GText.h index 96511d04c8..b2ab630764 100644 --- a/src/frontends/gtk/GText.h +++ b/src/frontends/gtk/GText.h @@ -19,8 +19,7 @@ namespace frontend { class ControlCommand; -class GText : public GViewCB -{ +class GText : public GViewCB { public: GText(Dialog & parent, std::string const & title, std::string const & label); private: diff --git a/src/frontends/gtk/GTimeout.h b/src/frontends/gtk/GTimeout.h index 1eca87f1ac..a0e068d64a 100644 --- a/src/frontends/gtk/GTimeout.h +++ b/src/frontends/gtk/GTimeout.h @@ -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: diff --git a/src/frontends/gtk/GToolbar.C b/src/frontends/gtk/GToolbar.C index f01cf0b231..eedfefb3af 100644 --- a/src/frontends/gtk/GToolbar.C +++ b/src/frontends/gtk/GToolbar.C @@ -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( widget->get_data(gToolData)); diff --git a/src/frontends/gtk/GToolbar.h b/src/frontends/gtk/GToolbar.h index 4fa9aca173..cfbc4e5640 100644 --- a/src/frontends/gtk/GToolbar.h +++ b/src/frontends/gtk/GToolbar.h @@ -13,10 +13,11 @@ #ifndef GTOOLBAR_H #define GTOOLBAR_H -#include #include "frontends/Toolbars.h" + #include +#include 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); diff --git a/src/frontends/gtk/GUrl.C b/src/frontends/gtk/GUrl.C index f25ca575db..dfb7bd3bcc 100644 --- a/src/frontends/gtk/GUrl.C +++ b/src/frontends/gtk/GUrl.C @@ -23,6 +23,7 @@ using std::string; namespace lyx { namespace frontend { + GUrl::GUrl(Dialog & parent) : GViewCB(parent, _("URL")) { diff --git a/src/frontends/gtk/GUrl.h b/src/frontends/gtk/GUrl.h index ba547fc371..b342deb835 100644 --- a/src/frontends/gtk/GUrl.h +++ b/src/frontends/gtk/GUrl.h @@ -19,8 +19,7 @@ namespace frontend { class ControlCommand; -class GUrl : public GViewCB -{ +class GUrl : public GViewCB { public: GUrl(Dialog & parent); private: diff --git a/src/frontends/gtk/GView.C b/src/frontends/gtk/GView.C index d37a335cf5..7b46f51b90 100644 --- a/src/frontends/gtk/GView.C +++ b/src/frontends/gtk/GView.C @@ -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); diff --git a/src/frontends/gtk/GView.h b/src/frontends/gtk/GView.h index 5d7967202b..e5c827e093 100644 --- a/src/frontends/gtk/GView.h +++ b/src/frontends/gtk/GView.h @@ -14,6 +14,7 @@ #include "frontends/LyXView.h" #include "bufferview_funcs.h" + #include 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, diff --git a/src/frontends/gtk/GViewBase.C b/src/frontends/gtk/GViewBase.C index 34d8887d9d..2c1c61398f 100644 --- a/src/frontends/gtk/GViewBase.C +++ b/src/frontends/gtk/GViewBase.C @@ -69,6 +69,7 @@ GBC & GViewBase::bcview() return static_cast(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_) diff --git a/src/frontends/gtk/GViewBase.h b/src/frontends/gtk/GViewBase.h index e6113c1d82..1958523b41 100644 --- a/src/frontends/gtk/GViewBase.h +++ b/src/frontends/gtk/GViewBase.h @@ -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 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 xml_; }; template -class GViewCB : public Base -{ +class GViewCB : public Base { public: Controller & controller(); Controller const & controller() const; diff --git a/src/frontends/gtk/GWorkArea.C b/src/frontends/gtk/GWorkArea.C index 0381187ae6..2044cd4258 100644 --- a/src/frontends/gtk/GWorkArea.C +++ b/src/frontends/gtk/GWorkArea.C @@ -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(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; diff --git a/src/frontends/gtk/GWorkArea.h b/src/frontends/gtk/GWorkArea.h index 7ba06fde64..9c9d14d474 100644 --- a/src/frontends/gtk/GWorkArea.h +++ b/src/frontends/gtk/GWorkArea.h @@ -26,13 +26,12 @@ class LyXView; namespace lyx { namespace frontend { -class ColorCache -{ +class ColorCache { +public: typedef std::map Map; typedef Map::iterator MapIt; typedef std::map 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_; diff --git a/src/frontends/gtk/GXpmBtnTbl.C b/src/frontends/gtk/GXpmBtnTbl.C index d22495e4ba..a32e41eab3 100644 --- a/src/frontends/gtk/GXpmBtnTbl.C +++ b/src/frontends/gtk/GXpmBtnTbl.C @@ -9,19 +9,21 @@ */ #include -#include -#include + #include "GXpmBtnTbl.h" +#include + +#include + void GXpmBtnTbl::GXpmBtn::setXpm(XpmData xpm) { Glib::RefPtr 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 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 mask; - Glib::RefPtr pixmap; Glib::RefPtr clrmap = get_colormap(); Gdk::Color fg(const_cast(&xbm.fg_)); clrmap->alloc_color(fg); Glib::RefPtr window = get_window(); - pixmap = Gdk::Pixmap::create_from_data( + + Glib::RefPtr pixmap = Gdk::Pixmap::create_from_data( window, reinterpret_cast(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 mask = Gdk::Bitmap::create( window, reinterpret_cast(xbm.data_), xbm.width_, xbm.height_); - Glib::RefPtr maskBtn; - Glib::RefPtr pixmapBtn; + + + Glib::RefPtr 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 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 maskBtn = + Gdk::Bitmap::create( window, reinterpret_cast(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 mask; - Glib::RefPtr pixmap; + Glib::RefPtr 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 pixmap = + Gdk::Pixmap::create_from_xpm(clrmap, + mask, + xpm); + Gtk::Image * image = SigC::manage(new Gtk::Image(pixmap, mask)); image->show(); btn->add(*image); } diff --git a/src/frontends/gtk/GXpmBtnTbl.h b/src/frontends/gtk/GXpmBtnTbl.h index f2a9d6ca71..dd7295c3ba 100644 --- a/src/frontends/gtk/GXpmBtnTbl.h +++ b/src/frontends/gtk/GXpmBtnTbl.h @@ -15,20 +15,19 @@ #include -class GXpmBtnTbl : public Gtk::Table -{ +class GXpmBtnTbl : public Gtk::Table { public: typedef char const ** XpmData; typedef SigC::Signal2 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 getPixmap() { return pixmap_; } Glib::RefPtr 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 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 diff --git a/src/frontends/gtk/GtkmmX.h b/src/frontends/gtk/GtkmmX.h index ce29b39c2f..8a1ddb6f26 100644 --- a/src/frontends/gtk/GtkmmX.h +++ b/src/frontends/gtk/GtkmmX.h @@ -12,10 +12,11 @@ #ifndef GTKMMX_H #define GTKMMX_H -#include #include #include +#include + inline Display * getDisplay() { diff --git a/src/frontends/gtk/LyXKeySymFactory.C b/src/frontends/gtk/LyXKeySymFactory.C index 950157e380..8e19ab4aa2 100644 --- a/src/frontends/gtk/LyXKeySymFactory.C +++ b/src/frontends/gtk/LyXKeySymFactory.C @@ -10,18 +10,16 @@ #include -#include "frontends/LyXKeySymFactory.h" - #include "GLyXKeySym.h" +#include "frontends/LyXKeySymFactory.h" + namespace LyXKeySymFactory { - LyXKeySym * create() { return new GLyXKeySym; } - } diff --git a/src/frontends/gtk/LyXScreenFactory.C b/src/frontends/gtk/LyXScreenFactory.C index 8bcd1f8fda..a041779eb3 100644 --- a/src/frontends/gtk/LyXScreenFactory.C +++ b/src/frontends/gtk/LyXScreenFactory.C @@ -10,12 +10,13 @@ #include -#include -#include "frontends/LyXScreenFactory.h" - #include "GWorkArea.h" #include "GScreen.h" +#include "frontends/LyXScreenFactory.h" + +#include + namespace LyXScreenFactory { diff --git a/src/frontends/gtk/ghelpers.C b/src/frontends/gtk/ghelpers.C index f943a6452a..1d19e18055 100644 --- a/src/frontends/gtk/ghelpers.C +++ b/src/frontends/gtk/ghelpers.C @@ -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; diff --git a/src/frontends/gtk/io_callback.C b/src/frontends/gtk/io_callback.C index d5b507c9ac..064171ee0d 100644 --- a/src/frontends/gtk/io_callback.C +++ b/src/frontends/gtk/io_callback.C @@ -17,7 +17,9 @@ io_callback::io_callback(int fd, boost::function 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); } diff --git a/src/frontends/gtk/xftFontLoader.C b/src/frontends/gtk/xftFontLoader.C index c68cc0bf6c..6484af7424 100644 --- a/src/frontends/gtk/xftFontLoader.C +++ b/src/frontends/gtk/xftFontLoader.C @@ -9,22 +9,28 @@ */ #include -#include -#include // fabs() -#include #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 + +#include + +#include // fabs() #include -#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); diff --git a/src/frontends/gtk/xftFontLoader.h b/src/frontends/gtk/xftFontLoader.h index 6bfd7351ab..8437a6a619 100644 --- a/src/frontends/gtk/xftFontLoader.h +++ b/src/frontends/gtk/xftFontLoader.h @@ -43,6 +43,7 @@ public: else return doLoad(family, series, shape, size); } + bool isSpecial(LyXFont const & f) { switch (f.family()) { diff --git a/src/frontends/gtk/xftFontMetrics.C b/src/frontends/gtk/xftFontMetrics.C index f95aff0c78..91c36dfd61 100644 --- a/src/frontends/gtk/xftFontMetrics.C +++ b/src/frontends/gtk/xftFontMetrics.C @@ -9,9 +9,7 @@ */ #include -#include -#include #include "GtkmmX.h" #include "support/lstrings.h" #include "xftFontLoader.h" @@ -21,8 +19,12 @@ #include "language.h" #include "codeConvert.h" +#include + #include +#include + 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( + const_cast( 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 wcs(new wchar_t[n]); size_t len;