mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-02 08:10:39 +00:00
Fixes to insettabular/text + GNOME patch + KDE patch
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1029 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
0031da054f
commit
783c043a7e
60
ChangeLog
60
ChangeLog
@ -1,3 +1,63 @@
|
||||
2000-09-18 Juergen Vigna <jug@sad.it>
|
||||
|
||||
* src/insets/insettext.C (LocalDispatch): fixed Backspace/Delete
|
||||
problems with selection. Inserted new LFUN_PASTESELECTION.
|
||||
(InsetButtonPress): inserted handling of middle mouse-button paste.
|
||||
|
||||
* src/spellchecker.C: changed word to word.c_str().
|
||||
|
||||
2000-09-16 Kayvan A. Sylvan <kayvan@sylvan.com>
|
||||
|
||||
* src/Makefile.am: Add sources to lyx_SOURCES so they will be
|
||||
included in the ``make dist'' tarball.
|
||||
|
||||
2000-09-15 Juergen Vigna <jug@sad.it>
|
||||
|
||||
* src/CutAndPaste.C (cutSelection): small fix return the right
|
||||
end position after cut inside one paragraph only.
|
||||
|
||||
* src/insets/insettext.C (resizeLyXText): only reset the cursor if
|
||||
we are locked as otherwise we don't have a valid cursor position!
|
||||
|
||||
* src/insets/figinset.C (draw): small bugfix but why is this needed???
|
||||
|
||||
2000-09-19 Angus Leeming <a.leeming@ic.ac.uk>
|
||||
|
||||
* src/frontends/kde/FormRef.C: added using directive.
|
||||
* src/frontends/kde/FormToc.C: ditto
|
||||
|
||||
* src/frontends/kde/formtocdialog.h: changed endl to std::endl.
|
||||
|
||||
* src/frontends/kde/FormRef.h: removed trailing comma from enums.
|
||||
|
||||
|
||||
2000-09-19 Marko Vendelin <markov@ioc.ee>
|
||||
|
||||
* src/frontends/gnome/Menubar_pimpl.C
|
||||
* src/frontends/gnome/Menubar_pimpl.h: Gnome menus show now
|
||||
Toc, ViewFormats, UpdateFormats, and ExportFormats.
|
||||
|
||||
* src/frontends/gnome/mainapp.C
|
||||
* src/frontends/gnome/mainapp.h: support for menu update used
|
||||
by Toc menu.
|
||||
|
||||
* src/frontends/gnome/mainapp.C
|
||||
* src/frontends/gnome/mainapp.h: support for "action" area in the
|
||||
main window. This area is used by small simple dialogs, such as
|
||||
FormUrl.
|
||||
|
||||
* src/frontends/gnome/FormIndex.C
|
||||
* src/frontends/gnome/FormIndex.h
|
||||
* src/frontends/gnome/FormUrl.C
|
||||
* src/frontends/gnome/FormUrl.h: rewrite to use main window action
|
||||
area
|
||||
|
||||
* src/frontends/gnome/FormCitation.C
|
||||
* src/frontends/gnome/FormCitation.h: rewrite to use main window
|
||||
action area. Only "Insert new citation" is implemented.
|
||||
|
||||
|
||||
|
||||
2000-09-19 Lars Gullik Bjønnes <larsbj@lyx.org>
|
||||
|
||||
* src/buffer.C (Dispatch): fix call to Dispatch
|
||||
|
@ -31,6 +31,8 @@ src/form1.C
|
||||
src/frontends/gnome/FormCitation.C
|
||||
src/frontends/gnome/FormPrint.C
|
||||
src/frontends/gnome/FormToc.C
|
||||
src/frontends/kde/dlg/FormIndex.C
|
||||
src/frontends/kde/dlg/formindexdialog.C
|
||||
src/frontends/kde/FormCitation.C
|
||||
src/frontends/kde/formcitationdialog.C
|
||||
src/frontends/kde/FormCopyright.C
|
||||
|
@ -107,6 +107,7 @@ bool CutAndPaste::cutSelection(LyXParagraph * startpar, LyXParagraph ** endpar,
|
||||
#endif
|
||||
buf->InsertFromMinibuffer(buf->Last());
|
||||
}
|
||||
end = start-1;
|
||||
} else {
|
||||
// more than one paragraph
|
||||
(*endpar)->BreakParagraphConservative(current_view->buffer()->params,
|
||||
|
@ -207,6 +207,8 @@ lyx_SOURCES = \
|
||||
spellchecker.C \
|
||||
spellchecker.h \
|
||||
stl_string_fwd.h \
|
||||
table.h \
|
||||
table.C \
|
||||
tabular.C \
|
||||
tabular.h \
|
||||
tex-accent.C \
|
||||
|
@ -27,13 +27,19 @@
|
||||
#include "support/filetools.h"
|
||||
#include "support/LRegex.h"
|
||||
|
||||
extern "C" {
|
||||
#include "diainsertcitation_interface.h"
|
||||
#include "support.h"
|
||||
}
|
||||
|
||||
#include <gtk--/scrolledwindow.h>
|
||||
#include <gnome--/pixmap.h>
|
||||
#include <gtk--/label.h>
|
||||
#include <gtk--/box.h>
|
||||
#include <gtk--/buttonbox.h>
|
||||
#include <gnome--/entry.h>
|
||||
#include <gnome--/stock.h>
|
||||
#include <gtk--/separator.h>
|
||||
#include <libgnome/gnome-config.h>
|
||||
|
||||
// temporary solution for LyXView
|
||||
#include "mainapp.h"
|
||||
extern GLyxAppWin * mainAppWin;
|
||||
|
||||
using std::vector;
|
||||
using std::pair;
|
||||
@ -46,27 +52,30 @@ using SigC::slot;
|
||||
using SigC::bind;
|
||||
#endif
|
||||
|
||||
// gnome configuration file keys
|
||||
#define LOCAL_CONFIGURE_PREFIX "FormCitation"
|
||||
|
||||
#define CONF_DIALOG_WIDTH "width"
|
||||
#define CONF_DIALOG_WIDTH_DEFAULT "=550"
|
||||
// configuration keys
|
||||
static string const LOCAL_CONFIGURE_PREFIX("FormCitation");
|
||||
|
||||
#define CONF_DIALOG_HEIGTH "heigth"
|
||||
#define CONF_DIALOG_HEIGTH_DEFAULT "=550"
|
||||
static string const CONF_DIALOG_WIDTH("width");
|
||||
static string const CONF_DIALOG_WIDTH_DEFAULT("=550");
|
||||
|
||||
#define CONF_PANE_INFO "paneinfo"
|
||||
#define CONF_PANE_INFO_DEFAULT "=300"
|
||||
static string const CONF_DIALOG_HEIGTH("heigth");
|
||||
static string const CONF_DIALOG_HEIGTH_DEFAULT("=550");
|
||||
|
||||
#define CONF_PANE_KEY "panekey"
|
||||
#define CONF_PANE_KEY_DEFAULT "=225"
|
||||
static string const CONF_PANE_INFO("paneinfo");
|
||||
static string const CONF_PANE_INFO_DEFAULT("=300");
|
||||
|
||||
#define CONF_COLUMN "column"
|
||||
#define CONF_COLUMN_DEFAULT "=50"
|
||||
static string const CONF_PANE_KEY("panekey");
|
||||
static string const CONF_PANE_KEY_DEFAULT("=225");
|
||||
|
||||
#define CONF_REGEXP "regexp"
|
||||
#define CONF_REGEXP_DEFAULT "=0"
|
||||
static string const CONF_COLUMN("column");
|
||||
static string const CONF_COLUMN_DEFAULT("=50");
|
||||
|
||||
static string const CONF_REGEXP("regexp");
|
||||
static string const CONF_REGEXP_DEFAULT("=0");
|
||||
|
||||
static string const CONF_SEARCH("FormCitation_search");
|
||||
static string const CONF_TEXTAFTER("FormCitation_textafter");
|
||||
|
||||
FormCitation::FormCitation(LyXView * lv, Dialogs * d)
|
||||
: lv_(lv), d_(d), u_(0), h_(0), ih_(0), inset_(0), dialog_(NULL)
|
||||
@ -90,9 +99,12 @@ void FormCitation::showInset( InsetCommand * const inset )
|
||||
|
||||
inset_ = inset;
|
||||
ih_ = inset_->hide.connect(slot(this, &FormCitation::hide));
|
||||
|
||||
u_ = d_->updateBufferDependent.connect(slot(this, &FormCitation::update));
|
||||
h_ = d_->hideBufferDependent.connect(slot(this, &FormCitation::hide));
|
||||
|
||||
params = inset->params();
|
||||
show();
|
||||
//showStageEdit();
|
||||
}
|
||||
|
||||
|
||||
@ -100,10 +112,14 @@ void FormCitation::createInset( string const & arg )
|
||||
{
|
||||
if( dialog_!=NULL ) return;
|
||||
|
||||
u_ = d_->updateBufferDependent.connect(slot(this, &FormCitation::update));
|
||||
h_ = d_->hideBufferDependent.connect(slot(this, &FormCitation::hide));
|
||||
|
||||
params.setFromString( arg );
|
||||
show();
|
||||
showStageSearch();
|
||||
}
|
||||
|
||||
|
||||
static
|
||||
void parseBibTeX(string data,
|
||||
string const & findkey,
|
||||
@ -195,7 +211,202 @@ void parseBibTeX(string data,
|
||||
}
|
||||
}
|
||||
|
||||
void FormCitation::show()
|
||||
void FormCitation::showStageSearch()
|
||||
{
|
||||
if (!dialog_)
|
||||
{
|
||||
using namespace Gtk::Box_Helpers;
|
||||
|
||||
Gtk::Box * mbox = manage( new Gtk::HBox() );
|
||||
Gtk::ButtonBox * bbox = manage( new Gtk::HButtonBox() );
|
||||
Gtk::Separator * sep = manage( new Gtk::VSeparator() );
|
||||
|
||||
search_text_ = manage( new Gnome::Entry() );
|
||||
|
||||
button_regexp_ = manage( new Gtk::CheckButton(N_("Use Regular Expression")) );
|
||||
|
||||
b_ok = manage( new Gtk::Button(N_("Search")) );
|
||||
b_cancel = Gtk::wrap( GTK_BUTTON( gnome_stock_button(GNOME_STOCK_BUTTON_CANCEL) ) );
|
||||
|
||||
// set up spacing
|
||||
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));
|
||||
|
||||
mbox->children().push_back(Element(*search_text_, true, true));
|
||||
mbox->children().push_back(Element(*button_regexp_, false, false));
|
||||
mbox->children().push_back(Element(*sep, false, false));
|
||||
mbox->children().push_back(Element(*bbox, false, false));
|
||||
|
||||
// packing dialog to main window
|
||||
dialog_ = mbox;
|
||||
mainAppWin->add_action(*dialog_, N_(" Insert Citation: Enter keyword(s) or regular expression "));
|
||||
|
||||
// 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));
|
||||
}
|
||||
}
|
||||
|
||||
void FormCitation::moveFromSearchToSelect()
|
||||
{
|
||||
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();
|
||||
|
||||
// moves to stage "select"
|
||||
dialog_ = NULL;
|
||||
mainAppWin->remove_action();
|
||||
showStageSelect();
|
||||
}
|
||||
|
||||
void FormCitation::showStageSelect()
|
||||
{
|
||||
if (!dialog_)
|
||||
{
|
||||
using namespace Gtk::Box_Helpers;
|
||||
|
||||
Gtk::Box * mbox = manage( new Gtk::VBox() );
|
||||
Gtk::Box * tbox = manage( new Gtk::HBox() );
|
||||
Gtk::ButtonBox * bbox = manage( new Gtk::HButtonBox() );
|
||||
Gtk::Separator * sep = manage( new Gtk::HSeparator() );
|
||||
Gtk::ScrolledWindow * sw = manage( new Gtk::ScrolledWindow() );
|
||||
|
||||
info_ = manage( new Gnome::Less() );
|
||||
paned_info_ = manage( new Gtk::HPaned() );
|
||||
text_after_ = manage( new Gnome::Entry() );
|
||||
|
||||
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
|
||||
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);
|
||||
|
||||
bbox->set_layout(GTK_BUTTONBOX_END);
|
||||
|
||||
// set up spacing
|
||||
mbox->set_spacing(4);
|
||||
bbox->set_spacing(4);
|
||||
tbox->set_spacing(4);
|
||||
|
||||
// packing widgets
|
||||
sw->add(*clist_bib_);
|
||||
paned_info_->add1(*sw);
|
||||
paned_info_->add2(*info_);
|
||||
|
||||
bbox->children().push_back(Element(*b_ok, false, false));
|
||||
bbox->children().push_back(Element(*b_cancel, false, false));
|
||||
|
||||
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));
|
||||
|
||||
mbox->children().push_back(Element(*paned_info_,true,true));
|
||||
mbox->children().push_back(Element(*sep, false, false));
|
||||
mbox->children().push_back(Element(*tbox, false, false));
|
||||
|
||||
// packing dialog to main window
|
||||
dialog_ = mbox;
|
||||
mainAppWin->add_action(*dialog_, N_(" Insert Citation: Select citation "), 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(clist_bib_->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;
|
||||
string w, h;
|
||||
path = PACKAGE "/" + LOCAL_CONFIGURE_PREFIX;
|
||||
|
||||
w = path + "/" + CONF_PANE_INFO + CONF_PANE_INFO_DEFAULT;
|
||||
paned_info_->set_position( gnome_config_get_int(w.c_str()) );
|
||||
|
||||
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()) );
|
||||
}
|
||||
|
||||
// connecting signals
|
||||
b_ok->clicked.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),
|
||||
true, false));
|
||||
clist_bib_->unselect_row.connect(bind(slot(this, &FormCitation::selection_toggled),
|
||||
false, false));
|
||||
// retrieving data
|
||||
vector<pair<string,string> > blist = lv_->buffer()->getBibkeyList();
|
||||
|
||||
for ( i = 0, sz = blist.size(); i < sz; ++i )
|
||||
{
|
||||
bibkeys.push_back(blist[i].first);
|
||||
bibkeysInfo.push_back(blist[i].second);
|
||||
}
|
||||
|
||||
blist.clear();
|
||||
|
||||
// updating list
|
||||
search();
|
||||
}
|
||||
}
|
||||
|
||||
/*void FormCitation::show()
|
||||
{
|
||||
if (!dialog_)
|
||||
{
|
||||
@ -313,6 +524,7 @@ void FormCitation::show()
|
||||
dialog_win.raise();
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
void FormCitation::addItemToBibList(int i)
|
||||
{
|
||||
@ -340,6 +552,8 @@ void FormCitation::addItemToBibList(int i)
|
||||
|
||||
void FormCitation::update()
|
||||
{
|
||||
return;
|
||||
|
||||
bibkeys.clear();
|
||||
bibkeysInfo.clear();
|
||||
|
||||
@ -442,7 +656,6 @@ void FormCitation::selection_toggled(gint row,
|
||||
{
|
||||
info_->show_string("");
|
||||
}
|
||||
updateButtons();
|
||||
}
|
||||
|
||||
void FormCitation::removeCitation()
|
||||
@ -479,7 +692,7 @@ void FormCitation::newCitation()
|
||||
|
||||
void FormCitation::hide()
|
||||
{
|
||||
if (dialog_!=NULL) dialog_->destroy();
|
||||
if (dialog_!=NULL) mainAppWin->remove_action();
|
||||
}
|
||||
|
||||
void FormCitation::free()
|
||||
@ -487,32 +700,32 @@ void FormCitation::free()
|
||||
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;
|
||||
// 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());
|
||||
// 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_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());
|
||||
// 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));
|
||||
}
|
||||
// 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());
|
||||
// w = path + "/" + CONF_REGEXP;
|
||||
// gnome_config_set_int(w.c_str(), button_regexp_->get_active());
|
||||
|
||||
gnome_config_sync();
|
||||
// gnome_config_sync();
|
||||
|
||||
// cleaning up
|
||||
dialog_ = NULL;
|
||||
@ -523,6 +736,63 @@ void FormCitation::free()
|
||||
}
|
||||
}
|
||||
|
||||
void FormCitation::applySelect()
|
||||
{
|
||||
if( lv_->buffer()->isReadonly() ) return;
|
||||
|
||||
string contents;
|
||||
int i, sz;
|
||||
|
||||
contents = frontStrip( strip(params.getContents()) );
|
||||
if (!contents.empty()) contents += ", ";
|
||||
|
||||
sz = clist_bib_->selection().size();
|
||||
for (i=0; i < sz; ++i)
|
||||
{
|
||||
if (i > 0) contents += ", ";
|
||||
contents += clist_bib_->selection().operator[](i).operator[](1).get_text();
|
||||
}
|
||||
|
||||
params.setContents( contents );
|
||||
params.setOptions( text_after_->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_CITATION_INSERT,
|
||||
params.getAsString().c_str() );
|
||||
}
|
||||
|
||||
// save config
|
||||
text_after_->save_history();
|
||||
|
||||
string path;
|
||||
string w, h;
|
||||
path = PACKAGE "/" + LOCAL_CONFIGURE_PREFIX;
|
||||
|
||||
w = path + "/" + CONF_PANE_INFO;
|
||||
gnome_config_set_int(w.c_str(), paned_info_->width() - info_->width());
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
gnome_config_sync();
|
||||
|
||||
// close dialog
|
||||
hide();
|
||||
}
|
||||
|
||||
void FormCitation::apply()
|
||||
{
|
||||
if( lv_->buffer()->isReadonly() ) return;
|
||||
@ -561,14 +831,14 @@ void FormCitation::sortBibList(gint col)
|
||||
|
||||
void FormCitation::search()
|
||||
{
|
||||
if (button_regexp_->get_active()) searchReg();
|
||||
if (use_regexp_) searchReg();
|
||||
else searchSimple();
|
||||
}
|
||||
|
||||
// looking for entries which match regexp
|
||||
void FormCitation::searchReg()
|
||||
{
|
||||
string tmp, rexptxt( search_text_->get_entry()->get_text() );
|
||||
string tmp, rexptxt( search_string_ );
|
||||
rexptxt = frontStrip( strip( rexptxt ) );
|
||||
|
||||
LRegex reg(rexptxt);
|
||||
@ -592,15 +862,13 @@ void FormCitation::searchReg()
|
||||
|
||||
clist_bib_->sort();
|
||||
clist_bib_->thaw();
|
||||
// clist_bib_: done
|
||||
updateButtons();
|
||||
}
|
||||
|
||||
// looking for entries which contain all the words specified in search_text entry
|
||||
void FormCitation::searchSimple()
|
||||
{
|
||||
vector<string> searchwords;
|
||||
string tmp, stext( search_text_->get_entry()->get_text() );
|
||||
string tmp, stext( search_string_ );
|
||||
stext = frontStrip( strip( stext ) );
|
||||
stext = frontStrip( split(stext, tmp, ' ') );
|
||||
while( !tmp.empty() )
|
||||
@ -633,6 +901,4 @@ void FormCitation::searchSimple()
|
||||
|
||||
clist_bib_->sort();
|
||||
clist_bib_->thaw();
|
||||
// clist_bib_: done
|
||||
updateButtons();
|
||||
}
|
||||
|
@ -21,7 +21,7 @@
|
||||
#include "support/utility.hpp"
|
||||
#include "insets/insetcommand.h"
|
||||
|
||||
#include <gtk--/widget.h>
|
||||
#include <gtk--/container.h>
|
||||
#include <gtk--/clist.h>
|
||||
#include <gnome--/entry.h>
|
||||
#include <gnome--/less.h>
|
||||
@ -48,13 +48,21 @@ private:
|
||||
virtual void update();
|
||||
/// Apply from dialog (modify or create inset)
|
||||
virtual void apply();
|
||||
/// Apply from dialog (modify or create inset)
|
||||
virtual void applySelect();
|
||||
/// Explicitly free the dialog.
|
||||
void free();
|
||||
/// Create the dialog if necessary, update it and display it.
|
||||
void show();
|
||||
/// Hide the dialog.
|
||||
void hide();
|
||||
|
||||
/// Create the dialog if necessary, update it and display it. Not used in this dialog
|
||||
void show() { }
|
||||
/// Ask user for regexp or keyword(s)
|
||||
void showStageSearch();
|
||||
/// Ask user to select the citation in the list
|
||||
void showStageSelect();
|
||||
/// moves from Search to Select "stage"
|
||||
void moveFromSearchToSelect();
|
||||
|
||||
/// sort biblist
|
||||
void sortBibList(gint);
|
||||
/// update state of the buttons
|
||||
@ -102,20 +110,21 @@ private:
|
||||
Connection ih_;
|
||||
|
||||
/// Real GUI implementation.
|
||||
Gtk::Widget * dialog_;
|
||||
Gtk::Container * dialog_;
|
||||
Gtk::Button * b_ok;
|
||||
Gtk::Button * b_cancel;
|
||||
|
||||
Gnome::Entry * search_text_;
|
||||
string search_string_;
|
||||
bool use_regexp_;
|
||||
|
||||
Gnome::Less * info_;
|
||||
Gnome::Entry * text_after_;
|
||||
|
||||
Gnome::Entry * search_text_;
|
||||
|
||||
Gtk::Button * button_select_;
|
||||
Gtk::Button * button_unselect_;
|
||||
Gtk::Button * button_up_;
|
||||
Gtk::Button * button_down_;
|
||||
Gtk::Button * button_search_;
|
||||
Gtk::CheckButton * button_regexp_;
|
||||
|
||||
Gtk::CList * clist_selected_;
|
||||
|
@ -23,13 +23,6 @@
|
||||
#include "buffer.h"
|
||||
#include "lyxfunc.h"
|
||||
|
||||
extern "C" {
|
||||
#include "diainsertindex_interface.h"
|
||||
#include "support.h"
|
||||
}
|
||||
|
||||
#include <gtk--/base.h>
|
||||
|
||||
#include "gettext.h"
|
||||
#include "Dialogs.h"
|
||||
#include "FormIndex.h"
|
||||
@ -38,6 +31,20 @@ extern "C" {
|
||||
#include "form_index.h"
|
||||
#include "lyxfunc.h"
|
||||
|
||||
#include <gtk--/label.h>
|
||||
#include <gtk--/box.h>
|
||||
#include <gtk--/buttonbox.h>
|
||||
#include <gnome--/entry.h>
|
||||
#include <gnome--/stock.h>
|
||||
#include <gtk--/separator.h>
|
||||
|
||||
// temporary solution for LyXView
|
||||
#include "mainapp.h"
|
||||
extern GLyxAppWin * mainAppWin;
|
||||
|
||||
// configuration keys
|
||||
static string const CONF_ENTRY("FormIndex_entry");
|
||||
|
||||
FormIndex::FormIndex(LyXView * lv, Dialogs * d)
|
||||
: lv_(lv), d_(d), u_(0), h_(0), ih_(0), inset_(0), dialog_(NULL)
|
||||
{
|
||||
@ -77,31 +84,58 @@ void FormIndex::show()
|
||||
{
|
||||
if (!dialog_)
|
||||
{
|
||||
GtkWidget * pd = create_DiaInsertIndex();
|
||||
|
||||
dialog_ = Gtk::wrap(pd);
|
||||
keyword_ = Gtk::wrap( GNOME_ENTRY( lookup_widget(pd, "keyword") ) );
|
||||
using namespace Gtk::Box_Helpers;
|
||||
|
||||
b_ok = Gtk::wrap( GTK_BUTTON( lookup_widget(pd, "button_ok") ) );
|
||||
b_cancel = Gtk::wrap( GTK_BUTTON( lookup_widget(pd, "button_cancel") ) );
|
||||
Gtk::Label * label = manage( new Gtk::Label(N_("Keyword")) );
|
||||
Gtk::Box * mbox = manage( new Gtk::HBox() );
|
||||
Gtk::ButtonBox * bbox = manage( new Gtk::HButtonBox() );
|
||||
Gtk::Separator * sep = manage( new Gtk::VSeparator() );
|
||||
|
||||
keyword_ = manage( new Gnome::Entry() );
|
||||
|
||||
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
|
||||
mbox->set_spacing(2);
|
||||
bbox->set_spacing(4);
|
||||
|
||||
keyword_->set_history_id(CONF_ENTRY);
|
||||
keyword_->set_max_saved(10);
|
||||
keyword_->load_history();
|
||||
keyword_->set_use_arrows_always(true);
|
||||
|
||||
// packing
|
||||
bbox->children().push_back(Element(*b_ok, false, false));
|
||||
bbox->children().push_back(Element(*b_cancel, false, false));
|
||||
|
||||
mbox->children().push_back(Element(*label, false, false));
|
||||
mbox->children().push_back(Element(*keyword_, true, true));
|
||||
mbox->children().push_back(Element(*sep, false, false));
|
||||
mbox->children().push_back(Element(*bbox, false, false));
|
||||
|
||||
// packing dialog to main window
|
||||
dialog_ = mbox;
|
||||
mainAppWin->add_action(*dialog_, N_(" Index "));
|
||||
|
||||
// setting focus
|
||||
GTK_WIDGET_SET_FLAGS (GTK_WIDGET(keyword_->get_entry()->gtkobj()), GTK_CAN_DEFAULT);
|
||||
gtk_widget_grab_focus (GTK_WIDGET(keyword_->get_entry()->gtkobj()));
|
||||
gtk_widget_grab_default (GTK_WIDGET(keyword_->get_entry()->gtkobj()));
|
||||
|
||||
// connecting signals
|
||||
b_ok->clicked.connect(slot(this, &FormIndex::apply));
|
||||
b_ok->clicked.connect(dialog_->destroy.slot());
|
||||
b_cancel->clicked.connect(dialog_->destroy.slot());
|
||||
keyword_->get_entry()->activate.connect(slot(this, &FormIndex::apply));
|
||||
|
||||
b_cancel->clicked.connect(slot(mainAppWin, &GLyxAppWin::remove_action));
|
||||
|
||||
dialog_->destroy.connect(slot(this, &FormIndex::free));
|
||||
|
||||
u_ = d_->updateBufferDependent.connect(slot(this, &FormIndex::update));
|
||||
h_ = d_->hideBufferDependent.connect(slot(this, &FormIndex::hide));
|
||||
|
||||
if (!dialog_->is_visible()) dialog_->show_all();
|
||||
|
||||
update(); // make sure its up-to-date
|
||||
}
|
||||
else
|
||||
{
|
||||
Gdk_Window dialog_win(dialog_->get_window());
|
||||
dialog_win.raise();
|
||||
}
|
||||
}
|
||||
|
||||
void FormIndex::update()
|
||||
@ -120,7 +154,7 @@ void FormIndex::update()
|
||||
|
||||
void FormIndex::hide()
|
||||
{
|
||||
if (dialog_!=NULL) dialog_->destroy();
|
||||
if (dialog_!=NULL) mainAppWin->remove_action();
|
||||
}
|
||||
|
||||
void FormIndex::free()
|
||||
@ -155,4 +189,11 @@ void FormIndex::apply()
|
||||
lv_->getLyXFunc()->Dispatch( LFUN_INDEX_INSERT,
|
||||
params.getAsString().c_str() );
|
||||
}
|
||||
|
||||
// save history
|
||||
keyword_->save_history();
|
||||
|
||||
// hide the dialog
|
||||
hide();
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
#include "support/utility.hpp"
|
||||
#include "insets/insetcommand.h"
|
||||
|
||||
#include <gtk--/widget.h>
|
||||
#include <gtk--/container.h>
|
||||
#include <gnome--/entry.h>
|
||||
#include <gtk--/label.h>
|
||||
|
||||
@ -71,7 +71,7 @@ private:
|
||||
Connection ih_;
|
||||
|
||||
/// Real GUI implementation.
|
||||
Gtk::Widget * dialog_;
|
||||
Gtk::Container * dialog_;
|
||||
Gnome::Entry * keyword_;
|
||||
Gtk::Button * b_ok;
|
||||
Gtk::Button * b_cancel;
|
||||
|
@ -23,12 +23,20 @@
|
||||
#include "buffer.h"
|
||||
#include "lyxfunc.h"
|
||||
|
||||
extern "C" {
|
||||
#include "diainserturl_interface.h"
|
||||
#include "support.h"
|
||||
}
|
||||
|
||||
#include <gtk--/label.h>
|
||||
#include <gtk--/table.h>
|
||||
#include <gtk--/box.h>
|
||||
#include <gtk--/buttonbox.h>
|
||||
#include <gtk--/base.h>
|
||||
#include <gtk--/separator.h>
|
||||
|
||||
// temporary solution for LyXView
|
||||
#include "mainapp.h"
|
||||
extern GLyxAppWin * mainAppWin;
|
||||
|
||||
// configuration keys
|
||||
static string const CONF_ENTRY_URL("FormUrl_url");
|
||||
static string const CONF_ENTRY_NAME("FormUrl_name");
|
||||
|
||||
FormUrl::FormUrl(LyXView * lv, Dialogs * d)
|
||||
: lv_(lv), d_(d), u_(0), h_(0), ih_(0), inset_(0), dialog_(NULL)
|
||||
@ -70,33 +78,76 @@ void FormUrl::show()
|
||||
{
|
||||
if (!dialog_)
|
||||
{
|
||||
GtkWidget * pd = create_DiaInsertUrl();
|
||||
using namespace Gtk::Box_Helpers;
|
||||
|
||||
dialog_ = Gtk::wrap(pd);
|
||||
url_ = Gtk::wrap( GNOME_ENTRY( lookup_widget(pd, "url") ) );
|
||||
name_ = Gtk::wrap( GNOME_ENTRY( lookup_widget(pd, "name") ) );
|
||||
html_type_ = Gtk::wrap( GTK_CHECK_BUTTON( lookup_widget(pd, "html_type") ) );
|
||||
Gtk::Label * label;
|
||||
Gtk::Table * table = manage( new Gtk::Table(2, 2, FALSE) );
|
||||
Gtk::Box * mbox = manage( new Gtk::HBox() );
|
||||
Gtk::ButtonBox * bbox = manage( new Gtk::VButtonBox() );
|
||||
Gtk::Separator * sep = manage( new Gtk::VSeparator() );
|
||||
|
||||
url_ = manage( new Gnome::Entry() );
|
||||
name_ = manage( new Gnome::Entry() );
|
||||
html_type_ = manage( new Gtk::CheckButton(N_("HTML type")) );
|
||||
|
||||
b_ok = Gtk::wrap( GTK_BUTTON( lookup_widget(pd, "button_ok") ) );
|
||||
b_cancel = Gtk::wrap( GTK_BUTTON( lookup_widget(pd, "button_cancel") ) );
|
||||
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(2);
|
||||
table->set_col_spacings(2);
|
||||
mbox->set_spacing(2);
|
||||
bbox->set_spacing(4);
|
||||
|
||||
// configure entries
|
||||
url_->set_history_id(CONF_ENTRY_URL);
|
||||
url_->set_max_saved(10);
|
||||
url_->load_history();
|
||||
url_->set_use_arrows_always(true);
|
||||
|
||||
name_->set_history_id(CONF_ENTRY_NAME);
|
||||
name_->set_max_saved(10);
|
||||
name_->load_history();
|
||||
name_->set_use_arrows_always(true);
|
||||
|
||||
// pack widgets
|
||||
bbox->children().push_back(Element(*b_ok, false, false));
|
||||
bbox->children().push_back(Element(*b_cancel, false, false));
|
||||
|
||||
label = manage( new Gtk::Label(N_("URL")) );
|
||||
table->attach( *label, 0, 1, 0, 1, 0, 0 );
|
||||
label = manage( new Gtk::Label(N_("Name")) );
|
||||
table->attach( *label, 0, 1, 1, 2, 0, 0 );
|
||||
table->attach( *url_, 1, 2, 0, 1 );
|
||||
table->attach( *name_, 1, 2, 1, 2 );
|
||||
|
||||
mbox->children().push_back(Element(*table));
|
||||
mbox->children().push_back(Element(*html_type_, false, false));
|
||||
mbox->children().push_back(Element(*sep, false, false));
|
||||
mbox->children().push_back(Element(*bbox, false, false));
|
||||
|
||||
// packing dialog to main window
|
||||
dialog_ = mbox;
|
||||
mainAppWin->add_action(*dialog_, N_(" URL "));
|
||||
|
||||
// setting focus
|
||||
GTK_WIDGET_SET_FLAGS (GTK_WIDGET(url_->get_entry()->gtkobj()), GTK_CAN_DEFAULT);
|
||||
gtk_widget_grab_focus (GTK_WIDGET(url_->get_entry()->gtkobj()));
|
||||
gtk_widget_grab_default (GTK_WIDGET(url_->get_entry()->gtkobj()));
|
||||
|
||||
// connecting signals
|
||||
b_ok->clicked.connect(slot(this, &FormUrl::apply));
|
||||
b_ok->clicked.connect(dialog_->destroy.slot());
|
||||
b_cancel->clicked.connect(dialog_->destroy.slot());
|
||||
name_->get_entry()->activate.connect(slot(this, &FormUrl::apply));
|
||||
|
||||
b_cancel->clicked.connect(slot(mainAppWin, &GLyxAppWin::remove_action));
|
||||
|
||||
dialog_->destroy.connect(slot(this, &FormUrl::free));
|
||||
|
||||
u_ = d_->updateBufferDependent.connect(slot(this, &FormUrl::update));
|
||||
h_ = d_->hideBufferDependent.connect(slot(this, &FormUrl::hide));
|
||||
|
||||
if (!dialog_->is_visible()) dialog_->show_all();
|
||||
|
||||
update(); // make sure its up-to-date
|
||||
}
|
||||
else
|
||||
{
|
||||
Gdk_Window dialog_win(dialog_->get_window());
|
||||
dialog_win.raise();
|
||||
}
|
||||
}
|
||||
|
||||
void FormUrl::update()
|
||||
@ -120,7 +171,7 @@ void FormUrl::update()
|
||||
|
||||
void FormUrl::hide()
|
||||
{
|
||||
if (dialog_!=NULL) dialog_->destroy();
|
||||
if (dialog_!=NULL) mainAppWin->remove_action();
|
||||
}
|
||||
|
||||
void FormUrl::free()
|
||||
@ -160,4 +211,11 @@ void FormUrl::apply()
|
||||
lv_->getLyXFunc()->Dispatch( LFUN_INSERT_URL,
|
||||
params.getAsString().c_str() );
|
||||
}
|
||||
|
||||
// save history
|
||||
url_->save_history();
|
||||
name_->save_history();
|
||||
|
||||
// hide the dialog
|
||||
hide();
|
||||
}
|
||||
|
@ -21,7 +21,7 @@
|
||||
#include "support/utility.hpp"
|
||||
#include "insets/insetcommand.h"
|
||||
|
||||
#include <gtk--/widget.h>
|
||||
#include <gtk--/container.h>
|
||||
#include <gtk--/checkbutton.h>
|
||||
#include <gnome--/entry.h>
|
||||
#include <gtk--/button.h>
|
||||
@ -76,7 +76,7 @@ private:
|
||||
Connection ih_;
|
||||
|
||||
/// Real GUI implementation.
|
||||
Gtk::Widget * dialog_;
|
||||
Gtk::Container * dialog_;
|
||||
|
||||
Gtk::CheckButton * html_type_;
|
||||
|
||||
|
@ -29,9 +29,13 @@
|
||||
#include "LyXView.h"
|
||||
#include "MenuBackend.h"
|
||||
#include "Menubar_pimpl.h"
|
||||
#include "lyxtext.h"
|
||||
#include "exporter.h"
|
||||
|
||||
#include "mainapp.h"
|
||||
|
||||
#include <gtk--/menu.h>
|
||||
|
||||
using SigC::slot;
|
||||
using SigC::bind;
|
||||
|
||||
@ -51,12 +55,12 @@ extern LastFiles * lastfiles;
|
||||
Menubar::Pimpl::Pimpl(LyXView * view, MenuBackend const & mb)
|
||||
: owner_(view), menubackend_(&mb), ignore_action_(false)
|
||||
{
|
||||
// Should we do something here?
|
||||
|
||||
}
|
||||
|
||||
Menubar::Pimpl::~Pimpl()
|
||||
{
|
||||
// Should we do something here?
|
||||
if (utoc_.connected()) utoc_.disconnect();
|
||||
}
|
||||
|
||||
void Menubar::Pimpl::set(string const & menu_name)
|
||||
@ -64,9 +68,14 @@ void Menubar::Pimpl::set(string const & menu_name)
|
||||
// if (current_menu_name_ != menu_name) // disabled until Lastfiles and Documents are added dynamically to menu
|
||||
{
|
||||
current_menu_name_ = menu_name;
|
||||
|
||||
// clean up the lists
|
||||
toc_.clear();
|
||||
if (utoc_.connected()) utoc_.disconnect();
|
||||
|
||||
// compose new menu
|
||||
vector<Gnome::UI::Info> menus;
|
||||
composeUIInfo(current_menu_name_, menus);
|
||||
composeUIInfo(current_menu_name_, menus, "");
|
||||
|
||||
// set menu
|
||||
Menu_ = menus;
|
||||
@ -80,6 +89,48 @@ void Menubar::Pimpl::set(string const & menu_name)
|
||||
|
||||
// update state of the items
|
||||
update();
|
||||
updateAllLists();
|
||||
}
|
||||
}
|
||||
|
||||
void Menubar::Pimpl::updateAllLists()
|
||||
{
|
||||
// update lists
|
||||
if (toc_.size() > 0)
|
||||
{
|
||||
vector<Buffer::TocItem> toclist = (owner_->view()->buffer()->getTocList())[Buffer::TOC_TOC];
|
||||
updateList(&toclist, &toc_);
|
||||
}
|
||||
}
|
||||
|
||||
void Menubar::Pimpl::updateList(vector<Buffer::TocItem> * toclist, vector<ListsHolder> * pgui)
|
||||
{
|
||||
vector<ListsHolder> & gui = *pgui;
|
||||
int szGui = gui.size();
|
||||
int i;
|
||||
for (i=0; i < szGui; ++i)
|
||||
{
|
||||
int oldsz = gui[i].lst.size();
|
||||
vector<Gnome::UI::Info> menu;
|
||||
string label;
|
||||
|
||||
menu.push_back(Gnome::UI::Item(Gnome::UI::Icon(GNOME_STOCK_MENU_REFRESH),
|
||||
N_("Refresh"), slot(this, &Menubar::Pimpl::updateAllLists)));
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
gui[i].lst = menu;
|
||||
mainAppWin->update_menu(gui[i].path, oldsz, gui[i].lst);
|
||||
}
|
||||
}
|
||||
|
||||
@ -93,8 +144,20 @@ void Menubar::Pimpl::callback(int action)
|
||||
action_ = action;
|
||||
}
|
||||
|
||||
void Menubar::Pimpl::composeUIInfo(string const & menu_name, vector<Gnome::UI::Info> & Menus)
|
||||
void Menubar::Pimpl::callbackToc(Buffer::TocItem tg)
|
||||
{
|
||||
if (!owner_->view()->available()) return;
|
||||
|
||||
owner_->view()->beforeChange();
|
||||
owner_->view()->text->SetCursor( owner_->view(), tg.par, 0 );
|
||||
owner_->view()->text->sel_cursor = owner_->view()->text->cursor;
|
||||
owner_->view()->update(BufferView::SELECT|BufferView::FITCUR);
|
||||
}
|
||||
|
||||
void Menubar::Pimpl::composeUIInfo(string const & menu_name, vector<Gnome::UI::Info> & Menus, string rootpath)
|
||||
{
|
||||
string path = rootpath;
|
||||
|
||||
if (!menubackend_->hasMenu(menu_name))
|
||||
{
|
||||
cout << "ERROR:composeUIInfo: Unknown menu `" << menu_name
|
||||
@ -111,6 +174,9 @@ void Menubar::Pimpl::composeUIInfo(string const & menu_name, vector<Gnome::UI::I
|
||||
|
||||
case MenuItem::Command: {
|
||||
string label = item.label();
|
||||
|
||||
path = rootpath + label;
|
||||
|
||||
if (label.find(item.shortcut()) != string::npos)
|
||||
label.insert(label.find(item.shortcut()), "_");
|
||||
|
||||
@ -204,14 +270,20 @@ void Menubar::Pimpl::composeUIInfo(string const & menu_name, vector<Gnome::UI::I
|
||||
case MenuItem::Submenu: {
|
||||
vector<Gnome::UI::Info> submenu;
|
||||
string label = item.label();
|
||||
|
||||
path = rootpath + label;
|
||||
|
||||
if (label.find(item.shortcut()) != string::npos)
|
||||
label.insert(label.find(item.shortcut()), "_");
|
||||
composeUIInfo(item.submenu(), submenu);
|
||||
composeUIInfo(item.submenu(), submenu, path + "/");
|
||||
Menus.push_back(Gnome::UI::Menu(label,submenu,label));
|
||||
break;
|
||||
}
|
||||
|
||||
case MenuItem::Separator: {
|
||||
|
||||
path = rootpath + "<Separator>";
|
||||
|
||||
Menus.push_back(Gnome::UI::Separator());
|
||||
break;
|
||||
}
|
||||
@ -222,8 +294,11 @@ void Menubar::Pimpl::composeUIInfo(string const & menu_name, vector<Gnome::UI::I
|
||||
cit != lastfiles->end() && ii < 10; ++cit, ++ii)
|
||||
{
|
||||
int action = lyxaction.getPseudoAction(LFUN_FILE_OPEN, (*cit));
|
||||
string label = "_" + tostr(ii) + ". " + MakeDisplayPath((*cit),30);
|
||||
string label = tostr(ii) + ". " + MakeDisplayPath((*cit),30);
|
||||
|
||||
path = rootpath + label;
|
||||
label = "_" + label;
|
||||
|
||||
Menus.push_back(Gnome::UI::Item(label,
|
||||
bind<int>(slot(this, &Menubar::Pimpl::callback), action),
|
||||
label));
|
||||
@ -240,6 +315,8 @@ void Menubar::Pimpl::composeUIInfo(string const & menu_name, vector<Gnome::UI::I
|
||||
int action = lyxaction.getPseudoAction(LFUN_SWITCHBUFFER, *cit);
|
||||
string label = MakeDisplayPath(*cit, 30);
|
||||
|
||||
path = rootpath + label;
|
||||
|
||||
Menus.push_back(Gnome::UI::Item(label,
|
||||
bind<int>(slot(this, &Menubar::Pimpl::callback), action),
|
||||
label));
|
||||
@ -247,16 +324,57 @@ void Menubar::Pimpl::composeUIInfo(string const & menu_name, vector<Gnome::UI::I
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case MenuItem::Toc: {
|
||||
ListsHolder t;
|
||||
t.path = path;
|
||||
toc_.push_back(t);
|
||||
break;
|
||||
}
|
||||
|
||||
case MenuItem::ViewFormats: {
|
||||
add_formats(Menus, LFUN_PREVIEW, true);
|
||||
break;
|
||||
}
|
||||
|
||||
case MenuItem::UpdateFormats: {
|
||||
add_formats(Menus, LFUN_UPDATE, true);
|
||||
break;
|
||||
}
|
||||
|
||||
case MenuItem::ExportFormats: {
|
||||
add_formats(Menus, LFUN_EXPORT, false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Menubar::Pimpl::add_formats(vector<Gnome::UI::Info> & Menus, kb_action action, bool viewable)
|
||||
{
|
||||
vector<pair<string,string> > names =
|
||||
viewable
|
||||
? Exporter::GetViewableFormats(owner_->buffer())
|
||||
: Exporter::GetExportableFormats(owner_->buffer());
|
||||
|
||||
for (vector<pair<string,string> >::const_iterator cit = names.begin();
|
||||
cit != names.end() ; ++cit) {
|
||||
int action2 = lyxaction.getPseudoAction(action, (*cit).first);
|
||||
string label = (*cit).second;
|
||||
|
||||
Menus.push_back(Gnome::UI::Item(label,
|
||||
bind<int>(slot(this, &Menubar::Pimpl::callback), action2),
|
||||
label));
|
||||
}
|
||||
}
|
||||
|
||||
void Menubar::Pimpl::connectWidgetToAction(GnomeUIInfo * guinfo)
|
||||
{
|
||||
for (; guinfo->type != GnomeUIInfoType(GNOME_APP_UI_ENDOFINFO); ++guinfo)
|
||||
{
|
||||
if ( guinfo->type == GnomeUIInfoType(GNOME_APP_UI_ITEM) ||
|
||||
guinfo->type == GnomeUIInfoType(GNOME_APP_UI_TOGGLEITEM) )
|
||||
if ( ( guinfo->type == GnomeUIInfoType(GNOME_APP_UI_ITEM) ||
|
||||
guinfo->type == GnomeUIInfoType(GNOME_APP_UI_TOGGLEITEM) ) &&
|
||||
guinfo->moreinfo != NULL )
|
||||
{
|
||||
(*((void(*)(void *, void *))(guinfo->moreinfo)))(NULL, guinfo->user_data);
|
||||
wid_act_.push_back( GtkWidgetToAction( guinfo->widget, action_ ) );
|
||||
|
@ -19,12 +19,18 @@
|
||||
#include "LString.h"
|
||||
#include <gnome--/app.h>
|
||||
#include "frontends/Menubar.h"
|
||||
#include "commandtags.h"
|
||||
#include "buffer.h"
|
||||
|
||||
class LyXView;
|
||||
class MenuBackend;
|
||||
class MenuItem;
|
||||
class StrPool;
|
||||
|
||||
#ifdef SIGC_CXX_NAMESPACES
|
||||
using SigC::Connection;
|
||||
#endif
|
||||
|
||||
#include "debug.h"
|
||||
|
||||
/*
|
||||
@ -55,14 +61,31 @@ public:
|
||||
void openByName(string const &);
|
||||
/// update the state of menuitems
|
||||
void update();
|
||||
/// update TOC, LOF, ... on user' request
|
||||
void updateAllLists();
|
||||
|
||||
protected:
|
||||
/// callback function
|
||||
void callback(int action);
|
||||
/// callback function used by lists
|
||||
void callbackToc(Buffer::TocItem tg);
|
||||
/// compose Gnome::UI::Array object describing the menu
|
||||
void composeUIInfo(string const & menu_name, vector<Gnome::UI::Info> & Menus);
|
||||
void composeUIInfo(string const & menu_name, vector<Gnome::UI::Info> & Menus, string path);
|
||||
/// populate wid_act_ vector with all widgets and corresponding actions
|
||||
void connectWidgetToAction(GnomeUIInfo * guinfo);
|
||||
|
||||
/// lists (toc, lof, lot, loa)
|
||||
struct ListsHolder {
|
||||
string path;
|
||||
Gnome::UI::Array lst;
|
||||
|
||||
ListsHolder () { }
|
||||
ListsHolder (const ListsHolder & a) { path = a.path; lst = a.lst; }
|
||||
};
|
||||
/// populate lists
|
||||
void updateList(vector<Buffer::TocItem> *, vector<ListsHolder> *);
|
||||
/// Add to "Menus" the list of exportable/viewable formats
|
||||
void add_formats(vector<Gnome::UI::Info> & Menus, kb_action action, bool viewable);
|
||||
|
||||
private:
|
||||
///
|
||||
@ -77,5 +100,9 @@ private:
|
||||
bool ignore_action_;
|
||||
int action_;
|
||||
vector<GtkWidgetToAction> wid_act_;
|
||||
|
||||
/// toc
|
||||
Connection utoc_;
|
||||
vector<ListsHolder> toc_;
|
||||
};
|
||||
#endif
|
||||
|
@ -9,8 +9,14 @@
|
||||
* ====================================================== */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <gnome--/main.h>
|
||||
#include <gtk--/accelgroup.h>
|
||||
#include <gnome--/pixmap.h>
|
||||
#include <gtk--/separator.h>
|
||||
#include <gtk--/frame.h>
|
||||
#include <gtk--/label.h>
|
||||
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
|
||||
@ -21,7 +27,8 @@ using SigC::slot;
|
||||
|
||||
GLyxAppWin::GLyxAppWin() :
|
||||
Gnome::App(PACKAGE,"LyX Gnomified"),
|
||||
status_(false, true, GNOME_PREFERENCES_NEVER)
|
||||
status_(false, true, GNOME_PREFERENCES_NEVER),
|
||||
action_mode(false)
|
||||
{
|
||||
init();
|
||||
show_all();
|
||||
@ -38,10 +45,6 @@ void GLyxAppWin::init()
|
||||
set_default_size(250, 350);
|
||||
set_wmclass(PACKAGE, "GnomeLyX");
|
||||
|
||||
frame_.set_shadow_type(GTK_SHADOW_IN);
|
||||
|
||||
set_contents(frame_);
|
||||
|
||||
set_statusbar(status_);
|
||||
|
||||
// initial (dummy) menu
|
||||
@ -54,6 +57,31 @@ void GLyxAppWin::init()
|
||||
menu.gtkobj());
|
||||
|
||||
menusize_ = menu.size();
|
||||
|
||||
// packing widgets
|
||||
|
||||
// temporary main widget
|
||||
Gtk::HBox * h = manage( new Gtk::HBox() );
|
||||
Gnome::Pixmap * p;
|
||||
p = Gtk::wrap( GNOME_PIXMAP( gnome_stock_pixmap_widget(NULL, GNOME_STOCK_PIXMAP_ABOUT) ) );
|
||||
|
||||
h->children().push_back( Gtk::Box_Helpers::Element( *p ) );
|
||||
h->children().push_back( *(manage(new Gtk::Label("Waiting for LyXView port"))) );
|
||||
|
||||
view_ = h;
|
||||
// temporary main widget: done
|
||||
|
||||
// packing main widget and separator
|
||||
Gtk::Separator * sep = manage( new Gtk::HSeparator() );
|
||||
|
||||
box_.children().push_back( Gtk::Box_Helpers::Element(*view_) );
|
||||
box_.children().push_back( Gtk::Box_Helpers::Element(*sep, false) );
|
||||
|
||||
box_.show_all();
|
||||
|
||||
set_contents(box_);
|
||||
|
||||
key_press_event.connect(slot(this, &GLyxAppWin::key_pressed));
|
||||
}
|
||||
|
||||
|
||||
@ -66,4 +94,50 @@ void GLyxAppWin::set_menu(Gnome::UI::Array &menu)
|
||||
menusize_ = menu.size();
|
||||
}
|
||||
|
||||
void GLyxAppWin::update_menu(string path, int noelms, Gnome::UI::Array &menu)
|
||||
{
|
||||
// remove "noelms" items and install new items from "menu"
|
||||
gnome_app_remove_menus(this->gtkobj(),path.c_str(),noelms);
|
||||
gnome_app_insert_menus(this->gtkobj(),path.c_str(),menu.gtkobj());
|
||||
gnome_app_install_menu_hints(this->gtkobj(),menu.gtkobj());
|
||||
}
|
||||
|
||||
// clean up first, then add new action widget and finally, disable main view
|
||||
void GLyxAppWin::add_action(Gtk::Container &action, string title, bool expand)
|
||||
{
|
||||
remove_action();
|
||||
|
||||
Gtk::Frame * frame = manage( new Gtk::Frame(title) );
|
||||
frame->set_border_width(2);
|
||||
action.set_border_width(2);
|
||||
frame->add(action);
|
||||
|
||||
box_.children().push_back( Gtk::Box_Helpers::Element( *frame, expand ) );
|
||||
box_.show_all();
|
||||
|
||||
view_->set_sensitive(false);
|
||||
action_mode = true;
|
||||
}
|
||||
|
||||
void GLyxAppWin::remove_action()
|
||||
{
|
||||
while ( box_.children().size() > 2 )
|
||||
{
|
||||
box_.children().pop_back();
|
||||
}
|
||||
|
||||
view_->set_sensitive(true);
|
||||
action_mode = false;
|
||||
}
|
||||
|
||||
gint GLyxAppWin::key_pressed(GdkEventKey * e)
|
||||
{
|
||||
if (action_mode &&
|
||||
e->keyval == GDK_Escape)
|
||||
{
|
||||
remove_action();
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -30,6 +30,16 @@ class GLyxAppWin: public Gnome::App
|
||||
|
||||
/// set menu of the window
|
||||
void set_menu(Gnome::UI::Array &);
|
||||
/// update menu
|
||||
void update_menu(string path,
|
||||
int noelms,
|
||||
Gnome::UI::Array &);
|
||||
/// add action area
|
||||
void add_action(Gtk::Container &, string title, bool expand=false);
|
||||
/// remove action area
|
||||
void remove_action();
|
||||
/// clears action area if Escape is pressed
|
||||
gint key_pressed(GdkEventKey * e);
|
||||
|
||||
protected:
|
||||
/// init window widgets
|
||||
@ -38,8 +48,11 @@ class GLyxAppWin: public Gnome::App
|
||||
protected:
|
||||
// widgets
|
||||
Gnome::AppBar status_;
|
||||
Gtk::Frame frame_;
|
||||
Gtk::VBox box_;
|
||||
Gtk::Widget *view_;
|
||||
|
||||
bool action_mode;
|
||||
|
||||
// menu size
|
||||
int menusize_;
|
||||
};
|
||||
|
@ -24,6 +24,8 @@
|
||||
#include "formrefdialog.h"
|
||||
#include "debug.h"
|
||||
|
||||
using std::endl;
|
||||
|
||||
FormRef::FormRef(LyXView *v, Dialogs *d)
|
||||
: dialog_(0), lv_(v), d_(d), inset_(0), h_(0), u_(0), ih_(0),
|
||||
sort(0), gotowhere(GOTOREF), type(REF), refs(0)
|
||||
|
@ -53,11 +53,11 @@ public:
|
||||
|
||||
private:
|
||||
enum Type {
|
||||
REF, PAGEREF, VREF, VPAGEREF, PRETTYREF,
|
||||
REF, PAGEREF, VREF, VPAGEREF, PRETTYREF
|
||||
};
|
||||
|
||||
enum GotoType {
|
||||
GOTOREF, GOTOBACK,
|
||||
GOTOREF, GOTOBACK
|
||||
};
|
||||
|
||||
/// Create the dialog if necessary, update it and display it.
|
||||
|
@ -31,7 +31,8 @@
|
||||
using std::vector;
|
||||
using std::pair;
|
||||
using std::stack;
|
||||
|
||||
using std::endl;
|
||||
|
||||
FormToc::FormToc(LyXView *v, Dialogs *d)
|
||||
: dialog_(0), lv_(v), d_(d), inset_(0), h_(0), u_(0), ih_(0),
|
||||
toclist(0), type(Buffer::TOC_TOC), depth(1)
|
||||
|
@ -90,7 +90,7 @@ private slots:
|
||||
form_->set_type(Buffer::TOC_LOA);
|
||||
break;
|
||||
default:
|
||||
lyxerr[Debug::GUI] << "Unknown TOC combo selection." << endl;
|
||||
lyxerr[Debug::GUI] << "Unknown TOC combo selection." << std::endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -336,7 +336,7 @@ bool FormDocument::class_apply()
|
||||
params.pagestyle = fl_get_choice_text(class_->choice_doc_pagestyle);
|
||||
|
||||
#ifdef USE_CLASS_COMBO
|
||||
unsigned int new_class = combo_doc_class->get();
|
||||
unsigned int new_class = combo_doc_class->get() - 1;
|
||||
#else
|
||||
unsigned int new_class = fl_get_choice(class_->choice_doc_class) - 1;
|
||||
#endif
|
||||
@ -369,7 +369,7 @@ bool FormDocument::class_apply()
|
||||
_("Errors loading new document class."),
|
||||
_("Reverting to original document class."));
|
||||
#ifdef USE_CLASS_COMBO
|
||||
combo_doc_class->select(params.textclass);
|
||||
combo_doc_class->select(params.textclass + 1);
|
||||
#else
|
||||
fl_set_choice(class_->choice_doc_class,
|
||||
params.textclass + 1);
|
||||
@ -1168,7 +1168,7 @@ void FormDocument::CheckChoiceClass(FL_OBJECT * ob, long)
|
||||
string tct;
|
||||
|
||||
#ifdef USE_CLASS_COMBO
|
||||
tc = combo_doc_class->get();
|
||||
tc = combo_doc_class->get() - 1;
|
||||
tct = combo_doc_class->getline();
|
||||
#else
|
||||
tc = fl_get_choice(ob) - 1;
|
||||
@ -1189,7 +1189,7 @@ void FormDocument::CheckChoiceClass(FL_OBJECT * ob, long)
|
||||
_("Unable to switch to new document class."),
|
||||
_("Reverting to original document class."));
|
||||
#ifdef USE_CLASS_COMBO
|
||||
combo_doc_class->select(lv_->buffer()->params.textclass);
|
||||
combo_doc_class->select(lv_->buffer()->params.textclass + 1);
|
||||
#else
|
||||
fl_set_choice(class_->choice_doc_class,
|
||||
lv_->buffer()->params.textclass + 1);
|
||||
|
@ -1010,7 +1010,7 @@ void InsetFig::draw(BufferView * bv, LyXFont const & f,
|
||||
} else {
|
||||
char * msg = 0;
|
||||
string lfname = fname;
|
||||
if (GetExtension(fname).empty())
|
||||
if (!fname.empty() && GetExtension(fname).empty())
|
||||
lfname += ".eps";
|
||||
// draw frame
|
||||
pain.rectangle(int(x), baseline - hgh - 1, wid + 1, hgh + 1);
|
||||
|
@ -38,6 +38,12 @@
|
||||
|
||||
const int ADD_TO_HEIGHT = 2;
|
||||
const int ADD_TO_TABULAR_WIDTH = 2;
|
||||
///
|
||||
static LyXTabular * paste_tabular = 0;
|
||||
bool InsetTabular::hasPasteBuffer() const
|
||||
{
|
||||
return (paste_tabular != 0);
|
||||
}
|
||||
|
||||
using std::ostream;
|
||||
using std::ifstream;
|
||||
@ -128,7 +134,6 @@ InsetTabular::InsetTabular(Buffer * buf, int rows, int columns)
|
||||
cursor.pos(0);
|
||||
sel_pos_start = sel_pos_end = sel_cell_start = sel_cell_end = 0;
|
||||
dialogs_ = 0;
|
||||
paste_tabular = 0;
|
||||
need_update = INIT;
|
||||
}
|
||||
|
||||
@ -145,7 +150,6 @@ InsetTabular::InsetTabular(InsetTabular const & tab, Buffer * buf)
|
||||
cursor.pos(0);
|
||||
sel_pos_start = sel_pos_end = sel_cell_start = sel_cell_end = 0;
|
||||
dialogs_ = 0;
|
||||
paste_tabular = 0;
|
||||
need_update = INIT;
|
||||
}
|
||||
|
||||
@ -590,8 +594,9 @@ void InsetTabular::InsetButtonPress(BufferView * bv, int x, int y, int button)
|
||||
}
|
||||
the_locking_inset = 0;
|
||||
if (inset_hit && bv->the_locking_inset) {
|
||||
ActivateCellInset(bv, x, y, button);
|
||||
the_locking_inset->InsetButtonPress(bv, x-inset_x, y-inset_y, button);
|
||||
if (ActivateCellInset(bv, x, y, button))
|
||||
the_locking_inset->InsetButtonPress(bv, x-inset_x,
|
||||
y-inset_y, button);
|
||||
return;
|
||||
}
|
||||
ShowInsetCursor(bv);
|
||||
@ -1532,7 +1537,7 @@ bool InsetTabular::ActivateCellInset(BufferView * bv, int x, int y, int button,
|
||||
if (!the_locking_inset)
|
||||
return false;
|
||||
UpdateLocal(bv, CELL, false);
|
||||
return true;
|
||||
return (the_locking_inset != 0);
|
||||
}
|
||||
|
||||
|
||||
@ -1913,8 +1918,36 @@ bool InsetTabular::cutSelection()
|
||||
{
|
||||
if (!hasSelection())
|
||||
return false;
|
||||
for(int i=sel_cell_start; i < sel_cell_end; ++i) {
|
||||
tabular->GetCellInset(i)->clear();
|
||||
|
||||
int sel_col_start, sel_col_end;
|
||||
int sel_row_start, sel_row_end;
|
||||
|
||||
sel_col_start = tabular->column_of_cell(sel_cell_start);
|
||||
sel_col_end = tabular->column_of_cell(sel_cell_end);
|
||||
if (sel_col_start > sel_col_end) {
|
||||
sel_col_start = sel_col_end;
|
||||
sel_col_end = tabular->right_column_of_cell(sel_cell_start);
|
||||
} else {
|
||||
sel_col_end = tabular->right_column_of_cell(sel_cell_end);
|
||||
}
|
||||
sel_row_start = tabular->row_of_cell(sel_cell_start);
|
||||
sel_row_end = tabular->row_of_cell(sel_cell_end);
|
||||
if (sel_row_start > sel_row_end) {
|
||||
int tmp;
|
||||
tmp = sel_row_start;
|
||||
sel_row_start = sel_row_end;
|
||||
sel_row_end = tmp;
|
||||
}
|
||||
if (sel_cell_start > sel_cell_end) {
|
||||
int tmp = sel_cell_start;
|
||||
sel_cell_start = sel_cell_end;
|
||||
sel_cell_end = tmp;
|
||||
}
|
||||
int i, j;
|
||||
for(i=sel_row_start; i <= sel_row_end; ++i) {
|
||||
for(j=sel_col_start; j <= sel_col_end; ++j) {
|
||||
tabular->GetCellInset(tabular->GetCellNumber(i, j))->clear();
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -218,7 +218,7 @@ private:
|
||||
///
|
||||
int GetMaxWidthOfCell(Painter &, int cell) const;
|
||||
///
|
||||
bool hasPasteBuffer() const { return (paste_tabular != 0); }
|
||||
bool hasPasteBuffer() const;
|
||||
///
|
||||
bool copySelection();
|
||||
///
|
||||
@ -266,7 +266,5 @@ private:
|
||||
mutable UpdateCodes need_update;
|
||||
///
|
||||
mutable Dialogs * dialogs_;
|
||||
///
|
||||
LyXTabular * paste_tabular;
|
||||
};
|
||||
#endif
|
||||
|
@ -46,6 +46,7 @@
|
||||
#include "intl.h"
|
||||
#include "trans_mgr.h"
|
||||
#include "lyxscreen.h"
|
||||
#include "WorkArea.h"
|
||||
|
||||
using std::ostream;
|
||||
using std::ifstream;
|
||||
@ -596,12 +597,26 @@ void InsetText::InsetButtonPress(BufferView * bv, int x, int y, int button)
|
||||
}
|
||||
}
|
||||
if (!inset) {
|
||||
bool paste_internally = false;
|
||||
if ((button == 2) && TEXT(bv)->selection) {
|
||||
LocalDispatch(bv, LFUN_COPY, "");
|
||||
paste_internally = true;
|
||||
}
|
||||
TEXT(bv)->SetCursorFromCoordinates(bv, x-drawTextXOffset,
|
||||
y+TEXT(bv)->first+insetAscent);
|
||||
TEXT(bv)->sel_cursor = TEXT(bv)->cursor;
|
||||
UpdateLocal(bv, CURSOR, false);
|
||||
bv->owner()->setLayout(cpar(bv)->GetLayout());
|
||||
old_par = cpar(bv);
|
||||
// Insert primary selection with middle mouse
|
||||
// if there is a local selection in the current buffer,
|
||||
// insert this
|
||||
if (button == 2) {
|
||||
if (paste_internally)
|
||||
LocalDispatch(bv, LFUN_PASTE, "");
|
||||
else
|
||||
LocalDispatch(bv, LFUN_PASTESELECTION, "paragraph");
|
||||
}
|
||||
}
|
||||
ShowInsetCursor(bv);
|
||||
}
|
||||
@ -800,7 +815,10 @@ InsetText::LocalDispatch(BufferView * bv,
|
||||
bv->text->cursor.par()->next
|
||||
#endif
|
||||
);
|
||||
TEXT(bv)->Backspace(bv);
|
||||
if (TEXT(bv)->selection)
|
||||
TEXT(bv)->CutSelection(bv);
|
||||
else
|
||||
TEXT(bv)->Backspace(bv);
|
||||
UpdateLocal(bv, CURSOR_PAR, true);
|
||||
break;
|
||||
case LFUN_DELETE:
|
||||
@ -813,7 +831,10 @@ InsetText::LocalDispatch(BufferView * bv,
|
||||
bv->text->cursor.par()->next
|
||||
#endif
|
||||
);
|
||||
TEXT(bv)->Delete(bv);
|
||||
if (TEXT(bv)->selection)
|
||||
TEXT(bv)->CutSelection(bv);
|
||||
else
|
||||
TEXT(bv)->Delete(bv);
|
||||
UpdateLocal(bv, CURSOR_PAR, true);
|
||||
break;
|
||||
case LFUN_CUT:
|
||||
@ -834,6 +855,20 @@ InsetText::LocalDispatch(BufferView * bv,
|
||||
TEXT(bv)->CopySelection(bv);
|
||||
UpdateLocal(bv, CURSOR_PAR, false);
|
||||
break;
|
||||
case LFUN_PASTESELECTION:
|
||||
{
|
||||
string clip(bv->workarea()->getClipboard());
|
||||
|
||||
if (clip.empty())
|
||||
break;
|
||||
if (arg == "paragraph") {
|
||||
TEXT(bv)->InsertStringB(bv, clip);
|
||||
} else {
|
||||
TEXT(bv)->InsertStringA(bv, clip);
|
||||
}
|
||||
UpdateLocal(bv, CURSOR_PAR, true);
|
||||
break;
|
||||
}
|
||||
case LFUN_PASTE:
|
||||
if (!autoBreakRows) {
|
||||
CutAndPaste cap;
|
||||
@ -1368,14 +1403,16 @@ void InsetText::resizeLyXText(BufferView * bv) const
|
||||
|
||||
// ProhibitInput(bv);
|
||||
|
||||
lpar = TEXT(bv)->cursor.par();
|
||||
pos = TEXT(bv)->cursor.pos();
|
||||
selstartpar = TEXT(bv)->sel_start_cursor.par();
|
||||
selstartpos = TEXT(bv)->sel_start_cursor.pos();
|
||||
selendpar = TEXT(bv)->sel_end_cursor.par();
|
||||
selendpos = TEXT(bv)->sel_end_cursor.pos();
|
||||
selection = TEXT(bv)->selection;
|
||||
mark_set = TEXT(bv)->mark_set;
|
||||
if (locked) {
|
||||
lpar = TEXT(bv)->cursor.par();
|
||||
pos = TEXT(bv)->cursor.pos();
|
||||
selstartpar = TEXT(bv)->sel_start_cursor.par();
|
||||
selstartpos = TEXT(bv)->sel_start_cursor.pos();
|
||||
selendpar = TEXT(bv)->sel_end_cursor.par();
|
||||
selendpos = TEXT(bv)->sel_end_cursor.pos();
|
||||
selection = TEXT(bv)->selection;
|
||||
mark_set = TEXT(bv)->mark_set;
|
||||
}
|
||||
deleteLyXText(bv, (the_locking_inset == 0));
|
||||
|
||||
if (lpar) {
|
||||
|
@ -593,7 +593,7 @@ void sc_store_replacement(string const & mis, string const & cor) {
|
||||
PspellCanHaveError * spell_error_object;
|
||||
|
||||
static
|
||||
void init_spell_checker(BufferParams const &, string const & lang)
|
||||
void init_spell_checker(BufferParams const &, string const & /* lang */)
|
||||
{
|
||||
PspellConfig * config = new_pspell_config();
|
||||
spell_error_object = new_pspell_manager(config);
|
||||
@ -630,7 +630,6 @@ isp_result * sc_check_word(string const & word)
|
||||
if (word_ok) {
|
||||
result->flag = ISP_OK;
|
||||
} else {
|
||||
|
||||
PspellWordList const * sugs =
|
||||
pspell_manager_suggest(sc, word.c_str());
|
||||
Assert(sugs != 0);
|
||||
|
@ -787,7 +787,7 @@ char LyXTable::GetAlignment(int cell)
|
||||
return column_info[column_of_cell(cell)].alignment;
|
||||
}
|
||||
|
||||
string LyXTable::GetPWidth(int cell)
|
||||
string const LyXTable::GetPWidth(int cell)
|
||||
{
|
||||
int fvcell = FirstVirtualCell(cell);
|
||||
|
||||
@ -796,7 +796,7 @@ string LyXTable::GetPWidth(int cell)
|
||||
return column_info[column_of_cell(fvcell)].p_width;
|
||||
}
|
||||
|
||||
string LyXTable::GetAlignSpecial(int cell, int what)
|
||||
string const LyXTable::GetAlignSpecial(int cell, int what)
|
||||
{
|
||||
if (what == SET_SPECIAL_MULTI)
|
||||
return cellinfo_of_cell(cell)->align_special;
|
||||
|
Loading…
Reference in New Issue
Block a user