Gnome Error&Ref popups, change LyXParagraph::size_type, many tweaks to help cxx compile

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1109 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 2000-10-12 15:17:42 +00:00
parent 06f595812c
commit cff99d6de1
20 changed files with 869 additions and 26 deletions

View File

@ -1,3 +1,37 @@
2000-10-12 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
* src/converter.C (runLaTeX): constify buffer argument
(scanLog): ditto.
* src/frontends/support/Makefile.am (INCLUDES): fix.
* src/buffer.h: add std:: qualifier
* src/insets/figinset.C (addpidwait): ditto
* src/MenuBackend.C: ditto
* src/buffer.C: ditto
* src/bufferlist.C: ditto
* src/layout.C: ditto
* src/lyxfunc.C: ditto
2000-10-11 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
* src/lyxtext.h (bidi_level): change return type to
LyXParagraph::size_type.
* src/lyxparagraph.h: change size_type to
TextContainer::difference_type. This should really be
TextContainer::size_type, but we need currently to support signed
values.
2000-10-11 Marko Vendelin <markov@ioc.ee>
* src/frontends/gnome/FormError.h
* src/frontends/gnome/FormRef.C
* src/frontends/gnome/FormRef.h
* src/frontends/gnome/FormError.C
* src/frontends/gnome/Makefile.am
* src/frontends/gnome/pixbutton.h: FormError and FormRef are ported
to Gnome frontend. Both dialogs use "action" area.
2000-10-12 Baruch Even <baruch.even@writeme.com>
* src/graphics/GraphicsCacheItem_pimpl.C:
@ -99,8 +133,8 @@
2000-10-11 Lars Gullik Bjønnes <larsbj@lyx.org>
* src/support/translator.h: move helper template clsses to
lyxfunctional.h, inlcude 2support/lyxfunctional.h"
* src/support/translator.h: move helper template classes to
lyxfunctional.h, include "support/lyxfunctional.h"
* src/support/lyxmanip.h: add delaration of fmt
@ -112,13 +146,13 @@
(compare_memfun_t): new template class
(compare_memfun): helper template function
(equal_1st_in_pair): moved here from translator
(equal_2nd_in_pair): moved here from translatro
(equal_2nd_in_pair): moved here from translator
* src/support/fmt.C: new file
(fmt): new func, can be used for a printf substute when still
(fmt): new func, can be used for a printf substitute when still
using iostreams ex. lyxerr << fmg("Hello %s", "Jürgen") << endl;
* src/support/StrPool.C: add some comment
* src/support/StrPool.C: add some comments
* src/support/Makefile.am (libsupport_la_SOURCES): add fmt.C and
lyxfunctional.h
@ -188,7 +222,7 @@
return NULL
* src/bufferlist.C: add <functional>, "support/lyxmanip.h",
"support/lyxfunctional.h", remove currentview variable.
"support/lyxfunctional.h", remove current_view variable.
(resize): use std::for_each with std::mem_fun
(getFileNames): use std::copy with back_inserter_fun
(getBuffer): change arg type to unsigned int
@ -202,12 +236,11 @@
* src/buffer.h: add typedefs for iterator_category, value_type
difference_type, pointer and reference for inset_iterator
add postfix ++ for inset_iterator
make isnet_iterator::getPos() const
make inset_iterator::getPos() const
* src/buffer.C: added support/lyxmanip.h
(readFile): use lyxerr << fmt instead of printf
(makeLaTeXFile): use std::copy to write out encodings
* src/Painter.C (text): rewrite slightly to avoid extra font variable
@ -223,11 +256,11 @@
* src/LColor.C (getGUIName): remove c_str()
* several files: change all occurances of fl_display to
* several files: change all occurrences of fl_display to
fl_get_display()
* config/lyxinclude.m4 (LYX_PROG_CXX): add a 2.97 clause so
that -pedantid is not used for gcc 2.97 (cvs gcc)
that -pedantic is not used for gcc 2.97 (cvs gcc)
* boost/Makefile.am: begin slowly to prepare for a real boost lib

