+2000-09-25 Juergen Vigna <jug@sad.it>
+
+ * src/insets/insettext.C (LocalDispatch): don't set the layout on
+ non breakable paragraphs.
+
+2000-09-25 Garst R. Reese <reese@isn.net>
+
+ * src/language.C (initL): added missing language_country codes.
+
+2000-09-25 Juergen Vigna <jug@sad.it>
+
+ * src/insets/insettext.C (InsetText):
+ (deleteLyXText): remove the not released LyXText structure!
+
+2000-09-24 Marko Vendelin <markov@ioc.ee>
+
+ * src/frontends/gnome/mainapp.C
+ * src/frontends/gnome/mainapp.h: added support for keyboard
+ accelerators
+
+ * src/frontends/gnome/FormCitation.C
+ * src/frontends/gnome/FormCitation.h
+ * src/frontends/gnome/Makefile.am
+ * src/frontends/gnome/pixbutton.h: completed the rewrite of
+ FormCitation to use "action area" in mainapp window
+
+ * src/frontends/gnome/Menubar_pimpl.C
+ * src/frontends/gnome/Menubar_pimpl.h: Gnome menu can handle
+ large TOC.
+
+2000-09-23 Dekel Tsur <dekel@math.tau.ac.il>
+
+ * src/mathed/formula.C (MathFuncInset::Metrics): Use default
+ width/descent/ascent values if name is empty.
+ (mathed_string_height): Use std::max.
+
2000-09-25 Allan Rae <rae@lyx.org>
* src/frontends/xforms/forms/form_preferences.fd: resize to stop
#include <gnome--/stock.h>
#include <gtk--/separator.h>
#include <libgnome/gnome-config.h>
+#include <gtk--/alignment.h>
+#include "pixbutton.h"
// temporary solution for LyXView
#include "mainapp.h"
// configuration keys
static string const LOCAL_CONFIGURE_PREFIX("FormCitation");
-static string const CONF_DIALOG_WIDTH("width");
-static string const CONF_DIALOG_WIDTH_DEFAULT("=550");
-
-static string const CONF_DIALOG_HEIGTH("heigth");
-static string const CONF_DIALOG_HEIGTH_DEFAULT("=550");
-
static string const CONF_PANE_INFO("paneinfo");
static string const CONF_PANE_INFO_DEFAULT("=300");
-static string const CONF_PANE_KEY("panekey");
-static string const CONF_PANE_KEY_DEFAULT("=225");
-
static string const CONF_COLUMN("column");
static string const CONF_COLUMN_DEFAULT("=50");
static string const CONF_TEXTAFTER("FormCitation_textafter");
FormCitation::FormCitation(LyXView * lv, Dialogs * d)
- : lv_(lv), d_(d), inset_(0), u_(0), h_(0), ih_(0), dialog_(NULL)
+ : lv_(lv), d_(d), inset_(0), u_(0), h_(0), ih_(0)
{
// let the dialog be shown
// These are permanent connections so we won't bother
// storing a copy because we won't be disconnecting.
d->showCitation.connect(slot(this, &FormCitation::showInset));
d->createCitation.connect(slot(this, &FormCitation::createInset));
-}
+ cleanupWidgets();
+}
FormCitation::~FormCitation()
{
h_ = d_->hideBufferDependent.connect(slot(this, &FormCitation::hide));
params = inset->params();
- //showStageEdit();
+
+ if ( params.getContents().empty() ) showStageSearch();
+ else showStageAction();
}
}
}
+
+void FormCitation::cleanupWidgets()
+{
+ dialog_ = NULL;
+ b_ok = NULL;
+ b_cancel = NULL;
+ search_text_ = NULL;
+ info_ = NULL;
+ text_after_ = NULL;
+ button_unselect_ = NULL;
+ button_up_ = NULL;
+ button_down_ = NULL;
+ button_regexp_ = NULL;
+ clist_selected_ = NULL;
+ clist_bib_ = NULL;
+ paned_info_ = NULL;
+}
+
+
+void FormCitation::initWidgets()
+{
+ string const path = PACKAGE "/" + LOCAL_CONFIGURE_PREFIX;
+
+ if (search_text_ != NULL)
+ {
+ search_text_->set_history_id(CONF_SEARCH);
+ search_text_->set_max_saved(10);
+ search_text_->load_history();
+ search_text_->set_use_arrows_always(true);
+ }
+
+ if (text_after_ != NULL )
+ {
+ text_after_->set_history_id(CONF_TEXTAFTER);
+ text_after_->set_max_saved(10);
+ text_after_->load_history();
+ text_after_->set_use_arrows_always(true);
+ text_after_->get_entry()->set_text(params.getOptions());
+ }
+
+ if (button_regexp_ != NULL)
+ {
+ string w = path + "/" + CONF_REGEXP + CONF_REGEXP_DEFAULT;
+ button_regexp_->set_active( (gnome_config_get_int(w.c_str()) > 0) );
+ }
+
+ if (paned_info_ != NULL)
+ {
+ string w = path + "/" + CONF_PANE_INFO + CONF_PANE_INFO_DEFAULT;
+ paned_info_->set_position( gnome_config_get_int(w.c_str()) );
+ }
+
+ if (clist_bib_ != NULL)
+ {
+ // preferences
+ clist_bib_->column(0).set_visiblity(false);
+ clist_bib_->set_selection_mode(GTK_SELECTION_BROWSE);
+
+ // setting up sizes of columns
+ string w;
+ int sz = clist_bib_->columns().size();
+ for (int i = 0; i < sz; ++i)
+ {
+ w = path + "/" + CONF_COLUMN + "_" + tostr(i) + CONF_COLUMN_DEFAULT;
+ clist_bib_->column(i).set_width( gnome_config_get_int(w.c_str()) );
+ }
+
+ // retrieving data
+ vector<pair<string,string> > blist = lv_->buffer()->getBibkeyList();
+
+ sz = blist.size();
+ for (int i = 0; i < sz; ++i )
+ {
+ bibkeys.push_back(blist[i].first);
+ bibkeysInfo.push_back(blist[i].second);
+ }
+
+ blist.clear();
+
+ // updating list
+ search();
+
+ if (clist_bib_->rows().size() > 0)
+ {
+ clist_bib_->rows()[0].select();
+ selectionToggled(0, 0, NULL, true, false);
+ }
+ }
+
+ if (clist_selected_ != NULL)
+ {
+ clist_selected_->set_selection_mode(GTK_SELECTION_BROWSE);
+
+ // populating clist_selected_
+ vector<string> r;
+ string tmp, keys( params.getContents() );
+ keys = frontStrip( split(keys, tmp, ',') );
+ while( !tmp.empty() )
+ {
+ r.clear();
+ r.push_back(tmp);
+ clist_selected_->rows().push_back(r);
+
+ keys = frontStrip( split(keys, tmp, ',') );
+ }
+
+ if (clist_selected_->rows().size() > 0)
+ {
+ clist_selected_->rows()[0].select();
+ selectionToggled(0, 0, NULL, true, true);
+ }
+ }
+
+ updateButtons();
+}
+
+
+void FormCitation::storeWidgets()
+{
+ string const path = PACKAGE "/" + LOCAL_CONFIGURE_PREFIX;
+
+ if (search_text_ != NULL) search_text_->save_history();
+
+ if (text_after_ != NULL) text_after_->save_history();
+
+ if (button_regexp_ != NULL)
+ {
+ string w = path + "/" + CONF_REGEXP;
+ gnome_config_set_int(w.c_str(), button_regexp_->get_active());
+ }
+
+ if (paned_info_ != NULL)
+ {
+ string w = path + "/" + CONF_PANE_INFO;
+ gnome_config_set_int(w.c_str(), paned_info_->width() - info_->width());
+ }
+
+ if (clist_bib_ != NULL)
+ {
+ string w;
+ int const sz = clist_bib_->columns().size();
+ for (int i = 0; i < sz; ++i)
+ {
+ w = path + "/" + CONF_COLUMN + "_" + tostr(i);
+ gnome_config_set_int(w.c_str(), clist_bib_->get_column_width(i));
+ }
+ }
+
+ gnome_config_sync();
+}
+
+
+void FormCitation::showStageAction()
+{
+ if (!dialog_)
+ {
+ using namespace Gtk::Box_Helpers;
+
+ Gtk::Alignment * mbox = manage( new Gtk::Alignment(0.5, 0.5, 0, 0) );
+ Gtk::ButtonBox * bbox = manage( new Gtk::HButtonBox() );
+
+ string const addlabel = N_("_Add new citation");
+ string const editlabel = N_("_Edit/remove citation(s)");
+
+ Gnome::PixButton * b_add = manage(new Gnome::PixButton(addlabel, GNOME_STOCK_PIXMAP_NEW));
+ Gnome::PixButton * b_edit = manage(new Gnome::PixButton(editlabel, GNOME_STOCK_PIXMAP_PROPERTIES));
+
+ b_cancel = Gtk::wrap( GTK_BUTTON( gnome_stock_button(GNOME_STOCK_BUTTON_CANCEL) ) );
+
+ // set up spacing
+ bbox->set_spacing(4);
+ bbox->set_layout(GTK_BUTTONBOX_SPREAD);
+
+ bbox->children().push_back(Element(*b_add, false, false));
+ bbox->children().push_back(Element(*b_edit, false, false));
+ bbox->children().push_back(Element(*b_cancel, false, false));
+
+ mbox->add(*bbox);
+
+ // accelerators
+ Gtk::AccelGroup * accel = Gtk::AccelGroup::create();
+
+ b_add->add_accelerator("clicked", *accel, b_add->get_accelkey(), 0, GTK_ACCEL_VISIBLE);
+ b_edit->add_accelerator("clicked", *accel, b_edit->get_accelkey(), 0, GTK_ACCEL_VISIBLE);
+
+ // packing dialog to main window
+ dialog_ = mbox;
+ mainAppWin->add_action(*dialog_, N_(" Citation: Select action "), false, accel);
+
+ initWidgets();
+
+ // setting focus
+ gtk_widget_grab_focus (GTK_WIDGET(b_add->gtkobj()));
+
+ // connecting signals
+ b_add->clicked.connect(slot(this, &FormCitation::moveFromActionToSearch));
+ b_edit->clicked.connect(slot(this, &FormCitation::moveFromActionToEdit));
+
+ b_cancel->clicked.connect(slot(mainAppWin, &GLyxAppWin::remove_action));
+
+ dialog_->destroy.connect(slot(this, &FormCitation::free));
+ }
+}
+
+
+void FormCitation::moveFromActionToSearch()
+{
+ // stores configuration and cleans all widgets
+ storeWidgets();
+ cleanupWidgets();
+
+ // moves to stage "search"
+ mainAppWin->remove_action();
+ showStageSearch();
+}
+
+
+void FormCitation::moveFromActionToEdit()
+{
+ // stores configuration and cleans all widgets
+ storeWidgets();
+ cleanupWidgets();
+
+ // moves to stage "edit"
+ mainAppWin->remove_action();
+ showStageEdit();
+}
+
+
void FormCitation::showStageSearch()
{
if (!dialog_)
mbox->set_spacing(4);
bbox->set_spacing(4);
- search_text_->set_history_id(CONF_SEARCH);
- search_text_->set_max_saved(10);
- search_text_->load_history();
- search_text_->set_use_arrows_always(true);
-
// packing
bbox->children().push_back(Element(*b_ok, false, false));
bbox->children().push_back(Element(*b_cancel, false, false));
dialog_ = mbox;
mainAppWin->add_action(*dialog_, N_(" Insert Citation: Enter keyword(s) or regular expression "));
+ initWidgets();
+
// setting focus
GTK_WIDGET_SET_FLAGS (GTK_WIDGET(search_text_->get_entry()->gtkobj()), GTK_CAN_DEFAULT);
gtk_widget_grab_focus (GTK_WIDGET(search_text_->get_entry()->gtkobj()));
gtk_widget_grab_default (GTK_WIDGET(search_text_->get_entry()->gtkobj()));
- // restoring regexp setting
- string path = PACKAGE "/" + LOCAL_CONFIGURE_PREFIX;
- string w;
- w = path + "/" + CONF_REGEXP + CONF_REGEXP_DEFAULT;
- button_regexp_->set_active( (gnome_config_get_int(w.c_str()) > 0) );
-
// connecting signals
b_ok->clicked.connect(slot(this, &FormCitation::moveFromSearchToSelect));
search_text_->get_entry()->activate.connect(slot(this, &FormCitation::moveFromSearchToSelect));
b_cancel->clicked.connect(slot(mainAppWin, &GLyxAppWin::remove_action));
-
dialog_->destroy.connect(slot(this, &FormCitation::free));
}
}
{
search_string_ = search_text_->get_entry()->get_text();
use_regexp_ = button_regexp_->get_active();
-
- // saving configuration
- search_text_->save_history();
- string path = PACKAGE "/" + LOCAL_CONFIGURE_PREFIX;
- string w;
- w = path + "/" + CONF_REGEXP;
- gnome_config_set_int(w.c_str(), button_regexp_->get_active());
- gnome_config_sync();
+ // stores configuration and cleans all widgets
+ storeWidgets();
+ cleanupWidgets();
// moves to stage "select"
- dialog_ = NULL;
mainAppWin->remove_action();
showStageSelect();
}
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) ) );
- // setup text_after_
- text_after_->set_history_id(CONF_TEXTAFTER);
- text_after_->set_max_saved(10);
- text_after_->load_history();
- text_after_->set_use_arrows_always(true);
-
sw->set_policy(GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
// constructing CList
colnames.push_back(N_("Year"));
colnames.push_back(N_("Journal"));
clist_bib_ = manage( new Gtk::CList(colnames) );
- clist_bib_->column(0).set_visiblity(false);
bbox->set_layout(GTK_BUTTONBOX_END);
dialog_ = mbox;
mainAppWin->add_action(*dialog_, N_(" Insert Citation: Select citation "), true);
+ initWidgets();
+
// 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_grab_focus (GTK_WIDGET(clist_bib_->gtkobj()));
gtk_widget_grab_default (GTK_WIDGET(b_ok->gtkobj()));
- // setting sizes of the widgets
- string path = PACKAGE "/" + LOCAL_CONFIGURE_PREFIX;
- string w = path + "/" + CONF_PANE_INFO + CONF_PANE_INFO_DEFAULT;
-
- paned_info_->set_position( gnome_config_get_int(w.c_str()) );
-
- int sz = clist_bib_->columns().size();
- for (int i = 0; i < sz; ++i)
- {
- w = path + "/" + CONF_COLUMN + "_" + tostr(i) + CONF_COLUMN_DEFAULT;
- clist_bib_->column(i).set_width( gnome_config_get_int(w.c_str()) );
- }
-
// connecting signals
b_ok->clicked.connect(slot(this, &FormCitation::applySelect));
+ text_after_->get_entry()->activate.connect(slot(this, &FormCitation::applySelect));
+
b_cancel->clicked.connect(slot(mainAppWin, &GLyxAppWin::remove_action));
dialog_->destroy.connect(slot(this, &FormCitation::free));
clist_bib_->click_column.connect(slot(this, &FormCitation::sortBibList));
- clist_bib_->select_row.connect(bind(slot(this, &FormCitation::selection_toggled),
+ clist_bib_->select_row.connect(bind(slot(this, &FormCitation::selectionToggled),
true, false));
- clist_bib_->unselect_row.connect(bind(slot(this, &FormCitation::selection_toggled),
+ clist_bib_->unselect_row.connect(bind(slot(this, &FormCitation::selectionToggled),
false, false));
- // retrieving data
- vector<pair<string,string> > blist = lv_->buffer()->getBibkeyList();
-
- sz = blist.size();
- for (int i = 0; i < sz; ++i )
- {
- bibkeys.push_back(blist[i].first);
- bibkeysInfo.push_back(blist[i].second);
- }
-
- blist.clear();
-
- // updating list
- search();
}
}
-/*void FormCitation::show()
+void FormCitation::showStageEdit()
{
if (!dialog_)
{
- GtkWidget * pd = create_DiaInsertCitation();
-
- dialog_ = Gtk::wrap(pd);
- clist_selected_ = Gtk::wrap( GTK_CLIST( lookup_widget(pd, "clist_selected") ) );
- info_ = Gtk::wrap( GNOME_LESS( lookup_widget(pd, "info") ) );
- text_after_ = Gtk::wrap( GNOME_ENTRY( lookup_widget(pd, "text_after") ) );
- search_text_ = Gtk::wrap( GNOME_ENTRY( lookup_widget(pd, "search_text") ) );
-
- button_select_ = Gtk::wrap( GTK_BUTTON( lookup_widget(pd, "button_select") ) );
- button_unselect_ = Gtk::wrap( GTK_BUTTON( lookup_widget(pd, "button_unselect") ) );
- button_up_ = Gtk::wrap( GTK_BUTTON( lookup_widget(pd, "button_up") ) );
- button_down_ = Gtk::wrap( GTK_BUTTON( lookup_widget(pd, "button_down") ) );
- button_search_ = Gtk::wrap( GTK_BUTTON( lookup_widget(pd, "button_search") ) );
-
- button_regexp_ = Gtk::wrap( GTK_CHECK_BUTTON( lookup_widget(pd, "button_regexp") ) );
-
- paned_info_ = Gtk::wrap( GTK_PANED( lookup_widget(pd, "vpaned_info") ) );
- paned_key_ = Gtk::wrap( GTK_PANED( lookup_widget(pd, "hpaned_key") ) );
- box_keys_ = Gtk::wrap( GTK_BOX( lookup_widget(pd, "vbox_keys") ) );
-
- b_ok = Gtk::wrap( GTK_BUTTON( lookup_widget(pd, "button_ok") ) );
- b_cancel = Gtk::wrap( GTK_BUTTON( lookup_widget(pd, "button_cancel") ) );
-
- // constructing and packing CList
+ using namespace Gtk::Box_Helpers;
+
+ Gtk::Box * mbox = manage( new Gtk::VBox() );
+ Gtk::Box * tbox = manage( new Gtk::HBox() );
+ Gtk::Box * t2box = manage( new Gtk::HBox() );
+ Gtk::ButtonBox * bbox = manage( new Gtk::HButtonBox() );
+ Gtk::ButtonBox * actbbox = manage( new Gtk::VButtonBox() );
+ Gtk::ScrolledWindow * sw = manage( new Gtk::ScrolledWindow() );
+
vector<string> colnames;
- colnames.push_back("INVISIBLE");
- colnames.push_back(N_("Key"));
- colnames.push_back(N_("Author(s)"));
- colnames.push_back(N_("Title"));
- colnames.push_back(N_("Year"));
- colnames.push_back(N_("Journal"));
- clist_bib_ = manage( new Gtk::CList(colnames) );
- clist_bib_->column(0).set_visiblity(false);
+ colnames.push_back(" ");
+ clist_selected_ = manage( new Gtk::CList(colnames) );
+ clist_selected_->column_titles_hide();
- Gtk::ScrolledWindow * sw_ = Gtk::wrap( GTK_SCROLLED_WINDOW( lookup_widget(pd, "scrolledwindow_bib") ) );
- sw_->add(*clist_bib_);
-
- // populating buttons with icons
- Gnome::Pixmap * p;
- p = Gtk::wrap( GNOME_PIXMAP( gnome_stock_pixmap_widget(NULL, GNOME_STOCK_PIXMAP_BACK) ) );
- button_select_->add(*p);
- p = Gtk::wrap( GNOME_PIXMAP( gnome_stock_pixmap_widget(NULL, GNOME_STOCK_PIXMAP_TRASH) ) );
- button_unselect_->add(*p);
- p = Gtk::wrap( GNOME_PIXMAP( gnome_stock_pixmap_widget(NULL, GNOME_STOCK_PIXMAP_UP) ) );
- button_up_->add(*p);
- p = Gtk::wrap( GNOME_PIXMAP( gnome_stock_pixmap_widget(NULL, GNOME_STOCK_PIXMAP_DOWN) ) );
- button_down_->add(*p);
+ text_after_ = manage( new Gnome::Entry() );
+ button_unselect_ = manage( new Gnome::PixButton( N_("_Remove"), GNOME_STOCK_PIXMAP_TRASH ) );
+ button_up_ = manage( new Gnome::PixButton( N_("_Up"), GNOME_STOCK_PIXMAP_UP ) );
+ button_down_ = manage( new Gnome::PixButton( N_("_Down"), GNOME_STOCK_PIXMAP_DOWN ) );
- // connecting signals
- clist_bib_->click_column.connect(slot(this, &FormCitation::sortBibList));
+ 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) ) );
- clist_selected_->select_row.connect(bind(slot(this, &FormCitation::selection_toggled),
- true, true));
- clist_bib_->select_row.connect(bind(slot(this, &FormCitation::selection_toggled),
- true, false));
- clist_selected_->unselect_row.connect(bind(slot(this, &FormCitation::selection_toggled),
- false, true));
- clist_bib_->unselect_row.connect(bind(slot(this, &FormCitation::selection_toggled),
- false, false));
-
- button_select_->clicked.connect(slot(this, &FormCitation::newCitation));
- button_unselect_->clicked.connect(slot(this, &FormCitation::removeCitation));
- button_up_->clicked.connect(slot(this, &FormCitation::moveCitationUp));
- button_down_->clicked.connect(slot(this, &FormCitation::moveCitationDown));
+ sw->set_policy(GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
- search_text_->get_entry()->activate.connect(slot(this, &FormCitation::search));
- button_search_->clicked.connect(slot(this, &FormCitation::search));
+ bbox->set_layout(GTK_BUTTONBOX_END);
+ actbbox->set_layout(GTK_BUTTONBOX_START);
- b_ok->clicked.connect(slot(this, &FormCitation::apply));
- b_ok->clicked.connect(dialog_->destroy.slot());
- b_cancel->clicked.connect(dialog_->destroy.slot());
- dialog_->destroy.connect(slot(this, &FormCitation::free));
+ // set up spacing
+ mbox->set_spacing(4);
+ bbox->set_spacing(4);
+ actbbox->set_spacing(4);
+ tbox->set_spacing(4);
+ t2box->set_spacing(4);
- u_ = d_->updateBufferDependent.connect(slot(this, &FormCitation::update));
- h_ = d_->hideBufferDependent.connect(slot(this, &FormCitation::hide));
+ // packing widgets
+ sw->add(*clist_selected_);
- // setting sizes of the widgets
- string path;
- string w, h;
- path += PACKAGE "/" LOCAL_CONFIGURE_PREFIX;
- w = path + "/" + CONF_DIALOG_WIDTH + CONF_DIALOG_WIDTH_DEFAULT;
- h = path + "/" + CONF_DIALOG_HEIGTH + CONF_DIALOG_HEIGTH_DEFAULT;
- dialog_->set_usize(gnome_config_get_int(w.c_str()),
- gnome_config_get_int(h.c_str()));
+ bbox->children().push_back(Element(*b_ok, false, false));
+ bbox->children().push_back(Element(*b_cancel, false, false));
- w = path + "/" + CONF_PANE_INFO + CONF_PANE_INFO_DEFAULT;
- paned_info_->set_position( gnome_config_get_int(w.c_str()) );
+ actbbox->children().push_back(Element(*button_unselect_, false, false));
+ actbbox->children().push_back(Element(*button_up_, false, false));
+ actbbox->children().push_back(Element(*button_down_, false, false));
- w = path + "/" + CONF_PANE_KEY + CONF_PANE_KEY_DEFAULT;
- paned_key_->set_position( gnome_config_get_int(w.c_str()) );
+ t2box->children().push_back(Element(*sw, true, true));
+ t2box->children().push_back(Element(*actbbox, false, false));
- int i, sz;
- for (i = 0, sz = clist_bib_->columns().size(); i < sz; ++i)
- {
- w = path + "/" + CONF_COLUMN + "_" + tostr(i) + CONF_COLUMN_DEFAULT;
- clist_bib_->column(i).set_width( gnome_config_get_int(w.c_str()) );
- }
+ tbox->children().push_back(Element(*manage(new Gtk::Label(N_("Text after"))), false, false));
+ tbox->children().push_back(Element(*text_after_, true, true));
+ tbox->children().push_back(Element(*manage(new Gtk::VSeparator()), false, false));
+ tbox->children().push_back(Element(*bbox, false, false));
- // restoring regexp setting
- w = path + "/" + CONF_REGEXP + CONF_REGEXP_DEFAULT;
- button_regexp_->set_active( (gnome_config_get_int(w.c_str()) > 0) );
+ mbox->children().push_back(Element(*t2box,true,true));
+ mbox->children().push_back(Element(*manage(new Gtk::HSeparator()), false, false));
+ mbox->children().push_back(Element(*tbox, false, false));
- // ready to go...
- if (!dialog_->is_visible()) dialog_->show_all();
+ // accelerators
+ Gtk::AccelGroup * accel = Gtk::AccelGroup::create();
- update(); // make sure its up-to-date
- }
- else
- {
- Gdk_Window dialog_win(dialog_->get_window());
- dialog_win.raise();
+ button_unselect_->add_accelerator("clicked", *accel, button_unselect_->get_accelkey(), 0, GTK_ACCEL_VISIBLE);
+ button_up_->add_accelerator("clicked", *accel, button_up_->get_accelkey(), 0, GTK_ACCEL_VISIBLE);
+ button_down_->add_accelerator("clicked", *accel, button_down_->get_accelkey(), 0, GTK_ACCEL_VISIBLE);
+
+ // packing dialog to main window
+ dialog_ = mbox;
+ mainAppWin->add_action(*dialog_, N_(" Citation: Edit "), true, accel);
+
+ initWidgets();
+
+ // 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(clist_selected_->gtkobj()), GTK_CAN_DEFAULT);
+ gtk_widget_grab_focus (GTK_WIDGET(clist_selected_->gtkobj()));
+ gtk_widget_grab_default (GTK_WIDGET(b_ok->gtkobj()));
+
+ // connecting signals
+ b_ok->clicked.connect(slot(this, &FormCitation::applyEdit));
+ text_after_->get_entry()->activate.connect(slot(this, &FormCitation::applyEdit));
+
+ b_cancel->clicked.connect(slot(mainAppWin, &GLyxAppWin::remove_action));
+
+ dialog_->destroy.connect(slot(this, &FormCitation::free));
+
+ button_unselect_->clicked.connect(slot(this, &FormCitation::removeCitation));
+ button_up_->clicked.connect(slot(this, &FormCitation::moveCitationUp));
+ button_down_->clicked.connect(slot(this, &FormCitation::moveCitationDown));
+
+ clist_selected_->select_row.connect(bind(slot(this, &FormCitation::selectionToggled),
+ true, true));
+ clist_selected_->unselect_row.connect(bind(slot(this, &FormCitation::selectionToggled),
+ false, true));
}
}
-*/
+
void FormCitation::addItemToBibList(int i)
{
clist_bib_->rows().push_back(r);
}
-void FormCitation::update()
-{
- return;
-
- bibkeys.clear();
- bibkeysInfo.clear();
-
- clist_selected_->rows().clear();
- clist_bib_->rows().clear();
-
- // populating clist_bib_
- clist_bib_->freeze();
-
- vector<pair<string,string> > blist =
- lv_->buffer()->getBibkeyList();
-
- int sz = blist.size();
- for ( int i = 0; i < sz; ++i )
- {
- bibkeys.push_back(blist[i].first);
- bibkeysInfo.push_back(blist[i].second);
- }
-
- blist.clear();
- sz = bibkeys.size();
- for ( int i = 0; i < sz; ++i )
- addItemToBibList(i);
-
- clist_bib_->sort();
- clist_bib_->thaw();
- // clist_bib_: done
-
- // populating clist_selected_
- vector<string> r;
- string tmp, keys( params.getContents() );
- keys = frontStrip( split(keys, tmp, ',') );
- while( !tmp.empty() )
- {
- r.clear();
- r.push_back(tmp);
- clist_selected_->rows().push_back(r);
-
- keys = frontStrip( split(keys, tmp, ',') );
- }
- // clist_selected_: done
-
- text_after_->get_entry()->set_text(params.getOptions());
-
- updateButtons();
-}
void FormCitation::updateButtons()
{
- bool sens;
-
- sens = (clist_selected_->selection().size()>0);
- button_unselect_->set_sensitive(sens);
- button_up_->set_sensitive(sens &&
- clist_selected_->selection()[0].get_row_num()>0);
- button_down_->set_sensitive(sens &&
- clist_selected_->selection()[0].get_row_num() <
- clist_selected_->rows().size()-1);
-
- sens = (clist_bib_->selection().size()>0);
- button_select_->set_sensitive( (clist_bib_->selection().size()>0) );
+ if (button_unselect_ != NULL) // => button_up_ and button_down_ are != NULL
+ {
+ bool sens;
+
+ sens = (clist_selected_->selection().size()>0);
+ button_unselect_->set_sensitive(sens);
+ button_up_->set_sensitive(sens &&
+ clist_selected_->selection()[0].get_row_num()>0);
+ button_down_->set_sensitive(sens &&
+ clist_selected_->selection()[0].get_row_num() <
+ clist_selected_->rows().size()-1);
+ }
}
-void FormCitation::selection_toggled(gint row,
- gint ,//column,
- GdkEvent * ,//event,
- bool selected,
- bool citeselected)
+void FormCitation::selectionToggled(gint row,
+ gint ,//column,
+ GdkEvent * ,//event,
+ bool selected,
+ bool citeselected)
{
- if (selected)
+ if (!citeselected)
{
- bool keyfound = false;
- string info;
- if (citeselected)
- {
- // lookup the record with the same key in bibkeys and show additional Info
- int const sz = bibkeys.size();
- string key = clist_selected_->cell(row,0).get_text();
- for (int i=0; !keyfound && i<sz; ++i)
- if (bibkeys[i] == key)
- {
- info = bibkeysInfo[i];
- keyfound = true;
- }
- }
- else
+ if (selected)
{
+ bool keyfound = false;
+ string info;
+
// the first column in clist_bib_ contains the index
keyfound = true;
info = bibkeysInfo[ strToInt(clist_bib_->cell(row,0).get_text()) ];
- }
- if (keyfound)
- info_->show_string(info);
+ if (keyfound)
+ info_->show_string(info);
+ else
+ info_->show_string(N_("--- No such key in the database ---"));
+ }
else
- info_->show_string(N_("--- No such key in the database ---"));
- }
- else
- {
- info_->show_string("");
+ {
+ info_->show_string("");
+ }
}
+
+ updateButtons();
}
void FormCitation::removeCitation()
updateButtons();
}
-void FormCitation::newCitation()
-{
- // citation key is in the first column of clist_bib_ list
- vector<string> r;
- r.push_back( clist_bib_->selection()[0][1].get_text() );
- clist_selected_->rows().push_back(r);
- clist_selected_->row( clist_selected_->rows().size()-1 ).select();
- updateButtons();
-}
-
void FormCitation::hide()
{
if (dialog_!=NULL) mainAppWin->remove_action();
{
if (dialog_!=NULL)
{
- // storing configuration
-// string path;
-// string w, h;
-// path = PACKAGE "/" LOCAL_CONFIGURE_PREFIX;
-// w = path + "/" + CONF_DIALOG_WIDTH;
-// h = path + "/" + CONF_DIALOG_HEIGTH;
-
-// gnome_config_set_int(w.c_str(), dialog_->width());
-// gnome_config_set_int(h.c_str(), dialog_->height());
-
-// w = path + "/" + CONF_PANE_INFO;
-// gnome_config_set_int(w.c_str(), paned_key_->height());
-
-// w = path + "/" + CONF_PANE_KEY;
-// gnome_config_set_int(w.c_str(), box_keys_->width());
-
-// int i, sz;
-// for (i = 0, sz = clist_bib_->columns().size(); i < sz; ++i)
-// {
-// w = path + "/" + CONF_COLUMN + "_" + tostr(i);
-// gnome_config_set_int(w.c_str(), clist_bib_->get_column_width(i));
-// }
-
-// w = path + "/" + CONF_REGEXP;
-// gnome_config_set_int(w.c_str(), button_regexp_->get_active());
-
-// gnome_config_sync();
-
// cleaning up
- dialog_ = NULL;
+ cleanupWidgets();
u_.disconnect();
h_.disconnect();
inset_ = 0;
params.getAsString() );
}
- // save config
- text_after_->save_history();
-
- string path = PACKAGE "/" + LOCAL_CONFIGURE_PREFIX;
- string w = path + "/" + CONF_PANE_INFO;
-
- gnome_config_set_int(w.c_str(), paned_info_->width() - info_->width());
-
- sz = clist_bib_->columns().size();
- for (int i = 0; i < sz; ++i)
- {
- w = path + "/" + CONF_COLUMN + "_" + tostr(i);
- gnome_config_set_int(w.c_str(), clist_bib_->get_column_width(i));
- }
-
- gnome_config_sync();
-
// close dialog
+ storeWidgets();
hide();
}
-void FormCitation::apply()
+void FormCitation::applyEdit()
{
if( lv_->buffer()->isReadonly() ) return;
lv_->getLyXFunc()->Dispatch( LFUN_CITATION_INSERT,
params.getAsString() );
}
+
+ // close dialog
+ storeWidgets();
+ hide();
}
void FormCitation::sortBibList(gint col)
#include <gtk--/paned.h>
#include <gtk--/box.h>
#include <gtk--/checkbutton.h>
+#include "pixbutton.h"
/** This class provides an Gnome implementation of the FormCitation Dialog.
*/
void createInset( string const & );
/// Slot launching dialog to an existing inset
void showInset( InsetCommand * const );
-
- /// Update dialog before showing it
- virtual void update();
- /// Apply from dialog (modify or create inset)
- virtual void apply();
- /// Apply from dialog (modify or create inset)
- virtual void applySelect();
+
+ /// The following three methods do nothing in this implementation
+ virtual void update() { }
+ virtual void apply() { }
+ void show() { }
+
/// Explicitly free the dialog.
void free();
/// Hide the dialog.
void hide();
- /// Create the dialog if necessary, update it and display it. Not used in this dialog
- void show() { }
+
+ /// Apply from dialog (modify or create inset)
+ void applySelect();
+ /// Apply from dialog (modify or create inset)
+ void applyEdit();
+
+ /// Ask user for requested action: add new citation or edit the existing ones
+ void showStageAction();
/// Ask user for regexp or keyword(s)
void showStageSearch();
/// Ask user to select the citation in the list
void showStageSelect();
+ /// Ask user to edit the citation in the list
+ void showStageEdit();
+
/// moves from Search to Select "stage"
void moveFromSearchToSelect();
+ /// moves from Action to Search "stage"
+ void moveFromActionToSearch();
+ /// moves from Action to Edit "stage"
+ void moveFromActionToEdit();
/// sort biblist
void sortBibList(gint);
/// update state of the buttons
void updateButtons();
/// clist selection/unselection callback
- void selection_toggled(gint row,
- gint column,
- GdkEvent *event,
- bool selected,
- bool citeselected);
- /// adds new citation key
- void newCitation();
+ void selectionToggled(gint row,
+ gint column,
+ GdkEvent *event,
+ bool selected,
+ bool citeselected);
+
/// removes selected citation key
void removeCitation();
/// moves citation up
void moveCitationUp();
/// moves citation up
void moveCitationDown();
- /// searches for entries
+
+ /// searches for entries (calls searchReg or searchSimple)
void search();
+ /// searches for entries using regexp
void searchReg();
+ /// searches for entries containing keyword(s)
void searchSimple();
- /// add item to the list
+ /// adds item to clist_bib_
void addItemToBibList(int i);
+ /// sets all widget pointers to NULL
+ void cleanupWidgets();
+ /// initializes all non-NULL member widgets
+ void initWidgets();
+ /// stores configuration of all non-NULL member widgets
+ void storeWidgets();
+
/** Which LyXFunc do we use?
We could modify Dialogs to have a visible LyXFunc* instead and
save a couple of bytes per dialog.
Gnome::Less * info_;
Gnome::Entry * text_after_;
- Gtk::Button * button_select_;
- Gtk::Button * button_unselect_;
- Gtk::Button * button_up_;
- Gtk::Button * button_down_;
+ Gnome::PixButton * button_unselect_;
+ Gnome::PixButton * button_up_;
+ Gnome::PixButton * button_down_;
Gtk::CheckButton * button_regexp_;
Gtk::CList * clist_selected_;
Gtk::CList * clist_bib_;
Gtk::Paned * paned_info_;
- Gtk::Paned * paned_key_;
- Gtk::Box * box_keys_;
std::vector<string> bibkeys;
///
diainsertcitation_interface.c \
diainsertcitation_interface.h \
diainsertcitation_callbacks.c \
- diainsertcitation_callbacks.h
+ diainsertcitation_callbacks.h \
+ pixbutton.h
# These still have to be added. Sooner or later. ARRae-20000411
# GUI_defaults.C \
}
}
+int const max_number_of_items = 25;
void Menubar::Pimpl::updateList(vector<Buffer::TocItem> * toclist, vector<ListsHolder> * pgui)
{
vector<ListsHolder> & gui = *pgui;
menu.push_back(Gnome::UI::Item(Gnome::UI::Icon(GNOME_STOCK_MENU_REFRESH),
N_("Refresh"), slot(this, &Menubar::Pimpl::updateAllLists)));
+
+ if (toclist->size() > max_number_of_items)
+ composeTocUIInfo(menu, *toclist, toclist->begin(), 0);
+ else
+ {
+ vector<Buffer::TocItem>::const_iterator end = toclist->end();
+ for (vector<Buffer::TocItem>::const_iterator it = toclist->begin();
+ it != end; ++it)
+
+ {
+ label = string(4*(*it).depth,' ')+(*it).str;
+
+ menu.push_back(Gnome::UI::Item(label,
+ bind<Buffer::TocItem>(slot(this, &Menubar::Pimpl::callbackToc), (*it)),
+ label));
+ }
+ }
- vector<Buffer::TocItem>::const_iterator end = toclist->end();
- for (vector<Buffer::TocItem>::const_iterator it = toclist->begin();
- it != end; ++it)
+ gui[i].lst = menu;
+ mainAppWin->update_menu(gui[i].path, oldsz, gui[i].lst);
+ }
+}
+vector<Buffer::TocItem>::const_iterator
+Menubar::Pimpl::composeTocUIInfo(vector<Gnome::UI::Info> & menu,
+ vector<Buffer::TocItem> const & toclist,
+ vector<Buffer::TocItem>::const_iterator begin,
+ int mylevel)
+{
+ string label = N_("<No Name>");
+
+ vector<Buffer::TocItem>::const_iterator end = toclist.end();
+ vector<Buffer::TocItem>::const_iterator it;
+ for (it = begin; it != end && (*it).depth >= mylevel; ++it)
+ {
+ if ( (*it).depth == mylevel &&
+ (it+1 == end || (*(it+1)).depth <= mylevel) )
{
- label = string(4*(*it).depth,' ')+(*it).str;
-
+ label = (*it).str;
menu.push_back(Gnome::UI::Item(label,
- bind<Buffer::TocItem>(slot(this, &Menubar::Pimpl::callbackToc), (*it)),
+ bind<Buffer::TocItem>(slot(this, &Menubar::Pimpl::callbackToc), (*it)),
label));
}
-
- gui[i].lst = menu;
- mainAppWin->update_menu(gui[i].path, oldsz, gui[i].lst);
+ else
+ {
+ vector<Gnome::UI::Info> submenu;
+ if ( (*it).depth == mylevel )
+ {
+ label = (*it).str;
+ submenu.push_back(Gnome::UI::Item(label,
+ bind<Buffer::TocItem>(slot(this, &Menubar::Pimpl::callbackToc), (*it)),
+ label));
+ ++it;
+ }
+ it = composeTocUIInfo(submenu, toclist, it, mylevel+1);
+ menu.push_back(Gnome::UI::Menu(label,submenu,label));
+ }
}
+ --it;
+ return it;
}
void Menubar::Pimpl::callback(int action)
void callbackToc(Buffer::TocItem tg);
/// compose Gnome::UI::Array object describing the menu
void composeUIInfo(string const & menu_name, vector<Gnome::UI::Info> & Menus, string path);
+ /// compose Gnome::UI::Array object describing the TOClist
+ vector<Buffer::TocItem>::const_iterator
+ composeTocUIInfo(vector<Gnome::UI::Info> & menu,
+ vector<Buffer::TocItem> const & toclist,
+ vector<Buffer::TocItem>::const_iterator begin,
+ int mylevel);
/// populate wid_act_ vector with all widgets and corresponding actions
void connectWidgetToAction(GnomeUIInfo * guinfo);
set_statusbar(status_);
+ accel_ = NULL;
+
// initial (dummy) menu
vector<Gnome::UI::Info> menus, fm;
fm.push_back(Gnome::MenuItems::Open());
}
// clean up first, then add new action widget and finally, disable main view
-void GLyxAppWin::add_action(Gtk::Container &action, string title, bool expand)
+void GLyxAppWin::add_action(Gtk::Container &action, string title, bool expand, Gtk::AccelGroup * acgr)
{
remove_action();
box_.children().push_back( Gtk::Box_Helpers::Element( *frame, expand ) );
box_.show_all();
+ accel_ = acgr;
+ if (accel_ != NULL) add_accel_group(*accel_);
+
view_->set_sensitive(false);
action_mode = true;
}
void GLyxAppWin::remove_action()
{
+ if (accel_ != NULL)
+ {
+ remove_accel_group(*accel_);
+ accel_ = NULL;
+ }
+
while ( box_.children().size() > 2 )
{
box_.children().pop_back();
}
-
+
view_->set_sensitive(true);
action_mode = false;
}
#include <gnome--/app.h>
#include <gnome--/appbar.h>
#include <gtk--/frame.h>
+#include <gtk--/accelgroup.h>
#include "MenuBackend.h"
int noelms,
Gnome::UI::Array &);
/// add action area
- void add_action(Gtk::Container &, string title, bool expand=false);
+ void add_action(Gtk::Container &, string title, bool expand=false, Gtk::AccelGroup * acgr=NULL);
/// remove action area
void remove_action();
/// clears action area if Escape is pressed
Gtk::VBox box_;
Gtk::Widget *view_;
+ Gtk::AccelGroup * accel_;
+
bool action_mode;
// menu size
--- /dev/null
+// -*- C++ -*-
+/* This file is part of
+ * ======================================================
+ *
+ * LyX, The Document Processor
+ *
+ * Copyright 2000 The LyX Team.
+ *
+ * ====================================================== */
+
+#ifndef GNOME_PIXBUTTON
+#define GNOME_PIXBUTTON
+
+#include <gtk--/button.h>
+#include <gtk--/box.h>
+#include <gtk--/label.h>
+#include <gnome--/pixmap.h>
+#include <gnome--/stock.h>
+
+/* Button class used in LyX Gnome frontend for buttons with pixmaps and
+ accelerators */
+
+namespace Gnome
+{
+ class PixButton: public Gtk::Button
+ {
+ public:
+ PixButton(string label, string pixname): Button()
+ {
+ Gtk::Box * b = manage( new Gtk::HBox() );
+ Gtk::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);
+ b->children().push_back(Gtk::Box_Helpers::Element(*p, false, false));
+ b->children().push_back(Gtk::Box_Helpers::Element(*l, false, false));
+
+ add(*b);
+
+ accelkey_ = l->parse_uline(label);
+
+ l->show();
+ p->show();
+ b->show();
+ }
+
+ guint get_accelkey() { return accelkey_; }
+
+ protected:
+ guint accelkey_;
+ };
+}
+
+#endif
+
InsetText::~InsetText()
{
+ for(Cache::const_iterator cit=cache.begin(); cit != cache.end(); ++cit)
+ deleteLyXText((*cit).first);
LyXParagraph * p = par->next;
delete par;
while(p) {
UpdateLocal(bv, CURSOR_PAR, true);
break;
case LFUN_LAYOUT:
- {
- static LyXTextClass::size_type cur_layout = cpar(bv)->layout;
+ // do not set layouts on non breakable textinsets
+ if (autoBreakRows) {
+ static LyXTextClass::size_type cur_layout = cpar(bv)->layout;
- // Derive layout number from given argument (string)
- // and current buffer's textclass (number). */
- LyXTextClassList::ClassList::size_type tclass =
- bv->buffer()->params.textclass;
- std::pair <bool, LyXTextClass::size_type> layout =
- textclasslist.NumberOfLayout(tclass, arg);
-
- // If the entry is obsolete, use the new one instead.
- if (layout.first) {
- string obs = textclasslist.Style(tclass,layout.second).
- obsoleted_by();
- if (!obs.empty())
- layout = textclasslist.NumberOfLayout(tclass, obs);
- }
+ // Derive layout number from given argument (string)
+ // and current buffer's textclass (number). */
+ LyXTextClassList::ClassList::size_type tclass =
+ bv->buffer()->params.textclass;
+ std::pair <bool, LyXTextClass::size_type> layout =
+ textclasslist.NumberOfLayout(tclass, arg);
+
+ // If the entry is obsolete, use the new one instead.
+ if (layout.first) {
+ string obs = textclasslist.Style(tclass,layout.second).
+ obsoleted_by();
+ if (!obs.empty())
+ layout = textclasslist.NumberOfLayout(tclass, obs);
+ }
- // see if we found the layout number:
- if (!layout.first) {
- string msg = string(N_("Layout ")) + arg + N_(" not known");
+ // see if we found the layout number:
+ if (!layout.first) {
+ string msg = string(N_("Layout ")) + arg + N_(" not known");
- bv->owner()->getMiniBuffer()->Set(msg);
- break;
- }
+ bv->owner()->getMiniBuffer()->Set(msg);
+ break;
+ }
- if (cur_layout != layout.second) {
- cur_layout = layout.second;
- TEXT(bv)->SetLayout(bv, layout.second);
+ if (cur_layout != layout.second) {
+ cur_layout = layout.second;
+ TEXT(bv)->SetLayout(bv, layout.second);
+ bv->owner()->setLayout(cpar(bv)->GetLayout());
+ UpdateLocal(bv, CURSOR_PAR, true);
+ }
+ } else {
+ // reset the layout box
bv->owner()->setLayout(cpar(bv)->GetLayout());
- UpdateLocal(bv, CURSOR_PAR, true);
}
- }
- break;
+ break;
case LFUN_PARAGRAPH_SPACING:
// This one is absolutely not working. When fiddling with this
// it also seems to me that the paragraphs inside the insettext
void InsetText::deleteLyXText(BufferView * bv, bool recursive) const
{
+ if (cache.find(bv) == cache.end())
+ return;
+ delete cache[bv];
cache.erase(bv);
if (recursive) {
/// then remove all LyXText in text-insets
// Same method is used in LyXAction.C (Lgb)
lang_item items[] = {
- { "afrikaans", N_("Afrikaans"), false, &iso8859_1, "" },
+ { "afrikaans", N_("Afrikaans"), false, &iso8859_1, "af_ZA" },
{ "american", N_("American"), false, &iso8859_1, "en_US" },
- { "arabic", N_("Arabic"), true, &iso8859_6, "" },
+ { "arabic", N_("Arabic"), true, &iso8859_6, "ar_SA" },
{ "austrian", N_("Austrian"), false, &iso8859_1, "de_AU" },
- { "bahasa", N_("Bahasa"), false, &iso8859_1, "" },
- { "brazil", N_("Brazil"), false, &iso8859_1, "" },
- { "breton", N_("Breton"), false, &iso8859_1, "" },
- { "catalan", N_("Catalan"), false, &iso8859_1, "" },
- { "croatian", N_("Croatian"), false, &iso8859_2, "" },
- { "czech", N_("Czech"), false, &iso8859_2, "" },
- { "danish", N_("Danish"), false, &iso8859_1, "" },
+ { "bahasa", N_("Bahasa"), false, &iso8859_1, "in_ID" },
+ { "brazil", N_("Brazil"), false, &iso8859_1, "pt_BR" },
+ { "breton", N_("Breton"), false, &iso8859_1, "br_FR" },
+ { "british", N_("British"), false, &iso8859_1, "en" },
+ { "canadian", N_("Canadian"), false, &iso8859_1, "en_CA" },
+ { "catalan", N_("Catalan"), false, &iso8859_1, "ca_ES" },
+ { "croatian", N_("Croatian"), false, &iso8859_2, "hr" },
+ { "czech", N_("Czech"), false, &iso8859_2, "cs_CZ" },
+ { "danish", N_("Danish"), false, &iso8859_1, "da_DK" },
{ "default", N_("Document wide language"), false, &iso8859_1, "" },
- { "dutch", N_("Dutch"), false, &iso8859_1, "" },
- { "english", N_("English"), false, &iso8859_1, "en_EN" },
- { "esperanto", N_("Esperanto"), false, &iso8859_3, "" },
- { "estonian", N_("Estonian"), false, &iso8859_4, "" },
- { "finnish", N_("Finnish"), false, &iso8859_1, "" },
- { "frenchb", N_("French"), false, &iso8859_1, "fr_FR" },
- { "french", N_("French (GUTenberg)"), false, &iso8859_1, "fr_FR" },
- { "galician", N_("Galician"), false, &iso8859_1, "" },
- { "german", N_("German"), false, &iso8859_1, "de_DE" },
- { "greek", N_("Greek"), false, &iso8859_7, "" },
- { "hebrew", N_("Hebrew"), true, &cp1255, "" },
+ { "dutch", N_("Dutch"), false, &iso8859_1, "nl" },
+ // changed from en_EN (Garst)
+ { "esperanto", N_("Esperanto"), false, &iso8859_3, "eo" },
+ // and what country code should esperanto have?? (Garst)
+ { "estonian", N_("Estonian"), false, &iso8859_4, "et_EE" },
+ { "finnish", N_("Finnish"), false, &iso8859_1, "fi" },
+ { "frenchb", N_("French"), false, &iso8859_1, "fr" },
+ { "frenchc", N_("French Canadien"), false, &iso8859_1, "fr_CA" },
+ { "french", N_("French (GUTenberg)"), false, &iso8859_1, "fr" },
+ { "galician", N_("Galician"), false, &iso8859_1, "gl_ES" },
+ /*There are two Galicia's, one in Spain, one in E.Europe. Because of
+ the font encoding, I am assuming this is the one in Spain. (Garst)
+ */
+ { "german", N_("German"), false, &iso8859_1, "de" },
+ { "greek", N_("Greek"), false, &iso8859_7, "el_GR" },
+ { "hebrew", N_("Hebrew"), true, &cp1255, "he_IL" },
/* According to Zrubecz Laszlo <zrubi@k2.jozsef.kando.hu>,
"magyar" is better. I kept it here in case we want
to provide aliasing of languages. (JMarc)
*/
//{ "hungarian", N_("Hungarian"), false, &iso8859_2, "" },
- { "irish", N_("Irish"), false, &iso8859_1, "" },
- { "italian", N_("Italian"), false, &iso8859_1, "it_IT" },
+ { "irish", N_("Irish"), false, &iso8859_1, "ga_IE" },
+ { "italian", N_("Italian"), false, &iso8859_1, "it" },
{ "lsorbian", N_("Lsorbian"), false, &iso8859_2, "" },
- { "magyar", N_("Magyar"), false, &iso8859_2, "" },
- { "norsk", N_("Norsk"), false, &iso8859_1, "" },
- { "polish", N_("Polish"), false, &iso8859_2, "" },
- { "portuges", N_("Portuges"), false, &iso8859_1, "pt_PT" },
- { "romanian", N_("Romanian"), false, &iso8859_2, "" },
- { "russian", N_("Russian"), false, &koi8, "" },
- { "scottish", N_("Scottish"), false, &iso8859_1, "" },
- { "spanish", N_("Spanish"), false, &iso8859_1, "es_ES" },
- { "slovak", N_("Slovak"), false, &iso8859_2, "" },
- { "slovene", N_("Slovene"), false, &iso8859_2, "" },
- { "swedish", N_("Swedish"), false, &iso8859_1, "" },
- { "turkish", N_("Turkish"), false, &iso8859_9, "" },
+ // no ISO listing for lsorbian (Garst)
+ { "magyar", N_("Magyar"), false, &iso8859_2, "hu" },
+ { "norsk", N_("Norsk"), false, &iso8859_1, "no" },
+ { "polish", N_("Polish"), false, &iso8859_2, "pl" },
+ { "portuges", N_("Portuges"), false, &iso8859_1, "pt" },
+ { "romanian", N_("Romanian"), false, &iso8859_2, "ro" },
+ { "russian", N_("Russian"), false, &koi8, "ru" },
+ { "scottish", N_("Scottish"), false, &iso8859_1, "gd_GB" },
+ { "spanish", N_("Spanish"), false, &iso8859_1, "es" },
+ { "slovak", N_("Slovak"), false, &iso8859_2, "sk_SL" },
+ { "slovene", N_("Slovene"), false, &iso8859_2, "sl_SI" },
+ { "swedish", N_("Swedish"), false, &iso8859_1, "sv_SE" },
+ { "turkish", N_("Turkish"), false, &iso8859_9, "tr" },
{ "usorbian", N_("Usorbian"), false, &iso8859_2, "" },
- { "welsh", N_("Welsh"), false, &iso8859_1, "" },
+ // no ISO listing for usorbian (Garst)
+ { "welsh", N_("Welsh"), false, &iso8859_1, "cy_GB" },
{ 0, 0, false, 0, 0 }
};
using std::pair;
using std::endl;
using std::vector;
+using std::max;
extern char * mathed_label;
LyXFont font = WhichFont(type, size);
asc = des = 0;
for (int i = 0; i < ls; ++i) {
- if (lyxfont::descent(s[i], font) > des)
- des = lyxfont::descent(s[i], font);
- if (lyxfont::ascent(s[i], font) > asc)
- asc = lyxfont::ascent(s[i], font);
+ des = max(des, lyxfont::descent(s[i], font));
+ asc = max(asc, lyxfont::ascent(s[i], font));
}
return asc + des;
}
//ln = (name) ? strlen(name): 0;
LyXFont font = WhichFont(LM_TC_TEXTRM, size);
font.setLatex(LyXFont::ON);
- width = lyxfont::width(name, font)
- + lyxfont::width('I', font) / 2;
- mathed_string_height(LM_TC_TEXTRM, size, name, ascent, descent);
+ if (name.empty()) {
+ width = df_width;
+ descent = df_des;
+ ascent = df_asc;
+ } else {
+ width = lyxfont::width(name, font)
+ + lyxfont::width('I', font) / 2;
+ mathed_string_height(LM_TC_TEXTRM, size, name, ascent, descent);
+ }
}