mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
Anguses patch + some modifications for smart? inset-update.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@864 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
e3bd2ba9dd
commit
89885b5fa1
15
ChangeLog
15
ChangeLog
@ -1,3 +1,18 @@
|
||||
2000-07-06 Angus Leeming <a.leeming@ic.ac.uk>
|
||||
|
||||
* src/insets/insetbib.[Ch] (callback) new method, moving callback
|
||||
processing inside class.
|
||||
|
||||
* src/insets/insetindex.[Ch] (callback) new method, moving callback
|
||||
processing inside class.
|
||||
|
||||
* src/insets/insetindex.h new struct Holder, consistent with other
|
||||
insets.
|
||||
|
||||
* src/insets/insetcite.[Ch] and elsewhere: stripped out xforms
|
||||
citation dialog from main code and placed it in src/frontends/xforms.
|
||||
Dialog launched through signals instead of callbacks
|
||||
|
||||
2000-07-06 R. Lahaye <lahaye@postech.ac.kr>
|
||||
|
||||
* lyx.man: update the options description.
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include "intl.h"
|
||||
#include "support/LAssert.h"
|
||||
#include "frontends/Dialogs.h"
|
||||
#include "insets/insetcite.h"
|
||||
|
||||
#ifdef SIGC_CXX_NAMESPACES
|
||||
using SigC::slot;
|
||||
@ -789,7 +790,18 @@ void BufferView::Pimpl::workAreaButtonRelease(int x, int y,
|
||||
inset->InsetButtonRelease(bv_, x, y, button);
|
||||
} else {
|
||||
inset_hit->InsetButtonRelease(bv_, x, y, button);
|
||||
inset_hit->Edit(bv_, x, y, button);
|
||||
|
||||
switch( inset_hit->LyxCode() ) {
|
||||
case Inset::CITATION_CODE:
|
||||
{
|
||||
owner_->getDialogs()->
|
||||
showCitation( (InsetCitation *)inset_hit );
|
||||
}
|
||||
break;
|
||||
default:
|
||||
inset_hit->Edit(bv_, x, y, button);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -157,7 +157,7 @@ struct LaTeXFeatures {
|
||||
///
|
||||
typedef std::map<string , string> FileMap;
|
||||
///
|
||||
FileMap IncludedFiles;
|
||||
FileMap IncludedFiles;
|
||||
//@}
|
||||
BufferParams const & bufferParams() const;
|
||||
private:
|
||||
|
@ -156,7 +156,7 @@ void LyXAction::init()
|
||||
ReadOnly },
|
||||
{ LFUN_RIGHT, "char-forward", N_("Go one char forward"),
|
||||
ReadOnly },
|
||||
{ LFUN_INSERT_CITATION, "citation-insert",
|
||||
{ LFUN_CREATE_CITATION, "citation-insert",
|
||||
N_("Insert citation"), Noop },
|
||||
{ LFUN_EXEC_COMMAND, "command-execute", "", NoBuffer },
|
||||
{ LFUN_PREFIX, "command-prefix",
|
||||
|
@ -1,34 +1,16 @@
|
||||
#ifndef FD_citation_form_h_
|
||||
#define FD_citation_form_h_
|
||||
#ifndef FD_bibitem_form_h_
|
||||
#define FD_bibitem_form_h_
|
||||
/* Header file generated with fdesign. */
|
||||
|
||||
|
||||
/**** Forms and Objects ****/
|
||||
|
||||
typedef struct {
|
||||
FL_FORM *form;
|
||||
void *vdata;
|
||||
long ldata;
|
||||
FL_OBJECT *box;
|
||||
FL_OBJECT *citeBrsr;
|
||||
FL_OBJECT *bibBrsr;
|
||||
FL_OBJECT *infoBrsr;
|
||||
FL_OBJECT *textAftr;
|
||||
FL_OBJECT *addBtn;
|
||||
FL_OBJECT *delBtn;
|
||||
FL_OBJECT *upBtn;
|
||||
FL_OBJECT *downBtn;
|
||||
FL_OBJECT *ok;
|
||||
FL_OBJECT *cancel;
|
||||
} FD_citation_form;
|
||||
|
||||
|
||||
typedef struct {
|
||||
struct FD_bibitem_form {
|
||||
FL_FORM *bibitem_form;
|
||||
void *vdata;
|
||||
long ldata;
|
||||
FL_OBJECT *key;
|
||||
FL_OBJECT *label;
|
||||
} FD_bibitem_form;
|
||||
};
|
||||
|
||||
#endif /* FD_citation_form_h_ */
|
||||
#endif /* FD_bibitem_form_h_ */
|
||||
|
@ -260,6 +260,7 @@ enum kb_action {
|
||||
LFUN_INSET_FLOAT, // Lgb 20000627
|
||||
LFUN_INSET_LIST, // Lgb 20000627
|
||||
LFUN_INSET_THEOREM, // Lgb 20000630
|
||||
LFUN_CREATE_CITATION, // Angus 20000705
|
||||
LFUN_LASTACTION /* this marks the end of the table */
|
||||
};
|
||||
|
||||
|
@ -108,6 +108,8 @@ public:
|
||||
///
|
||||
Signal1<void, InsetCitation *> showCitation;
|
||||
///
|
||||
Signal1<void, string const &> createCitation;
|
||||
///
|
||||
Signal1<void, InsetBibtex *> showBibtex;
|
||||
///
|
||||
Signal1<void, InsetInfo *> showInfo;
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include "FormCopyright.h"
|
||||
#include "FormPrint.h"
|
||||
#include "FormPreferences.h"
|
||||
#include "FormCitation.h"
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation
|
||||
@ -16,6 +17,7 @@ Dialogs::Dialogs(LyXView * lv)
|
||||
dialogs_.push_back(new FormCopyright(lv, this));
|
||||
dialogs_.push_back(new FormPrint(lv, this));
|
||||
dialogs_.push_back(new FormPreferences(lv, this));
|
||||
dialogs_.push_back(new FormCitation(lv, this));
|
||||
|
||||
// reduce the number of connections needed in
|
||||
// dialogs by a simple connection here.
|
||||
|
529
src/frontends/xforms/FormCitation.C
Normal file
529
src/frontends/xforms/FormCitation.C
Normal file
@ -0,0 +1,529 @@
|
||||
// -*- C++ -*-
|
||||
/* This file is part of
|
||||
* ======================================================
|
||||
*
|
||||
* LyX, The Document Processor
|
||||
*
|
||||
* Copyright 2000 The LyX Team.
|
||||
*
|
||||
* ======================================================
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <algorithm>
|
||||
|
||||
#include "gettext.h"
|
||||
#include FORMS_H_LOCATION
|
||||
#include "xform_macros.h"
|
||||
#include "FormCitation.h"
|
||||
#include "Dialogs.h"
|
||||
#include "LyXView.h"
|
||||
#include "lyxfunc.h"
|
||||
#include "insets/insetcite.h"
|
||||
#include "form_citation.h"
|
||||
#include "buffer.h"
|
||||
#include "BufferView.h"
|
||||
#include "support/filetools.h"
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation
|
||||
#endif
|
||||
|
||||
using std::vector;
|
||||
using std::pair;
|
||||
using std::max;
|
||||
using std::min;
|
||||
using std::find;
|
||||
|
||||
C_RETURNCB(FormCitation, WMHideCB)
|
||||
C_GENERICCB(FormCitation, OKCB)
|
||||
C_GENERICCB(FormCitation, CancelCB)
|
||||
C_GENERICCB(FormCitation, InputCB)
|
||||
|
||||
FormCitation::FormCitation(LyXView * lv, Dialogs * d)
|
||||
: dialog_(0), lv_(lv), d_(d), h_(0), inset_(0), dialogIsOpen(false)
|
||||
{
|
||||
// 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));
|
||||
}
|
||||
|
||||
|
||||
FormCitation::~FormCitation()
|
||||
{
|
||||
free();
|
||||
}
|
||||
|
||||
|
||||
void FormCitation::build()
|
||||
{
|
||||
dialog_ = build_citation();
|
||||
}
|
||||
|
||||
|
||||
void FormCitation::showInset( InsetCitation * inset )
|
||||
{
|
||||
if( dialogIsOpen || inset == 0 ) return;
|
||||
|
||||
inset_ = inset;
|
||||
|
||||
textAfter = inset->getOptions();
|
||||
updateCitekeys(inset->getContents());
|
||||
show();
|
||||
}
|
||||
|
||||
|
||||
void FormCitation::createInset( string const & arg )
|
||||
{
|
||||
if( dialogIsOpen ) return;
|
||||
|
||||
string keys;
|
||||
if (contains(arg, "|")) {
|
||||
keys = token(arg, '|', 0);
|
||||
textAfter = token(arg, '|', 1);
|
||||
} else {
|
||||
keys = arg;
|
||||
textAfter.erase();
|
||||
}
|
||||
|
||||
updateCitekeys(keys);
|
||||
show();
|
||||
}
|
||||
|
||||
|
||||
void FormCitation::show()
|
||||
{
|
||||
if (!dialog_) {
|
||||
build();
|
||||
fl_set_form_atclose(dialog_->form_citation,
|
||||
C_FormCitationWMHideCB, 0);
|
||||
}
|
||||
|
||||
update(); // make sure its up-to-date
|
||||
|
||||
dialogIsOpen = true;
|
||||
if (dialog_->form_citation->visible) {
|
||||
fl_raise_form(dialog_->form_citation);
|
||||
} else {
|
||||
fl_show_form(dialog_->form_citation,
|
||||
FL_PLACE_MOUSE | FL_FREE_SIZE,
|
||||
FL_TRANSIENT,
|
||||
_("Citation"));
|
||||
u_ = d_->updateBufferDependent.
|
||||
connect(slot(this, &FormCitation::update));
|
||||
h_ = d_->hideBufferDependent.
|
||||
connect(slot(this, &FormCitation::hide));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void FormCitation::update()
|
||||
{
|
||||
bibkeys.clear();
|
||||
bibkeysInfo.clear();
|
||||
|
||||
vector<pair<string,string> > blist =
|
||||
lv_->buffer()->getBibkeyList();
|
||||
|
||||
for( unsigned int i = 0; i < blist.size(); ++i ) {
|
||||
bibkeys.push_back(blist[i].first);
|
||||
bibkeysInfo.push_back(blist[i].second);
|
||||
}
|
||||
|
||||
blist.clear();
|
||||
|
||||
updateBrowser( dialog_->bibBrsr, bibkeys );
|
||||
updateBrowser( dialog_->citeBrsr, citekeys );
|
||||
fl_clear_browser( dialog_->infoBrsr );
|
||||
|
||||
// No keys have been selected yet, so...
|
||||
setBibButtons( OFF );
|
||||
setCiteButtons( OFF );
|
||||
|
||||
int noKeys = max( bibkeys.size(), citekeys.size() );
|
||||
|
||||
// Place bounds, so that 4 <= noKeys <= 15
|
||||
noKeys = max( 4, min(15, noKeys) );
|
||||
|
||||
// Re-size the form to accommodate the new browser size
|
||||
int size = 20 * noKeys;
|
||||
bool bibPresent = ( bibkeys.size() > 0 );
|
||||
setSize( size, bibPresent );
|
||||
|
||||
fl_set_input( dialog_->textAftr, textAfter.c_str() );
|
||||
}
|
||||
|
||||
|
||||
void FormCitation::updateCitekeys( string const & keysIn )
|
||||
{
|
||||
citekeys.clear();
|
||||
|
||||
string tmp;
|
||||
string keys = keysIn;
|
||||
keys = frontStrip( split(keys, tmp, ',') );
|
||||
while( !tmp.empty() ) {
|
||||
citekeys.push_back( tmp );
|
||||
keys = frontStrip( split(keys, tmp, ',') );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void FormCitation::updateBrowser( FL_OBJECT * browser,
|
||||
vector<string> const & keys ) const
|
||||
{
|
||||
fl_clear_browser( browser );
|
||||
|
||||
fl_freeze_form( browser->form );
|
||||
for( unsigned int i = 0; i < keys.size(); ++i )
|
||||
fl_add_browser_line( browser, keys[i].c_str() );
|
||||
fl_unfreeze_form( browser->form );
|
||||
}
|
||||
|
||||
|
||||
void FormCitation::setBibButtons( State status ) const
|
||||
{
|
||||
switch (status) {
|
||||
case ON:
|
||||
fl_activate_object( dialog_->addBtn );
|
||||
fl_set_object_lcol( dialog_->addBtn, FL_BLACK );
|
||||
break;
|
||||
|
||||
case OFF:
|
||||
fl_deactivate_object( dialog_->addBtn );
|
||||
fl_set_object_lcol( dialog_->addBtn, FL_INACTIVE );
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void FormCitation::setCiteButtons( State status ) const
|
||||
{
|
||||
switch( status ) {
|
||||
case ON:
|
||||
{
|
||||
fl_activate_object( dialog_->delBtn );
|
||||
fl_set_object_lcol( dialog_->delBtn, FL_BLACK );
|
||||
|
||||
int sel = fl_get_browser( dialog_->citeBrsr );
|
||||
|
||||
if( sel != 1 ) {
|
||||
fl_activate_object( dialog_->upBtn );
|
||||
fl_set_object_lcol( dialog_->upBtn, FL_BLACK );
|
||||
} else {
|
||||
fl_deactivate_object( dialog_->upBtn );
|
||||
fl_set_object_lcol( dialog_->upBtn, FL_INACTIVE );
|
||||
}
|
||||
|
||||
if( sel != fl_get_browser_maxline(dialog_->citeBrsr)) {
|
||||
fl_activate_object( dialog_->downBtn );
|
||||
fl_set_object_lcol( dialog_->downBtn, FL_BLACK );
|
||||
} else {
|
||||
fl_deactivate_object( dialog_->downBtn );
|
||||
fl_set_object_lcol( dialog_->downBtn, FL_INACTIVE );
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case OFF:
|
||||
{
|
||||
fl_deactivate_object( dialog_->delBtn );
|
||||
fl_set_object_lcol( dialog_->delBtn, FL_INACTIVE );
|
||||
|
||||
fl_deactivate_object( dialog_->upBtn );
|
||||
fl_set_object_lcol( dialog_->upBtn, FL_INACTIVE );
|
||||
|
||||
fl_deactivate_object( dialog_->downBtn );
|
||||
fl_set_object_lcol( dialog_->downBtn, FL_INACTIVE );
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void FormCitation::setSize( int brsrHeight, bool bibPresent ) const
|
||||
{
|
||||
int const infoHeight = 110;
|
||||
int const otherHeight = 140;
|
||||
brsrHeight = max( brsrHeight, 175 );
|
||||
int formHeight = brsrHeight + otherHeight;
|
||||
|
||||
if( bibPresent ) formHeight += infoHeight + 30;
|
||||
fl_set_form_size( dialog_->form_citation, 430, formHeight );
|
||||
|
||||
// No resizing is alowed in the y-direction
|
||||
fl_set_form_minsize( dialog_->form_citation, 430, formHeight );
|
||||
fl_set_form_maxsize( dialog_->form_citation, 1000, formHeight );
|
||||
|
||||
int ypos = 0;
|
||||
fl_set_object_geometry( dialog_->box, 0, ypos, 430, formHeight );
|
||||
ypos += 30;
|
||||
fl_set_object_geometry( dialog_->citeBrsr, 10, ypos, 180, brsrHeight );
|
||||
fl_set_object_geometry( dialog_->bibBrsr, 240, ypos, 180, brsrHeight );
|
||||
fl_set_object_geometry( dialog_->addBtn, 200, ypos, 30, 30 );
|
||||
ypos += 35;
|
||||
fl_set_object_geometry( dialog_->delBtn, 200, ypos, 30, 30 );
|
||||
ypos += 35;
|
||||
fl_set_object_geometry( dialog_->upBtn, 200, ypos, 30, 30 );
|
||||
ypos += 35;
|
||||
fl_set_object_geometry( dialog_->downBtn, 200, ypos, 30, 30 );
|
||||
|
||||
ypos = brsrHeight+30; // base of Citation/Bibliography browsers
|
||||
|
||||
// awaiting natbib support
|
||||
fl_hide_object( dialog_->style );
|
||||
|
||||
if( bibPresent ) {
|
||||
ypos += 30;
|
||||
fl_set_object_geometry( dialog_->infoBrsr, 10, ypos, 410, infoHeight );
|
||||
fl_show_object( dialog_->infoBrsr );
|
||||
ypos += infoHeight;
|
||||
}
|
||||
else
|
||||
fl_hide_object( dialog_->infoBrsr );
|
||||
|
||||
ypos += 20;
|
||||
// awaiting natbib support
|
||||
fl_hide_object( dialog_->textBefore );
|
||||
|
||||
fl_set_object_geometry( dialog_->textAftr, 100, ypos, 250, 30 );
|
||||
fl_set_object_geometry( dialog_->ok, 230, ypos+50, 90, 30 );
|
||||
fl_set_object_geometry( dialog_->cancel, 330, ypos+50, 90, 30 );
|
||||
}
|
||||
|
||||
|
||||
void FormCitation::input( State cb )
|
||||
{
|
||||
switch( cb ) {
|
||||
case BIBBRSR:
|
||||
{
|
||||
fl_deselect_browser( dialog_->citeBrsr );
|
||||
|
||||
unsigned int sel = fl_get_browser( dialog_->bibBrsr );
|
||||
if( sel < 1 || sel > bibkeys.size() ) break;
|
||||
|
||||
// Put into infoBrsr the additional info associated with
|
||||
// the selected bibBrsr key
|
||||
fl_clear_browser( dialog_->infoBrsr );
|
||||
fl_add_browser_line( dialog_->infoBrsr,
|
||||
bibkeysInfo[sel-1].c_str() );
|
||||
|
||||
// Highlight the selected bibBrsr key in citeBrsr if present
|
||||
vector<string>::iterator it =
|
||||
find( citekeys.begin(), citekeys.end(), bibkeys[sel-1] );
|
||||
|
||||
if( it != citekeys.end() ) {
|
||||
int n = it - citekeys.begin();
|
||||
fl_select_browser_line( dialog_->citeBrsr, n+1 );
|
||||
fl_set_browser_topline( dialog_->citeBrsr, n+1 );
|
||||
}
|
||||
|
||||
if( !lv_->buffer()->isReadonly() ) {
|
||||
if( it != citekeys.end() ) {
|
||||
setBibButtons( OFF );
|
||||
setCiteButtons( ON );
|
||||
} else {
|
||||
setBibButtons( ON );
|
||||
setCiteButtons( OFF );
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case CITEBRSR:
|
||||
{
|
||||
unsigned int sel = fl_get_browser( dialog_->citeBrsr );
|
||||
if( sel < 1 || sel > citekeys.size() ) break;
|
||||
|
||||
if( !lv_->buffer()->isReadonly() ) {
|
||||
setBibButtons( OFF );
|
||||
setCiteButtons( ON );
|
||||
}
|
||||
|
||||
// Highlight the selected citeBrsr key in bibBrsr
|
||||
vector<string>::iterator it =
|
||||
find( bibkeys.begin(), bibkeys.end(), citekeys[sel-1] );
|
||||
|
||||
if (it != bibkeys.end()) {
|
||||
int n = it - bibkeys.begin();
|
||||
fl_select_browser_line( dialog_->bibBrsr, n+1 );
|
||||
fl_set_browser_topline( dialog_->bibBrsr, n+1 );
|
||||
|
||||
// Put into infoBrsr the additional info associated with
|
||||
// the selected citeBrsr key
|
||||
fl_clear_browser( dialog_->infoBrsr );
|
||||
fl_add_browser_line( dialog_->infoBrsr,
|
||||
bibkeysInfo[n].c_str() );
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ADD:
|
||||
{
|
||||
if( lv_->buffer()->isReadonly() ) break;
|
||||
|
||||
unsigned int sel = fl_get_browser( dialog_->bibBrsr );
|
||||
if( sel < 1 || sel > bibkeys.size() ) break;
|
||||
|
||||
// Add the selected bibBrsr key to citeBrsr
|
||||
fl_addto_browser( dialog_->citeBrsr,
|
||||
bibkeys[sel-1].c_str() );
|
||||
citekeys.push_back( bibkeys[sel-1] );
|
||||
|
||||
int n = citekeys.size();
|
||||
fl_select_browser_line( dialog_->citeBrsr, n );
|
||||
|
||||
setBibButtons( OFF );
|
||||
setCiteButtons( ON );
|
||||
}
|
||||
break;
|
||||
case DELETE:
|
||||
{
|
||||
if( lv_->buffer()->isReadonly() ) break;
|
||||
|
||||
unsigned int sel = fl_get_browser( dialog_->citeBrsr );
|
||||
if( sel < 1 || sel > citekeys.size() ) break;
|
||||
|
||||
// Remove the selected key from citeBrsr
|
||||
fl_delete_browser_line( dialog_->citeBrsr, sel ) ;
|
||||
citekeys.erase( citekeys.begin() + sel-1 );
|
||||
|
||||
setBibButtons( ON );
|
||||
setCiteButtons( OFF );
|
||||
}
|
||||
break;
|
||||
case UP:
|
||||
{
|
||||
if( lv_->buffer()->isReadonly() ) break;
|
||||
|
||||
unsigned int sel = fl_get_browser( dialog_->citeBrsr );
|
||||
if( sel < 2 || sel > citekeys.size() ) break;
|
||||
|
||||
// Move the selected key up one line
|
||||
vector<string>::iterator it = citekeys.begin() + sel-1;
|
||||
string tmp = *it;
|
||||
|
||||
fl_delete_browser_line( dialog_->citeBrsr, sel );
|
||||
citekeys.erase( it );
|
||||
|
||||
fl_insert_browser_line( dialog_->citeBrsr, sel-1, tmp.c_str() );
|
||||
fl_select_browser_line( dialog_->citeBrsr, sel-1 );
|
||||
citekeys.insert( it-1, tmp );
|
||||
setCiteButtons( ON );
|
||||
}
|
||||
break;
|
||||
case DOWN:
|
||||
{
|
||||
if( lv_->buffer()->isReadonly() ) break;
|
||||
|
||||
unsigned int sel = fl_get_browser( dialog_->citeBrsr );
|
||||
if( sel < 1 || sel > citekeys.size()-1 ) break;
|
||||
|
||||
// Move the selected key down one line
|
||||
vector<string>::iterator it = citekeys.begin() + sel-1;
|
||||
string tmp = *it;
|
||||
|
||||
fl_delete_browser_line( dialog_->citeBrsr, sel );
|
||||
citekeys.erase( it );
|
||||
|
||||
fl_insert_browser_line( dialog_->citeBrsr, sel+1, tmp.c_str() );
|
||||
fl_select_browser_line( dialog_->citeBrsr, sel+1 );
|
||||
citekeys.insert( it+1, tmp );
|
||||
setCiteButtons( ON );
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void FormCitation::apply()
|
||||
{
|
||||
if( lv_->buffer()->isReadonly() ) return;
|
||||
|
||||
string tmp;
|
||||
for( unsigned int i = 0; i < citekeys.size(); ++i ) {
|
||||
if (i > 0) tmp += ", ";
|
||||
tmp += citekeys[i];
|
||||
}
|
||||
|
||||
textAfter = fl_get_input(dialog_->textAftr);
|
||||
|
||||
if( inset_ != 0 )
|
||||
{
|
||||
inset_->setContents( tmp );
|
||||
inset_->setOptions( textAfter );
|
||||
lv_->view()->updateInset( inset_, true );
|
||||
} else {
|
||||
string arg = tmp + '|' + textAfter;
|
||||
lv_->getLyXFunc()->Dispatch( LFUN_INSERT_CITATION, arg.c_str() );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void FormCitation::hide()
|
||||
{
|
||||
if (dialog_
|
||||
&& dialog_->form_citation
|
||||
&& dialog_->form_citation->visible) {
|
||||
fl_hide_form(dialog_->form_citation);
|
||||
u_.disconnect();
|
||||
h_.disconnect();
|
||||
}
|
||||
|
||||
// free up the dialog for another inset
|
||||
inset_ = 0;
|
||||
dialogIsOpen = false;
|
||||
}
|
||||
|
||||
|
||||
void FormCitation::free()
|
||||
{
|
||||
// we don't need to delete u and h here because
|
||||
// hide() does that after disconnecting.
|
||||
if (dialog_) {
|
||||
if (dialog_->form_citation
|
||||
&& dialog_->form_citation->visible) {
|
||||
hide();
|
||||
}
|
||||
fl_free_form(dialog_->form_citation);
|
||||
delete dialog_;
|
||||
dialog_ = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int FormCitation::WMHideCB(FL_FORM * form, void *)
|
||||
{
|
||||
// Ensure that the signals (u and h) are disconnected even if the
|
||||
// window manager is used to close the dialog.
|
||||
FormCitation * pre = static_cast<FormCitation*>(form->u_vdata);
|
||||
pre->hide();
|
||||
return FL_CANCEL;
|
||||
}
|
||||
|
||||
|
||||
void FormCitation::OKCB(FL_OBJECT * ob, long)
|
||||
{
|
||||
FormCitation * pre = static_cast<FormCitation*>(ob->form->u_vdata);
|
||||
pre->apply();
|
||||
pre->hide();
|
||||
}
|
||||
|
||||
|
||||
void FormCitation::CancelCB(FL_OBJECT * ob, long)
|
||||
{
|
||||
FormCitation * pre = static_cast<FormCitation*>(ob->form->u_vdata);
|
||||
pre->hide();
|
||||
}
|
||||
|
||||
|
||||
void FormCitation::InputCB(FL_OBJECT * ob, long data)
|
||||
{
|
||||
FormCitation * pre = static_cast<FormCitation*>(ob->form->u_vdata);
|
||||
pre->input( static_cast<FormCitation::State>(data) );
|
||||
}
|
130
src/frontends/xforms/FormCitation.h
Normal file
130
src/frontends/xforms/FormCitation.h
Normal file
@ -0,0 +1,130 @@
|
||||
// -*- C++ -*-
|
||||
/* This file is part of
|
||||
* ======================================================
|
||||
*
|
||||
* LyX, The Document Processor
|
||||
*
|
||||
* Copyright 2000 The LyX Team.
|
||||
*
|
||||
* ======================================================
|
||||
*/
|
||||
|
||||
#ifndef FORMCITATION_H
|
||||
#define FORMCITATION_H
|
||||
|
||||
#include "DialogBase.h"
|
||||
#include "LString.h"
|
||||
#include <vector>
|
||||
#include "form_citation.h"
|
||||
|
||||
class Dialogs;
|
||||
// same arguement as in Dialogs.h s/LyX/UI/
|
||||
class LyXView;
|
||||
class InsetCitation;
|
||||
|
||||
/** This class provides an XForms implementation of the FormCitation Dialog.
|
||||
*/
|
||||
class FormCitation : public DialogBase {
|
||||
public:
|
||||
///
|
||||
enum State {
|
||||
DOWN,
|
||||
UP,
|
||||
DELETE,
|
||||
ADD,
|
||||
BIBBRSR,
|
||||
CITEBRSR,
|
||||
ON,
|
||||
OFF
|
||||
};
|
||||
/**@name Constructors and Destructors */
|
||||
//@{
|
||||
/// #FormCitation x(LyXFunc ..., Dialogs ...);#
|
||||
FormCitation(LyXView *, Dialogs *);
|
||||
///
|
||||
~FormCitation();
|
||||
//@}
|
||||
|
||||
/**@name Real per-instance Callback Methods */
|
||||
//@{
|
||||
static int WMHideCB(FL_FORM *, void *);
|
||||
static void OKCB(FL_OBJECT *, long);
|
||||
static void CancelCB(FL_OBJECT *, long);
|
||||
static void InputCB(FL_OBJECT *, long);
|
||||
//@}
|
||||
|
||||
private:
|
||||
FormCitation() {}
|
||||
FormCitation(FormCitation &) : DialogBase() {}
|
||||
|
||||
/**@name Slot Methods */
|
||||
//@{
|
||||
/// Create the dialog if necessary, update it and display it.
|
||||
void createInset( string const & );
|
||||
///
|
||||
void showInset( InsetCitation * );
|
||||
///
|
||||
void show();
|
||||
/// Hide the dialog.
|
||||
void hide();
|
||||
/// Not used but we've got to implement it.
|
||||
void update();
|
||||
//@}
|
||||
|
||||
/**@name Dialog internal methods */
|
||||
//@{
|
||||
/// Apply from dialog
|
||||
void apply();
|
||||
/// Filter the inputs
|
||||
void input( State );
|
||||
/// Build the dialog
|
||||
void build();
|
||||
///
|
||||
void updateCitekeys( string const & );
|
||||
///
|
||||
void updateBrowser( FL_OBJECT *, std::vector<string> const & ) const;
|
||||
///
|
||||
void setBibButtons( State ) const;
|
||||
///
|
||||
void setCiteButtons( State ) const;
|
||||
///
|
||||
void setSize( int, bool ) const;
|
||||
///
|
||||
FD_form_citation * build_citation();
|
||||
/// Explicitly free the dialog.
|
||||
void free();
|
||||
//@}
|
||||
|
||||
/**@name Private Data */
|
||||
//@{
|
||||
/// Real GUI implementation.
|
||||
FD_form_citation * dialog_;
|
||||
/** Which LyXFunc do we use?
|
||||
We could modify Dialogs to have a visible LyXFunc* instead and
|
||||
save a couple of bytes per dialog.
|
||||
*/
|
||||
LyXView * lv_;
|
||||
/** Which Dialogs do we belong to?
|
||||
Used so we can get at the signals we have to connect to.
|
||||
*/
|
||||
Dialogs * d_;
|
||||
/// Update connection.
|
||||
Connection u_;
|
||||
/// Hide connection.
|
||||
Connection h_;
|
||||
///
|
||||
InsetCitation * inset_;
|
||||
///
|
||||
bool dialogIsOpen;
|
||||
///
|
||||
string textAfter;
|
||||
///
|
||||
std::vector<string> citekeys;
|
||||
///
|
||||
std::vector<string> bibkeys;
|
||||
///
|
||||
std::vector<string> bibkeysInfo;
|
||||
//@}
|
||||
};
|
||||
|
||||
#endif
|
@ -23,6 +23,10 @@ libxforms_la_SOURCES = \
|
||||
FormPrint.h \
|
||||
form_print.C \
|
||||
form_print.h \
|
||||
FormCitation.C \
|
||||
FormCitation.h \
|
||||
form_citation.C \
|
||||
form_citation.h \
|
||||
input_validators.h \
|
||||
input_validators.c \
|
||||
xform_macros.h
|
||||
|
65
src/frontends/xforms/form_citation.C
Normal file
65
src/frontends/xforms/form_citation.C
Normal file
@ -0,0 +1,65 @@
|
||||
// File modified by fdfix.sh for use by lyx (with xforms >= 0.86) and gettext
|
||||
#include <config.h>
|
||||
#include "lyx_gui_misc.h"
|
||||
#include "gettext.h"
|
||||
|
||||
/* Form definition file generated with fdesign. */
|
||||
|
||||
#include FORMS_H_LOCATION
|
||||
#include <stdlib.h>
|
||||
#include "FormCitation.h"
|
||||
|
||||
FD_form_citation * FormCitation::build_citation()
|
||||
{
|
||||
FL_OBJECT *obj;
|
||||
FD_form_citation *fdui = new FD_form_citation;
|
||||
|
||||
fdui->form_citation = fl_bgn_form(FL_NO_BOX, 450, 780);
|
||||
fdui->form_citation->u_vdata = this;
|
||||
fdui->box = obj = fl_add_box(FL_UP_BOX, 0, 0, 450, 780, "");
|
||||
fl_set_object_resize(obj, FL_RESIZE_X);
|
||||
fdui->citeBrsr = obj = fl_add_browser(FL_HOLD_BROWSER, 20, 40, 170, 370, _("Inset keys"));
|
||||
fl_set_object_lalign(obj, FL_ALIGN_TOP_LEFT);
|
||||
fl_set_object_resize(obj, FL_RESIZE_X);
|
||||
fl_set_object_callback(obj, C_FormCitationInputCB, CITEBRSR);
|
||||
fdui->bibBrsr = obj = fl_add_browser(FL_HOLD_BROWSER, 250, 40, 170, 370, _("Bibliography keys"));
|
||||
fl_set_object_lalign(obj, FL_ALIGN_TOP_LEFT);
|
||||
fl_set_object_resize(obj, FL_RESIZE_X);
|
||||
fl_set_object_callback(obj, C_FormCitationInputCB, BIBBRSR);
|
||||
fdui->addBtn = obj = fl_add_button(FL_NORMAL_BUTTON, 200, 40, 40, 40, _("@4->"));
|
||||
fl_set_object_resize(obj, FL_RESIZE_NONE);
|
||||
fl_set_object_callback(obj, C_FormCitationInputCB, ADD);
|
||||
fdui->delBtn = obj = fl_add_button(FL_NORMAL_BUTTON, 200, 90, 40, 40, _("@9+"));
|
||||
fl_set_object_resize(obj, FL_RESIZE_NONE);
|
||||
fl_set_object_callback(obj, C_FormCitationInputCB, DELETE);
|
||||
fdui->upBtn = obj = fl_add_button(FL_NORMAL_BUTTON, 200, 140, 40, 40, _("@8->"));
|
||||
fl_set_object_resize(obj, FL_RESIZE_NONE);
|
||||
fl_set_object_callback(obj, C_FormCitationInputCB, UP);
|
||||
fdui->downBtn = obj = fl_add_button(FL_NORMAL_BUTTON, 200, 190, 40, 40, _("@2->"));
|
||||
fl_set_object_resize(obj, FL_RESIZE_NONE);
|
||||
fl_set_object_callback(obj, C_FormCitationInputCB, DOWN);
|
||||
fdui->infoBrsr = obj = fl_add_browser(FL_NORMAL_BROWSER, 20, 440, 400, 110, _("Info"));
|
||||
fl_set_object_lalign(obj, FL_ALIGN_TOP_LEFT);
|
||||
fl_set_object_resize(obj, FL_RESIZE_X);
|
||||
fdui->style = obj = fl_add_choice(FL_NORMAL_CHOICE, 160, 570, 130, 30, _("Citation style"));
|
||||
fl_set_object_boxtype(obj, FL_DOWN_BOX);
|
||||
fl_set_object_resize(obj, FL_RESIZE_X);
|
||||
fdui->textBefore = obj = fl_add_input(FL_NORMAL_INPUT, 100, 620, 250, 30, _("Text before"));
|
||||
fl_set_object_resize(obj, FL_RESIZE_X);
|
||||
fdui->textAftr = obj = fl_add_input(FL_NORMAL_INPUT, 100, 660, 250, 30, _("Text after"));
|
||||
fl_set_object_resize(obj, FL_RESIZE_X);
|
||||
fdui->ok = obj = fl_add_button(FL_RETURN_BUTTON, 190, 730, 110, 40, _("OK"));
|
||||
fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast);
|
||||
fl_set_object_callback(obj, C_FormCitationOKCB, 0);
|
||||
fdui->cancel = obj = fl_add_button(FL_NORMAL_BUTTON, 310, 730, 110, 40, _("Cancel"));
|
||||
fl_set_button_shortcut(obj, _("^["), 1);
|
||||
fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast);
|
||||
fl_set_object_callback(obj, C_FormCitationCancelCB, 0);
|
||||
fl_end_form();
|
||||
|
||||
fdui->form_citation->fdui = fdui;
|
||||
|
||||
return fdui;
|
||||
}
|
||||
/*---------------------------------------*/
|
||||
|
34
src/frontends/xforms/form_citation.h
Normal file
34
src/frontends/xforms/form_citation.h
Normal file
@ -0,0 +1,34 @@
|
||||
/** Header file generated with fdesign on Thu Jul 6 17:01:34 2000.**/
|
||||
|
||||
#ifndef FD_form_citation_h_
|
||||
#define FD_form_citation_h_
|
||||
|
||||
/** Callbacks, globals and object handlers **/
|
||||
extern "C" void C_FormCitationInputCB(FL_OBJECT *, long);
|
||||
extern "C" void C_FormCitationOKCB(FL_OBJECT *, long);
|
||||
extern "C" void C_FormCitationCancelCB(FL_OBJECT *, long);
|
||||
|
||||
|
||||
/**** Forms and Objects ****/
|
||||
typedef struct {
|
||||
FL_FORM *form_citation;
|
||||
void *vdata;
|
||||
char *cdata;
|
||||
long ldata;
|
||||
FL_OBJECT *box;
|
||||
FL_OBJECT *citeBrsr;
|
||||
FL_OBJECT *bibBrsr;
|
||||
FL_OBJECT *addBtn;
|
||||
FL_OBJECT *delBtn;
|
||||
FL_OBJECT *upBtn;
|
||||
FL_OBJECT *downBtn;
|
||||
FL_OBJECT *infoBrsr;
|
||||
FL_OBJECT *style;
|
||||
FL_OBJECT *textBefore;
|
||||
FL_OBJECT *textAftr;
|
||||
FL_OBJECT *ok;
|
||||
FL_OBJECT *cancel;
|
||||
} FD_form_citation;
|
||||
|
||||
|
||||
#endif /* FD_form_citation_h_ */
|
@ -1,4 +1,4 @@
|
||||
/** Header file generated with fdesign on Mon Jun 12 03:43:16 2000.**/
|
||||
/** Header file generated with fdesign on Thu Jul 6 17:01:34 2000.**/
|
||||
|
||||
#ifndef FD_form_copyright_h_
|
||||
#define FD_form_copyright_h_
|
||||
|
@ -1,4 +1,4 @@
|
||||
/** Header file generated with fdesign on Mon Jun 12 03:43:04 2000.**/
|
||||
/** Header file generated with fdesign on Thu Jul 6 17:01:34 2000.**/
|
||||
|
||||
#ifndef FD_form_bind_h_
|
||||
#define FD_form_bind_h_
|
||||
|
@ -1,4 +1,4 @@
|
||||
/** Header file generated with fdesign on Mon Jun 12 03:43:16 2000.**/
|
||||
/** Header file generated with fdesign on Thu Jul 6 17:01:34 2000.**/
|
||||
|
||||
#ifndef FD_form_print_h_
|
||||
#define FD_form_print_h_
|
||||
|
250
src/frontends/xforms/forms/form_citation.fd
Normal file
250
src/frontends/xforms/forms/form_citation.fd
Normal file
@ -0,0 +1,250 @@
|
||||
Magic: 13000
|
||||
|
||||
Internal Form Definition File
|
||||
(do not change)
|
||||
|
||||
Number of forms: 1
|
||||
Unit of measure: FL_COORD_PIXEL
|
||||
|
||||
=============== FORM ===============
|
||||
Name: form_citation
|
||||
Width: 450
|
||||
Height: 780
|
||||
Number of Objects: 13
|
||||
|
||||
--------------------
|
||||
class: FL_BOX
|
||||
type: UP_BOX
|
||||
box: 0 0 450 780
|
||||
boxtype: FL_UP_BOX
|
||||
colors: FL_COL1 FL_COL1
|
||||
alignment: FL_ALIGN_CENTER
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_DEFAULT_SIZE
|
||||
lcol: FL_BLACK
|
||||
label:
|
||||
shortcut:
|
||||
resize: FL_RESIZE_X
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: box
|
||||
callback:
|
||||
argument:
|
||||
|
||||
--------------------
|
||||
class: FL_BROWSER
|
||||
type: HOLD_BROWSER
|
||||
box: 20 40 170 370
|
||||
boxtype: FL_DOWN_BOX
|
||||
colors: FL_COL1 FL_YELLOW
|
||||
alignment: FL_ALIGN_TOP_LEFT
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_DEFAULT_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: Inset keys
|
||||
shortcut:
|
||||
resize: FL_RESIZE_X
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: citeBrsr
|
||||
callback: C_FormCitationInputCB
|
||||
argument: CITEBRSR
|
||||
|
||||
--------------------
|
||||
class: FL_BROWSER
|
||||
type: HOLD_BROWSER
|
||||
box: 250 40 170 370
|
||||
boxtype: FL_DOWN_BOX
|
||||
colors: FL_COL1 FL_YELLOW
|
||||
alignment: FL_ALIGN_TOP_LEFT
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_DEFAULT_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: Bibliography keys
|
||||
shortcut:
|
||||
resize: FL_RESIZE_X
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: bibBrsr
|
||||
callback: C_FormCitationInputCB
|
||||
argument: BIBBRSR
|
||||
|
||||
--------------------
|
||||
class: FL_BUTTON
|
||||
type: NORMAL_BUTTON
|
||||
box: 200 40 40 40
|
||||
boxtype: FL_UP_BOX
|
||||
colors: FL_COL1 FL_COL1
|
||||
alignment: FL_ALIGN_CENTER
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_DEFAULT_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: @4->
|
||||
shortcut:
|
||||
resize: FL_RESIZE_NONE
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: addBtn
|
||||
callback: C_FormCitationInputCB
|
||||
argument: ADD
|
||||
|
||||
--------------------
|
||||
class: FL_BUTTON
|
||||
type: NORMAL_BUTTON
|
||||
box: 200 90 40 40
|
||||
boxtype: FL_UP_BOX
|
||||
colors: FL_COL1 FL_COL1
|
||||
alignment: FL_ALIGN_CENTER
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_DEFAULT_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: @9+
|
||||
shortcut:
|
||||
resize: FL_RESIZE_NONE
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: delBtn
|
||||
callback: C_FormCitationInputCB
|
||||
argument: DELETE
|
||||
|
||||
--------------------
|
||||
class: FL_BUTTON
|
||||
type: NORMAL_BUTTON
|
||||
box: 200 140 40 40
|
||||
boxtype: FL_UP_BOX
|
||||
colors: FL_COL1 FL_COL1
|
||||
alignment: FL_ALIGN_CENTER
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_DEFAULT_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: @8->
|
||||
shortcut:
|
||||
resize: FL_RESIZE_NONE
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: upBtn
|
||||
callback: C_FormCitationInputCB
|
||||
argument: UP
|
||||
|
||||
--------------------
|
||||
class: FL_BUTTON
|
||||
type: NORMAL_BUTTON
|
||||
box: 200 190 40 40
|
||||
boxtype: FL_UP_BOX
|
||||
colors: FL_COL1 FL_COL1
|
||||
alignment: FL_ALIGN_CENTER
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_DEFAULT_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: @2->
|
||||
shortcut:
|
||||
resize: FL_RESIZE_NONE
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: downBtn
|
||||
callback: C_FormCitationInputCB
|
||||
argument: DOWN
|
||||
|
||||
--------------------
|
||||
class: FL_BROWSER
|
||||
type: NORMAL_BROWSER
|
||||
box: 20 440 400 110
|
||||
boxtype: FL_DOWN_BOX
|
||||
colors: FL_COL1 FL_YELLOW
|
||||
alignment: FL_ALIGN_TOP_LEFT
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_DEFAULT_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: Info
|
||||
shortcut:
|
||||
resize: FL_RESIZE_X
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: infoBrsr
|
||||
callback:
|
||||
argument:
|
||||
|
||||
--------------------
|
||||
class: FL_CHOICE
|
||||
type: NORMAL_CHOICE
|
||||
box: 160 570 130 30
|
||||
boxtype: FL_DOWN_BOX
|
||||
colors: FL_COL1 FL_BLACK
|
||||
alignment: FL_ALIGN_LEFT
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_DEFAULT_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: Citation style
|
||||
shortcut:
|
||||
resize: FL_RESIZE_X
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: style
|
||||
callback:
|
||||
argument:
|
||||
|
||||
--------------------
|
||||
class: FL_INPUT
|
||||
type: NORMAL_INPUT
|
||||
box: 100 620 250 30
|
||||
boxtype: FL_DOWN_BOX
|
||||
colors: FL_COL1 FL_MCOL
|
||||
alignment: FL_ALIGN_LEFT
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_DEFAULT_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: Text before
|
||||
shortcut:
|
||||
resize: FL_RESIZE_X
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: textBefore
|
||||
callback:
|
||||
argument:
|
||||
|
||||
--------------------
|
||||
class: FL_INPUT
|
||||
type: NORMAL_INPUT
|
||||
box: 100 660 250 30
|
||||
boxtype: FL_DOWN_BOX
|
||||
colors: FL_COL1 FL_MCOL
|
||||
alignment: FL_ALIGN_LEFT
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_DEFAULT_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: Text after
|
||||
shortcut:
|
||||
resize: FL_RESIZE_X
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: textAftr
|
||||
callback:
|
||||
argument:
|
||||
|
||||
--------------------
|
||||
class: FL_BUTTON
|
||||
type: RETURN_BUTTON
|
||||
box: 190 730 110 40
|
||||
boxtype: FL_UP_BOX
|
||||
colors: FL_COL1 FL_COL1
|
||||
alignment: FL_ALIGN_CENTER
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_DEFAULT_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: OK
|
||||
shortcut: ^M
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_SouthEast FL_SouthEast
|
||||
name: ok
|
||||
callback: C_FormCitationOKCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
class: FL_BUTTON
|
||||
type: NORMAL_BUTTON
|
||||
box: 310 730 110 40
|
||||
boxtype: FL_UP_BOX
|
||||
colors: FL_COL1 FL_COL1
|
||||
alignment: FL_ALIGN_CENTER
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_DEFAULT_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: Cancel
|
||||
shortcut: ^[
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_SouthEast FL_SouthEast
|
||||
name: cancel
|
||||
callback: C_FormCitationCancelCB
|
||||
argument: 0
|
||||
|
||||
==============================
|
||||
create_the_forms
|
@ -19,7 +19,8 @@ SHELL = /bin/sh
|
||||
# Various commands
|
||||
FDESIGN = fdesign
|
||||
|
||||
SRCS := form_copyright.fd \
|
||||
SRCS := form_citation.fd \
|
||||
form_copyright.fd \
|
||||
form_preferences.fd \
|
||||
form_print.fd
|
||||
|
||||
@ -78,4 +79,4 @@ distclean: clean
|
||||
rm -f *.orig *.rej *~
|
||||
|
||||
install: updatesrc
|
||||
cp *.C *.h ..
|
||||
cp *.C *.h ..
|
||||
|
@ -36,32 +36,12 @@ FD_bibitem_form * create_form_bibitem_form(void);
|
||||
|
||||
extern "C" void bibitem_cb(FL_OBJECT *, long data)
|
||||
{
|
||||
switch (data)
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
InsetBibKey::Holder * holder =
|
||||
static_cast<InsetBibKey::Holder*>
|
||||
(bibitem_form->bibitem_form->u_vdata);
|
||||
|
||||
if(!holder->view->buffer()->isReadonly())
|
||||
{
|
||||
InsetBibKey * inset = holder->inset;
|
||||
inset->setContents(fl_get_input(bibitem_form->key));
|
||||
inset->setOptions(fl_get_input(bibitem_form->label));
|
||||
fl_hide_form(bibitem_form->bibitem_form);
|
||||
// Does look like a hack? It is! (but will change at 0.13)
|
||||
holder->view->text->RedoParagraph(holder->view);
|
||||
holder->view->update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
|
||||
break;
|
||||
} // fall through to Cancel on RO-mode
|
||||
}
|
||||
case 0:
|
||||
fl_hide_form(bibitem_form->bibitem_form);
|
||||
break;
|
||||
}
|
||||
}
|
||||
InsetBibKey::Holder * holder =
|
||||
static_cast<InsetBibKey::Holder*>
|
||||
(bibitem_form->bibitem_form->u_vdata);
|
||||
|
||||
holder->inset->callback( bibitem_form, data );
|
||||
}
|
||||
|
||||
FD_bibitem_form * create_form_bibitem_form(void)
|
||||
{
|
||||
@ -115,6 +95,27 @@ InsetBibKey::~InsetBibKey()
|
||||
fl_hide_form(bibitem_form->bibitem_form);
|
||||
}
|
||||
|
||||
|
||||
void InsetBibKey::callback( FD_bibitem_form * form, long data )
|
||||
{
|
||||
switch (data)
|
||||
{
|
||||
case 1:
|
||||
if(!holder.view->buffer()->isReadonly())
|
||||
{
|
||||
setContents(fl_get_input(form->key));
|
||||
setOptions(fl_get_input(form->label));
|
||||
// shouldn't mark the buffer dirty unless
|
||||
// something was actually altered
|
||||
holder.view->updateInset( this, true );
|
||||
} // fall through to Cancel
|
||||
case 0:
|
||||
fl_hide_form(form->bibitem_form);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void InsetBibKey::setCounter(int c)
|
||||
{
|
||||
counter = c;
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include <vector>
|
||||
|
||||
class Buffer;
|
||||
struct FD_bibitem_form;
|
||||
|
||||
/** Used to insert bibitem's information (key and label)
|
||||
|
||||
@ -59,6 +60,8 @@ public:
|
||||
///
|
||||
int getCounter() const { return counter; }
|
||||
///
|
||||
void callback( FD_bibitem_form *, long );
|
||||
///
|
||||
struct Holder {
|
||||
InsetBibKey * inset;
|
||||
BufferView * view;
|
||||
@ -67,7 +70,6 @@ public:
|
||||
private:
|
||||
///
|
||||
int counter;
|
||||
|
||||
///
|
||||
Holder holder;
|
||||
};
|
||||
|
@ -1,494 +1,26 @@
|
||||
#include <config.h>
|
||||
// -*- C++ -*-
|
||||
/* This file is part of*
|
||||
* ======================================================
|
||||
*
|
||||
* LyX, The Document Processor
|
||||
*
|
||||
* Copyright 2000 The LyX Team.
|
||||
*
|
||||
* ====================================================== */
|
||||
|
||||
#include <fstream>
|
||||
#include <cstdlib>
|
||||
#include <algorithm>
|
||||
#include <config.h>
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation
|
||||
#endif
|
||||
|
||||
#include FORMS_H_LOCATION
|
||||
#include "insetcite.h"
|
||||
#include "buffer.h"
|
||||
#include "debug.h"
|
||||
#include "lyx_gui_misc.h"
|
||||
#include "BufferView.h"
|
||||
#include "gettext.h"
|
||||
#include "lyxtext.h"
|
||||
#include "support/filetools.h"
|
||||
|
||||
using std::getline;
|
||||
using std::vector;
|
||||
using std::pair;
|
||||
using std::max;
|
||||
using std::min;
|
||||
using std::find;
|
||||
|
||||
FD_citation_form * citation_form = 0;
|
||||
FD_citation_form * create_form_citation_form(void);
|
||||
void set_size_citation_form(FD_citation_form *, int, bool);
|
||||
|
||||
static vector<pair<string,string> > bibkeys_info;
|
||||
static vector<string> bibkeys;
|
||||
static vector<string> insetkeys;
|
||||
|
||||
extern "C" void citation_cb( FL_OBJECT *, long data )
|
||||
{
|
||||
InsetCitation::Holder * holder =
|
||||
static_cast<InsetCitation::Holder*>(citation_form->form->u_vdata);
|
||||
|
||||
holder->inset->callback( citation_form,
|
||||
static_cast<InsetCitation::State>(data) );
|
||||
}
|
||||
|
||||
|
||||
FD_citation_form *create_form_citation_form(void)
|
||||
{
|
||||
FL_OBJECT *obj;
|
||||
FD_citation_form *fdui = (FD_citation_form *) fl_calloc(1, sizeof(*fdui));
|
||||
|
||||
fdui->form = fl_bgn_form(FL_NO_BOX, 440, 790);
|
||||
fdui->box = obj = fl_add_box(FL_UP_BOX,0,0,440,790,"");
|
||||
fl_set_object_resize(obj, FL_RESIZE_X);
|
||||
|
||||
fdui->citeBrsr = obj =
|
||||
fl_add_browser(FL_HOLD_BROWSER,20,40,170,370,_("Inset keys"));
|
||||
fl_set_object_lalign(obj,FL_ALIGN_TOP_LEFT);
|
||||
fl_set_object_resize(obj, FL_RESIZE_X);
|
||||
fl_set_object_callback(obj,citation_cb,InsetCitation::CITEBRSR);
|
||||
|
||||
fdui->bibBrsr = obj =
|
||||
fl_add_browser(FL_HOLD_BROWSER,250,40,170,370,_("Bibliography keys"));
|
||||
fl_set_object_lalign(obj,FL_ALIGN_TOP_LEFT);
|
||||
fl_set_object_resize(obj, FL_RESIZE_X);
|
||||
fl_set_object_callback(obj,citation_cb,InsetCitation::BIBBRSR);
|
||||
|
||||
fdui->addBtn = obj =
|
||||
fl_add_button(FL_NORMAL_BUTTON,200,40,40,40,"@4->");
|
||||
fl_set_object_gravity(obj, FL_South, FL_South);
|
||||
fl_set_object_resize(obj, FL_RESIZE_NONE);
|
||||
fl_set_object_callback(obj,citation_cb,InsetCitation::ADD);
|
||||
|
||||
fdui->delBtn = obj =
|
||||
fl_add_button(FL_NORMAL_BUTTON,200,90,40,40,"@9+");
|
||||
fl_set_object_gravity(obj, FL_South, FL_South);
|
||||
fl_set_object_resize(obj, FL_RESIZE_NONE);
|
||||
fl_set_object_callback(obj,citation_cb,InsetCitation::DELETE);
|
||||
|
||||
fdui->upBtn = obj =
|
||||
fl_add_button(FL_NORMAL_BUTTON,200,140,40,40,"@8->");
|
||||
fl_set_object_gravity(obj, FL_South, FL_South);
|
||||
fl_set_object_resize(obj, FL_RESIZE_NONE);
|
||||
fl_set_object_callback(obj,citation_cb,InsetCitation::UP);
|
||||
|
||||
fdui->downBtn = obj =
|
||||
fl_add_button(FL_NORMAL_BUTTON,200,190,40,40,"@2->");
|
||||
fl_set_object_gravity(obj, FL_South, FL_South);
|
||||
fl_set_object_resize(obj, FL_RESIZE_NONE);
|
||||
fl_set_object_callback(obj,citation_cb,InsetCitation::DOWN);
|
||||
|
||||
fdui->infoBrsr = obj =
|
||||
fl_add_browser(FL_NORMAL_BROWSER,20,440,400,110,_("Info"));
|
||||
fl_set_object_lalign(obj,FL_ALIGN_TOP_LEFT);
|
||||
fl_set_object_resize(obj, FL_RESIZE_X);
|
||||
|
||||
/*
|
||||
fdui->style = obj =
|
||||
fl_add_choice(FL_NORMAL_CHOICE,160,570,130,30,_("Citation style"));
|
||||
fl_set_object_boxtype(obj,FL_DOWN_BOX);
|
||||
fl_set_object_resize(obj, FL_RESIZE_X);
|
||||
|
||||
fdui->textBefore = obj =
|
||||
fl_add_input(FL_NORMAL_INPUT,100,620,250,30,_("Text before"));
|
||||
fl_set_object_resize(obj, FL_RESIZE_X);
|
||||
*/
|
||||
|
||||
fdui->textAftr = obj =
|
||||
fl_add_input(FL_NORMAL_INPUT,100,660,250,30,_("Text after"));
|
||||
fl_set_object_gravity(obj, FL_SouthWest, FL_SouthEast);
|
||||
fl_set_object_resize(obj, FL_RESIZE_X);
|
||||
|
||||
fdui->ok = obj =
|
||||
fl_add_button(FL_RETURN_BUTTON,190,730,110,40,_("OK"));
|
||||
fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast);
|
||||
fl_set_object_callback(obj,citation_cb,InsetCitation::OK);
|
||||
|
||||
fdui->cancel = obj =
|
||||
fl_add_button(FL_NORMAL_BUTTON,310,730,110,40,idex(_("Cancel|^[")));
|
||||
fl_set_button_shortcut(obj, scex(_("Cancel|^[")), 1);
|
||||
fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast);
|
||||
fl_set_object_callback(obj,citation_cb,InsetCitation::CANCEL);
|
||||
|
||||
fl_end_form();
|
||||
|
||||
return fdui;
|
||||
}
|
||||
|
||||
|
||||
InsetCitation::InsetCitation(string const & key, string const & note)
|
||||
: InsetCommand("cite", key, note)
|
||||
: InsetCommand("cite", key, note)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
InsetCitation::~InsetCitation()
|
||||
{
|
||||
if(citation_form && citation_form->form
|
||||
&& citation_form->form->visible
|
||||
&& citation_form->form->u_vdata == &holder)
|
||||
fl_hide_form(citation_form->form);
|
||||
}
|
||||
|
||||
|
||||
void InsetCitation::Edit( BufferView * bv, int, int, unsigned int )
|
||||
{
|
||||
if ( !citation_form ) {
|
||||
citation_form = create_form_citation_form();
|
||||
fl_set_form_atclose( citation_form->form,
|
||||
CancelCloseBoxCB, 0 );
|
||||
}
|
||||
|
||||
holder.inset = this;
|
||||
holder.view = bv;
|
||||
|
||||
citation_form->form->u_vdata = &holder;
|
||||
|
||||
// update the browsers, noting the number of keys.
|
||||
bibkeys_info = bv->buffer()->getBibkeyList();
|
||||
bibkeys.clear();
|
||||
insetkeys.clear();
|
||||
for( unsigned int i = 0; i < bibkeys_info.size(); ++i )
|
||||
bibkeys.push_back(bibkeys_info[i].first);
|
||||
|
||||
string tmp;
|
||||
string keys = getContents();
|
||||
keys = frontStrip( split(keys, tmp, ',') );
|
||||
while( !tmp.empty() ) {
|
||||
insetkeys.push_back( tmp );
|
||||
keys = frontStrip( split(keys, tmp, ',') );
|
||||
}
|
||||
|
||||
updateBrowser( citation_form->bibBrsr, bibkeys );
|
||||
updateBrowser( citation_form->citeBrsr, insetkeys );
|
||||
fl_clear_browser( citation_form->infoBrsr );
|
||||
|
||||
// No keys have been selected yet, so...
|
||||
setBibButtons( citation_form, OFF );
|
||||
setCiteButtons( citation_form, OFF );
|
||||
|
||||
int noKeys = max( bibkeys.size(), insetkeys.size() );
|
||||
|
||||
// Place bounds, so that 4 <= noKeys <= 15
|
||||
noKeys = max( 4, min(15, noKeys) );
|
||||
|
||||
// Re-size the form to accommodate the new browser size
|
||||
int size = 20 * noKeys;
|
||||
bool bibPresent = ( bibkeys.size() > 0 );
|
||||
setSize(citation_form, size, bibPresent);
|
||||
|
||||
fl_set_input( citation_form->textAftr, getOptions().c_str() );
|
||||
if( holder.view->buffer()->isReadonly() )
|
||||
fl_deactivate_object( citation_form->textAftr );
|
||||
|
||||
if( citation_form->form->visible ) {
|
||||
fl_raise_form( citation_form->form );
|
||||
} else {
|
||||
fl_show_form(citation_form->form,
|
||||
FL_PLACE_MOUSE | FL_FREE_SIZE,
|
||||
FL_FULLBORDER,
|
||||
_("Citation") );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void InsetCitation::updateBrowser( FL_OBJECT * browser,
|
||||
vector<string> const & inkeys ) const
|
||||
{
|
||||
fl_clear_browser( browser );
|
||||
|
||||
fl_freeze_form( browser->form );
|
||||
for( unsigned int i = 0; i < inkeys.size(); ++i )
|
||||
fl_add_browser_line( browser, inkeys[i].c_str() );
|
||||
fl_unfreeze_form( browser->form );
|
||||
}
|
||||
|
||||
void InsetCitation::callback( FD_citation_form * form, State cb )
|
||||
{
|
||||
switch( cb ) {
|
||||
case BIBBRSR: {
|
||||
fl_deselect_browser( form->citeBrsr );
|
||||
|
||||
unsigned int sel = fl_get_browser( form->bibBrsr );
|
||||
if( sel < 1 || sel > bibkeys.size() ) break;
|
||||
|
||||
// Put into infoBrsr the additional info associated with
|
||||
// the selected bibBrsr key
|
||||
fl_clear_browser( form->infoBrsr );
|
||||
fl_add_browser_line( form->infoBrsr,
|
||||
bibkeys_info[sel-1].second.c_str() );
|
||||
|
||||
// Highlight the selected bibBrsr key in citeBrsr if present
|
||||
vector<string>::iterator it =
|
||||
find( insetkeys.begin(), insetkeys.end(), bibkeys[sel-1] );
|
||||
|
||||
if( it != insetkeys.end() ) {
|
||||
int n = it - insetkeys.begin();
|
||||
fl_select_browser_line( form->citeBrsr, n+1 );
|
||||
fl_set_browser_topline( form->citeBrsr, n+1 );
|
||||
}
|
||||
|
||||
if( !holder.view->buffer()->isReadonly() ) {
|
||||
if( it != insetkeys.end() ) {
|
||||
setBibButtons( form, OFF );
|
||||
setCiteButtons( form, ON );
|
||||
} else {
|
||||
setBibButtons( form, ON );
|
||||
setCiteButtons( form, OFF );
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
} case CITEBRSR: {
|
||||
unsigned int sel = fl_get_browser( form->citeBrsr );
|
||||
if( sel < 1 || sel > insetkeys.size() ) break;
|
||||
|
||||
if( !holder.view->buffer()->isReadonly() ) {
|
||||
setBibButtons( form, OFF );
|
||||
setCiteButtons( form, ON );
|
||||
}
|
||||
|
||||
// Highlight the selected citeBrsr key in bibBrsr
|
||||
vector<string>::iterator it =
|
||||
find( bibkeys.begin(), bibkeys.end(), insetkeys[sel-1] );
|
||||
|
||||
if (it != bibkeys.end()) {
|
||||
int n = it - bibkeys.begin();
|
||||
fl_select_browser_line( form->bibBrsr, n+1 );
|
||||
fl_set_browser_topline( form->bibBrsr, n+1 );
|
||||
|
||||
// Put into infoBrsr the additional info associated with
|
||||
// the selected citeBrsr key
|
||||
fl_clear_browser( form->infoBrsr );
|
||||
fl_add_browser_line( form->infoBrsr,
|
||||
bibkeys_info[n].second.c_str() );
|
||||
}
|
||||
break;
|
||||
|
||||
} case ADD: {
|
||||
if( holder.view->buffer()->isReadonly() ) break;
|
||||
|
||||
unsigned int sel = fl_get_browser( form->bibBrsr );
|
||||
if( sel < 1 || sel > bibkeys.size() ) break;
|
||||
|
||||
// Add the selected bibBrsr key to citeBrsr
|
||||
fl_addto_browser( form->citeBrsr,
|
||||
bibkeys[sel-1].c_str() );
|
||||
insetkeys.push_back( bibkeys[sel-1] );
|
||||
|
||||
int n = insetkeys.size();
|
||||
fl_select_browser_line( form->citeBrsr, n );
|
||||
|
||||
setBibButtons( form, OFF );
|
||||
setCiteButtons( form, ON );
|
||||
|
||||
break;
|
||||
|
||||
} case DELETE: {
|
||||
if( holder.view->buffer()->isReadonly() ) break;
|
||||
|
||||
unsigned int sel = fl_get_browser( form->citeBrsr );
|
||||
if( sel < 1 || sel > insetkeys.size() ) break;
|
||||
|
||||
// Remove the selected key from citeBrsr
|
||||
fl_delete_browser_line( form->citeBrsr, sel ) ;
|
||||
insetkeys.erase( insetkeys.begin() + sel-1 );
|
||||
|
||||
setBibButtons( form, ON );
|
||||
setCiteButtons( form, OFF );
|
||||
break;
|
||||
|
||||
} case UP: {
|
||||
if( holder.view->buffer()->isReadonly() ) break;
|
||||
|
||||
unsigned int sel = fl_get_browser( form->citeBrsr );
|
||||
if( sel < 2 || sel > insetkeys.size() ) break;
|
||||
|
||||
// Move the selected key up one line
|
||||
vector<string>::iterator it = insetkeys.begin() + sel-1;
|
||||
string tmp = *it;
|
||||
|
||||
fl_delete_browser_line( form->citeBrsr, sel );
|
||||
insetkeys.erase( it );
|
||||
|
||||
fl_insert_browser_line( form->citeBrsr, sel-1, tmp.c_str() );
|
||||
fl_select_browser_line( form->citeBrsr, sel-1 );
|
||||
insetkeys.insert( it-1, tmp );
|
||||
setCiteButtons( form, ON );
|
||||
|
||||
break;
|
||||
|
||||
} case DOWN: {
|
||||
if( holder.view->buffer()->isReadonly() ) break;
|
||||
|
||||
unsigned int sel = fl_get_browser( form->citeBrsr );
|
||||
if( sel < 1 || sel > insetkeys.size()-1 ) break;
|
||||
|
||||
// Move the selected key down one line
|
||||
vector<string>::iterator it = insetkeys.begin() + sel-1;
|
||||
string tmp = *it;
|
||||
|
||||
fl_delete_browser_line( form->citeBrsr, sel );
|
||||
insetkeys.erase( it );
|
||||
|
||||
fl_insert_browser_line( form->citeBrsr, sel+1, tmp.c_str() );
|
||||
fl_select_browser_line( form->citeBrsr, sel+1 );
|
||||
insetkeys.insert( it+1, tmp );
|
||||
setCiteButtons( form, ON );
|
||||
|
||||
break;
|
||||
|
||||
} case OK: {
|
||||
// The inset contains a comma separated list of the keys
|
||||
// in citeBrsr
|
||||
if( !holder.view->buffer()->isReadonly() )
|
||||
{
|
||||
string tmp;
|
||||
for( unsigned int i = 0; i < insetkeys.size(); ++i ) {
|
||||
if (i > 0)
|
||||
tmp += ", ";
|
||||
tmp += insetkeys[i];
|
||||
}
|
||||
setContents( tmp );
|
||||
setOptions( fl_get_input(form->textAftr) );
|
||||
// shouldn't mark the buffer dirty unless something
|
||||
// was actually altered
|
||||
holder.view->updateInset( this, true );
|
||||
}
|
||||
// fall through to Cancel
|
||||
|
||||
} case CANCEL: {
|
||||
fl_hide_form( form->form );
|
||||
break;
|
||||
|
||||
} default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void InsetCitation::setSize( FD_citation_form * form,
|
||||
int brsrHeight, bool bibPresent ) const
|
||||
{
|
||||
int const infoHeight = 110;
|
||||
int const otherHeight = 140;
|
||||
brsrHeight = max( brsrHeight, 175 );
|
||||
int formHeight = brsrHeight + otherHeight;
|
||||
|
||||
if( bibPresent ) formHeight += infoHeight + 30;
|
||||
fl_set_form_size( form->form, 430, formHeight );
|
||||
|
||||
// No resizing is alowed in the y-direction
|
||||
fl_set_form_minsize( form->form, 430, formHeight );
|
||||
fl_set_form_maxsize( form->form, 1000, formHeight );
|
||||
|
||||
int ypos = 0;
|
||||
fl_set_object_geometry( form->box, 0, ypos, 430, formHeight );
|
||||
ypos += 30;
|
||||
fl_set_object_geometry( form->citeBrsr, 10, ypos, 180, brsrHeight );
|
||||
fl_set_object_geometry( form->bibBrsr, 240, ypos, 180, brsrHeight );
|
||||
fl_set_object_geometry( form->addBtn, 200, ypos, 30, 30 );
|
||||
ypos += 35;
|
||||
fl_set_object_geometry( form->delBtn, 200, ypos, 30, 30 );
|
||||
ypos += 35;
|
||||
fl_set_object_geometry( form->upBtn, 200, ypos, 30, 30 );
|
||||
ypos += 35;
|
||||
fl_set_object_geometry( form->downBtn, 200, ypos, 30, 30 );
|
||||
|
||||
ypos = brsrHeight+30; // base of Citation/Bibliography browsers
|
||||
|
||||
if( bibPresent ) {
|
||||
ypos += 30;
|
||||
fl_set_object_geometry( form->infoBrsr, 10, ypos, 410, infoHeight );
|
||||
fl_show_object( form->infoBrsr );
|
||||
ypos += infoHeight;
|
||||
}
|
||||
else
|
||||
fl_hide_object( form->infoBrsr );
|
||||
|
||||
ypos += 20;
|
||||
fl_set_object_geometry( form->textAftr, 100, ypos, 250, 30 );
|
||||
fl_set_object_geometry( form->ok, 230, ypos+50, 90, 30 );
|
||||
fl_set_object_geometry( form->cancel, 330, ypos+50, 90, 30 );
|
||||
}
|
||||
|
||||
|
||||
void InsetCitation::setBibButtons( FD_citation_form * form, State status ) const
|
||||
{
|
||||
switch (status) {
|
||||
case ON:
|
||||
{
|
||||
fl_activate_object( form->addBtn );
|
||||
fl_set_object_lcol( form->addBtn, FL_BLACK );
|
||||
|
||||
break;
|
||||
}
|
||||
case OFF:
|
||||
{
|
||||
fl_deactivate_object( form->addBtn );
|
||||
fl_set_object_lcol( form->addBtn, FL_INACTIVE );
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void InsetCitation::setCiteButtons( FD_citation_form * form, State status ) const
|
||||
{
|
||||
switch( status ) {
|
||||
case ON:
|
||||
{
|
||||
fl_activate_object( form->delBtn );
|
||||
fl_set_object_lcol( form->delBtn, FL_BLACK );
|
||||
|
||||
int sel = fl_get_browser( form->citeBrsr );
|
||||
|
||||
if( sel != 1 ) {
|
||||
fl_activate_object( form->upBtn );
|
||||
fl_set_object_lcol( form->upBtn, FL_BLACK );
|
||||
} else {
|
||||
fl_deactivate_object( form->upBtn );
|
||||
fl_set_object_lcol( form->upBtn, FL_INACTIVE );
|
||||
}
|
||||
|
||||
if( sel != fl_get_browser_maxline(form->citeBrsr)) {
|
||||
fl_activate_object( form->downBtn );
|
||||
fl_set_object_lcol( form->downBtn, FL_BLACK );
|
||||
} else {
|
||||
fl_deactivate_object( form->downBtn );
|
||||
fl_set_object_lcol( form->downBtn, FL_INACTIVE );
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case OFF:
|
||||
{
|
||||
fl_deactivate_object( form->delBtn );
|
||||
fl_set_object_lcol( form->delBtn, FL_INACTIVE );
|
||||
|
||||
fl_deactivate_object( form->upBtn );
|
||||
fl_set_object_lcol( form->upBtn, FL_INACTIVE );
|
||||
|
||||
fl_deactivate_object( form->downBtn );
|
||||
fl_set_object_lcol( form->downBtn, FL_INACTIVE );
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
string InsetCitation::getScreenLabel() const
|
||||
{
|
||||
string temp("[");
|
||||
|
@ -4,8 +4,7 @@
|
||||
*
|
||||
* LyX, The Document Processor
|
||||
*
|
||||
* Copyright 1995 Matthias Ettrich
|
||||
* Copyright 1995-2000 The LyX Team.
|
||||
* Copyright 2000 The LyX Team.
|
||||
*
|
||||
* ====================================================== */
|
||||
|
||||
@ -17,66 +16,27 @@
|
||||
#endif
|
||||
|
||||
#include "insetcommand.h"
|
||||
#include "bibforms.h"
|
||||
#include <vector>
|
||||
|
||||
class Buffer;
|
||||
|
||||
/** Used to insert citations
|
||||
*/
|
||||
class InsetCitation: public InsetCommand {
|
||||
public:
|
||||
///
|
||||
enum State {
|
||||
CANCEL,
|
||||
OK,
|
||||
DOWN,
|
||||
UP,
|
||||
DELETE,
|
||||
ADD,
|
||||
BIBBRSR,
|
||||
CITEBRSR,
|
||||
ON,
|
||||
OFF
|
||||
};
|
||||
///
|
||||
InsetCitation() : InsetCommand("cite") {}
|
||||
///
|
||||
explicit
|
||||
InsetCitation(string const & key, string const & note = string());
|
||||
///
|
||||
~InsetCitation();
|
||||
///
|
||||
Inset * Clone() const {
|
||||
///
|
||||
Inset * Clone() const {
|
||||
return new InsetCitation(getContents(), getOptions());
|
||||
}
|
||||
///
|
||||
string getScreenLabel()const;
|
||||
///
|
||||
void Edit(BufferView *, int x, int y, unsigned int button);
|
||||
///
|
||||
void callback( FD_citation_form *, State );
|
||||
///
|
||||
EDITABLE Editable() const {
|
||||
return IS_EDITABLE;
|
||||
}
|
||||
string getScreenLabel() const;
|
||||
///
|
||||
struct Holder {
|
||||
InsetCitation * inset;
|
||||
BufferView * view;
|
||||
};
|
||||
|
||||
Code LyxCode() const { return CITATION_CODE; }
|
||||
///
|
||||
EDITABLE Editable() const { return IS_EDITABLE; }
|
||||
private:
|
||||
///
|
||||
void setSize( FD_citation_form *, int, bool ) const;
|
||||
///
|
||||
void setBibButtons( FD_citation_form *, State ) const;
|
||||
///
|
||||
void setCiteButtons( FD_citation_form *, State ) const;
|
||||
///
|
||||
void updateBrowser( FL_OBJECT *, std::vector<string> const & ) const;
|
||||
///
|
||||
Holder holder;
|
||||
InsetCitation() : InsetCommand("cite") {}
|
||||
};
|
||||
|
||||
#endif // INSET_CITE_H
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "support/LOstream.h"
|
||||
#include "support/lstrings.h"
|
||||
#include "debug.h"
|
||||
#include "lyxtext.h"
|
||||
|
||||
class LyXText;
|
||||
|
||||
@ -310,14 +311,20 @@ int InsetCollapsable::getMaxTextWidth(Painter & pain,
|
||||
#endif
|
||||
|
||||
void InsetCollapsable::update(BufferView * bv, LyXFont const & font,
|
||||
bool dodraw)
|
||||
bool reinit)
|
||||
{
|
||||
if (reinit) {
|
||||
need_update = FULL;
|
||||
if (owner())
|
||||
owner()->update(bv, font, true);
|
||||
return;
|
||||
}
|
||||
if (!widthCollapsed) {
|
||||
widthCollapsed = width_collapsed(bv->painter(), font);
|
||||
inset->deleteLyXText(bv);
|
||||
need_update = FULL;
|
||||
if (owner()) {
|
||||
owner()->update(bv, font, dodraw);
|
||||
owner()->update(bv, font);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -326,11 +333,11 @@ void InsetCollapsable::update(BufferView * bv, LyXFont const & font,
|
||||
inset->deleteLyXText(bv);
|
||||
need_update = FULL;
|
||||
if (owner()) {
|
||||
owner()->update(bv, font, dodraw);
|
||||
owner()->update(bv, font);
|
||||
return;
|
||||
}
|
||||
}
|
||||
inset->update(bv, font, dodraw);
|
||||
inset->update(bv, font);
|
||||
}
|
||||
|
||||
UpdatableInset::RESULT
|
||||
|
@ -15,30 +15,17 @@
|
||||
#include "LString.h"
|
||||
#include "lyx_gui_misc.h" // WarnReadonly
|
||||
|
||||
extern BufferView * current_view;
|
||||
|
||||
FD_index_form * index_form = 0;
|
||||
|
||||
extern "C" void index_cb(FL_OBJECT *, long data)
|
||||
{
|
||||
InsetIndex * inset = static_cast<InsetIndex*>(index_form->index_form->u_vdata);
|
||||
|
||||
switch (data) {
|
||||
case 1: // OK
|
||||
if(!current_view->buffer()->isReadonly()) {
|
||||
string tmp = fl_get_input(index_form->key);
|
||||
if(tmp != inset->getContents()) {
|
||||
inset->setContents(tmp);
|
||||
fl_hide_form(index_form->index_form);
|
||||
current_view->updateInset(inset, true);
|
||||
break;
|
||||
}
|
||||
} // fall through to Cancel on RO
|
||||
case 0: // Cancel
|
||||
fl_hide_form(index_form->index_form); break;
|
||||
}
|
||||
}
|
||||
InsetIndex::Holder * holder =
|
||||
static_cast<InsetIndex::Holder*>
|
||||
(index_form->index_form->u_vdata);
|
||||
|
||||
holder->inset->callback( index_form, data );
|
||||
}
|
||||
|
||||
|
||||
static
|
||||
FD_index_form * create_form_index_form()
|
||||
@ -80,11 +67,32 @@ InsetIndex::~InsetIndex()
|
||||
{
|
||||
if(index_form && index_form->index_form
|
||||
&& index_form->index_form->visible
|
||||
&& index_form->index_form->u_vdata == this)
|
||||
&& index_form->index_form->u_vdata == &holder)
|
||||
fl_hide_form(index_form->index_form);
|
||||
}
|
||||
|
||||
|
||||
void InsetIndex::callback( FD_index_form * form, long data )
|
||||
{
|
||||
switch (data)
|
||||
{
|
||||
case 1: // OK
|
||||
if(!holder.view->buffer()->isReadonly())
|
||||
{
|
||||
string tmp = fl_get_input(form->key);
|
||||
if(tmp != getContents())
|
||||
{
|
||||
setContents(tmp);
|
||||
holder.view->updateInset( this, true );
|
||||
}
|
||||
} // fall through to Cancel
|
||||
case 0:
|
||||
fl_hide_form(form->index_form);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void InsetIndex::Edit(BufferView * bv, int, int, unsigned int)
|
||||
{
|
||||
if(bv->buffer()->isReadonly())
|
||||
@ -95,7 +103,10 @@ void InsetIndex::Edit(BufferView * bv, int, int, unsigned int)
|
||||
fl_set_form_atclose(index_form->index_form, CancelCloseBoxCB, 0);
|
||||
}
|
||||
|
||||
index_form->index_form->u_vdata = this;
|
||||
holder.inset = this;
|
||||
holder.view = bv;
|
||||
|
||||
index_form->index_form->u_vdata = &holder;
|
||||
fl_set_input(index_form->key, getContents().c_str());
|
||||
if (index_form->index_form->visible) {
|
||||
fl_raise_form(index_form->index_form);
|
||||
|
@ -20,6 +20,7 @@
|
||||
|
||||
class Buffer;
|
||||
struct LaTeXFeatures;
|
||||
struct FD_index_form;
|
||||
|
||||
// Created by Lgb 970227
|
||||
|
||||
@ -46,6 +47,16 @@ public:
|
||||
}
|
||||
///
|
||||
string getScreenLabel() const;
|
||||
///
|
||||
void callback( FD_index_form *, long );
|
||||
///
|
||||
struct Holder {
|
||||
InsetIndex * inset;
|
||||
BufferView * view;
|
||||
};
|
||||
private:
|
||||
///
|
||||
Holder holder;
|
||||
};
|
||||
|
||||
|
||||
|
@ -292,15 +292,22 @@ void InsetTabular::DrawCellSelection(Painter & pain, int x, int baseline,
|
||||
}
|
||||
|
||||
|
||||
void InsetTabular::update(BufferView * bv, LyXFont const & font, bool dodraw)
|
||||
void InsetTabular::update(BufferView * bv, LyXFont const & font, bool reinit)
|
||||
{
|
||||
if (reinit) {
|
||||
need_update = INIT;
|
||||
calculate_dimensions_of_cells(bv, font, true);
|
||||
if (owner())
|
||||
owner()->update(bv, font, true);
|
||||
return;
|
||||
}
|
||||
if (the_locking_inset)
|
||||
the_locking_inset->update(bv, font, dodraw);
|
||||
the_locking_inset->update(bv, font, reinit);
|
||||
switch(need_update) {
|
||||
case INIT:
|
||||
case FULL:
|
||||
case CELL:
|
||||
if (calculate_dimensions_of_cells(bv, font, dodraw))
|
||||
if (calculate_dimensions_of_cells(bv, font, false))
|
||||
need_update = INIT;
|
||||
break;
|
||||
case SELECTION:
|
||||
@ -771,7 +778,7 @@ void InsetTabular::Validate(LaTeXFeatures & features) const
|
||||
|
||||
bool InsetTabular::calculate_dimensions_of_cells(BufferView * bv,
|
||||
LyXFont const & font,
|
||||
bool dodraw) const
|
||||
bool reinit) const
|
||||
{
|
||||
int cell = -1;
|
||||
int maxAsc, maxDesc;
|
||||
@ -785,7 +792,8 @@ bool InsetTabular::calculate_dimensions_of_cells(BufferView * bv,
|
||||
continue;
|
||||
++cell;
|
||||
inset = tabular->GetCellInset(cell);
|
||||
inset->update(bv, font, dodraw);
|
||||
if (!reinit)
|
||||
inset->update(bv, font, false);
|
||||
maxAsc = max(maxAsc, inset->ascent(bv, font));
|
||||
maxDesc = max(maxDesc, inset->descent(bv, font));
|
||||
changed = tabular->SetWidthOfCell(cell, inset->width(bv, font)) || changed;
|
||||
|
@ -261,10 +261,11 @@ void InsetText::draw(BufferView * bv, LyXFont const & f,
|
||||
|
||||
if (top_x != int(x)) {
|
||||
need_update = INIT;
|
||||
top_x = int(x);
|
||||
owner()->update(bv, f, true);
|
||||
}
|
||||
|
||||
top_baseline = baseline;
|
||||
top_x = int(x);
|
||||
top_y = baseline - ascent(bv, f);
|
||||
last_width = width(bv, f);
|
||||
last_height = ascent(bv, f) + descent(bv, f);
|
||||
@ -311,13 +312,22 @@ void InsetText::draw(BufferView * bv, LyXFont const & f,
|
||||
}
|
||||
|
||||
|
||||
void InsetText::update(BufferView * bv, LyXFont const & font, bool dodraw)
|
||||
void InsetText::update(BufferView * bv, LyXFont const & font, bool reinit)
|
||||
{
|
||||
if (reinit) { // && (need_update != CURSOR)) {
|
||||
need_update = INIT;
|
||||
deleteLyXText(bv);
|
||||
if (owner())
|
||||
owner()->update(bv, font, true);
|
||||
return;
|
||||
}
|
||||
if (the_locking_inset)
|
||||
the_locking_inset->update(bv, font, dodraw);
|
||||
the_locking_inset->update(bv, font, reinit);
|
||||
if (need_update == INIT) {
|
||||
deleteLyXText(bv);
|
||||
need_update = FULL;
|
||||
// if (!owner() && bv->text)
|
||||
// bv->text->UpdateInset(bv, this);
|
||||
}
|
||||
int oldw = insetWidth;
|
||||
#if 1
|
||||
@ -331,31 +341,26 @@ void InsetText::update(BufferView * bv, LyXFont const & font, bool dodraw)
|
||||
insetWidth = static_cast<int>(TEXT(bv)->width);
|
||||
#endif
|
||||
if (oldw != insetWidth) {
|
||||
printf("TW(%p): %d-%d-%d-%d\n",this,insetWidth, oldw,
|
||||
textWidth(bv->painter()),static_cast<int>(TEXT(bv)->width));
|
||||
// printf("TW(%p): %d-%d-%d-%d\n",this,insetWidth, oldw,
|
||||
// textWidth(bv->painter()),static_cast<int>(TEXT(bv)->width));
|
||||
deleteLyXText(bv);
|
||||
need_update = FULL;
|
||||
#if 0
|
||||
if (owner()) {
|
||||
owner()->update(bv, font, dodraw);
|
||||
owner()->update(bv, font, reinit);
|
||||
return;
|
||||
} else {
|
||||
update(bv, font, dodraw);
|
||||
update(bv, font, reinit);
|
||||
}
|
||||
#else
|
||||
#if 1
|
||||
update(bv, font, dodraw);
|
||||
update(bv, font, reinit);
|
||||
#else
|
||||
UpdateLocal(bv, INIT, false);
|
||||
#endif
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
if (dodraw && (need_update != CURSOR))
|
||||
need_update = FULL;
|
||||
|
||||
TEXT(bv)->FullRebreak(bv);
|
||||
|
||||
if ((need_update==CURSOR_PAR) && (TEXT(bv)->status==LyXText::UNCHANGED) &&
|
||||
the_locking_inset)
|
||||
{
|
||||
@ -376,10 +381,12 @@ void InsetText::update(BufferView * bv, LyXFont const & font, bool dodraw)
|
||||
void InsetText::UpdateLocal(BufferView * bv, UpdateCodes what, bool mark_dirty)
|
||||
{
|
||||
TEXT(bv)->FullRebreak(bv);
|
||||
if (TEXT(bv)->status == LyXText::NEED_MORE_REFRESH)
|
||||
need_update = FULL;
|
||||
else if (!the_locking_inset || (what != CURSOR))
|
||||
need_update = what;
|
||||
if (need_update != INIT) {
|
||||
if (TEXT(bv)->status == LyXText::NEED_MORE_REFRESH)
|
||||
need_update = FULL;
|
||||
else if (!the_locking_inset || (what != CURSOR))
|
||||
need_update = what;
|
||||
}
|
||||
if ((need_update != CURSOR) || (TEXT(bv)->status != LyXText::UNCHANGED))
|
||||
bv->updateInset(this, mark_dirty);
|
||||
if (old_par != cpar(bv)) {
|
||||
@ -409,7 +416,8 @@ void InsetText::Edit(BufferView * bv, int x, int y, unsigned int button)
|
||||
inset_pos = inset_x = inset_y = 0;
|
||||
inset_par = 0;
|
||||
if (!checkAndActivateInset(bv, x, y, button))
|
||||
TEXT(bv)->SetCursorFromCoordinates(bv, x-drawTextXOffset, y);
|
||||
TEXT(bv)->SetCursorFromCoordinates(bv, x-drawTextXOffset,
|
||||
y+TEXT(bv)->first+insetAscent);
|
||||
TEXT(bv)->sel_cursor = TEXT(bv)->cursor;
|
||||
bv->text->FinishUndo();
|
||||
UpdateLocal(bv, FULL, false);
|
||||
@ -524,8 +532,9 @@ void InsetText::InsetButtonPress(BufferView * bv, int x, int y, int button)
|
||||
inset_y = cy(bv) + drawTextYOffset;
|
||||
inset->InsetButtonPress(bv, x - inset_x, y - inset_y, button);
|
||||
inset->Edit(bv, x - inset_x, y - inset_y, button);
|
||||
if (the_locking_inset)
|
||||
if (the_locking_inset) {
|
||||
UpdateLocal(bv, CURSOR_PAR, false);
|
||||
}
|
||||
return;
|
||||
}
|
||||
// otherwise only unlock the_locking_inset
|
||||
@ -541,8 +550,9 @@ void InsetText::InsetButtonPress(BufferView * bv, int x, int y, int button)
|
||||
inset_par = cpar(bv);
|
||||
uinset->InsetButtonPress(bv, x - inset_x, y - inset_y, button);
|
||||
uinset->Edit(bv, x - inset_x, y - inset_y, 0);
|
||||
if (the_locking_inset)
|
||||
if (the_locking_inset) {
|
||||
UpdateLocal(bv, CURSOR_PAR, false);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -569,6 +579,7 @@ void InsetText::InsetButtonRelease(BufferView * bv, int x, int y, int button)
|
||||
inset->InsetButtonRelease(bv, x - inset_x, y - inset_y,button);
|
||||
inset->Edit(bv, x - inset_x, y - inset_y, button);
|
||||
}
|
||||
UpdateLocal(bv, CURSOR_PAR, false);
|
||||
}
|
||||
}
|
||||
no_selection = false;
|
||||
@ -1039,7 +1050,7 @@ bool InsetText::InsertInset(BufferView * bv, Inset * inset)
|
||||
UpdatableInset * i = static_cast<UpdatableInset *>(inset);
|
||||
i->setOwner(static_cast<UpdatableInset *>(this));
|
||||
}
|
||||
cpar(bv)->InsertInset(cpos(bv), inset);
|
||||
TEXT(bv)->InsertInset(bv, inset);
|
||||
TEXT(bv)->selection = 0;
|
||||
UpdateLocal(bv, CURSOR_PAR, true);
|
||||
static_cast<UpdatableInset*>(inset)->Edit(bv, 0, 0, 0);
|
||||
|
@ -102,6 +102,8 @@ public:
|
||||
///
|
||||
EXTERNAL_CODE,
|
||||
///
|
||||
CITATION_CODE,
|
||||
///
|
||||
THEOREM_CODE
|
||||
};
|
||||
|
||||
|
@ -61,7 +61,6 @@ extern FD_delim * fd_delim;
|
||||
extern FD_deco * fd_deco;
|
||||
extern FD_space * fd_space;
|
||||
extern FD_matrix * fd_matrix;
|
||||
extern FD_citation_form * citation_form;
|
||||
extern FD_bibitem_form * bibitem_form;
|
||||
extern FD_include * form;
|
||||
extern FD_index_form * index_form;
|
||||
@ -170,11 +169,6 @@ void CloseAllBufferRelatedDialogs()
|
||||
fl_hide_form(fd_matrix->matrix);
|
||||
}
|
||||
}
|
||||
if (citation_form) {
|
||||
if (citation_form->form->visible) {
|
||||
fl_hide_form(citation_form->form);
|
||||
}
|
||||
}
|
||||
if (bibitem_form) {
|
||||
if (bibitem_form->bibitem_form->visible) {
|
||||
fl_hide_form(bibitem_form->bibitem_form);
|
||||
@ -321,11 +315,6 @@ void updateAllVisibleBufferRelatedDialogs()
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (citation_form) {
|
||||
if (citation_form->form->visible) {
|
||||
fl_hide_form(citation_form->form);
|
||||
}
|
||||
}
|
||||
if (bibitem_form) {
|
||||
if (bibitem_form->bibitem_form->visible) {
|
||||
fl_hide_form(bibitem_form->bibitem_form);
|
||||
|
@ -2378,27 +2378,22 @@ string LyXFunc::Dispatch(int ac,
|
||||
}
|
||||
break;
|
||||
|
||||
case LFUN_CREATE_CITATION:
|
||||
{
|
||||
owner->getDialogs()->createCitation( argument );
|
||||
}
|
||||
break;
|
||||
|
||||
case LFUN_INSERT_CITATION:
|
||||
{
|
||||
InsetCitation * new_inset = new InsetCitation();
|
||||
// ale970405
|
||||
// The note, if any, must be after the key, delimited
|
||||
// by a | so both key and remark can have spaces.
|
||||
if (!argument.empty()) {
|
||||
string lsarg(argument);
|
||||
if (contains(lsarg, "|")) {
|
||||
new_inset->setContents(token(lsarg, '|', 0));
|
||||
new_inset->setOptions(token(lsarg, '|', 1));
|
||||
} else
|
||||
new_inset->setContents(lsarg);
|
||||
if (!owner->view()->insertInset(new_inset))
|
||||
delete new_inset;
|
||||
} else {
|
||||
if (owner->view()->insertInset(new_inset))
|
||||
new_inset->Edit(owner->view(), 0, 0, 0);
|
||||
else
|
||||
delete new_inset;
|
||||
}
|
||||
{
|
||||
string keys = token(argument, '|', 0);
|
||||
string text = token(argument, '|', 1);
|
||||
|
||||
InsetCitation * inset = new InsetCitation( keys, text );
|
||||
if (!owner->view()->insertInset(inset))
|
||||
delete inset;
|
||||
else
|
||||
owner->view()->updateInset( inset, true );
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -1864,7 +1864,7 @@ void Menus::ShowInsertMenu(FL_OBJECT * ob, long)
|
||||
case 12: tmpfunc->Dispatch(LFUN_INSERT_NOTE); break;
|
||||
case 13: tmpfunc->Dispatch(LFUN_INSERT_LABEL); break;
|
||||
case 14: tmpfunc->Dispatch(LFUN_INSERT_REF); break;
|
||||
case 15: tmpfunc->Dispatch(LFUN_INSERT_CITATION); break;
|
||||
case 15: tmpfunc->Dispatch(LFUN_CREATE_CITATION); break;
|
||||
case 16: tmpfunc->Dispatch(LFUN_INDEX_INSERT); break;
|
||||
case 17: tmpfunc->Dispatch(LFUN_INDEX_INSERT_LAST); break;
|
||||
case 18: tmpfunc->Dispatch(LFUN_URL); break;
|
||||
|
@ -501,7 +501,7 @@ void LyXText::draw(BufferView * bview, Row const * row,
|
||||
if (c == LyXParagraph::META_INSET) {
|
||||
Inset * tmpinset = row->par()->GetInset(pos);
|
||||
if (tmpinset) {
|
||||
tmpinset->update(bview, font, false);
|
||||
// tmpinset->update(bview, font, false);
|
||||
tmpinset->draw(bview, font, offset+row->baseline(), x,
|
||||
cleared);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user