View File

@ -16,8 +16,10 @@ src/filedlg.C
src/FontLoader.C
src/form1.C
src/frontends/gnome/FormCitation.C
src/frontends/gnome/FormError.C
src/frontends/gnome/FormIndex.C
src/frontends/gnome/FormPrint.C
src/frontends/gnome/FormRef.C
src/frontends/gnome/FormToc.C
src/frontends/gnome/FormUrl.C
src/frontends/gnome/Menubar_pimpl.C

View File

@ -34,6 +34,7 @@ extern BufferList bufferlist;
using std::endl;
using std::vector;
using std::pair;
using std::find_if;
// This is the global menu definition
MenuBackend menubackend;

View File

@ -1889,8 +1889,8 @@ void Buffer::makeLaTeXFile(string const & fname,
encodings.insert((*it)->encoding()->LatexName());
ofs << "\\usepackage[";
copy(encodings.begin(), encodings.end(),
ostream_iterator<string>(ofs, ","));
std::copy(encodings.begin(), encodings.end(),
std::ostream_iterator<string>(ofs, ","));
ofs << doc_encoding << "]{inputenc}\n";
texrow.newline();
} else if (params.inputenc != "default") {

View File

@ -413,7 +413,7 @@ public:
///
class inset_iterator {
public:
typedef input_iterator_tag iterator_category;
typedef std::input_iterator_tag iterator_category;
typedef Inset value_type;
typedef ptrdiff_t difference_type;
typedef Inset * pointer;

View File

@ -43,6 +43,8 @@
using std::vector;
using std::find;
using std::endl;
using std::find_if;
using std::for_each;
//
// Class BufferStorage

View File

@ -447,7 +447,7 @@ string const Converter::SplitFormat(string const & str, string & format)
return using_format;
}
bool Converter::scanLog(Buffer * buffer, string const & command,
bool Converter::scanLog(Buffer const * buffer, string const & command,
string const & filename)
{
BufferView * bv = buffer->getUser();
@ -494,7 +494,7 @@ bool Converter::scanLog(Buffer * buffer, string const & command,
return true;
}
bool Converter::runLaTeX(Buffer * buffer, string const & command)
bool Converter::runLaTeX(Buffer const * buffer, string const & command)
{
BufferView * bv = buffer->getUser();

View File

@ -123,11 +123,11 @@ public:
private:
///
static
bool scanLog(Buffer * buffer, string const & command,
bool scanLog(Buffer const * buffer, string const & command,
string const & filename);
///
static
bool runLaTeX(Buffer * buffer, string const & command);
bool runLaTeX(Buffer const * buffer, string const & command);
///
static
std::vector<Command> commands;

View File

@ -0,0 +1,129 @@
// -*- C++ -*-
/* This file is part of
* ======================================================
*
* LyX, The Document Processor
*
* Copyright 2000 The LyX Team.
*
* ======================================================
*/
#include <config.h>
#ifdef __GNUG__
#pragma implementation
#endif
#include "gettext.h"
#include "Dialogs.h"
#include "FormError.h"
#include "LyXView.h"
#include "buffer.h"
#include "lyxfunc.h"
#include <gtk--/label.h>
#include <gtk--/box.h>
#include <gtk--/button.h>
#include <gtk--/buttonbox.h>
#include <gnome--/stock.h>
#include <gtk--/separator.h>
#include <gtk--/alignment.h>
// temporary solution for LyXView
#include "mainapp.h"
extern GLyxAppWin * mainAppWin;
FormError::FormError(LyXView * lv, Dialogs * d)
: lv_(lv), d_(d), inset_(0), u_(0), h_(0), ih_(0), dialog_(NULL)
{
// let the dialog be shown
// These are permanent connections so we won't bother
// storing a copy because we won't be disconnecting.
d->showError.connect(slot(this, &FormError::showInset));
}
FormError::~FormError()
{
hide();
}
void FormError::showInset( InsetError * const inset )
{
if( dialog_!=NULL || inset == 0 ) return;
inset_ = inset;
ih_ = inset_->hide.connect(slot(this, &FormError::hide));
show();
}
void FormError::show()
{
if (!dialog_)
{
using namespace Gtk::Box_Helpers;
Gtk::Label * label = manage( new Gtk::Label(inset_->getContents()) );
Gtk::Box * hbox = manage( new Gtk::HBox() );
Gtk::Button * b_close = Gtk::wrap( GTK_BUTTON( gnome_stock_button(GNOME_STOCK_BUTTON_CLOSE) ) );
Gtk::Alignment * alg1 = manage( new Gtk::Alignment(0.5, 0.5, 0, 0) );
Gtk::Alignment * mbox = manage( new Gtk::Alignment(0.5, 0.5, 0, 0) );
// set up spacing
hbox->set_spacing(4);
// packing
alg1->add(*b_close);
hbox->children().push_back(Element(*label, false, false));
hbox->children().push_back(Element(*manage(new Gtk::VSeparator()), false, false));
hbox->children().push_back(Element(*alg1, false, false));
mbox->add(*hbox);
// packing dialog to main window
dialog_ = mbox;
mainAppWin->add_action(*dialog_, N_(" Error "));
// setting focus
GTK_WIDGET_SET_FLAGS (GTK_WIDGET(b_close->gtkobj()), GTK_CAN_DEFAULT);
gtk_widget_grab_focus (GTK_WIDGET(b_close->gtkobj()));
gtk_widget_grab_default (GTK_WIDGET(b_close->gtkobj()));
// connecting signals
b_close->clicked.connect(slot(mainAppWin, &GLyxAppWin::remove_action));
dialog_->destroy.connect(slot(this, &FormError::free));
u_ = d_->updateBufferDependent.connect(slot(this, &FormError::update));
h_ = d_->hideBufferDependent.connect(slot(this, &FormError::hide));
}
}
void FormError::update()
{
}
void FormError::hide()
{
if (dialog_!=NULL) mainAppWin->remove_action();
}
void FormError::free()
{
if (dialog_!=NULL)
{
dialog_ = NULL;
u_.disconnect();
h_.disconnect();
inset_ = 0;
ih_.disconnect();
}
}
void FormError::apply()
{
}

View File

@ -0,0 +1,71 @@
// -*- C++ -*-
/* This file is part of
* ======================================================
*
* LyX, The Document Processor
*
* Copyright 2000 The LyX Team.
*
* ======================================================
*/
#ifndef FORMERROR_H
#define FORMERROR_H
#ifdef __GNUG__
#pragma interface
#endif
#include "DialogBase.h"
#include "LString.h"
#include "boost/utility.hpp"
#include "insets/inseterror.h"
#include <gtk--/container.h>
/** This class provides an Gnome implementation of the FormError Dialog.
*/
class FormError : public DialogBase, public noncopyable {
public:
///
FormError(LyXView *, Dialogs *);
///
~FormError();
private:
/// Slot launching dialog to an existing inset
void showInset( InsetError * const );
/// Update dialog before showing it
virtual void update();
/// Apply from dialog (modify or create inset)
virtual void apply();
/// Explicitly free the dialog.
void free();
/// Create the dialog if necessary, update it and display it.
void show();
/// Hide the dialog.
void hide();
/** Which LyXFunc do we use?
We could modify Dialogs to have a visible LyXFunc* instead and
save a couple of bytes per dialog.
*/
LyXView * lv_;
/** Which Dialogs do we belong to?
Used so we can get at the signals we have to connect to.
*/
Dialogs * d_;
/// pointer to the inset passed through showInset (if any)
InsetError * inset_;
/// Update connection.
Connection u_;
/// Hide connection.
Connection h_;
/// inset::hide connection.
Connection ih_;
/// Real GUI implementation.
Gtk::Container * dialog_;
};
#endif

View File

@ -0,0 +1,452 @@
// -*- C++ -*-
/* This file is part of
* ======================================================
*
* LyX, The Document Processor
*
* Copyright 2000 The LyX Team.
*
* ======================================================
*/
#include <config.h>
#ifdef __GNUG__
#pragma implementation
#endif
#include "gettext.h"
#include "Dialogs.h"
#include "FormRef.h"
#include "LyXView.h"
#include "buffer.h"
#include "lyxfunc.h"
#include <gtk--/box.h>
#include <gtk--/buttonbox.h>
#include <gtk--/alignment.h>
#include <gtk--/separator.h>
#include <gtk--/label.h>
#include <gtk--/scrolledwindow.h>
#include <gtk--/entry.h>
#include <gtk--/table.h>
#include <gtk--/menu.h>
#include <gtk--/menuitem.h>
// temporary solution for LyXView
#include "mainapp.h"
extern GLyxAppWin * mainAppWin;
using SigC::bind;
// configuration keys
static string const CONF_ENTRY_NAME("FormRef_name");
// goto button labels
static string const GOTO_REF_LABEL(N_("Goto reference"));
static string const GOTO_BACK_LABEL(N_("Go back"));
FormRef::FormRef(LyXView * lv, Dialogs * d)
: lv_(lv), d_(d), inset_(0), u_(0), h_(0), ih_(0), dialog_(NULL)
{
// let the dialog be shown
// These are permanent connections so we won't bother
// storing a copy because we won't be disconnecting.
d->showRef.connect(slot(this, &FormRef::showInset));
d->createRef.connect(slot(this, &FormRef::createInset));
}
FormRef::~FormRef()
{
hide();
}
void FormRef::showInset( InsetCommand * const inset )
{
if( dialog_!=NULL || inset == 0 ) return;
inset_ = inset;
ih_ = inset_->hide.connect(slot(this, &FormRef::hide));
acttype_ = EDIT;
params = inset->params();
showStageAction();
}
void FormRef::createInset( string const & arg )
{
if( dialog_!=NULL ) return;
acttype_ = INSERT;
params.setFromString( arg );
refs = lv_->buffer()->getLabelList();
if (refs.empty()) showStageError(_("*** No labels found in document ***"));
else showStageSelect();
}
void FormRef::showStageError(string const & mess)
{
if (!dialog_)
{
using namespace Gtk::Box_Helpers;
Gtk::Alignment * alig = manage( new Gtk::Alignment(0.5, 0.5, 0, 0) );
Gtk::Box * box = manage( new Gtk::HBox() );
b_cancel = Gtk::wrap( GTK_BUTTON( gnome_stock_button(GNOME_STOCK_BUTTON_CANCEL) ) );
box->set_spacing(4);
box->children().push_back(Element(*manage( new Gtk::Label(mess) ), false, false));
box->children().push_back(Element(*manage(new Gtk::VSeparator()), false, false));
box->children().push_back(Element(*b_cancel, false, false));
alig->add(*box);
// packing dialog to main window
dialog_ = alig;
mainAppWin->add_action(*dialog_, N_(" Reference "));
// setting focus
gtk_widget_grab_focus (GTK_WIDGET(b_cancel->gtkobj()));
// connecting signals
b_cancel->clicked.connect(slot(mainAppWin, &GLyxAppWin::remove_action));
dialog_->destroy.connect(slot(this, &FormRef::free));
u_ = d_->updateBufferDependent.connect(slot(this, &FormRef::update));
h_ = d_->hideBufferDependent.connect(slot(this, &FormRef::hide));
}
}
void FormRef::showStageSelect()
{
if (!dialog_)
{
using namespace Gtk::Box_Helpers;
Gtk::Box * mbox = manage( new Gtk::HBox() );
Gtk::ButtonBox * bbox = manage( new Gtk::VButtonBox() );
Gtk::Alignment * alig = manage( new Gtk::Alignment(0.5, 0.5, 0, 0) );
Gtk::ScrolledWindow * sw = manage( new Gtk::ScrolledWindow() );
// constructing CList
vector<string> colnames;
colnames.push_back("INVISIBLE");
list_ = manage( new Gtk::CList(colnames) );
// populating CList
vector<string> r;
vector<string>::const_iterator end = refs.end();
for (vector<string>::const_iterator it = refs.begin(); it != end; ++it)
{
r.clear();
r.push_back(*(it));
list_->rows().push_back(r);
}
list_->rows()[0].select(); // there is always at least one item. otherwise we go to stateError
b_ok = Gtk::wrap( GTK_BUTTON( gnome_stock_button(GNOME_STOCK_BUTTON_OK) ) );
b_cancel = Gtk::wrap( GTK_BUTTON( gnome_stock_button(GNOME_STOCK_BUTTON_CANCEL) ) );
// policy
list_->set_selection_mode(GTK_SELECTION_BROWSE); // this ensures that we have always item selected
list_->column_titles_hide();
sw->set_policy(GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
// set up spacing
mbox->set_spacing(2);
bbox->set_spacing(4);
// pack widgets
sw->add(*list_);
bbox->children().push_back(Element(*b_ok, false, false));
bbox->children().push_back(Element(*b_cancel, false, false));
alig->add( *bbox );
mbox->children().push_back(Element(*sw, true, true));
mbox->children().push_back(Element(*manage(new Gtk::VSeparator()), false, false));
mbox->children().push_back(Element(*alig, false, false));
// packing dialog to main window
dialog_ = mbox;
mainAppWin->add_action(*dialog_, N_(" Reference: Select reference "), true);
// setting focus
GTK_WIDGET_SET_FLAGS (GTK_WIDGET(b_ok->gtkobj()), GTK_CAN_DEFAULT);
GTK_WIDGET_SET_FLAGS (GTK_WIDGET(b_cancel->gtkobj()), GTK_CAN_DEFAULT);
GTK_WIDGET_SET_FLAGS (GTK_WIDGET(list_->gtkobj()), GTK_CAN_DEFAULT);
gtk_widget_grab_focus (GTK_WIDGET(list_->gtkobj()));
gtk_widget_grab_default (GTK_WIDGET(b_ok->gtkobj()));
// connecting signals
b_ok->clicked.connect(slot(this, &FormRef::moveFromSelectToAction));
b_cancel->clicked.connect(slot(mainAppWin, &GLyxAppWin::remove_action));
dialog_->destroy.connect(slot(this, &FormRef::free));
u_ = d_->updateBufferDependent.connect(slot(this, &FormRef::update));
h_ = d_->hideBufferDependent.connect(slot(this, &FormRef::hide));
}
}
void FormRef::moveFromSelectToAction()
{
params.setContents( list_->selection()[0][0].get_text() );
// moves to stage "search"
mainAppWin->remove_action();
showStageAction();
}
void FormRef::showStageAction()
{
if (!dialog_)
{
using namespace Gtk::Box_Helpers;
Gtk::Table * table = manage( new Gtk::Table(2, 2, FALSE) );
Gtk::Box * mbox = manage( new Gtk::HBox() );
Gtk::ButtonBox * bbox = manage( new Gtk::HButtonBox() );
b_goto = manage(new Gnome::PixButton(GOTO_REF_LABEL, GNOME_STOCK_PIXMAP_JUMP_TO));
gototype_ = GOREF;
name_ = manage( new Gnome::Entry() );
choice_ = manage( new Gtk::OptionMenu() );
b_ok = Gtk::wrap( GTK_BUTTON( gnome_stock_button(GNOME_STOCK_BUTTON_OK) ) );
b_cancel = Gtk::wrap( GTK_BUTTON( gnome_stock_button(GNOME_STOCK_BUTTON_CANCEL) ) );
// set up spacing
table->set_row_spacings(4);
table->set_col_spacings(4);
mbox->set_spacing(4);
bbox->set_spacing(4);
bbox->set_layout(GTK_BUTTONBOX_SPREAD);
// configure entries
name_->set_history_id(CONF_ENTRY_NAME);
name_->set_max_saved(10);
name_->load_history();
name_->set_use_arrows_always(true);
if( lv_->buffer()->isLatex() ) name_->set_sensitive(false); // Name is irrelevant to LaTeX documents
// fill choice
Gtk::Menu * menu = manage( new Gtk::Menu() );
Gtk::MenuItem * e;
e = manage( new Gtk::MenuItem(N_("Ref")) );
e->activate.connect(bind<Type>(slot(this, &FormRef::changeType), REF));
e->show();
menu->append( *e );
e = manage( new Gtk::MenuItem(N_("Page")) );
e->activate.connect(bind<Type>(slot(this, &FormRef::changeType), PAGEREF));
e->show();
menu->append( *e );
e = manage( new Gtk::MenuItem(N_("TextRef")) );
e->activate.connect(bind<Type>(slot(this, &FormRef::changeType), VREF));
e->show();
menu->append( *e );
e = manage( new Gtk::MenuItem(N_("TextPage")) );
e->activate.connect(bind<Type>(slot(this, &FormRef::changeType), VPAGEREF));
e->show();
menu->append( *e );
e = manage( new Gtk::MenuItem(N_("PrettyRef")) );
e->activate.connect(bind<Type>(slot(this, &FormRef::changeType), PRETTYREF));
e->show();
menu->append( *e );
choice_-> set_menu ( *menu );
switch ( getType() ) {
case REF: { choice_-> set_history(0); break; }
case PAGEREF: { choice_-> set_history(1); break; }
case VREF: { choice_-> set_history(2); break; }
case VPAGEREF: { choice_-> set_history(3); break; }
case PRETTYREF: { choice_-> set_history(4); break; }
}
changeType( getType() );
// filling widgets with data
name_->get_entry()->set_text(params.getOptions());
// pack widgets
bbox->children().push_back(Element(*b_goto, false, false));
bbox->children().push_back(Element(*b_ok, false, false));
bbox->children().push_back(Element(*b_cancel, false, false));
table->attach( *manage( new Gtk::Label(N_("Type:")) ), 0, 1, 0, 1, 0, 0 );
table->attach( *manage( new Gtk::Label(N_("Name:")) ), 0, 1, 1, 2, 0, 0 );
table->attach( *choice_, 1, 2, 0, 1 );
table->attach( *name_, 1, 2, 1, 2 );
mbox->children().push_back(Element(*table, true, true));
mbox->children().push_back(Element(*manage( new Gtk::VSeparator() ), false, false ));
mbox->children().push_back(Element(*bbox, false, false));
// packing dialog to main window
dialog_ = mbox;
mainAppWin->add_action(*dialog_, string(N_(" Reference: ")) + params.getContents() + string(" "));
// setting focus
GTK_WIDGET_SET_FLAGS (GTK_WIDGET(b_cancel->gtkobj()), GTK_CAN_DEFAULT);
GTK_WIDGET_SET_FLAGS (GTK_WIDGET(b_ok->gtkobj()), GTK_CAN_DEFAULT);
GTK_WIDGET_SET_FLAGS (GTK_WIDGET(b_goto->gtkobj()), GTK_CAN_DEFAULT);
gtk_widget_grab_default (GTK_WIDGET(b_ok->gtkobj()));
gtk_widget_grab_focus (GTK_WIDGET(choice_->gtkobj()));
// connecting signals
b_cancel->clicked.connect(slot(mainAppWin, &GLyxAppWin::remove_action));
b_ok->clicked.connect(slot(this, &FormRef::apply));
b_goto->clicked.connect(slot(this, &FormRef::gotoRef));
dialog_->destroy.connect(slot(this, &FormRef::free));
u_ = d_->updateBufferDependent.connect(slot(this, &FormRef::update));
h_ = d_->hideBufferDependent.connect(slot(this, &FormRef::hide));
}
}
void FormRef::hide()
{
if (dialog_!=NULL) mainAppWin->remove_action();
}
void FormRef::free()
{
if (dialog_!=NULL)
{
dialog_ = NULL;
u_.disconnect();
h_.disconnect();
inset_ = 0;
ih_.disconnect();
}
}
void FormRef::gotoRef()
{
switch (gototype_) {
case GOREF:
{
lv_->getLyXFunc()-> Dispatch(LFUN_REF_GOTO, params.getContents());
gototype_ = GOBACK;
b_goto->set_text(GOTO_BACK_LABEL);
break;
}
case GOBACK:
{
lv_->getLyXFunc()->Dispatch(LFUN_REF_BACK);
gototype_ = GOREF;
b_goto->set_text(GOTO_REF_LABEL);
break;
}
}
}
void FormRef::apply()
{
if ( lv_->buffer()->isReadonly() )
return;
params.setCmdName(getName(reftype_));
params.setOptions(name_->get_entry()->get_text());
if (inset_ != 0)
{
// Only update if contents have changed
if (params != inset_->params())
{
inset_->setParams(params);
lv_->view()->updateInset(inset_, true);
}
}
else
{
lv_->getLyXFunc()->Dispatch(LFUN_REF_INSERT,
params.getAsString());
}
// save configuration
name_->save_history();
// hide the dialog
hide();
}
void FormRef::changeType(Type t)
{
reftype_ = t;
}
FormRef::Type FormRef::getType() const
{
Type type;
if( params.getCmdName() == "ref" )
type = REF;
else if( params.getCmdName() == "pageref" )
type = PAGEREF;
else if( params.getCmdName() == "vref" )
type = VREF;
else if( params.getCmdName() == "vpageref" )
type = VPAGEREF;
else
type = PRETTYREF;
return type;
}
string FormRef::getName( Type type ) const
{
string name;
switch( type ) {
case REF:
name = "ref";
break;
case PAGEREF:
name = "pageref";
break;
case VREF:
name = "vref";
break;
case VPAGEREF:
name = "vpageref";
break;
case PRETTYREF:
name = "prettyref";
break;
}
return name;
}

View File

@ -0,0 +1,141 @@
// -*- C++ -*-
/* This file is part of
* ======================================================
*
* LyX, The Document Processor
*
* Copyright 2000 The LyX Team.
*
* ======================================================
*/
#ifndef FORMREF_H
#define FORMREF_H
#ifdef __GNUG__
#pragma interface
#endif
#include "DialogBase.h"
#include "LString.h"
#include "boost/utility.hpp"
#include "insets/insetcommand.h"
#include <gtk--/container.h>
#include <gtk--/clist.h>
#include <gtk--/button.h>
#include <gnome--/entry.h>
#include <gtk--/optionmenu.h>
#include <gtk--/menu.h>
#include "pixbutton.h"
/** This class provides an Gnome implementation of the FormRef Dialog.
*/
class FormRef : public DialogBase, public noncopyable {
public:
///
FormRef(LyXView *, Dialogs *);
///
~FormRef();
private:
///
enum Type{
///
REF,
///
PAGEREF,
///
VREF,
///
VPAGEREF,
///
PRETTYREF
};
///
enum Goto{
///
GOREF,
///
GOBACK
};
///
enum ActionType {
///
INSERT,
///
EDIT
};
/// Slot launching dialog to (possibly) create a new inset
void createInset( string const & );
/// Slot launching dialog to an existing inset
void showInset( InsetCommand * const );
/// Update dialog before showing it (not used in this implementation)
virtual void update() { hide(); }
/// Apply from dialog (modify or create inset)
virtual void apply();
/// Explicitly free the dialog.
void free();
/// dummy function
virtual void show() { }
/// Show selection of the references
void showStageSelect();
/// Edit properties
void showStageAction();
/// Error (no labels)
void showStageError(string const & mess);
/// Hide the dialog.
void hide();
/// Go to reference or return back
void gotoRef();
/// moves from Search to Select "stage"
void moveFromSelectToAction();
/// changes the type of the reference
void changeType(Type);
///
Type getType() const;
///
string getName( Type type ) const;
/** Which LyXFunc do we use?
We could modify Dialogs to have a visible LyXFunc* instead and
save a couple of bytes per dialog.
*/
LyXView * lv_;
/** Which Dialogs do we belong to?
Used so we can get at the signals we have to connect to.
*/
Dialogs * d_;
/// pointer to the inset passed through showInset (if any)
InsetCommand * inset_;
/// the nitty-griity. What is modified and passed back
InsetCommandParams params;
/// Update connection.
Connection u_;
/// Hide connection.
Connection h_;
/// inset::hide connection.
Connection ih_;
///
std::vector<string> refs;
///
Type reftype_;
///
Goto gototype_;
///
ActionType acttype_;
/// Real GUI implementation.
Gtk::Container * dialog_;
Gtk::CList * list_;
Gtk::Button * b_ok;
Gtk::Button * b_cancel;
Gnome::Entry * name_;
Gtk::OptionMenu * choice_;
Gnome::PixButton * b_goto;
};
#endif

View File

@ -43,8 +43,12 @@ libgnome_la_SOURCES = \
FormCitation.h \
FormCopyright.C \
FormCopyright.h \
FormError.C \
FormError.h \
FormPrint.C \
FormPrint.h \
FormRef.C \
FormRef.h \
FormUrl.C \
FormUrl.h \
FormIndex.C \

View File

@ -28,7 +28,7 @@ namespace Gnome
PixButton(string label, string pixname): Button()
{
Gtk::Box * b = manage( new Gtk::HBox() );
Gtk::Label * l = manage( new Gtk::Label(label) );
l = manage( new Gtk::Label(label) );
Gnome::Pixmap * p = Gtk::wrap( GNOME_PIXMAP( gnome_stock_pixmap_widget(NULL, pixname.c_str()) ) );
b->set_spacing(3);
@ -46,8 +46,11 @@ namespace Gnome
guint get_accelkey() { return accelkey_; }
void set_text(string const & newlabel) { l->set_text(newlabel); }
protected:
guint accelkey_;
Gtk::Label * l;
};
}

View File

@ -4,8 +4,8 @@ MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
noinst_LTLIBRARIES = libfrontendsupport.la
LIBS =
ETAGS_ARGS = --lang=c++
INCLUDES = -I${srcdir}/../ $(SIGC_CFLAGS)
INCLUDES = -I${srcdir}/../../ $(SIGC_CFLAGS)
libfrontendsupport_la_SOURCES = \
LyXImage.h \
LyXImage.C
LyXImage.C

View File

@ -139,7 +139,7 @@ void addpidwait(int pid)
if (lyxerr.debugging()) {
lyxerr << "Pids to wait for: \n";
copy(pidwaitlist.begin(), pidwaitlist.end(),
ostream_iterator<int>(lyxerr, "\n"));
std::ostream_iterator<int>(lyxerr, "\n"));
lyxerr << flush;
}
}

View File

@ -30,6 +30,8 @@ using std::pair;
using std::make_pair;
using std::sort;
using std::endl;
using std::find_if;
using std::remove_if;
// Global variable: textclass table.
LyXTextClassList textclasslist;

View File

@ -90,7 +90,7 @@
using std::pair;
using std::endl;
using std::find_if;
extern void InsertAsciiFile(BufferView *, string const &, bool);
extern void math_insert_symbol(string const &);

View File

@ -124,14 +124,17 @@ public:
///
typedef std::vector<value_type> TextContainer;
///
typedef int size_type;
/* This should be TextContainer::size_type, but we need
signed values for now.
*/
typedef TextContainer::difference_type size_type;
///
LyXParagraph();
/// this konstruktor inserts the new paragraph in a list
/// this constructor inserts the new paragraph in a list
explicit
LyXParagraph(LyXParagraph * par);
/// the destruktors removes the new paragraph from the list
/// the destructor removes the new paragraph from the list
~LyXParagraph();
///

View File

@ -506,7 +506,7 @@ public:
}
///
inline
int bidi_level(LyXParagraph::size_type pos) const {
LyXParagraph::size_type bidi_level(LyXParagraph::size_type pos) const {
if (bidi_start == -1)
return 0;
else